mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-13 10:28:51 +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'
|
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) {
|
export function serializeEvent(evt) {
|
||||||
return JSON.stringify([
|
return JSON.stringify([
|
||||||
0,
|
0,
|
||||||
|
|||||||
11
index.js
11
index.js
@@ -1,6 +1,12 @@
|
|||||||
import {relayConnect} from './relay'
|
import {relayConnect} from './relay'
|
||||||
import {relayPool} from './pool'
|
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'
|
import {makeRandom32, sha256, getPublicKey} from './utils'
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@@ -12,5 +18,6 @@ export {
|
|||||||
getEventHash,
|
getEventHash,
|
||||||
makeRandom32,
|
makeRandom32,
|
||||||
sha256,
|
sha256,
|
||||||
getPublicKey
|
getPublicKey,
|
||||||
|
getBlankEvent
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nostr-tools",
|
"name": "nostr-tools",
|
||||||
"version": "0.4.3",
|
"version": "0.4.4",
|
||||||
"description": "Tools for making a Nostr client.",
|
"description": "Tools for making a Nostr client.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in New Issue
Block a user