PeculiarVentures / webcrypto

A WebCrypto Polyfill for NodeJS
MIT License
185 stars 23 forks source link

Export key error #30

Open tplooker opened 3 years ago

tplooker commented 3 years ago

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

microshine commented 3 years ago

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