signum-transaction-grabber
Version:
Scans an Signum Blockchain account for transactions by custom criteria and persists the results
21 lines (15 loc) • 483 B
JavaScript
const { decryptMessage, generateMasterKeys } = require('@signumjs/crypto')
function extractMessage (transaction, agreementPrivateKey) {
const { attachment } = transaction
if (!attachment) return ''
if (attachment.message) {
return attachment.message
}
if (agreementPrivateKey && attachment.nonce && attachment.isText) {
return decryptMessage(attachment, transaction.senderPublicKey, agreementPrivateKey)
}
return ''
}
module.exports = {
extractMessage
}