Interface NDKSigner

Interface for NDK signers.

interface NDKSigner {
    blockUntilReady(): Promise<NDKUser>;
    decrypt(sender: NDKUser, value: string, type?: ENCRYPTION_SCHEMES): Promise<string>;
    encrypt(recipient: NDKUser, value: string, type?: ENCRYPTION_SCHEMES): Promise<string>;
    nip04Decrypt(sender: NDKUser, value: string): Promise<string>;
    nip04Encrypt(recipient: NDKUser, value: string): Promise<string>;
    nip44Decrypt(sender: NDKUser, value: string): Promise<string>;
    nip44Encrypt(recipient: NDKUser, value: string): Promise<string>;
    relays?(ndk?: default): Promise<NDKRelay[]>;
    sign(event: NostrEvent): Promise<string>;
    user(): Promise<NDKUser>;
}

Implemented by

Methods

  • Blocks until the signer is ready and returns the associated NDKUser.

    Returns Promise<NDKUser>

    A promise that resolves to the NDKUser instance.

  • Encrypts the given Nostr event for the given recipient.

    Parameters

    • recipient: NDKUser

      The recipient of the encrypted value.

    • value: string

      The value to be encrypted.

    • Optionaltype: ENCRYPTION_SCHEMES

      The encryption scheme to use. Defaults to "nip04".

    Returns Promise<string>

  • Signs the given Nostr event.

    Parameters

    Returns Promise<string>

    A promise that resolves to the signature of the signed event.