Skip to content

Commit c61de84

Browse files
authored
Migrate to SwiftKeychain v2.1.0 (#23)
2 parents cbbf5c1 + f6bfb42 commit c61de84

File tree

15 files changed

+199
-67
lines changed

15 files changed

+199
-67
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
swift: ['swift6', 'swift5']
1818
include:
1919
- swift: 'swift6'
20-
xcode-path: '/Applications/Xcode_16.0.0.app'
20+
xcode-path: '/Applications/Xcode_16.2.app'
2121
macos: 'macos-14'
2222
- swift: 'swift5'
23-
xcode-path: '/Applications/Xcode_15.4.0.app'
23+
xcode-path: '/Applications/Xcode_15.4.app'
2424
macos: 'macos-14'
2525

2626
env:

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.3
1+
5.5.3

OAuth2.xcodeproj/project.pbxproj

Lines changed: 108 additions & 35 deletions
Large diffs are not rendered by default.

OAuth2.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OAuth2.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.resolved

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.3
1+
// swift-tools-version:5.5
22
//
33
// Package.swift
44
// OAuth2
@@ -30,14 +30,12 @@ let package = Package(
3030
.library(name: "OAuth2", targets: ["OAuth2"]),
3131
],
3232
dependencies: [
33-
// SwiftKeychain is not yet available as a Package, so we symlink to /Sources and make it a Target
34-
//.package(url: "https://github.com/yankodimitrov/SwiftKeychain.git", majorVersion: 1),
33+
.package(url: "https://github.com/slidoapp/SwiftKeychain.git", .upToNextMinor(from: "2.1.0")),
3534
],
3635
targets: [
3736
.target(name: "OAuth2",
3837
dependencies: ["Base", "Flows", "DataLoader"]),
39-
.target(name: "SwiftKeychain"),
40-
.target(name: "Base", dependencies: [.target(name: "SwiftKeychain")]),
38+
.target(name: "Base", dependencies: ["SwiftKeychain"]),
4139
.target(name: "macOS", dependencies: [.target(name: "Base")]),
4240
.target(name: "iOS", dependencies: [.target(name: "Base")]),
4341
.target(name: "tvOS", dependencies: [.target(name: "Base")]),

Sources/Base/OAuth2Base.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,26 @@ open class OAuth2Base: OAuth2Securable {
208208
return authURL.description
209209
}
210210

211-
override open func updateFromKeychainItems(_ items: [String: Any]) {
211+
override open func updateFromKeychainItems(_ items: [String: any Sendable]) {
212212
for message in clientConfig.updateFromStorableItems(items) {
213213
logger?.debug("OAuth2", msg: message)
214214
}
215215
clientConfig.secretInBody = (clientConfig.endpointAuthMethod == OAuth2EndpointAuthMethod.clientSecretPost)
216216
}
217217

218-
override open func storableCredentialItems() -> [String: Any]? {
218+
override open func storableCredentialClasses() -> [AnyClass] {
219+
return clientConfig.storableCredentialClasses()
220+
}
221+
222+
override open func storableCredentialItems() -> [String: any Sendable]? {
219223
return clientConfig.storableCredentialItems()
220224
}
221225

222-
override open func storableTokenItems() -> [String: Any]? {
226+
override open func storableTokenClasses() -> [AnyClass] {
227+
return clientConfig.storableTokenClasses()
228+
}
229+
230+
override open func storableTokenItems() -> [String: any Sendable]? {
223231
return clientConfig.storableTokenItems()
224232
}
225233

Sources/Base/OAuth2ClientConfig.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,15 @@ open class OAuth2ClientConfig {
204204
}
205205
}
206206

207+
/**
208+
Enumerates all classes used for storing credential items.
209+
210+
- returns: An array containing all classes used for storing credential items
211+
*/
212+
func storableCredentialClasses() -> [AnyClass] {
213+
return []
214+
}
215+
207216
/**
208217
Creates a dictionary of credential items that can be stored to the keychain.
209218

@@ -220,6 +229,15 @@ open class OAuth2ClientConfig {
220229
return items
221230
}
222231

232+
/**
233+
Enumerates all classes used for storing token items.
234+
235+
- returns: An array containing all classes used for storing token items
236+
*/
237+
func storableTokenClasses() -> [AnyClass] {
238+
return [NSDate.self]
239+
}
240+
223241
/**
224242
Creates a dictionary of token items that can be stored to the keychain.
225243

0 commit comments

Comments
 (0)