Plugin for managing Bitcoin wallet functionality in ShogunCore Supports Alby, Nostr extensions, or direct key management

Hierarchy (View Summary)

Implements

Constructors

Properties

_category?: PluginCategory

Categoria del plugin

bitcoinConnector: null | NostrConnector = null
core: null | ShogunCore = null

Riferimento all'istanza di ShogunCore

description: string = "Provides Bitcoin wallet connection and authentication for ShogunCore"

Descrizione opzionale del plugin

name: string = "nostr"

Nome univoco del plugin - deve essere implementato dalle sottoclassi

signer: null | NostrSigner = null
version: string = "1.0.0"

Versione del plugin - deve essere implementata dalle sottoclassi

Methods

  • Verifica che il plugin sia stato inizializzato prima di usare il core

    Returns ShogunCore

    L'istanza di ShogunCore non null

    Error se il plugin non è stato inizializzato

  • Private

    Assicura che il signer sia inizializzato

    Returns NostrSigner

  • Clear signature cache for better user recovery

    Parameters

    • Optionaladdress: string

      Optional specific address to clear, or clear all if not provided

    Returns void

  • Connect to a Bitcoin wallet

    Parameters

    • type: "nostr" | "alby" | "manual" = "nostr"

      Type of wallet to connect to

    Returns Promise<ConnectionResult>

    Promise with the connection result

  • Creates an authenticator function for Nostr signing

    Parameters

    • address: string

    Returns (data: any) => Promise<string>

  • Creates a derived key pair from Nostr credential

    Parameters

    • address: string
    • Optionalextra: string[]

    Returns Promise<{ epriv: string; epub: string; priv: string; pub: string }>

  • Creates a Gun user from Nostr signing credential This ensures the SAME user is created as with normal approach

    Parameters

    • address: string

    Returns Promise<{ error?: string; success: boolean; userPub?: string }>

  • Creates a new Nostr signing credential CONSISTENT with normal Nostr approach

    Parameters

    • address: string

    Returns Promise<NostrSigningCredential>

  • Distrugge il plugin e libera le risorse

    Returns void

  • Emits an event with arguments

    Parameters

    • event: EventType
    • Optionaldata: unknown

    Returns boolean

  • Generate a password based on a signature

    Parameters

    • signature: string

      Signature

    Returns Promise<string>

    Promise with the generated password

  • Get the Gun user public key for a signing credential

    Parameters

    • address: string

    Returns undefined | string

  • Get the password (for consistency checking)

    Parameters

    • address: string

    Returns undefined | string

  • Get signing credential by address

    Parameters

    • address: string

    Returns undefined | NostrSigningCredential

  • Check if Alby extension is available Note: Alby is deprecated in favor of Nostr

    Returns boolean

  • Check if Nostr extension is available

    Returns boolean

  • List all signing credentials

    Returns NostrSigningCredential[]

  • Login with Bitcoin wallet

    Parameters

    • address: string

      Bitcoin address

    Returns Promise<AuthResult>

    Authentication result

    Authenticates the user using Bitcoin wallet credentials after signature verification

  • Convenience method that matches the interface pattern

    Parameters

    • address: string

    Returns Promise<AuthResult>

  • Removes an event listener

    Parameters

    • event: EventType
    • listener: (data: unknown) => void

    Returns void

  • Registers an event listener

    Parameters

    • event: EventType
    • listener: (data: unknown) => void

    Returns void

  • Registers a one-time event listener

    Parameters

    • event: EventType
    • listener: (data: unknown) => void

    Returns void

  • Removes all listeners for an event or all events

    Parameters

    • Optionalevent: EventType

    Returns void

  • Remove a signing credential

    Parameters

    • address: string

    Returns boolean

  • Complete oneshot workflow that creates the SAME Gun user as normal approach This is the recommended method for oneshot signing with full consistency

    Parameters

    • address: string

    Returns Promise<
        {
            authenticator: (data: any) => Promise<string>;
            credential: NostrSigningCredential;
            gunUser: { error?: string; success: boolean; userPub?: string };
            password: string;
            username: string;
        },
    >

  • Register a new user with Bitcoin wallet

    Parameters

    • address: string

      Bitcoin address

    Returns Promise<AuthResult>

    Registration result

    Creates a new user account with Bitcoin wallet credentials

  • Convenience method that matches the interface pattern

    Parameters

    • address: string

    Returns Promise<AuthResult>

  • Signs data with derived keys after Nostr verification

    Parameters

    • data: any
    • address: string
    • Optionalextra: string[]

    Returns Promise<string>

  • Verify consistency between oneshot and normal approaches This ensures both approaches create the same Gun user

    Parameters

    • address: string
    • OptionalexpectedUserPub: string

    Returns Promise<
        {
            actualUserPub?: string;
            consistent: boolean;
            expectedUserPub?: string;
        },
    >

  • 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