aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/dev/msfjarvis/aps/util/totp/TotpFinder.kt
blob: 8144095da6b0c38d0a3f507b41c81527c8db044b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
 * SPDX-License-Identifier: GPL-3.0-only
 */

package dev.msfjarvis.aps.util.totp

/**
 * 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
}