pub enum ExportFormat {
Vault,
EncryptedVault,
Text,
Json,
EncryptedJson,
Html,
}Expand description
An export format this library writes.
The six are the interface’s numbered choices, in the order the interface offers them: the two
.q2fa containers first, then the four shapes another authenticator reads. Which one a
caller offers is a user interface question; the differences that matter to the library are
ExportFormat::needs_password and ExportFormat::group_carrying.
Variants§
Vault
A plain .q2fa: the master key in clear plus the whole vault ciphertext.
This is the format that restores an account on a clean device. Whoever holds the file holds the master key, which is why the interface warns about it more strongly than about the encrypted form.
EncryptedVault
A passphrase-protected .q2fa: the master key wrapped by crate::recovery plus the
whole vault ciphertext.
Text
The text export: one otpauth:// URI per line.
Json
The JSON export, readable as it stands.
EncryptedJson
The JSON export, encrypted with a password the caller supplies.
Html
The HTML export: a table with one row per entry and the code drawn beside it.
Implementations§
Source§impl ExportFormat
impl ExportFormat
Sourcepub const fn extension(self) -> &'static str
pub const fn extension(self) -> &'static str
The file name extension this format is normally written with.
Both JSON forms share one: they are the same file with and without a password, and a
reader tells them apart by the db field being a string rather than an object. Both
.q2fa forms share one for the same reason: they are told apart by their magic.
Sourcepub const fn needs_password(self) -> bool
pub const fn needs_password(self) -> bool
Whether this format is written with a password.
A caller uses it to decide whether to ask for one before calling export, rather
than calling and handling Error::ExportPasswordRequired.
Sourcepub const fn group_carrying(self) -> GroupCarrying
pub const fn group_carrying(self) -> GroupCarrying
How much of the group tree this format carries.
Sourcepub const fn carries_groups(self) -> bool
pub const fn carries_groups(self) -> bool
Whether this format carries the groups at all.