From 587d04a5c4d8e287b27d1ea4af540187a5f5f717 Mon Sep 17 00:00:00 2001 From: Nandan Prabhu Date: Fri, 3 Jul 2026 18:23:12 +0530 Subject: [PATCH] fix: make ActClaim conform to Sendable instead of @unchecked Sendable additionalClaims stored Any values, which aren't Sendable and forced the @unchecked escape hatch. Typing it as [String: any Sendable] lets ActClaim get real Sendable conformance checked by the compiler. Co-Authored-By: Claude Sonnet 4.6 --- Auth0/ActClaim.swift | 10 +++++----- Auth0/UserProfile.swift | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Auth0/ActClaim.swift b/Auth0/ActClaim.swift index c837a7814..ecf891639 100644 --- a/Auth0/ActClaim.swift +++ b/Auth0/ActClaim.swift @@ -23,7 +23,7 @@ import Foundation /// /// - [RFC 8693: OAuth 2.0 Token Exchange - act Claim](https://tools.ietf.org/html/rfc8693#section-4.4) /// - [Custom Token Exchange Documentation](https://auth0.com/docs/authenticate/custom-token-exchange) -public final class ActClaim: @unchecked Sendable { +public final class ActClaim: Sendable { /// The subject identifier of the acting party. /// @@ -38,23 +38,23 @@ public final class ActClaim: @unchecked Sendable { /// /// Values are preserved as-is, including non-string JSON values (numbers, booleans, objects, arrays), so that /// custom claims set via `api.authentication.setActor()` are not lost. - public let additionalClaims: [String: Any] + public let additionalClaims: [String: any Sendable] /// Creates a new `ActClaim` from a JSON dictionary. /// /// - Parameter json: A dictionary representing the `act` claim from a decoded JWT. /// - Returns: An `ActClaim` instance, or `nil` if the dictionary does not contain a `sub` claim. - public init?(json: [String: Any]) { + public init?(json: [String: any Sendable]) { guard let sub = json["sub"] as? String else { return nil } self.sub = sub - if let nestedAct = json["act"] as? [String: Any] { + if let nestedAct = json["act"] as? [String: any Sendable] { self.act = ActClaim(json: nestedAct) } else { self.act = nil } - var additional: [String: Any] = [:] + var additional: [String: any Sendable] = [:] for (key, value) in json where key != "sub" && key != "act" { additional[key] = value } diff --git a/Auth0/UserProfile.swift b/Auth0/UserProfile.swift index f6e9ee860..0404cfef8 100644 --- a/Auth0/UserProfile.swift +++ b/Auth0/UserProfile.swift @@ -199,7 +199,7 @@ public extension UserProfile { } var act: ActClaim? - if let actJson = json["act"] as? [String: Any] { + if let actJson = json["act"] as? [String: any Sendable] { act = ActClaim(json: actJson) }