This commit is contained in:
Andre Staltz 2023-04-07 15:19:26 +03:00
parent 1f53758fe0
commit b4178b7420
1 changed files with 2 additions and 3 deletions

View File

@ -169,6 +169,7 @@ function create(opts) {
if ((err = validateContent(msg))) throw err if ((err = validateContent(msg))) throw err
const privateKey = Buffer.from(opts.keys.private, 'base64') const privateKey = Buffer.from(opts.keys.private, 'base64')
// TODO: add a label prefix to the metadata before signing
const metadataBuf = Buffer.from(stringify(msg.metadata), 'utf8') const metadataBuf = Buffer.from(stringify(msg.metadata), 'utf8')
// TODO: when signing, what's the point of a customizable hmac? // TODO: when signing, what's the point of a customizable hmac?
const sigBuf = ed25519.sign(privateKey, metadataBuf) const sigBuf = ed25519.sign(privateKey, metadataBuf)
@ -187,6 +188,7 @@ function fromPlaintextBuffer(plaintextBuf, msg) {
} }
module.exports = { module.exports = {
getMsgHash,
getMsgId, getMsgId,
getFeedId, getFeedId,
isFeedId, isFeedId,
@ -198,7 +200,4 @@ module.exports = {
validateOOO, validateOOO,
validateBatch, validateBatch,
validateOOOBatch, validateOOOBatch,
// custom APIs:
getMsgHash,
} }