Download mobile/src/utils/pairing/securePairingFeature.ts from Anirudh1950/MentraOS: direct link, hf CLI and curl.
- Browser
- Download file 706 Bytes
-
https://huggingface.co/Anirudh1950/MentraOS/resolve/main/mobile/src/utils/pairing/securePairingFeature.ts
- Command line
-
hf download hf://Anirudh1950/MentraOS/mobile/src/utils/pairing/securePairingFeature.ts
-
curl -L -o securePairingFeature.ts https://huggingface.co/Anirudh1950/MentraOS/resolve/main/mobile/src/utils/pairing/securePairingFeature.ts
706 Bytes
| /** | |
| * Expo Router stores route params as strings, so a legacy advertisement's | |
| * `false` arrives as `"false"`. Missing means the scan did not say. | |
| */ | |
| export const parseOptionalBoolean = (value: unknown): boolean | undefined => { | |
| if (typeof value === "boolean") return value | |
| if (value === "true") return true | |
| if (value === "false") return false | |
| return undefined | |
| } | |
| /** | |
| * Prefer the device payload. JSON keeps the original boolean when the separate | |
| * route flag is dropped or stringified. | |
| */ | |
| export const advertisedSecurePairingCapable = (routeValue: unknown, deviceValue: unknown): boolean | undefined => | |
| parseOptionalBoolean(deviceValue) ?? parseOptionalBoolean(routeValue) | |