Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3384552
D14026.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D14026.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D14026: [keyserver] Extract uploadOneTimeKeys to a separate function
Attached
Detach File
Event Timeline
Log In to Comment