Skip to content
Prev Previous commit
Next Next commit
refactor: update documentation for secret data item methods
  • Loading branch information
huggingbot committed Dec 2, 2025
commit fc73107ccdf8d53ebdd56b5ba0bee5c87592136b
Original file line number Diff line number Diff line change
Expand Up @@ -538,14 +538,17 @@ export class SeedlessOnboardingController<
}

/**
* Update fields for an existing secret data item by itemId.
* Update the dataType for an existing secret data item.
*
* This method updates metadata fields for an existing secret data item
* without modifying the encrypted data itself.
* This is used for migrating legacy data that was stored before the dataType
* field was introduced. When users created wallets with older SDK versions,
* their secrets were stored without dataType classification. This method allows
* clients to retroactively assign the correct dataType (e.g., PrimarySrp,
* ImportedSrp) when the wallet is unlocked.
*
* @param params - The parameters for updating the secret data item.
* @param params.itemId - The item ID of the secret data to update.
* @param params.dataType - The data type to set for the item.
* @param params.itemId - The server-assigned item ID from fetchAllSecretData.
* @param params.dataType - The data type classification to assign.
* @returns A promise that resolves when the update is complete.
*/
async updateSecretDataItem(params: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we specify why and when we need to call this? since in the clients, update* is not something we usually do with SRPs

Copy link
Member Author

@huggingbot huggingbot Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's used to migrate existing users to update the data_type column in the metadata service. Currently the server doesn't know the type of secret (it's encrypted). It needs to know for the deletion API to work: to prevent clients from deleting the default SRP

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added more notes here

Expand Down Expand Up @@ -588,13 +591,14 @@ export class SeedlessOnboardingController<
}

/**
* Batch update fields for multiple existing secret data items by their itemIds.
* Batch update the dataType for multiple existing secret data items.
*
* This method updates metadata fields for multiple existing secret data items
* without modifying the encrypted data itself.
* This is the batch version of updateSecretDataItem, used for migrating
* multiple legacy secrets in a single operation. Useful when a user with
* multiple SRPs/private keys upgrades from an older SDK version.
*
* @param params - The parameters for batch updating secret data items.
* @param params.updates - Array of objects containing itemId and fields to update.
* @param params.updates - Array of objects containing itemId and dataType to assign.
* @returns A promise that resolves when all updates are complete.
*/
async batchUpdateSecretDataItems(params: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added more notes here

Expand Down
Loading