Skip to content

Commit

Permalink
Changed totp name to potp in WMTTOTPUtils class (#130)
Browse files Browse the repository at this point in the history
* Fix `totp` name to `potp`

* Fix tests
  • Loading branch information
Hopsaheysa authored Nov 28, 2023
1 parent a199f86 commit df03d45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion WultraMobileTokenSDK/Operations/Utils/WMTTOTPUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public struct WMTOperationTOTPData: Codable {
public let operationId: String

public enum Keys: String, CodingKey {
case totp = "totp"
case totp = "potp"
case operationId = "oid"
}

Expand Down
12 changes: 6 additions & 6 deletions WultraMobileTokenSDKTests/TOTPParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ final class TOTPParserTest: XCTestCase {
}

func testQRTOTPParserWithValidCode() {
let code = "eyJhbGciOiJub25lIiwidHlwZSI6IkpXVCJ9.eyJvaWQiOiI2YTFjYjAwNy1mZjc1LTRmNDAtYTIxYi0wYjU0NmYwZjZjYWQiLCJ0b3RwIjoiNzM3NDMxOTQifQ=="
let code = "eyJhbGciOiJub25lIiwidHlwZSI6IkpXVCJ9.eyJvaWQiOiI5OWZjZjc5Mi1mMjhiLTRhZGEtYmVlNy1mYjY4ZDE5ZTA1OGYiLCJwb3RwIjoiNjI2NTY0MTMifQ=="

XCTAssertEqual(WMTTOTPUtils.parseQRCode(code: code)?.totp, "73743194", "Parsing of totp failed")
XCTAssertEqual(WMTTOTPUtils.parseQRCode(code: code)?.operationId, "6a1cb007-ff75-4f40-a21b-0b546f0f6cad", "Parsing of operationId failed")
XCTAssertEqual(WMTTOTPUtils.parseQRCode(code: code)?.totp, "62656413", "Parsing of totp failed")
XCTAssertEqual(WMTTOTPUtils.parseQRCode(code: code)?.operationId, "99fcf792-f28b-4ada-bee7-fb68d19e058f", "Parsing of operationId failed")
}


Expand All @@ -51,9 +51,9 @@ final class TOTPParserTest: XCTestCase {
}

func testDeeplinkTOTPParserWithValidJWTCode() {
let url = URL(string: "mtoken://login?code=eyJhbGciOiJub25lIiwidHlwZSI6IkpXVCJ9.eyJvaWQiOiJkZjYxMjhmYy1jYTUxLTQ0YjctYmVmYS1jYTBlMTQwOGFhNjMiLCJ0b3RwIjoiNTY3MjU0OTQifQ==")!
let url = URL(string: "mtoken://login?code=eyJhbGciOiJub25lIiwidHlwZSI6IkpXVCJ9.eyJvaWQiOiI5OWZjZjc5Mi1mMjhiLTRhZGEtYmVlNy1mYjY4ZDE5ZTA1OGYiLCJwb3RwIjoiNjI2NTY0MTMifQ==")!

XCTAssertEqual(WMTTOTPUtils.parseDeeplink(url: url)?.totp, "56725494", "Parsing of totp failed")
XCTAssertEqual(WMTTOTPUtils.parseDeeplink(url: url)?.operationId, "df6128fc-ca51-44b7-befa-ca0e1408aa63", "Parsing of operationId failed")
XCTAssertEqual(WMTTOTPUtils.parseDeeplink(url: url)?.totp, "62656413", "Parsing of totp failed")
XCTAssertEqual(WMTTOTPUtils.parseDeeplink(url: url)?.operationId, "99fcf792-f28b-4ada-bee7-fb68d19e058f", "Parsing of operationId failed")
}
}

0 comments on commit df03d45

Please sign in to comment.