From 1cf77170fa652ef6a3b784ed5d09b746526b5b34 Mon Sep 17 00:00:00 2001 From: Filippos Sakellaropoulos Date: Fri, 20 Sep 2024 00:24:51 +0300 Subject: [PATCH] Swift 6 migration --- .devcontainer/devcontainer.json | 2 +- Package.resolved | 8 ++++---- Package.swift | 6 +++--- Sources/WalletStorage/Document.swift | 2 +- Sources/WalletStorage/Enumerations.swift | 8 ++++---- Sources/WalletStorage/IssueRequest.swift | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 41a5104..1dc5156 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ { "name": "Swift", - "image": "swift:5.9", + "image": "swift:6.0", "features": { "ghcr.io/devcontainers/features/common-utils:2": { "installZsh": "false", diff --git a/Package.resolved b/Package.resolved index d729aaf..195dbf5 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-iso18013-data-model.git", "state" : { - "revision" : "e604f0f0b67c86c3360f848defe85c9a9939b716", - "version" : "0.3.1" + "branch" : "develop", + "revision" : "1d74365e1b7e4a12ef4268897bbf738c87c45bf6" } }, { @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/niscy-eudiw/SwiftCBOR.git", "state" : { - "revision" : "310dbc3975a5653237fed304d88a6dd59d04dd30", - "version" : "0.5.7" + "revision" : "2c8c55273d4c4aae21bb46c2afbae79ee072eff4", + "version" : "0.6.2" } } ], diff --git a/Package.swift b/Package.swift index 659adae..fba43f8 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.9 +// swift-tools-version: 6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -15,7 +15,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/apple/swift-log.git", from: "1.5.3"), - .package(url: "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-iso18013-data-model.git", exact: "0.3.1"), + .package(url: "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-iso18013-data-model.git", branch: "develop"), ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. @@ -28,6 +28,6 @@ let package = Package( ]), .testTarget( name: "WalletStorageTests", - dependencies: ["WalletStorage"], resources: [.process("Resources")]), + dependencies: ["WalletStorage"]), ] ) diff --git a/Sources/WalletStorage/Document.swift b/Sources/WalletStorage/Document.swift index 9b85cdc..2515d4e 100644 --- a/Sources/WalletStorage/Document.swift +++ b/Sources/WalletStorage/Document.swift @@ -18,7 +18,7 @@ import Foundation import MdocDataModel18013 /// wallet document structure -public struct Document: DocumentProtocol { +public struct Document: DocumentProtocol, Sendable { public init(id: String = UUID().uuidString, docType: String, docDataType: DocDataType, data: Data, privateKeyType: PrivateKeyType?, privateKey: Data?, createdAt: Date?, modifiedAt: Date? = nil, displayName: String?, status: DocumentStatus) { self.id = id self.docType = docType diff --git a/Sources/WalletStorage/Enumerations.swift b/Sources/WalletStorage/Enumerations.swift index 413f5e4..2f0ef7c 100644 --- a/Sources/WalletStorage/Enumerations.swift +++ b/Sources/WalletStorage/Enumerations.swift @@ -19,7 +19,7 @@ import Foundation /// type of data to save in storage /// ``doc``: Document data /// ``key``: Private-key -public enum SavedKeyChainDataType: String { +public enum SavedKeyChainDataType: String, Sendable { case doc = "sdoc" case key = "skey" } @@ -29,7 +29,7 @@ public enum SavedKeyChainDataType: String { /// ``sjwt``: sd-jwt ** not yet supported ** /// ``signupResponseJson``: DeviceResponse and PrivateKey json serialized /// ``deferred``: Deferred issuance data -public enum DocDataType: String { +public enum DocDataType: String, Sendable { case cbor = "cbor" case sjwt = "sjwt" case signupResponseJson = "srjs" @@ -40,7 +40,7 @@ public enum DocDataType: String { /// ``pemStringDataP256`` PEM string encoded as utf8 /// ``x963EncodedP256``: ANSI x9.63 representation (default) /// ``secureEnclaveP256``: data representation for the secure enclave -public enum PrivateKeyType: String { +public enum PrivateKeyType: String, Sendable { case derEncodedP256 = "dep2" case pemStringDataP256 = "pep2" case x963EncodedP256 = "x9p2" @@ -49,7 +49,7 @@ public enum PrivateKeyType: String { /// document status -public enum DocumentStatus: String, CaseIterable { +public enum DocumentStatus: String, CaseIterable, Sendable { case issued case deferred case pending diff --git a/Sources/WalletStorage/IssueRequest.swift b/Sources/WalletStorage/IssueRequest.swift index e55fb31..be82756 100644 --- a/Sources/WalletStorage/IssueRequest.swift +++ b/Sources/WalletStorage/IssueRequest.swift @@ -19,7 +19,7 @@ import CryptoKit import MdocDataModel18013 /// Issue request structure -public struct IssueRequest { +public struct IssueRequest: Sendable { public var id: String public var docType: String? public var keyData: Data