Skip to main content

UserStorageController Actions

13 actions registered.

NameDeprecated
getState
getStorageKey
listEntropySources
performBatchDeleteStorage
performBatchSetStorage
performDeleteStorage
performDeleteStorageAllFeatureEntries
performGetStorage
performGetStorageAllFeatureEntries
performSetStorage
setIsBackupAndSyncFeatureEnabled
setIsContactSyncingInProgress
syncContactsWithUserStorage

UserStorageController:getState​

Package: @metamask/profile-sync-controller

Handler signature:

() => UserStorageControllerState

UserStorageController:getStorageKey​

Package: @metamask/profile-sync-controller

Retrieves the storage key, for internal use only!

Returns: the storage key

Handler signature:

() => Promise<string>

UserStorageController:listEntropySources​

Package: @metamask/profile-sync-controller

Lists all the available HD keyring metadata IDs. These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.

Returns: A promise that resolves to an array of HD keyring metadata IDs.

Handler signature:

() => Promise<string[]>

UserStorageController:performBatchDeleteStorage​

Package: @metamask/profile-sync-controller

Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted. Developers can extend the entry path through the schema.ts file.

Parameters:

NameDescription
pathstring in the form of ${feature} that matches schema
valuesdata to store, in the form of an array of entryKey[]
entropySourceIdThe entropy source ID used to generate the encryption key.

Returns: nothing. NOTE that an error is thrown if fails to store data.

Handler signature:

(path: UserStorageGenericPathWithFeatureOnly, values: UserStorageGenericFeatureKey[], entropySourceId?: string) => Promise<void>

UserStorageController:performBatchSetStorage​

Package: @metamask/profile-sync-controller

Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted. Developers can extend the entry path through the schema.ts file.

Parameters:

NameDescription
pathstring in the form of ${feature} that matches schema
valuesdata to store, in the form of an array of [entryKey, entryValue] pairs
entropySourceIdThe entropy source ID used to generate the encryption key.

Returns: nothing. NOTE that an error is thrown if fails to store data.

Handler signature:

(path: UserStorageGenericPathWithFeatureOnly, values: [UserStorageGenericFeatureKey, string][], entropySourceId?: string) => Promise<void>

UserStorageController:performDeleteStorage​

Package: @metamask/profile-sync-controller

Allows deletion of user data. Developers can extend the entry path and entry name through the schema.ts file.

Parameters:

NameDescription
pathstring in the form of ${feature}.${key} that matches schema
entropySourceIdThe entropy source ID used to generate the encryption key.

Returns: nothing. NOTE that an error is thrown if fails to delete data.

Handler signature:

(path: UserStorageGenericPathWithFeatureAndKey, entropySourceId?: string) => Promise<void>

UserStorageController:performDeleteStorageAllFeatureEntries​

Package: @metamask/profile-sync-controller

Allows deletion of all user data entries for a specific feature. Developers can extend the entry path through the schema.ts file.

Parameters:

NameDescription
pathstring in the form of ${feature} that matches schema
entropySourceIdThe entropy source ID used to generate the encryption key.

Returns: nothing. NOTE that an error is thrown if fails to delete data.

Handler signature:

(path: UserStorageGenericPathWithFeatureOnly, entropySourceId?: string) => Promise<void>

UserStorageController:performGetStorage​

Package: @metamask/profile-sync-controller

Allows retrieval of stored data. Data stored is string formatted. Developers can extend the entry path and entry name through the schema.ts file.

Parameters:

NameDescription
pathstring in the form of ${feature}.${key} that matches schema
entropySourceIdThe entropy source ID used to generate the encryption key.

Returns: the decrypted string contents found from user storage (or null if not found)

Handler signature:

(path: UserStorageGenericPathWithFeatureAndKey, entropySourceId?: string) => Promise<string | null>

UserStorageController:performGetStorageAllFeatureEntries​

Package: @metamask/profile-sync-controller

Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings. Developers can extend the entry path through the schema.ts file.

Parameters:

NameDescription
pathstring in the form of ${feature} that matches schema
entropySourceIdThe entropy source ID used to generate the encryption key.

Returns: the array of decrypted string contents found from user storage (or null if not found)

Handler signature:

(path: UserStorageGenericPathWithFeatureOnly, entropySourceId?: string) => Promise<string[] | null>

UserStorageController:performSetStorage​

Package: @metamask/profile-sync-controller

Allows storage of user data. Data stored must be string formatted. Developers can extend the entry path and entry name through the schema.ts file.

Parameters:

NameDescription
pathstring in the form of ${feature}.${key} that matches schema
valueThe string data you want to store.
entropySourceIdThe entropy source ID used to generate the encryption key.

Returns: nothing. NOTE that an error is thrown if fails to store data.

Handler signature:

(path: UserStorageGenericPathWithFeatureAndKey, value: string, entropySourceId?: string) => Promise<void>

UserStorageController:setIsBackupAndSyncFeatureEnabled​

Package: @metamask/profile-sync-controller

Handler signature:

(feature: keyof typeof BACKUPANDSYNC_FEATURES, enabled: boolean) => Promise<void>

UserStorageController:setIsContactSyncingInProgress​

Package: @metamask/profile-sync-controller

Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization

Parameters:

NameDescription
isContactSyncingInProgressWhether contact syncing is in progress

Handler signature:

(isContactSyncingInProgress: boolean) => Promise<void>

UserStorageController:syncContactsWithUserStorage​

Package: @metamask/profile-sync-controller

Syncs the address book list with the user storage address book list. This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa. It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage.

Handler signature:

() => Promise<void>