import { SignedEvent, StampedEvent } from "@welshman/util"; import { SignerOptions, ISigner } from "../util.js"; export type Nip55AppInfo = { name: string; packageName: string; iconUrl?: string; }; export type Nip55Crypt = (packageName: string, text: string, id: string, pubKey: string, npub: string) => Promise<{ result: string; }>; /** * The part of nostr-signer-capacitor-plugin's `NostrSignerPlugin` that * `Nip55Signer` uses, declared structurally so this package never imports the * plugin. It only exists in Capacitor apps, and a bundler can't resolve a * package that was never installed. */ export type Nip55 = { setPackageName: (packageName: string) => Promise; getInstalledSignerApps: () => Promise<{ apps: Nip55AppInfo[]; }>; getPublicKey: (packageName?: string) => Promise<{ npub: string; }>; signEvent: (packageName: string, eventJson: string, id: string, npub: string) => Promise<{ event: string; }>; nip04Encrypt: Nip55Crypt; nip04Decrypt: Nip55Crypt; nip44Encrypt: Nip55Crypt; nip44Decrypt: Nip55Crypt; }; /** * Register the NIP-55 plugin. Capacitor apps should call this once at startup: * * import {NostrSignerPlugin} from "nostr-signer-capacitor-plugin" * import {setNip55Plugin} from "@welshman/signer" * * setNip55Plugin(NostrSignerPlugin) */ export declare const setNip55Plugin: (nip55: Nip55 | undefined) => void; export declare const getNip55Plugin: () => Nip55 | undefined; /** Installed signer apps, or an empty list if no plugin has been registered. */ export declare const getNip55: () => Promise; export declare class Nip55Signer implements ISigner { #private; readonly packageName: string; constructor(packageName: string, pubkey?: string); getPubkey: (options?: SignerOptions) => Promise; sign: (template: StampedEvent, options?: SignerOptions) => Promise; nip04: { encrypt: (pubkey: string, message: string, options?: SignerOptions) => Promise; decrypt: (pubkey: string, message: string, options?: SignerOptions) => Promise; }; nip44: { encrypt: (pubkey: string, message: string, options?: SignerOptions) => Promise; decrypt: (pubkey: string, message: string, options?: SignerOptions) => Promise; }; } //# sourceMappingURL=nip55.d.ts.map