@ldclabs/cose-ts
Version:
Implemented Keys, Algorithms (RFC9053), COSE (RFC9052) and CWT (RFC8392) in TypeScript.
36 lines (35 loc) • 1.1 kB
TypeScript
import { KVMap, RawMap } from './map';
export interface Encryptor {
nonceSize(): number;
encrypt(plaintext: Uint8Array, nonce: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
decrypt(ciphertext: Uint8Array, nonce: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
}
export interface MACer {
mac(message: Uint8Array): Uint8Array;
}
export interface Signer {
sign(message: Uint8Array): Uint8Array;
}
export interface Verifier {
verify(message: Uint8Array, signature: Uint8Array): boolean;
}
export interface ECDHer {
ecdh(remotePublic: Key): Uint8Array;
}
export declare class Key extends KVMap {
static fromBytes(data: Uint8Array): Key;
constructor(kv?: RawMap);
get kty(): number | string;
set kty(kty: number);
get kid(): Uint8Array;
set kid(kid: Uint8Array);
get alg(): number | string;
set alg(alg: number | string);
get ops(): (number | string)[];
set ops(ops: (number | string)[]);
get baseIV(): Uint8Array;
set baseIV(iv: Uint8Array);
getKid<T>(): T;
setKid<T>(kid: T): this;
getSecret(): Uint8Array;
}