Add HTTP signature check before linked signature
It's faster, and will allow us to use RSA signature 2018 (with upstream jsonld-signature module) without too much incompatibilities in the peertube federation
This commit is contained in:
parent
d23e6a1c97
commit
41f2ebae4f
8 changed files with 182 additions and 83 deletions
|
@ -2,6 +2,7 @@ import { buildSignedActivity } from '../../../../helpers/activitypub'
|
|||
import { getServerActor } from '../../../../helpers/utils'
|
||||
import { ActorModel } from '../../../../models/activitypub/actor'
|
||||
import { sha256 } from '../../../../helpers/core-utils'
|
||||
import { HTTP_SIGNATURE } from '../../../../initializers'
|
||||
|
||||
type Payload = { body: any, signatureActorId?: number }
|
||||
|
||||
|
@ -29,11 +30,11 @@ async function buildSignedRequestOptions (payload: Payload) {
|
|||
|
||||
const keyId = actor.getWebfingerUrl()
|
||||
return {
|
||||
algorithm: 'rsa-sha256',
|
||||
authorizationHeaderName: 'Signature',
|
||||
algorithm: HTTP_SIGNATURE.ALGORITHM,
|
||||
authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME,
|
||||
keyId,
|
||||
key: actor.privateKey,
|
||||
headers: [ 'date', 'host', 'digest', '(request-target)' ]
|
||||
headers: HTTP_SIGNATURE.HEADERS_TO_SIGN
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue