18 Commits
Author SHA1 Message Date
Andrew Heard ebd7f0547a feat(debug): add debugToken: initializer and debugTokenSource (#134)
Add initWithServiceName:resourceName:baseURL:APIKey:requestHooks:
debugToken: (Swift: init(serviceName:resourceName:baseURL:apiKey:
requestHooks:debugToken:)) to GACAppCheckDebugProvider so callers can
supply a debug token resolved outside the SDK, such as one the Firebase
CLI saved to ~/.config/configstore/firebase-appcheck.json. The existing
initializer delegates to it with a nil token.

Tokens resolve in this order: the AppCheckDebugToken or
FIRAAppCheckDebugToken environment variable, the provided token, the
stored local token, then a newly generated one. The provided token is
trimmed, and an empty result falls back to the local token. When it is
used, no local token is generated, stored, or logged; a debug-level
message (I-GAC004005) is logged instead, and its exchanges don't change
the local token's registered state.

Also add debugTokenSource and AppCheckCoreDebugTokenSource
(GACAppCheckDebugTokenSource: local, environmentVariable, provided),
which report where the current token came from. The enum is Sendable
and marked @nonexhaustive when the compiler supports it, so new sources
can be added without breaking Swift clients.
2026-11-06 12:23:01 -05:00
Andrew Heard 958f0212cf fix(debug): only track registration state for local debug token (#135)
The debug provider stores a per-service "registered" flag so it stops
logging the local debug token's registration instructions once that
token has been exchanged successfully. Exchanges using the
AppCheckDebugToken or FIRAAppCheckDebugToken environment variable also
updated the flag, even though the local token wasn't used:

- On success, the local token was marked as registered, so after the
  variable was removed the SDK fell back to an unregistered token
  without logging how to register it.
- On failure, the flag was cleared, so an already registered local
  token logged its registration instructions again.

Only set or clear the flag when the local token was the one exchanged;
serverUnreachable failures still leave it untouched. There are no
public API changes.

Also document all parameters of the public initializer, and fix the
test tearDown, which only removed the registered key's prefix and let
the flag leak between tests.
2026-11-05 16:47:46 -05:00
c7eb17e554 Rewrite AppCheckCore in Swift (#111)
Signed-off-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
Co-authored-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
Co-authored-by: Nick Cooke <nickcooke@google.com>
2026-09-23 18:22:08 -04:00
Nick Cooke 8ceec5f0b6 refactor: migrate GACAppAttestProviderTests off OCMock (Milestone 2) (#109)
Signed-off-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
2026-07-27 21:38:27 -04:00
Nick Cooke a574648453 fix: eliminate thread starvation flake in legacy provider tests (#100) 2026-06-20 12:20:53 -04:00
Andrew HeardandNick Cooke bb4002485f feat: Only log local debug tokens when not yet registered (#95)
Co-authored-by: Nick Cooke <nickcooke@google.com>
2026-06-10 11:30:20 -04:00
f6b4582ed1 feat: Add Recaptcha attestation provider (#94)
Signed-off-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
Co-authored-by: Hitesh Maurya <hiteshmaurya@google.com>
Co-authored-by: Paul Beusterien <paulbeusterien@google.com>
2026-06-09 16:44:19 -04:00
Nick Cooke 34e4ef0800 [v11] Migrate to GoogleUtilities v8 (#61)
Signed-off-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
2024-06-12 15:22:18 -04:00
Nick Cooke 7d2688de03 [AppCheckCore] Migrate to GoogleUtilities's storage container (#53) 2024-04-12 15:40:49 -04:00
Andrew Heard ba91f3f518 Fix C function warnings in Xcode 14.3+ (#28) 2023-09-08 17:36:04 -04:00
Andrew Heard 462e3d2cf5 Make API key nonnull in DeviceCheck and debug providers (#26) 2023-09-07 15:15:43 -04:00
Andrew Heard 4e405b8c4f Rename debug token environment variable key (#24) 2023-09-07 10:57:38 -04:00
Andrew Heard 023abd45d3 Add baseURL parameter to GACAppCheckDebugProvider constructor (#21) 2023-08-31 12:18:47 -04:00
Andrew Heard f2cc90d0ce Return GACAppCheckTokenResult in tokenForcingRefresh handler (#19) 2023-08-30 14:22:33 -04:00
Andrew Heard f53218675e Consistently use GACAppCheckTokenProtocol in public API (#15) 2023-08-23 10:12:24 -04:00
Andrew Heard 8d0bdd3f24 Add generation of limited-use tokens with a TTL of 5 mins (#11) 2023-08-22 12:56:00 -04:00
Andrew Heard b12f472db8 Rename instanceName and storageID to serviceName (#11599)
For consistency, renamed both instanceName and storageID to serviceName for consistency.

In all cases, the serviceName is an identifier that differentiates multiple GACAppCheck instances such as when there are multiple FIRApps in use, or multiple dependent SDKs (e.g., Firebase and Google Sign-In). This unique identifier ensures their state is not shared in the Keychain or in User Defaults.
2023-08-01 13:48:42 -04:00
Andrew Heard 2d2d0e6228 Renamed AppCheck to AppCheckCore (#11581)
Renamed the App Check (Lite) SDK to App Check Core.
2023-07-21 10:17:20 -04:00