diff --git a/native/cpp/CommonCpp/NativeModules/CommRustModule.h b/native/cpp/CommonCpp/NativeModules/CommRustModule.h --- a/native/cpp/CommonCpp/NativeModules/CommRustModule.h +++ b/native/cpp/CommonCpp/NativeModules/CommRustModule.h @@ -33,9 +33,7 @@ jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, - jsi::String notifPrekeySignature, - jsi::Array contentOneTimeKeys, - jsi::Array notifOneTimeKeys) override; + jsi::String notifPrekeySignature) override; virtual jsi::Value registerWalletUser( jsi::Runtime &rt, jsi::String siweMessage, @@ -57,9 +55,7 @@ jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, - jsi::String notifPrekeySignature, - jsi::Array contentOneTimeKeys, - jsi::Array notifOneTimeKeys) override; + jsi::String notifPrekeySignature) override; virtual jsi::Value updatePassword( jsi::Runtime &rt, jsi::String userID, diff --git a/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp b/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp --- a/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp +++ b/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp @@ -93,9 +93,7 @@ jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, - jsi::String notifPrekeySignature, - jsi::Array contentOneTimeKeys, - jsi::Array notifOneTimeKeys) { + jsi::String notifPrekeySignature) { auto usernameRust = jsiStringToRustString(username, rt); auto passwordRust = jsiStringToRustString(password, rt); auto keyPayloadRust = jsiStringToRustString(keyPayload, rt); @@ -106,8 +104,6 @@ auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt); auto notifPrekeySignatureRust = jsiStringToRustString(notifPrekeySignature, rt); - auto contentOneTimeKeysRust = jsiStringArrayToRustVec(contentOneTimeKeys, rt); - auto notifOneTimeKeysRust = jsiStringArrayToRustVec(notifOneTimeKeys, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { @@ -124,8 +120,6 @@ contentPrekeySignatureRust, notifPrekeyRust, notifPrekeySignatureRust, - contentOneTimeKeysRust, - notifOneTimeKeysRust, currentID); } catch (const std::exception &e) { error = e.what(); @@ -199,9 +193,7 @@ jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, - jsi::String notifPrekeySignature, - jsi::Array contentOneTimeKeys, - jsi::Array notifOneTimeKeys) { + jsi::String notifPrekeySignature) { auto siweMessageRust = jsiStringToRustString(siweMessage, rt); auto siweSignatureRust = jsiStringToRustString(siweSignature, rt); auto keyPayloadRust = jsiStringToRustString(keyPayload, rt); @@ -212,8 +204,6 @@ auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt); auto notifPrekeySignatureRust = jsiStringToRustString(notifPrekeySignature, rt); - auto contentOneTimeKeysRust = jsiStringArrayToRustVec(contentOneTimeKeys, rt); - auto notifOneTimeKeysRust = jsiStringArrayToRustVec(notifOneTimeKeys, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { @@ -230,8 +220,6 @@ contentPrekeySignatureRust, notifPrekeyRust, notifPrekeySignatureRust, - contentOneTimeKeysRust, - notifOneTimeKeysRust, currentID); } catch (const std::exception &e) { error = e.what(); diff --git a/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp b/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp --- a/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp +++ b/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp @@ -19,13 +19,13 @@ return static_cast(&turboModule)->registerPasswordUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asObject(rt).asArray(rt), args[9].asObject(rt).asArray(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInPasswordUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { - return static_cast(&turboModule)->logInPasswordUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asObject(rt).asArray(rt), args[9].asObject(rt).asArray(rt)); + return static_cast(&turboModule)->logInPasswordUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerWalletUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->registerWalletUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asObject(rt).asArray(rt), args[9].asObject(rt).asArray(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInWalletUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { - return static_cast(&turboModule)->logInWalletUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asObject(rt).asArray(rt), args[9].asObject(rt).asArray(rt)); + return static_cast(&turboModule)->logInWalletUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_updatePassword(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->updatePassword(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt)); @@ -71,9 +71,9 @@ : TurboModule("CommRustTurboModule", jsInvoker) { methodMap_["generateNonce"] = MethodMetadata {0, __hostFunction_CommRustModuleSchemaCxxSpecJSI_generateNonce}; methodMap_["registerPasswordUser"] = MethodMetadata {10, __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerPasswordUser}; - methodMap_["logInPasswordUser"] = MethodMetadata {10, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInPasswordUser}; + methodMap_["logInPasswordUser"] = MethodMetadata {8, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInPasswordUser}; methodMap_["registerWalletUser"] = MethodMetadata {10, __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerWalletUser}; - methodMap_["logInWalletUser"] = MethodMetadata {10, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInWalletUser}; + methodMap_["logInWalletUser"] = MethodMetadata {8, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInWalletUser}; methodMap_["updatePassword"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_updatePassword}; methodMap_["deleteUser"] = MethodMetadata {3, __hostFunction_CommRustModuleSchemaCxxSpecJSI_deleteUser}; methodMap_["logOut"] = MethodMetadata {3, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logOut}; diff --git a/native/cpp/CommonCpp/_generated/rustJSI.h b/native/cpp/CommonCpp/_generated/rustJSI.h --- a/native/cpp/CommonCpp/_generated/rustJSI.h +++ b/native/cpp/CommonCpp/_generated/rustJSI.h @@ -22,9 +22,9 @@ public: virtual jsi::Value generateNonce(jsi::Runtime &rt) = 0; virtual jsi::Value registerPasswordUser(jsi::Runtime &rt, jsi::String username, jsi::String password, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) = 0; - virtual jsi::Value logInPasswordUser(jsi::Runtime &rt, jsi::String username, jsi::String password, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) = 0; + virtual jsi::Value logInPasswordUser(jsi::Runtime &rt, jsi::String username, jsi::String password, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature) = 0; virtual jsi::Value registerWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) = 0; - virtual jsi::Value logInWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) = 0; + virtual jsi::Value logInWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature) = 0; virtual jsi::Value updatePassword(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String password) = 0; virtual jsi::Value deleteUser(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) = 0; virtual jsi::Value logOut(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) = 0; @@ -75,13 +75,13 @@ return bridging::callFromJs( rt, &T::registerPasswordUser, jsInvoker_, instance_, std::move(username), std::move(password), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys)); } - jsi::Value logInPasswordUser(jsi::Runtime &rt, jsi::String username, jsi::String password, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) override { + jsi::Value logInPasswordUser(jsi::Runtime &rt, jsi::String username, jsi::String password, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature) override { static_assert( - bridging::getParameterCount(&T::logInPasswordUser) == 11, - "Expected logInPasswordUser(...) to have 11 parameters"); + bridging::getParameterCount(&T::logInPasswordUser) == 9, + "Expected logInPasswordUser(...) to have 9 parameters"); return bridging::callFromJs( - rt, &T::logInPasswordUser, jsInvoker_, instance_, std::move(username), std::move(password), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys)); + rt, &T::logInPasswordUser, jsInvoker_, instance_, std::move(username), std::move(password), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature)); } jsi::Value registerWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) override { static_assert( @@ -91,13 +91,13 @@ return bridging::callFromJs( rt, &T::registerWalletUser, jsInvoker_, instance_, std::move(siweMessage), std::move(siweSignature), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys)); } - jsi::Value logInWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) override { + jsi::Value logInWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature) override { static_assert( - bridging::getParameterCount(&T::logInWalletUser) == 11, - "Expected logInWalletUser(...) to have 11 parameters"); + bridging::getParameterCount(&T::logInWalletUser) == 9, + "Expected logInWalletUser(...) to have 9 parameters"); return bridging::callFromJs( - rt, &T::logInWalletUser, jsInvoker_, instance_, std::move(siweMessage), std::move(siweSignature), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys)); + rt, &T::logInWalletUser, jsInvoker_, instance_, std::move(siweMessage), std::move(siweSignature), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature)); } jsi::Value updatePassword(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String password) override { static_assert( diff --git a/native/identity-service/identity-service-context-provider.react.js b/native/identity-service/identity-service-context-provider.react.js --- a/native/identity-service/identity-service-context-provider.react.js +++ b/native/identity-service/identity-service-context-provider.react.js @@ -336,15 +336,11 @@ }, logInPasswordUser: async (username: string, password: string) => { await commCoreModule.initializeCryptoAccount(); - const [ - { blobPayload, signature, primaryIdentityPublicKeys }, - { contentOneTimeKeys, notificationsOneTimeKeys }, - prekeys, - ] = await Promise.all([ - commCoreModule.getUserPublicKey(), - commCoreModule.getOneTimeKeys(ONE_TIME_KEYS_NUMBER), - commCoreModule.validateAndGetPrekeys(), - ]); + const [{ blobPayload, signature, primaryIdentityPublicKeys }, prekeys] = + await Promise.all([ + commCoreModule.getUserPublicKey(), + commCoreModule.validateAndGetPrekeys(), + ]); const loginResult = await commRustModule.logInPasswordUser( username, password, @@ -354,8 +350,6 @@ prekeys.contentPrekeySignature, prekeys.notifPrekey, prekeys.notifPrekeySignature, - getOneTimeKeyValues(contentOneTimeKeys), - getOneTimeKeyValues(notificationsOneTimeKeys), ); const { userID, accessToken: token } = JSON.parse(loginResult); const identityAuthResult = { accessToken: token, userID, username }; @@ -418,15 +412,11 @@ siweSignature: string, ) => { await commCoreModule.initializeCryptoAccount(); - const [ - { blobPayload, signature, primaryIdentityPublicKeys }, - { contentOneTimeKeys, notificationsOneTimeKeys }, - prekeys, - ] = await Promise.all([ - commCoreModule.getUserPublicKey(), - commCoreModule.getOneTimeKeys(ONE_TIME_KEYS_NUMBER), - commCoreModule.validateAndGetPrekeys(), - ]); + const [{ blobPayload, signature, primaryIdentityPublicKeys }, prekeys] = + await Promise.all([ + commCoreModule.getUserPublicKey(), + commCoreModule.validateAndGetPrekeys(), + ]); const loginResult = await commRustModule.logInWalletUser( siweMessage, siweSignature, @@ -436,8 +426,6 @@ prekeys.contentPrekeySignature, prekeys.notifPrekey, prekeys.notifPrekeySignature, - getOneTimeKeyValues(contentOneTimeKeys), - getOneTimeKeyValues(notificationsOneTimeKeys), ); const { userID, accessToken: token } = JSON.parse(loginResult); const identityAuthResult = { diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs --- a/native/native_rust_library/src/lib.rs +++ b/native/native_rust_library/src/lib.rs @@ -88,8 +88,6 @@ content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, - content_one_time_keys: Vec, - notif_one_time_keys: Vec, promise_id: u32, ); @@ -118,8 +116,6 @@ content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, - content_one_time_keys: Vec, - notif_one_time_keys: Vec, promise_id: u32, ); @@ -675,8 +671,6 @@ content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, - content_one_time_keys: Vec, - notif_one_time_keys: Vec, promise_id: u32, ) { RUNTIME.spawn(async move { @@ -689,8 +683,8 @@ content_prekey_signature, notif_prekey, notif_prekey_signature, - content_one_time_keys, - notif_one_time_keys, + content_one_time_keys: Vec::new(), + notif_one_time_keys: Vec::new(), }; let result = log_in_password_user_helper(password_user_info).await; handle_string_result_as_callback(result, promise_id); @@ -782,8 +776,6 @@ content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, - content_one_time_keys: Vec, - notif_one_time_keys: Vec, promise_id: u32, ) { RUNTIME.spawn(async move { @@ -796,8 +788,8 @@ content_prekey_signature, notif_prekey, notif_prekey_signature, - content_one_time_keys, - notif_one_time_keys, + content_one_time_keys: Vec::new(), + notif_one_time_keys: Vec::new(), }; let result = log_in_wallet_user_helper(wallet_user_info).await; handle_string_result_as_callback(result, promise_id); diff --git a/native/schema/CommRustModuleSchema.js b/native/schema/CommRustModuleSchema.js --- a/native/schema/CommRustModuleSchema.js +++ b/native/schema/CommRustModuleSchema.js @@ -28,8 +28,6 @@ contentPrekeySignature: string, notifPrekey: string, notifPrekeySignature: string, - contentOneTimeKeys: $ReadOnlyArray, - notifOneTimeKeys: $ReadOnlyArray, ) => Promise; +registerWalletUser: ( siweMessage: string, @@ -52,8 +50,6 @@ contentPrekeySignature: string, notifPrekey: string, notifPrekeySignature: string, - contentOneTimeKeys: $ReadOnlyArray, - notifOneTimeKeys: $ReadOnlyArray, ) => Promise; +updatePassword: ( userID: string,