@synonymdev/pubky
    Preparing search index...

    Class GrantAuthFlow

    Start and control a grant-backed pubkyauth authorization flow.

    Typical flow:

    1. GrantAuthFlow.start(...) or pubky.startGrantAuthFlow(...)
    2. Show authorizationUrl() as QR/deeplink to the user's signing device
    3. awaitApproval() to receive a grant-backed, self-refreshing Session
    Index
    authorizationUrl: string

    Return the authorization deep link (URL) to show as QR or open on the signer device.

    isDelegationAvailable: boolean

    Whether delegated grant auth is available in the current JS runtime.

    This checks for a secure browser context with WebCrypto crypto.subtle and IndexedDB. It is a coarse synchronous feature-detection helper only; some runtimes expose those primitives without Ed25519 support.

    • Returns void

    • Block until the user approves on their signer device; returns a grant-backed Session.

      Returns Promise<Session>

    • Returns void

    • Save sensitive state required to resume this delegated pending grant flow.

      This includes either a shared relay secret or a temporary HPKE recipient secret. Store it only temporarily and delete it once the flow completes or is abandoned.

      Returns string

    • Save sensitive state required to resume this pending local grant flow.

      Returns string

      Opaque state for GrantAuthFlow.resume() or pubky.resumeGrantAuthFlow().

    • Non-blocking single poll step (advanced UIs).

      Returns Promise<Session | undefined>

      A session if the approval arrived, otherwise undefined.

    • Resume a previously saved pending grant auth flow (standalone). Prefer pubky.resumeGrantAuthFlow() to reuse a facade client.

      Security: savedState contains the PoP client private key and either a shared relay secret or a temporary HPKE recipient secret. Store it only temporarily and delete it once the flow completes or is abandoned.

      Parameters

      • saved_state: string

      Returns GrantAuthFlow

      A flow reconnected to the original relay channel.

    • Resume a previously saved pending delegated grant auth flow.

      Runtime: delegated grant keys require a secure browser context with WebCrypto crypto.subtle and IndexedDB. The saved keyId must still exist in IndexedDB for the same origin. Unsupported runtimes reject with ClientStateError.

      Parameters

      • saved_state: string

      Returns Promise<GrantAuthFlow>

    • Start a grant-backed flow with a new DHT client. Prefer pubky.startGrantAuthFlow() to reuse a facade DHT client.

      Parameters

      • capabilities: Capabilities

        Comma-separated capabilities, e.g. "/pub/app/:rw,/priv/foo.txt:r". Empty string is allowed (no scopes).

      • kind: AuthFlowKind

        The kind of authentication flow to perform.

      • options: GrantAuthFlowOptions

        Options for the grant flow: { clientId, relay?, xCallback? }.

      Returns GrantAuthFlow

      A running grant auth flow. Call authorizationUrl() to show the deep link, then awaitApproval() to receive a grant-backed Session.

    • Start a browser delegated grant-backed flow.

      The SDK creates a fresh non-extractable WebCrypto Ed25519 key in IndexedDB and uses that key for grant Proof-of-Possession signing.

      Runtime: delegated grant keys require a secure browser context with WebCrypto crypto.subtle and IndexedDB. Unsupported runtimes reject with ClientStateError.

      Parameters

      Returns Promise<GrantAuthFlow>