aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/Activity.php76
-rw-r--r--Zotlabs/Lib/ActivityStreams.php1
2 files changed, 77 insertions, 0 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 0dfa15aea..766b4ed91 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -4211,4 +4211,80 @@ class Activity {
}
+ public static function ap_context($contextType = null): array {
+ return ['@context' => [
+ ACTIVITYSTREAMS_JSONLD_REV,
+ 'https://w3id.org/security/v1',
+ // 'https://www.w3.org/ns/did/v1',
+ // 'https://w3id.org/security/multikey/v1',
+ // 'https://w3id.org/security/data-integrity/v1',
+ 'https://purl.archive.org/socialweb/webfinger',
+ self::ap_schema($contextType)
+ ]];
+ }
+
+ public static function ap_schema($contextType = null): array {
+ // $contextType is reserved for future use so that the caller can specify
+ // a limited subset of the entire schema definition for particular activities.
+
+ return [
+ 'zot' => z_root() . '/apschema#',
+ 'schema' => 'http://schema.org#',
+ 'ostatus' => 'http://ostatus.org#',
+ 'diaspora' => 'https://diasporafoundation.org/ns/',
+
+ 'commentPolicy' => 'zot:commentPolicy',
+ 'locationAddress' => 'zot:locationAddress',
+ 'locationPrimary' => 'zot:locationPrimary',
+ 'locationDeleted' => 'zot:locationDeleted',
+ 'nomadicLocation' => 'zot:nomadicLocation',
+ 'nomadicHubs' => 'zot:nomadicHubs',
+ 'emojiReaction' => 'zot:emojiReaction',
+ 'expires' => 'zot:expires',
+ 'directMessage' => 'zot:directMessage',
+ 'Bookmark' => 'zot:Bookmark',
+ 'Category' => 'zot:Category',
+
+ 'PropertyValue' => 'schema:PropertyValue',
+ 'value' => 'schema:value',
+
+ 'conversation' => 'ostatus:conversation',
+
+ 'guid' => 'diaspora:guid',
+
+ 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
+ 'Hashtag' => 'as:Hashtag'
+
+ ];
+
+ }
+
+ /**
+ * @brief Builds the activity packet and signs it if $channel is provided.
+ *
+ * @param array $obj
+ * @param array $channel (optional) default []
+ * @param bool $json_encode (optional) default true
+ * @return string|array
+ */
+
+ public static function build_packet(array $obj, array $channel = [], bool $json_encode = true): string|array {
+ $arr = array_merge(Activity::ap_context(), $obj);
+
+ if ($channel) {
+ // $proof = (new JcsEddsa2022)->sign($arr, $channel);
+ // $arr['proof'] = $proof;
+
+ $signature = LDSignatures::sign($arr, $channel);
+ $arr['signature'] = $signature;
+ }
+
+ if ($json_encode) {
+ return json_encode($arr, JSON_UNESCAPED_SLASHES);
+ }
+
+ return $arr;
+ }
+
+
}
diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php
index 4c3e3d8f8..c32f82e33 100644
--- a/Zotlabs/Lib/ActivityStreams.php
+++ b/Zotlabs/Lib/ActivityStreams.php
@@ -28,6 +28,7 @@ class ActivityStreams {
public $sigok = false;
public $recips = null;
public $raw_recips = null;
+ public $saved_recips = null;
/**
* @brief Constructor for ActivityStreams.