Skip to content

Instantly share code, notes, and snippets.

@vdhanan
Last active April 26, 2024 19:51
Show Gist options
  • Save vdhanan/be35b6552248428fce2d20a55c6b65cb to your computer and use it in GitHub Desktop.
Save vdhanan/be35b6552248428fce2d20a55c6b65cb to your computer and use it in GitHub Desktop.
diff --git a/keyserver/src/user/login.js b/keyserver/src/user/login.js
index 57e54776bb..99823c4897 100644
--- a/keyserver/src/user/login.js
+++ b/keyserver/src/user/login.js
@@ -30,6 +30,7 @@ function markKeysAsPublished(account: OlmAccount) {
// Before attempting login
function markPrekeyAsPublished(account: OlmAccount) {
+ console.log('unpublished prekey', account.unpublished_prekey());
account.mark_prekey_as_published();
+ console.log(
+ 'unpublished prekey should be null',
+ account.unpublished_prekey(),
+ );
}
@@ -61,6 +62,7 @@ async function getUserCredentials(): Promise<UserCredentials> {
}
async function verifyUserLoggedIn(): Promise<IdentityInfo> {
+ console.log('got here');
const userInfoPromise = getUserCredentials();
const result = await fetchIdentityInfo();
@@ -195,11 +197,20 @@ async function registerOrLogInBase<T>(
getUpdateContentAccount(contentAccountCallback),
]);
+ console.log('prekey before marking as published:', contentPrekey);
+
try {
await Promise.all([
getUpdateContentAccount(markPrekeyAsPublished),
getUpdateNotificationsAccount(markPrekeyAsPublished),
]);
+
+ const { prekey: newPrekey } = await getUpdateContentAccount(
+ contentAccountCallback,
+ );
+
+ console.log('prekey after marking as published:', newPrekey);
+
return await rustAPI.loginUser(
userInfo.username,
userInfo.password,
@vdhanan
Copy link
Author

vdhanan commented Apr 26, 2024

From logs:

[NODEM] prekey before marking as published: e5YteRTKpSoNJ9WAZsqhPyaJuaQaMAPYcYYGfCTm3WQ
[NODEM] unpublished prekey {"curve25519":{"AAAAAQ":"e5YteRTKpSoNJ9WAZsqhPyaJuaQaMAPYcYYGfCTm3WQ"}}
[NODEM] unpublished prekey should be null null
[NODEM] prekey after marking as published: e5YteRTKpSoNJ9WAZsqhPyaJuaQaMAPYcYYGfCTm3WQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment