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.
42 lines
2.2 KiB
TypeScript
42 lines
2.2 KiB
TypeScript
import { ISigner } from "applesauce-signers";
|
|
import { BehaviorSubject } from "rxjs";
|
|
import { NostrEvent } from "nostr-tools";
|
|
import { EventTemplate, IAccount, SerializedAccount } from "./types.js";
|
|
/** An error thrown when a signer is used with the wrong pubkey */
|
|
export declare class SignerMismatchError extends Error {
|
|
}
|
|
/** A base class for all accounts */
|
|
export declare class BaseAccount<Signer extends ISigner, SignerData, Metadata extends unknown> implements IAccount<Signer, SignerData, Metadata> {
|
|
pubkey: string;
|
|
signer: Signer;
|
|
id: string;
|
|
get type(): string;
|
|
/** Disable request queueing */
|
|
disableQueue?: boolean;
|
|
metadata$: BehaviorSubject<Metadata | undefined>;
|
|
get metadata(): Metadata | undefined;
|
|
set metadata(metadata: Metadata);
|
|
get nip04(): ISigner["nip04"] | undefined;
|
|
get nip44(): ISigner["nip44"] | undefined;
|
|
constructor(pubkey: string, signer: Signer);
|
|
toJSON(): SerializedAccount<SignerData, Metadata>;
|
|
/** A method that wraps any signer interaction, this allows the account to wait for unlock or queue requests */
|
|
protected operation<T extends unknown>(operation: () => Promise<T>): Promise<T>;
|
|
/** Adds the common fields to the serialized output of a toJSON method */
|
|
protected saveCommonFields(json: Omit<SerializedAccount<SignerData, Metadata>, "id" | "type" | "metadata" | "pubkey">): SerializedAccount<SignerData, Metadata>;
|
|
/** Sets an accounts id and metadata. NOTE: This should only be used in fromJSON methods */
|
|
static loadCommonFields<T extends IAccount>(account: T, json: SerializedAccount<any, any>): T;
|
|
/** Gets the pubkey from the signer */
|
|
getPublicKey(): Promise<string>;
|
|
/** sign the event and make sure its signed with the correct pubkey */
|
|
signEvent(template: EventTemplate): Promise<NostrEvent>;
|
|
/** Aborts all pending requests in the queue */
|
|
abortQueue(reason: Error): void;
|
|
/** internal queue */
|
|
protected queueLength: number;
|
|
protected lock: Promise<any> | null;
|
|
protected abort: AbortController | null;
|
|
protected reduceQueue(): void;
|
|
protected waitForQueue<T extends unknown>(operation: () => Promise<T>): Promise<T>;
|
|
}
|