diff --git a/Sources/WebAuthn/Helpers/ChallengeGenerator.swift b/Sources/WebAuthn/Helpers/ChallengeGenerator.swift index ecbaa69..f46b3e2 100644 --- a/Sources/WebAuthn/Helpers/ChallengeGenerator.swift +++ b/Sources/WebAuthn/Helpers/ChallengeGenerator.swift @@ -11,10 +11,14 @@ // //===----------------------------------------------------------------------===// -package struct ChallengeGenerator: Sendable { - var generate: @Sendable () -> [UInt8] +public struct ChallengeGenerator: Sendable { + public var generate: @Sendable () -> [UInt8] - package static var live: Self { + public init(generate: @Sendable @escaping () -> [UInt8]) { + self.generate = generate + } + + public static var live: Self { .init(generate: { [UInt8].random(count: 32) }) } } diff --git a/Sources/WebAuthn/WebAuthnManager.swift b/Sources/WebAuthn/WebAuthnManager.swift index 299089b..0cc5ad5 100644 --- a/Sources/WebAuthn/WebAuthnManager.swift +++ b/Sources/WebAuthn/WebAuthnManager.swift @@ -35,11 +35,8 @@ public struct WebAuthnManager: Sendable { /// /// - Parameters: /// - configuration: The configuration to use for this manager. - public init(configuration: Configuration) { - self.init(configuration: configuration, challengeGenerator: .live) - } - - package init(configuration: Configuration, challengeGenerator: ChallengeGenerator) { + /// - challengeGenerator: The generator of challenge. + public init(configuration: Configuration, challengeGenerator: ChallengeGenerator = .live) { self.configuration = configuration self.challengeGenerator = challengeGenerator }