diff options
Diffstat (limited to 'server/lib/job-queue/handlers/utils')
-rw-r--r-- | server/lib/job-queue/handlers/utils/activitypub-http-utils.ts | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts b/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts index 258ffabee..437ea06fc 100644 --- a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts +++ b/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | import { buildSignedActivity, ContextType } from '../../../../helpers/activitypub' | 1 | import { buildSignedActivity, ContextType } from '../../../../helpers/activitypub' |
2 | import { getServerActor } from '../../../../helpers/utils' | ||
3 | import { ActorModel } from '../../../../models/activitypub/actor' | 2 | import { ActorModel } from '../../../../models/activitypub/actor' |
4 | import { sha256 } from '../../../../helpers/core-utils' | ||
5 | import { ACTIVITY_PUB, HTTP_SIGNATURE } from '../../../../initializers/constants' | 3 | import { ACTIVITY_PUB, HTTP_SIGNATURE } from '../../../../initializers/constants' |
6 | import { MActor } from '../../../../typings/models' | 4 | import { MActor } from '../../../../typings/models' |
5 | import { getServerActor } from '@server/models/application/application' | ||
6 | import { buildDigest } from '@server/helpers/peertube-crypto' | ||
7 | 7 | ||
8 | type Payload = { body: any, contextType?: ContextType, signatureActorId?: number } | 8 | type Payload = { body: any, contextType?: ContextType, signatureActorId?: number } |
9 | 9 | ||
@@ -48,14 +48,7 @@ function buildGlobalHeaders (body: any) { | |||
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | function buildDigest (body: any) { | ||
52 | const rawBody = typeof body === 'string' ? body : JSON.stringify(body) | ||
53 | |||
54 | return 'SHA-256=' + sha256(rawBody, 'base64') | ||
55 | } | ||
56 | |||
57 | export { | 51 | export { |
58 | buildDigest, | ||
59 | buildGlobalHeaders, | 52 | buildGlobalHeaders, |
60 | computeBody, | 53 | computeBody, |
61 | buildSignedRequestOptions | 54 | buildSignedRequestOptions |