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

Function parsePemKey

js/sign/src/utils/utils.ts:14–22  ·  view source on GitHub ↗
(
  unparsedKey: string | Buffer<ArrayBufferLike>,
  passphrase?: string
)

Source from the content-addressed store, hash-verified

12// A helper function which can be used to parse string formatted keys to
13// KeyObjects.
14export function parsePemKey(
15 unparsedKey: string | Buffer<ArrayBufferLike>,
16 passphrase?: string
17): KeyObject {
18 return crypto.createPrivateKey({
19 key: unparsedKey,
20 passphrase,
21 });
22}
23
24function maybeGetSignatureType(key: crypto.KeyObject): SignatureType | null {
25 switch (key.asymmetricKeyType) {

Callers 2

parseMaybeEncryptedKeyFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected