-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow custom data addon on challenge while keeping random generation …
…internal
- Loading branch information
Showing
6 changed files
with
78 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift WebAuthn open source project | ||
// | ||
// Copyright (c) 2022 the Swift WebAuthn project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
@testable import WebAuthn | ||
import XCTest | ||
import Crypto | ||
|
||
final class WebAuthnManagerChallengeTests: XCTestCase { | ||
var webAuthnManager: WebAuthnManager! | ||
|
||
let relyingPartyID = "example.com" | ||
let relyingPartyName = "Testy test" | ||
let relyingPartyOrigin = "https://example.com" | ||
|
||
override func setUp() { | ||
let configuration = WebAuthnManager.Configuration( | ||
relyingPartyID: relyingPartyID, | ||
relyingPartyName: relyingPartyName, | ||
relyingPartyOrigin: relyingPartyOrigin | ||
) | ||
webAuthnManager = .init(configuration: configuration) | ||
} | ||
|
||
func testChallengeData() async throws { | ||
let challengeGenerator = ChallengeGenerator.live | ||
let challengeData : [UInt8] = [12,15,48,64] | ||
|
||
let challenge = challengeGenerator.generate(challengeData) | ||
let extractedData = webAuthnManager.extractChallengeData(challenge: challenge) | ||
|
||
XCTAssertEqual(challengeData, extractedData) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters