@velion-la/onboarding-sdk-react-native 1.2.0-beta.1 → 1.2.0-beta.11
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 +240 -87
- 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/i18n/strings/en.js +1 -0
- package/lib/commonjs/i18n/strings/en.js.map +1 -1
- package/lib/commonjs/i18n/strings/es.js +1 -0
- package/lib/commonjs/i18n/strings/es.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 +361 -63
- 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 +242 -89
- 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/i18n/strings/en.js +1 -0
- package/lib/module/i18n/strings/en.js.map +1 -1
- package/lib/module/i18n/strings/es.js +1 -0
- package/lib/module/i18n/strings/es.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 +364 -66
- 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 +101 -10
- package/lib/typescript/camera/LivenessCamera.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/en.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/es.d.ts +1 -0
- package/lib/typescript/i18n/strings/es.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 +283 -89
- package/src/camera/MapAddressPicker.tsx +1 -1
- package/src/i18n/strings/en.ts +2 -0
- package/src/i18n/strings/es.ts +2 -0
- package/src/steps/DocumentsOcrStep.tsx +160 -18
- package/src/steps/LivenessMatchStep.tsx +416 -89
- 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
|
@@ -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
|
}
|