new nostr-tools which abstracts all the relay activity.

This commit is contained in:
fiatjaf
2021-01-09 18:06:26 -03:00
parent 5921ad1080
commit 44edef63f9
11 changed files with 1686 additions and 61 deletions

View File

@@ -1,5 +1,6 @@
export function makeRandom32() {
var array = new Uint32Array(32)
window.crypto.getRandomValues(array)
return Buffer.from(array)
}
import * as secp256k1 from 'noble-secp256k1'
export const makeRandom32 = () => secp256k1.utils.generateRandomPrivateKey()
export const sha256 = m => secp256k1.utils.sha256(Uint8Array.from(m))
export const getPublicKey = privateKey =>
secp256k1.schnorr.getPublicKey(privateKey)