twitch-bot/pkg/database/database.go
Knut Ahlers 3213f4ac37
[core] Add validation and reset of encrypted values
in order to detect change of encryption pass

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2023-03-24 20:41:02 +01:00

25 lines
696 B
Go

// Package database represents a connector to the sqlite storage
// backend to store persistent data from core and plugins
package database
import (
"gorm.io/gorm"
)
type (
// Connector represents a database connection having some extra
// convenience methods
Connector interface {
Close() error
DB() *gorm.DB
DeleteCoreMeta(key string) error
ReadCoreMeta(key string, value any) error
StoreCoreMeta(key string, value any) error
ReadEncryptedCoreMeta(key string, value any) error
ResetEncryptedCoreMeta() error
StoreEncryptedCoreMeta(key string, value any) error
DecryptField(string) (string, error)
EncryptField(string) (string, error)
ValidateEncryption() error
}
)