1
0
mirror of https://github.com/element-hq/element-web.git synced 2025-07-31 19:44:30 +03:00

e2e test: by default the bot should not use a passphrase to create the recovery key (#29214)

* test(crypto): by default do not use a passphrase to create the recovery key

* test(crypto): update tests
This commit is contained in:
Florian D
2025-02-07 10:39:36 +01:00
committed by GitHub
parent 4a231c6450
commit 7b3ce5d9b2
7 changed files with 21 additions and 14 deletions

View File

@ -41,6 +41,10 @@ export interface CreateBotOpts {
* Whether to bootstrap the secret storage
*/
bootstrapSecretStorage?: boolean;
/**
* Whether to use a passphrase when creating the recovery key
*/
usePassphrase?: boolean;
}
const defaultCreateBotOptions = {
@ -48,6 +52,7 @@ const defaultCreateBotOptions = {
autoAcceptInvites: true,
startClient: true,
bootstrapCrossSigning: true,
usePassphrase: false,
} satisfies CreateBotOpts;
type ExtendedMatrixClient = MatrixClient & { __playwright_recovery_key: GeneratedSecretStorageKey };
@ -206,8 +211,8 @@ export class Bot extends Client {
}
if (this.opts.bootstrapSecretStorage) {
await clientHandle.evaluate(async (cli) => {
const passphrase = "new passphrase";
await clientHandle.evaluate(async (cli, usePassphrase) => {
const passphrase = usePassphrase ? "new passphrase" : undefined;
const recoveryKey = await cli.getCrypto().createRecoveryKeyFromPassphrase(passphrase);
Object.assign(cli, { __playwright_recovery_key: recoveryKey });
@ -216,7 +221,7 @@ export class Bot extends Client {
setupNewKeyBackup: true,
createSecretStorageKey: () => Promise.resolve(recoveryKey),
});
});
}, this.opts.usePassphrase);
}
return clientHandle;