@metamask-previews/profile-sync-controller 14.0.0-preview-698a7cc → 14.0.0-preview-5cc6dab9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllers/authentication/AuthenticationController.cjs +58 -24
- package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.cts +6 -4
- package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.mts +6 -4
- package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.mjs +59 -25
- package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.cjs +25 -4
- package/dist/controllers/authentication/auth-snap-requests.cjs.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.d.cts +12 -2
- package/dist/controllers/authentication/auth-snap-requests.d.cts.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.d.mts +12 -2
- package/dist/controllers/authentication/auth-snap-requests.d.mts.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.mjs +23 -3
- package/dist/controllers/authentication/auth-snap-requests.mjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.cjs +76 -27
- package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.cts +23 -9
- package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.mts +23 -9
- package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.mjs +77 -28
- package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.cjs +33 -28
- package/dist/controllers/user-storage/account-syncing/controller-integration.cjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.cts +5 -2
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.cts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.mts +5 -2
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.mts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.mjs +34 -29
- package/dist/controllers/user-storage/account-syncing/controller-integration.mjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.cjs +12 -7
- package/dist/controllers/user-storage/account-syncing/sync-utils.cjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.cts +6 -2
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.cts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.mts +6 -2
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.mts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.mjs +12 -7
- package/dist/controllers/user-storage/account-syncing/sync-utils.mjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.cjs +1 -42
- package/dist/controllers/user-storage/account-syncing/utils.cjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.d.cts +1 -18
- package/dist/controllers/user-storage/account-syncing/utils.d.cts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.d.mts +1 -18
- package/dist/controllers/user-storage/account-syncing/utils.d.mts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.mjs +0 -39
- package/dist/controllers/user-storage/account-syncing/utils.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +23 -21
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts +4 -4
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +4 -4
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +23 -21
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.cts +8 -8
- package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.mts +8 -8
- package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.mjs.map +1 -1
- package/dist/sdk/authentication.cjs +8 -11
- package/dist/sdk/authentication.cjs.map +1 -1
- package/dist/sdk/authentication.d.cts +4 -4
- package/dist/sdk/authentication.d.cts.map +1 -1
- package/dist/sdk/authentication.d.mts +4 -4
- package/dist/sdk/authentication.d.mts.map +1 -1
- package/dist/sdk/authentication.mjs +8 -11
- package/dist/sdk/authentication.mjs.map +1 -1
- package/dist/sdk/user-storage.cjs +38 -32
- package/dist/sdk/user-storage.cjs.map +1 -1
- package/dist/sdk/user-storage.d.cts +4 -3
- package/dist/sdk/user-storage.d.cts.map +1 -1
- package/dist/sdk/user-storage.d.mts +4 -3
- package/dist/sdk/user-storage.d.mts.map +1 -1
- package/dist/sdk/user-storage.mjs +38 -32
- package/dist/sdk/user-storage.mjs.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.cjs +16 -4
- package/dist/sdk/utils/messaging-signing-snap-requests.cjs.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.d.cts +2 -2
- package/dist/sdk/utils/messaging-signing-snap-requests.d.cts.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.d.mts +2 -2
- package/dist/sdk/utils/messaging-signing-snap-requests.d.mts.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.mjs +16 -4
- package/dist/sdk/utils/messaging-signing-snap-requests.mjs.map +1 -1
- package/dist/shared/storage-schema.cjs +1 -6
- package/dist/shared/storage-schema.cjs.map +1 -1
- package/dist/shared/storage-schema.d.cts +0 -1
- package/dist/shared/storage-schema.d.cts.map +1 -1
- package/dist/shared/storage-schema.d.mts +0 -1
- package/dist/shared/storage-schema.d.mts.map +1 -1
- package/dist/shared/storage-schema.mjs +0 -4
- package/dist/shared/storage-schema.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AccountsControllerListAccountsAction, AccountsControllerUpdateAccountMetadataAction, AccountsControllerAccountRenamedEvent, AccountsControllerAccountAddedEvent } from "@metamask/accounts-controller";
|
|
1
|
+
import type { AccountsControllerListAccountsAction, AccountsControllerUpdateAccountMetadataAction, AccountsControllerAccountRenamedEvent, AccountsControllerAccountAddedEvent, AccountsControllerUpdateAccountsAction } from "@metamask/accounts-controller";
|
|
2
2
|
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedMessenger } from "@metamask/base-controller";
|
|
3
3
|
import { BaseController } from "@metamask/base-controller";
|
|
4
4
|
import { type KeyringControllerGetStateAction, type KeyringControllerLockEvent, type KeyringControllerUnlockEvent, type KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
|
|
@@ -107,7 +107,7 @@ export type UserStorageControllerPerformBatchSetStorage = ActionsObj['performBat
|
|
|
107
107
|
export type UserStorageControllerPerformDeleteStorage = ActionsObj['performDeleteStorage'];
|
|
108
108
|
export type UserStorageControllerPerformBatchDeleteStorage = ActionsObj['performBatchDeleteStorage'];
|
|
109
109
|
export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];
|
|
110
|
-
export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction;
|
|
110
|
+
export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | AccountsControllerUpdateAccountsAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction;
|
|
111
111
|
export type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, UserStorageControllerState>;
|
|
112
112
|
export type Events = UserStorageControllerStateChangeEvent;
|
|
113
113
|
export type AllowedEvents = UserStorageControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | AccountsControllerAccountAddedEvent | AccountsControllerAccountRenamedEvent | NetworkControllerNetworkRemovedEvent;
|
|
@@ -136,59 +136,66 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
136
136
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
137
137
|
*
|
|
138
138
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
139
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
139
140
|
* @returns the decrypted string contents found from user storage (or null if not found)
|
|
140
141
|
*/
|
|
141
|
-
performGetStorage(path: UserStoragePathWithFeatureAndKey): Promise<string | null>;
|
|
142
|
+
performGetStorage(path: UserStoragePathWithFeatureAndKey, entropySourceId?: string): Promise<string | null>;
|
|
142
143
|
/**
|
|
143
144
|
* Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.
|
|
144
145
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
145
146
|
*
|
|
146
147
|
* @param path - string in the form of `${feature}` that matches schema
|
|
148
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
147
149
|
* @returns the array of decrypted string contents found from user storage (or null if not found)
|
|
148
150
|
*/
|
|
149
|
-
performGetStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly): Promise<string[] | null>;
|
|
151
|
+
performGetStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly, entropySourceId?: string): Promise<string[] | null>;
|
|
150
152
|
/**
|
|
151
153
|
* Allows storage of user data. Data stored must be string formatted.
|
|
152
154
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
153
155
|
*
|
|
154
156
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
155
157
|
* @param value - The string data you want to store.
|
|
158
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
156
159
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
157
160
|
*/
|
|
158
|
-
performSetStorage(path: UserStoragePathWithFeatureAndKey, value: string): Promise<void>;
|
|
161
|
+
performSetStorage(path: UserStoragePathWithFeatureAndKey, value: string, entropySourceId?: string): Promise<void>;
|
|
159
162
|
/**
|
|
160
163
|
* Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.
|
|
161
164
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
162
165
|
*
|
|
163
166
|
* @param path - string in the form of `${feature}` that matches schema
|
|
164
167
|
* @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs
|
|
168
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
165
169
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
166
170
|
*/
|
|
167
|
-
performBatchSetStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: [UserStorageFeatureKeys<FeatureName>, string][]): Promise<void>;
|
|
171
|
+
performBatchSetStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: [UserStorageFeatureKeys<FeatureName>, string][], entropySourceId?: string): Promise<void>;
|
|
168
172
|
/**
|
|
169
173
|
* Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
170
174
|
*
|
|
171
175
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
176
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
172
177
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
173
178
|
*/
|
|
174
|
-
performDeleteStorage(path: UserStoragePathWithFeatureAndKey): Promise<void>;
|
|
179
|
+
performDeleteStorage(path: UserStoragePathWithFeatureAndKey, entropySourceId?: string): Promise<void>;
|
|
175
180
|
/**
|
|
176
181
|
* Allows deletion of all user data entries for a specific feature.
|
|
177
182
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
178
183
|
*
|
|
179
184
|
* @param path - string in the form of `${feature}` that matches schema
|
|
185
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
180
186
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
181
187
|
*/
|
|
182
|
-
performDeleteStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly): Promise<void>;
|
|
188
|
+
performDeleteStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly, entropySourceId?: string): Promise<void>;
|
|
183
189
|
/**
|
|
184
190
|
* Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.
|
|
185
191
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
186
192
|
*
|
|
187
193
|
* @param path - string in the form of `${feature}` that matches schema
|
|
188
194
|
* @param values - data to store, in the form of an array of entryKey[]
|
|
195
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
189
196
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
190
197
|
*/
|
|
191
|
-
performBatchDeleteStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: UserStorageFeatureKeys<FeatureName>[]): Promise<void>;
|
|
198
|
+
performBatchDeleteStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: UserStorageFeatureKeys<FeatureName>[], entropySourceId?: string): Promise<void>;
|
|
192
199
|
/**
|
|
193
200
|
* Retrieves the storage key, for internal use only!
|
|
194
201
|
*
|
|
@@ -201,6 +208,13 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
201
208
|
* It should not be used in production code.
|
|
202
209
|
*/
|
|
203
210
|
flushStorageKeyCache(): void;
|
|
211
|
+
/**
|
|
212
|
+
* Lists all the available HD keyring metadata IDs.
|
|
213
|
+
* These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.
|
|
214
|
+
*
|
|
215
|
+
* @returns A promise that resolves to an array of HD keyring metadata IDs.
|
|
216
|
+
*/
|
|
217
|
+
listEntropySources(): Promise<string[]>;
|
|
204
218
|
setIsBackupAndSyncFeatureEnabled(feature: keyof typeof BACKUPANDSYNC_FEATURES, enabled: boolean): Promise<void>;
|
|
205
219
|
setHasAccountSyncingSyncedAtLeastOnce(hasAccountSyncingSyncedAtLeastOnce: boolean): Promise<void>;
|
|
206
220
|
setIsAccountSyncingReadyToBeDispatched(isAccountSyncingReadyToBeDispatched: boolean): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserStorageController.d.cts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,qCAAqC,EACrC,mCAAmC,
|
|
1
|
+
{"version":3,"file":"UserStorageController.d.cts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,qCAAqC,EACrC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C,CAChD,IAAI,EAAE,8BAA8B,EACpC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;IAQhB;;;;;;;;OAQG;IACU,yBAAyB,CACpC,WAAW,SAAS,8BAA8B,EAElD,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,sBAAsB,CAAC,WAAW,CAAC,EAAE,EAC7C,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;IAQhB;;;;OAIG;IACU,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7C;;;;OAIG;IACI,oBAAoB,IAAI,IAAI;IAInC;;;;;OAKG;IACG,kBAAkB;IAkDX,gCAAgC,CAC3C,OAAO,EAAE,MAAM,OAAO,sBAAsB,EAC5C,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC;IAyCV,qCAAqC,CACzC,kCAAkC,EAAE,OAAO,GAC1C,OAAO,CAAC,IAAI,CAAC;IAOV,sCAAsC,CAC1C,mCAAmC,EAAE,OAAO,GAC3C,OAAO,CAAC,IAAI,CAAC;IAOV,6BAA6B,CACjC,0BAA0B,EAAE,OAAO,GAClC,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IACG,mCAAmC,IAAI,OAAO,CAAC,IAAI,CAAC;IA2C1D;;;;OAIG;IACG,gCAAgC,CACpC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,IAAI,CAAC;IAOV,YAAY;CAuBnB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AccountsControllerListAccountsAction, AccountsControllerUpdateAccountMetadataAction, AccountsControllerAccountRenamedEvent, AccountsControllerAccountAddedEvent } from "@metamask/accounts-controller";
|
|
1
|
+
import type { AccountsControllerListAccountsAction, AccountsControllerUpdateAccountMetadataAction, AccountsControllerAccountRenamedEvent, AccountsControllerAccountAddedEvent, AccountsControllerUpdateAccountsAction } from "@metamask/accounts-controller";
|
|
2
2
|
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedMessenger } from "@metamask/base-controller";
|
|
3
3
|
import { BaseController } from "@metamask/base-controller";
|
|
4
4
|
import { type KeyringControllerGetStateAction, type KeyringControllerLockEvent, type KeyringControllerUnlockEvent, type KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
|
|
@@ -107,7 +107,7 @@ export type UserStorageControllerPerformBatchSetStorage = ActionsObj['performBat
|
|
|
107
107
|
export type UserStorageControllerPerformDeleteStorage = ActionsObj['performDeleteStorage'];
|
|
108
108
|
export type UserStorageControllerPerformBatchDeleteStorage = ActionsObj['performBatchDeleteStorage'];
|
|
109
109
|
export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];
|
|
110
|
-
export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction;
|
|
110
|
+
export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | AccountsControllerUpdateAccountsAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction;
|
|
111
111
|
export type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, UserStorageControllerState>;
|
|
112
112
|
export type Events = UserStorageControllerStateChangeEvent;
|
|
113
113
|
export type AllowedEvents = UserStorageControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | AccountsControllerAccountAddedEvent | AccountsControllerAccountRenamedEvent | NetworkControllerNetworkRemovedEvent;
|
|
@@ -136,59 +136,66 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
136
136
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
137
137
|
*
|
|
138
138
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
139
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
139
140
|
* @returns the decrypted string contents found from user storage (or null if not found)
|
|
140
141
|
*/
|
|
141
|
-
performGetStorage(path: UserStoragePathWithFeatureAndKey): Promise<string | null>;
|
|
142
|
+
performGetStorage(path: UserStoragePathWithFeatureAndKey, entropySourceId?: string): Promise<string | null>;
|
|
142
143
|
/**
|
|
143
144
|
* Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.
|
|
144
145
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
145
146
|
*
|
|
146
147
|
* @param path - string in the form of `${feature}` that matches schema
|
|
148
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
147
149
|
* @returns the array of decrypted string contents found from user storage (or null if not found)
|
|
148
150
|
*/
|
|
149
|
-
performGetStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly): Promise<string[] | null>;
|
|
151
|
+
performGetStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly, entropySourceId?: string): Promise<string[] | null>;
|
|
150
152
|
/**
|
|
151
153
|
* Allows storage of user data. Data stored must be string formatted.
|
|
152
154
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
153
155
|
*
|
|
154
156
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
155
157
|
* @param value - The string data you want to store.
|
|
158
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
156
159
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
157
160
|
*/
|
|
158
|
-
performSetStorage(path: UserStoragePathWithFeatureAndKey, value: string): Promise<void>;
|
|
161
|
+
performSetStorage(path: UserStoragePathWithFeatureAndKey, value: string, entropySourceId?: string): Promise<void>;
|
|
159
162
|
/**
|
|
160
163
|
* Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.
|
|
161
164
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
162
165
|
*
|
|
163
166
|
* @param path - string in the form of `${feature}` that matches schema
|
|
164
167
|
* @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs
|
|
168
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
165
169
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
166
170
|
*/
|
|
167
|
-
performBatchSetStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: [UserStorageFeatureKeys<FeatureName>, string][]): Promise<void>;
|
|
171
|
+
performBatchSetStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: [UserStorageFeatureKeys<FeatureName>, string][], entropySourceId?: string): Promise<void>;
|
|
168
172
|
/**
|
|
169
173
|
* Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
170
174
|
*
|
|
171
175
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
176
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
172
177
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
173
178
|
*/
|
|
174
|
-
performDeleteStorage(path: UserStoragePathWithFeatureAndKey): Promise<void>;
|
|
179
|
+
performDeleteStorage(path: UserStoragePathWithFeatureAndKey, entropySourceId?: string): Promise<void>;
|
|
175
180
|
/**
|
|
176
181
|
* Allows deletion of all user data entries for a specific feature.
|
|
177
182
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
178
183
|
*
|
|
179
184
|
* @param path - string in the form of `${feature}` that matches schema
|
|
185
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
180
186
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
181
187
|
*/
|
|
182
|
-
performDeleteStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly): Promise<void>;
|
|
188
|
+
performDeleteStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly, entropySourceId?: string): Promise<void>;
|
|
183
189
|
/**
|
|
184
190
|
* Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.
|
|
185
191
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
186
192
|
*
|
|
187
193
|
* @param path - string in the form of `${feature}` that matches schema
|
|
188
194
|
* @param values - data to store, in the form of an array of entryKey[]
|
|
195
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
189
196
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
190
197
|
*/
|
|
191
|
-
performBatchDeleteStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: UserStorageFeatureKeys<FeatureName>[]): Promise<void>;
|
|
198
|
+
performBatchDeleteStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: UserStorageFeatureKeys<FeatureName>[], entropySourceId?: string): Promise<void>;
|
|
192
199
|
/**
|
|
193
200
|
* Retrieves the storage key, for internal use only!
|
|
194
201
|
*
|
|
@@ -201,6 +208,13 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
201
208
|
* It should not be used in production code.
|
|
202
209
|
*/
|
|
203
210
|
flushStorageKeyCache(): void;
|
|
211
|
+
/**
|
|
212
|
+
* Lists all the available HD keyring metadata IDs.
|
|
213
|
+
* These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.
|
|
214
|
+
*
|
|
215
|
+
* @returns A promise that resolves to an array of HD keyring metadata IDs.
|
|
216
|
+
*/
|
|
217
|
+
listEntropySources(): Promise<string[]>;
|
|
204
218
|
setIsBackupAndSyncFeatureEnabled(feature: keyof typeof BACKUPANDSYNC_FEATURES, enabled: boolean): Promise<void>;
|
|
205
219
|
setHasAccountSyncingSyncedAtLeastOnce(hasAccountSyncingSyncedAtLeastOnce: boolean): Promise<void>;
|
|
206
220
|
setIsAccountSyncingReadyToBeDispatched(isAccountSyncingReadyToBeDispatched: boolean): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserStorageController.d.mts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,qCAAqC,EACrC,mCAAmC,
|
|
1
|
+
{"version":3,"file":"UserStorageController.d.mts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,qCAAqC,EACrC,mCAAmC,EACnC,sCAAsC,EACvC,sCAAsC;AACvC,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EAEpB,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,kCAAkC,EACxC,qCAAqC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EACV,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,oCAAoC,EACpC,oCAAoC,EACrC,qCAAqC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,oCAAoC;AAOrE,OAAO,EAAE,sBAAsB,EAAE,wBAAoB;AAMrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAoC;AAC1E,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACpC,wCAAoC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,0CAAsC;AAKlE,OAAO,KAAK,EACV,sCAAsC,EACtC,yCAAyC,EACzC,kCAAkC,EAClC,qCAAqC,EACtC,uDAAmD;AAEpD,QAAA,MAAM,cAAc,0BAA0B,CAAC;AAG/C,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,sBA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EAAE,eAAe,GAC/B,OAAO,CAAC,IAAI,CAAC;IAOV,YAAY;CAuBnB"}
|
|
@@ -16,7 +16,7 @@ import { setupAccountSyncingSubscriptions } from "./account-syncing/setup-subscr
|
|
|
16
16
|
import { BACKUPANDSYNC_FEATURES } from "./constants.mjs";
|
|
17
17
|
import { performMainNetworkSync, startNetworkSyncing } from "./network-syncing/controller-integration.mjs";
|
|
18
18
|
import { Env, UserStorage } from "../../sdk/index.mjs";
|
|
19
|
-
import { createSnapSignMessageRequest } from "../authentication/auth-snap-requests.mjs";
|
|
19
|
+
import { createSnapSignMessageRequest, createSnapAllPublicKeysRequest } from "../authentication/auth-snap-requests.mjs";
|
|
20
20
|
const controllerName = 'UserStorageController';
|
|
21
21
|
export const defaultState = {
|
|
22
22
|
isBackupAndSyncEnabled: true,
|
|
@@ -80,8 +80,8 @@ class UserStorageController extends BaseController {
|
|
|
80
80
|
});
|
|
81
81
|
_UserStorageController_userStorage.set(this, void 0);
|
|
82
82
|
_UserStorageController_auth.set(this, {
|
|
83
|
-
getProfileId: async () => {
|
|
84
|
-
const sessionProfile = await this.messagingSystem.call('AuthenticationController:getSessionProfile');
|
|
83
|
+
getProfileId: async (entropySourceId) => {
|
|
84
|
+
const sessionProfile = await this.messagingSystem.call('AuthenticationController:getSessionProfile', entropySourceId);
|
|
85
85
|
return sessionProfile?.profileId;
|
|
86
86
|
},
|
|
87
87
|
isSignedIn: () => {
|
|
@@ -113,11 +113,11 @@ class UserStorageController extends BaseController {
|
|
|
113
113
|
__classPrivateFieldSet(this, _UserStorageController_userStorage, new UserStorage({
|
|
114
114
|
env: Env.PRD,
|
|
115
115
|
auth: {
|
|
116
|
-
getAccessToken: () => this.messagingSystem.call('AuthenticationController:getBearerToken'),
|
|
117
|
-
getUserProfile: async () => {
|
|
118
|
-
return await this.messagingSystem.call('AuthenticationController:getSessionProfile');
|
|
116
|
+
getAccessToken: (entropySourceId) => this.messagingSystem.call('AuthenticationController:getBearerToken', entropySourceId),
|
|
117
|
+
getUserProfile: async (entropySourceId) => {
|
|
118
|
+
return await this.messagingSystem.call('AuthenticationController:getSessionProfile', entropySourceId);
|
|
119
119
|
},
|
|
120
|
-
signMessage: (message) => __classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_snapSignMessage).call(this, message),
|
|
120
|
+
signMessage: (message, entropySourceId) => __classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_snapSignMessage).call(this, message, entropySourceId),
|
|
121
121
|
},
|
|
122
122
|
}, {
|
|
123
123
|
storage: {
|
|
@@ -149,12 +149,14 @@ class UserStorageController extends BaseController {
|
|
|
149
149
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
150
150
|
*
|
|
151
151
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
152
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
152
153
|
* @returns the decrypted string contents found from user storage (or null if not found)
|
|
153
154
|
*/
|
|
154
|
-
async performGetStorage(path) {
|
|
155
|
+
async performGetStorage(path, entropySourceId) {
|
|
155
156
|
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").getItem(path, {
|
|
156
157
|
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
157
158
|
validateAgainstSchema: true,
|
|
159
|
+
entropySourceId,
|
|
158
160
|
});
|
|
159
161
|
}
|
|
160
162
|
/**
|
|
@@ -162,12 +164,14 @@ class UserStorageController extends BaseController {
|
|
|
162
164
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
163
165
|
*
|
|
164
166
|
* @param path - string in the form of `${feature}` that matches schema
|
|
167
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
165
168
|
* @returns the array of decrypted string contents found from user storage (or null if not found)
|
|
166
169
|
*/
|
|
167
|
-
async performGetStorageAllFeatureEntries(path) {
|
|
170
|
+
async performGetStorageAllFeatureEntries(path, entropySourceId) {
|
|
168
171
|
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").getAllFeatureItems(path, {
|
|
169
172
|
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
170
173
|
validateAgainstSchema: true,
|
|
174
|
+
entropySourceId,
|
|
171
175
|
});
|
|
172
176
|
}
|
|
173
177
|
/**
|
|
@@ -176,12 +180,14 @@ class UserStorageController extends BaseController {
|
|
|
176
180
|
*
|
|
177
181
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
178
182
|
* @param value - The string data you want to store.
|
|
183
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
179
184
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
180
185
|
*/
|
|
181
|
-
async performSetStorage(path, value) {
|
|
186
|
+
async performSetStorage(path, value, entropySourceId) {
|
|
182
187
|
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").setItem(path, value, {
|
|
183
188
|
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
184
189
|
validateAgainstSchema: true,
|
|
190
|
+
entropySourceId,
|
|
185
191
|
});
|
|
186
192
|
}
|
|
187
193
|
/**
|
|
@@ -190,24 +196,28 @@ class UserStorageController extends BaseController {
|
|
|
190
196
|
*
|
|
191
197
|
* @param path - string in the form of `${feature}` that matches schema
|
|
192
198
|
* @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs
|
|
199
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
193
200
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
194
201
|
*/
|
|
195
|
-
async performBatchSetStorage(path, values) {
|
|
202
|
+
async performBatchSetStorage(path, values, entropySourceId) {
|
|
196
203
|
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").batchSetItems(path, values, {
|
|
197
204
|
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
198
205
|
validateAgainstSchema: true,
|
|
206
|
+
entropySourceId,
|
|
199
207
|
});
|
|
200
208
|
}
|
|
201
209
|
/**
|
|
202
210
|
* Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
203
211
|
*
|
|
204
212
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
213
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
205
214
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
206
215
|
*/
|
|
207
|
-
async performDeleteStorage(path) {
|
|
216
|
+
async performDeleteStorage(path, entropySourceId) {
|
|
208
217
|
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").deleteItem(path, {
|
|
209
218
|
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
210
219
|
validateAgainstSchema: true,
|
|
220
|
+
entropySourceId,
|
|
211
221
|
});
|
|
212
222
|
}
|
|
213
223
|
/**
|
|
@@ -215,10 +225,15 @@ class UserStorageController extends BaseController {
|
|
|
215
225
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
216
226
|
*
|
|
217
227
|
* @param path - string in the form of `${feature}` that matches schema
|
|
228
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
218
229
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
219
230
|
*/
|
|
220
|
-
async performDeleteStorageAllFeatureEntries(path) {
|
|
221
|
-
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").deleteAllFeatureItems(path
|
|
231
|
+
async performDeleteStorageAllFeatureEntries(path, entropySourceId) {
|
|
232
|
+
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").deleteAllFeatureItems(path, {
|
|
233
|
+
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
234
|
+
validateAgainstSchema: true,
|
|
235
|
+
entropySourceId,
|
|
236
|
+
});
|
|
222
237
|
}
|
|
223
238
|
/**
|
|
224
239
|
* Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.
|
|
@@ -226,10 +241,15 @@ class UserStorageController extends BaseController {
|
|
|
226
241
|
*
|
|
227
242
|
* @param path - string in the form of `${feature}` that matches schema
|
|
228
243
|
* @param values - data to store, in the form of an array of entryKey[]
|
|
244
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
229
245
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
230
246
|
*/
|
|
231
|
-
async performBatchDeleteStorage(path, values) {
|
|
232
|
-
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").batchDeleteItems(path, values
|
|
247
|
+
async performBatchDeleteStorage(path, values, entropySourceId) {
|
|
248
|
+
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").batchDeleteItems(path, values, {
|
|
249
|
+
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
250
|
+
validateAgainstSchema: true,
|
|
251
|
+
entropySourceId,
|
|
252
|
+
});
|
|
233
253
|
}
|
|
234
254
|
/**
|
|
235
255
|
* Retrieves the storage key, for internal use only!
|
|
@@ -247,6 +267,19 @@ class UserStorageController extends BaseController {
|
|
|
247
267
|
flushStorageKeyCache() {
|
|
248
268
|
__classPrivateFieldSet(this, _UserStorageController_storageKeyCache, {}, "f");
|
|
249
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Lists all the available HD keyring metadata IDs.
|
|
272
|
+
* These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.
|
|
273
|
+
*
|
|
274
|
+
* @returns A promise that resolves to an array of HD keyring metadata IDs.
|
|
275
|
+
*/
|
|
276
|
+
async listEntropySources() {
|
|
277
|
+
if (!__classPrivateFieldGet(this, _UserStorageController_isUnlocked, "f")) {
|
|
278
|
+
throw new Error('listEntropySources - unable to call snap, wallet is locked');
|
|
279
|
+
}
|
|
280
|
+
const result = (await this.messagingSystem.call('SnapController:handleRequest', createSnapAllPublicKeysRequest()));
|
|
281
|
+
return result.map(([id]) => id);
|
|
282
|
+
}
|
|
250
283
|
async setIsBackupAndSyncFeatureEnabled(feature, enabled) {
|
|
251
284
|
try {
|
|
252
285
|
__classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_setIsBackupAndSyncUpdateLoading).call(this, true);
|
|
@@ -299,16 +332,29 @@ class UserStorageController extends BaseController {
|
|
|
299
332
|
* It will add new accounts to the internal accounts list, update/merge conflicting names and re-upload the results in some cases to the user storage.
|
|
300
333
|
*/
|
|
301
334
|
async syncInternalAccountsWithUserStorage() {
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
335
|
+
const entropySourceIds = await this.listEntropySources();
|
|
336
|
+
try {
|
|
337
|
+
for (const entropySourceId of entropySourceIds) {
|
|
338
|
+
const profileId = await __classPrivateFieldGet(this, _UserStorageController_auth, "f").getProfileId(entropySourceId);
|
|
339
|
+
await syncInternalAccountsWithUserStorage({
|
|
340
|
+
maxNumberOfAccountsToAdd: __classPrivateFieldGet(this, _UserStorageController_config, "f")?.accountSyncing?.maxNumberOfAccountsToAdd,
|
|
341
|
+
onAccountAdded: () => __classPrivateFieldGet(this, _UserStorageController_config, "f")?.accountSyncing?.onAccountAdded?.(profileId),
|
|
342
|
+
onAccountNameUpdated: () => __classPrivateFieldGet(this, _UserStorageController_config, "f")?.accountSyncing?.onAccountNameUpdated?.(profileId),
|
|
343
|
+
onAccountSyncErroneousSituation: (situationMessage, sentryContext) => __classPrivateFieldGet(this, _UserStorageController_config, "f")?.accountSyncing?.onAccountSyncErroneousSituation?.(profileId, situationMessage, sentryContext),
|
|
344
|
+
}, {
|
|
345
|
+
getMessenger: () => this.messagingSystem,
|
|
346
|
+
getUserStorageControllerInstance: () => this,
|
|
347
|
+
}, entropySourceId);
|
|
348
|
+
}
|
|
349
|
+
// We do this here and not in the finally statement because we want to make sure that
|
|
350
|
+
// the accounts are saved / updated / deleted at least once before we set this flag
|
|
351
|
+
await this.setHasAccountSyncingSyncedAtLeastOnce(true);
|
|
352
|
+
}
|
|
353
|
+
catch (e) {
|
|
354
|
+
// Silently fail for now
|
|
355
|
+
// istanbul ignore next
|
|
356
|
+
console.error(e);
|
|
357
|
+
}
|
|
312
358
|
}
|
|
313
359
|
/**
|
|
314
360
|
* Saves an individual internal account to the user storage.
|
|
@@ -352,16 +398,19 @@ _UserStorageController_env = new WeakMap(), _UserStorageController_userStorage =
|
|
|
352
398
|
* Signs a specific message using an underlying auth snap.
|
|
353
399
|
*
|
|
354
400
|
* @param message - A specific tagged message to sign.
|
|
401
|
+
* @param entropySourceId - The entropy source ID used to derive the key,
|
|
402
|
+
* when multiple sources are available (Multi-SRP).
|
|
355
403
|
* @returns A Signature created by the snap.
|
|
356
404
|
*/
|
|
357
|
-
async function _UserStorageController_snapSignMessage(message) {
|
|
405
|
+
async function _UserStorageController_snapSignMessage(message, entropySourceId) {
|
|
406
|
+
// the message is SRP specific already, so there's no need to use the entropySourceId in the cache
|
|
358
407
|
if (__classPrivateFieldGet(this, _UserStorageController__snapSignMessageCache, "f")[message]) {
|
|
359
408
|
return __classPrivateFieldGet(this, _UserStorageController__snapSignMessageCache, "f")[message];
|
|
360
409
|
}
|
|
361
410
|
if (!__classPrivateFieldGet(this, _UserStorageController_isUnlocked, "f")) {
|
|
362
411
|
throw new Error('#snapSignMessage - unable to call snap, wallet is locked');
|
|
363
412
|
}
|
|
364
|
-
const result = (await this.messagingSystem.call('SnapController:handleRequest', createSnapSignMessageRequest(message)));
|
|
413
|
+
const result = (await this.messagingSystem.call('SnapController:handleRequest', createSnapSignMessageRequest(message, entropySourceId)));
|
|
365
414
|
__classPrivateFieldGet(this, _UserStorageController__snapSignMessageCache, "f")[message] = result;
|
|
366
415
|
return result;
|
|
367
416
|
}, _UserStorageController_setIsBackupAndSyncUpdateLoading = function _UserStorageController_setIsBackupAndSyncUpdateLoading(isBackupAndSyncUpdateLoading) {
|