Show TOTP codes in password details (#75)
This commit is contained in:
@@ -7,9 +7,9 @@ use sha2::{Digest as _, Sha256};
|
||||
use crate::{
|
||||
command::EditRequest,
|
||||
crypto::{KeyStore, SecretProvider},
|
||||
otp::{OtpAlgorithm, OtpKind, OtpUri},
|
||||
otp::{OtpAlgorithm, OtpError, OtpKind, OtpUri},
|
||||
recipient::SigningPolicy,
|
||||
repository::{EntryPath, Repository, SecretBytes},
|
||||
repository::{EncryptedEntry, EntryPath, Repository, SecretBytes},
|
||||
write::{EditSession, EntryCommitter, VaultWriter, WriteError, WriteOutcome},
|
||||
};
|
||||
|
||||
@@ -424,6 +424,15 @@ impl EntryDocument {
|
||||
SecretBytes::new(output)
|
||||
}
|
||||
|
||||
pub(crate) fn original_ciphertext(&self) -> Option<&EncryptedEntry> {
|
||||
self.session.original_ciphertext()
|
||||
}
|
||||
|
||||
pub(crate) fn otp_uri(&self) -> Result<Option<OtpUri>, OtpError> {
|
||||
let plaintext = self.serialize();
|
||||
crate::otp::find_uri(&plaintext, &self.path).map(|found| found.map(|(_, uri)| uri))
|
||||
}
|
||||
|
||||
fn has_final_newline(&self) -> bool {
|
||||
self.fields
|
||||
.last()
|
||||
|
||||
Reference in New Issue
Block a user