Improve example for finishEvent

This commit is contained in:
Asai Toshiya 2023-09-11 12:53:25 +09:00 committed by GitHub
parent 6db8b94275
commit f9a048679f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -90,13 +90,12 @@ sub.on('event', event => {
let event = {
kind: 1,
pubkey: pk,
created_at: Math.floor(Date.now() / 1000),
tags: [],
content: 'hello world',
}
// this calculates the event id and signs the event in a single step
// this assigns the pubkey, calculates the event id and signs the event in a single step
const signedEvent = finishEvent(event, sk)
await relay.publish(signedEvent)