Skip to main content

keepass_ng/db/types/
autotype.rs

1/// An `AutoType` setting associated with an [Entry][crate::db::Entry]
2#[derive(Debug, Default, Eq, PartialEq, Clone)]
3#[cfg_attr(feature = "serialization", derive(serde::Serialize))]
4pub struct AutoType {
5    /// Whether AutoType is enabled for this entry
6    pub enabled: bool,
7
8    /// Default AutoType sequence. This is used if no window associations match.
9    pub default_sequence: Option<String>,
10
11    /// Whether an implementation MAY try to obfuscate Auto-Type key strokes to make it harder
12    /// for key loggers to record the full sequence.
13    pub data_transfer_obfuscation: DataTransferObfuscation,
14
15    /// Window associations for this entry. The first association whose window matches the active
16    /// window will be used.
17    pub associations: Vec<AutoTypeAssociation>,
18}
19
20/// A window association associated with an [AutoType] setting
21#[derive(Debug, Default, Eq, PartialEq, Clone)]
22#[cfg_attr(feature = "serialization", derive(serde::Serialize))]
23pub struct AutoTypeAssociation {
24    /// The title of the window to match with this entry. The string MUST support * as a wildcard character.
25    pub window: Option<String>,
26
27    /// A custom Auto-Type sequence. If the value is left empty, the sequence from <DefaultSequence> is
28    /// used or, if that is empty as well, the group or global default.
29    pub sequence: Option<String>,
30}
31
32/// Obfuscation methods for auto-type data transfer.
33#[derive(Debug, Eq, PartialEq, Clone, Default)]
34#[cfg_attr(feature = "serialization", derive(serde::Serialize))]
35pub enum DataTransferObfuscation {
36    /// No obfuscation. The auto-type sequence is sent as-is.
37    #[default]
38    None,
39
40    /// Obfuscate auto-type sequence using the clipboard
41    UseClipboard,
42}