How to use the @casual-simulation/crypto.parsePrivatePEMKey function in @casual-simulation/crypto

To help you get started, we’ve selected a few @casual-simulation/crypto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github casual-simulation / aux / src / crypto-browser / BrowserSigningCryptoImpl.ts View on Github external
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);
    }