Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32221600
D14003.1765198725.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
11 KB
Referenced Files
None
Subscribers
None
D14003.1765198725.diff
View Options
diff --git a/lib/components/qr-auth-provider.react.js b/lib/components/qr-auth-provider.react.js
--- a/lib/components/qr-auth-provider.react.js
+++ b/lib/components/qr-auth-provider.react.js
@@ -7,7 +7,6 @@
import { uintArrayToHexString } from '../media/data-utils.js';
import { IdentityClientContext } from '../shared/identity-client-context.js';
import { useTunnelbroker } from '../tunnelbroker/tunnelbroker-context.js';
-import type { BackupKeys } from '../types/backup-types.js';
import {
tunnelbrokerToDeviceMessageTypes,
type TunnelbrokerToDeviceMessage,
@@ -20,6 +19,7 @@
import {
qrCodeAuthMessageTypes,
type QRCodeAuthMessagePayload,
+ type QRAuthBackupData,
} from '../types/tunnelbroker/qr-code-auth-message-types.js';
import { getContentSigningKey } from '../utils/crypto-utils.js';
@@ -35,7 +35,7 @@
encryptionKey: string,
message: QRCodeAuthMessage,
) => Promise<?QRCodeAuthMessagePayload>,
- +performBackupRestore?: (backupKeys: BackupKeys) => Promise<void>,
+ +performBackupRestore?: (qrAuthBackupData: QRAuthBackupData) => Promise<void>,
};
type QRData = ?{ +deviceID: string, +aesKey: string };
diff --git a/lib/types/backup-types.js b/lib/types/backup-types.js
--- a/lib/types/backup-types.js
+++ b/lib/types/backup-types.js
@@ -5,19 +5,6 @@
import { tShape } from '../utils/validation-utils.js';
-// This type should match `BackupKeysResult` in
-// `native/native_rust_library/src/backup.rs`
-export type BackupKeys = {
- +backupID: string,
- +backupDataKey: string,
- +backupLogDataKey: string,
-};
-export const backupKeysValidator: TInterface<BackupKeys> = tShape<BackupKeys>({
- backupID: t.String,
- backupDataKey: t.String,
- backupLogDataKey: t.String,
-});
-
// This type should match `SIWEBackupData` in
// `native/native_rust_library/src/backup.rs`
export type SIWEBackupData = {
diff --git a/lib/types/tunnelbroker/qr-code-auth-message-types.js b/lib/types/tunnelbroker/qr-code-auth-message-types.js
--- a/lib/types/tunnelbroker/qr-code-auth-message-types.js
+++ b/lib/types/tunnelbroker/qr-code-auth-message-types.js
@@ -12,7 +12,7 @@
SECONDARY_DEVICE_REGISTRATION_SUCCESS: 'SecondaryDeviceRegistrationSuccess',
});
-type QRAuthBackupData = {
+export type QRAuthBackupData = {
+backupID: string,
+backupDataKey: string,
+backupLogDataKey: string,
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
@@ -229,7 +229,7 @@
jsi::String backupDataKey,
jsi::String backupLogDataKey,
jsi::String maxVersion) override;
- virtual jsi::Value retrieveBackupKeys(jsi::Runtime &rt) override;
+ virtual jsi::Value getQRAuthBackupData(jsi::Runtime &rt) override;
virtual jsi::Value retrieveLatestBackupInfo(
jsi::Runtime &rt,
jsi::String userIdentifier) override;
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
@@ -2686,7 +2686,7 @@
});
}
-jsi::Value CommCoreModule::retrieveBackupKeys(jsi::Runtime &rt) {
+jsi::Value CommCoreModule::getQRAuthBackupData(jsi::Runtime &rt) {
return createPromiseAsJSIValue(
rt, [this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
taskType job = [this, &innerRt, promise]() {
diff --git a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
--- a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
+++ b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
@@ -193,8 +193,8 @@
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreBackupData(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->restoreBackupData(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt));
}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_retrieveBackupKeys(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->retrieveBackupKeys(rt);
+static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getQRAuthBackupData(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getQRAuthBackupData(rt);
}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_retrieveLatestBackupInfo(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->retrieveLatestBackupInfo(rt, args[0].asString(rt));
@@ -305,7 +305,7 @@
methodMap_["createFullBackup"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_createFullBackup};
methodMap_["restoreBackup"] = MethodMetadata {3, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreBackup};
methodMap_["restoreBackupData"] = MethodMetadata {4, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreBackupData};
- methodMap_["retrieveBackupKeys"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_retrieveBackupKeys};
+ methodMap_["getQRAuthBackupData"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getQRAuthBackupData};
methodMap_["retrieveLatestBackupInfo"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_retrieveLatestBackupInfo};
methodMap_["setSIWEBackupSecrets"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setSIWEBackupSecrets};
methodMap_["getSIWEBackupSecrets"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getSIWEBackupSecrets};
diff --git a/native/cpp/CommonCpp/_generated/commJSI.h b/native/cpp/CommonCpp/_generated/commJSI.h
--- a/native/cpp/CommonCpp/_generated/commJSI.h
+++ b/native/cpp/CommonCpp/_generated/commJSI.h
@@ -78,7 +78,7 @@
virtual jsi::Value createFullBackup(jsi::Runtime &rt, jsi::String backupSecret) = 0;
virtual jsi::Value restoreBackup(jsi::Runtime &rt, jsi::String backupSecret, jsi::String maxVersion, jsi::String backupID) = 0;
virtual jsi::Value restoreBackupData(jsi::Runtime &rt, jsi::String backupID, jsi::String backupDataKey, jsi::String backupLogDataKey, jsi::String maxVersion) = 0;
- virtual jsi::Value retrieveBackupKeys(jsi::Runtime &rt) = 0;
+ virtual jsi::Value getQRAuthBackupData(jsi::Runtime &rt) = 0;
virtual jsi::Value retrieveLatestBackupInfo(jsi::Runtime &rt, jsi::String userIdentifier) = 0;
virtual jsi::Value setSIWEBackupSecrets(jsi::Runtime &rt, jsi::Object siweBackupSecrets) = 0;
virtual jsi::Value getSIWEBackupSecrets(jsi::Runtime &rt) = 0;
@@ -580,13 +580,13 @@
return bridging::callFromJs<jsi::Value>(
rt, &T::restoreBackupData, jsInvoker_, instance_, std::move(backupID), std::move(backupDataKey), std::move(backupLogDataKey), std::move(maxVersion));
}
- jsi::Value retrieveBackupKeys(jsi::Runtime &rt) override {
+ jsi::Value getQRAuthBackupData(jsi::Runtime &rt) override {
static_assert(
- bridging::getParameterCount(&T::retrieveBackupKeys) == 1,
- "Expected retrieveBackupKeys(...) to have 1 parameters");
+ bridging::getParameterCount(&T::getQRAuthBackupData) == 1,
+ "Expected getQRAuthBackupData(...) to have 1 parameters");
return bridging::callFromJs<jsi::Value>(
- rt, &T::retrieveBackupKeys, jsInvoker_, instance_);
+ rt, &T::getQRAuthBackupData, jsInvoker_, instance_);
}
jsi::Value retrieveLatestBackupInfo(jsi::Runtime &rt, jsi::String userIdentifier) override {
static_assert(
diff --git a/native/native_rust_library/src/backup.rs b/native/native_rust_library/src/backup.rs
--- a/native/native_rust_library/src/backup.rs
+++ b/native/native_rust_library/src/backup.rs
@@ -494,7 +494,6 @@
})
}
-// This struct should match `BackupKeys` in `lib/types/backup-types.js`
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
struct BackupKeysResult {
diff --git a/native/profile/secondary-device-qr-code-scanner.react.js b/native/profile/secondary-device-qr-code-scanner.react.js
--- a/native/profile/secondary-device-qr-code-scanner.react.js
+++ b/native/profile/secondary-device-qr-code-scanner.react.js
@@ -160,7 +160,7 @@
const sendDeviceListUpdateSuccessMessage = async () => {
let backupData = null;
if (deviceType !== identityDeviceTypes.KEYSERVER) {
- backupData = await commCoreModule.retrieveBackupKeys();
+ backupData = await commCoreModule.getQRAuthBackupData();
}
const message = await composeTunnelbrokerQRAuthMessage(encryptionKey, {
type: qrCodeAuthMessageTypes.DEVICE_LIST_UPDATE_SUCCESS,
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -8,7 +8,6 @@
import type { ClientDBMessageStoreOperation } from 'lib/ops/message-store-ops.js';
import type { ClientDBReportStoreOperation } from 'lib/ops/report-store-ops.js';
import type { ClientDBThreadStoreOperation } from 'lib/ops/thread-store-ops.js';
-import type { BackupKeys } from 'lib/types/backup-types.js';
import type {
OneTimeKeysResult,
SignedPrekeys,
@@ -27,6 +26,7 @@
ClientDBStoreOperations,
} from 'lib/types/store-ops-types';
import type { ClientDBThreadInfo } from 'lib/types/thread-types.js';
+import type { QRAuthBackupData } from 'lib/types/tunnelbroker/qr-code-auth-message-types.js';
type CommServicesAuthMetadata = {
+userID?: ?string,
@@ -170,7 +170,7 @@
backupLogDataKey: string,
maxVersion: string,
) => Promise<void>;
- +retrieveBackupKeys: () => Promise<Object>;
+ +getQRAuthBackupData: () => Promise<Object>;
+retrieveLatestBackupInfo: (userIdentifier: string) => Promise<string>;
+setSIWEBackupSecrets: (siweBackupSecrets: Object) => Promise<void>;
+getSIWEBackupSecrets: () => Promise<?Object>;
@@ -238,7 +238,7 @@
+processDBStoreOperations: (
operations: ClientDBStoreOperations,
) => Promise<void>;
- +retrieveBackupKeys: () => Promise<BackupKeys>;
+ +getQRAuthBackupData: () => Promise<QRAuthBackupData>;
}
export default (TurboModuleRegistry.getEnforcing<Spec>(
diff --git a/native/utils/qr-code-utils.js b/native/utils/qr-code-utils.js
--- a/native/utils/qr-code-utils.js
+++ b/native/utils/qr-code-utils.js
@@ -1,7 +1,6 @@
// @flow
import { hexToUintArray } from 'lib/media/data-utils.js';
-import type { BackupKeys } from 'lib/types/backup-types.js';
import {
peerToPeerMessageTypes,
type QRCodeAuthMessage,
@@ -9,6 +8,7 @@
import {
qrCodeAuthMessagePayloadValidator,
type QRCodeAuthMessagePayload,
+ type QRAuthBackupData,
} from 'lib/types/tunnelbroker/qr-code-auth-message-types.js';
import { getMessageForException } from 'lib/utils/errors.js';
@@ -79,8 +79,10 @@
}
}
-function performBackupRestore(backupKeys: BackupKeys): Promise<void> {
- const { backupID, backupDataKey, backupLogDataKey } = backupKeys;
+function performBackupRestore(
+ qrAuthBackupData: QRAuthBackupData,
+): Promise<void> {
+ const { backupID, backupDataKey, backupLogDataKey } = qrAuthBackupData;
return commCoreModule.restoreBackupData(
backupID,
backupDataKey,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 8, 12:58 PM (13 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5848357
Default Alt Text
D14003.1765198725.diff (11 KB)
Attached To
Mode
D14003: [native] remove `BackupKeys` and use `QRAuthBackupData`
Attached
Detach File
Event Timeline
Log In to Comment