mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
Fix mistakes and change db upgrade message
This commit is contained in:
parent
00090f6e78
commit
87d2cbdfe6
4 changed files with 9 additions and 6 deletions
|
|
@ -178,7 +178,7 @@ type EncryptionConfig struct {
|
|||
DeleteKeys struct {
|
||||
DeleteOutboundOnAck bool `yaml:"delete_outbound_on_ack"`
|
||||
RatchetOnDecrypt bool `yaml:"ratchet_on_decrypt"`
|
||||
DeleteFullyUsedOnDecrypt bool `yamL:"delete_fully_used_on_decrypt"`
|
||||
DeleteFullyUsedOnDecrypt bool `yaml:"delete_fully_used_on_decrypt"`
|
||||
DeletePrevOnNewSession bool `yaml:"delete_prev_on_new_session"`
|
||||
DeleteOnDeviceDelete bool `yaml:"delete_on_device_delete"`
|
||||
PeriodicallyDeleteExpired bool `yaml:"periodically_delete_expired"`
|
||||
|
|
|
|||
|
|
@ -557,9 +557,6 @@ func (mach *OlmMachine) receiveRoomKey(ctx context.Context, evt *DecryptedOlmEve
|
|||
Str("algorithm", string(content.Algorithm)).
|
||||
Str("session_id", content.SessionID.String()).
|
||||
Str("room_id", content.RoomID.String()).
|
||||
Bool("scheduled", content.IsScheduled).
|
||||
Int64("max_age", content.MaxAge).
|
||||
Int("max_messages", content.MaxMessages).
|
||||
Logger()
|
||||
if content.Algorithm != id.AlgorithmMegolmV1 || evt.Keys.Ed25519 == "" {
|
||||
log.Debug().Msg("Ignoring weird room key")
|
||||
|
|
@ -571,7 +568,13 @@ func (mach *OlmMachine) receiveRoomKey(ctx context.Context, evt *DecryptedOlmEve
|
|||
var maxMessages int
|
||||
if config != nil {
|
||||
maxAge = time.Duration(config.RotationPeriodMillis) * time.Millisecond
|
||||
if maxAge == 0 {
|
||||
maxAge = 7 * 24 * time.Hour
|
||||
}
|
||||
maxMessages = config.RotationPeriodMessages
|
||||
if maxMessages == 0 {
|
||||
maxMessages = 100
|
||||
}
|
||||
}
|
||||
if content.MaxAge != 0 {
|
||||
maxAge = time.Duration(content.MaxAge) * time.Millisecond
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ func (store *SQLCryptoStore) RedactExpiredGroupSessions() ([]id.SessionID, error
|
|||
}
|
||||
|
||||
func (store *SQLCryptoStore) PutWithheldGroupSession(content event.RoomKeyWithheldEventContent) error {
|
||||
_, err := store.DB.Exec("INSERT INTO crypto_megolm_inbound_session (session_id, sender_key, room_id, withheld_code, withheld_reason, received_at, account_id) VALUES ($1, $2, $3, $4, $5, $6. $7)",
|
||||
_, err := store.DB.Exec("INSERT INTO crypto_megolm_inbound_session (session_id, sender_key, room_id, withheld_code, withheld_reason, received_at, account_id) VALUES ($1, $2, $3, $4, $5, $6, $7)",
|
||||
content.SessionID, content.SenderKey, content.RoomID, content.Code, content.Reason, time.Now().UTC(), store.AccountID)
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
-- v10: Add flag for megolm sessions to mark them as safe to delete
|
||||
-- v10: Add metadata for detecting when megolm sessions are safe to delete
|
||||
ALTER TABLE crypto_megolm_inbound_session ADD COLUMN ratchet_safety jsonb;
|
||||
ALTER TABLE crypto_megolm_inbound_session ADD COLUMN received_at timestamp;
|
||||
ALTER TABLE crypto_megolm_inbound_session ADD COLUMN max_age BIGINT;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue