Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3382483
D7082.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7082.diff
View Options
diff --git a/keyserver/src/socket/session-utils.js b/keyserver/src/socket/session-utils.js
--- a/keyserver/src/socket/session-utils.js
+++ b/keyserver/src/socket/session-utils.js
@@ -12,6 +12,7 @@
import { usersInThreadInfo } from 'lib/shared/thread-utils.js';
import { hasMinCodeVersion } from 'lib/shared/version-utils.js';
import type { UpdateActivityResult } from 'lib/types/activity-types.js';
+import type { IdentityKeysBlob } from 'lib/types/crypto-types.js';
import { isDeviceType } from 'lib/types/device-types.js';
import type {
CalendarQuery,
@@ -65,11 +66,13 @@
setNewSession,
setCookiePlatform,
setCookiePlatformDetails,
+ setCookieSignedIdentityKeysBlob,
} from '../session/cookies.js';
import type { Viewer } from '../session/viewer.js';
import { activityUpdater } from '../updaters/activity-updaters.js';
import { compareNewCalendarQuery } from '../updaters/entry-updaters.js';
import type { SessionUpdate } from '../updaters/session-updaters.js';
+import { getOlmUtility } from '../utils/olm-utils.js';
const clientResponseInputValidator: TUnion<TInterface> = t.union([
tShape({
@@ -200,6 +203,33 @@
} else if (clientResponse.type === serverRequestTypes.MORE_ONE_TIME_KEYS) {
invariant(clientResponse.keys, 'keys expected in client response');
handleAsyncPromise(saveOneTimeKeys(viewer, clientResponse.keys));
+ } else if (
+ clientResponse.type === serverRequestTypes.SIGNED_IDENTITY_KEYS_BLOB
+ ) {
+ invariant(
+ clientResponse.signedIdentityKeysBlob,
+ 'signedIdentityKeysBlob expected in client response',
+ );
+ const { signedIdentityKeysBlob } = clientResponse;
+ const identityKeys: IdentityKeysBlob = JSON.parse(
+ signedIdentityKeysBlob.payload,
+ );
+ const olmUtil = getOlmUtility();
+ try {
+ olmUtil.ed25519_verify(
+ identityKeys.primaryIdentityPublicKeys.ed25519,
+ signedIdentityKeysBlob.payload,
+ signedIdentityKeysBlob.signature,
+ );
+ handleAsyncPromise(
+ setCookieSignedIdentityKeysBlob(
+ viewer.cookieID,
+ signedIdentityKeysBlob,
+ ),
+ );
+ } catch (e) {
+ continue;
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 11:01 AM (21 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2596743
Default Alt Text
D7082.diff (2 KB)
Attached To
Mode
D7082: [keyserver] Handle `SIGNED_IDENTITY_KEYS_BLOB` response
Attached
Detach File
Event Timeline
Log In to Comment