Expand description
Types representing an opened KeePass database
The main entry point is the Database struct, which can be created with Database::new or loaded from a file using Database::open. The example uses explicit type annotations to show what is happening, but these can be omitted in your own code.
use keepass::{Database, db::{fields, AttachmentMut, EntryMut, GroupMut, Value}};
let mut db = Database::new();
let mut root: GroupMut<'_> = db.root_mut();
// Add a new child group to the root group
let mut group: GroupMut<'_> = root.add_group();
// GroupMut dereferences to &mut Group, so you can access most of its fields directly
group.name = "My Group".into();
group.notes = Some("This is an example group".into());
// Add a new entry to the group
let mut entry: EntryMut<'_> = root.add_entry();
// EntryMut dereferences to &mut Entry, so you can access most of its fields directly
entry.set_unprotected(fields::TITLE, "My Entry");
entry.set_unprotected(fields::USERNAME, "jdoe");
entry.set_protected(fields::PASSWORD, "hunter2");
entry.tags.push("example".into());
// Adding the attachment to an entry will store it in the associated database and add a
// reference to the entry.
entry.add_attachment("myfile.txt", Value::unprotected(b"Hello, world!".to_vec()));
// You can also use the fluent API to chain method calls together.
let entry_id = root.add_group()
.edit(|g: &mut GroupMut| {
g.name = "Another Group".into();
g.notes = Some("This is another example group".into());
})
.add_entry()
.edit(|e: &mut EntryMut<'_>| {
e.set_unprotected(fields::TITLE, "Another Entry");
e.set_unprotected(fields::USERNAME, "asmith");
e.set_protected(fields::PASSWORD, "password123");
e.tags.push("example".into());
}).id();Modules§
- fields
- Standard field names for entries.
Structs§
- Attachment
- Attachment for an entry.
- Attachment
Id - Identifier for an Attachment
- Attachment
Mut - A mutable reference to an Attachment. Implements DerefMut to &mut Attachment
- Attachment
Ref - An immutable reference to an Attachment. Implements Deref to &Attachment
- Auto
Type - An AutoType setting associated with an Entry
- Auto
Type Association - A window association associated with an AutoType setting
- Color
- A color value for the Database, or Entry
- Custom
Data Item - Custom data field for an Entry or Meta for database-wide custom data
- Custom
Icon - A custom icon stored in the database, containing raw image data.
- Custom
Icon Id - A unique identifier for a CustomIcon
- Custom
Icon Mut - A mutable reference to a CustomIcon. Implements DerefMut to &mut CustomIcon
- Custom
Icon NotFound Error - Error type for when a CustomIconId is provided that does not exist in the database
- Custom
Icon Ref - An immutable reference to a CustomIcon. Implements Deref to &CustomIcon
- Database
- A decrypted KeePass database
- Destination
Group NotFound Error - Error type for when a destination GroupId is provided that does not exist in the database
- Duplicate
Entry IdError - Attempted to add an entry with an ID that already exists in the database.
- Duplicate
Group IdError - Attempted to add a group with an ID that already exists in the database.
- Entry
- A database entry containing several key-value fields.
- EntryId
- Unique identifier for an Entry
- Entry
Mut - A mutable reference to an Entry. Implements DerefMut to &mut Entry.
- Entry
Ref - An immutable reference to an Entry. Implements Deref to &Entry.
- Entry
Track - A variant of EntryMut that will persist the history of the entry when dropped.
- Group
- A database group with child groups and entries
- GroupId
- Unique identifier for a Group
- Group
Mut - Mutable reference to a Group. Implements DerefMut to &mut Group
- Group
Ref - Immutable reference to a Group. Implements Deref to &Group.
- Group
Track - A variant of GroupMut that tracks changes to the group, such as deletions and moves, and updates the location changed time when the group is moved.
- History
- An entry’s history
- Memory
Protection - Database memory protection settings
- Meta
- Database metadata
- Parse
Color Error - Error parsing a color code
- Times
- Timestamps for a Group or Entry
Enums§
- Custom
Data Value - Value of a CustomDataItem
- Data
Transfer Obfuscation - Obfuscation methods for auto-type data transfer.
- Database
Format Error - Format-specific database parsing errors
- Database
Open Error - Errors that can occur when opening a database
- Icon
- Icon specification for an Entry or Group.
- Move
Group Error - Errors that can occur when moving a group to a new parent.
- Value
- Value in an Entry’s fields or an Attachment’s data