Skip to content

Commit

Permalink
docs: add JSDocs to new encryptor methods
Browse files Browse the repository at this point in the history
  • Loading branch information
gantunesr committed Mar 4, 2024
1 parent a168981 commit c845b97
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/core/Encryptor/Encryptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ class Encryptor {
? Aes.decrypt(encryptedData.cipher, key, encryptedData.iv)
: AesForked.decrypt(encryptedData.cipher, key, encryptedData.iv);

/**
* Checks if the provided vault is an updated encryption format.
*
* @param vault - The vault to check.
* @param targetDerivationParams - The options to use for key derivation.
* @returns Whether or not the vault is an updated encryption format.
*/
private isVaultUpdated = (
vault: string,
targetDerivationParams = DEFAULT_DERIVATION_PARAMS,
Expand Down Expand Up @@ -192,6 +199,18 @@ class Encryptor {
return JSON.parse(data);
};

/**
* Updates the provided vault, re-encrypting
* data with a safer algorithm if one is available.
*
* If the provided vault is already using the latest available encryption method,
* it is returned as is.
*
* @param vault - The vault to update.
* @param password - The password to use for encryption.
* @param targetDerivationParams - The options to use for key derivation.
* @returns A promise resolving to the updated vault.
*/
updateVault = async (
vault: string,
password: string,
Expand Down

0 comments on commit c845b97

Please sign in to comment.