[fix] fediverse signature

This commit is contained in:
les
2019-11-09 15:06:25 +01:00
parent 1afc30fb48
commit e23d3a13ad
2 changed files with 4 additions and 5 deletions

View File

@@ -66,7 +66,9 @@ const userController = {
}
},
// ADD EVENT
/**
* add event
*/
async addEvent (req, res) {
const body = req.body

View File

@@ -27,13 +27,10 @@ const Helpers = {
async signAndSend (message, user, inbox) {
// get the URI of the actor object and append 'inbox' to it
const inboxUrl = new url.URL(inbox)
// const toPath = toOrigin.path + '/inbox'
// get the private key
const privkey = user.rsa.privateKey
const signer = crypto.createSign('sha256')
const d = new Date()
const stringToSign = `(request-target): post ${inboxUrl.path}\nhost: ${inboxUrl.hostname}\ndate: ${d.toUTCString()}`
debug('Sign and send', user.username, inbox)
const stringToSign = `(request-target): post ${inboxUrl.pathname}\nhost: ${inboxUrl.hostname}\ndate: ${d.toUTCString()}`
signer.update(stringToSign)
signer.end()
const signature = signer.sign(privkey)