support getBlankEvent() function.

This commit is contained in:
fiatjaf
2021-05-22 21:20:30 -03:00
parent 28443710e3
commit e2956ab937
3 changed files with 20 additions and 3 deletions

View File

@@ -2,6 +2,16 @@ import * as secp256k1 from 'noble-secp256k1'
import {sha256} from './utils'
export function getBlankEvent(evt) {
return {
kind: -1,
pubkey: null,
content: '',
tags: [],
created_at: Math.round(Date.now() / 1000)
}
}
export function serializeEvent(evt) {
return JSON.stringify([
0,

View File

@@ -1,6 +1,12 @@
import {relayConnect} from './relay'
import {relayPool} from './pool'
import {signEvent, verifySignature, serializeEvent, getEventHash} from './event'
import {
getBlankEvent,
signEvent,
verifySignature,
serializeEvent,
getEventHash
} from './event'
import {makeRandom32, sha256, getPublicKey} from './utils'
export {
@@ -12,5 +18,6 @@ export {
getEventHash,
makeRandom32,
sha256,
getPublicKey
getPublicKey,
getBlankEvent
}

View File

@@ -1,6 +1,6 @@
{
"name": "nostr-tools",
"version": "0.4.3",
"version": "0.4.4",
"description": "Tools for making a Nostr client.",
"main": "index.js",
"repository": {