Page MenuHomePhabricator

D14026.diff
No OneTemporary

D14026.diff

diff --git a/keyserver/src/utils/identity-utils.js b/keyserver/src/utils/identity-utils.js
--- a/keyserver/src/utils/identity-utils.js
+++ b/keyserver/src/utils/identity-utils.js
@@ -70,9 +70,29 @@
);
}
+async function uploadOneTimeKeys(
+ identityInfo: IdentityInfo,
+ contentOneTimeKeys: $ReadOnlyArray<string>,
+ notifOneTimeKeys: $ReadOnlyArray<string>,
+): Promise<void> {
+ const [rustAPI, deviceID] = await Promise.all([
+ getRustAPI(),
+ getContentSigningKey(),
+ ]);
+
+ await rustAPI.uploadOneTimeKeys(
+ identityInfo.userId,
+ deviceID,
+ identityInfo.accessToken,
+ contentOneTimeKeys,
+ notifOneTimeKeys,
+ );
+}
+
export {
findUserIdentities,
privilegedDeleteUsers,
privilegedResetUserPassword,
syncPlatformDetails,
+ uploadOneTimeKeys,
};
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
@@ -21,6 +21,7 @@
retrieveAccountKeysSet,
} from 'lib/utils/olm-utils.js';
+import { uploadOneTimeKeys } from './identity-utils.js';
import {
fetchCallUpdateOlmAccount,
fetchOlmAccount,
@@ -207,12 +208,7 @@
}
async function uploadNewOneTimeKeys(numberOfKeys: number) {
- const [rustAPI, identityInfo, deviceID] = await Promise.all([
- getRustAPI(),
- verifyUserLoggedIn(),
- getContentSigningKey(),
- ]);
-
+ const identityInfo = await verifyUserLoggedIn();
if (!identityInfo) {
throw new ServerError('missing_identity_info');
}
@@ -246,13 +242,7 @@
'notif one-time keys not set after fetchCallUpdateOlmAccount',
);
- await rustAPI.uploadOneTimeKeys(
- identityInfo.userId,
- deviceID,
- identityInfo.accessToken,
- contentOneTimeKeys,
- notifOneTimeKeys,
- );
+ await uploadOneTimeKeys(identityInfo, contentOneTimeKeys, notifOneTimeKeys);
}
async function getContentSigningKey(): Promise<string> {

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 9:35 PM (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2598219
Default Alt Text
D14026.diff (1 KB)

Event Timeline