I as the receiver of a message can prove that this particular baemail-tx has this content.
//////////////////
//this is how the OP_RETURN of a baemail is assembled
var assembledOpReturn = [this.protocolPrefix];
assembledOpReturn.push(encryptForPki(serializedBaemailFull, this.baemailPki));
assembledOpReturn.push(encryptForPki(serializedBaemail, sendingPaymailPkiPublicKey.toString()));
assembledOpReturn.push(encryptForPki(serializedBaemail, message.destinationPkiPublicKey));
const baeHash = this.context.bsv.crypto.Hash.sha256(
Buffer.from(this.protocolPrefix + serializedBaemailFull)
).toString('hex');
assembledOpReturn.push('|');
assembledOpReturn.push('15igChEkUWgx4dsEcSuPitcLNZmNDfUvgA');
assembledOpReturn.push(baeHash);
assembledOpReturn.push(senderPkiSign(baeHash));
assembledOpReturn.push(sendingPaymailPkiPublicKey.toString());
assembledOpReturn.push(sendingPaymail.paymail);
//////////////////
During the assembling of the array, there are three calls to #encryptForPki adding 3 items to the array. This function asymmetrically-encrypted the content passed in `var1` with pub-key of `var2`. From the code you can see that variable `serializedBaemail` is encrypted for both sender and receiver with an identical content.
I as the receiver can decrypt the array-item intended for me & then use the content I got by passing it into my own call of #encryptForPki with the sender's paymail-pki (which is public). The resulting encrypted value would be identical to the value that can be found in my receiveing-baemail-tx in the array-item intended for sender, proving this is the content.
I as the receiver of a message can prove that this particular baemail-tx has this content.
//////////////////
//this is how the OP_RETURN of a baemail is assembled
var assembledOpReturn = [this.protocolPrefix];
assembledOpReturn.push(encryptForPki(serializedBaemailFull, this.baemailPki));
assembledOpReturn.push(encryptForPki(serializedBaemail, sendingPaymailPkiPublicKey.toString()));
assembledOpReturn.push(encryptForPki(serializedBaemail, message.destinationPkiPublicKey));
const baeHash = this.context.bsv.crypto.Hash.sha256(
Buffer.from(this.protocolPrefix + serializedBaemailFull)
).toString('hex');
assembledOpReturn.push('|');
assembledOpReturn.push('15igChEkUWgx4dsEcSuPitcLNZmNDfUvgA');
assembledOpReturn.push(baeHash);
assembledOpReturn.push(senderPkiSign(baeHash));
assembledOpReturn.push(sendingPaymailPkiPublicKey.toString());
assembledOpReturn.push(sendingPaymail.paymail);
//////////////////
During the assembling of the array, there are three calls to #encryptForPki adding 3 items to the array. This function asymmetrically-encrypted the content passed in `var1` with pub-key of `var2`. From the code you can see that variable `serializedBaemail` is encrypted for both sender and receiver with an identical content.
I as the receiver can decrypt the array-item intended for me & then use the content I got by passing it into my own call of #encryptForPki with the sender's paymail-pki (which is public). The resulting encrypted value would be identical to the value that can be found in my receiveing-baemail-tx in the array-item intended for sender, proving this is the content.