@simprints/simface-sdk 0.6.1 → 0.7.1
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 +52 -4
- package/dist/components/simface-capture.d.ts +15 -17
- package/dist/components/simface-capture.js +173 -226
- package/dist/components/simface-capture.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/services/camera.d.ts +8 -12
- package/dist/services/camera.js +197 -361
- package/dist/services/camera.js.map +1 -1
- package/dist/services/face-quality.js +6 -6
- package/dist/services/face-quality.js.map +1 -1
- package/dist/shared/capture-flow.d.ts +28 -0
- package/dist/shared/capture-flow.js +61 -0
- package/dist/shared/capture-flow.js.map +1 -0
- package/dist/shared/capture-runtime.d.ts +21 -0
- package/dist/shared/capture-runtime.js +183 -0
- package/dist/shared/capture-runtime.js.map +1 -0
- package/dist/shared/capture-session.d.ts +99 -0
- package/dist/shared/capture-session.js +287 -0
- package/dist/shared/capture-session.js.map +1 -0
- package/dist/simface-sdk.js +2769 -2526
- package/dist/simface-sdk.umd.cjs +37 -37
- package/dist/types/index.d.ts +17 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23,13 +23,15 @@ export { SimFaceCapture } from './components/simface-capture.js';
|
|
|
23
23
|
* and sends it to the backend for enrollment.
|
|
24
24
|
*
|
|
25
25
|
* If the user is already enrolled, returns { alreadyEnrolled: true }.
|
|
26
|
+
* The optional capture options let the host choose popup vs embedded capture
|
|
27
|
+
* and the preferred fallback policy.
|
|
26
28
|
*/
|
|
27
|
-
export async function enroll(config, clientId) {
|
|
29
|
+
export async function enroll(config, clientId, captureOptions) {
|
|
28
30
|
const client = new SimFaceAPIClient(config);
|
|
29
31
|
// Validate API key first
|
|
30
32
|
await client.validateAPIKey();
|
|
31
33
|
// Capture face image
|
|
32
|
-
const blob = await captureWithQualityCheck();
|
|
34
|
+
const blob = await captureWithQualityCheck(captureOptions);
|
|
33
35
|
if (!blob) {
|
|
34
36
|
return { success: false, clientId, message: 'Capture cancelled by user' };
|
|
35
37
|
}
|
|
@@ -48,13 +50,15 @@ export async function enroll(config, clientId) {
|
|
|
48
50
|
* and sends it to the backend for comparison against the enrolled image.
|
|
49
51
|
*
|
|
50
52
|
* If the user is not enrolled, returns { notEnrolled: true }.
|
|
53
|
+
* The optional capture options let the host choose popup vs embedded capture
|
|
54
|
+
* and the preferred fallback policy.
|
|
51
55
|
*/
|
|
52
|
-
export async function verify(config, clientId) {
|
|
56
|
+
export async function verify(config, clientId, captureOptions) {
|
|
53
57
|
const client = new SimFaceAPIClient(config);
|
|
54
58
|
// Validate API key first
|
|
55
59
|
await client.validateAPIKey();
|
|
56
60
|
// Capture face image
|
|
57
|
-
const blob = await captureWithQualityCheck();
|
|
61
|
+
const blob = await captureWithQualityCheck(captureOptions);
|
|
58
62
|
if (!blob) {
|
|
59
63
|
return { match: false, score: 0, threshold: 0, message: 'Capture cancelled by user' };
|
|
60
64
|
}
|
|
@@ -63,7 +67,7 @@ export async function verify(config, clientId) {
|
|
|
63
67
|
/**
|
|
64
68
|
* Capture a face image with the camera flow's built-in quality validation.
|
|
65
69
|
*/
|
|
66
|
-
async function captureWithQualityCheck() {
|
|
67
|
-
return captureFromCamera();
|
|
70
|
+
async function captureWithQualityCheck(captureOptions) {
|
|
71
|
+
return captureFromCamera(captureOptions);
|
|
68
72
|
}
|
|
69
73
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,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AAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACxF,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,uBAAuB,CACpC,cAAsC;IAEtC,OAAO,iBAAiB,CAAC,cAAc,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Camera capture service.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Plans capture explicitly as an ordered fallback chain:
|
|
5
|
+
* auto camera -> manual camera -> media picker.
|
|
6
6
|
*/
|
|
7
|
+
import { blobToDataURL, blobToImage } from '../shared/capture-runtime.js';
|
|
8
|
+
import type { SimFaceCaptureOptions } from '../types/index.js';
|
|
7
9
|
/**
|
|
8
|
-
* Opens the
|
|
10
|
+
* Opens the configured capture presentation and returns a confirmed image Blob,
|
|
11
|
+
* or null if the user cancels.
|
|
9
12
|
*/
|
|
10
|
-
export declare function captureFromCamera(): Promise<Blob | null>;
|
|
11
|
-
|
|
12
|
-
* Loads a Blob as an HTMLImageElement for face detection analysis.
|
|
13
|
-
*/
|
|
14
|
-
export declare function blobToImage(blob: Blob): Promise<HTMLImageElement>;
|
|
15
|
-
/**
|
|
16
|
-
* Creates a data URL from a Blob for display in an <img> tag.
|
|
17
|
-
*/
|
|
18
|
-
export declare function blobToDataURL(blob: Blob): Promise<string>;
|
|
13
|
+
export declare function captureFromCamera(options?: SimFaceCaptureOptions): Promise<Blob | null>;
|
|
14
|
+
export { blobToImage, blobToDataURL };
|