Clarify logic, add comment
This commit is contained in:
@@ -419,6 +419,11 @@ function AccessSection() {
|
|||||||
}, [control, ax, hasInitiated])
|
}, [control, ax, hasInitiated])
|
||||||
|
|
||||||
const onPressVerify = useCallback(async () => {
|
const onPressVerify = useCallback(async () => {
|
||||||
|
const did = currentAccount?.did
|
||||||
|
|
||||||
|
// Just for typescript, this screen won't be shown without a logged in user
|
||||||
|
if (!did) return
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In regions that permit on-device verification, try the native age API
|
* In regions that permit on-device verification, try the native age API
|
||||||
* first. We tag the result with the current region (device assurance is
|
* first. We tag the result with the current region (device assurance is
|
||||||
@@ -434,7 +439,6 @@ function AccessSection() {
|
|||||||
* a session DID.
|
* a session DID.
|
||||||
*/
|
*/
|
||||||
if (allowsDeviceVerification) {
|
if (allowsDeviceVerification) {
|
||||||
const did = currentAccount?.did
|
|
||||||
// Show a loading state while the OS age prompt is up.
|
// Show a loading state while the OS age prompt is up.
|
||||||
setIsVerifyingDevice(true)
|
setIsVerifyingDevice(true)
|
||||||
let signals: AgeRange.AgeRangeResponse | undefined
|
let signals: AgeRange.AgeRangeResponse | undefined
|
||||||
@@ -443,7 +447,7 @@ function AccessSection() {
|
|||||||
} finally {
|
} finally {
|
||||||
setIsVerifyingDevice(false)
|
setIsVerifyingDevice(false)
|
||||||
}
|
}
|
||||||
if (signals && did) {
|
if (signals) {
|
||||||
const {assuredAge} = getAgeAssuranceDataFromDeviceSignals(
|
const {assuredAge} = getAgeAssuranceDataFromDeviceSignals(
|
||||||
region,
|
region,
|
||||||
signals,
|
signals,
|
||||||
|
|||||||
@@ -501,6 +501,10 @@ export function createDeviceSignalsQueryKey({did}: {did: string}) {
|
|||||||
*
|
*
|
||||||
* Native-only: on web `expo-age-range` returns a misleading default (e.g.
|
* Native-only: on web `expo-age-range` returns a misleading default (e.g.
|
||||||
* `{lowerBound: 18}`), so we never call it there — web users fall back to KWS.
|
* `{lowerBound: 18}`), so we never call it there — web users fall back to KWS.
|
||||||
|
*
|
||||||
|
* If this method throws for whatever reason, we catch and log the error and
|
||||||
|
* return undefined. The caller should treat undefined as "no device signals
|
||||||
|
* available" and fall back to KWS.
|
||||||
*/
|
*/
|
||||||
export async function getDeviceSignals(): Promise<
|
export async function getDeviceSignals(): Promise<
|
||||||
AgeRange.AgeRangeResponse | undefined
|
AgeRange.AgeRangeResponse | undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user