import type { NPool } from '@nostrify/nostrify'; /** Parameters for initiating a nostrconnect:// session. */ export interface NostrConnectParams { /** The ephemeral client secret key. */ clientSecretKey: Uint8Array; /** The ephemeral client public key (derived from clientSecretKey). */ clientPubkey: string; /** A random secret for validating the signer's response. */ secret: string; /** Relay URLs for NIP-46 communication. */ relays: string[]; } /** * Progress phases emitted by {@link NLogin.fromNostrConnect} as the handshake * advances. Surfacing these lets the UI show live feedback to the user — * particularly important on mobile, where the browser is backgrounded while * the signer app runs and a frozen dialog is indistinguishable from a hang. * * - `'awaiting-connect'`: The subscription is open; we're waiting for the * remote signer to publish its kind-24133 connect-ack event. * - `'getting-public-key'`: The connect-ack arrived. We're now issuing the * NIP-46 `get_public_key` RPC so the login can be registered against a * known user pubkey. */ export type NostrConnectStatus = 'awaiting-connect' | 'getting-public-key'; /** Options for generating a nostrconnect:// URI. */ export interface NostrConnectURIOptions { /** Application name to include in the URI. */ name?: string; /** Callback URL for mobile signer apps to redirect back to. */ callback?: string; } /** Generate random parameters for a nostrconnect:// session. */ export declare function generateNostrConnectParams(relays: string[]): NostrConnectParams; /** Generate a nostrconnect:// URI from the given parameters. */ export declare function generateNostrConnectURI(params: NostrConnectParams, opts?: NostrConnectURIOptions): string; /** An object represeting any supported Nostr login credentials. */ export type NLoginType = NLoginNsec | NLoginBunker | NLoginExtension | NLoginOther; /** Nostr login with nsec. */ export type NLoginNsec = NLoginBase<'nsec', { nsec: `nsec1${string}`; }>; /** NIP-46 (aka remote signer) login. */ export type NLoginBunker = NLoginBase<'bunker', { bunkerPubkey: string; clientNsec: `nsec1${string}`; relays: string[]; }>; /** NIP-07 (browser extension) login. */ export type NLoginExtension = NLoginBase<'extension', null>; /** Additional login types created by the library user. */ export type NLoginOther = NLoginBase<`x-${string}`, { [key: string]: unknown; }>; /** Base properties shared by Nostr login objects. */ interface NLoginBase { id: string; type: T; pubkey: string; createdAt: string; data: D; } /** Class representing Nostr login credentials. */ export declare class NLogin implements NLoginBase { id: string; type: T; pubkey: string; createdAt: string; data: D; constructor(type: T, pubkey: string, data: D); /** Create a login object from an nsec. */ static fromNsec(nsec: string): NLoginNsec; /** Create a login object from a bunker URI. */ static fromBunker(uri: string, pool: NPool): Promise; /** * Create a login object via client-initiated NIP-46 (nostrconnect://). * * The client displays a QR code or deep link containing the `nostrconnect://` URI, * then waits for the remote signer to respond over the relay. Once the signer responds, * the connection is validated and an `NLoginBunker` is returned. * * `opts.onStatus` is invoked synchronously as the handshake progresses, so the caller * can render "waiting for signer..." → "getting public key..." feedback in the UI. * See {@link NostrConnectStatus} for the phases. */ static fromNostrConnect(params: NostrConnectParams, pool: NPool, opts?: { signal?: AbortSignal; onStatus?: (status: NostrConnectStatus) => void; }): Promise; /** Create a login object from a browser extension. */ static fromExtension(): Promise; /** Convert to a JSON-serializable object. */ toJSON(): NLoginBase; } export {}; //# sourceMappingURL=NLogin.d.ts.map