entitlements: support Sign in with Apple (#377)
- Commit
952a7ffd435139f4f6f7a62951b0d14fda6f2fee- Author
- Víctor Agudo Gonzalez <[email protected]>
- When
- 2026-10-23 02:25 UTC (1 month ago)
- Parents
bda3c69
## What does this PR do?
Hi! xtool didn't know about the `com.apple.developer.applesignin`
entitlement, so every time I installed my app, the capability sync
removed Sign in with Apple from the App ID. The new provisioning profile
didn't have it, and the device refused the app ("A valid provisioning
profile for this executable was not found").
This maps the entitlement to the `APPLE_ID_AUTH` capability, as a
primary App ID, so the capability stays and the profile includes it.
## How was it tested?
I built xtool from this branch on macOS and installed my app (a SwiftPM
app with `entitlementsPath` and the Sign in with Apple entitlement) on
an iPhone with a paid team. The App ID kept the capability, the install
worked, and native Sign in with Apple works in the app. Before the
change the same install failed every time.
## AI tool usage
How much of this PR was AI-assisted? (check one)
- [ ] **0** - No AI was used to write code
- [x] **1** - I was assisted by AI. I reviewed the finished result.
- [ ] **2** - I set the AI going and left it to it; nobody has read the
result - no review, or AI review only
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **New Features**
* Added support for configuring the Apple Sign In entitlement.
* Apple Sign In is now available as a supported entitlement type,
including serialization and configuration support.
* Configures Apple ID app consent as the primary app consent option.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->Diff
Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swift
diff --git a/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swift b/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swiftindex 2dca463..1d12254 100644--- a/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swift +++ b/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swift @@ -79,6 +79,22 @@ extension AppGroupEntitlement: EntitlementWithCapability { } } +extension AppleSignInEntitlement: EntitlementWithCapability {+ var capability: DeveloperServicesCapability {+ // A primary App ID: the app is its own Sign in with Apple group.+ DeveloperServicesCapability(+ .appleIdAuth,+ isFree: false,+ settings: [+ .init(+ key: .init(.appleIdAuthAppConsent),+ options: [.init(key: .init(.primaryAppConsent))]+ )+ ]+ )+ }+}+ extension AssociatedDomainsEntitlement: EntitlementWithCapability { var capability: DeveloperServicesCapability { DeveloperServicesCapability(.associatedDomains, isFree: false)
Sources/XKit/Model/Entitlements/EntitlementTypes.swift
diff --git a/Sources/XKit/Model/Entitlements/EntitlementTypes.swift b/Sources/XKit/Model/Entitlements/EntitlementTypes.swiftindex 1d65a04..7bc1ea5 100644--- a/Sources/XKit/Model/Entitlements/EntitlementTypes.swift+++ b/Sources/XKit/Model/Entitlements/EntitlementTypes.swift@@ -29,6 +29,7 @@ extension EntitlementContainer { WiFiAwareEntitlement.self, HomeKitEntitlement.self, HealthKitEntitlement.self,+ AppleSignInEntitlement.self, ] } @@ -99,6 +100,21 @@ public struct AssociatedDomainsEntitlement: Entitlement, RawRepresentable { } } +public struct AppleSignInEntitlement: Entitlement, RawRepresentable {+ public static let identifier = "com.apple.developer.applesignin"++ public var rawValue: [String]+ public init(rawValue: [String]) { self.rawValue = rawValue }++ public init(from decoder: Decoder) throws {+ rawValue = try decoder.singleValueContainer().decode([String].self)+ }+ public func encode(to encoder: Encoder) throws {+ var container = encoder.singleValueContainer()+ try container.encode(rawValue)+ }+}+ public enum APSEnvironmentEntitlement: String, Entitlement { public static let identifier = "aps-environment"