import { LedgerHandle } from '../common/ledger-handle'; import { LedgerKeyPair } from '../records/ledger-signer'; /** * Setup of a header that is going to be protected * within the request hash. */ export type ProtectedHeader = { name: string; value: string; }; /** * Define config parameters for creating a request hash */ export type LedgerRequestHashParams = { /** * Define HTTP method of request */ method: 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE'; /** * HTTP request path with query parameters * i.e /resource/1/values?query1=value&query2=value */ url: string; /** * List of protected headers that must be checked within the hash * i.e: x-api-key, content-type, etc */ protectedHeaders?: ProtectedHeader[]; /** * Request body to be added to hash */ body?: Record; }; /** * Represents authentication params responsible for composing JWT * and allow users for transactioning to ledger. */ export type JwtOptions = { /** * Represents a client identifier. * */ iss: string; /** * Represents a user identifier of the token sender. * */ sub: string; /** * Represents a recipient for which a token is intended, ledger public key or handle * * */ aud: string; /** * Time after which a token expires, seconds since epoch. * */ exp: number; /** * Unique id of the token, can be used to prevent replay attacks * */ jti?: string; /** * Defines the request hash claim (hsh) must * be created and sent. * * Set as "true" if this value is not * given. */ createHsh?: boolean; /** * ED25519 Key pair for signing token * */ keyPair: LedgerKeyPair; /** * Token verification key identifier. * Accepts a public key or a ledger signer handle. */ kid?: LedgerHandle | LedgerKeyPair['public']; /** * Token override, should be undefined for JwtOptions */ overrideToken?: undefined; }; export type JwtOverride = { /** * Token override. * If set, this token will be used instead of a generated token when sending * requests. Other properties of this object will be ignored in that case. */ overrideToken: string; }; /** * Represents authentication params responsible for composing JWT * and allow users for transactioning to ledger. */ export type JwtConfig = JwtOptions | JwtOverride; export declare function isJwtOptions(secure: Partial): secure is JwtOptions;