mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 08:38:50 +00:00
add a bunch of tests.
This commit is contained in:
14
nip04.test.js
Normal file
14
nip04.test.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
const {nip04, getPublicKey, generatePrivateKey} = require('./cjs')
|
||||
|
||||
test('encrypt and decrypt message', () => {
|
||||
let sk1 = generatePrivateKey()
|
||||
let sk2 = generatePrivateKey()
|
||||
let pk1 = getPublicKey(sk1)
|
||||
let pk2 = getPublicKey(sk2)
|
||||
|
||||
expect(nip04.decrypt(sk2, pk1, nip04.encrypt(sk1, pk2, 'hello'))).toEqual(
|
||||
'hello'
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user