-
-
Save cardoso/d537a9afd5a14da8c3f2f2ed8dd00e7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default async () => { | |
const keyPair = await window.crypto.subtle.generateKey( | |
{ | |
name: "ECDH", | |
namedCurve: "P-256", | |
}, | |
true, | |
["deriveKey", "deriveBits"] | |
); | |
const publicKeyJwk = await window.crypto.subtle.exportKey( | |
"jwk", | |
keyPair.publicKey | |
); | |
const privateKeyJwk = await window.crypto.subtle.exportKey( | |
"jwk", | |
keyPair.privateKey | |
); | |
return { publicKeyJwk, privateKeyJwk }; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment