UNPKG

cose-kit

Version:

This is an early prototype of a RFC8152 COSE library for node.js.

50 lines (49 loc) 2.15 kB
export declare const algs: Map<number, { name: string; hash?: string | undefined; }>; /** +-----------+-------+---------+----------+--------------------------+ | Name | Value | Hash | Tag | Description | | | | | Length | | +-----------+-------+---------+----------+--------------------------+ | HMAC | 4 | SHA-256 | 64 | HMAC w/ SHA-256 | | 256/64 | | | | truncated to 64 bits | | HMAC | 5 | SHA-256 | 256 | HMAC w/ SHA-256 | | 256/256 | | | | | | HMAC | 6 | SHA-384 | 384 | HMAC w/ SHA-384 | | 384/384 | | | | | | HMAC | 7 | SHA-512 | 512 | HMAC w/ SHA-512 | | 512/512 | | | | | +-----------+-------+---------+----------+--------------------------+ */ export declare const macAlgs: Map<number, { name: SupportedMacAlg; hash: string; length?: number | undefined; }>; export declare const macAlgsToValue: Map<SupportedMacAlg, number>; export declare const algsToValue: Map<string, number>; export declare const headers: { [k: string]: number; }; export type ProtectedHeaders = { alg?: 'EdDSA' | 'ES256' | 'ES384' | 'ES512' | 'PS256' | 'PS384' | 'PS512' | 'RS256' | 'RS384' | 'RS512'; crit?: number[]; ctyp?: number | string; [key: string]: unknown; }; export type SupportedMacAlg = 'HS256' | 'HS384' | 'HS512'; export type MacProtectedHeaders = { alg?: SupportedMacAlg; crit?: number[]; ctyp?: number | string; [key: string]: unknown; }; export type UnprotectedHeaders = { ctyp?: number | string; kid?: Uint8Array | string; x5chain?: Uint8Array | Uint8Array[]; }; export declare const encodeProtectedHeaders: (protectedHeaders: ProtectedHeaders | undefined) => any; export declare const mapUnprotectedHeaders: (unprotectedHeaders: UnprotectedHeaders | undefined) => Map<number, unknown>;