mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 15:14:20 +01:00
- Add project structure with TypeScript, React, and Vite - Implement nostr authentication using browser extension (NIP-07) - Add NIP-51 compliant bookmark fetching and display - Create minimal UI with login and bookmark components - Integrate applesauce-core and applesauce-react libraries - Add responsive styling with dark/light mode support - Include comprehensive README with setup instructions This is a minimal MVP for a nostr bookmark client that allows users to view their bookmarks according to NIP-51 specification.
51 lines
2.7 KiB
TypeScript
51 lines
2.7 KiB
TypeScript
import { ISigner } from "applesauce-signers";
|
|
import { BehaviorSubject } from "rxjs";
|
|
import { IAccount, IAccountConstructor, SerializedAccount } from "./types.js";
|
|
export declare class AccountManager<Metadata extends unknown = any> {
|
|
types: Map<string, IAccountConstructor<any, any, Metadata>>;
|
|
active$: BehaviorSubject<IAccount<any, any, Metadata> | undefined>;
|
|
get active(): IAccount<any, any, Metadata> | undefined;
|
|
accounts$: BehaviorSubject<IAccount<any, any, Metadata>[]>;
|
|
get accounts(): IAccount<any, any, Metadata>[];
|
|
/** Proxy signer for currently active account */
|
|
signer: ISigner;
|
|
/** Disable request queueing for any accounts added to this manager */
|
|
disableQueue?: boolean;
|
|
constructor();
|
|
/** Add account type class */
|
|
registerType<S extends ISigner>(accountType: IAccountConstructor<S, any, Metadata>): void;
|
|
/** Remove account type */
|
|
unregisterType(type: string): void;
|
|
/** gets an account in the manager */
|
|
getAccount<Signer extends ISigner>(id: string | IAccount<Signer, any, Metadata>): IAccount<Signer, any, Metadata> | undefined;
|
|
/** Return the first account for a pubkey */
|
|
getAccountForPubkey(pubkey: string): IAccount<any, any, Metadata> | undefined;
|
|
/** Returns all accounts for a pubkey */
|
|
getAccountsForPubkey(pubkey: string): IAccount<any, any, Metadata>[];
|
|
/** adds an account to the manager */
|
|
addAccount(account: IAccount<any, any, Metadata>): void;
|
|
/** Removes an account from the manager */
|
|
removeAccount(account: string | IAccount<any, any, Metadata>): void;
|
|
/** Replaces an account with another */
|
|
replaceAccount(old: string | IAccount<any, any, Metadata>, account: IAccount<any, any, Metadata>): void;
|
|
/** Returns the currently active account */
|
|
getActive(): IAccount<any, any, Metadata> | undefined;
|
|
/** Sets the currently active account */
|
|
setActive(id: string | IAccount<any, any, Metadata>): void;
|
|
/** Clears the currently active account */
|
|
clearActive(): void;
|
|
/** sets the metadata on an account */
|
|
setAccountMetadata(id: string | IAccount<any, any, Metadata>, metadata: Metadata): void;
|
|
/** sets the metadata on an account */
|
|
getAccountMetadata(id: string | IAccount<any, any, Metadata>): Metadata | undefined;
|
|
/** Removes all metadata on the account */
|
|
clearAccountMetadata(id: string | IAccount<any, any, Metadata>): void;
|
|
/** Returns an array of serialized accounts */
|
|
toJSON(quite?: boolean): SerializedAccount<any, Metadata>[];
|
|
/**
|
|
* Restores all accounts from an array of serialized accounts
|
|
* NOTE: this will clear all existing accounts
|
|
*/
|
|
fromJSON(accounts: SerializedAccount<any, Metadata>[], quite?: boolean): void;
|
|
}
|