Skip to content

Commit e3d306e

Browse files
committed
format
1 parent 6a52265 commit e3d306e

34 files changed

+242
-172
lines changed

Sources/Auth/AuthAdmin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77

88
import Foundation
9-
import Helpers
109
import HTTPTypes
10+
import Helpers
1111

1212
public struct AuthAdmin: Sendable {
1313
let clientID: AuthClientID

Sources/Auth/AuthClient.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ConcurrencyExtras
22
import Foundation
3-
import Helpers
43
import HTTPTypes
4+
import Helpers
55

66
#if canImport(AuthenticationServices)
77
import AuthenticationServices
@@ -18,7 +18,9 @@ public final class AuthClient: Sendable {
1818

1919
private var api: APIClient { Dependencies[clientID].api }
2020
var configuration: AuthClient.Configuration { Dependencies[clientID].configuration }
21-
private var codeVerifierStorage: CodeVerifierStorage { Dependencies[clientID].codeVerifierStorage }
21+
private var codeVerifierStorage: CodeVerifierStorage {
22+
Dependencies[clientID].codeVerifierStorage
23+
}
2224
private var date: @Sendable () -> Date { Dependencies[clientID].date }
2325
private var sessionManager: SessionManager { Dependencies[clientID].sessionManager }
2426
private var eventEmitter: AuthStateChangeEventEmitter { Dependencies[clientID].eventEmitter }
@@ -189,8 +191,8 @@ public final class AuthClient: Sendable {
189191

190192
private func _signUp(request: HTTPRequest, from body: Data) async throws -> AuthResponse {
191193
let (data, _) = try await api.execute(for: request, from: body)
192-
193-
let response = try configuration.decoder.decode(AuthResponse.self, from: data)
194+
195+
let response = try configuration.decoder.decode(AuthResponse.self, from: data)
194196

195197
if let session = response.session {
196198
await sessionManager.update(session)
@@ -298,7 +300,7 @@ public final class AuthClient: Sendable {
298300

299301
private func _signIn(request: HTTPRequest, from body: Data) async throws -> Session {
300302
let (data, _) = try await api.execute(for: request, from: body)
301-
303+
302304
let session = try configuration.decoder.decode(Session.self, from: data)
303305

304306
await sessionManager.update(session)
@@ -415,7 +417,7 @@ public final class AuthClient: Sendable {
415417
)
416418
)
417419
)
418-
420+
419421
return try configuration.decoder.decode(SSOResponse.self, from: data)
420422
}
421423

@@ -449,7 +451,7 @@ public final class AuthClient: Sendable {
449451
)
450452
)
451453
)
452-
454+
453455
return try configuration.decoder.decode(SSOResponse.self, from: data)
454456
}
455457

@@ -903,7 +905,7 @@ public final class AuthClient: Sendable {
903905

904906
private func _verifyOTP(request: HTTPRequest, from body: Data) async throws -> AuthResponse {
905907
let (data, _) = try await api.execute(for: request, from: body)
906-
let response = try configuration.decoder.decode(AuthResponse.self, from: data)
908+
let response = try configuration.decoder.decode(AuthResponse.self, from: data)
907909

908910
if let session = response.session {
909911
await sessionManager.update(session)
@@ -1237,7 +1239,7 @@ public final class AuthClient: Sendable {
12371239
}
12381240

12391241
var queryItems: [URLQueryItem] = [
1240-
URLQueryItem(name: "provider", value: provider.rawValue),
1242+
URLQueryItem(name: "provider", value: provider.rawValue)
12411243
]
12421244

12431245
if let scopes {

Sources/Auth/AuthClientConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77

88
import Foundation
9-
import Helpers
109
import HTTPTypes
1110
import HTTPTypesFoundation
11+
import Helpers
1212

1313
#if canImport(FoundationNetworking)
1414
import FoundationNetworking

Sources/Auth/AuthMFA.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
2-
import Helpers
32
import HTTPTypes
3+
import Helpers
44

55
/// Contains the full multi-factor authentication API.
66
public struct AuthMFA: Sendable {
@@ -32,7 +32,7 @@ public struct AuthMFA: Sendable {
3232
),
3333
from: encoder.encode(params)
3434
)
35-
35+
3636
return try decoder.decode(AuthMFAEnrollResponse.self, from: data)
3737
}
3838

@@ -64,7 +64,7 @@ public struct AuthMFA: Sendable {
6464
),
6565
from: encoder.encode(params)
6666
)
67-
67+
6868
let response = try decoder.decode(AuthMFAVerifyResponse.self, from: data)
6969

7070
await sessionManager.update(response)

Sources/Auth/Defaults.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extension AuthClient.Configuration {
4949
}()
5050

5151
public static let defaultHeaders: [String: String] = [
52-
"X-Client-Info": "auth-swift/\(version)",
52+
"X-Client-Info": "auth-swift/\(version)"
5353
]
5454

5555
/// The default ``AuthFlowType`` used when initializing a ``AuthClient`` instance.

Sources/Auth/Deprecated.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77

88
import Foundation
9-
import Helpers
109
import HTTPTypes
1110
import HTTPTypesFoundation
11+
import Helpers
1212

1313
#if canImport(FoundationNetworking)
1414
import FoundationNetworking

Sources/Auth/Internal/APIClient.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
2-
import Helpers
32
import HTTPTypes
3+
import Helpers
44

55
extension HTTPClient {
66
init(configuration: AuthClient.Configuration) {
@@ -32,7 +32,10 @@ struct APIClient: Sendable {
3232
Dependencies[clientID].http
3333
}
3434

35-
func execute(for request: HTTPRequest, from bodyData: Data?) async throws -> (Data, HTTPResponse) {
35+
func execute(
36+
for request: HTTPRequest,
37+
from bodyData: Data?
38+
) async throws -> (Data, HTTPResponse) {
3639
var request = request
3740
request.headerFields = HTTPFields(configuration.headers).merging(with: request.headerFields)
3841

@@ -50,7 +53,10 @@ struct APIClient: Sendable {
5053
}
5154

5255
@discardableResult
53-
func authorizedExecute(for request: HTTPRequest, from bodyData: Data?) async throws -> (Data, HTTPResponse) {
56+
func authorizedExecute(
57+
for request: HTTPRequest,
58+
from bodyData: Data?
59+
) async throws -> (Data, HTTPResponse) {
5460
var sessionManager: SessionManager {
5561
Dependencies[clientID].sessionManager
5662
}

Sources/Auth/Internal/Keychain.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@
4040
if addStatus == KeychainError.duplicateItem.status {
4141
let updateQuery = baseQuery(withKey: key)
4242
let updateAttributes: [String: Any] = [kSecValueData as String: data]
43-
let updateStatus = SecItemUpdate(updateQuery as CFDictionary, updateAttributes as CFDictionary)
43+
let updateStatus = SecItemUpdate(
44+
updateQuery as CFDictionary,
45+
updateAttributes as CFDictionary
46+
)
4447
try assertSuccess(forStatus: updateStatus)
4548
} else {
4649
try assertSuccess(forStatus: addStatus)
@@ -132,7 +135,7 @@
132135
case .interactionNotAllowed: errSecInteractionNotAllowed
133136
case .decodeFailed: errSecDecode
134137
case let .other(status): status
135-
case .unknown: errSecSuccess // This is not a Keychain error
138+
case .unknown: errSecSuccess // This is not a Keychain error
136139
}
137140
}
138141
}

Sources/Auth/Internal/SessionManager.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
2-
import Helpers
32
import HTTPTypes
3+
import Helpers
44

55
struct SessionManager: Sendable {
66
var session: @Sendable () async throws -> Session
@@ -78,12 +78,12 @@ private actor LiveSessionManager {
7878
url: configuration.url
7979
.appendingPathComponent("token")
8080
.appendingQueryItems([
81-
URLQueryItem(name: "grant_type", value: "refresh_token"),
81+
URLQueryItem(name: "grant_type", value: "refresh_token")
8282
])
8383
),
8484
from: configuration.encoder.encode(UserCredentials(refreshToken: refreshToken))
8585
)
86-
86+
8787
let session = try configuration.decoder.decode(Session.self, from: data)
8888

8989
update(session)
@@ -115,7 +115,10 @@ private actor LiveSessionManager {
115115
}
116116
}
117117

118-
private func scheduleNextTokenRefresh(_ refreshedSession: Session, caller: StaticString = #function) async {
118+
private func scheduleNextTokenRefresh(
119+
_ refreshedSession: Session,
120+
caller: StaticString = #function
121+
) async {
119122
await SupabaseLoggerTaskLocal.$additionalContext.withValue(
120123
merging: ["caller": .string("\(caller)")]
121124
) {

Sources/Auth/Internal/SessionStorage.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ extension StorageMigration {
109109
let key = SessionStorage.key(clientID)
110110

111111
if let data = try? storage.retrieve(key: key),
112-
let storedSession = try? AuthClient.Configuration.jsonDecoder.decode(StoredSession.self, from: data)
113-
{
112+
let storedSession = try? AuthClient.Configuration.jsonDecoder.decode(
113+
StoredSession.self,
114+
from: data
115+
) {
114116
let session = try AuthClient.Configuration.jsonEncoder.encode(storedSession.session)
115117
try storage.store(key: key, value: session)
116118
}

0 commit comments

Comments
 (0)