7e98a7df7d
Put functions in lib/activitypub instead
21 lines
575 B
TypeScript
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
|
|
}
|