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
pull/28192/head
Florian Duros 2024-09-19 15:41:11 +02:00 committed by GitHub
parent 4776f87775
commit 490746e56a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -122,7 +122,6 @@ module.exports = {
"!matrix-js-sdk/src/crypto/aes", "!matrix-js-sdk/src/crypto/aes",
"!matrix-js-sdk/src/crypto/keybackup", "!matrix-js-sdk/src/crypto/keybackup",
"!matrix-js-sdk/src/crypto/deviceinfo", "!matrix-js-sdk/src/crypto/deviceinfo",
"!matrix-js-sdk/src/crypto/key_passphrase",
"!matrix-js-sdk/src/crypto/recoverykey", "!matrix-js-sdk/src/crypto/recoverykey",
"!matrix-js-sdk/src/crypto/dehydration", "!matrix-js-sdk/src/crypto/dehydration",
"!matrix-js-sdk/src/oidc", "!matrix-js-sdk/src/oidc",

View File

@ -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 { 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 { decodeRecoveryKey } from "matrix-js-sdk/src/crypto/recoverykey";
import { logger } from "matrix-js-sdk/src/logger"; import { logger } from "matrix-js-sdk/src/logger";
@ -64,7 +64,7 @@ function makeInputToKey(
): (keyParams: KeyParams) => Promise<Uint8Array> { ): (keyParams: KeyParams) => Promise<Uint8Array> {
return async ({ passphrase, recoveryKey }): Promise<Uint8Array> => { return async ({ passphrase, recoveryKey }): Promise<Uint8Array> => {
if (passphrase) { if (passphrase) {
return deriveKey(passphrase, keyInfo.passphrase.salt, keyInfo.passphrase.iterations); return deriveRecoveryKeyFromPassphrase(passphrase, keyInfo.passphrase.salt, keyInfo.passphrase.iterations);
} else if (recoveryKey) { } else if (recoveryKey) {
return decodeRecoveryKey(recoveryKey); return decodeRecoveryKey(recoveryKey);
} }