diff options
| author | ennmichael <enntheprogrammer@gmail.com> | 2023-03-05 21:43:14 +0100 |
|---|---|---|
| committer | fiatjaf_ <fiatjaf@gmail.com> | 2023-03-05 22:09:59 -0300 |
| commit | d97928bd9024a988be6c9f7ec18c0fcf93a8b9a3 (patch) | |
| tree | b998752d44a088d2ecd435f2472d21d5fe31ac6f /04.md | |
| parent | c74f11b7a921276849f4d0eebc3a90a6a3edf2c1 (diff) | |
avoid using substr in NIP-04 example
Diffstat (limited to '04.md')
| -rw-r--r-- | 04.md | 2 |
1 files changed, 1 insertions, 1 deletions
| @@ -23,7 +23,7 @@ import crypto from 'crypto' | |||
| 23 | import * as secp from 'noble-secp256k1' | 23 | import * as secp from 'noble-secp256k1' |
| 24 | 24 | ||
| 25 | let sharedPoint = secp.getSharedSecret(ourPrivateKey, '02' + theirPublicKey) | 25 | let sharedPoint = secp.getSharedSecret(ourPrivateKey, '02' + theirPublicKey) |
| 26 | let sharedX = sharedPoint.substr(2, 64) | 26 | let sharedX = sharedPoint.slice(2, 67) |
| 27 | 27 | ||
| 28 | let iv = crypto.randomFillSync(new Uint8Array(16)) | 28 | let iv = crypto.randomFillSync(new Uint8Array(16)) |
| 29 | var cipher = crypto.createCipheriv( | 29 | var cipher = crypto.createCipheriv( |