@voltom.io/sdk 0.0.0-stage → 1.0.2

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.
@@ -0,0 +1,7 @@
1
+ import type { VoltomFaceKey as VoltomFaceKeyType } from "../facekey.js";
2
+
3
+ declare global {
4
+ var VoltomFaceKey: typeof VoltomFaceKeyType;
5
+ }
6
+
7
+ export {};
@@ -0,0 +1,72 @@
1
+ export type FaceKeyOperation = "enroll" | "unlock" | "forget";
2
+
3
+ export type FaceKeyPose = "faceStraight" | "faceUp" | "faceLeft" | "faceRight" | "faceSmile";
4
+
5
+ export type FaceKeyInput = { token: string; userId?: string };
6
+
7
+ export type FaceKeyUnlock = {
8
+ userId: string;
9
+ matched: boolean;
10
+ matches: { pose: FaceKeyPose; matched: boolean; score: number }[];
11
+ reason: string | null;
12
+ };
13
+
14
+ export type FaceKeyCapability = "enroll" | "unlock" | "forget";
15
+
16
+ export type FaceKeyOperationOptions = { signal?: AbortSignal; debug?: boolean };
17
+
18
+ export type VoltomFaceKeyOptions = {
19
+ clientKey: string;
20
+ apiUrl?: string;
21
+ debug?: boolean;
22
+ language?: "ar" | "ch" | "de" | "en" | "es" | "fr" | "it" | "ja" | "pt" | "zh";
23
+ capabilities?: FaceKeyCapability[];
24
+ ui?: boolean;
25
+ video?: HTMLVideoElement;
26
+ };
27
+
28
+ export type FaceKeyIdentity = { userId: string };
29
+
30
+ export type FaceKeyInstruction = {
31
+ pose: FaceKeyPose;
32
+ rejection:
33
+ | "FACEKEY_LOWER_HEAD"
34
+ | "FACEKEY_LOWER_HEAD_LESS"
35
+ | "FACEKEY_RAISE_HEAD"
36
+ | "FACEKEY_RAISE_HEAD_LESS"
37
+ | "FACEKEY_TILT_HEAD_LEFT"
38
+ | "FACEKEY_TILT_HEAD_LESS"
39
+ | "FACEKEY_TILT_HEAD_RIGHT"
40
+ | "FACEKEY_TURN_HEAD_LEFT"
41
+ | "FACEKEY_TURN_HEAD_LESS"
42
+ | "FACEKEY_TURN_HEAD_RIGHT"
43
+ | "FACEKEY_SMILE_REQUIRED"
44
+ | "FACEKEY_WINK_LEFT_REQUIRED"
45
+ | null;
46
+ retry: string | null;
47
+ };
48
+
49
+ export type VoltomFaceKeyState = {
50
+ operation: FaceKeyOperation;
51
+ phase: "loading" | "capturing" | "checking" | "processing" | "success" | "failure";
52
+ instruction: FaceKeyInstruction | null;
53
+ progress: { completed: number; total: number };
54
+ feedback: { matched: boolean; animating: boolean } | null;
55
+ error: unknown | null;
56
+ match: { accepted: boolean; reason: string | null; reference?: boolean; score: number | null } | null;
57
+ debug: { label: string; valid?: boolean; value: string }[];
58
+ };
59
+
60
+ export declare class VoltomFaceKey {
61
+ constructor(options: VoltomFaceKeyOptions);
62
+ prepare(): Promise<void>;
63
+ faceEnroll(input: FaceKeyInput, options?: FaceKeyOperationOptions): Promise<FaceKeyIdentity>;
64
+ faceUnlock(input: FaceKeyInput & { userId: string }, options?: FaceKeyOperationOptions): Promise<FaceKeyUnlock>;
65
+ faceForget(input: FaceKeyInput & { userId: string }, options?: FaceKeyOperationOptions): Promise<FaceKeyIdentity>;
66
+ stop(): void;
67
+ dispose(): void;
68
+ getState(): VoltomFaceKeyState;
69
+ subscribe(listener: (state: VoltomFaceKeyState) => void): () => void;
70
+ }
71
+
72
+ export default VoltomFaceKey;