@ldclabs/cose-ts
Version:
Implemented Keys, Algorithms (RFC9053), COSE (RFC9052) and CWT (RFC8392) in TypeScript.
23 lines • 648 B
JavaScript
// (c) 2023-present, LDC Labs. All rights reserved.
// See the file LICENSE for licensing terms.
import { KVMap } from './map';
import { decodeCBOR } from './utils';
// Header represents a COSE Generic_Headers structure.
export class Header extends KVMap {
static fromBytes(data) {
if (data.length === 0) {
return new Header();
}
return new Header(decodeCBOR(data));
}
constructor(kv = new Map()) {
super(kv);
}
toBytes() {
if (this.toRaw().size === 0) {
return new Uint8Array();
}
return super.toBytes();
}
}
//# sourceMappingURL=header.js.map