@@ -292,17 +292,28 @@ export async function doTwoWaySasVerification(page: Page, verifier: JSHandle<Ver
292
292
}
293
293
294
294
/**
295
- * Open the security settings and enable secure key backup.
296
- *
297
- * Assumes that the current device has been cross-signed (which means that we skip a step where we set it up).
295
+ * Open the encryption settings and enable key storage and recovery
296
+ * Assumes that the current device has been verified
298
297
*
299
298
* Returns the recovery key
300
299
*/
301
300
export async function enableKeyBackup ( app : ElementAppPage ) : Promise < string > {
302
- await app . settings . openUserSettings ( "Security & Privacy" ) ;
303
- await app . page . getByRole ( "button" , { name : "Set up Secure Backup" } ) . click ( ) ;
301
+ const encryptionTab = await app . settings . openUserSettings ( "Encryption" ) ;
302
+
303
+ const keyStorageToggle = encryptionTab . getByRole ( "checkbox" , { name : "Allow key storage" } ) ;
304
+ if ( ! ( await keyStorageToggle . isChecked ( ) ) ) {
305
+ await encryptionTab . getByRole ( "checkbox" , { name : "Allow key storage" } ) . click ( ) ;
306
+ }
304
307
305
- return await completeCreateSecretStorageDialog ( app . page ) ;
308
+ await encryptionTab . getByRole ( "button" , { name : "Set up recovery" } ) . click ( ) ;
309
+ await encryptionTab . getByRole ( "button" , { name : "Continue" } ) . click ( ) ;
310
+
311
+ const recoveryKey = await encryptionTab . getByTestId ( "recoveryKey" ) . innerText ( ) ;
312
+ await encryptionTab . getByRole ( "button" , { name : "Continue" } ) . click ( ) ;
313
+ await encryptionTab . getByRole ( "textbox" ) . fill ( recoveryKey ) ;
314
+ await encryptionTab . getByRole ( "button" , { name : "Finish set up" } ) . click ( ) ;
315
+ await app . settings . closeDialog ( ) ;
316
+ return recoveryKey ;
306
317
}
307
318
308
319
/**
0 commit comments