Message Encryption and Decryption
Overview
Encrypting a Message
import { PrivateKey, EncryptedMessage, Utils } from '@bsv/sdk'const sender = new PrivateKey(15)
const recipient = new PrivateKey(21)
const recipientPub = recipient.toPublicKey()
const message: number[] = Utils.toArray('Did you receive the Bitcoin payment?', 'utf8')const encrypted: number[] = EncryptedMessage.encrypt(message, sender, recipientPub)
const ciphertextMessage: string = Utils.toUTF8(encrypted)Decrypting a Message
Considerations
Last updated
Was this helpful?

