How to use the @casual-simulation/crypto.parsePublicPEMKey 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 importPublicKey(key: string): Promise {
        const buffer = parsePublicPEMKey(key);
        const cryptoKey = await crypto.subtle.importKey(
            'spki',
            buffer,
            {
                name: 'ECDSA',
                namedCurve: BrowserSigningCryptoImpl.NAMED_CURVE,
            },
            true,
            ['verify']
        );

        return new BrowserPublicCryptoKey(cryptoKey);
    }