ego
This commit is contained in:
@@ -55,6 +55,26 @@ const Helpers = {
|
||||
body['@context'] = 'https://www.w3.org/ns/activitystreams'
|
||||
Helpers.signAndSend(body, user, follower)
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: cache
|
||||
// user: les@mastodon.cisti.org
|
||||
async getFederatedUser(address) {
|
||||
address = address.trim()
|
||||
let [ user, host ] = address.split('@')
|
||||
const url = `https://${host}/.well-known/webfinger?resource=acct:${user}@${host}`
|
||||
console.error('get federated user at => ', address, url)
|
||||
const user = await fetch(url, { headers: {'Accept': 'application/jrd+json, application/json'} })
|
||||
return user
|
||||
},
|
||||
|
||||
async verifySignature(req, res) {
|
||||
console.error(req.headers['signature'])
|
||||
// https://blog.joinmastodon.org/2018/07/how-to-make-friends-and-verify-requests/
|
||||
const signature_header = req.headers['signature'].split(',')
|
||||
.map(pair => pair.split('='))
|
||||
console.error(signature_header)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user