import { NextFunction, Request, Response } from 'express'
+import { getAPId } from '@server/helpers/activitypub'
+import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor'
import { ActivityDelete, ActivityPubSignature } from '../../shared'
+import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
import { logger } from '../helpers/logger'
import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto'
import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants'
-import { getOrCreateActorAndServerAndModel } from '../lib/activitypub/actor'
-import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger'
-import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor'
-import { getAPId } from '@server/helpers/activitypub'
-import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes'
+import { getOrCreateAPActor, loadActorUrlOrGetFromWebfinger } from '../lib/activitypub/actors'
async function checkSignature (req: Request, res: Response, next: NextFunction) {
try {
actorUrl = await loadActorUrlOrGetFromWebfinger(actorUrl.replace(/^acct:/, ''))
}
- const actor = await getOrCreateActorAndServerAndModel(actorUrl)
+ const actor = await getOrCreateAPActor(actorUrl)
const verified = isHTTPSignatureVerified(parsed, actor)
if (verified !== true) {
logger.debug('Checking JsonLD signature of actor %s...', creator)
- const actor = await getOrCreateActorAndServerAndModel(creator)
+ const actor = await getOrCreateAPActor(creator)
const verified = await isJsonLDSignatureVerified(actor, req.body)
if (verified !== true) {