From 490746e56aab4227f64895f43de24d2b189c0ffe Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Thu, 19 Sep 2024 15:41:11 +0200 Subject: [PATCH] Update to use non deprecated methods to derive key from passphrase (#55) * Replace `deriveKey` call by `deriveRecoveryKeyFromPassphrase` * Remove `matrix-js-sdk/src/crypto/key_passphrase` import of eslint exception --- .eslintrc.js | 1 - src/SecurityManager.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 444388d492..9cb3e29fb7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -122,7 +122,6 @@ module.exports = { "!matrix-js-sdk/src/crypto/aes", "!matrix-js-sdk/src/crypto/keybackup", "!matrix-js-sdk/src/crypto/deviceinfo", - "!matrix-js-sdk/src/crypto/key_passphrase", "!matrix-js-sdk/src/crypto/recoverykey", "!matrix-js-sdk/src/crypto/dehydration", "!matrix-js-sdk/src/oidc", diff --git a/src/SecurityManager.ts b/src/SecurityManager.ts index 6bfd361140..f03f83d573 100644 --- a/src/SecurityManager.ts +++ b/src/SecurityManager.ts @@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details. */ import { ICryptoCallbacks, SecretStorage } from "matrix-js-sdk/src/matrix"; -import { deriveKey } from "matrix-js-sdk/src/crypto/key_passphrase"; +import { deriveRecoveryKeyFromPassphrase } from "matrix-js-sdk/src/crypto-api"; import { decodeRecoveryKey } from "matrix-js-sdk/src/crypto/recoverykey"; import { logger } from "matrix-js-sdk/src/logger"; @@ -64,7 +64,7 @@ function makeInputToKey( ): (keyParams: KeyParams) => Promise { return async ({ passphrase, recoveryKey }): Promise => { if (passphrase) { - return deriveKey(passphrase, keyInfo.passphrase.salt, keyInfo.passphrase.iterations); + return deriveRecoveryKeyFromPassphrase(passphrase, keyInfo.passphrase.salt, keyInfo.passphrase.iterations); } else if (recoveryKey) { return decodeRecoveryKey(recoveryKey); }