aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-07-24 20:23:00 -0700
committerzotlabs <mike@macgirvin.com>2017-07-24 20:23:00 -0700
commit6a7fa6bf5414a89c27f4f7d8da1ad8bb33d7c5a1 (patch)
tree03ab8d239542af18bf1f6b07bc21988a0696f25a /Zotlabs/Daemon
parent5ed4ed2246233d7e5c0a1136824a94e864420911 (diff)
downloadvolse-hubzilla-6a7fa6bf5414a89c27f4f7d8da1ad8bb33d7c5a1.tar.gz
volse-hubzilla-6a7fa6bf5414a89c27f4f7d8da1ad8bb33d7c5a1.tar.bz2
volse-hubzilla-6a7fa6bf5414a89c27f4f7d8da1ad8bb33d7c5a1.zip
provide a keychange operation to rebase an identity on a new keypair
Diffstat (limited to 'Zotlabs/Daemon')
-rw-r--r--Zotlabs/Daemon/Notifier.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index 20dd96ddd..f64e6748c 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -67,6 +67,7 @@ require_once('include/bbcode.php');
* location channel_id
* request channel_id xchan_hash message_id
* rating xlink_id
+ * keychange channel_id
*
*/
@@ -144,6 +145,20 @@ class Notifier {
$packet_type = 'request';
$normal_mode = false;
}
+ elseif($cmd === 'keychange') {
+ $channel = channelx_by_n($item_id);
+ $r = q("select abook_xchan from abook where abook_channel = %d",
+ intval($item_id)
+ );
+ if($r) {
+ foreach($r as $rr) {
+ $recipients[] = $rr['abook_xchan'];
+ }
+ }
+ $private = false;
+ $packet_type = 'keychange';
+ $normal_mode = false;
+ }
elseif($cmd == 'permission_update' || $cmd == 'permission_create') {
// Get the (single) recipient
$r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_self = 0",
@@ -570,12 +585,17 @@ class Notifier {
}
- $hash = random_string();
+ $hash = random_string();
$packet = null;
+ $pmsg = '';
if($packet_type === 'refresh' || $packet_type === 'purge') {
$packet = zot_build_packet($channel,$packet_type,(($packet_recips) ? $packet_recips : null));
}
+ if($packet_type === 'keychange') {
+ $packet = zot_build_packet($channel,$packet_type,(($packet_recips) ? $packet_recips : null));
+ $pmsg = get_pconfig($channel['channel_id'],'system','keychange');
+ }
elseif($packet_type === 'request') {
$env = (($hub_env && $hub_env[$hub['hubloc_host'] . $hub['hubloc_sitekey']]) ? $hub_env[$hub['hubloc_host'] . $hub['hubloc_sitekey']] : '');
$packet = zot_build_packet($channel,$packet_type,$env,$hub['hubloc_sitekey'],$hub['site_crypto'],
@@ -589,7 +609,8 @@ class Notifier {
'account_id' => $channel['channel_account_id'],
'channel_id' => $channel['channel_id'],
'posturl' => $hub['hubloc_callback'],
- 'notify' => $packet
+ 'notify' => $packet,
+ 'msg' => (($pmsg) ? json_encode($pmsg) : '')
));
}
else {