Fix consistency bug where ClientConfig would get out of date between different parts of the code

This commit is contained in:
David Dworken
2023-09-23 12:40:57 -07:00
parent 8c239a32b9
commit ab12fa4d47
6 changed files with 40 additions and 14 deletions

View File

@@ -63,7 +63,7 @@ func Setup(userSecret string, isOffline bool) error {
config.DeviceId = uuid.Must(uuid.NewRandom()).String()
config.ControlRSearchEnabled = true
config.IsOffline = isOffline
err := hctx.SetConfig(config)
err := hctx.SetConfig(&config)
if err != nil {
return fmt.Errorf("failed to persist config to disk: %w", err)
}
@@ -563,7 +563,7 @@ func ReliableDbCreate(db *gorm.DB, entry data.HistoryEntry) error {
})
}
func EncryptAndMarshal(config hctx.ClientConfig, entries []*data.HistoryEntry) ([]byte, error) {
func EncryptAndMarshal(config *hctx.ClientConfig, entries []*data.HistoryEntry) ([]byte, error) {
var encEntries []shared.EncHistoryEntry
for _, entry := range entries {
encEntry, err := data.EncryptHistoryEntry(config.UserSecret, *entry)