Interface for the Bitcoin wallet plugin

interface NostrConnectorPluginInterface {
    cleanup(): void;
    connectBitcoinWallet(
        type?: "nostr" | "alby" | "manual",
    ): Promise<ConnectionResult>;
    generateCredentials(address: string): Promise<NostrConnectorCredentials>;
    generatePassword(signature: string): Promise<string>;
    isAvailable(): boolean;
    login(address: string): Promise<AuthResult>;
    signUp(address: string): Promise<AuthResult>;
    verifySignature(
        message: string,
        signature: string,
        address: string,
    ): Promise<boolean>;
}

Implemented by

Methods

  • Release resources and clean up event listeners

    Returns void

  • Connect to a Bitcoin wallet

    Parameters

    • Optionaltype: "nostr" | "alby" | "manual"

      Type of wallet to connect to

    Returns Promise<ConnectionResult>

    Promise with the connection result

  • Generate a password based on a signature

    Parameters

    • signature: string

      Signature

    Returns Promise<string>

    Promise with the generated password

  • Check if any Bitcoin wallet is available in the browser

    Returns boolean

    true if a wallet is available, false otherwise

  • Login with Bitcoin wallet

    Parameters

    • address: string

      Bitcoin address

    Returns Promise<AuthResult>

    Promise with the operation result

  • Signup with Bitcoin wallet

    Parameters

    • address: string

      Bitcoin address

    Returns Promise<AuthResult>

    Promise with the operation result

  • Verify a signature

    Parameters

    • message: string

      Signed message

    • signature: string

      Signature to verify

    • address: string

      The Bitcoin address that supposedly created the signature

    Returns Promise<boolean>

    Promise that resolves to true if the signature is valid