@@ -17,14 +17,14 @@ using config::UserProfile;
1717session::config::ProConfig pro_config_from_object (Napi::Object input) {
1818 session::config::ProConfig pro_config = {};
1919
20- auto rotating_privkey_hex_js = input.Get (" rotatingPrivKeyHex " );
21- assertIsString (rotating_privkey_hex_js , " pro_config_from_object.rotating_privkey_js " );
22- auto rotating_privkey_cpp = from_hex_to_vector (
23- toCppString (rotating_privkey_hex_js , " pro_config_from_object.rotating_privkey_js " ));
24- assert_length (rotating_privkey_cpp, 64 , " pro_config_from_object.rotating_privkey_js " );
20+ auto rotating_seed_hex_js = input.Get (" rotatingSeedHex " );
21+ assertIsString (rotating_seed_hex_js , " pro_config_from_object.rotating_seed_js " );
22+ auto rotating_seed_cpp = from_hex_to_vector (
23+ toCppString (rotating_seed_hex_js , " pro_config_from_object.rotating_seed_js " ));
24+ assert_length (rotating_seed_cpp, 32 , " pro_config_from_object.rotating_seed_js " );
2525 std::copy (
26- rotating_privkey_cpp .begin (),
27- rotating_privkey_cpp .end (),
26+ rotating_seed_cpp .begin (),
27+ rotating_seed_cpp .end (),
2828 pro_config.rotating_privkey .begin ());
2929
3030 auto proProof = input.Get (" proProof" );
@@ -46,18 +46,6 @@ session::config::ProConfig pro_config_from_object(Napi::Object input) {
4646 gen_index_hash_cpp.end (),
4747 pro_config.proof .gen_index_hash .begin ());
4848
49- // extract rotatingPubkeyHex
50- auto rotating_pubkey_hex_js = proof_js.Get (" rotatingPubkeyHex" );
51- assertIsString (rotating_pubkey_hex_js, " pro_config_from_object.rotatingPubkeyHex" );
52- auto rotating_pubkey_hex_cpp =
53- toCppString (rotating_pubkey_hex_js, " pro_config_from_object.rotatingPubkeyHex" );
54- auto rotating_pubkey_cpp = from_hex_to_vector (rotating_pubkey_hex_cpp);
55- assert_length (rotating_pubkey_cpp, 32 , " pro_config_from_object.rotatingPubkeyHex" );
56- std::copy (
57- rotating_pubkey_cpp.begin (),
58- rotating_pubkey_cpp.end (),
59- pro_config.proof .rotating_pubkey .begin ());
60-
6149 // extract backend signature
6250 auto signature_hex_js = proof_js.Get (" signatureHex" );
6351 assertIsString (signature_hex_js, " pro_config_from_object.signature_hex_js" );
@@ -278,6 +266,10 @@ void UserConfigWrapper::setProConfig(const Napi::CallbackInfo& info) {
278266 auto pro_config_js = info[0 ];
279267 assertIsObject (pro_config_js);
280268
269+ // This is quite messed up, but the type expected by libsession is not correct here.
270+ // It needs a seed in the rotatingPrivKey and will discard the rotatingPubkey in the
271+ // proProof.
272+ // When calling get_pro_config, it will deduce those two from the seed stored above.
281273 session::config::ProConfig pro_config =
282274 pro_config_from_object (pro_config_js.As <Napi::Object>());
283275
0 commit comments