MCPcopy Create free account
hub / github.com/WICG/webpackage / constructor

Method constructor

js/sign/src/web-bundle-id.ts:30–44  ·  view source on GitHub ↗
(key: KeyObject)

Source from the content-addressed store, hash-verified

28 private readonly typeSuffix: number[];
29
30 constructor(key: KeyObject) {
31 if (!isAsymmetricKeyTypeSupported(key)) {
32 throw new Error(
33 `WebBundleId: Only Ed25519 and ECDSA P-256 keys are currently supported.`
34 );
35 }
36
37 if (key.type === 'private') {
38 this.key = crypto.createPublicKey(key);
39 } else {
40 this.key = key;
41 }
42
43 this.typeSuffix = this.TYPE_SUFFIX_MAPPING.get(getSignatureType(this.key))!;
44 }
45
46 getKeyTypeName(): string {
47 return this.TYPE_NAME_MAPPING.get(getSignatureType(this.key)) as string;

Callers

nothing calls this directly

Calls 2

getSignatureTypeFunction · 0.90

Tested by

no test coverage detected