Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2842517
D11810.id39588.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11810.id39588.diff
View Options
diff --git a/keyserver/src/responders/keys-responders.js b/keyserver/src/responders/keys-responders.js
--- a/keyserver/src/responders/keys-responders.js
+++ b/keyserver/src/responders/keys-responders.js
@@ -45,13 +45,13 @@
retrieveSessionInitializationKeysSet,
);
- const contentAccountCallback = async (account: OlmAccount) => {
+ const contentAccountCallback = (account: OlmAccount) => {
const {
identityKeys: contentIdentityKeys,
oneTimeKey,
prekey,
prekeySignature,
- } = await retrieveSessionInitializationKeysSet(account);
+ } = retrieveSessionInitializationKeysSet(account);
const identityKeysBlob = {
primaryIdentityPublicKeys: JSON.parse(contentIdentityKeys),
diff --git a/keyserver/src/user/login.js b/keyserver/src/user/login.js
--- a/keyserver/src/user/login.js
+++ b/keyserver/src/user/login.js
@@ -22,12 +22,17 @@
import { unpickleOlmAccount } from '../utils/olm-utils.js';
import type { PickledOlmAccount } from '../utils/olm-utils.js';
-// After register or login is successful
+// Before attempting registration
function markKeysAsPublished(account: OlmAccount) {
account.mark_prekey_as_published();
account.mark_keys_as_published();
}
+// Before attempting login
+function markPrekeyAsPublished(account: OlmAccount) {
+ account.mark_prekey_as_published();
+}
+
async function getUserCredentials(): Promise<UserCredentials> {
const userInfo = await getCommConfig<UserCredentials>({
folder: 'secrets',
@@ -191,7 +196,11 @@
]);
try {
- const identity_info = await rustAPI.loginUser(
+ await Promise.all([
+ getUpdateContentAccount(markPrekeyAsPublished),
+ getUpdateNotificationsAccount(markPrekeyAsPublished),
+ ]);
+ return await rustAPI.loginUser(
userInfo.username,
userInfo.password,
signedIdentityKeysBlob,
@@ -201,11 +210,6 @@
notificationsPrekeySignature,
userInfo.forceLogin,
);
- await Promise.all([
- getUpdateContentAccount(markKeysAsPublished),
- getUpdateNotificationsAccount(markKeysAsPublished),
- ]);
- return identity_info;
} catch (e) {
console.warn('Failed to login user: ' + getMessageForException(e));
const [contentOneTimeKeys, notificationsOneTimeKeys] = await Promise.all([
@@ -217,7 +221,11 @@
),
]);
try {
- const identity_info = await rustAPI.registerUser(
+ await Promise.all([
+ getUpdateContentAccount(markKeysAsPublished),
+ getUpdateNotificationsAccount(markKeysAsPublished),
+ ]);
+ return await rustAPI.registerUser(
userInfo.username,
userInfo.password,
signedIdentityKeysBlob,
@@ -228,11 +236,6 @@
contentOneTimeKeys,
notificationsOneTimeKeys,
);
- await Promise.all([
- getUpdateContentAccount(markKeysAsPublished),
- getUpdateNotificationsAccount(markKeysAsPublished),
- ]);
- return identity_info;
} catch (err) {
console.warn('Failed to register user: ' + getMessageForException(err));
if (userInfo.usingIdentityCredentials) {
diff --git a/keyserver/src/utils/olm-utils.js b/keyserver/src/utils/olm-utils.js
--- a/keyserver/src/utils/olm-utils.js
+++ b/keyserver/src/utils/olm-utils.js
@@ -164,8 +164,6 @@
contentAccount.generate_prekey();
notifAccount.generate_prekey();
await publishPrekeysToIdentity(contentAccount, notifAccount);
- contentAccount.mark_prekey_as_published();
- notifAccount.mark_prekey_as_published();
}
if (shouldForgetPrekey(contentAccount)) {
contentAccount.forget_old_prekey();
@@ -203,6 +201,9 @@
return;
}
+ contentAccount.mark_prekey_as_published();
+ notifAccount.mark_prekey_as_published();
+
await rustAPI.publishPrekeys(
identityInfo.userId,
deviceID,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Sep 30, 2:22 PM (21 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2205432
Default Alt Text
D11810.id39588.diff (3 KB)
Attached To
Mode
D11810: [keyserver] mark prekeys and OTKs as published right before calling identity service
Attached
Detach File
Event Timeline
Log In to Comment