Repository navigation
0.2.0
Upgrading from 0.1.0: macOS 14 and iOS 17 are the only supported platforms, KeychainCredentialStore.init(decodeLegacy:)
is gone, and the ManualClock waits in PassportKitTesting throw. See the Breaking entries.
Added
TokenManager.signIn(refreshToken:grantedScope:idToken:) async throwsstarts a session from a refresh token the app
already holds, for example the oneexchangeRefreshToken(audiences:)issued for another client, or one read from
the storage of a previous OAuth library. LikesignIn(with:requestedScope:)it replaces the session, saves the
credential and emits.signedIn, but it caches no access token: the firstaccessToken(for:)refreshes. It throws
invalidConfigurationfor an empty token and then leaves the current session untouched.- A DocC article, "Migrating stored tokens", on moving users from another OAuth library without signing them out: read
the old refresh token, callsignIn(refreshToken:)under a new account, delete the old item once a token request
succeeded. ManualClock.WaitTimeout, thrown by the waits ofManualClock(see Changed).- Documentation of exact scope matching:
RequireAnyScopeand the resource access article state that scopes are
compared as exact strings and*is not a wildcard, with a compiled.custompolicy that accepts a scope prefix. - A release workflow: pushing a version tag runs the CI workflow (now also callable with
workflow_call) and, only if
every job passes, creates the GitHub release with the tag's changelog section as notes. The procedure is in
CONTRIBUTING.md.
Changed
- Breaking (
PassportKitTesting):ManualClock.waitForSleeper()andManualClock.advanceToNextSleeper()are
throws; call them withtry await. When no task sleeps within 60 seconds of real time (it was 10 seconds) they
throwManualClock.WaitTimeoutinstead of stopping the whole test process, so a slow wake-up on a loaded machine
fails only the waiting test. The wait is resumed by the sleeper that arrives instead of polling.
waitForSleeper(timeout:)is unchanged. TokenManager.init: the default ofrejectedTokenCacheDurationis 5 seconds (it was 30). The window only has to
absorb tight retry loops, which would otherwise rotate the refresh token on every attempt; a long one makes a
permission that was just granted look denied. Pass.seconds(30)to keep the old behaviour.- The iOS test job boots the simulator first, prints the full test output and uploads the result bundle when it
fails.
Removed
- Breaking:
KeychainCredentialStore.init(decodeLegacy:)and the migration code behind it. The store reads and
writes only its own format, and an item it cannot decode is a.storageFailure. An app migrates by reading its old
storage itself and callingTokenManager.signIn(refreshToken:grantedScope:idToken:). This also removes the
write-back, which replaced the migrated item by deleting and adding it and could lose it. Items written directly as
the record JSON by builds before 0.1.0 are no longer read. - Breaking: tvOS, watchOS and visionOS are no longer supported.
Package.swiftdeclares macOS 14 and iOS 17 only,
and the platform guards that existed for the other three are gone:WebAuthenticationSessionUserAgent,
LoopbackRedirectListenerandLoopbackUserAgentexist on both supported platforms (ADR 0011, Update).
Fixed
KeychainCredentialStore.deletematches the item by service, account and access group only. It no longer carries
the accessibility class, so an item stored with another class is removed on sign-out, and it no longer matches items
of other access groups.- The documentation of
KeychainCredentialStore,KeychainCredentialStore.Accessibilityand the security model said
accessibility classes and access groups protect the item. On macOS the store uses the file-based login keychain,
which enforces neither; they apply on iOS.
Security
KeychainCredentialStoresetskSecAttrSynchronizabletofalseexplicitly when it adds, fetches and deletes an
item, instead of relying on the default, so a credential never reaches iCloud Keychain. Items written before are
found as before.