mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 00:28:51 +00:00
add nip06.
This commit is contained in:
3
nip04.js
3
nip04.js
@@ -1,11 +1,12 @@
|
||||
import {Buffer} from 'buffer'
|
||||
import randomBytes from 'randombytes'
|
||||
import * as secp256k1 from '@noble/secp256k1'
|
||||
|
||||
export function encrypt(privkey, pubkey, text) {
|
||||
const key = secp256k1.getSharedSecret(privkey, '02' + pubkey)
|
||||
const normalizedKey = getOnlyXFromFullSharedSecret(key)
|
||||
|
||||
let iv = crypto.randomFillSync(new Uint8Array(16))
|
||||
let iv = Uint8Array.from(randomBytes(16))
|
||||
var cipher = crypto.createCipheriv(
|
||||
'aes-256-cbc',
|
||||
Buffer.from(normalizedKey, 'hex'),
|
||||
|
||||
Reference in New Issue
Block a user