@velion-la/onboarding-sdk-react-native 1.2.0-beta.1 → 1.2.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -17
- package/lib/commonjs/camera/DocumentCapture.js +57 -35
- package/lib/commonjs/camera/DocumentCapture.js.map +1 -1
- package/lib/commonjs/camera/LivenessCamera.js +137 -86
- package/lib/commonjs/camera/LivenessCamera.js.map +1 -1
- package/lib/commonjs/camera/MapAddressPicker.js +1 -1
- package/lib/commonjs/camera/MapAddressPicker.js.map +1 -1
- package/lib/commonjs/steps/DocumentsOcrStep.js +140 -20
- package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -1
- package/lib/commonjs/steps/LivenessMatchStep.js +101 -39
- package/lib/commonjs/steps/LivenessMatchStep.js.map +1 -1
- package/lib/commonjs/transport/irisWebSocket.js +38 -3
- package/lib/commonjs/transport/irisWebSocket.js.map +1 -1
- package/lib/commonjs/ui/icons/StepIcon.js +8 -3
- package/lib/commonjs/ui/icons/StepIcon.js.map +1 -1
- package/lib/commonjs/ui/overlays/LoadingOverlay.js +1 -1
- package/lib/commonjs/ui/overlays/LoadingOverlay.js.map +1 -1
- package/lib/commonjs/ui/overlays/RetryDialog.js +1 -1
- package/lib/commonjs/ui/overlays/RetryDialog.js.map +1 -1
- package/lib/commonjs/utils/jpegFromUri.js +54 -14
- package/lib/commonjs/utils/jpegFromUri.js.map +1 -1
- package/lib/module/camera/DocumentCapture.js +58 -36
- package/lib/module/camera/DocumentCapture.js.map +1 -1
- package/lib/module/camera/LivenessCamera.js +138 -87
- package/lib/module/camera/LivenessCamera.js.map +1 -1
- package/lib/module/camera/MapAddressPicker.js +1 -1
- package/lib/module/camera/MapAddressPicker.js.map +1 -1
- package/lib/module/steps/DocumentsOcrStep.js +140 -20
- package/lib/module/steps/DocumentsOcrStep.js.map +1 -1
- package/lib/module/steps/LivenessMatchStep.js +102 -40
- package/lib/module/steps/LivenessMatchStep.js.map +1 -1
- package/lib/module/transport/irisWebSocket.js +38 -3
- package/lib/module/transport/irisWebSocket.js.map +1 -1
- package/lib/module/ui/icons/StepIcon.js +8 -3
- package/lib/module/ui/icons/StepIcon.js.map +1 -1
- package/lib/module/ui/overlays/LoadingOverlay.js +1 -1
- package/lib/module/ui/overlays/LoadingOverlay.js.map +1 -1
- package/lib/module/ui/overlays/RetryDialog.js +1 -1
- package/lib/module/ui/overlays/RetryDialog.js.map +1 -1
- package/lib/module/utils/jpegFromUri.js +52 -14
- package/lib/module/utils/jpegFromUri.js.map +1 -1
- package/lib/typescript/camera/DocumentCapture.d.ts +15 -3
- package/lib/typescript/camera/DocumentCapture.d.ts.map +1 -1
- package/lib/typescript/camera/LivenessCamera.d.ts +35 -9
- package/lib/typescript/camera/LivenessCamera.d.ts.map +1 -1
- package/lib/typescript/steps/DocumentsOcrStep.d.ts.map +1 -1
- package/lib/typescript/steps/LivenessMatchStep.d.ts.map +1 -1
- package/lib/typescript/transport/irisWebSocket.d.ts.map +1 -1
- package/lib/typescript/ui/icons/StepIcon.d.ts +7 -2
- package/lib/typescript/ui/icons/StepIcon.d.ts.map +1 -1
- package/lib/typescript/utils/jpegFromUri.d.ts +31 -10
- package/lib/typescript/utils/jpegFromUri.d.ts.map +1 -1
- package/package.json +20 -14
- package/src/camera/DocumentCapture.tsx +59 -41
- package/src/camera/LivenessCamera.tsx +159 -86
- package/src/camera/MapAddressPicker.tsx +1 -1
- package/src/steps/DocumentsOcrStep.tsx +160 -18
- package/src/steps/LivenessMatchStep.tsx +112 -47
- package/src/transport/irisWebSocket.ts +32 -2
- package/src/ui/icons/StepIcon.tsx +9 -3
- package/src/ui/overlays/LoadingOverlay.tsx +1 -1
- package/src/ui/overlays/RetryDialog.tsx +1 -1
- package/src/utils/jpegFromUri.ts +54 -16
|
@@ -41,7 +41,7 @@ import { StepIcon } from '../ui/icons/StepIcon';
|
|
|
41
41
|
import { mixHex, useTheme } from '../ui/theme';
|
|
42
42
|
import { getStrings } from '../i18n';
|
|
43
43
|
import { log } from '../utils/log';
|
|
44
|
-
import { readJpegFromUri } from '../utils/jpegFromUri';
|
|
44
|
+
import { readBytesFromUri, readJpegFromUri } from '../utils/jpegFromUri';
|
|
45
45
|
import {
|
|
46
46
|
buildSignedFrameEnvelope,
|
|
47
47
|
importHmacKey,
|
|
@@ -58,8 +58,9 @@ import {
|
|
|
58
58
|
LivenessCamera,
|
|
59
59
|
type LivenessCameraHandle,
|
|
60
60
|
type LivenessOvalCue,
|
|
61
|
+
type LivenessVideoFile,
|
|
61
62
|
} from '../camera/LivenessCamera';
|
|
62
|
-
|
|
63
|
+
|
|
63
64
|
import type { ApiCaller } from '../transport/api';
|
|
64
65
|
import type { StepDeps, StepModule } from './types';
|
|
65
66
|
|
|
@@ -75,7 +76,11 @@ const PROGRESS_WATCHDOG_MS = 25_000;
|
|
|
75
76
|
*/
|
|
76
77
|
const LIVENESS_VERIFY_TIMEOUT_MS = 20_000;
|
|
77
78
|
const FRAME_MAX_LONG_EDGE = 720;
|
|
78
|
-
|
|
79
|
+
// Match the web SDK's canvas JPEG (~0.92) closely enough that MiniFAS does
|
|
80
|
+
// not treat block artefacts as a screen replay. 0.55 (the previous value)
|
|
81
|
+
// was the other half of the spoof-false-positive we saw after the v5
|
|
82
|
+
// migration: ZSL fallback JPEGs re-compressed this hard scored `screen ≈ 0.95`.
|
|
83
|
+
const FRAME_QUALITY = 0.85;
|
|
79
84
|
/**
|
|
80
85
|
* Hard ceiling for the video upload PUT to GCS that runs between SESSION_COMPLETE
|
|
81
86
|
* and POST /liveness-verify. Long enough for a 5 MB upload on a slow mobile link
|
|
@@ -209,6 +214,11 @@ function LivenessMatchView({
|
|
|
209
214
|
const framesSentRef = useRef(0);
|
|
210
215
|
const watchdogRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
211
216
|
const finalizingRef = useRef(false);
|
|
217
|
+
// Set when we are about to show the in-flow retry dialog. Iris often
|
|
218
|
+
// closes with 1000 in the same tick as the terminal WARNING, and that close
|
|
219
|
+
// can beat our own 4001 — without this flag the generic onClose would
|
|
220
|
+
// treat a handled rejection as "socket closed before the step finalized".
|
|
221
|
+
const closingForRetryRef = useRef(false);
|
|
212
222
|
const toastTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
213
223
|
// Tracks the toast currently on screen so we can extend its visibility when
|
|
214
224
|
// the same message arrives again (instead of dismount/remount, which made
|
|
@@ -309,7 +319,7 @@ function LivenessMatchView({
|
|
|
309
319
|
}, []);
|
|
310
320
|
|
|
311
321
|
const uploadRecordedVideo = useCallback(
|
|
312
|
-
async (video:
|
|
322
|
+
async (video: LivenessVideoFile): Promise<void> => {
|
|
313
323
|
const target = videoUploadRef.current;
|
|
314
324
|
videoTempPathRef.current = video.path;
|
|
315
325
|
if (!target) {
|
|
@@ -341,29 +351,43 @@ function LivenessMatchView({
|
|
|
341
351
|
});
|
|
342
352
|
const t0 = Date.now();
|
|
343
353
|
try {
|
|
344
|
-
//
|
|
345
|
-
//
|
|
346
|
-
//
|
|
347
|
-
//
|
|
348
|
-
//
|
|
349
|
-
//
|
|
350
|
-
//
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
354
|
+
// Read the bytes with `expo-file-system`, NOT with `fetch(fileUri)`.
|
|
355
|
+
//
|
|
356
|
+
// This reverses what this code used to do, so it is worth spelling
|
|
357
|
+
// out. Under React Native's `fetch` the native Blob was the reliable
|
|
358
|
+
// body and passing bytes sent an empty one. Since Expo SDK 57 the
|
|
359
|
+
// global `fetch` is Expo's native HTTP client
|
|
360
|
+
// (`expo/src/winter/runtime.native.ts` → `install('fetch', ...)`),
|
|
361
|
+
// which does not handle the `file://` scheme: it answers with an empty
|
|
362
|
+
// body instead of failing, so reading the recording through it
|
|
363
|
+
// uploaded a 0-byte object while every status code reported success
|
|
364
|
+
// (OSDKR-22). Expo's `fetch` does accept any `ArrayBuffer.isView` as a
|
|
365
|
+
// request body, so the bytes go up directly.
|
|
366
|
+
const videoBytes = await readBytesFromUri(video.path);
|
|
355
367
|
log.info('[Liveness] video upload body prepared', {
|
|
356
|
-
|
|
357
|
-
blobType: nativeBlob.type,
|
|
368
|
+
bytes: videoBytes.byteLength,
|
|
358
369
|
});
|
|
370
|
+
if (videoBytes.byteLength === 0) {
|
|
371
|
+
throw new Error('Recorded video read back as 0 bytes.');
|
|
372
|
+
}
|
|
359
373
|
const result = await fetch(target.upload_url, {
|
|
360
374
|
method: 'PUT',
|
|
361
375
|
headers: { 'Content-Type': VIDEO_CONTENT_TYPE },
|
|
362
|
-
body:
|
|
376
|
+
body: videoBytes,
|
|
363
377
|
});
|
|
364
378
|
const elapsedMs = Date.now() - t0;
|
|
365
379
|
if (result.ok) {
|
|
366
|
-
|
|
380
|
+
// `sentBytes` is what we actually put on the wire; `sizeBytes` is
|
|
381
|
+
// the file size stat'd before reading. They must match — a mismatch,
|
|
382
|
+
// or an etag that repeats across sessions, means the body never
|
|
383
|
+
// reached the bucket (OSDKR-22).
|
|
384
|
+
log.info('[Liveness] video upload ok', {
|
|
385
|
+
status: result.status,
|
|
386
|
+
sentBytes: videoBytes.byteLength,
|
|
387
|
+
sizeBytes,
|
|
388
|
+
etag: result.headers.get('etag'),
|
|
389
|
+
elapsedMs,
|
|
390
|
+
});
|
|
367
391
|
videoOutcomeRef.current = 'uploaded';
|
|
368
392
|
videoMetaRef.current = {
|
|
369
393
|
content_type: VIDEO_CONTENT_TYPE,
|
|
@@ -413,7 +437,17 @@ function LivenessMatchView({
|
|
|
413
437
|
[deleteVideoTemp],
|
|
414
438
|
);
|
|
415
439
|
|
|
416
|
-
const startVideoRecordingIfEnabled = useCallback(() => {
|
|
440
|
+
const startVideoRecordingIfEnabled = useCallback(async () => {
|
|
441
|
+
// Idempotent on purpose: with the recorder now starting at
|
|
442
|
+
// POSITIONING_READY, the first CHALLENGE calls this again, and both paths
|
|
443
|
+
// are legitimate — positioning can also be skipped entirely.
|
|
444
|
+
//
|
|
445
|
+
// Without this guard the second call would replace the two Deferreds below
|
|
446
|
+
// while the first recording is still running. `LivenessCamera` returns
|
|
447
|
+
// early because it already holds a Recorder, so the fresh promises would
|
|
448
|
+
// never settle and the finalize path would await them forever — the
|
|
449
|
+
// "analyzing" hang from OSDKR-23, reintroduced through a different door.
|
|
450
|
+
if (videoOutcomeRef.current === 'recording') return;
|
|
417
451
|
if (!videoUploadRef.current) {
|
|
418
452
|
log.info('[Liveness] video skipped: no video_upload in liveness-init');
|
|
419
453
|
return;
|
|
@@ -453,7 +487,7 @@ function LivenessMatchView({
|
|
|
453
487
|
};
|
|
454
488
|
});
|
|
455
489
|
try {
|
|
456
|
-
camera.startVideoRecording({
|
|
490
|
+
await camera.startVideoRecording({
|
|
457
491
|
onRecordingFinished: (video) => {
|
|
458
492
|
log.info('[Liveness] video recording finished', {
|
|
459
493
|
path: video.path,
|
|
@@ -580,22 +614,30 @@ function LivenessMatchView({
|
|
|
580
614
|
try {
|
|
581
615
|
const photo = await cameraRef.current?.takeFrame();
|
|
582
616
|
if (!photo || !ws.isOpen()) return;
|
|
583
|
-
//
|
|
584
|
-
//
|
|
585
|
-
// matrix — see the `isMirrored` comment in LivenessCamera). For Iris,
|
|
586
|
-
// we want the un-mirrored yaw so TURN_LEFT/RIGHT challenges map to
|
|
587
|
-
// real-world directions, so we flip the JPEG horizontally here before
|
|
588
|
-
// signing and sending.
|
|
617
|
+
// DO NOT add a horizontal flip here (OSDKR-23). v5 photo capture is
|
|
618
|
+
// already un-mirrored; flipping inverted TURN_LEFT / TURN_RIGHT.
|
|
589
619
|
const compressed = await ImageManipulator.manipulateAsync(
|
|
590
|
-
photo.
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
],
|
|
620
|
+
photo.filePath.startsWith('file://')
|
|
621
|
+
? photo.filePath
|
|
622
|
+
: `file://${photo.filePath}`,
|
|
623
|
+
[{ resize: { width: FRAME_MAX_LONG_EDGE } }],
|
|
595
624
|
{ compress: FRAME_QUALITY, format: ImageManipulator.SaveFormat.JPEG },
|
|
596
625
|
);
|
|
626
|
+
const jpegUri = compressed.uri;
|
|
597
627
|
if (!ws.isOpen()) return;
|
|
598
|
-
const jpeg = await readJpegFromUri(
|
|
628
|
+
const jpeg = await readJpegFromUri(jpegUri);
|
|
629
|
+
// SPIKE (spike/debug-liveness-stall-1): one line every 10th frame saying
|
|
630
|
+
// what actually went on the wire. Iris rejecting frames and Iris never
|
|
631
|
+
// receiving usable frames look identical from here otherwise — the run
|
|
632
|
+
// that produced 14 WARNINGs and zero CHALLENGEs could not be told apart
|
|
633
|
+
// from a positioning problem. Pair it with the WARNING `code` now logged
|
|
634
|
+
// by irisWebSocket: source + bytes on one side, the reason on the other.
|
|
635
|
+
if (framesSentRef.current % 10 === 0) {
|
|
636
|
+
log.info('[Liveness] frame on the wire', {
|
|
637
|
+
bytes: jpeg.byteLength,
|
|
638
|
+
challenge: currentChallengeRef.current ?? null,
|
|
639
|
+
});
|
|
640
|
+
}
|
|
599
641
|
const key = hmacRef.current;
|
|
600
642
|
if (key) {
|
|
601
643
|
const envelope = buildSignedFrameEnvelope({
|
|
@@ -657,6 +699,7 @@ function LivenessMatchView({
|
|
|
657
699
|
|
|
658
700
|
const presentTerminalRetry = useCallback(
|
|
659
701
|
(code: string, message?: string) => {
|
|
702
|
+
closingForRetryRef.current = true;
|
|
660
703
|
stopCapture();
|
|
661
704
|
stopWatchdog();
|
|
662
705
|
try {
|
|
@@ -706,10 +749,11 @@ function LivenessMatchView({
|
|
|
706
749
|
setChallengeText(t.liveness.centerFace);
|
|
707
750
|
showToast('success', t.liveness.getReady);
|
|
708
751
|
startCaptureLoop(FRAME_MS_DEFAULT);
|
|
709
|
-
//
|
|
710
|
-
//
|
|
711
|
-
//
|
|
712
|
-
|
|
752
|
+
// Do not start the evidence recorder yet. MiniFAS and positioning
|
|
753
|
+
// run on these first seconds; a photo+video session on Android
|
|
754
|
+
// produced blurry stills (`LOW_SHARPNESS`) and a screen-replay
|
|
755
|
+
// score. Recording starts on POSITIONING_READY (or the first
|
|
756
|
+
// CHALLENGE if positioning is disabled).
|
|
713
757
|
resetWatchdog();
|
|
714
758
|
return;
|
|
715
759
|
}
|
|
@@ -746,6 +790,9 @@ function LivenessMatchView({
|
|
|
746
790
|
: 'NEUTRAL',
|
|
747
791
|
);
|
|
748
792
|
setProgress(0);
|
|
793
|
+
// Positioning skipped or already passed — start the evidence
|
|
794
|
+
// recorder if it is not running yet (idempotent).
|
|
795
|
+
void startVideoRecordingIfEnabled();
|
|
749
796
|
resetWatchdog();
|
|
750
797
|
return;
|
|
751
798
|
}
|
|
@@ -860,6 +907,9 @@ function LivenessMatchView({
|
|
|
860
907
|
.concat(' — ', baseText)
|
|
861
908
|
: baseText;
|
|
862
909
|
showToast(isPositioningReady ? 'success' : 'warning', text);
|
|
910
|
+
if (isPositioningReady) {
|
|
911
|
+
void startVideoRecordingIfEnabled();
|
|
912
|
+
}
|
|
863
913
|
resetWatchdog();
|
|
864
914
|
return;
|
|
865
915
|
}
|
|
@@ -998,6 +1048,7 @@ function LivenessMatchView({
|
|
|
998
1048
|
setRetry(null);
|
|
999
1049
|
setStatusText(t.liveness.connecting);
|
|
1000
1050
|
finalizingRef.current = false;
|
|
1051
|
+
closingForRetryRef.current = false;
|
|
1001
1052
|
framesSentRef.current = 0;
|
|
1002
1053
|
currentChallengeRef.current = null;
|
|
1003
1054
|
lastChallengeMetaRef.current = null;
|
|
@@ -1083,17 +1134,30 @@ function LivenessMatchView({
|
|
|
1083
1134
|
// — this handler is registered via closure on a stale render,
|
|
1084
1135
|
// so `retry` reads `null` even when we just called `setRetry`.
|
|
1085
1136
|
// The close code is reliable: we always pair 4001 with the
|
|
1086
|
-
// retry-dialog mount.
|
|
1087
|
-
|
|
1137
|
+
// retry-dialog mount. `closingForRetryRef` covers the race where
|
|
1138
|
+
// Iris's own 1000 arrives first (it always closes NORMAL after a
|
|
1139
|
+
// terminal WARNING).
|
|
1140
|
+
if (code === 4001 || closingForRetryRef.current) return;
|
|
1088
1141
|
stopCapture();
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1142
|
+
|
|
1143
|
+
// Reaching here means the socket closed and the step never
|
|
1144
|
+
// finalized, so we do not know how the session ended (OSDKR-23).
|
|
1145
|
+
//
|
|
1146
|
+
// A close code cannot tell us: Iris closes with 1000 after a
|
|
1147
|
+
// successful SESSION_COMPLETE, after CHALLENGE_NOT_CONFIRMED, and
|
|
1148
|
+
// after SPOOF_RISK_HIGH alike. It always sends the deciding message
|
|
1149
|
+
// immediately before closing, so a 1000 here means we lost it.
|
|
1150
|
+
//
|
|
1151
|
+
// This used to `stopWatchdog()` and then return on 1000, which left
|
|
1152
|
+
// the step on the "analyzing" overlay forever with every safety net
|
|
1153
|
+
// disarmed. Route the user into the same recovery a terminal warning
|
|
1154
|
+
// uses instead: the session did not complete as far as we can tell,
|
|
1155
|
+
// and offering a retry is both honest and actionable.
|
|
1156
|
+
log.warn('[Liveness] socket closed before the step finalized', {
|
|
1157
|
+
code,
|
|
1158
|
+
reason,
|
|
1096
1159
|
});
|
|
1160
|
+
presentTerminalRetry('CONNECTION_CLOSED', t.liveness.terminalRetryFallback);
|
|
1097
1161
|
},
|
|
1098
1162
|
});
|
|
1099
1163
|
} catch (err) {
|
|
@@ -1114,12 +1178,13 @@ function LivenessMatchView({
|
|
|
1114
1178
|
failWith,
|
|
1115
1179
|
handleWsMessage,
|
|
1116
1180
|
locale,
|
|
1181
|
+
presentTerminalRetry,
|
|
1117
1182
|
retry,
|
|
1118
1183
|
sessionId,
|
|
1119
1184
|
stopCapture,
|
|
1120
|
-
stopWatchdog,
|
|
1121
1185
|
t.liveness.connecting,
|
|
1122
1186
|
t.liveness.preparingCamera,
|
|
1187
|
+
t.liveness.terminalRetryFallback,
|
|
1123
1188
|
]);
|
|
1124
1189
|
|
|
1125
1190
|
// Re-run after a terminal retry — same cleanup as start, but reuses the
|
|
@@ -122,11 +122,36 @@ export function openIrisWebSocket(opts: IrisOpenOptions): IrisConnection {
|
|
|
122
122
|
|
|
123
123
|
ws.onmessage = (event: WebSocketMessageEvent) => {
|
|
124
124
|
if (typeof event.data !== 'string') return;
|
|
125
|
+
|
|
126
|
+
// Parsing and handling are deliberately in SEPARATE try blocks (OSDKR-23).
|
|
127
|
+
// They used to share one, so a `catch` written to ignore non-JSON noise
|
|
128
|
+
// also swallowed every exception thrown by the handler. A message that
|
|
129
|
+
// arrived and blew up looked exactly like a message that never arrived —
|
|
130
|
+
// which is how a hung liveness step went undiagnosed.
|
|
131
|
+
let parsed: IrisServerMessage;
|
|
125
132
|
try {
|
|
126
|
-
|
|
127
|
-
opts.onMessage(parsed);
|
|
133
|
+
parsed = JSON.parse(event.data) as IrisServerMessage;
|
|
128
134
|
} catch {
|
|
129
135
|
// Iris only sends JSON; ignore noise.
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Logged before dispatch so the record exists even if the handler throws.
|
|
140
|
+
// This is the line that answers "did SESSION_COMPLETE / the WARNING
|
|
141
|
+
// actually arrive?", which nothing could answer before.
|
|
142
|
+
log.info('[IrisWS] message', {
|
|
143
|
+
type: parsed.type,
|
|
144
|
+
...(parsed.code != null ? { code: parsed.code } : {}),
|
|
145
|
+
...(parsed.message != null ? { message: parsed.message } : {}),
|
|
146
|
+
...(parsed.consecutiveMisses != null
|
|
147
|
+
? { consecutiveMisses: parsed.consecutiveMisses }
|
|
148
|
+
: {}),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
try {
|
|
152
|
+
opts.onMessage(parsed);
|
|
153
|
+
} catch (err) {
|
|
154
|
+
log.error('[IrisWS] message handler threw', { type: parsed.type, err });
|
|
130
155
|
}
|
|
131
156
|
};
|
|
132
157
|
|
|
@@ -183,4 +208,9 @@ export const TERMINAL_WARNING_CODES = new Set<string>([
|
|
|
183
208
|
'SPOOF_RISK_HIGH',
|
|
184
209
|
'SESSION_TERMINATED',
|
|
185
210
|
'BIOMETRIC_LOCK',
|
|
211
|
+
// Iris sends this and immediately closes with 1000 when the session ran
|
|
212
|
+
// to the end without confirming every challenge. If we treat it as a
|
|
213
|
+
// toast, the close wins a race and the step looks like a hung socket.
|
|
214
|
+
'CHALLENGE_NOT_CONFIRMED',
|
|
215
|
+
'CHALLENGE_FAILED_TERMINAL',
|
|
186
216
|
]);
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview StepIcon — small wrapper around `MaterialIcons
|
|
3
|
-
* `@expo/vector-icons
|
|
2
|
+
* @fileoverview StepIcon — small wrapper around `MaterialIcons`, shipped with
|
|
3
|
+
* `@expo/vector-icons`.
|
|
4
|
+
*
|
|
5
|
+
* That package is an OPTIONAL peer dependency the host installs itself. It
|
|
6
|
+
* used to arrive for free because `expo` depended on it, but `expo@57` dropped
|
|
7
|
+
* that dependency, so relying on it silently blanked every step icon
|
|
8
|
+
* (OSDKR-21). Nothing here assumes it is present.
|
|
4
9
|
*
|
|
5
10
|
* Steps pass an icon by name (e.g. `<StepIcon name="badge" />`) and the
|
|
6
11
|
* shell renders it inside the colored circle next to the title. When the
|
|
@@ -46,7 +51,8 @@ try {
|
|
|
46
51
|
} catch {
|
|
47
52
|
log.warn(
|
|
48
53
|
'[StepIcon] @expo/vector-icons is not installed — step header icons will be hidden. ' +
|
|
49
|
-
'
|
|
54
|
+
'Install it (`npx expo install @expo/vector-icons`) or set VelionTheme.hideStepIcons=true. ' +
|
|
55
|
+
'Note it is no longer bundled with expo: since SDK 57 the host has to add it explicitly.',
|
|
50
56
|
);
|
|
51
57
|
}
|
|
52
58
|
|
|
@@ -88,7 +88,7 @@ export function LoadingOverlay({ message }: LoadingOverlayProps) {
|
|
|
88
88
|
|
|
89
89
|
const styles = StyleSheet.create({
|
|
90
90
|
root: {
|
|
91
|
-
...StyleSheet.
|
|
91
|
+
...StyleSheet.absoluteFill,
|
|
92
92
|
alignItems: 'center',
|
|
93
93
|
justifyContent: 'center',
|
|
94
94
|
paddingHorizontal: 32,
|
package/src/utils/jpegFromUri.ts
CHANGED
|
@@ -5,14 +5,23 @@
|
|
|
5
5
|
* path into either base64 (for the Iris HMAC envelope) or raw bytes (for
|
|
6
6
|
* binary WebSocket frames + direct PUT to signed URLs).
|
|
7
7
|
*
|
|
8
|
-
* Why not `fetch(uri)
|
|
8
|
+
* Why not `fetch(uri)`?
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* Two independent reasons, and the second one is the load-bearing one now:
|
|
11
|
+
*
|
|
12
|
+
* 1. React Native's Blob polyfill does NOT implement `Blob.arrayBuffer()`
|
|
13
|
+
* (it's web-only) — calling it throws `blob.arrayBuffer is not a
|
|
14
|
+
* function`.
|
|
15
|
+
* 2. **`fetch` cannot read local files at all since Expo SDK 57.** Expo now
|
|
16
|
+
* replaces the global `fetch` (`expo/src/winter/runtime.native.ts`:
|
|
17
|
+
* `install('fetch', ...)`) with a native HTTP client, and that client does
|
|
18
|
+
* not handle the `file://` scheme. It answers with an empty body instead
|
|
19
|
+
* of failing, so anything reading a capture through `fetch` silently
|
|
20
|
+
* uploads 0 bytes (OSDKR-22). SDK 54 did not install it, which is why the
|
|
21
|
+
* old code worked.
|
|
22
|
+
*
|
|
23
|
+
* `File.arrayBuffer()` from `expo-file-system` reads straight from disk and is
|
|
24
|
+
* unaffected by either.
|
|
16
25
|
*/
|
|
17
26
|
|
|
18
27
|
import { File } from 'expo-file-system';
|
|
@@ -25,18 +34,47 @@ export interface JpegFromUri {
|
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* Accepts both forms vision-camera returns (`/var/mobile/...` without a
|
|
31
|
-
* scheme on iOS; `file:///data/...` on Android). Normalises to `file://`.
|
|
37
|
+
* Normalises the path forms vision-camera returns (`/var/mobile/...` without a
|
|
38
|
+
* scheme on iOS; `file:///data/...` on Android) to a `file://` URI.
|
|
32
39
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
function normalise(uri: string): string {
|
|
41
|
+
return uri.startsWith('file://') || uri.startsWith('http')
|
|
35
42
|
? uri
|
|
36
43
|
: `file://${uri}`;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Reads a local file into raw bytes.
|
|
48
|
+
*
|
|
49
|
+
* Prefer this over `readJpegFromUri` when the caller only needs the bytes —
|
|
50
|
+
* uploads, for instance. It skips the base64 encoding, which is pure waste for
|
|
51
|
+
* a multi-megabyte video.
|
|
52
|
+
*/
|
|
53
|
+
export async function readBytesFromUri(uri: string): Promise<Uint8Array> {
|
|
54
|
+
const buf = await new File(normalise(uri)).arrayBuffer();
|
|
55
|
+
return new Uint8Array(buf);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Size of a local file in bytes, or `0` when it cannot be read.
|
|
60
|
+
*
|
|
61
|
+
* Reads the filesystem metadata instead of loading the contents, so it stays
|
|
62
|
+
* cheap enough to call before an upload.
|
|
63
|
+
*/
|
|
64
|
+
export function byteLengthOfUri(uri: string): number {
|
|
65
|
+
try {
|
|
66
|
+
const size = new File(normalise(uri)).size;
|
|
67
|
+
return typeof size === 'number' ? size : 0;
|
|
68
|
+
} catch {
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Reads a `file://` URI into JPEG bytes + base64 representation.
|
|
75
|
+
*/
|
|
76
|
+
export async function readJpegFromUri(uri: string): Promise<JpegFromUri> {
|
|
77
|
+
const bytes = await readBytesFromUri(uri);
|
|
40
78
|
const base64 = bytesToBase64(bytes);
|
|
41
79
|
return { bytes, base64, byteLength: bytes.byteLength };
|
|
42
80
|
}
|