diff --git a/lib/types/holder-types.js b/lib/types/holder-types.js new file mode 100644 --- /dev/null +++ b/lib/types/holder-types.js @@ -0,0 +1,19 @@ +// @flow + +export type HolderStatus = + | 'PENDING_ESTABLISHMENT' + | 'ESTABLISHED' + | 'NOT_ESTABLISHED' + | 'PENDING_REMOVAL' + | 'NOT_REMOVED'; + +export type HolderInfo = { + +holder: string, + +status: HolderStatus, +}; + +export type HolderStore = { + +storedHolders: { + +[blobHash: string]: HolderInfo, + }, +}; diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js --- a/lib/types/redux-types.js +++ b/lib/types/redux-types.js @@ -70,6 +70,7 @@ CalendarThreadFilter, SetCalendarDeletedFilterPayload, } from './filter-types.js'; +import type { HolderStore } from './holder-types.js'; import type { IdentityAuthResult } from './identity-service-types'; import type { IntegrityStore } from './integrity-types.js'; import type { @@ -200,6 +201,7 @@ +tunnelbrokerDeviceToken: TunnelbrokerDeviceToken, +_persist: ?PersistState, +queuedDMOperations: QueuedDMOperations, + +holderStore: HolderStore, ... }; diff --git a/lib/utils/reducers-utils.test.js b/lib/utils/reducers-utils.test.js --- a/lib/utils/reducers-utils.test.js +++ b/lib/utils/reducers-utils.test.js @@ -104,6 +104,9 @@ entryQueue: {}, membershipQueue: {}, }, + holderStore: { + storedHolders: {}, + }, }; state = { ...defaultState, diff --git a/native/redux/default-state.js b/native/redux/default-state.js --- a/native/redux/default-state.js +++ b/native/redux/default-state.js @@ -104,6 +104,9 @@ entryQueue: {}, membershipQueue: {}, }, + holderStore: { + storedHolders: {}, + }, }: AppState); export { defaultState }; diff --git a/native/redux/persist.js b/native/redux/persist.js --- a/native/redux/persist.js +++ b/native/redux/persist.js @@ -1475,6 +1475,15 @@ }, ops: [], }), + [83]: (state: AppState) => ({ + state: { + ...state, + holderStore: { + storedHolders: {}, + }, + }, + ops: [], + }), }; // NOTE: renaming this object, and especially the `version` property @@ -1485,7 +1494,7 @@ storage: AsyncStorage, blacklist: persistBlacklist, debug: __DEV__, - version: 82, + version: 83, transforms: [ messageStoreMessagesBlocklistTransform, reportStoreTransform, diff --git a/native/redux/state-types.js b/native/redux/state-types.js --- a/native/redux/state-types.js +++ b/native/redux/state-types.js @@ -12,6 +12,7 @@ import type { EnabledApps } from 'lib/types/enabled-apps.js'; import type { EntryStore } from 'lib/types/entry-types.js'; import type { CalendarFilter } from 'lib/types/filter-types.js'; +import type { HolderStore } from 'lib/types/holder-types.js'; import type { IntegrityStore } from 'lib/types/integrity-types.js'; import type { KeyserverStore } from 'lib/types/keyserver-types.js'; import type { LifecycleState } from 'lib/types/lifecycle-state-types.js'; @@ -86,6 +87,7 @@ +auxUserStore: AuxUserStore, +tunnelbrokerDeviceToken: TunnelbrokerDeviceToken, +queuedDMOperations: QueuedDMOperations, + +holderStore: HolderStore, }; export { nonUserSpecificFieldsNative }; diff --git a/web/redux/default-state.js b/web/redux/default-state.js --- a/web/redux/default-state.js +++ b/web/redux/default-state.js @@ -100,6 +100,9 @@ entryQueue: {}, membershipQueue: {}, }, + holderStore: { + storedHolders: {}, + }, }); export { defaultWebState }; diff --git a/web/redux/handle-redux-migration-failure.js b/web/redux/handle-redux-migration-failure.js --- a/web/redux/handle-redux-migration-failure.js +++ b/web/redux/handle-redux-migration-failure.js @@ -16,6 +16,7 @@ 'messageStore', 'tunnelbrokerDeviceToken', 'queuedDMOperations', + 'holderStore', ]; function handleReduxMigrationFailure(oldState: AppState): AppState { diff --git a/web/redux/persist-constants.js b/web/redux/persist-constants.js --- a/web/redux/persist-constants.js +++ b/web/redux/persist-constants.js @@ -3,6 +3,6 @@ const rootKey = 'root'; const rootKeyPrefix = 'persist:'; const completeRootKey = `${rootKeyPrefix}${rootKey}`; -const storeVersion = 82; +const storeVersion = 83; export { rootKey, rootKeyPrefix, completeRootKey, storeVersion }; diff --git a/web/redux/persist.js b/web/redux/persist.js --- a/web/redux/persist.js +++ b/web/redux/persist.js @@ -632,6 +632,15 @@ }, ops: [], }), + [83]: (state: AppState) => ({ + state: { + ...state, + holderStore: { + storedHolders: {}, + }, + }, + ops: [], + }), }; const persistConfig: PersistConfig = { diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js --- a/web/redux/redux-setup.js +++ b/web/redux/redux-setup.js @@ -44,6 +44,7 @@ import type { EnabledApps } from 'lib/types/enabled-apps.js'; import type { EntryStore } from 'lib/types/entry-types.js'; import { type CalendarFilter } from 'lib/types/filter-types.js'; +import type { HolderStore } from 'lib/types/holder-types.js'; import type { IntegrityStore } from 'lib/types/integrity-types.js'; import type { KeyserverStore } from 'lib/types/keyserver-types.js'; import type { LifecycleState } from 'lib/types/lifecycle-state-types.js'; @@ -134,6 +135,7 @@ +auxUserStore: AuxUserStore, +tunnelbrokerDeviceToken: TunnelbrokerDeviceToken, +queuedDMOperations: QueuedDMOperations, + +holderStore: HolderStore, }; export type Action = $ReadOnly<