diff --git a/Sources/WebAuthn/Helpers/ChallengeGenerator.swift b/Sources/WebAuthn/Helpers/ChallengeGenerator.swift index ecbaa69..61aa13e 100644 --- a/Sources/WebAuthn/Helpers/ChallengeGenerator.swift +++ b/Sources/WebAuthn/Helpers/ChallengeGenerator.swift @@ -11,10 +11,12 @@ // //===----------------------------------------------------------------------===// -package struct ChallengeGenerator: Sendable { +public struct ChallengeGenerator: Sendable { + public static let challengeSize: Int = 32 + var generate: @Sendable () -> [UInt8] package static var live: Self { - .init(generate: { [UInt8].random(count: 32) }) + .init(generate: { [UInt8].random(count: challengeSize) }) } } diff --git a/Sources/WebAuthn/Helpers/Duration+Milliseconds.swift b/Sources/WebAuthn/Helpers/Duration+Milliseconds.swift index 4a3c3b9..372ecb4 100644 --- a/Sources/WebAuthn/Helpers/Duration+Milliseconds.swift +++ b/Sources/WebAuthn/Helpers/Duration+Milliseconds.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -extension Duration { +public extension Duration { /// The value of a positive duration in milliseconds, suitable to be encoded in WebAuthn types. var milliseconds: Int64 { let (seconds, attoseconds) = self.components diff --git a/Sources/WebAuthn/Helpers/KeyedDecodingContainer+decodeURLEncoded.swift b/Sources/WebAuthn/Helpers/KeyedDecodingContainer+decodeURLEncoded.swift index e6af1b5..3a93451 100644 --- a/Sources/WebAuthn/Helpers/KeyedDecodingContainer+decodeURLEncoded.swift +++ b/Sources/WebAuthn/Helpers/KeyedDecodingContainer+decodeURLEncoded.swift @@ -14,7 +14,7 @@ import Foundation extension KeyedDecodingContainer { - func decodeBytesFromURLEncodedBase64(forKey key: KeyedDecodingContainer.Key) throws -> [UInt8] { + public func decodeBytesFromURLEncodedBase64(forKey key: KeyedDecodingContainer.Key) throws -> [UInt8] { guard let bytes = try decode( URLEncodedBase64.self, forKey: key @@ -28,7 +28,7 @@ extension KeyedDecodingContainer { return bytes } - func decodeBytesFromURLEncodedBase64IfPresent(forKey key: KeyedDecodingContainer.Key) throws -> [UInt8]? { + public func decodeBytesFromURLEncodedBase64IfPresent(forKey key: KeyedDecodingContainer.Key) throws -> [UInt8]? { guard let bytes = try decodeIfPresent( URLEncodedBase64.self, forKey: key