mirror of
https://github.com/dergigi/boris.git
synced 2026-01-07 00:44:52 +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.
50 lines
2.5 KiB
TypeScript
50 lines
2.5 KiB
TypeScript
import { EventTemplate, Filter, NostrEvent } from "nostr-tools";
|
|
import { ObservableInput } from "rxjs";
|
|
export type ISigner = {
|
|
getPublicKey: () => Promise<string>;
|
|
signEvent: (template: EventTemplate) => Promise<NostrEvent>;
|
|
nip04?: {
|
|
encrypt: (pubkey: string, plaintext: string) => Promise<string>;
|
|
decrypt: (pubkey: string, ciphertext: string) => Promise<string>;
|
|
};
|
|
nip44?: {
|
|
encrypt: (pubkey: string, plaintext: string) => Promise<string>;
|
|
decrypt: (pubkey: string, ciphertext: string) => Promise<string>;
|
|
};
|
|
};
|
|
/** @deprecated Use ISigner instead */
|
|
export type Nip07Interface = ISigner;
|
|
/** A method used to subscribe to events on a set of relays */
|
|
export type NostrSubscriptionMethod = (relays: string[], filters: Filter[]) => ObservableInput<NostrEvent | string>;
|
|
/** A method used for publishing an event, can return a Promise that completes when published or an Observable that completes when published*/
|
|
export type NostrPublishMethod = (relays: string[], event: NostrEvent) => Promise<any> | ObservableInput<any>;
|
|
/** A simple pool type that combines the subscription and publish methods */
|
|
export type NostrPool = {
|
|
subscription: NostrSubscriptionMethod;
|
|
publish: NostrPublishMethod;
|
|
};
|
|
/** Options for setting the subscription and publish methods */
|
|
export type NostrConnectionMethodsOptions = {
|
|
/** An optional method for subscribing to relays */
|
|
subscriptionMethod?: NostrSubscriptionMethod;
|
|
/** An optional method for publishing events */
|
|
publishMethod?: NostrPublishMethod;
|
|
/** An optional pool for connection methods */
|
|
pool?: NostrPool;
|
|
};
|
|
/** A class that implements has global fallback methods for subscription and publish methods */
|
|
export interface NostrConnectionClassMethods {
|
|
new (...args: any[]): any;
|
|
/** A fallback method to use for subscriptionMethod if none is passed in when creating the client */
|
|
subscriptionMethod: NostrSubscriptionMethod | undefined;
|
|
/** A fallback method to use for publishMethod if none is passed in when creating the client */
|
|
publishMethod: NostrPublishMethod | undefined;
|
|
/** A fallback pool to use if none is pass in when creating the signer */
|
|
pool: NostrPool | undefined;
|
|
}
|
|
/** Get the subscription and publish methods for a NostrConnect class */
|
|
export declare function getConnectionMethods(options: NostrConnectionMethodsOptions, cls?: NostrConnectionClassMethods): {
|
|
subscriptionMethod: NostrSubscriptionMethod;
|
|
publishMethod: NostrPublishMethod;
|
|
};
|