App Check compatibility
This is a Pyric-native API with no Firebase counterpart, so coverage is measured against its own public exports rather than a Firebase surface.
App Check is climbing under Conformance Driven Development. A row below is a target with a derived assertion set, not a guarantee, until its status says otherwise. Production AI pass-through rows live in the AI Logic compatibility page.
initializeAppCheck(app, options) and providers
initializeAppCheck(app, { provider, isTokenAutoRefreshEnabled }): AppCheckReturns an AppCheck handle whose app is the app it was initialized on.
app-check-client-initialize-twice (instanceKeySet includes app). (Structured evidence: oracle-conformance.test.ts, scenario.ts)initializeAppCheck(app, options) called twiceA second call with the same options returns the same instance without throwing, including when the provider is a new CustomProvider instance built from the same factory.
app-check-client-initialize-twice (sameOptions, sameOptionsNewProviderInstance). (Structured evidence: oracle-conformance.test.ts, scenario.ts)initializeAppCheck(app, options) called twiceA second call with a different isTokenAutoRefreshEnabled throws a FirebaseError with code appCheck/already-initialized, customData.appName set to the app name, and the message that names initializeAppCheck() and the app.
app-check-client-initialize-twice (differentAutoRefresh). (Structured evidence: oracle-conformance.test.ts, scenario.ts)initializeAppCheck(app, options) called twiceAn omitted isTokenAutoRefreshEnabled equals false: a first call that omits it followed by one that passes false, the reverse, or two calls that both omit it, return the same instance. Only true against false or omitted throws appCheck/already-initialized.
app-check-client-initialize-twice-unset-auto-refresh (unsetThenFalse, falseThenUnset, unsetThenUnset). Upstream initializeAppCheck in @firebase/app-check 0.13.1 (firebase 12.19.0) compares !!initialOptions.isTokenAutoRefreshEnabled === !!options.isTokenAutoRefreshEnabled; 0.11.3 compared the raw values. (Structured evidence: oracle-conformance.test.ts, scenario.ts)new CustomProvider({ getToken })A CustomProvider constructs and is accepted by initializeAppCheck. With a debug token in effect, the SDK never calls it (a provider whose getToken would reject is called zero times).
app-check-client-debug-get-token (customProviderCalls; the capture initialized App Check with a CustomProvider). (Structured evidence: oracle-conformance.test.ts, scenario.ts)getToken(appCheck), getLimitedUseToken(appCheck) with a CustomProvider and no debug tokenWith FIREBASE_APPCHECK_DEBUG_TOKEN neither true nor a string, the SDK calls the CustomProvider and returns its token as given, caching it until its expireTimeMillis. When the provider rejects, getToken and getLimitedUseToken reject with its error, an onTokenChanged error handler receives it. AI Logic then depends on the handle: by default it gets the placeholder token, which the sandbox refuses with the 401, and with useLimitedUseAppCheckTokens: true no request is sent and the call rejects with AIError code error, message Error fetching from <url>: <provider message>.
@firebase/app-check 0.11.3 dist/esm/index.esm.js: initializeDebugMode (lines 638 to 657), getToken$2 (the provider path from line 783, makeDummyTokenResult on error), getLimitedUseToken$1 (lines 847 to 861, no placeholder), CustomProvider.getToken (lines 1374 to 1388), and the public getToken rethrowing result.error; @firebase/ai 2.12.0 dist/esm/index.esm.js getHeaders (line 1619) awaited inside makeRequest's try, whose catch wraps the rejection (line 1717). A real-SDK Node run in the ai-app-check hunt (GATE-1) saw the provider called and its token, or the placeholder, sent to AI Logic. No committed capture.new ReCaptchaV3Provider(siteKey); new ReCaptchaEnterpriseProvider(siteKey)Both reCAPTCHA providers construct from a site key and are accepted by initializeAppCheck in a realm with a document, such as a page.
initializeAppCheck(app, { provider: new ReCaptchaV3Provider(siteKey) }) with no document, and the same for ReCaptchaEnterpriseProviderWhere there is no document, such as a Node process or a server-rendered module, initializeAppCheck with either reCAPTCHA provider throws ReferenceError: document is not defined synchronously, with or without FIREBASE_APPCHECK_DEBUG_TOKEN. App Check is already set up for the app when it throws: a second call with the same options returns the handle, and one with other options throws appCheck/already-initialized.
document, and the same for ReCaptchaEnterpriseProvider@firebase/app-check 0.11.3 dist/esm/index.esm.js: initializeAppCheck creates the instance (line 1511) before _activate marks the app activated and calls provider.initialize last (line 1559); ReCaptchaV3Provider.initialize (line 1270) and ReCaptchaEnterpriseProvider.initialize (line 1347) call initializeV3 and initializeEnterprise, whose makeDiv reads document (line 1133). A real-SDK run in plain Node 24 (firebase 12.13.0, offline) saw each provider throw the ReferenceError, debug token or not, then return the instance for the same options and throw appCheck/already-initialized for another site key. The package has no Node build. No committed capture. Integration: test/apps/sandbox-app-check (a registered Node process and a Vite server-rendered module).Tokens: getToken, getLimitedUseToken
getToken(appCheck) on an app without initializeAppCheckRejects with a FirebaseError with code appCheck/use-before-activation, customData.appName, and the message telling the caller to call initializeAppCheck() first.
app-check-client-get-token-before-initialize (publicGetTokenWithUninitializedApp). (Structured evidence: oracle-conformance.test.ts, scenario.ts)getToken(appCheck, forceRefresh?): Promise<AppCheckTokenResult>Resolves { token } where token is a three-segment JWT: header alg RS256, typ JWT, with a kid; claims aud, exp, iat, iss, jti, lu, provider, sub; iss is https://firebaseappcheck.googleapis.com/<projectNumber>, aud is [projects/<projectNumber>, projects/<projectId>], sub is the app id, and exp - iat is 3600 seconds.
app-check-client-debug-get-token (first, forced). (Structured evidence: oracle-conformance.test.ts, scenario.ts)getToken(appCheck, forceRefresh?)A second getToken returns the cached token; getToken(appCheck, true) returns a different, newly minted token.
app-check-client-debug-get-token (secondEqualsFirst, forceRefreshDiffersFromFirst). (Structured evidence: oracle-conformance.test.ts, scenario.ts)getToken(appCheck, forceRefresh?) called concurrentlyProduction, debug mode: concurrent getToken calls share one in-flight exchange, forceRefresh calls included: two calls started together with no cached token resolve to one token, and two forced calls started together resolve to one new token. Listener calls are row app-check#on-token-changed-refresh.
app-check-client-get-token-concurrent (concurrentFirstShareOneToken, concurrentForcedShareOneToken, forcedDiffersFromFirst). Upstream getToken in @firebase/app-check 0.11.3 starts an exchange only if (!state.exchangeTokenPromise). (Structured evidence: oracle-conformance.test.ts, scenario.ts)getLimitedUseToken(appCheck): Promise<AppCheckTokenResult>Resolves { token } with the same JWT shape as getToken and a 300 second TTL, a different token on every call, never the cached token, and leaves the cached getToken token unchanged.
app-check-client-limited-use-token records the TTL in ttlSeconds, and the docs give a fixed 5 minutes (https://firebase.google.com/docs/ai-logic/app-check). (Structured evidence: oracle-conformance.test.ts, scenario.ts)getToken / getLimitedUseToken when attestation failsWhen the exchange is refused (an unregistered debug token), both reject with a FirebaseError with code appCheck/fetch-status-error and customData.httpStatus 403.
Listeners and refresh: onTokenChanged, setTokenAutoRefreshEnabled
onTokenChanged(appCheck, listener | observer): UnsubscribeReturns an unsubscribe function. A listener registered after a token exists is not called synchronously; it is called once, asynchronously, with the current cached token.
app-check-client-on-token-changed (unsubscribeType, lateListenerCallsSynchronous, lateListenerCallsWithin500ms, lateListenerTokenSequence). (Structured evidence: oracle-conformance.test.ts, scenario.ts)onTokenChanged(appCheck, listener | observer)Production, debug mode: listeners and observers registered before the first getToken are never called, not by the first token, a forced refresh, or limited-use tokens. Sandbox: they are called once each time the cached token changes (the first token and every forced refresh), never for limited-use tokens, and not after unsubscribing, which is the upstream-documented behavior for an attestation provider.
app-check-client-on-token-changed (every listenerCalls* count is 0). The sandbox side and the attested-provider behavior are pinned in the suite; the attested-provider path is upstream-documented, not captured. (Structured evidence: oracle-conformance.test.ts, scenario.ts)setTokenAutoRefreshEnabled(appCheck, isEnabled): voidReturns undefined and does not throw for either value; getToken still returns the cached token afterwards. Background refresh timing is not captured.
app-check-client-auto-refresh-toggle. (Structured evidence: oracle-conformance.test.ts, scenario.ts)Token exchange on the wire
POST projects/{projectId}/apps/{appId}:exchangeDebugToken?key=A registered debug token exchanges for { token, ttl: "3600s" }; an unregistered one fails 403 PERMISSION_DENIED with message App attestation failed.
app-check-exchange-debug-token-wire.firebase-admin getAppCheck()
getAppCheck().createToken(appId)Resolves { token, ttlMillis: 3600000 }; the token has the web SDK token shape (RS256 JWT with kid, claims aud, exp, iat, iss, jti, lu, provider, sub, exp - iat 3600).
app-check-admin-create-token-shape. (Structured evidence: oracle-conformance.test.ts)getAppCheck().createToken(appId, { ttlMillis })ttlMillis of 30 minutes is honored in the result and in exp - iat; 29 minutes and 7 days plus one second reject with app-check/invalid-argument and the message that names the 30 minute to 7 day range.
app-check-admin-create-token-custom-ttl. (Structured evidence: oracle-conformance.test.ts)getAppCheck().createToken(unknownAppId)Production: an app id the project does not own rejects with app-check/unknown-error and the message App not registered: <appId>. Sandbox: it has no list of the project's registered apps, so it mints a token for any non-empty app id; an empty app id rejects with app-check/invalid-argument.
app-check-admin-create-token-unknown-app; the sandbox side is pinned in the admin suite. (Structured evidence: oracle-conformance.test.ts)getAppCheck().verifyToken(token)Resolves { appId, token } for an Admin-minted token and for a token from the web debug exchange; the decoded token carries app_id, aud, exp, iat, iss, jti, provider, sub, and no alreadyConsumed key is present.
app-check-admin-verify-token. (Structured evidence: oracle-conformance.test.ts)getAppCheck().verifyToken(badToken)A token with an altered signature rejects with app-check/invalid-argument and The provided App Check token has invalid signature.; a non-JWT string and the empty string reject with app-check/invalid-argument and the decoding message.
app-check-admin-verify-tampered. (Structured evidence: oracle-conformance.test.ts)getAppCheck().verifyToken(token, options) with bad input, on another project, or with a foreign issuer, algorithm, subject, key, nbf, or expOptions that are not a non-null object throw app-check/invalid-argument with VerifyAppCheckTokenOptions must be a non-null object., and a token that is not a string throws App check token must be a non-null string.; both throw synchronously. Then, with no project id configured, app-check/invalid-credential. A token with a character outside base64url in any segment fails with the decoding message. Before the signature, the token content is checked in this order: a header alg other than RS256 rejects with The provided App Check token has incorrect algorithm. Expected "RS256" but got "<alg>".; an aud without projects/<projectId> of the verifying app rejects with app-check/invalid-argument and The provided App Check token has incorrect "aud" (audience) claim. Expected "projects/<projectId>" but got "<aud>". Make sure the App Check token comes from the same Firebase project as the service account used to authenticate this SDK.; an iss not starting with https://firebaseappcheck.googleapis.com/ rejects with The provided App Check token has incorrect "iss" (issuer) claim.; a sub that is not a string rejects with The provided App Check token has no "sub" (subject) claim., and an empty one with The provided App Check token has an empty string "sub" (subject) claim. Then a token with no kid is checked against every key. A kid that names a key other than the sandbox's marks a token from Firebase: in sandbox AI mode it rejects with Pyric's message (row verify-token-firebase-token), and in production AI mode it goes to firebase-admin (row verify-token-firebase-token-production-ai-mode). After the signature, a non-numeric or future nbf and a non-numeric exp reject as an invalid signature; an absent nbf or exp does not apply.
lib/app-check/token-verifier.js (verifyToken, verifyContent, ensureProjectId, mapJwtErrorToAppCheckError), lib/utils/jwt.js (getKeyCallback, PublicKeySignatureVerifier.verify), jws 4 verify-stream.js (JWS_REGEX), and jsonwebtoken 9 verify.js (nbf, exp). No capture; verification runs locally in the Admin SDK, so a capture would need no production change.getAppCheck().verifyToken(token, { consume: true })The first consume resolves with alreadyConsumed: false, a second consume with alreadyConsumed: true, and a plain verify afterwards has no alreadyConsumed key.
app-check-admin-verify-consume. (Structured evidence: oracle-conformance.test.ts)getAppCheck().verifyToken(firebaseToken) in sandbox AI modeProduction verifies the App Check tokens Firebase issues. Sandbox: in sandbox AI mode, or in a process not started with @pyric/cli/register in production AI mode, a token whose kid names a key other than the sandbox's rejects with app-check/invalid-argument and Pyric's message, which says the token was not minted by the Pyric sandbox and to start the server in production AI mode (PYRIC_AI_MODE=production). The project check comes first, as in production.
app-check-admin-verify-token (production verifies a token from its debug exchange); the sandbox side is pinned in the admin suite. (Structured evidence: oracle-conformance.test.ts)getAppCheck().verifyToken(firebaseToken) under @pyric/cli/register in production AI modeA token whose kid names a key other than the sandbox's goes to firebase-admin's own verifyToken, for an app scoped to the project the mirror resolves. It resolves with production's { appId, token } shape, the decoded token carrying app_id, and firebase-admin's errors (signature, audience, issuer, expiry) pass through with their codes and messages. Sandbox tokens, tokens with no kid, and malformed tokens keep the sandbox path.
app-check-admin-verify-token for the result shape; the verification itself is firebase-admin 13.10.0 lib/app-check/token-verifier.js, run unchanged.getAppCheck().verifyToken(firebaseToken, { consume: true }) in production AI modeProduction records consumption on Firebase's servers, once per project: the first consume resolves with alreadyConsumed: false and a second with alreadyConsumed: true. Sandbox: firebase-admin verifies the token without consume, and the mirror records it in the process, in the set it keeps for sandbox tokens, with the same false then true results.
app-check-admin-verify-consume; the sandbox side is pinned in the admin suite and the production AI mode app scenario. (Structured evidence: oracle-conformance.test.ts)initializeApp({ credential: cert(serviceAccount) }), then getAppCheck().createToken and verifyTokenAn app initialized with only a cert credential finds its project in the service account's project_id (or projectId), so createToken mints a token whose aud names projects/<project_id> and verifyToken accepts it. The projectId app option wins over the credential, and the credential wins over GOOGLE_CLOUD_PROJECT and GCLOUD_PROJECT. The project id is not copied into app.options.
lib/utils/index.js (getExplicitProjectId) and lib/app/credential-internal.js (ServiceAccount, copyAttr). No capture; the project is resolved locally in the Admin SDK.firebase-admin createToken options, checked against production captures
Each row cites a production capture from the App Check and AI Logic hunt. A bug row states production’s behavior and pyric’s; its replay holds both answers until the fix lands.
getAppCheck().createToken(appId, { limitedUse: true, jti }) twice, then verifyToken(token, { consume: true })AC-1: pyric ignores jti, so two same-jti tokens differ and both first consumes say false; in production a second consume of the same jti says alreadyConsumed: true.
oracle:app-check-admin-options-create-token and oracle:app-check-admin-options-same-jti-consume. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken(appId, { jti }) / ({ limitedUse: "yes" }) / ({ limitedUse: true, jti: 5 })AC-1c, AC-1d, AC-1e: production rejects jti without limitedUse, a non-boolean limitedUse and a non-string jti; pyric mints a token.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken(appId, { limitedUse: true })AC-1f: production limited-use tokens live 300 s; pyric gives them 3600 s.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken(appId, null | "str" | [] | { ttlMillis: null })AC-2: production throws for null, string or array options and a null ttlMillis; pyric mints a token.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken(appId, { ttlMillis: NaN | "1800000" })AC-3: for a ttlMillis that is not a number, pyric gives the range message instead of production's duration message.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken("") / createToken(appId, { ttlMillis: 1 }) and the other local option checksAC-4: production throws createToken input errors synchronously; pyric returns a rejected promise.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken(appId, { ttlMillis: 1800999 | 1800000.5 })AC-5: for fractional ttlMillis pyric echoes the value and floors the lifetime; production rounds both.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().verifyToken(token, { consume: true })AC-12: the consume result key order is alreadyConsumed, appId, token in production; pyric puts alreadyConsumed last.
oracle:app-check-admin-options-same-jti-consume. (Structured evidence: hunt-captures.test.ts)Current gaps
Documented divergences
Known differences between Pyric and production Firebase. Each remains tracked as a non-conforming row.
onTokenChanged(appCheck, listener | observer)Production, debug mode: listeners and observers registered before the first getToken are never called, not by the first token, a forced refresh, or limited-use tokens. Sandbox: they are called once each time the cached token changes (the first token and every forced refresh), never for limited-use tokens, and not after unsubscribing, which is the upstream-documented behavior for an attestation provider.
app-check-client-on-token-changed (every listenerCalls* count is 0). The sandbox side and the attested-provider behavior are pinned in the suite; the attested-provider path is upstream-documented, not captured. (Structured evidence: oracle-conformance.test.ts, scenario.ts)getAppCheck().createToken(unknownAppId)Production: an app id the project does not own rejects with app-check/unknown-error and the message App not registered: <appId>. Sandbox: it has no list of the project's registered apps, so it mints a token for any non-empty app id; an empty app id rejects with app-check/invalid-argument.
app-check-admin-create-token-unknown-app; the sandbox side is pinned in the admin suite. (Structured evidence: oracle-conformance.test.ts)getAppCheck().verifyToken(firebaseToken) in sandbox AI modeProduction verifies the App Check tokens Firebase issues. Sandbox: in sandbox AI mode, or in a process not started with @pyric/cli/register in production AI mode, a token whose kid names a key other than the sandbox's rejects with app-check/invalid-argument and Pyric's message, which says the token was not minted by the Pyric sandbox and to start the server in production AI mode (PYRIC_AI_MODE=production). The project check comes first, as in production.
app-check-admin-verify-token (production verifies a token from its debug exchange); the sandbox side is pinned in the admin suite. (Structured evidence: oracle-conformance.test.ts)getAppCheck().verifyToken(firebaseToken, { consume: true }) in production AI modeProduction records consumption on Firebase's servers, once per project: the first consume resolves with alreadyConsumed: false and a second with alreadyConsumed: true. Sandbox: firebase-admin verifies the token without consume, and the mirror records it in the process, in the set it keeps for sandbox tokens, with the same false then true results.
app-check-admin-verify-consume; the sandbox side is pinned in the admin suite and the production AI mode app scenario. (Structured evidence: oracle-conformance.test.ts)Bugs
Behavior that should match production Firebase but currently does not.
getAppCheck().createToken(appId, { limitedUse: true, jti }) twice, then verifyToken(token, { consume: true })AC-1: pyric ignores jti, so two same-jti tokens differ and both first consumes say false; in production a second consume of the same jti says alreadyConsumed: true.
oracle:app-check-admin-options-create-token and oracle:app-check-admin-options-same-jti-consume. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken(appId, { jti }) / ({ limitedUse: "yes" }) / ({ limitedUse: true, jti: 5 })AC-1c, AC-1d, AC-1e: production rejects jti without limitedUse, a non-boolean limitedUse and a non-string jti; pyric mints a token.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken(appId, { limitedUse: true })AC-1f: production limited-use tokens live 300 s; pyric gives them 3600 s.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken(appId, null | "str" | [] | { ttlMillis: null })AC-2: production throws for null, string or array options and a null ttlMillis; pyric mints a token.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken(appId, { ttlMillis: NaN | "1800000" })AC-3: for a ttlMillis that is not a number, pyric gives the range message instead of production's duration message.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken("") / createToken(appId, { ttlMillis: 1 }) and the other local option checksAC-4: production throws createToken input errors synchronously; pyric returns a rejected promise.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().createToken(appId, { ttlMillis: 1800999 | 1800000.5 })AC-5: for fractional ttlMillis pyric echoes the value and floors the lifetime; production rounds both.
oracle:app-check-admin-options-create-token. (Structured evidence: hunt-captures.test.ts)getAppCheck().verifyToken(token, { consume: true })AC-12: the consume result key order is alreadyConsumed, appId, token in production; pyric puts alreadyConsumed last.
oracle:app-check-admin-options-same-jti-consume. (Structured evidence: hunt-captures.test.ts)Not implemented yet
Tracked behavior that is not implemented in the current contract.
getToken / getLimitedUseToken when attestation failsWhen the exchange is refused (an unregistered debug token), both reject with a FirebaseError with code appCheck/fetch-status-error and customData.httpStatus 403.
POST projects/{projectId}/apps/{appId}:exchangeDebugToken?key=A registered debug token exchanges for { token, ttl: "3600s" }; an unregistered one fails 403 PERMISSION_DENIED with message App attestation failed.
app-check-exchange-debug-token-wire.Unverified
Tracked behavior whose available evidence does not yet establish the production result.
getToken(appCheck), getLimitedUseToken(appCheck) with a CustomProvider and no debug tokenWith FIREBASE_APPCHECK_DEBUG_TOKEN neither true nor a string, the SDK calls the CustomProvider and returns its token as given, caching it until its expireTimeMillis. When the provider rejects, getToken and getLimitedUseToken reject with its error, an onTokenChanged error handler receives it. AI Logic then depends on the handle: by default it gets the placeholder token, which the sandbox refuses with the 401, and with useLimitedUseAppCheckTokens: true no request is sent and the call rejects with AIError code error, message Error fetching from <url>: <provider message>.
@firebase/app-check 0.11.3 dist/esm/index.esm.js: initializeDebugMode (lines 638 to 657), getToken$2 (the provider path from line 783, makeDummyTokenResult on error), getLimitedUseToken$1 (lines 847 to 861, no placeholder), CustomProvider.getToken (lines 1374 to 1388), and the public getToken rethrowing result.error; @firebase/ai 2.12.0 dist/esm/index.esm.js getHeaders (line 1619) awaited inside makeRequest's try, whose catch wraps the rejection (line 1717). A real-SDK Node run in the ai-app-check hunt (GATE-1) saw the provider called and its token, or the placeholder, sent to AI Logic. No committed capture.new ReCaptchaV3Provider(siteKey); new ReCaptchaEnterpriseProvider(siteKey)Both reCAPTCHA providers construct from a site key and are accepted by initializeAppCheck in a realm with a document, such as a page.
initializeAppCheck(app, { provider: new ReCaptchaV3Provider(siteKey) }) with no `document`, and the same for ReCaptchaEnterpriseProviderWhere there is no document, such as a Node process or a server-rendered module, initializeAppCheck with either reCAPTCHA provider throws ReferenceError: document is not defined synchronously, with or without FIREBASE_APPCHECK_DEBUG_TOKEN. App Check is already set up for the app when it throws: a second call with the same options returns the handle, and one with other options throws appCheck/already-initialized.
@firebase/app-check 0.11.3 dist/esm/index.esm.js: initializeAppCheck creates the instance (line 1511) before _activate marks the app activated and calls provider.initialize last (line 1559); ReCaptchaV3Provider.initialize (line 1270) and ReCaptchaEnterpriseProvider.initialize (line 1347) call initializeV3 and initializeEnterprise, whose makeDiv reads document (line 1133). A real-SDK run in plain Node 24 (firebase 12.13.0, offline) saw each provider throw the ReferenceError, debug token or not, then return the instance for the same options and throw appCheck/already-initialized for another site key. The package has no Node build. No committed capture. Integration: test/apps/sandbox-app-check (a registered Node process and a Vite server-rendered module).getAppCheck().verifyToken(token, options) with bad input, on another project, or with a foreign issuer, algorithm, subject, key, nbf, or expOptions that are not a non-null object throw app-check/invalid-argument with VerifyAppCheckTokenOptions must be a non-null object., and a token that is not a string throws App check token must be a non-null string.; both throw synchronously. Then, with no project id configured, app-check/invalid-credential. A token with a character outside base64url in any segment fails with the decoding message. Before the signature, the token content is checked in this order: a header alg other than RS256 rejects with The provided App Check token has incorrect algorithm. Expected "RS256" but got "<alg>".; an aud without projects/<projectId> of the verifying app rejects with app-check/invalid-argument and The provided App Check token has incorrect "aud" (audience) claim. Expected "projects/<projectId>" but got "<aud>". Make sure the App Check token comes from the same Firebase project as the service account used to authenticate this SDK.; an iss not starting with https://firebaseappcheck.googleapis.com/ rejects with The provided App Check token has incorrect "iss" (issuer) claim.; a sub that is not a string rejects with The provided App Check token has no "sub" (subject) claim., and an empty one with The provided App Check token has an empty string "sub" (subject) claim. Then a token with no kid is checked against every key. A kid that names a key other than the sandbox's marks a token from Firebase: in sandbox AI mode it rejects with Pyric's message (row verify-token-firebase-token), and in production AI mode it goes to firebase-admin (row verify-token-firebase-token-production-ai-mode). After the signature, a non-numeric or future nbf and a non-numeric exp reject as an invalid signature; an absent nbf or exp does not apply.
lib/app-check/token-verifier.js (verifyToken, verifyContent, ensureProjectId, mapJwtErrorToAppCheckError), lib/utils/jwt.js (getKeyCallback, PublicKeySignatureVerifier.verify), jws 4 verify-stream.js (JWS_REGEX), and jsonwebtoken 9 verify.js (nbf, exp). No capture; verification runs locally in the Admin SDK, so a capture would need no production change.getAppCheck().verifyToken(firebaseToken) under @pyric/cli/register in production AI modeA token whose kid names a key other than the sandbox's goes to firebase-admin's own verifyToken, for an app scoped to the project the mirror resolves. It resolves with production's { appId, token } shape, the decoded token carrying app_id, and firebase-admin's errors (signature, audience, issuer, expiry) pass through with their codes and messages. Sandbox tokens, tokens with no kid, and malformed tokens keep the sandbox path.
app-check-admin-verify-token for the result shape; the verification itself is firebase-admin 13.10.0 lib/app-check/token-verifier.js, run unchanged.initializeApp({ credential: cert(serviceAccount) }), then getAppCheck().createToken and verifyTokenAn app initialized with only a cert credential finds its project in the service account's project_id (or projectId), so createToken mints a token whose aud names projects/<project_id> and verifyToken accepts it. The projectId app option wins over the credential, and the credential wins over GOOGLE_CLOUD_PROJECT and GCLOUD_PROJECT. The project id is not copied into app.options.
lib/utils/index.js (getExplicitProjectId) and lib/app/credential-internal.js (ServiceAccount, copyAttr). No capture; the project is resolved locally in the Admin SDK.