1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

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:
Chocobozzz 2018-10-19 11:41:19 +02:00
parent 333210d862
commit f7509cbec8
No known key found for this signature in database
GPG key ID: 583A612D890159BE
8 changed files with 182 additions and 83 deletions

View file

@ -4,7 +4,7 @@ import { ResultList } from '../../shared/models'
import { Activity, ActivityPubActor } from '../../shared/models/activitypub'
import { ACTIVITY_PUB } from '../initializers'
import { ActorModel } from '../models/activitypub/actor'
import { signObject } from './peertube-crypto'
import { signJsonLDObject } from './peertube-crypto'
import { pageToStartAndCount } from './core-utils'
function activityPubContextify <T> (data: T) {
@ -15,22 +15,22 @@ function activityPubContextify <T> (data: T) {
{
RsaSignature2017: 'https://w3id.org/security#RsaSignature2017',
pt: 'https://joinpeertube.org/ns',
schema: 'http://schema.org#',
sc: 'http://schema.org#',
Hashtag: 'as:Hashtag',
uuid: 'schema:identifier',
category: 'schema:category',
licence: 'schema:license',
subtitleLanguage: 'schema:subtitleLanguage',
uuid: 'sc:identifier',
category: 'sc:category',
licence: 'sc:license',
subtitleLanguage: 'sc:subtitleLanguage',
sensitive: 'as:sensitive',
language: 'schema:inLanguage',
views: 'schema:Number',
stats: 'schema:Number',
size: 'schema:Number',
fps: 'schema:Number',
commentsEnabled: 'schema:Boolean',
waitTranscoding: 'schema:Boolean',
expires: 'schema:expires',
support: 'schema:Text',
language: 'sc:inLanguage',
views: 'sc:Number',
stats: 'sc:Number',
size: 'sc:Number',
fps: 'sc:Number',
commentsEnabled: 'sc:Boolean',
waitTranscoding: 'sc:Boolean',
expires: 'sc:expires',
support: 'sc:Text',
CacheFile: 'pt:CacheFile'
},
{
@ -102,7 +102,7 @@ async function activityPubCollectionPagination (url: string, handler: ActivityPu
function buildSignedActivity (byActor: ActorModel, data: Object) {
const activity = activityPubContextify(data)
return signObject(byActor, activity) as Promise<Activity>
return signJsonLDObject(byActor, activity) as Promise<Activity>
}
function getActorUrl (activityActor: string | ActivityPubActor) {