[fix] fediverse signature
This commit is contained in:
@@ -66,7 +66,9 @@ const userController = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// ADD EVENT
|
/**
|
||||||
|
* add event
|
||||||
|
*/
|
||||||
async addEvent (req, res) {
|
async addEvent (req, res) {
|
||||||
const body = req.body
|
const body = req.body
|
||||||
|
|
||||||
|
|||||||
@@ -27,13 +27,10 @@ const Helpers = {
|
|||||||
async signAndSend (message, user, inbox) {
|
async signAndSend (message, user, inbox) {
|
||||||
// get the URI of the actor object and append 'inbox' to it
|
// get the URI of the actor object and append 'inbox' to it
|
||||||
const inboxUrl = new url.URL(inbox)
|
const inboxUrl = new url.URL(inbox)
|
||||||
// const toPath = toOrigin.path + '/inbox'
|
|
||||||
// get the private key
|
|
||||||
const privkey = user.rsa.privateKey
|
const privkey = user.rsa.privateKey
|
||||||
const signer = crypto.createSign('sha256')
|
const signer = crypto.createSign('sha256')
|
||||||
const d = new Date()
|
const d = new Date()
|
||||||
const stringToSign = `(request-target): post ${inboxUrl.path}\nhost: ${inboxUrl.hostname}\ndate: ${d.toUTCString()}`
|
const stringToSign = `(request-target): post ${inboxUrl.pathname}\nhost: ${inboxUrl.hostname}\ndate: ${d.toUTCString()}`
|
||||||
debug('Sign and send', user.username, inbox)
|
|
||||||
signer.update(stringToSign)
|
signer.update(stringToSign)
|
||||||
signer.end()
|
signer.end()
|
||||||
const signature = signer.sign(privkey)
|
const signature = signer.sign(privkey)
|
||||||
|
|||||||
Reference in New Issue
Block a user