aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/activitypub.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-19 11:41:19 +0200
committerChocobozzz <me@florianbigard.com>2018-10-19 12:59:52 +0200
commitf7509cbec875ec4ee3201cce08839f2a02676c1c (patch)
tree5dbfcff41a175aa7d4b7d396ca90fe26049d0164 /server/helpers/activitypub.ts
parent333210d862fdba4bb114b756d4f964789f480196 (diff)
downloadPeerTube-f7509cbec875ec4ee3201cce08839f2a02676c1c.tar.gz
PeerTube-f7509cbec875ec4ee3201cce08839f2a02676c1c.tar.zst
PeerTube-f7509cbec875ec4ee3201cce08839f2a02676c1c.zip
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
Diffstat (limited to 'server/helpers/activitypub.ts')
-rw-r--r--server/helpers/activitypub.ts32
1 files changed, 16 insertions, 16 deletions
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts
index 1304c7559..278010e78 100644
--- a/server/helpers/activitypub.ts
+++ b/server/helpers/activitypub.ts
@@ -4,7 +4,7 @@ import { ResultList } from '../../shared/models'
4import { Activity, ActivityPubActor } from '../../shared/models/activitypub' 4import { Activity, ActivityPubActor } from '../../shared/models/activitypub'
5import { ACTIVITY_PUB } from '../initializers' 5import { ACTIVITY_PUB } from '../initializers'
6import { ActorModel } from '../models/activitypub/actor' 6import { ActorModel } from '../models/activitypub/actor'
7import { signObject } from './peertube-crypto' 7import { signJsonLDObject } from './peertube-crypto'
8import { pageToStartAndCount } from './core-utils' 8import { pageToStartAndCount } from './core-utils'
9 9
10function activityPubContextify <T> (data: T) { 10function activityPubContextify <T> (data: T) {
@@ -15,22 +15,22 @@ function activityPubContextify <T> (data: T) {
15 { 15 {
16 RsaSignature2017: 'https://w3id.org/security#RsaSignature2017', 16 RsaSignature2017: 'https://w3id.org/security#RsaSignature2017',
17 pt: 'https://joinpeertube.org/ns', 17 pt: 'https://joinpeertube.org/ns',
18 schema: 'http://schema.org#', 18 sc: 'http://schema.org#',
19 Hashtag: 'as:Hashtag', 19 Hashtag: 'as:Hashtag',
20 uuid: 'schema:identifier', 20 uuid: 'sc:identifier',
21 category: 'schema:category', 21 category: 'sc:category',
22 licence: 'schema:license', 22 licence: 'sc:license',
23 subtitleLanguage: 'schema:subtitleLanguage', 23 subtitleLanguage: 'sc:subtitleLanguage',
24 sensitive: 'as:sensitive', 24 sensitive: 'as:sensitive',
25 language: 'schema:inLanguage', 25 language: 'sc:inLanguage',
26 views: 'schema:Number', 26 views: 'sc:Number',
27 stats: 'schema:Number', 27 stats: 'sc:Number',
28 size: 'schema:Number', 28 size: 'sc:Number',
29 fps: 'schema:Number', 29 fps: 'sc:Number',
30 commentsEnabled: 'schema:Boolean', 30 commentsEnabled: 'sc:Boolean',
31 waitTranscoding: 'schema:Boolean', 31 waitTranscoding: 'sc:Boolean',
32 expires: 'schema:expires', 32 expires: 'sc:expires',
33 support: 'schema:Text', 33 support: 'sc:Text',
34 CacheFile: 'pt:CacheFile' 34 CacheFile: 'pt:CacheFile'
35 }, 35 },
36 { 36 {
@@ -102,7 +102,7 @@ async function activityPubCollectionPagination (url: string, handler: ActivityPu
102function buildSignedActivity (byActor: ActorModel, data: Object) { 102function buildSignedActivity (byActor: ActorModel, data: Object) {
103 const activity = activityPubContextify(data) 103 const activity = activityPubContextify(data)
104 104
105 return signObject(byActor, activity) as Promise<Activity> 105 return signJsonLDObject(byActor, activity) as Promise<Activity>
106} 106}
107 107
108function getActorUrl (activityActor: string | ActivityPubActor) { 108function getActorUrl (activityActor: string | ActivityPubActor) {