aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/utils/TotpFinder.kt
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-06-29 12:08:59 +0530
committerGitHub <noreply@github.com>2020-06-29 12:08:59 +0530
commit063c1a1144bb50845ecfb7d56eea16e4db4540e4 (patch)
treeeb237a470953264a54f2854f0e534bb2ab682927 /app/src/main/java/com/zeapo/pwdstore/utils/TotpFinder.kt
parent56c301dc7c5353d7f7021e04441104cfe42c063f (diff)
downloadHardenedPass-063c1a1144bb50845ecfb7d56eea16e4db4540e4.tar.gz
HardenedPass-063c1a1144bb50845ecfb7d56eea16e4db4540e4.zip
Reintroduce TOTP support (#890)
Co-authored-by: Fabian Henneke <fabian@henneke.me>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/utils/TotpFinder.kt')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/TotpFinder.kt32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/TotpFinder.kt b/app/src/main/java/com/zeapo/pwdstore/utils/TotpFinder.kt
new file mode 100644
index 00000000..13a47543
--- /dev/null
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/TotpFinder.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+package com.zeapo.pwdstore.utils
+
+/**
+ * Defines a class that can extract relevant parts of a TOTP URL for use by the app.
+ */
+interface TotpFinder {
+
+ /**
+ * Get the TOTP secret from the given extra content.
+ */
+ fun findSecret(content: String): String?
+
+ /**
+ * Get the number of digits required in the final OTP.
+ */
+ fun findDigits(content: String): String
+
+ /**
+ * Get the TOTP timeout period.
+ */
+ fun findPeriod(content: String): Long
+
+ /**
+ * Get the algorithm for the TOTP secret.
+ */
+ fun findAlgorithm(content: String): String
+}