diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-23 16:14:33 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-03-24 09:40:46 +0100 |
commit | a219c9100b3ce8774d454497d46be87465bf664e (patch) | |
tree | caa869e47919a9e23cc86dcece1100e239683b8c /server/tests/api/activitypub/helpers.ts | |
parent | 7e98a7df7d04e19ba67163a86c7b876d78d76839 (diff) | |
download | PeerTube-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.ts | 6 |
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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { cloneDeep } from 'lodash' | 5 | import { cloneDeep } from 'lodash' |
6 | import { signAndContextify } from '@server/lib/activitypub/send' | ||
6 | import { buildRequestStub } from '@server/tests/shared' | 7 | import { buildRequestStub } from '@server/tests/shared' |
7 | import { buildAbsoluteFixturePath } from '@shared/core-utils' | 8 | import { buildAbsoluteFixturePath } from '@shared/core-utils' |
8 | import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto' | 9 | import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto' |
9 | import { buildSignedActivity } from '../../../lib/activitypub/activity' | ||
10 | 10 | ||
11 | describe('Test activity pub helpers', function () { | 11 | describe('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) |