Page MenuHomePhabricator

D13575.id.diff
No OneTemporary

D13575.id.diff

diff --git a/lib/types/identity-service-types.js b/lib/types/identity-service-types.js
--- a/lib/types/identity-service-types.js
+++ b/lib/types/identity-service-types.js
@@ -236,15 +236,6 @@
+notifOneTimeKeys: $ReadOnlyArray<string>,
};
-export type IdentityExistingDeviceKeyUpload = {
- +keyPayload: string,
- +keyPayloadSignature: string,
- +contentPrekey: string,
- +contentPrekeySignature: string,
- +notifPrekey: string,
- +notifPrekeySignature: string,
-};
-
// Device list types
export type RawDeviceList = {
diff --git a/web/grpc/identity-service-client-wrapper.js b/web/grpc/identity-service-client-wrapper.js
--- a/web/grpc/identity-service-client-wrapper.js
+++ b/web/grpc/identity-service-client-wrapper.js
@@ -19,7 +19,6 @@
type UserDevicesOlmOutboundKeys,
type IdentityAuthResult,
type IdentityNewDeviceKeyUpload,
- type IdentityExistingDeviceKeyUpload,
identityAuthResultValidator,
type UserDevicesOlmInboundKeys,
type DeviceOlmInboundKeys,
@@ -63,14 +62,12 @@
authClient: ?IdentityAuthClient.IdentityClientServicePromiseClient;
unauthClient: IdentityUnauthClient.IdentityClientServicePromiseClient;
getNewDeviceKeyUpload: () => Promise<IdentityNewDeviceKeyUpload>;
- getExistingDeviceKeyUpload: () => Promise<IdentityExistingDeviceKeyUpload>;
constructor(
platformDetails: PlatformDetails,
overridedOpaqueFilepath: string,
authLayer: ?IdentityServiceAuthLayer,
getNewDeviceKeyUpload: () => Promise<IdentityNewDeviceKeyUpload>,
- getExistingDeviceKeyUpload: () => Promise<IdentityExistingDeviceKeyUpload>,
) {
this.overridedOpaqueFilepath = overridedOpaqueFilepath;
this.platformDetails = platformDetails;
@@ -83,7 +80,6 @@
this.unauthClient =
IdentityServiceClientWrapper.createUnauthClient(platformDetails);
this.getNewDeviceKeyUpload = getNewDeviceKeyUpload;
- this.getExistingDeviceKeyUpload = getExistingDeviceKeyUpload;
}
static determineSocketAddr(): string {
@@ -351,14 +347,14 @@
}
const [identityDeviceKeyUpload] = await Promise.all([
- this.getExistingDeviceKeyUpload(),
+ this.getNewDeviceKeyUpload(),
initOpaque(this.overridedOpaqueFilepath),
]);
const opaqueLogin = new Login();
const startRequestBytes = opaqueLogin.start(password);
- const deviceKeyUpload = authExistingDeviceKeyUpload(
+ const deviceKeyUpload = authNewDeviceKeyUpload(
this.platformDetails,
identityDeviceKeyUpload,
);
@@ -420,8 +416,8 @@
siweMessage: string,
siweSignature: string,
) => {
- const identityDeviceKeyUpload = await this.getExistingDeviceKeyUpload();
- const deviceKeyUpload = authExistingDeviceKeyUpload(
+ const identityDeviceKeyUpload = await this.getNewDeviceKeyUpload();
+ const deviceKeyUpload = authNewDeviceKeyUpload(
this.platformDetails,
identityDeviceKeyUpload,
);
@@ -806,41 +802,6 @@
return deviceKeyUpload;
}
-function authExistingDeviceKeyUpload(
- platformDetails: PlatformDetails,
- uploadData: IdentityExistingDeviceKeyUpload,
-): DeviceKeyUpload {
- const {
- keyPayload,
- keyPayloadSignature,
- contentPrekey,
- contentPrekeySignature,
- notifPrekey,
- notifPrekeySignature,
- } = uploadData;
-
- const identityKeyInfo = createIdentityKeyInfo(
- keyPayload,
- keyPayloadSignature,
- );
-
- const contentPrekeyUpload = createPrekey(
- contentPrekey,
- contentPrekeySignature,
- );
-
- const notifPrekeyUpload = createPrekey(notifPrekey, notifPrekeySignature);
-
- const deviceKeyUpload = createDeviceKeyUpload(
- platformDetails,
- identityKeyInfo,
- contentPrekeyUpload,
- notifPrekeyUpload,
- );
-
- return deviceKeyUpload;
-}
-
function createIdentityKeyInfo(
keyPayload: string,
keyPayloadSignature: string,
diff --git a/web/shared-worker/worker/identity-client.js b/web/shared-worker/worker/identity-client.js
--- a/web/shared-worker/worker/identity-client.js
+++ b/web/shared-worker/worker/identity-client.js
@@ -2,10 +2,7 @@
import type { PlatformDetails } from 'lib/types/device-types.js';
-import {
- getNewDeviceKeyUpload,
- getExistingDeviceKeyUpload,
-} from './worker-crypto.js';
+import { getNewDeviceKeyUpload } from './worker-crypto.js';
import { IdentityServiceClientWrapper } from '../../grpc/identity-service-client-wrapper.js';
import {
type WorkerResponseMessage,
@@ -34,7 +31,6 @@
message.opaqueWasmPath,
message.authLayer,
async () => getNewDeviceKeyUpload(),
- async () => getExistingDeviceKeyUpload(),
);
return undefined;
}
diff --git a/web/shared-worker/worker/worker-crypto.js b/web/shared-worker/worker/worker-crypto.js
--- a/web/shared-worker/worker/worker-crypto.js
+++ b/web/shared-worker/worker/worker-crypto.js
@@ -19,10 +19,7 @@
type OutboundSessionCreationResult,
} from 'lib/types/crypto-types.js';
import type { PlatformDetails } from 'lib/types/device-types.js';
-import type {
- IdentityNewDeviceKeyUpload,
- IdentityExistingDeviceKeyUpload,
-} from 'lib/types/identity-service-types.js';
+import type { IdentityNewDeviceKeyUpload } from 'lib/types/identity-service-types.js';
import type { OlmSessionInitializationInfo } from 'lib/types/olm-session-types.js';
import type { InboundP2PMessage } from 'lib/types/sqlite-types.js';
import { getMessageForException } from 'lib/utils/errors.js';
@@ -33,7 +30,6 @@
getAccountPrekeysSet,
shouldForgetPrekey,
shouldRotatePrekey,
- retrieveIdentityKeysAndPrekeys,
olmSessionErrors,
} from 'lib/utils/olm-utils.js';
@@ -441,33 +437,6 @@
};
}
-async function getExistingDeviceKeyUpload(): Promise<IdentityExistingDeviceKeyUpload> {
- if (!cryptoStore) {
- throw new Error('Crypto account not initialized');
- }
- const { contentAccount } = cryptoStore;
- const [notifsCryptoAccount, signedIdentityKeysBlob] = await Promise.all([
- getNotifsCryptoAccount(),
- getSignedIdentityKeysBlob(),
- ]);
-
- const { prekey: contentPrekey, prekeySignature: contentPrekeySignature } =
- retrieveIdentityKeysAndPrekeys(contentAccount);
- const { prekey: notifPrekey, prekeySignature: notifPrekeySignature } =
- retrieveIdentityKeysAndPrekeys(notifsCryptoAccount.notificationAccount);
-
- await persistCryptoStore(notifsCryptoAccount);
-
- return {
- keyPayload: signedIdentityKeysBlob.payload,
- keyPayloadSignature: signedIdentityKeysBlob.signature,
- contentPrekey,
- contentPrekeySignature,
- notifPrekey,
- notifPrekeySignature,
- };
-}
-
function getNotifsPersistenceKeys(
cookie: ?string,
keyserverID: string,
@@ -1026,5 +995,4 @@
processAppOlmApiRequest,
getSignedIdentityKeysBlob,
getNewDeviceKeyUpload,
- getExistingDeviceKeyUpload,
};

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 3, 1:58 PM (20 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2223672
Default Alt Text
D13575.id.diff (6 KB)

Event Timeline