cose-kit
Version:
This is an early prototype of a RFC8152 COSE library for node.js.
29 lines (28 loc) • 1.5 kB
TypeScript
import { KeyLike } from 'jose';
import { WithHeaders } from './WithHeaders.js';
import { MacProtectedHeaders, UnprotectedHeaders, SupportedMacAlg } from '../headers.js';
export declare class Mac0 extends WithHeaders {
readonly payload: Uint8Array;
tag: Uint8Array;
constructor(protectedHeaders: Map<number, unknown> | Uint8Array, unprotectedHeaders: Map<number, unknown>, payload: Uint8Array, tag: Uint8Array);
private static createMAC0;
getContentForEncoding(): (Uint8Array | Map<number, unknown> | undefined)[];
encode(): Buffer;
/**
* Verifies the signature of this instance using the given key.
*
* @param {KeyLike | Uint8Array} key - The key to verify the signature with.
* @param {Uint8Array} externalAAD - External Additional Associated Data
* @param {Uint8Array} detachedPayload - The detached payload to verify the signature with.
* @returns {Boolean} - The result of the signature verification.
*/
verify(key: KeyLike | Uint8Array, externalAAD?: Uint8Array, detachedPayload?: Uint8Array): Promise<boolean>;
get alg(): number | undefined;
get algName(): SupportedMacAlg | undefined;
hasSupportedAlg(): boolean;
/**
* compares the tag of this instance with the tag of the given instance
*/
areEqual(mac0: Mac0): boolean;
static create(protectedHeaders: MacProtectedHeaders, unprotectedHeaders: UnprotectedHeaders | undefined, payload: Uint8Array, key: KeyLike | Uint8Array): Promise<Mac0>;
}