summaryrefslogtreecommitdiff
path: root/format-common/src
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-10-29 05:34:09 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2022-10-29 05:34:09 +0530
commit505c2fa705fca1aaec7aae80c50a939bfd607716 (patch)
tree9877b7f00125ff8f5bf72cd649231c706ffd4ac4 /format-common/src
parente8d9a7753917476ac578f9fb14d365c83699c89a (diff)
refactor(format-common): add a getter to `PasswordEntry` for current OTP value
Diffstat (limited to 'format-common/src')
-rw-r--r--format-common/src/main/kotlin/app/passwordstore/data/passfile/PasswordEntry.kt4
1 files changed, 4 insertions, 0 deletions
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.