@cashu/cashu-ts
    Preparing search index...

    Class AuthManager

    AuthManager.

    • Owns CAT lifecycle (stores, optional refresh via attached OIDCAuth)
    • Mints and serves BATs (NUT-22)
    • Validates DLEQs for BATs per NUT-12.
    • Supplies serialized BATs for 'Blind-auth' and CAT for 'Clear-auth'

    Implements

    Index

    Constructors

    Accessors

    Methods

    • Attach an OIDCAuth instance so this manager can refresh CATs. Registers a listener to update internal CAT/refresh state on new tokens.

      Parameters

      Returns this

    • Ensure there are enough BAT tokens (topping up if needed)

      Parameters

      • minTokens: number

        Minimum tokens needed.

      Returns Promise<void>

    • Ensure a valid CAT is available (refresh if expiring soon). Returns a token safe to send right now, or undefined if unobtainable.

      Parameters

      • OptionalminValidSecs: number

      Returns Promise<undefined | string>

    • Gets a Blind Authentication Token (BAT)

      Parameters

      • to: { method: "GET" | "POST"; path: string }

        Call (not used in our implementation)

      Returns Promise<string>

      The serialized BAT ready to insert into request header.

    • Replace or merge the current BAT pool with previously persisted BATs.

      Parameters

      • proofs: Proof[]
      • mode: "replace" | "merge" = 'replace'

      Returns void