Fixed cinny verified device failed to verify other

This commit is contained in:
Ajay Bura 2022-05-08 11:55:41 +05:30
parent 73723ba6ba
commit 2075a572fe

View file

@ -28,7 +28,10 @@ function EmojiVerificationContent({ data, requestClose }) {
const mountStore = useStore(); const mountStore = useStore();
const beginVerification = async () => { const beginVerification = async () => {
if (mx.getCrossSigningId() === null && isCrossVerified(mx.deviceId)) { if (
isCrossVerified(mx.deviceId)
&& (mx.getCrossSigningId() === null || await mx.crypto.crossSigningInfo.isStoredInKeyCache('self_signing') === false)
) {
if (!hasPrivateKey(getDefaultSSKey())) { if (!hasPrivateKey(getDefaultSSKey())) {
const keyData = await accessSecretStorage('Emoji verification'); const keyData = await accessSecretStorage('Emoji verification');
if (!keyData) { if (!keyData) {
@ -66,10 +69,13 @@ function EmojiVerificationContent({ data, requestClose }) {
useEffect(() => { useEffect(() => {
mountStore.setItem(true); mountStore.setItem(true);
const handleChange = () => { const handleChange = () => {
if (request.done || request.cancelled) {
requestClose();
return;
}
if (targetDevice && request.started) { if (targetDevice && request.started) {
beginVerification(); beginVerification();
} }
if (request.done || request.cancelled) requestClose();
}; };
if (request === null) return null; if (request === null) return null;
@ -77,7 +83,7 @@ function EmojiVerificationContent({ data, requestClose }) {
req.on('change', handleChange); req.on('change', handleChange);
return () => { return () => {
req.off('change', handleChange); req.off('change', handleChange);
if (!req.cancelled && !req.done) { if (req.cancelled === false && req.done === false) {
req.cancel(); req.cancel();
} }
}; };