JwtOptions contains configuration for JWT generation.

This interface holds all necessary parameters for generating a JWT token for authenticating with Coinbase's REST APIs. It supports both EC (ES256) and Ed25519 (EdDSA) keys.

interface JwtOptions {
    apiKeyId: string;
    apiKeySecret: string;
    audience?: string[];
    expiresIn?: number;
    requestHost?: null | string;
    requestMethod?: null | string;
    requestPath?: null | string;
}

Properties

apiKeyId: string

The API key ID

Examples: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' 'organizations/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/apiKeys/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

apiKeySecret: string

The API key secret

Examples: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==' (Edwards key (Ed25519)) '-----BEGIN EC PRIVATE KEY-----\n...\n...\n...==\n-----END EC PRIVATE KEY-----\n' (EC key (ES256))

audience?: string[]

Optional audience claim for the JWT

expiresIn?: number

Optional expiration time in seconds (defaults to 120)

requestHost?: null | string

The host for the request (e.g. 'api.cdp.coinbase.com'), or null for JWTs intended for websocket connections

requestMethod?: null | string

The HTTP method for the request (e.g. 'GET', 'POST'), or null for JWTs intended for websocket connections

requestPath?: null | string

The path for the request (e.g. '/platform/v1/wallets'), or null for JWTs intended for websocket connections