Add better message for group session withheld

This commit is contained in:
Tulir Asokan 2023-03-15 01:32:32 +02:00
commit 96df4ac112
3 changed files with 4 additions and 0 deletions

View file

@ -32,6 +32,7 @@ import (
var _ crypto.StateStore = (*sqlstatestore.SQLStateStore)(nil)
var NoSessionFound = crypto.NoSessionFound
var ErrGroupSessionWithheld = crypto.ErrGroupSessionWithheld
var UnknownMessageIndex = olm.UnknownMessageIndex
type CryptoHelper struct {

View file

@ -391,6 +391,8 @@ func errorToHumanMessage(err error) string {
return err.Error()
case errors.Is(err, UnknownMessageIndex):
return "the keys received by the bridge can't decrypt the message"
case errors.Is(err, ErrGroupSessionWithheld):
return "your client refused to share decryption keys with the bridge"
case errors.Is(err, errMessageNotEncrypted):
return "the message is not encrypted"
default:

View file

@ -22,4 +22,5 @@ func NewCryptoHelper(bridge *Bridge) Crypto {
}
var NoSessionFound = errors.New("nil")
var ErrGroupSessionWithheld = NoSessionFound
var UnknownMessageIndex = NoSessionFound