PeculiarVentures / webcrypto

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

Error: Cannot get schema for 'PrivateKeyInfo' target #50

Open victorpayclip opened 2 years ago

victorpayclip commented 2 years ago

I am generating keys with ecdh

const { Crypto } = require("@peculiar/webcrypto");
const crypto = new Crypto();

const { publicKey, privateKey } = await crypto.subtle.generateKey(
  {
    name: "ECDH",
    namedCurve: "P-256", // P-256, P-384, or P-521
  },
  true,
  ["deriveKey", "deriveBits"],
);

but when exporting them it throws me this error

Error: Cannot get schema for 'PrivateKeyInfo' target

Can someone guide me how to solve this problem?

microshine commented 2 years ago

Looks like your project uses multiple versions of @peculiar/asn1-schema. Please deduplicate dependences and try again

markb-trustifi commented 2 years ago

It happens for me with the latest webcrypto version v1.4. When I switch strictly to the v1.3.3 without hat this error disappears.

fej-snikduj commented 2 years ago

Having this issue as well, even on 1.3.3