Skip to content

Commit 995ee3d

Browse files
committed
fix: bump to latest libsession-util dev
1 parent 8a9f18a commit 995ee3d

7 files changed

Lines changed: 35 additions & 36 deletions

File tree

.gitattributes

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
.circleci export-ignore
22
.github export-ignore
3-
libsession-util/external/libsodium-internal/test export-ignore
4-
libsession-util/external/zstd/doc export-ignore
5-
libsession-util/external/zstd/tests export-ignore
6-
libsession-util/tests export-ignore
7-
libsession-util/external/nlohmann-json/tests export-ignore
8-
libsession-util/external/nlohmann-json/docs export-ignore
9-
libsession-util/external/oxen-encoding/tests export-ignore
10-
libsession-util/external/oxen-libquic/external/ngtcp2 export-ignore
11-
libsession-util/external/oxen-libquic/tests export-ignore
3+
**/test export-ignore
4+
**/tests export-ignore
5+
**/doc export-ignore
6+
**/docs export-ignore
7+
libsession-util/session-router/external/oxen-libquic/external/ngtcp2 export-ignore
8+
9+
10+
# protobuf
1211
libsession-util/external/protobuf/csharp export-ignore
1312
libsession-util/external/protobuf/java export-ignore
1413
libsession-util/external/protobuf/objectivec export-ignore
1514
libsession-util/external/protobuf/php export-ignore
1615
libsession-util/external/protobuf/python export-ignore
1716
libsession-util/external/protobuf/ruby export-ignore
1817
libsession-util/external/protobuf/kokoro export-ignore
19-
libsession-util/external/oxen-libquic/external/oxen-logging/fmt/test export-ignore
20-
libsession-util/external/oxen-libquic/external/oxen-logging/spdlog/tests export-ignore
21-
libsession-util/external/oxen-libquic/external/oxen-encoding/tests export-ignore

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ SET(WITH_TESTS OFF)
5454
set(CMAKE_CXX_STANDARD 20)
5555
set(CMAKE_CXX_STANDARD_REQUIRED ON)
5656
set(CMAKE_CXX_EXTENSIONS OFF)
57-
set(ENABLE_ONIONREQ OFF)
57+
set(ENABLE_NETWORKING OFF)
5858

5959
# when building from a release of libsession on desktop, it complains that ios-cmake is not up to date
6060
# as it is not part of the archive. We actually don't care about it on session-desktop

libsession-util

Submodule libsession-util updated 101 files

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "libsession_util_nodejs",
44
"packageManager": "pnpm@10.28.1",
55
"description": "Wrappers for the Session Util Library",
6-
"version": "0.6.12",
6+
"version": "0.6.14",
77
"license": "GPL-3.0",
88
"author": {
99
"name": "Oxen Project",
@@ -13,7 +13,7 @@
1313
"clean": "rimraf .cache build",
1414
"lint:cpp": "cppcheck --std=c++20 -j8 src",
1515
"lint": "find src include -name '*.cpp' -o -name '*.hpp' | xargs clang-format-19 -i",
16-
"install": "cmake-js build --runtime=electron --runtime-version=40.0.0 --CDSUBMODULE_CHECK=OFF --CDLOCAL_MIRROR=https://oxen.rocks/deps --CDENABLE_ONIONREQ=OFF --CDWITH_TESTS=OFF",
16+
"install": "cmake-js build --runtime=electron --runtime-version=40.0.0 --CDSUBMODULE_CHECK=OFF --CDLOCAL_MIRROR=https://oxen.rocks/deps --CDENABLE_NETWORKING=OFF --CDWITH_TESTS=OFF",
1717
"prepare_release": "sh prepare_release.sh",
1818
"dedup": "pnpm dedupe --check"
1919
},

src/user_config.cpp

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ using config::UserProfile;
1717
session::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

types/pro/pro.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,21 @@ declare module 'libsession_util_nodejs' {
4343
rotatingPrivKeyHex: string;
4444
};
4545

46+
type WithRotatingSeedHex = {
47+
/**
48+
* 32 bytes, 64 chars
49+
*/
50+
rotatingPrivKeyHex: string;
51+
};
52+
4653
type ProConfig = WithRotatingPrivKeyHex & {
4754
proProof: ProProof;
4855
};
4956

57+
type ProConfigSet = WithRotatingSeedHex & {
58+
proProof: Omit<ProProof, 'rotatingPubkeyHex'>;
59+
};
60+
5061
export type ProOriginatingPlatform = 'Nil' | 'Google' | 'iOS';
5162

5263
export type ProBackendProviderConstantType = {

types/user/userconfig.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ declare module 'libsession_util_nodejs' {
3838
*/
3939
getNoteToSelfExpiry: () => number | undefined;
4040

41-
setProConfig: (proConfig: ProConfig) => void;
41+
setProConfig: (proConfig: ProConfigSet) => void;
4242
getProConfig: () => ProConfig | null;
4343
removeProConfig: () => boolean;
4444

0 commit comments

Comments
 (0)