-import { eachSeries } from 'async'
-import { NextFunction, Request, RequestHandler, Response } from 'express'
-import { ActivityPubSignature } from '../../shared'
-import { isSignatureVerified, logger } from '../helpers'
-import { database as db } from '../initializers'
-import { ACTIVITY_PUB } from '../initializers/constants'
-import { fetchRemoteAccount, saveAccountAndServerIfNotExist } from '../lib/activitypub/account'
+import { NextFunction, Request, Response } from 'express'
+import { ActivityDelete, ActivityPubSignature } from '../../shared'
+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'
+import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger'
+import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor'
+import { getAPId } from '@server/helpers/activitypub'