Skip to content

Instantly share code, notes, and snippets.

@vdhanan
Created February 6, 2024 22:54
Show Gist options
  • Save vdhanan/8d3b72f5ce43cedf35e6a265290348b7 to your computer and use it in GitHub Desktop.
Save vdhanan/8d3b72f5ce43cedf35e6a265290348b7 to your computer and use it in GitHub Desktop.
test plan for D10977
diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
index 2a21d8f2e..16f350e1d 100644
--- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
@@ -136,6 +136,10 @@ std::string CryptoModule::getIdentityKeys() {
std::string
CryptoModule::getOneTimeKeysForPublishing(size_t oneTimeKeysAmount) {
+ // REMOVE THIS START
+ // generating one one-time key to see how function handles its presence
+ this->generateOneTimeKeys(1);
+ // REMOVE THIS END
OlmBuffer unpublishedOneTimeKeys;
unpublishedOneTimeKeys.resize(
::olm_account_one_time_keys_length(this->getOlmAccount()));
diff --git a/native/profile/edit-password.react.js b/native/profile/edit-password.react.js
index 1a027ac43..ad3b7d62b 100644
--- a/native/profile/edit-password.react.js
+++ b/native/profile/edit-password.react.js
@@ -16,6 +16,7 @@ import {
changeKeyserverUserPassword,
} from 'lib/actions/user-actions.js';
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js';
+import { getOneTimeKeyValues } from 'lib/shared/crypto-utils.js';
import type { LoadingStatus } from 'lib/types/loading-types.js';
import type { PasswordUpdate } from 'lib/types/user-types.js';
import { useLegacyAshoatKeyserverCall } from 'lib/utils/action-utils.js';
@@ -28,6 +29,7 @@ import type { ProfileNavigationProp } from './profile.react.js';
import { setNativeCredentials } from '../account/native-credentials.js';
import Button from '../components/button.react.js';
import TextInput from '../components/text-input.react.js';
+import { commCoreModule } from '../native-modules.js';
import type { NavigationRoute } from '../navigation/route-names.js';
import { useSelector } from '../redux/redux-utils.js';
import { type Colors, useColors, useStyles } from '../themes/colors.js';
@@ -289,6 +291,12 @@ class EditPassword extends React.PureComponent<Props, State> {
return;
}
try {
+ const otks = await commCoreModule.getOneTimeKeys(10);
+ console.log(otks);
+ console.log(getOneTimeKeyValues(otks.contentOneTimeKeys));
+ const otks2 = await commCoreModule.getOneTimeKeys(10);
+ console.log(otks2);
+ console.log(getOneTimeKeyValues(otks2.contentOneTimeKeys));
await this.props.changeKeyserverUserPassword({
updatedFields: {
password: this.state.newPassword,
@@ -301,6 +309,7 @@ class EditPassword extends React.PureComponent<Props, State> {
});
this.goBackOnce();
} catch (e) {
+ console.log(e);
if (e.message === 'invalid_credentials') {
Alert.alert(
'Incorrect password',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment