Documentation ¶
Overview ¶
Package keepass reads and writes the KeePass1 database format.
Index ¶
- Constants
- Variables
- type Database
- type Entry
- type Group
- func (g *Group) Entries() []*Entry
- func (g *Group) Entry(i int) *Entry
- func (g *Group) Group(i int) *Group
- func (g *Group) Groups() []*Group
- func (g *Group) IsRoot() bool
- func (g *Group) NEntries() int
- func (g *Group) NGroups() int
- func (g *Group) NewEntry() (*Entry, error)
- func (g *Group) NewSubgroup() *Group
- func (g *Group) Parent() *Group
- func (g *Group) RemoveEntry(e *Entry) error
- func (g *Group) RemoveSubgroup(sub *Group) error
- func (g *Group) SetParent(parent *Group) error
- type Icon
- type Options
- type TimeInfo
Constants ¶
const ( RijndaelCipher = kdbcrypt.RijndaelCipher TwofishCipher = kdbcrypt.TwofishCipher )
Ciphers for Options
Variables ¶
var ( ErrHashMismatch = errors.New("keepass: password does not match or database is corrupt") ErrWrongSignature = errors.New("keepass: not a KeePass file") ErrWrongVersion = errors.New("keepass: unsupported version") ErrUnknownEncryption = errors.New("keepass: unknown encryption algorithm") )
Errors
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
A Database represents a decrypted KDB file.
func (*Database) ComputedKey ¶ added in v0.2.2
func (db *Database) ComputedKey() kdbcrypt.ComputedKey
ComputedKey returns the computed encryption key of the database.
type Entry ¶
type Entry struct { UUID uuids.UUID Title string Icon Icon URL string Username string Password string Notes string TimeInfo Attachment struct { Name string Data []byte } // contains filtered or unexported fields }
An Entry stores a username and password.
func (*Entry) HasAttachment ¶ added in v1.0.0
HasAttachment reports whether an entry has a file attachment.
type Group ¶
type Group struct { ID uint32 Name string Icon Icon TimeInfo // contains filtered or unexported fields }
A Group is a hierarchial collection of entries.
func (*Group) Entry ¶
Entry returns the entry at index i. If i is out of range, this method will panic.
func (*Group) Group ¶
Group returns the group at index i. If i is out of range, this method will panic.
func (*Group) IsRoot ¶ added in v1.0.0
IsRoot reports whether the group is the database's root group.
func (*Group) NewEntry ¶
NewEntry creates a new entry inside the group and returns it. An error is returned if the ID generation fails.
func (*Group) NewSubgroup ¶
NewSubgroup creates a group inside g and returns it.
func (*Group) Parent ¶ added in v1.0.0
Parent returns the containing group or nil if the group is the database's root.
func (*Group) RemoveEntry ¶
RemoveEntry removes e from the group's entries.
func (*Group) RemoveSubgroup ¶
RemoveSubgroup removes sub from the group's children.
type Options ¶
type Options struct { // Password is an optional textual password to encrypt/decrypt // the database. Password string // KeyFile is an optional binary file to encrypt/decrypt the database. KeyFile io.Reader // If ComputedKey is non-nil, it will be used instead of Password/KeyFile // to decrypt an existing database. ComputedKey kdbcrypt.ComputedKey // Random number source, used for salts and ID generation. // Defaults to crypto/rand.Reader. Rand io.Reader // Number of rounds to encrypt the key with. Higher values mean key // generation takes longer, thus harder to brute force. If zero, // a reasonable default is used. Only used for creation. KeyRounds int // Cipher to encrypt with. Defaults to AES-256 (RijndaelCipher). // Only used for creation. Cipher kdbcrypt.Cipher // StaticIVForTesting will keep the IV the same between writes, useful // for testing, but insecure. Never enable this in production code! StaticIVForTesting bool }
Options is the set of parameters for creating or opening a database. Nil is treated the same as the zero value.