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

    Class OIDCAuth

    Index

    Constructors

    Methods

    • Subscribe to token updates. Listeners are called after the primary onTokens callback.

      Parameters

      Returns void

    • Build an Authorization Code + PKCE URL.

      Parameters

      • input: {
            codeChallenge: string;
            codeChallengeMethod?: "S256" | "plain";
            redirectUri: string;
            scope?: string;
            state?: string;
        }

      Returns Promise<string>

    • Exchange an auth code for tokens, using the PKCE verifier.

      Parameters

      • input: { code: string; codeVerifier: string; redirectUri: string }

      Returns Promise<TokenResponse>

    • Generate a PKCE verifier and S256 challenge.

      • Verifier: base64url of random bytes, length >= 43, RFC 7636 compliant.
      • Challenge: base64url(sha256(verifier))

      Returns { challenge: string; verifier: string }

    • One call convenience for Device Code flow.

      Parameters

      • intervalSec: number = 5

        Desired polling interval in seconds.

      Returns Promise<
          DeviceStartResponse & {
              cancel: () => void;
              poll: () => Promise<TokenResponse>;
          },
      >

      The start fields and helpers to poll or cancel.

      Polling interval will be the MAX of intervalSec and Mint interval.

    • Parameters

      • info: {
            nuts: {
                "10"?: { supported: boolean };
                "11"?: { supported: boolean };
                "12"?: { supported: boolean };
                "14"?: { supported: boolean };
                "15"?: { methods: MPPMethod[] };
                "17"?: { supported: WebSocketSupport[] };
                "20"?: { supported: boolean };
                "21"?: {
                    client_id: string;
                    openid_discovery: string;
                    protected_endpoints?: { method: "GET" | "POST"; path: string }[];
                };
                "22"?: {
                    bat_max_mint: number;
                    protected_endpoints: { method: "GET"
                    | "POST"; path: string }[];
                };
                "4": { disabled: boolean; methods: SwapMethod[] };
                "5": { disabled: boolean; methods: SwapMethod[] };
                "7"?: { supported: boolean };
                "8"?: { supported: boolean };
                "9"?: { supported: boolean };
            };
        }
      • Optionalopts: OIDCAuthOptions

      Returns OIDCAuth