Assert that the crypto module is defined
parent
b20579d796
commit
24c537cdb7
|
@ -65,13 +65,7 @@ export function ChangeRecoveryKey({
|
|||
const [state, setState] = useState<State>(isSetupFlow ? "inform_user" : "save_key_change_flow");
|
||||
|
||||
// We create a new recovery key, the recovery key will be displayed to the user
|
||||
const recoveryKey = useAsyncMemo(() => {
|
||||
const crypto = matrixClient.getCrypto();
|
||||
if (!crypto) return Promise.resolve(undefined);
|
||||
|
||||
return crypto.createRecoveryKeyFromPassphrase();
|
||||
}, []);
|
||||
|
||||
const recoveryKey = useAsyncMemo(() => matrixClient.getCrypto()!.createRecoveryKeyFromPassphrase(), []);
|
||||
if (!recoveryKey?.encodedPrivateKey) return null;
|
||||
|
||||
let content: JSX.Element;
|
||||
|
|
|
@ -46,8 +46,7 @@ export function RecoveryPanel({ onSetUpRecoveryClick, onChangingRecoveryKeyClick
|
|||
const matrixClient = useMatrixClientContext();
|
||||
|
||||
const checkEncryption = useCallback(async () => {
|
||||
const crypto = matrixClient.getCrypto();
|
||||
if (!crypto) return;
|
||||
const crypto = matrixClient.getCrypto()!;
|
||||
|
||||
// Check if the user has a backup
|
||||
const hasBackup = Boolean(await crypto.checkKeyBackupAndEnable());
|
||||
|
|
|
@ -78,9 +78,7 @@ function useVerificationRequired(setState: (state: State) => void): () => Promis
|
|||
const matrixClient = useMatrixClientContext();
|
||||
|
||||
const checkVerificationRequired = useCallback(async () => {
|
||||
const crypto = matrixClient.getCrypto();
|
||||
if (!crypto) return;
|
||||
|
||||
const crypto = matrixClient.getCrypto()!;
|
||||
const isCrossSigningReady = await crypto.isCrossSigningReady();
|
||||
if (isCrossSigningReady) setState("main");
|
||||
else setState("verification_required");
|
||||
|
|
Loading…
Reference in New Issue