Last active
October 17, 2024 15:33
-
-
Save Anderson-Juhasc/4b484526678daf2325d8928d458a82db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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