UNPKG

cose-kit

Version:

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

41 lines (40 loc) 1.43 kB
import { KeyLike } from "jose"; import { COSEVerifyGetKey } from "./jwks/local.js"; import { Sign1 } from "./cose/Sign1.js"; import { Sign } from "./cose/Sign.js"; import { Mac0 } from "./cose/Mac0.js"; type VerifyResult = { isValid: boolean; decoded: Sign1; key?: KeyLike | Uint8Array; }; type MultiSigVerifyResult = { isValid: boolean; decoded: Sign; key?: KeyLike | Uint8Array; }; /** * Verify the signature of a COSE_Sign1 message. * * @param cose the buffer containing the Cose Sign1 tagged or untagged message. * @param key the key to use to verify the signature. * @returns */ export declare const coseVerify: (cose: Uint8Array, key: KeyLike | Uint8Array | COSEVerifyGetKey, externalAAD?: Uint8Array) => Promise<VerifyResult>; /** * Verify the signature of a COSE_Sign message. * * @param cose the buffer containing the Cose Sign tagged message. * @param keys the keys to use to verify the signature. * @returns */ export declare const coseVerifyMultiSignature: (cose: Uint8Array, keys: KeyLike[] | Uint8Array[] | COSEVerifyGetKey) => Promise<MultiSigVerifyResult>; export declare const coseVerifyX509: (cose: Uint8Array, roots: string[]) => Promise<{ isValid: boolean; decoded: Sign | Sign1; }>; export declare const coseVerifyMAC0: (cose: Uint8Array, key: KeyLike | Uint8Array, externalAAD?: Uint8Array) => Promise<{ isValid: boolean; decoded: Mac0; }>; export {};