OtpQRScanResult
public final class OtpQRScanResult : QRScanResultProtocol
The OtpQRScanResult
handles one-time password data scanned from a QR code.
-
Initializes a new
OtpQRScanResult
.Declaration
Swift
public init(type: String, issuer: String?, secret: String, username: String?, algorithm: HmacAlgorithm = HmacAlgorithm.sha1, digits: Int = 6, counter: Int?, period: Int?)
-
Initializes a new
OtpQRScanResult
from aDictionary
.Declaration
Swift
public init?(_ data:[String:Any])
-
The type of the QR scanned. Value must be either HOTP or TOTP.
Declaration
Swift
public fileprivate(set) var type: String
-
The name of the issuer providing the service.
Declaration
Swift
public fileprivate(set) var issuer: String?
-
The secret value encoded in Base32.
Declaration
Swift
public fileprivate(set) var secret: String
-
The username associated with the service.
Declaration
Swift
public fileprivate(set) var username: String?
-
The algorithm used to calculate the one-time password. The default is
HmacAlgorithm.SHA1
.Declaration
Swift
public fileprivate(set) var algorithm: HmacAlgorithm = HmacAlgorithm.sha1
-
The length of the one-time password to be displayed. The default is 6.
Declaration
Swift
public fileprivate(set) var digits: Int = 6
-
The counter is required for use with HOTP. It will set the initial counter value.
Declaration
Swift
public fileprivate(set) var counter: Int = 1
-
The period a TOTP code will be valid for, in seconds. The default value is 30.
Declaration
Swift
public fileprivate(set) var period: Int = 30
-
Parses the incoming data from the QR code.
Remark
Google’s spec: https://github.com/google/google-authenticator/wiki/Key-Uri-FormatDeclaration
Swift
public static func parse(_ value: String?) -> OtpQRScanResult?