From 505c2fa705fca1aaec7aae80c50a939bfd607716 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 29 Oct 2022 05:34:09 +0530 Subject: refactor(format-common): add a getter to `PasswordEntry` for current OTP value --- .../src/main/kotlin/app/passwordstore/data/passfile/PasswordEntry.kt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'format-common/src/main/kotlin') diff --git a/format-common/src/main/kotlin/app/passwordstore/data/passfile/PasswordEntry.kt b/format-common/src/main/kotlin/app/passwordstore/data/passfile/PasswordEntry.kt index d48c2ca3..cda8138e 100644 --- a/format-common/src/main/kotlin/app/passwordstore/data/passfile/PasswordEntry.kt +++ b/format-common/src/main/kotlin/app/passwordstore/data/passfile/PasswordEntry.kt @@ -70,6 +70,10 @@ constructor( } } + /** Obtain the [Totp.value] for this [PasswordEntry] at the current time. */ + public val currentOtp: String + get() = calculateTotp().value + /** * String representation of [extraContent] but with authentication related data such as TOTP URIs * and usernames stripped. -- cgit v1.2.3