aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/activitypub/helpers.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-23 16:14:33 +0100
committerChocobozzz <me@florianbigard.com>2022-03-24 09:40:46 +0100
commita219c9100b3ce8774d454497d46be87465bf664e (patch)
treecaa869e47919a9e23cc86dcece1100e239683b8c /server/tests/api/activitypub/helpers.ts
parent7e98a7df7d04e19ba67163a86c7b876d78d76839 (diff)
downloadPeerTube-a219c9100b3ce8774d454497d46be87465bf664e.tar.gz
PeerTube-a219c9100b3ce8774d454497d46be87465bf664e.tar.zst
PeerTube-a219c9100b3ce8774d454497d46be87465bf664e.zip
Refactor AP context builder
Diffstat (limited to 'server/tests/api/activitypub/helpers.ts')
-rw-r--r--server/tests/api/activitypub/helpers.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/tests/api/activitypub/helpers.ts b/server/tests/api/activitypub/helpers.ts
index e516cf49e..bc1de35d1 100644
--- a/server/tests/api/activitypub/helpers.ts
+++ b/server/tests/api/activitypub/helpers.ts
@@ -3,10 +3,10 @@
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { cloneDeep } from 'lodash' 5import { cloneDeep } from 'lodash'
6import { signAndContextify } from '@server/lib/activitypub/send'
6import { buildRequestStub } from '@server/tests/shared' 7import { buildRequestStub } from '@server/tests/shared'
7import { buildAbsoluteFixturePath } from '@shared/core-utils' 8import { buildAbsoluteFixturePath } from '@shared/core-utils'
8import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto' 9import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto'
9import { buildSignedActivity } from '../../../lib/activitypub/activity'
10 10
11describe('Test activity pub helpers', function () { 11describe('Test activity pub helpers', function () {
12 describe('When checking the Linked Signature', function () { 12 describe('When checking the Linked Signature', function () {
@@ -46,7 +46,7 @@ describe('Test activity pub helpers', function () {
46 const body = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json')) 46 const body = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json'))
47 47
48 const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey } 48 const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey }
49 const signedBody = await buildSignedActivity(actorSignature as any, body) 49 const signedBody = await signAndContextify(actorSignature as any, body, 'Announce')
50 50
51 const fromActor = { publicKey: keys.publicKey, url: 'http://localhost:9002/accounts/peertube' } 51 const fromActor = { publicKey: keys.publicKey, url: 'http://localhost:9002/accounts/peertube' }
52 const result = await isJsonLDSignatureVerified(fromActor as any, signedBody) 52 const result = await isJsonLDSignatureVerified(fromActor as any, signedBody)
@@ -59,7 +59,7 @@ describe('Test activity pub helpers', function () {
59 const body = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json')) 59 const body = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json'))
60 60
61 const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey } 61 const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey }
62 const signedBody = await buildSignedActivity(actorSignature as any, body) 62 const signedBody = await signAndContextify(actorSignature as any, body, 'Announce')
63 63
64 const fromActor = { publicKey: keys.publicKey, url: 'http://localhost:9002/accounts/peertube' } 64 const fromActor = { publicKey: keys.publicKey, url: 'http://localhost:9002/accounts/peertube' }
65 const result = await isJsonLDSignatureVerified(fromActor as any, signedBody) 65 const result = await isJsonLDSignatureVerified(fromActor as any, signedBody)