@x402-hpke/node
Version:
Provider-agnostic HPKE envelope library for x402 (Node) — cross-language interop with Python
32 lines (31 loc) • 959 B
TypeScript
export type OkpJwk = {
kty: "OKP";
crv: "X25519";
x: string;
d?: string;
kid?: string;
use?: string;
};
export type Jwks = {
keys: OkpJwk[];
};
export declare function generateKeyPair(): Promise<{
publicJwk: OkpJwk;
privateJwk: OkpJwk;
}>;
export declare function generatePublicJwk(): Promise<OkpJwk>;
export declare function selectJwkFromJwks(jwks: {
keys: OkpJwk[];
}, kid: string): OkpJwk | undefined;
export declare function jwkToPublicKeyBytes(jwk: OkpJwk): Uint8Array;
export declare function jwkToPrivateKeyBytes(jwk: OkpJwk): Uint8Array;
export declare function fetchJwks(url: string, opts?: {
minTtlMs?: number;
maxTtlMs?: number;
}): Promise<Jwks>;
export declare function setJwks(url: string, jwks: Jwks, ttlMs?: number): void;
export declare function generateJwks(keys: Array<{
jwk: OkpJwk;
kid: string;
}>): Jwks;
export declare function generateSingleJwks(jwk: OkpJwk, kid: string): Jwks;