Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// The unprocessed response received from `navigator.credentials.get()`.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Crypto

/// This is what the authenticator device returned after we requested it to authenticate a user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// The `PublicKeyCredentialRequestOptions` gets passed to the WebAuthn API (`navigator.credentials.get()`)
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// On successful authentication, this structure contains a summary of the authentication flow
public struct VerifiedAuthentication: Sendable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Crypto
@preconcurrency import SwiftCBOR

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import SwiftCBOR

/// The response from the authenticator device for the creation of a new public key credential.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// A dictionary describing the Relying Party's requirements regarding authenticator attributes.
///
Expand Down Expand Up @@ -75,4 +79,3 @@ extension AuthenticatorSelection: Codable {
case requireResidentKey
}
}

4 changes: 4 additions & 0 deletions Sources/WebAuthn/Ceremonies/Registration/Credential.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// After a successful registration ceremony we pass this data back to the relying party. It contains all needed
/// information about a WebAuthn credential for storage in e.g. a database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// The `PublicKeyCredentialCreationOptions` gets passed to the WebAuthn API (`navigator.credentials.create()`)
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Crypto

/// The unprocessed response received from `navigator.credentials.create()`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// The Relying Party's requirements regarding whether the authenticator should create a client-side-resident public key credential source.
///
Expand All @@ -37,4 +41,3 @@ public struct ResidentKeyRequirement: UnreferencedStringEnumeration, Sendable {
/// - SeeAlso: [WebAuthn Level 3 Working Draft §5.4.6. Resident Key Requirement Enumeration](https://www.w3.org/TR/webauthn-3/#dom-residentkeyrequirement-discouraged)
public static let discouraged: Self = "discouraged"
}

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// A globally unique ID identifying an authenticator.
///
Expand Down
4 changes: 4 additions & 0 deletions Sources/WebAuthn/Ceremonies/Shared/AuthenticatorData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Crypto
import SwiftCBOR

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Crypto

/// COSEAlgorithmIdentifier From §5.10.5. A number identifying a cryptographic algorithm. The algorithm
Expand Down
4 changes: 4 additions & 0 deletions Sources/WebAuthn/Ceremonies/Shared/COSE/COSEKeyType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// The Key Type derived from the IANA COSE AuthData
enum COSEKeyType: UInt64, RawRepresentable, Sendable {
Expand Down
4 changes: 4 additions & 0 deletions Sources/WebAuthn/Ceremonies/Shared/CollectedClientData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// A parsed version of the `clientDataJSON` received from the authenticator. The `clientDataJSON` is a
/// representation of the options we passed to the WebAuthn API (`.get()`/ `.create()`).
Expand Down
4 changes: 4 additions & 0 deletions Sources/WebAuthn/Ceremonies/Shared/CredentialPublicKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@

import Crypto
import _CryptoExtras
#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import SwiftCBOR

protocol PublicKey: Sendable {
Expand Down
4 changes: 4 additions & 0 deletions Sources/WebAuthn/Helpers/Base64Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Logging

/// Container for base64 encoded data
Expand Down
4 changes: 4 additions & 0 deletions Sources/WebAuthn/Helpers/ByteCasting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension BidirectionalCollection where Element == UInt8 {
/// Cast a byte sequence into a trivial type like a primitive or a tuple of primitives.
Expand Down
4 changes: 4 additions & 0 deletions Sources/WebAuthn/Helpers/Data+safeSubscript.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension Data {
struct IndexOutOfBounds: Error {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension KeyedDecodingContainer {
func decodeBytesFromURLEncodedBase64(forKey key: KeyedDecodingContainer.Key) throws -> [UInt8] {
Expand Down
4 changes: 4 additions & 0 deletions Sources/WebAuthn/WebAuthnManager+Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension WebAuthnManager {
/// Configuration represents the WebAuthn configuration.
Expand Down
4 changes: 4 additions & 0 deletions Sources/WebAuthn/WebAuthnManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// Main entrypoint for WebAuthn operations.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Testing
@testable import WebAuthn

Expand Down
5 changes: 4 additions & 1 deletion Tests/WebAuthnTests/AuthenticatorSelectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Testing
@testable import WebAuthn

Expand Down Expand Up @@ -457,4 +461,3 @@ struct AuthenticatorSelectionTests {
#expect(options.user.id == user.id)
}
}

4 changes: 4 additions & 0 deletions Tests/WebAuthnTests/HelpersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Testing
@testable import WebAuthn

Expand Down
4 changes: 4 additions & 0 deletions Tests/WebAuthnTests/Utils/Hexadecimal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension String {
/// Create `[UInt8]` from hexadecimal string representation
Expand Down
4 changes: 4 additions & 0 deletions Tests/WebAuthnTests/Utils/TestModels/TestAuthData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Crypto
import WebAuthn

Expand Down
4 changes: 4 additions & 0 deletions Tests/WebAuthnTests/Utils/TestModels/TestClientDataJSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import WebAuthn

struct TestClientDataJSON: Encodable {
Expand Down
4 changes: 4 additions & 0 deletions Tests/WebAuthnTests/Utils/TestModels/TestECCKeyPair.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Crypto
import WebAuthn

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

protocol TestSigner: Sendable {
static func sign(data: Data) throws -> [UInt8]
Expand Down
4 changes: 4 additions & 0 deletions Tests/WebAuthnTests/Utils/TestModels/TestRSAKeyPair.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//
//===----------------------------------------------------------------------===//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Crypto
import WebAuthn
import _CryptoExtras
Expand Down
Loading