mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
crypto/keysharing: fix including sender key in forwards
Some checks failed
Some checks failed
This commit is contained in:
parent
b041eb924e
commit
074a2d8d4d
3 changed files with 4 additions and 6 deletions
|
|
@ -29,7 +29,6 @@ var (
|
|||
ErrDuplicateMessageIndex = errors.New("duplicate megolm message index")
|
||||
ErrWrongRoom = errors.New("encrypted megolm event is not intended for this room")
|
||||
ErrDeviceKeyMismatch = errors.New("device keys in event and verified device info do not match")
|
||||
ErrSenderKeyMismatch = errors.New("sender keys in content and megolm session do not match")
|
||||
ErrRatchetError = errors.New("failed to ratchet session after use")
|
||||
ErrCorruptedMegolmPayload = errors.New("corrupted megolm payload")
|
||||
)
|
||||
|
|
@ -41,7 +40,6 @@ var (
|
|||
DuplicateMessageIndex = ErrDuplicateMessageIndex
|
||||
WrongRoom = ErrWrongRoom
|
||||
DeviceKeyMismatch = ErrDeviceKeyMismatch
|
||||
SenderKeyMismatch = ErrSenderKeyMismatch
|
||||
RatchetError = ErrRatchetError
|
||||
)
|
||||
|
||||
|
|
@ -254,8 +252,6 @@ func (mach *OlmMachine) actuallyDecryptMegolmEvent(ctx context.Context, evt *eve
|
|||
return nil, nil, 0, fmt.Errorf("failed to get group session: %w", err)
|
||||
} else if sess == nil {
|
||||
return nil, nil, 0, fmt.Errorf("%w (ID %s)", ErrNoSessionFound, content.SessionID)
|
||||
} else if content.SenderKey != "" && content.SenderKey != sess.SenderKey {
|
||||
return sess, nil, 0, ErrSenderKeyMismatch
|
||||
}
|
||||
plaintext, messageIndex, err := sess.Internal.Decrypt(content.MegolmCiphertext)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ func (mach *OlmMachine) rejectKeyRequest(ctx context.Context, rejection KeyShare
|
|||
RoomID: request.RoomID,
|
||||
Algorithm: request.Algorithm,
|
||||
SessionID: request.SessionID,
|
||||
//lint:ignore SA1019 This is just echoing back the deprecated field
|
||||
SenderKey: request.SenderKey,
|
||||
Code: rejection.Code,
|
||||
Reason: rejection.Reason,
|
||||
|
|
@ -356,7 +357,7 @@ func (mach *OlmMachine) HandleRoomKeyRequest(ctx context.Context, sender id.User
|
|||
SessionID: igs.ID(),
|
||||
SessionKey: string(exportedKey),
|
||||
},
|
||||
SenderKey: content.Body.SenderKey,
|
||||
SenderKey: igs.SenderKey,
|
||||
ForwardingKeyChain: igs.ForwardingChains,
|
||||
SenderClaimedKey: igs.SigningKey,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -132,8 +132,9 @@ type RoomKeyRequestEventContent struct {
|
|||
type RequestedKeyInfo struct {
|
||||
Algorithm id.Algorithm `json:"algorithm"`
|
||||
RoomID id.RoomID `json:"room_id"`
|
||||
SenderKey id.SenderKey `json:"sender_key"`
|
||||
SessionID id.SessionID `json:"session_id"`
|
||||
// Deprecated: Matrix v1.3
|
||||
SenderKey id.SenderKey `json:"sender_key"`
|
||||
}
|
||||
|
||||
type RoomKeyWithheldCode string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue