Skip to content

Commit f7ba912

Browse files
committed
add comments to #updateCachedEncryptionKey
1 parent 7d17c6d commit f7ba912

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/keyring-controller/src/KeyringController.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,12 +2176,16 @@ export class KeyringController extends BaseController<
21762176
}
21772177

21782178
/**
2179-
* Updates the cached vault encryption key.
2179+
* Updates the cached vault encryption key. This key will be persisted in
2180+
* the state at the next update if envelope encryption is enabled.
21802181
*
21812182
* @param encryptionKey - Optional new vault encryption key.
21822183
*/
21832184
#updateCachedEncryptionKey(encryptionKey?: string) {
21842185
if (!encryptionKey && this.state.encryptedEncryptionKey) {
2186+
// If no encryption key is provided and we are in envelope encryption
2187+
// mode, use the cached encryption key. This case occurs when we call
2188+
// change password without providing a new encryption key.
21852189
this.#encryptionKey = this.state.encryptionKey;
21862190
} else {
21872191
this.#encryptionKey = encryptionKey;

0 commit comments

Comments
 (0)