cose-kit
Version:
**DEPRECATED:** Use [@auth0/cose](https://www.npmjs.com/package/@auth0/cose).
37 lines (36 loc) • 1.89 kB
TypeScript
import { KeyLike } from 'jose';
import { COSEVerifyGetKey } from '../jwks/local.js';
import { ProtectedHeaders, UnprotectedHeaders } from '../headers.js';
import { SignatureBase, VerifyOptions } from './SignatureBase.js';
/**
* Decoded COSE_Sign1 structure.
*/
export declare class Sign1 extends SignatureBase {
readonly payload: Uint8Array;
constructor(protectedHeaders: Map<number, unknown> | Uint8Array, unprotectedHeaders: Map<number, unknown>, payload: Uint8Array, signature: Uint8Array);
getContentForEncoding(): (Uint8Array | Map<number, unknown> | undefined)[];
private static Signature1;
/**
*
* Verifies the signature of this instance using the given key.
*
* @param key {KeyLike | Uint8Array | COSEVerifyGetKey} - The key to verify the signature with.
* @param options {VerifyOptions} - Verify options
* @param options.algorithms {Algorithms[]} - List of allowed algorithms
* @param options.externalAAD {Uint8Array} - External Additional Associated Data
* @param options.detachedPayload {Uint8Array} - The detached payload to verify the signature with.
* @returns {Promise<void>}
*/
verify(key: KeyLike | Uint8Array | COSEVerifyGetKey, options?: VerifyOptions): Promise<void>;
verifyX509(roots: string[]): Promise<void>;
static sign(protectedHeaders: ProtectedHeaders | ConstructorParameters<typeof ProtectedHeaders>[0], unprotectedHeaders: UnprotectedHeaders | ConstructorParameters<typeof UnprotectedHeaders>[0] | undefined, payload: Uint8Array, key: KeyLike | Uint8Array): Promise<Sign1>;
/**
*
* Decode a COSE_Sign1 structure from a buffer.
*
* @param cose {Uint8Array} - The buffer containing the Cose Sign1 tagged or untagged message.
* @returns {Sign1} - The decoded COSE_Sign1 structure.
*/
static decode(cose: Uint8Array): Sign1;
static tag: number;
}