Add NIP-13 (proof-of-work) module

This commit is contained in:
Alex Gleason
2023-04-11 15:49:08 -05:00
committed by fiatjaf_
parent 674ff66b6f
commit a05506468d
3 changed files with 51 additions and 0 deletions

8
nip13.test.js Normal file
View File

@@ -0,0 +1,8 @@
/* eslint-env jest */
const {nip13} = require('./lib/nostr.cjs')
test('identifies proof-of-work difficulty', async () => {
const id = '000006d8c378af1779d2feebc7603a125d99eca0ccf1085959b307f64e5dd358'
const difficulty = nip13.getPow(id)
expect(difficulty).toEqual(21)
})