mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
Add option to disable storing outbound keys in inbound table
This commit is contained in:
parent
d03c193a31
commit
7c98416947
4 changed files with 7 additions and 2 deletions
|
|
@ -177,6 +177,7 @@ type EncryptionConfig struct {
|
|||
|
||||
DeleteKeys struct {
|
||||
DeleteOutboundOnAck bool `yaml:"delete_outbound_on_ack"`
|
||||
DontStoreOutbound bool `yaml:"dont_store_outbound"`
|
||||
RatchetOnDecrypt bool `yaml:"ratchet_on_decrypt"`
|
||||
DeleteFullyUsedOnDecrypt bool `yaml:"delete_fully_used_on_decrypt"`
|
||||
DeletePrevOnNewSession bool `yaml:"delete_prev_on_new_session"`
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ func (helper *CryptoHelper) Init() error {
|
|||
helper.mach.PlaintextMentions = encryptionConfig.PlaintextMentions
|
||||
|
||||
helper.mach.DeleteOutboundKeysOnAck = encryptionConfig.DeleteKeys.DeleteOutboundOnAck
|
||||
helper.mach.DontStoreOutboundKeys = encryptionConfig.DeleteKeys.DontStoreOutbound
|
||||
helper.mach.RatchetKeysOnDecrypt = encryptionConfig.DeleteKeys.RatchetOnDecrypt
|
||||
helper.mach.DeleteFullyUsedKeysOnDecrypt = encryptionConfig.DeleteKeys.DeleteFullyUsedOnDecrypt
|
||||
helper.mach.DeletePreviousKeysOnReceive = encryptionConfig.DeleteKeys.DeletePrevOnNewSession
|
||||
|
|
|
|||
|
|
@ -137,8 +137,10 @@ func (mach *OlmMachine) EncryptMegolmEvent(ctx context.Context, roomID id.RoomID
|
|||
|
||||
func (mach *OlmMachine) newOutboundGroupSession(ctx context.Context, roomID id.RoomID) *OutboundGroupSession {
|
||||
session := NewOutboundGroupSession(roomID, mach.StateStore.GetEncryptionEvent(roomID))
|
||||
signingKey, idKey := mach.account.Keys()
|
||||
mach.createGroupSession(ctx, idKey, signingKey, roomID, session.ID(), session.Internal.Key(), session.MaxAge, session.MaxMessages, false)
|
||||
if !mach.DontStoreOutboundKeys {
|
||||
signingKey, idKey := mach.account.Keys()
|
||||
mach.createGroupSession(ctx, idKey, signingKey, roomID, session.ID(), session.Internal.Key(), session.MaxAge, session.MaxMessages, false)
|
||||
}
|
||||
return session
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ type OlmMachine struct {
|
|||
crossSigningPubkeysFetched bool
|
||||
|
||||
DeleteOutboundKeysOnAck bool
|
||||
DontStoreOutboundKeys bool
|
||||
DeletePreviousKeysOnReceive bool
|
||||
RatchetKeysOnDecrypt bool
|
||||
DeleteFullyUsedKeysOnDecrypt bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue