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 +77 -0
- package/dist/_redirects +3 -0
- package/dist/components/FaceAndIdCapture.js +628 -0
- package/dist/index.js +26005 -0
- package/dist/sdk/CaptureExperience.js +241 -0
- package/dist/sdk/element.js +221 -0
- package/dist/sdk/react/index.js +125 -0
- package/dist/sdk/styles.js +2 -0
- package/dist/sdk/types.js +1 -0
- package/dist/types/components/FaceAndIdCapture.d.ts +47 -0
- package/dist/types/sdk/CaptureExperience.d.ts +26 -0
- package/dist/types/sdk/element.d.ts +27 -0
- package/dist/types/sdk/index.d.ts +4 -0
- package/dist/types/sdk/react/index.d.ts +42 -0
- package/dist/types/sdk/styles.d.ts +1 -0
- package/dist/types/sdk/types.d.ts +13 -0
- package/dist/types/utils/config.d.ts +52 -0
- package/dist/types/utils/faceAnalysis.d.ts +26 -0
- package/dist/types/utils/faceChecks.d.ts +19 -0
- package/dist/types/utils/idPlacement.d.ts +13 -0
- package/dist/types/utils/overlayDraw.d.ts +15 -0
- package/dist/utils/config.js +44 -0
- package/dist/utils/faceAnalysis.js +144 -0
- package/dist/utils/faceChecks.js +84 -0
- package/dist/utils/idPlacement.js +66 -0
- package/dist/utils/overlayDraw.js +96 -0
- package/dist/verification-login-svgrepo-com.svg +45 -0
- package/dist/vite.svg +1 -0
- package/package.json +67 -0
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/`.
|
package/dist/_redirects
ADDED