generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
VerificationCodeItem.kt
35 lines (34 loc) · 1.11 KB
/
VerificationCodeItem.kt
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
33
34
35
package com.bitwarden.authenticator.data.authenticator.manager.model
/**
* Models the items returned by the TotpCodeManager.
*
* @property code The verification code for the item.
* @property totpCode The totp code for the item.
* @property periodSeconds The time span where the code is valid in seconds.
* @property timeLeftSeconds The seconds remaining until a new code is required.
* @property issueTime The time the verification code was issued.
* @property id The cipher id of the item.
* @property username The username associated with the item.
*/
data class VerificationCodeItem(
val code: String,
val totpCode: String,
val periodSeconds: Int,
val timeLeftSeconds: Int,
val issueTime: Long,
val id: String,
val username: String?,
val issuer: String?,
) {
/**
* The composite label of the authenticator item. Used for constructing an OTPAuth URI.
* ```
* label = issuer (“:” / “%3A”) *”%20” username
* ```
*/
val label = if (issuer != null) {
issuer + username?.let { ":$it" }.orEmpty()
} else {
username.orEmpty()
}
}