Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async importPrivateKey(key: string): Promise {
const buffer = parsePrivatePEMKey(key);
const cryptoKey = await crypto.subtle.importKey(
'pkcs8',
buffer,
{
name: 'ECDSA',
namedCurve: BrowserSigningCryptoImpl.NAMED_CURVE,
},
true,
['sign']
);
return new BrowserPrivateCryptoKey(cryptoKey);
}