1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
export let generateKeys = async () => {
const keys = await crypto.subtle.generateKey(
{
name: "ECDSA",
namedCurve: "P-384",
},
true,
["sign", "verify"],
);
const exportedPublicKey = crypto.subtle.exportKey("jwk", keys.publicKey);
const exportedPrivateKey = crypto.subtle.exportKey("jwk", keys.privateKey);
return {
publicKey: exportedPublicKey,
privateKey: exportedPrivateKey,
};
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
v4
April 13, 2024