Skip to content

Commit 996e101

Browse files
authored
Merge pull request #64 from swift-server/sendable
Add Sendable Annotations
2 parents 331374f + 49c1315 commit 996e101

23 files changed

+44
-39
lines changed

Package.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,15 @@ let package = Package(
3737
.product(name: "Crypto", package: "swift-crypto"),
3838
.product(name: "_CryptoExtras", package: "swift-crypto"),
3939
.product(name: "Logging", package: "swift-log"),
40-
]
40+
],
41+
swiftSettings: [.enableExperimentalFeature("StrictConcurrency=complete")]
4142
),
42-
.testTarget(name: "WebAuthnTests", dependencies: [
43-
.target(name: "WebAuthn")
44-
])
43+
.testTarget(
44+
name: "WebAuthnTests",
45+
dependencies: [
46+
.target(name: "WebAuthn")
47+
],
48+
swiftSettings: [.enableExperimentalFeature("StrictConcurrency=complete")]
49+
)
4550
]
4651
)

Sources/WebAuthn/Ceremonies/Authentication/AuthenticationCredential.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Foundation
1717
/// The unprocessed response received from `navigator.credentials.get()`.
1818
///
1919
/// When decoding using `Decodable`, the `rawID` is decoded from base64url to bytes.
20-
public struct AuthenticationCredential {
20+
public struct AuthenticationCredential: Sendable {
2121
/// The credential ID of the newly created credential.
2222
public let id: URLEncodedBase64
2323

Sources/WebAuthn/Ceremonies/Authentication/AuthenticatorAssertionResponse.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Crypto
1818
/// This is what the authenticator device returned after we requested it to authenticate a user.
1919
///
2020
/// When decoding using `Decodable`, byte arrays are decoded from base64url to bytes.
21-
public struct AuthenticatorAssertionResponse {
21+
public struct AuthenticatorAssertionResponse: Sendable {
2222
/// Representation of what we passed to `navigator.credentials.get()`
2323
///
2424
/// When decoding using `Decodable`, this is decoded from base64url to bytes.
@@ -69,7 +69,7 @@ extension AuthenticatorAssertionResponse: Decodable {
6969
}
7070
}
7171

72-
struct ParsedAuthenticatorAssertionResponse {
72+
struct ParsedAuthenticatorAssertionResponse: Sendable {
7373
let rawClientData: [UInt8]
7474
let clientData: CollectedClientData
7575
let rawAuthenticatorData: [UInt8]

Sources/WebAuthn/Ceremonies/Authentication/PublicKeyCredentialRequestOptions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Foundation
1919
/// When encoding using `Encodable`, the byte arrays are encoded as base64url.
2020
///
2121
/// - SeeAlso: https://www.w3.org/TR/webauthn-2/#dictionary-assertion-options
22-
public struct PublicKeyCredentialRequestOptions: Encodable {
22+
public struct PublicKeyCredentialRequestOptions: Encodable, Sendable {
2323
/// A challenge that the authenticator signs, along with other data, when producing an authentication assertion
2424
///
2525
/// When encoding using `Encodable` this is encoded as base64url.
@@ -68,10 +68,10 @@ public struct PublicKeyCredentialRequestOptions: Encodable {
6868
/// Information about a generated credential.
6969
///
7070
/// When encoding using `Encodable`, `id` is encoded as base64url.
71-
public struct PublicKeyCredentialDescriptor: Equatable, Encodable {
71+
public struct PublicKeyCredentialDescriptor: Equatable, Encodable, Sendable {
7272
/// Defines hints as to how clients might communicate with a particular authenticator in order to obtain an
7373
/// assertion for a specific credential
74-
public enum AuthenticatorTransport: String, Equatable, Encodable {
74+
public enum AuthenticatorTransport: String, Equatable, Encodable, Sendable {
7575
/// Indicates the respective authenticator can be contacted over removable USB.
7676
case usb
7777
/// Indicates the respective authenticator can be contacted over Near Field Communication (NFC).
@@ -125,7 +125,7 @@ public struct PublicKeyCredentialDescriptor: Equatable, Encodable {
125125

126126
/// The Relying Party may require user verification for some of its operations but not for others, and may use this
127127
/// type to express its needs.
128-
public enum UserVerificationRequirement: String, Encodable {
128+
public enum UserVerificationRequirement: String, Encodable, Sendable {
129129
/// The Relying Party requires user verification for the operation and will fail the overall ceremony if the
130130
/// user wasn't verified.
131131
case required

Sources/WebAuthn/Ceremonies/Authentication/VerifiedAuthentication.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
import Foundation
1616

1717
/// On successful authentication, this structure contains a summary of the authentication flow
18-
public struct VerifiedAuthentication {
19-
public enum CredentialDeviceType: String {
18+
public struct VerifiedAuthentication: Sendable {
19+
public enum CredentialDeviceType: String, Sendable {
2020
case singleDevice = "single_device"
2121
case multiDevice = "multi_device"
2222
}

Sources/WebAuthn/Ceremonies/Registration/PublicKeyCredentialCreationOptions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public struct PublicKeyCredentialRelyingPartyEntity: Encodable {
119119
/// creating a new credential.
120120
///
121121
/// When encoding using `Encodable`, `id` is base64url encoded.
122-
public struct PublicKeyCredentialUserEntity: Encodable {
122+
public struct PublicKeyCredentialUserEntity: Encodable, Sendable {
123123
/// Generated by the Relying Party, unique to the user account, and must not contain personally identifying
124124
/// information about the user.
125125
///

Sources/WebAuthn/Ceremonies/Shared/AuthenticatorAttachment.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/// - SeeAlso: [WebAuthn Level 3 Editor's Draft §5.4.5. Authenticator Attachment Enumeration (enum AuthenticatorAttachment)](https://w3c.github.io/webauthn/#enum-attachment)
1919
/// - SeeAlso: [WebAuthn Level 3 Editor's Draft §6.2.1. Authenticator Attachment Modality](https://w3c.github.io/webauthn/#sctn-authenticator-attachment-modality)
2020
///
21-
public struct AuthenticatorAttachment: UnreferencedStringEnumeration {
21+
public struct AuthenticatorAttachment: UnreferencedStringEnumeration, Sendable {
2222
public var rawValue: String
2323
public init(_ rawValue: String) {
2424
self.rawValue = rawValue

Sources/WebAuthn/Ceremonies/Shared/AuthenticatorData.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import SwiftCBOR
1818

1919
/// Data created and/ or used by the authenticator during authentication/ registration.
2020
/// The data contains, for example, whether a user was present or verified.
21-
struct AuthenticatorData: Equatable {
21+
struct AuthenticatorData: Equatable, Sendable {
2222
let relyingPartyIDHash: [UInt8]
2323
let flags: AuthenticatorFlags
2424
let counter: UInt32

Sources/WebAuthn/Ceremonies/Shared/AuthenticatorFlags.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
struct AuthenticatorFlags: Equatable {
15+
struct AuthenticatorFlags: Equatable, Sendable {
1616

1717
/**
1818
Taken from https://w3c.github.io/webauthn/#sctn-authenticator-data

Sources/WebAuthn/Ceremonies/Shared/COSE/COSEAlgorithmIdentifier.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Crypto
1818
/// COSEAlgorithmIdentifier From §5.10.5. A number identifying a cryptographic algorithm. The algorithm
1919
/// identifiers SHOULD be values registered in the IANA COSE Algorithms registry
2020
/// [https://www.w3.org/TR/webauthn/#biblio-iana-cose-algs-reg], for instance, -7 for "ES256" and -257 for "RS256".
21-
public enum COSEAlgorithmIdentifier: Int, RawRepresentable, CaseIterable, Encodable {
21+
public enum COSEAlgorithmIdentifier: Int, RawRepresentable, CaseIterable, Encodable, Sendable {
2222
/// AlgES256 ECDSA with SHA-256
2323
case algES256 = -7
2424
/// AlgES384 ECDSA with SHA-384

0 commit comments

Comments
 (0)