Skip to content

Instantly share code, notes, and snippets.

@Anderson-Juhasc
Last active October 17, 2024 15:33
Show Gist options
  • Save Anderson-Juhasc/4b484526678daf2325d8928d458a82db to your computer and use it in GitHub Desktop.
Save Anderson-Juhasc/4b484526678daf2325d8928d458a82db to your computer and use it in GitHub Desktop.
const encryptedMessage = await nip04.encrypt(this.prvKey, contact.pubKey, message)
const notificationEvent = {
kind: 4,
pubkey: this.pubKey,
created_at: Math.floor(Date.now() / 1000),
tags: [['p', contact.pubKey]], // Tag the recipient's pubkey
content: encryptedMessage
}
const signedEvent = finalizeEvent(notificationEvent, this.prvKey)
await Promise.any(pool.publish(this.relays, signedEvent))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment