aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/activity.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/activity.ts')
-rw-r--r--server/lib/activitypub/activity.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/server/lib/activitypub/activity.ts b/server/lib/activitypub/activity.ts
new file mode 100644
index 000000000..215b50b69
--- /dev/null
+++ b/server/lib/activitypub/activity.ts
@@ -0,0 +1,21 @@
1import { signJsonLDObject } from '@server/helpers/peertube-crypto'
2import { MActor } from '@server/types/models'
3import { ContextType } from '@shared/models'
4import { activityPubContextify } from './context'
5
6function buildSignedActivity <T> (byActor: MActor, data: T, contextType?: ContextType) {
7 const activity = activityPubContextify(data, contextType)
8
9 return signJsonLDObject(byActor, activity)
10}
11
12function getAPId (object: string | { id: string }) {
13 if (typeof object === 'string') return object
14
15 return object.id
16}
17
18export {
19 buildSignedActivity,
20 getAPId
21}