Skip to content

Commit

Permalink
Merge pull request #10 from fizker/sendable
Browse files Browse the repository at this point in the history
Added Sendable to public structs and enums
  • Loading branch information
m-barthelemy authored May 21, 2024
2 parents bc58b1e + dfd46fc commit 97d3e85
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Sources/AcmeSwift/APIs/AcmeSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public class AcmeSwift {
}
}

public enum AcmeEndpoint {
public enum AcmeEndpoint: Sendable {
/// The default, production Let's Encrypt endpoint
case letsEncrypt
/// The staging Let's Encrypt endpoint, for tests. Issues certificate not recognized by clients/browsers
Expand Down
6 changes: 3 additions & 3 deletions Sources/AcmeSwift/Helpers/AcmeRequestBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ struct AcmeRequestBody<T: EndpointProtocol>: Encodable {
}
}

public struct JWK: Codable {
public struct JWK: Codable, Sendable {
/// Key Type
private(set) public var kty: KeyType = .ec

Expand All @@ -135,13 +135,13 @@ public struct JWK: Codable {
/// The y coordinate for the Elliptic Curve point.
private(set) public var y: String

public enum KeyType: String, Codable {
public enum KeyType: String, Codable, Sendable {
case ec = "EC"
case rsa = "RSA"
case oct
}

public enum CurveType: String, Codable {
public enum CurveType: String, Codable, Sendable {
case p256 = "P-256"
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/AcmeSwift/Helpers/HttpClient+Decode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Logging

extension HTTPClientResponse {

public enum BodyError : Swift.Error {
public enum BodyError : Swift.Error, Sendable {
case noBodyData
}

Expand Down
6 changes: 3 additions & 3 deletions Sources/AcmeSwift/Models/Account/AcmeAccountInfo.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Foundation

/// Account information returned when calling `get()` or `create()`
public struct AcmeAccountInfo: Codable {
public struct AcmeAccountInfo: Codable, Sendable {

/// URL containing the ID of the Account
/// This URL is used to performa some account management operations.
internal(set) public var url: URL?
Expand All @@ -29,7 +29,7 @@ public struct AcmeAccountInfo: Codable {
/// No provider seems to have this fully implemented
public let orders: URL?

public enum Status: String, Codable {
public enum Status: String, Codable, Sendable {
case valid, deactivated, revoked
}
}
4 changes: 2 additions & 2 deletions Sources/AcmeSwift/Models/AcmeDirectory.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

/// The Directory endpoint of the ACMEv2 service, providing discovery information about various endpoints
public struct AcmeDirectory: Codable {
public struct AcmeDirectory: Codable, Sendable {
public let newAuthz: URL?
public let newNonce: URL

Expand All @@ -12,7 +12,7 @@ public struct AcmeDirectory: Codable {
public let keyChange: URL
public let meta: Meta

public struct Meta: Codable {
public struct Meta: Codable, Sendable {
public let termsOfService: URL?

/// The web page of the ACME provider.
Expand Down
8 changes: 4 additions & 4 deletions Sources/AcmeSwift/Models/AcmeError.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public enum AcmeError: Error {
public enum AcmeError: Error, Sendable {
// This Account information has no private key
case invalidAccountInfo

Expand Down Expand Up @@ -30,7 +30,7 @@ public enum AcmeError: Error {
case noDomains(String)
}

public struct AcmeResponseError: Codable, Error {
public struct AcmeResponseError: Codable, Error, Sendable {
public let type: AcmeErrorType

public let title: String?
Expand All @@ -43,7 +43,7 @@ public struct AcmeResponseError: Codable, Error {

public let subproblems: [AcmeResponseError]?

public enum AcmeErrorType: String, Codable, Error {
public enum AcmeErrorType: String, Codable, Error, Sendable {
/// The request message was malformed
case malformed = "urn:ietf:params:acme:error:malformed"

Expand Down Expand Up @@ -121,7 +121,7 @@ public struct AcmeResponseError: Codable, Error {
case userActionRequired = "urn:ietf:params:acme:error:userActionRequired"
}

public struct ErrorIdentifier: Codable {
public struct ErrorIdentifier: Codable, Sendable {
public let type: String
public let value: String
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/AcmeSwift/Models/Certificate/RevokeSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct CertificateRevokeSpec: Codable {
}

/// Reason why we request for a certificate to be revoked.
public enum AcmeRevokeReason: Int, Codable {
public enum AcmeRevokeReason: Int, Codable, Sendable {
case unspecified = 0
case keyCompromise = 1
case cACompromise = 2
Expand Down
10 changes: 5 additions & 5 deletions Sources/AcmeSwift/Models/Order/AcmeAuthorization.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public struct AcmeAuthorization: Codable {
public struct AcmeAuthorization: Codable, Sendable {
public let status: AuthorizationStatus

/// The timestamp after which the server will consider this authorization invalid
Expand All @@ -13,7 +13,7 @@ public struct AcmeAuthorization: Codable {
/// Present and `true` if the current authorization is for a domain for which a wildcard certificate was requested.
public let wildcard: Bool?

public enum AuthorizationStatus: String, Codable {
public enum AuthorizationStatus: String, Codable, Sendable {
/// Initial status when the authorization is created.
case pending

Expand All @@ -31,7 +31,7 @@ public struct AcmeAuthorization: Codable {
case revoked
}

public struct Challenge: Codable {
public struct Challenge: Codable, Sendable {
/// The URL to which a response can be posted
public let url: URL

Expand All @@ -50,7 +50,7 @@ public struct AcmeAuthorization: Codable {
/// Error that occurred while the server was validating the challenge
public let error: AcmeResponseError?

public enum ChallengeType: String, Codable {
public enum ChallengeType: String, Codable, Sendable {
//// A HTTP challenge that requires publishing the contents of a challenge at a specific URL to prove ownership of the domain record.
case http = "http-01"

Expand All @@ -61,7 +61,7 @@ public struct AcmeAuthorization: Codable {
case alpn = "tls-alpn-01"
}

public enum ChallengeStatus: String, Codable {
public enum ChallengeStatus: String, Codable, Sendable {
case pending
case processing
case valid
Expand Down
6 changes: 3 additions & 3 deletions Sources/AcmeSwift/Models/Order/AcmeOrderInfo.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Foundation

/// Information returned when creating a new Order
public struct AcmeOrderInfo: Codable {
public struct AcmeOrderInfo: Codable,Sendable {

/// The URL of this Order.
internal(set) public var url: URL?

Expand Down Expand Up @@ -30,7 +30,7 @@ public struct AcmeOrderInfo: Codable {
public let certificate: URL?


public enum OrderStatus: String, Codable {
public enum OrderStatus: String, Codable, Sendable {
/// The certificate will not be issued. Consider thisorder process abandoned.
case invalid

Expand Down
8 changes: 4 additions & 4 deletions Sources/AcmeSwift/Models/Order/AcmeOrderSpec.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation


public struct AcmeOrderSpec: Codable {
public struct AcmeOrderSpec: Codable, Sendable {
public init(identifiers: [AcmeOrderSpec.Identifier], notBefore: Date? = nil, notAfter: Date? = nil) {
self.identifiers = identifiers
self.notBefore = notBefore
Expand All @@ -16,13 +16,13 @@ public struct AcmeOrderSpec: Codable {
/// The requested value of the notAfter field in the certificate
public var notAfter: Date? = nil

public struct Identifier: Codable {
public struct Identifier: Codable, Sendable {

public var `type`: IdentifierType = .dns

public var value: String

public enum IdentifierType: String, Codable {
public enum IdentifierType: String, Codable, Sendable {
case dns
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/AcmeSwift/Models/Order/ChallengeDescription.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public struct ChallengeDescription: Codable {
public struct ChallengeDescription: Codable, Sendable {
/// The type of challgen.
/// For a wildcard certificate, there will **always** be a at least one DNS challenge, even if your proferred method is HTTP.
public let type: AcmeAuthorization.Challenge.ChallengeType
Expand Down

0 comments on commit 97d3e85

Please sign in to comment.