fix(matrix): check if requestOwnUserVerification exists before calling
The crypto SDK may not have this function, causing a TypeError on startup. This adds a runtime check to gracefully handle missing verification support. Fixes #2901
This commit is contained in:
parent
640c8d1554
commit
67a7b677e2
@ -250,10 +250,14 @@ export async function monitorMatrixProvider(opts: MonitorMatrixOpts = {}): Promi
|
|||||||
// If E2EE is enabled, trigger device verification
|
// If E2EE is enabled, trigger device verification
|
||||||
if (auth.encryption && client.crypto) {
|
if (auth.encryption && client.crypto) {
|
||||||
try {
|
try {
|
||||||
// Request verification from other sessions
|
// Request verification from other sessions (if supported by SDK)
|
||||||
const verificationRequest = await client.crypto.requestOwnUserVerification();
|
if (typeof client.crypto.requestOwnUserVerification === "function") {
|
||||||
if (verificationRequest) {
|
const verificationRequest = await client.crypto.requestOwnUserVerification();
|
||||||
logger.info("matrix: device verification requested - please verify in another client");
|
if (verificationRequest) {
|
||||||
|
logger.info("matrix: device verification requested - please verify in another client");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.debug("matrix: device verification not supported by current crypto SDK version");
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.debug({ error: String(err) }, "Device verification request failed (may already be verified)");
|
logger.debug({ error: String(err) }, "Device verification request failed (may already be verified)");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user