1
0
Fork 0
peertube/server/lib/activitypub/activity.ts
Chocobozzz 7e98a7df7d
Remove activitypub helper
Put functions in lib/activitypub instead
2022-03-23 14:24:50 +01:00

21 lines
575 B
TypeScript

import { signJsonLDObject } from '@server/helpers/peertube-crypto'
import { MActor } from '@server/types/models'
import { ContextType } from '@shared/models'
import { activityPubContextify } from './context'
function buildSignedActivity <T> (byActor: MActor, data: T, contextType?: ContextType) {
const activity = activityPubContextify(data, contextType)
return signJsonLDObject(byActor, activity)
}
function getAPId (object: string | { id: string }) {
if (typeof object === 'string') return object
return object.id
}
export {
buildSignedActivity,
getAPId
}