func (db *Database) OpenDatabase(cfg *Configuration) error {
	file, err := os.Open(cfg.Database.Database)
	if err == nil {
		err = gokeepasslib.NewDecoder(file).Decode(db.Keepass)
		if err == nil {
			err = db.Keepass.UnlockProtectedEntries()
		}
	}
	return err
}
OpenDatabase decodes the database with the given configuration
package kpmenulib
import (
	"log"
	"os"
	"github.com/tobischo/gokeepasslib/v3"
)
type Database struct {
	Loaded  bool
	Keepass *gokeepasslib.Database
	Entries []Entry
}
type Entry struct {
	UUID      gokeepasslib.UUID
	FullEntry gokeepasslib.Entry
}
func NewDatabase() *Database {
	return &Database{
		Loaded:  false,
		Keepass: gokeepasslib.NewDatabase(),
	}
}
func (db *Database) AddCredentialsToDatabase(cfg *Configuration, password string) {
	if password != "" && cfg.Database.KeyFile != "" {
		db.Keepass.Credentials, _ = gokeepasslib.NewPasswordAndKeyCredentials(password, cfg.Database.KeyFile)
		log.Printf("credentials: password + keyfile")
	} else if password != "" {
		db.Keepass.Credentials = gokeepasslib.NewPasswordCredentials(password)
		log.Printf("credentials: password")
	} else if cfg.Database.KeyFile != "" {
		db.Keepass.Credentials, _ = gokeepasslib.NewKeyCredentials(cfg.Database.KeyFile)
		log.Printf("credentials: keyfile")
	}
}