Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3361518
D11230.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11230.diff
View Options
diff --git a/lib/utils/services-utils.js b/lib/utils/services-utils.js
--- a/lib/utils/services-utils.js
+++ b/lib/utils/services-utils.js
@@ -9,6 +9,11 @@
// other Comm services.
const usingCommServicesAccessToken = false;
+// If this is true, then the app is able to support multiple keyservers. This
+// requires the use of Tunnelbroker and the backup service to persist and sync
+// the KeyserverStore.
+const supportingMultipleKeyservers = false;
+
// If this is false, then the app no longer needs to rely on being connected to
// an authoritative keyserver for things like DMs.
const relyingOnAuthoritativeKeyserver = true;
@@ -40,6 +45,7 @@
export {
handleHTTPResponseError,
usingCommServicesAccessToken,
+ supportingMultipleKeyservers,
relyingOnAuthoritativeKeyserver,
createHTTPAuthorizationHeader,
createDefaultHTTPRequestHeaders,
diff --git a/native/data/sqlite-data-handler.js b/native/data/sqlite-data-handler.js
--- a/native/data/sqlite-data-handler.js
+++ b/native/data/sqlite-data-handler.js
@@ -1,5 +1,6 @@
// @flow
+import invariant from 'invariant';
import * as React from 'react';
import { setClientDBStoreActionType } from 'lib/actions/client-db-store-actions.js';
@@ -21,6 +22,7 @@
import { getMessageForException } from 'lib/utils/errors.js';
import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js';
import { useDispatch } from 'lib/utils/redux-utils.js';
+import { supportingMultipleKeyservers } from 'lib/utils/services-utils.js';
import { resolveKeyserverSessionInvalidationUsingNativeCredentials } from '../account/legacy-recover-keyserver-session.js';
import { authoritativeKeyserverID } from '../authoritative-keyserver.js';
@@ -108,6 +110,21 @@
],
);
+ const recoverData = React.useCallback(
+ (source: RecoveryActionSource) => {
+ if (supportingMultipleKeyservers) {
+ invariant(
+ false,
+ 'recoverData in SQLiteDataHandler is not yet implemented when ' +
+ 'supportingMultipleKeyservers is enabled. It should recover ' +
+ 'from broken SQLite state by restoring from backup service',
+ );
+ }
+ return recoverDataFromAuthoritativeKeyserver(source);
+ },
+ [recoverDataFromAuthoritativeKeyserver],
+ );
+
const callClearSensitiveData = React.useCallback(
async (triggeredBy: string) => {
await clearSensitiveData();
@@ -161,9 +178,7 @@
commCoreModule.terminate();
}
}
- await recoverDataFromAuthoritativeKeyserver(
- recoveryActionSources.corruptedDatabaseDeletion,
- );
+ await recoverData(recoveryActionSources.corruptedDatabaseDeletion);
})();
return;
}
@@ -228,9 +243,7 @@
'{no exception message}',
);
}
- await recoverDataFromAuthoritativeKeyserver(
- recoveryActionSources.sqliteLoadFailure,
- );
+ await recoverData(recoveryActionSources.sqliteLoadFailure);
}
})();
}, [
@@ -241,7 +254,7 @@
rehydrateConcluded,
staffCanSee,
storeLoaded,
- recoverDataFromAuthoritativeKeyserver,
+ recoverData,
callClearSensitiveData,
mediaCacheContext,
]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 5:51 PM (21 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2580588
Default Alt Text
D11230.diff (3 KB)
Attached To
Mode
D11230: [lib][native] Introduce supportingMultipleKeyservers constant
Attached
Detach File
Event Timeline
Log In to Comment