aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-01-10 13:33:57 +0000
committerMario <mario@mariovavti.com>2024-01-10 13:33:57 +0000
commit58593d7da6a893e681b7c64fdf21a02c93dfa0d0 (patch)
tree9da45b10745d41f4fe66afff9c27b87589ce5e91 /include/network.php
parent4aa29db7aac6c389a1908a53bce2ec36d7f94ee1 (diff)
downloadvolse-hubzilla-58593d7da6a893e681b7c64fdf21a02c93dfa0d0.tar.gz
volse-hubzilla-58593d7da6a893e681b7c64fdf21a02c93dfa0d0.tar.bz2
volse-hubzilla-58593d7da6a893e681b7c64fdf21a02c93dfa0d0.zip
prepare outbound fep-8b32 (object integrity) but do not enable yet since the additional context seems to break ldsig for some reason, introduce Activity::build_packet() and Activity::ap_context() to reduce code duplication, implement fep-2c59 (webfinger) and some cleanup
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php17
1 files changed, 5 insertions, 12 deletions
diff --git a/include/network.php b/include/network.php
index 13339eccd..854434d5a 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1,6 +1,6 @@
<?php
-use Zotlabs\Lib\LDSignatures;
+use Zotlabs\Lib\Activity;
use Zotlabs\Lib\Zotfinger;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Queue;
@@ -423,24 +423,17 @@ function json_return_and_die($x, $content_type = 'application/json') {
killme();
}
-function as_return_and_die($obj,$channel) {
+function as_return_and_die($obj, $channel) {
- $x = array_merge(['@context' => [
- ACTIVITYSTREAMS_JSONLD_REV,
- 'https://w3id.org/security/v1',
- z_root() . ZOT_APSCHEMA_REV
- ]], $obj );
+ $ret = Activity::build_packet($obj, $channel);
+ logger('data: ' . jindent($ret), LOGGER_DATA);
- $headers = [];
$headers['Content-Type'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ;
- $x['signature'] = LDSignatures::sign($x,$channel);
- $ret = json_encode($x, JSON_UNESCAPED_SLASHES);
- logger('data: ' . jindent($ret), LOGGER_DATA);
$headers['Date'] = datetime_convert('UTC','UTC', 'now', 'D, d M Y H:i:s \\G\\M\\T');
$headers['Digest'] = HTTPSig::generate_digest_header($ret);
$headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
- $h = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel));
+ $h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel));
HTTPSig::set_headers($h);
echo $ret;