Created
October 24, 2024 05:33
-
-
Save mikedotexe/15240d5331122168b3654573e1c47d1c to your computer and use it in GitHub Desktop.
messing around with SubtleCrypto
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
const newEd25519Key = await window.crypto.subtle.generateKey('Ed25519', true, ['sign', 'verify']); | |
const encoder = new TextEncoder(); | |
const messageUtf8Bytes = encoder.encode("aloha honua"); | |
const signature = await window.crypto.subtle.sign("Ed25519", newEd25519Key.privateKey, messageUtf8Bytes); | |
console.log('signature', signature); | |
const pkcs8PrivateKey = await window.crypto.subtle.exportKey('pkcs8', newEd25519Key.privateKey); | |
const pkcs8PrivKeyArr = new Uint8Array(pkcs8PrivateKey) | |
console.log('pkcs8PrivKeyArr', pkcs8PrivKeyArr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment