@simprints/simface-sdk 0.5.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 -19
- package/dist/components/simface-capture.js +176 -250
- 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 +240 -339
- 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/auto-capture.d.ts +7 -0
- package/dist/shared/auto-capture.js +23 -0
- package/dist/shared/auto-capture.js.map +1 -0
- 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 +2767 -2464
- package/dist/simface-sdk.umd.cjs +37 -37
- package/dist/types/index.d.ts +17 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* // Verify an existing user
|
|
11
11
|
* const result = await verify({ apiUrl: '...', projectId: '...', apiKey: '...' }, 'user-123');
|
|
12
12
|
*/
|
|
13
|
-
import type { SimFaceConfig, EnrollResult, VerifyResult } from './types/index.js';
|
|
14
|
-
export type { SimFaceConfig, EnrollResult, VerifyResult, FaceQualityResult, ValidateResult } from './types/index.js';
|
|
13
|
+
import type { SimFaceCaptureOptions, SimFaceConfig, EnrollResult, VerifyResult } from './types/index.js';
|
|
14
|
+
export type { CapturePreference, CapturePresentation, SimFaceCaptureOptions, SimFaceConfig, EnrollResult, VerifyResult, FaceQualityResult, ValidateResult, } from './types/index.js';
|
|
15
15
|
export { SimFaceAPIClient } from './services/api-client.js';
|
|
16
16
|
export { assessFaceQuality, assessFaceQualityForVideo } from './services/face-detection.js';
|
|
17
17
|
export { captureFromCamera, blobToImage, blobToDataURL } from './services/camera.js';
|
|
@@ -23,8 +23,10 @@ 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 declare function enroll(config: SimFaceConfig, clientId: string): Promise<EnrollResult>;
|
|
29
|
+
export declare function enroll(config: SimFaceConfig, clientId: string, captureOptions?: SimFaceCaptureOptions): Promise<EnrollResult>;
|
|
28
30
|
/**
|
|
29
31
|
* Verify a user with facial recognition.
|
|
30
32
|
*
|
|
@@ -32,5 +34,7 @@ export declare function enroll(config: SimFaceConfig, clientId: string): Promise
|
|
|
32
34
|
* and sends it to the backend for comparison against the enrolled image.
|
|
33
35
|
*
|
|
34
36
|
* If the user is not enrolled, returns { notEnrolled: true }.
|
|
37
|
+
* The optional capture options let the host choose popup vs embedded capture
|
|
38
|
+
* and the preferred fallback policy.
|
|
35
39
|
*/
|
|
36
|
-
export declare function verify(config: SimFaceConfig, clientId: string): Promise<VerifyResult>;
|
|
40
|
+
export declare function verify(config: SimFaceConfig, clientId: string, captureOptions?: SimFaceCaptureOptions): Promise<VerifyResult>;
|
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,sBAAsB,CAAC;AAazD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,MAAqB,EACrB,QAAgB,EAChB,cAAsC;IAEtC,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE5C,yBAAyB;IACzB,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC;IAE9B,qBAAqB;IACrB,MAAM,IAAI,GAAG,MAAM,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAC3D,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IAC5E,CAAC;IAED,kBAAkB;IAClB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAEnD,+CAA+C;IAC/C,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QAC3B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,MAAqB,EACrB,QAAgB,EAChB,cAAsC;IAEtC,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE5C,yBAAyB;IACzB,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC;IAE9B,qBAAqB;IACrB,MAAM,IAAI,GAAG,MAAM,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAC3D,IAAI,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 };
|