webcrypto icon indicating copy to clipboard operation
webcrypto copied to clipboard

Export key error

Open tplooker opened this issue 3 years ago • 1 comments

With the latest release of this library v1.1.7 I get the following error

Cannot get schema for 'PrivateKeyInfo' target

When running the following

const crypto = new Crypto();

const cryptoKeyPair = (await crypto.subtle.generateKey(
    {
      name: "ECDSA",
      namedCurve: "P-256",
    },
    true,
    [KeyUsage.SIGN]
  ));

  const exportedKey = (await subtleCrypto.exportKey("jwk", cryptoKeyPair.privateKey));

Issue is not present with v1.1.6

For additional context i'm running NodeJS 12.22.1

tplooker avatar Jun 09 '21 03:06 tplooker

Looks like you've got a few versions of @peculiar/asn1-schema in your project. Call npm list @peculiar/asn1-schema to check it out. And npm dedupe to fix it

microshine avatar Jun 09 '21 06:06 microshine