Applesauce
    Preparing search index...

    Class NostrConnectProvider

    Implements

    Index
    bunkerSecret?: string

    The secret used to authorize clients to connect (the secret in a bunker:// URI)

    client?: string

    The connected client's public key

    connected: boolean = false

    Whether a client is connected (received a connect request)

    listening: boolean = false

    Whether the provider is listening for events

    log: Debugger = ...

    Internal logger

    onClientConnect?: (client: string) => any

    Callbacks

    onClientDisconnect?: (client: string) => any
    onConnect?: (
        client: string,
        permissions: string[],
    ) => boolean | Promise<boolean>

    A method used to accept or reject connect requests

    onLogout?: (client: string) => void | Promise<void>

    A method called when a client requests to logout (end the session)

    onNip04Decrypt?: (
        pubkey: string,
        ciphertext: string,
        client: string,
    ) => boolean | Promise<boolean>

    A method used to accept or reject nip04_decrypt requests

    onNip04Encrypt?: (
        pubkey: string,
        plaintext: string,
        client: string,
    ) => boolean | Promise<boolean>

    A method used to accept or reject nip04_encrypt requests

    onNip44Decrypt?: (
        pubkey: string,
        ciphertext: string,
        client: string,
    ) => boolean | Promise<boolean>

    A method used to accept or reject nip44_decrypt requests

    onNip44Encrypt?: (
        pubkey: string,
        plaintext: string,
        client: string,
    ) => boolean | Promise<boolean>

    A method used to accept or reject nip44_encrypt requests

    onSignEvent?: (
        draft: Helpers.EventTemplate,
        client: string,
    ) => boolean | Promise<boolean>

    A method used to accept or reject sign_event requests

    onSwitchRelays?: (client: string) => string[] | Promise<string[] | null> | null

    A method called when a client requests relay switching. Return new relay list or null if no change

    publishMethod: NostrPublishMethod

    A method that is called when an event needs to be published

    relays: string[]

    Relays to communicate over

    req?: Subscription

    The currently active REQ subscription

    seen: Map<string, number> = ...

    The timestamps of recently seen requests by id

    seenUntil: number = 0

    Requests at or before this timestamp are treated as seen, since their ids may have been forgotten

    signer: ISigner

    The identity signer (provider's identity)

    subscriptionMethod: NostrSubscriptionMethod

    The active nostr subscription

    upstream: ISigner

    The main signer for the actual signing operations

    MAX_SEEN: number = 1000

    The most request ids remembered before the oldest are forgotten

    pool: NostrPool | undefined = undefined

    A fallback pool to use if none is pass in when creating the provider

    publishMethod: NostrPublishMethod | undefined = undefined

    A fallback method to use for publishMethod if none is passed in when creating the provider

    subscriptionMethod: NostrSubscriptionMethod | undefined = undefined

    A fallback method to use for subscriptionMethod if none is passed in when creating the provider

    • Handle connect request

      Parameters

      • client: string
      • __namedParameters:
            | [string]
            | [string, string]
            | [string, string, string]
            | [string, string, string, string]

      Returns Promise<string>