mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 08:38:50 +00:00
support getBlankEvent() function.
This commit is contained in:
10
event.js
10
event.js
@@ -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,
|
||||
|
||||
11
index.js
11
index.js
@@ -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
|
||||
}
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user