mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
crypto/decryptmegolm: allow device key mismatches, but mark as untrusted
This commit is contained in:
parent
ae58161412
commit
974f7dc544
2 changed files with 13 additions and 2 deletions
|
|
@ -16,6 +16,7 @@ type TrustState int
|
|||
|
||||
const (
|
||||
TrustStateBlacklisted TrustState = -100
|
||||
TrustStateDeviceKeyMismatch TrustState = -5
|
||||
TrustStateUnset TrustState = 0
|
||||
TrustStateUnknownDevice TrustState = 10
|
||||
TrustStateForwarded TrustState = 20
|
||||
|
|
@ -23,7 +24,7 @@ const (
|
|||
TrustStateCrossSignedTOFU TrustState = 100
|
||||
TrustStateCrossSignedVerified TrustState = 200
|
||||
TrustStateVerified TrustState = 300
|
||||
TrustStateInvalid TrustState = (1 << 31) - 1
|
||||
TrustStateInvalid TrustState = -2147483647
|
||||
)
|
||||
|
||||
func (ts *TrustState) UnmarshalText(data []byte) error {
|
||||
|
|
@ -44,6 +45,8 @@ func ParseTrustState(val string) TrustState {
|
|||
switch strings.ToLower(val) {
|
||||
case "blacklisted":
|
||||
return TrustStateBlacklisted
|
||||
case "device-key-mismatch":
|
||||
return TrustStateDeviceKeyMismatch
|
||||
case "unverified":
|
||||
return TrustStateUnset
|
||||
case "cross-signed-untrusted":
|
||||
|
|
@ -67,6 +70,8 @@ func (ts TrustState) String() string {
|
|||
switch ts {
|
||||
case TrustStateBlacklisted:
|
||||
return "blacklisted"
|
||||
case TrustStateDeviceKeyMismatch:
|
||||
return "device-key-mismatch"
|
||||
case TrustStateUnset:
|
||||
return "unverified"
|
||||
case TrustStateCrossSignedUntrusted:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue