upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--04.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/04.md b/04.md
index 1866970..350f9c0 100644
--- a/04.md
+++ b/04.md
@@ -23,12 +23,12 @@ import crypto from 'crypto'
23import * as secp from 'noble-secp256k1' 23import * as secp from 'noble-secp256k1'
24 24
25let sharedPoint = secp.getSharedSecret(ourPrivateKey, '02' + theirPublicKey) 25let sharedPoint = secp.getSharedSecret(ourPrivateKey, '02' + theirPublicKey)
26let sharedX = sharedPoint.slice(2, 67) 26let sharedX = sharedPoint.slice(1, 33)
27 27
28let iv = crypto.randomFillSync(new Uint8Array(16)) 28let iv = crypto.randomFillSync(new Uint8Array(16))
29var cipher = crypto.createCipheriv( 29var cipher = crypto.createCipheriv(
30 'aes-256-cbc', 30 'aes-256-cbc',
31 Buffer.from(sharedX, 'hex'), 31 Buffer.from(sharedX),
32 iv 32 iv
33) 33)
34let encryptedMessage = cipher.update(text, 'utf8', 'base64') 34let encryptedMessage = cipher.update(text, 'utf8', 'base64')