aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-09-03 19:56:13 -0700
committerzotlabs <mike@macgirvin.com>2017-09-03 19:56:13 -0700
commit47ef41695a3d30ca59ffb137745a7d3151b0df81 (patch)
tree9687aef4a2949a36872141e73f824fa6309e32d3 /Zotlabs
parent4adf2caaa687287cf82b930bb5a0c07d39c7afc0 (diff)
downloadvolse-hubzilla-47ef41695a3d30ca59ffb137745a7d3151b0df81.tar.gz
volse-hubzilla-47ef41695a3d30ca59ffb137745a7d3151b0df81.tar.bz2
volse-hubzilla-47ef41695a3d30ca59ffb137745a7d3151b0df81.zip
sign zot-info packets with httpsignatures
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Zfinger.php29
1 files changed, 28 insertions, 1 deletions
diff --git a/Zotlabs/Module/Zfinger.php b/Zotlabs/Module/Zfinger.php
index 2ff605fc9..b978b9769 100644
--- a/Zotlabs/Module/Zfinger.php
+++ b/Zotlabs/Module/Zfinger.php
@@ -9,8 +9,35 @@ class Zfinger extends \Zotlabs\Web\Controller {
require_once('include/zot.php');
require_once('include/crypto.php');
-
$x = zotinfo($_REQUEST);
+
+ if($x && $x['guid'] && $x['guid_sig']) {
+ $chan_hash = make_xchan_hash($x['guid'],$x['guid_sig']);
+ if($chan_hash) {
+ $chan = channelx_by_hash($chan_hash);
+ }
+ }
+
+ $headers = [];
+ $headers['Content-Type'] = 'application/json' ;
+ $ret = json_encode($x);
+
+ if($chan) {
+ $hash = \Zotlabs\Web\HTTPSig::generate_digest($ret,false);
+ $headers['Digest'] = 'SHA-256=' . $hash;
+ \Zotlabs\Web\HTTPSig::create_sig('',$headers,$chan['channel_prvkey'],z_root() . '/channel/' . $chan['channel_address'],true);
+ }
+ else {
+ foreach($headers as $k => $v) {
+ header($k . ': ' . $v);
+ }
+ }
+
+ echo $ret;
+ killme();
+
+
+
json_return_and_die($x);
}