truescene-face-id-capture-sdk 1.0.0

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 ADDED
@@ -0,0 +1,77 @@
1
+ # TrueScene Capture SDK
2
+
3
+ Framework-agnostic video capture and ID verification delivered as a Web Component,
4
+ with a thin React wrapper for React apps. The SDK performs the capture flow and
5
+ calls `/comparev2` using a session token you provide.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install truescene-face-capture
11
+ ```
12
+
13
+ ## Web Component (primary)
14
+
15
+ Import the SDK once to register the custom element, then render it anywhere.
16
+
17
+ ```html
18
+ <script type="module">
19
+ import 'truescene-face-capture'
20
+ </script>
21
+
22
+ <truescene-capture
23
+ session-token="YOUR_SESSION_TOKEN"
24
+ compare-url="/comparev2"
25
+ auto-start
26
+ ></truescene-capture>
27
+ ```
28
+
29
+ ### Attributes
30
+
31
+ - `session-token` (required): token from your backend.
32
+ - `compare-url` (optional): defaults to `/comparev2`.
33
+ - `token-header` (optional): header name for the token, default `Authorization`.
34
+ - `token-prefix` (optional): header prefix, default `Bearer`.
35
+ - `token-field` (optional): body field name for the token, default `session_token`.
36
+ - `auto-start` (optional): start immediately when token is present.
37
+ - `show-debug` (optional): show debug panel by default.
38
+ - `debug-toggle` (optional): show the debug toggle button.
39
+
40
+ ### Events
41
+
42
+ - `ready-change` → `{ faceReady, idReady }`
43
+ - `step-change` → `CaptureStep`
44
+ - `metrics-change` → `FaceAndIdCaptureMetrics`
45
+ - `capture` → `{ faceImage, idImage, fullImage }`
46
+ - `compare-result` → `CompareResult | null`
47
+ - `compare-error` → `string | null`
48
+ - `error` → `string`
49
+
50
+ ## React wrapper
51
+
52
+ The React wrapper renders the Web Component and maps its events to props.
53
+
54
+ ```tsx
55
+ import TrueSceneCapture from 'truescene-face-capture/react'
56
+
57
+ <TrueSceneCapture
58
+ sessionToken={sessionToken}
59
+ compareUrl="/comparev2"
60
+ autoStart
61
+ onCompareResult={(result) => console.log(result)}
62
+ />
63
+ ```
64
+
65
+ ## Session token flow
66
+
67
+ 1. Your backend issues a session token (after authenticating the end user).
68
+ 2. Pass the token to the SDK via `session-token` (or `sessionToken` in React).
69
+ 3. The SDK sends the token in:
70
+ - `Authorization: Bearer <token>` header (configurable), and
71
+ - `session_token` field in the request body (configurable).
72
+
73
+ ## Development
74
+
75
+ - `npm run dev` runs the demo app.
76
+ - `npm run build:demo` builds the demo app to `dist-demo/`.
77
+ - `npm run build` builds the SDK to `dist/`.
@@ -0,0 +1,3 @@
1
+ /comparev2 http://13.60.232.144:3031/comparev2 200
2
+ /comparev2/* http://13.60.232.144:3031/:splat 200
3
+ /compare/* http://13.60.232.144:3031/:splat 200