1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Avoir some circular dependencies

This commit is contained in:
Chocobozzz 2020-04-23 09:32:53 +02:00 committed by Chocobozzz
parent 7fed637506
commit 8dc8a34ee8
69 changed files with 278 additions and 263 deletions

View file

@ -1,9 +1,9 @@
import { buildSignedActivity, ContextType } from '../../../../helpers/activitypub'
import { getServerActor } from '../../../../helpers/utils'
import { ActorModel } from '../../../../models/activitypub/actor'
import { sha256 } from '../../../../helpers/core-utils'
import { ACTIVITY_PUB, HTTP_SIGNATURE } from '../../../../initializers/constants'
import { MActor } from '../../../../typings/models'
import { getServerActor } from '@server/models/application/application'
import { buildDigest } from '@server/helpers/peertube-crypto'
type Payload = { body: any, contextType?: ContextType, signatureActorId?: number }
@ -48,14 +48,7 @@ function buildGlobalHeaders (body: any) {
}
}
function buildDigest (body: any) {
const rawBody = typeof body === 'string' ? body : JSON.stringify(body)
return 'SHA-256=' + sha256(rawBody, 'base64')
}
export {
buildDigest,
buildGlobalHeaders,
computeBody,
buildSignedRequestOptions