diff options
author | Mario <mario@mariovavti.com> | 2024-01-07 19:58:09 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-01-07 19:58:09 +0000 |
commit | 87775ae37ad7f8226f7413d28e96fd23967c7659 (patch) | |
tree | 330126a1fca83e4297b8b1d2d206b3940dbd7341 /include | |
parent | 256b66de41b2cd8dcdeb39fc5f080c5ff957e5d2 (diff) | |
download | volse-hubzilla-87775ae37ad7f8226f7413d28e96fd23967c7659.tar.gz volse-hubzilla-87775ae37ad7f8226f7413d28e96fd23967c7659.tar.bz2 volse-hubzilla-87775ae37ad7f8226f7413d28e96fd23967c7659.zip |
ekey and xchan_updated updates
Diffstat (limited to 'include')
-rw-r--r-- | include/channel.php | 7 | ||||
-rw-r--r-- | include/import.php | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/channel.php b/include/channel.php index 640274348..fc19d85ab 100644 --- a/include/channel.php +++ b/include/channel.php @@ -236,6 +236,10 @@ function create_identity($arr) { $guid = Libzot::new_uid($nick); $key = Crypto::new_keypair(4096); + $eckey = sodium_crypto_sign_keypair(); + $ekey['pubkey'] = sodium_bin2base64(sodium_crypto_sign_publickey($eckey), SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING); + $ekey['prvkey'] = sodium_bin2base64(sodium_crypto_sign_secretkey($eckey), SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING); + // zot6 $sig = Libzot::sign($guid,$key['prvkey']); $hash = Libzot::make_xchan_hash($guid,$key['pubkey']); @@ -275,6 +279,8 @@ function create_identity($arr) { 'channel_portable_id' => '', 'channel_prvkey' => $key['prvkey'], 'channel_pubkey' => $key['pubkey'], + 'channel_eprvkey' => $ekey['prvkey'], + 'channel_epubkey' => $ekey['pubkey'], 'channel_pageflags' => intval($pageflags), 'channel_system' => intval($system), 'channel_expire_days' => intval($expire), @@ -370,6 +376,7 @@ function create_identity($arr) { 'xchan_guid' => $guid, 'xchan_guid_sig' => $sig, 'xchan_pubkey' => $key['pubkey'], + 'xchan_epubkey' => (new Multibase())->publicKey($ekey['pubkey']), 'xchan_photo_mimetype' => (($photo_type) ? $photo_type : 'image/png'), 'xchan_photo_l' => z_root() . "/photo/profile/l/{$newuid}", 'xchan_photo_m' => z_root() . "/photo/profile/m/{$newuid}", diff --git a/include/import.php b/include/import.php index 291dd2638..7dac518f5 100644 --- a/include/import.php +++ b/include/import.php @@ -80,6 +80,12 @@ function import_channel($channel, $account_id, $seize, $newname = '') { } } + 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); + } + unset($channel['channel_id']); $channel['channel_account_id'] = $account_id; $channel['channel_primary'] = (($seize) ? 1 : 0); |