Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
type: 'peer-invite/accept',
receipt: '%'+ssbKeys.hash(JSON.stringify(invite_msg, null, 2)),
id: bob.id,
key: u.hash(u.hash(seed)) //what the reveal key should be.
})
var accept_msg =
v.create(null, bob, caps.sign, accept, new Date('2018-03-26T06:14:18.377Z'))
throws(t, function () {
i.verifyAccept(accept_msg, invite_msg, caps)
}, 'peer-invites:decrypt-accept-reveal-failed')
var accept2 = ssbKeys.signObj(ssbKeys.generate(null, seed), caps.peerInvite, {
type: 'peer-invite/accept',
receipt: '%'+ssbKeys.hash(JSON.stringify(invite_msg, null, 2)),
id: bob.id,
key: u.hash('not the key') //what the reveal key should be.
})
throws(t, function () {
i.verifyAccept(accept_msg, invite_msg, caps)
}, 'peer-invites:decrypt-accept-reveal-failed')
t.end()
})
function toId(msg) {
return '%'+ssbKeys.hash(JSON.stringify(msg, null, 2))
}
function toId(msg) {
return '%'+ssbKeys.hash(JSON.stringify(msg, null, 2))
}
}, function (err) {
if(err && !onHash) throw err
var b = buffers.length > 1 ? Buffer.concat(buffers) : buffers[0]
var h = '&'+ssbKeys.hash(b)
onHash && onHash(err, h)
})
}
function validate(id) {
var feed = latest[id]
if(!feed.queue.length) return
if(!feed.ready) return
while(feed.queue.length) {
var op = feed.queue.shift()
if('function' == typeof op.create) {
op.value = op.create(feed.key, feed.value)
op.key = '%'+hash(encode(op.value))
}
var err =
util.isInvalidShape(op.value) ||
util.isInvalid(id, op.value, feed, sign_cap)
if(err)
op.cb(err)
else {
feed.key = op.key
feed.value = op.value
feed.ts = Date.now()
write(op)
}
}
}
function toMsgId(msg) {
return '%'+ssbKeys.hash(JSON.stringify(msg, null, 2))
}
}, function (err) {
if(err && !onHash) throw err
var b = buffers.length > 1 ? Buffer.concat(buffers) : buffers[0]
var h = '&'+ssbKeys.hash(b)
onHash && onHash(err, h)
})
}
function add (msg, cb) {
var err = util.isInvalidShape(msg)
if(err) return cb(err)
queue(msg.author, {
key: '%'+hash(encode(msg)),
value: msg, cb: cb,
create: null
})
}