diff --git a/Sources/AcmeSwift/APIs/AcmeSwift+Orders.swift b/Sources/AcmeSwift/APIs/AcmeSwift+Orders.swift index 25073ea..66ef159 100644 --- a/Sources/AcmeSwift/APIs/AcmeSwift+Orders.swift +++ b/Sources/AcmeSwift/APIs/AcmeSwift+Orders.swift @@ -334,9 +334,9 @@ extension AcmeSwift { let jwk = JWK.ecdsa( nil, identifier: nil, - x: publicKey.prefix(upTo: publicKey.count/2).base64EncodedString(), - y: publicKey.suffix(from: publicKey.count/2).base64EncodedString(), - curve: nil + x: publicKey.prefix(publicKey.count/2).toBase64UrlString(), + y: publicKey.suffix(publicKey.count/2).toBase64UrlString(), + curve: .p256 ) let encoder = JSONEncoder() encoder.outputFormatting = .sortedKeys @@ -347,6 +347,6 @@ extension AcmeSwift { extension SHA256Digest { var base64URLString: String { - Data(self).base64EncodedString().base64ToBase64Url() + Data(self).toBase64UrlString() } } diff --git a/Sources/AcmeSwift/Helpers/AcmeRequestBody.swift b/Sources/AcmeSwift/Helpers/AcmeRequestBody.swift index 2489231..11b10b3 100644 --- a/Sources/AcmeSwift/Helpers/AcmeRequestBody.swift +++ b/Sources/AcmeSwift/Helpers/AcmeRequestBody.swift @@ -65,12 +65,12 @@ struct AcmeRequestBody: Encodable { self.protected = .init( alg: .es256, - jwk: accountURL == nil ? JWTKit.JWK.ecdsa( + jwk: accountURL == nil ? JWK.ecdsa( nil, identifier: nil, - x: publicKey.prefix(upTo: publicKey.count/2).base64EncodedString(), - y: publicKey.suffix(from: publicKey.count/2).base64EncodedString(), - curve: nil + x: publicKey.prefix(publicKey.count/2).toBase64UrlString(), + y: publicKey.suffix(publicKey.count/2).toBase64UrlString(), + curve: .p256 ) : nil, kid: accountURL, nonce: nonce, diff --git a/Sources/AcmeSwift/Models/AcmeError.swift b/Sources/AcmeSwift/Models/AcmeError.swift index 53c6de7..2fd43a3 100644 --- a/Sources/AcmeSwift/Models/AcmeError.swift +++ b/Sources/AcmeSwift/Models/AcmeError.swift @@ -17,8 +17,6 @@ public enum AcmeError: Error, Sendable { /// No nonce (anti-replay) value was returned by the endpoint case noNonceReturned - case jwsEncodeError(String) - case dataCorrupted(String) case errorCode(UInt, String) diff --git a/Tests/AcmeSwiftTests/AccountTests.swift b/Tests/AcmeSwiftTests/AccountTests.swift index 25b8df2..93484e2 100644 --- a/Tests/AcmeSwiftTests/AccountTests.swift +++ b/Tests/AcmeSwiftTests/AccountTests.swift @@ -13,7 +13,7 @@ final class AccountTests: XCTestCase { self.logger = Logger.init(label: "acme-swift-tests") self.logger.logLevel = .trace - var config = HTTPClient.Configuration(certificateVerification: .fullVerification, backgroundActivityLogger: self.logger) + let config = HTTPClient.Configuration(certificateVerification: .fullVerification, backgroundActivityLogger: self.logger) self.http = HTTPClient( eventLoopGroupProvider: .singleton, configuration: config