From a219c9100b3ce8774d454497d46be87465bf664e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 23 Mar 2022 16:14:33 +0100 Subject: Refactor AP context builder --- server/tests/api/activitypub/helpers.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server/tests/api/activitypub/helpers.ts') 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 @@ import 'mocha' import { expect } from 'chai' import { cloneDeep } from 'lodash' +import { signAndContextify } from '@server/lib/activitypub/send' import { buildRequestStub } from '@server/tests/shared' import { buildAbsoluteFixturePath } from '@shared/core-utils' import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto' -import { buildSignedActivity } from '../../../lib/activitypub/activity' describe('Test activity pub helpers', function () { describe('When checking the Linked Signature', function () { @@ -46,7 +46,7 @@ describe('Test activity pub helpers', function () { const body = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json')) const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey } - const signedBody = await buildSignedActivity(actorSignature as any, body) + const signedBody = await signAndContextify(actorSignature as any, body, 'Announce') const fromActor = { publicKey: keys.publicKey, url: 'http://localhost:9002/accounts/peertube' } const result = await isJsonLDSignatureVerified(fromActor as any, signedBody) @@ -59,7 +59,7 @@ describe('Test activity pub helpers', function () { const body = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json')) const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey } - const signedBody = await buildSignedActivity(actorSignature as any, body) + const signedBody = await signAndContextify(actorSignature as any, body, 'Announce') const fromActor = { publicKey: keys.publicKey, url: 'http://localhost:9002/accounts/peertube' } const result = await isJsonLDSignatureVerified(fromActor as any, signedBody) -- cgit v1.2.3