Support Steam OTP (#505)
This commit is contained in:
parent
06d2ef1d09
commit
f2ab400f4b
8 changed files with 85 additions and 34 deletions
|
|
@ -171,6 +171,27 @@ class TokenBuilderTest: XCTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
func testRepresentation() {
|
||||
[
|
||||
(nil, .numeric),
|
||||
("steamguard", .steamguard),
|
||||
("numeric", .numeric),
|
||||
("wrong representation", .numeric),
|
||||
].forEach { (inputRepresentation: String?, represenetation: OneTimePassword.Generator.Representation) in
|
||||
var builder = TokenBuilder()
|
||||
.usingSecret(SECRET)
|
||||
.usingType("totp")
|
||||
.usingRepresentation(inputRepresentation)
|
||||
if represenetation == .steamguard {
|
||||
builder = builder
|
||||
.usingDigits("5")
|
||||
.usingAlgorithm("sha1")
|
||||
}
|
||||
let token = builder.build()
|
||||
XCTAssertEqual(token?.generator.representation, represenetation)
|
||||
}
|
||||
}
|
||||
|
||||
func testUnparsableCounter() {
|
||||
let token = TokenBuilder()
|
||||
.usingSecret(SECRET)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue