You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Element-R: detect "withheld key" UTD errors, and mark them as such (#4302)
Partial fix to element-hq/element-web#27653
This commit is contained in:
committed by
GitHub
parent
996663bf64
commit
53201688a6
@@ -1787,6 +1787,17 @@ class EventDecryptor {
|
||||
}
|
||||
}
|
||||
|
||||
// If we got a withheld code, expose that.
|
||||
if (err.maybe_withheld) {
|
||||
// Unfortunately the Rust SDK API doesn't let us distinguish between different withheld cases, other than
|
||||
// by string-matching.
|
||||
const failureCode =
|
||||
err.maybe_withheld === "The sender has disabled encrypting to unverified devices."
|
||||
? DecryptionFailureCode.MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE
|
||||
: DecryptionFailureCode.MEGOLM_KEY_WITHHELD;
|
||||
throw new DecryptionError(failureCode, err.maybe_withheld, errorDetails);
|
||||
}
|
||||
|
||||
switch (err.code) {
|
||||
case RustSdkCryptoJs.DecryptionErrorCode.MissingRoomKey:
|
||||
throw new DecryptionError(
|
||||
|
||||
Reference in New Issue
Block a user