Skip to content

Commit d8f787b

Browse files
Github issue: #890 Conforming Credential Manager to Sendable
1 parent 4a0b2f9 commit d8f787b

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

Auth0/Authentication.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public typealias DatabaseUser = (email: String, username: String?, verified: Boo
1313

1414
- ``AuthenticationError``
1515
*/
16-
public protocol Authentication: SenderConstraining, Trackable, Loggable {
16+
public protocol Authentication: SenderConstraining, Trackable, Loggable, Sendable {
1717

1818
/// The Auth0 Client ID.
1919
var clientId: String { get }

Auth0/BioAuthentication.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#if WEB_AUTH_PLATFORM
22
import Foundation
3-
import LocalAuthentication
3+
@preconcurrency import LocalAuthentication
44

5-
struct BioAuthentication {
5+
struct BioAuthentication: Sendable {
66

77
private let authContext: LAContext
88
private let evaluationPolicy: LAPolicy

Auth0/BiometricPolicy.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import Foundation
33

44
/// Defines the policy for when a biometric prompt should be shown when using the Credentials Manager.
5-
public enum BiometricPolicy {
5+
public enum BiometricPolicy: Sendable {
66

77
/// Default behavior. Uses the same LAContext instance, allowing the system to manage biometric prompts.
88
/// The system may skip the prompt if biometric authentication was recently successful.

Auth0/CredentialsManager.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import LocalAuthentication
2424
///
2525
/// - ``CredentialsManagerError``
2626
/// - <doc:RefreshTokens>
27-
public struct CredentialsManager {
27+
public struct CredentialsManager: Sendable {
2828

2929
private let storage: CredentialsStorage
3030
private let storeKey: String
@@ -33,7 +33,8 @@ public struct CredentialsManager {
3333
#if WEB_AUTH_PLATFORM
3434
var bioAuth: BioAuthentication?
3535
// Biometric session management - using a class to allow mutation in non-mutating methods
36-
private final class BiometricSession {
36+
// @unchecked Sendable is fine here as we are using lock to read and update lastBiometricAuthTime which is safe acorss threads.
37+
private final class BiometricSession: @unchecked Sendable {
3738
let noSession: TimeInterval = -1
3839
var lastBiometricAuthTime: TimeInterval = -1
3940
let lock = NSLock()

Auth0/CredentialsStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import SimpleKeychain
22
import Foundation
33

44
/// Generic storage API for storing credentials.
5-
public protocol CredentialsStorage {
5+
public protocol CredentialsStorage: Sendable {
66

77
/// Retrieves a storage entry.
88
///

Auth0/IDTokenValidator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#if WEB_AUTH_PLATFORM
22
import Foundation
3-
import JWTDecode
3+
@preconcurrency import JWTDecode
44

55
protocol JWTValidator {
66
func validate(_ jwt: JWT) -> Auth0Error?

Auth0/Requestable.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Foundation
2-
import Combine
32

43
public protocol Requestable {
54
associatedtype ResultType

Auth0/Telemetry.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
/// Generates and sets the `Auth0-Client` header.
4-
public struct Telemetry {
4+
public struct Telemetry: Sendable {
55

66
static let NameKey = "name"
77
static let VersionKey = "version"

0 commit comments

Comments
 (0)