aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Libsync.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-01-07 19:58:09 +0000
committerMario <mario@mariovavti.com>2024-01-07 19:58:09 +0000
commit87775ae37ad7f8226f7413d28e96fd23967c7659 (patch)
tree330126a1fca83e4297b8b1d2d206b3940dbd7341 /Zotlabs/Lib/Libsync.php
parent256b66de41b2cd8dcdeb39fc5f080c5ff957e5d2 (diff)
downloadvolse-hubzilla-87775ae37ad7f8226f7413d28e96fd23967c7659.tar.gz
volse-hubzilla-87775ae37ad7f8226f7413d28e96fd23967c7659.tar.bz2
volse-hubzilla-87775ae37ad7f8226f7413d28e96fd23967c7659.zip
ekey and xchan_updated updates
Diffstat (limited to 'Zotlabs/Lib/Libsync.php')
-rw-r--r--Zotlabs/Lib/Libsync.php24
1 files changed, 14 insertions, 10 deletions
diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php
index 5f183192d..3130290f7 100644
--- a/Zotlabs/Lib/Libsync.php
+++ b/Zotlabs/Lib/Libsync.php
@@ -325,9 +325,6 @@ class Libsync {
if (array_key_exists('channel', $arr) && is_array($arr['channel']) && count($arr['channel'])) {
- $remote_channel = $arr['channel'];
- $remote_channel['channel_id'] = $channel['channel_id'];
-
if (array_key_exists('channel_pageflags', $arr['channel'])) {
// Several pageflags are site-specific and cannot be sync'd.
@@ -339,6 +336,8 @@ class Libsync {
}
+ $columns = db_columns('channel');
+
$disallowed = [
'channel_id', 'channel_account_id', 'channel_primary', 'channel_prvkey',
'channel_address', 'channel_notifyflags', 'channel_removed', 'channel_deleted',
@@ -349,16 +348,21 @@ class Libsync {
'channel_a_delegate'
];
- $clean = [];
+ if (empty($channel['channel_epubkey']) && empty($channel['channel_eprvkey'])) {
+ $eckey = sodium_crypto_sign_keypair();
+ $channel['channel_epubkey'] = sodium_bin2base64(sodium_crypto_sign_publickey($eckey), SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING);
+ $channel['channel_eprvkey'] = sodium_bin2base64(sodium_crypto_sign_secretkey($eckey), SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING);
+ }
+
foreach ($arr['channel'] as $k => $v) {
- if (in_array($k, $disallowed))
+ if (in_array($k, $disallowed)) {
+ continue;
+ }
+ if (!in_array($k, $columns)) {
continue;
- $clean[$k] = $v;
- }
- if (count($clean)) {
- foreach ($clean as $k => $v) {
- dbq("UPDATE channel set " . dbesc($k) . " = '" . dbesc($v) . "' where channel_id = " . intval($channel['channel_id']));
}
+ $r = dbq("UPDATE channel set " . dbesc($k) . " = '" . dbesc($v)
+ . "' where channel_id = " . intval($channel['channel_id']));
}
}