Add TX device-verification region to debug config

Add a US-TX region to the debug config with verificationMethods
['device', 'kws'], plus a useRealDeviceSignalsAPI escape hatch (default
off) so the real native age API can be exercised in debug mode instead of
the faked deviceSignals.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Eric Bailey
2026-06-23 16:32:31 -05:00
parent 18f8d360cb
commit 2bfc1e6166
2 changed files with 13 additions and 6 deletions
+2 -1
View File
@@ -503,7 +503,8 @@ export function createDeviceSignalsQueryKey({did}: {did: string}) {
export async function getDeviceSignals(): Promise< export async function getDeviceSignals(): Promise<
AgeRange.AgeRangeResponse | undefined AgeRange.AgeRangeResponse | undefined
> { > {
if (debug.enabled) return debug.resolve(debug.deviceSignals) if (debug.enabled && !debug.useRealDeviceSignalsAPI)
return debug.resolve(debug.deviceSignals)
if (!IS_NATIVE) return undefined if (!IS_NATIVE) return undefined
try { try {
return await AgeRange.requestAgeRangeAsync({ return await AgeRange.requestAgeRangeAsync({
+11 -5
View File
@@ -18,7 +18,7 @@ export type DebugConfig = {
regions: AgeAssuranceConfigRegion[] regions: AgeAssuranceConfigRegion[]
} }
export const enabled = (IS_DEV && true) || IS_E2E export const enabled = (IS_DEV && false) || IS_E2E
export const geolocation: Geolocation | undefined = enabled export const geolocation: Geolocation | undefined = enabled
? { ? {
@@ -27,6 +27,13 @@ export const geolocation: Geolocation | undefined = enabled
} }
: undefined : undefined
/**
* When debug is enabled we normally fake `deviceSignals` too. Flip this to hit
* the real native age API (`expo-age-range`) so the OS age prompt actually
* shows — useful for testing the device flow on a physical device.
*/
export const useRealDeviceSignalsAPI = false
const deviceGeolocationEnabled = false || IS_E2E const deviceGeolocationEnabled = false || IS_E2E
export const deviceGeolocation: Geolocation | undefined = export const deviceGeolocation: Geolocation | undefined =
enabled && deviceGeolocationEnabled enabled && deviceGeolocationEnabled
@@ -69,10 +76,9 @@ export const config: DebugConfig = {
], ],
}, },
{ {
// On-device verification region (e.g. Texas). Set debug.geolocation to // On-device verification region. KWS is included as a fallback for
// {countryCode: 'US', regionCode: 'TX'} to exercise the device flow. // platforms without the native age API (e.g. web) or when the device
// KWS is included as a fallback for platforms without the native age API // result is insufficient.
// (e.g. web) or when the device result is insufficient.
countryCode: 'US', countryCode: 'US',
regionCode: 'TX', regionCode: 'TX',
minAccessAge: 18, minAccessAge: 18,