accounts
Version:
Tempo Accounts SDK
47 lines • 2.17 kB
TypeScript
import type { Chain, Transport } from 'viem';
import * as CliAuth from '../../CliAuth.js';
import { type Handler, from } from '../../Handler.js';
/**
* Instantiates a generic device-code handler for access-key bootstrap.
*
* Exposes 4 endpoints:
* - `GET /auth/pkce/pending/:code`
* - `POST /auth/pkce/code`
* - `POST /auth/pkce/poll/:code`
* - `POST /auth/pkce`
*
* @param {codeAuth.Options} options - Options.
* @returns {Handler} Request handler.
*/
export declare function codeAuth(options?: codeAuth.Options): Handler;
export declare namespace codeAuth {
type Options = from.Options & {
/**
* Supported chains. The handler resolves the client based on chain IDs carried
* by device-code requests and key authorizations.
* @default [tempo, tempoModerato, tempoDevnet]
*/
chains?: readonly [Chain, ...Chain[]] | undefined;
/** Maximum JSON request body size in bytes. @default 16384 */
maxBodyBytes?: number | undefined;
/** Time source used for TTL evaluation. */
now?: (() => number) | undefined;
/** Path prefix for the code auth endpoints. @default "/auth/pkce" */
path?: string | undefined;
/** Policy used to validate and default requested CLI auth fields. */
policy?: CliAuth.Policy | undefined;
/** Random byte generator used for device-code allocation. */
random?: ((size: number) => Uint8Array) | undefined;
/** Shared rate limiter across all CLI auth endpoints. Pass `false` to disable. */
rateLimit?: CliAuth.RateLimit | false | undefined;
/** Derives the rate-limit key from the request. Defaults to Cloudflare's trusted IP header, then `unknown`. */
rateLimitKey?: ((request: Request) => string) | undefined;
/** Device-code store. */
store?: CliAuth.Store | undefined;
/** Transports keyed by chain ID. Defaults to `http()` for each chain. */
transports?: Record<number, Transport> | undefined;
/** Pending entry TTL in milliseconds. @default 600000 */
ttlMs?: number | undefined;
};
}
//# sourceMappingURL=codeAuth.d.ts.map