@hexar/biometric-identity-sdk-core 1.0.5 → 1.0.7
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/dist/api/BackendClient.d.ts +2 -0
- package/dist/api/BackendClient.js +16 -7
- package/dist/i18n/languages/en.js +15 -1
- package/dist/i18n/languages/es-AR.js +15 -1
- package/dist/i18n/languages/es.js +15 -1
- package/dist/i18n/languages/pt-BR.js +15 -1
- package/dist/i18n/types.d.ts +15 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +1 -1
- package/src/api/BackendClient.ts +18 -7
- package/src/i18n/languages/en.ts +15 -1
- package/src/i18n/languages/es-AR.ts +15 -1
- package/src/i18n/languages/es.ts +15 -1
- package/src/i18n/languages/pt-BR.ts +15 -1
- package/src/i18n/types.ts +15 -1
- package/src/types/index.ts +1 -0
|
@@ -124,6 +124,7 @@ export interface BackendClientConfig {
|
|
|
124
124
|
export declare class BackendClient {
|
|
125
125
|
private config;
|
|
126
126
|
private currentSessionId;
|
|
127
|
+
private sdkSessionId;
|
|
127
128
|
constructor(config: BackendClientConfig);
|
|
128
129
|
/**
|
|
129
130
|
* Check if the backend is available
|
|
@@ -137,6 +138,7 @@ export declare class BackendClient {
|
|
|
137
138
|
* Validate liveness from video frames
|
|
138
139
|
*/
|
|
139
140
|
validateLiveness(videoFrames: string[], videoDurationMs: number, challengesCompleted?: string[], deviceInfo?: Record<string, any>): Promise<LivenessResponse>;
|
|
141
|
+
private generateSDKSessionId;
|
|
140
142
|
/**
|
|
141
143
|
* Compare faces between document and live capture
|
|
142
144
|
*/
|
|
@@ -11,11 +11,13 @@ exports.BackendClient = void 0;
|
|
|
11
11
|
class BackendClient {
|
|
12
12
|
constructor(config) {
|
|
13
13
|
this.currentSessionId = null;
|
|
14
|
+
this.sdkSessionId = null;
|
|
14
15
|
this.config = {
|
|
15
|
-
apiEndpoint: config.apiEndpoint.replace(/\/$/, ''),
|
|
16
|
+
apiEndpoint: config.apiEndpoint.replace(/\/$/, ''),
|
|
16
17
|
apiKey: config.apiKey,
|
|
17
18
|
timeout: config.timeout || 60000,
|
|
18
19
|
};
|
|
20
|
+
this.sdkSessionId = this.generateSDKSessionId();
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* Check if the backend is available
|
|
@@ -48,14 +50,16 @@ class BackendClient {
|
|
|
48
50
|
if (!this.currentSessionId) {
|
|
49
51
|
throw new Error('No active session. Call generateChallenge() first.');
|
|
50
52
|
}
|
|
51
|
-
|
|
53
|
+
return this.request('/api/v1/liveness/validate', 'POST', {
|
|
52
54
|
session_id: this.currentSessionId,
|
|
53
55
|
video_frames: videoFrames,
|
|
54
56
|
video_duration_ms: videoDurationMs,
|
|
55
57
|
challenges_completed: challengesCompleted,
|
|
56
58
|
device_info: deviceInfo,
|
|
57
59
|
});
|
|
58
|
-
|
|
60
|
+
}
|
|
61
|
+
generateSDKSessionId() {
|
|
62
|
+
return `sdk-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
59
63
|
}
|
|
60
64
|
/**
|
|
61
65
|
* Compare faces between document and live capture
|
|
@@ -159,6 +163,7 @@ class BackendClient {
|
|
|
159
163
|
*/
|
|
160
164
|
resetSession() {
|
|
161
165
|
this.currentSessionId = null;
|
|
166
|
+
this.sdkSessionId = this.generateSDKSessionId();
|
|
162
167
|
}
|
|
163
168
|
/**
|
|
164
169
|
* Make HTTP request to backend
|
|
@@ -167,13 +172,17 @@ class BackendClient {
|
|
|
167
172
|
const url = `${this.config.apiEndpoint}${endpoint}`;
|
|
168
173
|
const controller = new AbortController();
|
|
169
174
|
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
175
|
+
const headers = {
|
|
176
|
+
'Content-Type': 'application/json',
|
|
177
|
+
'X-API-Key': this.config.apiKey,
|
|
178
|
+
};
|
|
179
|
+
if (this.sdkSessionId) {
|
|
180
|
+
headers['X-SDK-Session-ID'] = this.sdkSessionId;
|
|
181
|
+
}
|
|
170
182
|
try {
|
|
171
183
|
const response = await fetch(url, {
|
|
172
184
|
method,
|
|
173
|
-
headers
|
|
174
|
-
'Content-Type': 'application/json',
|
|
175
|
-
'X-API-Key': this.config.apiKey,
|
|
176
|
-
},
|
|
185
|
+
headers,
|
|
177
186
|
body: body ? JSON.stringify(body) : undefined,
|
|
178
187
|
signal: controller.signal,
|
|
179
188
|
});
|
|
@@ -10,6 +10,7 @@ exports.en = {
|
|
|
10
10
|
continue: 'Continue',
|
|
11
11
|
close: 'Close',
|
|
12
12
|
done: 'Done',
|
|
13
|
+
grantPermission: 'Grant Permission',
|
|
13
14
|
},
|
|
14
15
|
initialization: {
|
|
15
16
|
initializing: 'Initializing...',
|
|
@@ -35,11 +36,13 @@ exports.en = {
|
|
|
35
36
|
title: 'Front of ID',
|
|
36
37
|
instruction: 'Position the front of your ID within the frame',
|
|
37
38
|
button: 'Capture Front ID',
|
|
39
|
+
tips: '• Ensure good lighting\n• Avoid glare and shadows\n• Keep document flat and complete',
|
|
38
40
|
},
|
|
39
41
|
backId: {
|
|
40
42
|
title: 'Back of ID',
|
|
41
43
|
instruction: 'Position the back of your ID within the frame',
|
|
42
44
|
button: 'Capture Back ID',
|
|
45
|
+
tips: '• Ensure good lighting\n• Avoid glare and shadows\n• Keep document flat and complete',
|
|
43
46
|
},
|
|
44
47
|
selfie: {
|
|
45
48
|
title: 'Face Photo',
|
|
@@ -50,6 +53,9 @@ exports.en = {
|
|
|
50
53
|
liveness: {
|
|
51
54
|
title: 'Face Verification',
|
|
52
55
|
preparing: 'Preparing verification...',
|
|
56
|
+
getReady: 'Get Ready!',
|
|
57
|
+
countdownMessage: 'You\'ll perform actions.\nFollow the on-screen instructions.',
|
|
58
|
+
recordingInstructions: 'Keep your face visible and follow the instructions',
|
|
53
59
|
instructions: {
|
|
54
60
|
lookLeft: 'Look to the left',
|
|
55
61
|
lookRight: 'Look to the right',
|
|
@@ -60,6 +66,7 @@ exports.en = {
|
|
|
60
66
|
turnHeadLeft: 'Turn your head to the left',
|
|
61
67
|
turnHeadRight: 'Turn your head to the right',
|
|
62
68
|
stayStill: 'Stay still',
|
|
69
|
+
openMouth: 'Open your mouth slightly',
|
|
63
70
|
},
|
|
64
71
|
recording: 'Recording...',
|
|
65
72
|
processing: 'Processing video...',
|
|
@@ -85,7 +92,10 @@ exports.en = {
|
|
|
85
92
|
},
|
|
86
93
|
},
|
|
87
94
|
errors: {
|
|
88
|
-
cameraPermissionDenied:
|
|
95
|
+
cameraPermissionDenied: {
|
|
96
|
+
title: 'Camera Permission Required',
|
|
97
|
+
message: 'Camera permission denied. Please enable camera access in settings.',
|
|
98
|
+
},
|
|
89
99
|
cameraNotAvailable: 'Camera not available.',
|
|
90
100
|
faceNotDetected: 'Face not detected. Please position your face clearly.',
|
|
91
101
|
multipleFacesDetected: 'Multiple faces detected. Only one person should be in frame.',
|
|
@@ -97,6 +107,10 @@ exports.en = {
|
|
|
97
107
|
networkError: 'Network error. Please check your connection.',
|
|
98
108
|
timeout: 'Request timeout. Please try again.',
|
|
99
109
|
unknownError: 'An unexpected error occurred.',
|
|
110
|
+
videoTooShort: {
|
|
111
|
+
title: 'Recording Too Short',
|
|
112
|
+
message: 'Video must be at least 8 seconds. Please try again.',
|
|
113
|
+
},
|
|
100
114
|
},
|
|
101
115
|
badges: {
|
|
102
116
|
secureVerification: 'Secure AI Verification',
|
|
@@ -10,6 +10,7 @@ exports.esAR = {
|
|
|
10
10
|
continue: 'Continuar',
|
|
11
11
|
close: 'Cerrar',
|
|
12
12
|
done: 'Listo',
|
|
13
|
+
grantPermission: 'Otorgar Permiso',
|
|
13
14
|
},
|
|
14
15
|
initialization: {
|
|
15
16
|
initializing: 'Iniciando...',
|
|
@@ -35,11 +36,13 @@ exports.esAR = {
|
|
|
35
36
|
title: 'Frente del Documento',
|
|
36
37
|
instruction: 'Posicioná el frente de tu documento dentro del marco',
|
|
37
38
|
button: 'Capturar Frente',
|
|
39
|
+
tips: '• Asegurate de tener buena iluminación\n• Evitá brillos y sombras\n• Mantené el documento plano y completo',
|
|
38
40
|
},
|
|
39
41
|
backId: {
|
|
40
42
|
title: 'Dorso del Documento',
|
|
41
43
|
instruction: 'Posicioná el dorso de tu documento dentro del marco',
|
|
42
44
|
button: 'Capturar Dorso',
|
|
45
|
+
tips: '• Asegurate de tener buena iluminación\n• Evitá brillos y sombras\n• Mantené el documento plano y completo',
|
|
43
46
|
},
|
|
44
47
|
selfie: {
|
|
45
48
|
title: 'Foto de Rostro',
|
|
@@ -50,6 +53,9 @@ exports.esAR = {
|
|
|
50
53
|
liveness: {
|
|
51
54
|
title: 'Verificación Facial',
|
|
52
55
|
preparing: 'Preparando verificación...',
|
|
56
|
+
getReady: '¡Prepárate!',
|
|
57
|
+
countdownMessage: 'Vas a realizar acciones.\nSeguí las instrucciones en pantalla.',
|
|
58
|
+
recordingInstructions: 'Mantené tu rostro visible y seguí las instrucciones',
|
|
53
59
|
instructions: {
|
|
54
60
|
lookLeft: 'Mirá a la izquierda',
|
|
55
61
|
lookRight: 'Mirá a la derecha',
|
|
@@ -60,6 +66,7 @@ exports.esAR = {
|
|
|
60
66
|
turnHeadLeft: 'Girá tu cabeza a la izquierda',
|
|
61
67
|
turnHeadRight: 'Girá tu cabeza a la derecha',
|
|
62
68
|
stayStill: 'Quedate quieto',
|
|
69
|
+
openMouth: 'Abrí la boca ligeramente',
|
|
63
70
|
},
|
|
64
71
|
recording: 'Grabando...',
|
|
65
72
|
processing: 'Procesando video...',
|
|
@@ -85,7 +92,10 @@ exports.esAR = {
|
|
|
85
92
|
},
|
|
86
93
|
},
|
|
87
94
|
errors: {
|
|
88
|
-
cameraPermissionDenied:
|
|
95
|
+
cameraPermissionDenied: {
|
|
96
|
+
title: 'Permiso de Cámara Requerido',
|
|
97
|
+
message: 'Permiso de cámara denegado. Habilitá el acceso en configuración.',
|
|
98
|
+
},
|
|
89
99
|
cameraNotAvailable: 'Cámara no disponible.',
|
|
90
100
|
faceNotDetected: 'Rostro no detectado. Posicioná tu cara claramente.',
|
|
91
101
|
multipleFacesDetected: 'Múltiples rostros detectados. Solo debe haber una persona.',
|
|
@@ -97,6 +107,10 @@ exports.esAR = {
|
|
|
97
107
|
networkError: 'Error de red. Verificá tu conexión.',
|
|
98
108
|
timeout: 'Tiempo de espera agotado. Intentá nuevamente.',
|
|
99
109
|
unknownError: 'Ocurrió un error inesperado.',
|
|
110
|
+
videoTooShort: {
|
|
111
|
+
title: 'Grabación Muy Corta',
|
|
112
|
+
message: 'El video debe durar al menos 8 segundos. Por favor intentá nuevamente.',
|
|
113
|
+
},
|
|
100
114
|
},
|
|
101
115
|
badges: {
|
|
102
116
|
secureVerification: 'Verificación Segura con IA',
|
|
@@ -10,6 +10,7 @@ exports.es = {
|
|
|
10
10
|
continue: 'Continuar',
|
|
11
11
|
close: 'Cerrar',
|
|
12
12
|
done: 'Listo',
|
|
13
|
+
grantPermission: 'Otorgar Permiso',
|
|
13
14
|
},
|
|
14
15
|
initialization: {
|
|
15
16
|
initializing: 'Iniciando...',
|
|
@@ -35,11 +36,13 @@ exports.es = {
|
|
|
35
36
|
title: 'Frente del Documento',
|
|
36
37
|
instruction: 'Posiciona el frente de tu documento dentro del marco',
|
|
37
38
|
button: 'Capturar Frente',
|
|
39
|
+
tips: '• Asegura buena iluminación\n• Evita brillos y sombras\n• Mantén el documento plano y completo',
|
|
38
40
|
},
|
|
39
41
|
backId: {
|
|
40
42
|
title: 'Reverso del Documento',
|
|
41
43
|
instruction: 'Posiciona el reverso de tu documento dentro del marco',
|
|
42
44
|
button: 'Capturar Reverso',
|
|
45
|
+
tips: '• Asegura buena iluminación\n• Evita brillos y sombras\n• Mantén el documento plano y completo',
|
|
43
46
|
},
|
|
44
47
|
selfie: {
|
|
45
48
|
title: 'Foto de Rostro',
|
|
@@ -50,6 +53,9 @@ exports.es = {
|
|
|
50
53
|
liveness: {
|
|
51
54
|
title: 'Verificación Facial',
|
|
52
55
|
preparing: 'Preparando verificación...',
|
|
56
|
+
getReady: '¡Prepárate!',
|
|
57
|
+
countdownMessage: 'Realizarás acciones.\nSigue las instrucciones en pantalla.',
|
|
58
|
+
recordingInstructions: 'Mantén tu rostro visible y sigue las instrucciones',
|
|
53
59
|
instructions: {
|
|
54
60
|
lookLeft: 'Mira a la izquierda',
|
|
55
61
|
lookRight: 'Mira a la derecha',
|
|
@@ -60,6 +66,7 @@ exports.es = {
|
|
|
60
66
|
turnHeadLeft: 'Gira tu cabeza a la izquierda',
|
|
61
67
|
turnHeadRight: 'Gira tu cabeza a la derecha',
|
|
62
68
|
stayStill: 'Permanece quieto',
|
|
69
|
+
openMouth: 'Abre la boca ligeramente',
|
|
63
70
|
},
|
|
64
71
|
recording: 'Grabando...',
|
|
65
72
|
processing: 'Procesando video...',
|
|
@@ -85,7 +92,10 @@ exports.es = {
|
|
|
85
92
|
},
|
|
86
93
|
},
|
|
87
94
|
errors: {
|
|
88
|
-
cameraPermissionDenied:
|
|
95
|
+
cameraPermissionDenied: {
|
|
96
|
+
title: 'Permiso de Cámara Requerido',
|
|
97
|
+
message: 'Permiso de cámara denegado. Habilita el acceso en configuración.',
|
|
98
|
+
},
|
|
89
99
|
cameraNotAvailable: 'Cámara no disponible.',
|
|
90
100
|
faceNotDetected: 'Rostro no detectado. Posiciona tu cara claramente.',
|
|
91
101
|
multipleFacesDetected: 'Múltiples rostros detectados. Solo debe haber una persona.',
|
|
@@ -97,6 +107,10 @@ exports.es = {
|
|
|
97
107
|
networkError: 'Error de red. Verifica tu conexión.',
|
|
98
108
|
timeout: 'Tiempo de espera agotado. Intenta nuevamente.',
|
|
99
109
|
unknownError: 'Ocurrió un error inesperado.',
|
|
110
|
+
videoTooShort: {
|
|
111
|
+
title: 'Grabación Muy Corta',
|
|
112
|
+
message: 'El video debe durar al menos 8 segundos. Por favor intenta nuevamente.',
|
|
113
|
+
},
|
|
100
114
|
},
|
|
101
115
|
badges: {
|
|
102
116
|
secureVerification: 'Verificación Segura con IA',
|
|
@@ -10,6 +10,7 @@ exports.ptBR = {
|
|
|
10
10
|
continue: 'Continuar',
|
|
11
11
|
close: 'Fechar',
|
|
12
12
|
done: 'Pronto',
|
|
13
|
+
grantPermission: 'Conceder Permissão',
|
|
13
14
|
},
|
|
14
15
|
initialization: {
|
|
15
16
|
initializing: 'Inicializando...',
|
|
@@ -35,11 +36,13 @@ exports.ptBR = {
|
|
|
35
36
|
title: 'Frente do Documento',
|
|
36
37
|
instruction: 'Posicione a frente do seu documento dentro da moldura',
|
|
37
38
|
button: 'Capturar Frente',
|
|
39
|
+
tips: '• Garanta boa iluminação\n• Evite brilhos e sombras\n• Mantenha o documento plano e completo',
|
|
38
40
|
},
|
|
39
41
|
backId: {
|
|
40
42
|
title: 'Verso do Documento',
|
|
41
43
|
instruction: 'Posicione o verso do seu documento dentro da moldura',
|
|
42
44
|
button: 'Capturar Verso',
|
|
45
|
+
tips: '• Garanta boa iluminação\n• Evite brilhos e sombras\n• Mantenha o documento plano e completo',
|
|
43
46
|
},
|
|
44
47
|
selfie: {
|
|
45
48
|
title: 'Foto do Rosto',
|
|
@@ -50,6 +53,9 @@ exports.ptBR = {
|
|
|
50
53
|
liveness: {
|
|
51
54
|
title: 'Verificação Facial',
|
|
52
55
|
preparing: 'Preparando verificação...',
|
|
56
|
+
getReady: 'Prepare-se!',
|
|
57
|
+
countdownMessage: 'Você realizará ações.\nSiga as instruções na tela.',
|
|
58
|
+
recordingInstructions: 'Mantenha seu rosto visível e siga as instruções',
|
|
53
59
|
instructions: {
|
|
54
60
|
lookLeft: 'Olhe para a esquerda',
|
|
55
61
|
lookRight: 'Olhe para a direita',
|
|
@@ -60,6 +66,7 @@ exports.ptBR = {
|
|
|
60
66
|
turnHeadLeft: 'Vire sua cabeça para a esquerda',
|
|
61
67
|
turnHeadRight: 'Vire sua cabeça para a direita',
|
|
62
68
|
stayStill: 'Fique parado',
|
|
69
|
+
openMouth: 'Abra a boca levemente',
|
|
63
70
|
},
|
|
64
71
|
recording: 'Gravando...',
|
|
65
72
|
processing: 'Processando vídeo...',
|
|
@@ -85,7 +92,10 @@ exports.ptBR = {
|
|
|
85
92
|
},
|
|
86
93
|
},
|
|
87
94
|
errors: {
|
|
88
|
-
cameraPermissionDenied:
|
|
95
|
+
cameraPermissionDenied: {
|
|
96
|
+
title: 'Permissão de Câmera Necessária',
|
|
97
|
+
message: 'Permissão de câmera negada. Habilite o acesso nas configurações.',
|
|
98
|
+
},
|
|
89
99
|
cameraNotAvailable: 'Câmera não disponível.',
|
|
90
100
|
faceNotDetected: 'Rosto não detectado. Posicione seu rosto claramente.',
|
|
91
101
|
multipleFacesDetected: 'Múltiplos rostos detectados. Apenas uma pessoa deve estar no quadro.',
|
|
@@ -97,6 +107,10 @@ exports.ptBR = {
|
|
|
97
107
|
networkError: 'Erro de rede. Verifique sua conexão.',
|
|
98
108
|
timeout: 'Tempo esgotado. Tente novamente.',
|
|
99
109
|
unknownError: 'Ocorreu um erro inesperado.',
|
|
110
|
+
videoTooShort: {
|
|
111
|
+
title: 'Gravação Muito Curta',
|
|
112
|
+
message: 'O vídeo deve durar pelo menos 8 segundos. Por favor, tente novamente.',
|
|
113
|
+
},
|
|
100
114
|
},
|
|
101
115
|
badges: {
|
|
102
116
|
secureVerification: 'Verificação Segura com IA',
|
package/dist/i18n/types.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface LanguageStrings {
|
|
|
8
8
|
continue: string;
|
|
9
9
|
close: string;
|
|
10
10
|
done: string;
|
|
11
|
+
grantPermission: string;
|
|
11
12
|
};
|
|
12
13
|
initialization: {
|
|
13
14
|
initializing: string;
|
|
@@ -33,11 +34,13 @@ export interface LanguageStrings {
|
|
|
33
34
|
title: string;
|
|
34
35
|
instruction: string;
|
|
35
36
|
button: string;
|
|
37
|
+
tips: string;
|
|
36
38
|
};
|
|
37
39
|
backId: {
|
|
38
40
|
title: string;
|
|
39
41
|
instruction: string;
|
|
40
42
|
button: string;
|
|
43
|
+
tips: string;
|
|
41
44
|
};
|
|
42
45
|
selfie: {
|
|
43
46
|
title: string;
|
|
@@ -48,6 +51,9 @@ export interface LanguageStrings {
|
|
|
48
51
|
liveness: {
|
|
49
52
|
title: string;
|
|
50
53
|
preparing: string;
|
|
54
|
+
getReady: string;
|
|
55
|
+
countdownMessage: string;
|
|
56
|
+
recordingInstructions: string;
|
|
51
57
|
instructions: {
|
|
52
58
|
lookLeft: string;
|
|
53
59
|
lookRight: string;
|
|
@@ -58,6 +64,7 @@ export interface LanguageStrings {
|
|
|
58
64
|
turnHeadLeft: string;
|
|
59
65
|
turnHeadRight: string;
|
|
60
66
|
stayStill: string;
|
|
67
|
+
openMouth: string;
|
|
61
68
|
};
|
|
62
69
|
recording: string;
|
|
63
70
|
processing: string;
|
|
@@ -83,7 +90,10 @@ export interface LanguageStrings {
|
|
|
83
90
|
};
|
|
84
91
|
};
|
|
85
92
|
errors: {
|
|
86
|
-
cameraPermissionDenied:
|
|
93
|
+
cameraPermissionDenied: {
|
|
94
|
+
title: string;
|
|
95
|
+
message: string;
|
|
96
|
+
};
|
|
87
97
|
cameraNotAvailable: string;
|
|
88
98
|
faceNotDetected: string;
|
|
89
99
|
multipleFacesDetected: string;
|
|
@@ -95,6 +105,10 @@ export interface LanguageStrings {
|
|
|
95
105
|
networkError: string;
|
|
96
106
|
timeout: string;
|
|
97
107
|
unknownError: string;
|
|
108
|
+
videoTooShort: {
|
|
109
|
+
title: string;
|
|
110
|
+
message: string;
|
|
111
|
+
};
|
|
98
112
|
};
|
|
99
113
|
badges: {
|
|
100
114
|
secureVerification: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -171,6 +171,7 @@ export declare enum BiometricErrorCode {
|
|
|
171
171
|
NETWORK_ERROR = "NETWORK_ERROR",
|
|
172
172
|
MODEL_LOAD_FAILED = "MODEL_LOAD_FAILED",
|
|
173
173
|
ENCRYPTION_FAILED = "ENCRYPTION_FAILED",
|
|
174
|
+
USER_CANCELLED = "USER_CANCELLED",
|
|
174
175
|
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
175
176
|
}
|
|
176
177
|
export interface FaceEmbedding {
|
package/dist/types/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var BiometricErrorCode;
|
|
|
20
20
|
BiometricErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
21
21
|
BiometricErrorCode["MODEL_LOAD_FAILED"] = "MODEL_LOAD_FAILED";
|
|
22
22
|
BiometricErrorCode["ENCRYPTION_FAILED"] = "ENCRYPTION_FAILED";
|
|
23
|
+
BiometricErrorCode["USER_CANCELLED"] = "USER_CANCELLED";
|
|
23
24
|
BiometricErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
24
25
|
})(BiometricErrorCode || (exports.BiometricErrorCode = BiometricErrorCode = {}));
|
|
25
26
|
var SDKStep;
|
package/package.json
CHANGED
package/src/api/BackendClient.ts
CHANGED
|
@@ -134,13 +134,15 @@ export interface BackendClientConfig {
|
|
|
134
134
|
export class BackendClient {
|
|
135
135
|
private config: Required<BackendClientConfig>;
|
|
136
136
|
private currentSessionId: string | null = null;
|
|
137
|
+
private sdkSessionId: string | null = null;
|
|
137
138
|
|
|
138
139
|
constructor(config: BackendClientConfig) {
|
|
139
140
|
this.config = {
|
|
140
|
-
apiEndpoint: config.apiEndpoint.replace(/\/$/, ''),
|
|
141
|
+
apiEndpoint: config.apiEndpoint.replace(/\/$/, ''),
|
|
141
142
|
apiKey: config.apiKey,
|
|
142
143
|
timeout: config.timeout || 60000,
|
|
143
144
|
};
|
|
145
|
+
this.sdkSessionId = this.generateSDKSessionId();
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
/**
|
|
@@ -188,7 +190,7 @@ export class BackendClient {
|
|
|
188
190
|
throw new Error('No active session. Call generateChallenge() first.');
|
|
189
191
|
}
|
|
190
192
|
|
|
191
|
-
|
|
193
|
+
return this.request<LivenessResponse>(
|
|
192
194
|
'/api/v1/liveness/validate',
|
|
193
195
|
'POST',
|
|
194
196
|
{
|
|
@@ -199,8 +201,10 @@ export class BackendClient {
|
|
|
199
201
|
device_info: deviceInfo,
|
|
200
202
|
}
|
|
201
203
|
);
|
|
204
|
+
}
|
|
202
205
|
|
|
203
|
-
|
|
206
|
+
private generateSDKSessionId(): string {
|
|
207
|
+
return `sdk-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
204
208
|
}
|
|
205
209
|
|
|
206
210
|
/**
|
|
@@ -341,6 +345,7 @@ export class BackendClient {
|
|
|
341
345
|
*/
|
|
342
346
|
resetSession(): void {
|
|
343
347
|
this.currentSessionId = null;
|
|
348
|
+
this.sdkSessionId = this.generateSDKSessionId();
|
|
344
349
|
}
|
|
345
350
|
|
|
346
351
|
/**
|
|
@@ -356,13 +361,19 @@ export class BackendClient {
|
|
|
356
361
|
const controller = new AbortController();
|
|
357
362
|
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
358
363
|
|
|
364
|
+
const headers: Record<string, string> = {
|
|
365
|
+
'Content-Type': 'application/json',
|
|
366
|
+
'X-API-Key': this.config.apiKey,
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
if (this.sdkSessionId) {
|
|
370
|
+
headers['X-SDK-Session-ID'] = this.sdkSessionId;
|
|
371
|
+
}
|
|
372
|
+
|
|
359
373
|
try {
|
|
360
374
|
const response = await fetch(url, {
|
|
361
375
|
method,
|
|
362
|
-
headers
|
|
363
|
-
'Content-Type': 'application/json',
|
|
364
|
-
'X-API-Key': this.config.apiKey,
|
|
365
|
-
},
|
|
376
|
+
headers,
|
|
366
377
|
body: body ? JSON.stringify(body) : undefined,
|
|
367
378
|
signal: controller.signal as RequestInit['signal'],
|
|
368
379
|
});
|
package/src/i18n/languages/en.ts
CHANGED
|
@@ -9,6 +9,7 @@ export const en: LanguageStrings = {
|
|
|
9
9
|
continue: 'Continue',
|
|
10
10
|
close: 'Close',
|
|
11
11
|
done: 'Done',
|
|
12
|
+
grantPermission: 'Grant Permission',
|
|
12
13
|
},
|
|
13
14
|
|
|
14
15
|
initialization: {
|
|
@@ -37,11 +38,13 @@ export const en: LanguageStrings = {
|
|
|
37
38
|
title: 'Front of ID',
|
|
38
39
|
instruction: 'Position the front of your ID within the frame',
|
|
39
40
|
button: 'Capture Front ID',
|
|
41
|
+
tips: '• Ensure good lighting\n• Avoid glare and shadows\n• Keep document flat and complete',
|
|
40
42
|
},
|
|
41
43
|
backId: {
|
|
42
44
|
title: 'Back of ID',
|
|
43
45
|
instruction: 'Position the back of your ID within the frame',
|
|
44
46
|
button: 'Capture Back ID',
|
|
47
|
+
tips: '• Ensure good lighting\n• Avoid glare and shadows\n• Keep document flat and complete',
|
|
45
48
|
},
|
|
46
49
|
selfie: {
|
|
47
50
|
title: 'Face Photo',
|
|
@@ -53,6 +56,9 @@ export const en: LanguageStrings = {
|
|
|
53
56
|
liveness: {
|
|
54
57
|
title: 'Face Verification',
|
|
55
58
|
preparing: 'Preparing verification...',
|
|
59
|
+
getReady: 'Get Ready!',
|
|
60
|
+
countdownMessage: 'You\'ll perform actions.\nFollow the on-screen instructions.',
|
|
61
|
+
recordingInstructions: 'Keep your face visible and follow the instructions',
|
|
56
62
|
instructions: {
|
|
57
63
|
lookLeft: 'Look to the left',
|
|
58
64
|
lookRight: 'Look to the right',
|
|
@@ -63,6 +69,7 @@ export const en: LanguageStrings = {
|
|
|
63
69
|
turnHeadLeft: 'Turn your head to the left',
|
|
64
70
|
turnHeadRight: 'Turn your head to the right',
|
|
65
71
|
stayStill: 'Stay still',
|
|
72
|
+
openMouth: 'Open your mouth slightly',
|
|
66
73
|
},
|
|
67
74
|
recording: 'Recording...',
|
|
68
75
|
processing: 'Processing video...',
|
|
@@ -91,7 +98,10 @@ export const en: LanguageStrings = {
|
|
|
91
98
|
},
|
|
92
99
|
|
|
93
100
|
errors: {
|
|
94
|
-
cameraPermissionDenied:
|
|
101
|
+
cameraPermissionDenied: {
|
|
102
|
+
title: 'Camera Permission Required',
|
|
103
|
+
message: 'Camera permission denied. Please enable camera access in settings.',
|
|
104
|
+
},
|
|
95
105
|
cameraNotAvailable: 'Camera not available.',
|
|
96
106
|
faceNotDetected: 'Face not detected. Please position your face clearly.',
|
|
97
107
|
multipleFacesDetected: 'Multiple faces detected. Only one person should be in frame.',
|
|
@@ -103,6 +113,10 @@ export const en: LanguageStrings = {
|
|
|
103
113
|
networkError: 'Network error. Please check your connection.',
|
|
104
114
|
timeout: 'Request timeout. Please try again.',
|
|
105
115
|
unknownError: 'An unexpected error occurred.',
|
|
116
|
+
videoTooShort: {
|
|
117
|
+
title: 'Recording Too Short',
|
|
118
|
+
message: 'Video must be at least 8 seconds. Please try again.',
|
|
119
|
+
},
|
|
106
120
|
},
|
|
107
121
|
|
|
108
122
|
badges: {
|
|
@@ -9,6 +9,7 @@ export const esAR: LanguageStrings = {
|
|
|
9
9
|
continue: 'Continuar',
|
|
10
10
|
close: 'Cerrar',
|
|
11
11
|
done: 'Listo',
|
|
12
|
+
grantPermission: 'Otorgar Permiso',
|
|
12
13
|
},
|
|
13
14
|
|
|
14
15
|
initialization: {
|
|
@@ -37,11 +38,13 @@ export const esAR: LanguageStrings = {
|
|
|
37
38
|
title: 'Frente del Documento',
|
|
38
39
|
instruction: 'Posicioná el frente de tu documento dentro del marco',
|
|
39
40
|
button: 'Capturar Frente',
|
|
41
|
+
tips: '• Asegurate de tener buena iluminación\n• Evitá brillos y sombras\n• Mantené el documento plano y completo',
|
|
40
42
|
},
|
|
41
43
|
backId: {
|
|
42
44
|
title: 'Dorso del Documento',
|
|
43
45
|
instruction: 'Posicioná el dorso de tu documento dentro del marco',
|
|
44
46
|
button: 'Capturar Dorso',
|
|
47
|
+
tips: '• Asegurate de tener buena iluminación\n• Evitá brillos y sombras\n• Mantené el documento plano y completo',
|
|
45
48
|
},
|
|
46
49
|
selfie: {
|
|
47
50
|
title: 'Foto de Rostro',
|
|
@@ -53,6 +56,9 @@ export const esAR: LanguageStrings = {
|
|
|
53
56
|
liveness: {
|
|
54
57
|
title: 'Verificación Facial',
|
|
55
58
|
preparing: 'Preparando verificación...',
|
|
59
|
+
getReady: '¡Prepárate!',
|
|
60
|
+
countdownMessage: 'Vas a realizar acciones.\nSeguí las instrucciones en pantalla.',
|
|
61
|
+
recordingInstructions: 'Mantené tu rostro visible y seguí las instrucciones',
|
|
56
62
|
instructions: {
|
|
57
63
|
lookLeft: 'Mirá a la izquierda',
|
|
58
64
|
lookRight: 'Mirá a la derecha',
|
|
@@ -63,6 +69,7 @@ export const esAR: LanguageStrings = {
|
|
|
63
69
|
turnHeadLeft: 'Girá tu cabeza a la izquierda',
|
|
64
70
|
turnHeadRight: 'Girá tu cabeza a la derecha',
|
|
65
71
|
stayStill: 'Quedate quieto',
|
|
72
|
+
openMouth: 'Abrí la boca ligeramente',
|
|
66
73
|
},
|
|
67
74
|
recording: 'Grabando...',
|
|
68
75
|
processing: 'Procesando video...',
|
|
@@ -91,7 +98,10 @@ export const esAR: LanguageStrings = {
|
|
|
91
98
|
},
|
|
92
99
|
|
|
93
100
|
errors: {
|
|
94
|
-
cameraPermissionDenied:
|
|
101
|
+
cameraPermissionDenied: {
|
|
102
|
+
title: 'Permiso de Cámara Requerido',
|
|
103
|
+
message: 'Permiso de cámara denegado. Habilitá el acceso en configuración.',
|
|
104
|
+
},
|
|
95
105
|
cameraNotAvailable: 'Cámara no disponible.',
|
|
96
106
|
faceNotDetected: 'Rostro no detectado. Posicioná tu cara claramente.',
|
|
97
107
|
multipleFacesDetected: 'Múltiples rostros detectados. Solo debe haber una persona.',
|
|
@@ -103,6 +113,10 @@ export const esAR: LanguageStrings = {
|
|
|
103
113
|
networkError: 'Error de red. Verificá tu conexión.',
|
|
104
114
|
timeout: 'Tiempo de espera agotado. Intentá nuevamente.',
|
|
105
115
|
unknownError: 'Ocurrió un error inesperado.',
|
|
116
|
+
videoTooShort: {
|
|
117
|
+
title: 'Grabación Muy Corta',
|
|
118
|
+
message: 'El video debe durar al menos 8 segundos. Por favor intentá nuevamente.',
|
|
119
|
+
},
|
|
106
120
|
},
|
|
107
121
|
|
|
108
122
|
badges: {
|
package/src/i18n/languages/es.ts
CHANGED
|
@@ -9,6 +9,7 @@ export const es: LanguageStrings = {
|
|
|
9
9
|
continue: 'Continuar',
|
|
10
10
|
close: 'Cerrar',
|
|
11
11
|
done: 'Listo',
|
|
12
|
+
grantPermission: 'Otorgar Permiso',
|
|
12
13
|
},
|
|
13
14
|
|
|
14
15
|
initialization: {
|
|
@@ -37,11 +38,13 @@ export const es: LanguageStrings = {
|
|
|
37
38
|
title: 'Frente del Documento',
|
|
38
39
|
instruction: 'Posiciona el frente de tu documento dentro del marco',
|
|
39
40
|
button: 'Capturar Frente',
|
|
41
|
+
tips: '• Asegura buena iluminación\n• Evita brillos y sombras\n• Mantén el documento plano y completo',
|
|
40
42
|
},
|
|
41
43
|
backId: {
|
|
42
44
|
title: 'Reverso del Documento',
|
|
43
45
|
instruction: 'Posiciona el reverso de tu documento dentro del marco',
|
|
44
46
|
button: 'Capturar Reverso',
|
|
47
|
+
tips: '• Asegura buena iluminación\n• Evita brillos y sombras\n• Mantén el documento plano y completo',
|
|
45
48
|
},
|
|
46
49
|
selfie: {
|
|
47
50
|
title: 'Foto de Rostro',
|
|
@@ -53,6 +56,9 @@ export const es: LanguageStrings = {
|
|
|
53
56
|
liveness: {
|
|
54
57
|
title: 'Verificación Facial',
|
|
55
58
|
preparing: 'Preparando verificación...',
|
|
59
|
+
getReady: '¡Prepárate!',
|
|
60
|
+
countdownMessage: 'Realizarás acciones.\nSigue las instrucciones en pantalla.',
|
|
61
|
+
recordingInstructions: 'Mantén tu rostro visible y sigue las instrucciones',
|
|
56
62
|
instructions: {
|
|
57
63
|
lookLeft: 'Mira a la izquierda',
|
|
58
64
|
lookRight: 'Mira a la derecha',
|
|
@@ -63,6 +69,7 @@ export const es: LanguageStrings = {
|
|
|
63
69
|
turnHeadLeft: 'Gira tu cabeza a la izquierda',
|
|
64
70
|
turnHeadRight: 'Gira tu cabeza a la derecha',
|
|
65
71
|
stayStill: 'Permanece quieto',
|
|
72
|
+
openMouth: 'Abre la boca ligeramente',
|
|
66
73
|
},
|
|
67
74
|
recording: 'Grabando...',
|
|
68
75
|
processing: 'Procesando video...',
|
|
@@ -91,7 +98,10 @@ export const es: LanguageStrings = {
|
|
|
91
98
|
},
|
|
92
99
|
|
|
93
100
|
errors: {
|
|
94
|
-
cameraPermissionDenied:
|
|
101
|
+
cameraPermissionDenied: {
|
|
102
|
+
title: 'Permiso de Cámara Requerido',
|
|
103
|
+
message: 'Permiso de cámara denegado. Habilita el acceso en configuración.',
|
|
104
|
+
},
|
|
95
105
|
cameraNotAvailable: 'Cámara no disponible.',
|
|
96
106
|
faceNotDetected: 'Rostro no detectado. Posiciona tu cara claramente.',
|
|
97
107
|
multipleFacesDetected: 'Múltiples rostros detectados. Solo debe haber una persona.',
|
|
@@ -103,6 +113,10 @@ export const es: LanguageStrings = {
|
|
|
103
113
|
networkError: 'Error de red. Verifica tu conexión.',
|
|
104
114
|
timeout: 'Tiempo de espera agotado. Intenta nuevamente.',
|
|
105
115
|
unknownError: 'Ocurrió un error inesperado.',
|
|
116
|
+
videoTooShort: {
|
|
117
|
+
title: 'Grabación Muy Corta',
|
|
118
|
+
message: 'El video debe durar al menos 8 segundos. Por favor intenta nuevamente.',
|
|
119
|
+
},
|
|
106
120
|
},
|
|
107
121
|
|
|
108
122
|
badges: {
|
|
@@ -9,6 +9,7 @@ export const ptBR: LanguageStrings = {
|
|
|
9
9
|
continue: 'Continuar',
|
|
10
10
|
close: 'Fechar',
|
|
11
11
|
done: 'Pronto',
|
|
12
|
+
grantPermission: 'Conceder Permissão',
|
|
12
13
|
},
|
|
13
14
|
|
|
14
15
|
initialization: {
|
|
@@ -37,11 +38,13 @@ export const ptBR: LanguageStrings = {
|
|
|
37
38
|
title: 'Frente do Documento',
|
|
38
39
|
instruction: 'Posicione a frente do seu documento dentro da moldura',
|
|
39
40
|
button: 'Capturar Frente',
|
|
41
|
+
tips: '• Garanta boa iluminação\n• Evite brilhos e sombras\n• Mantenha o documento plano e completo',
|
|
40
42
|
},
|
|
41
43
|
backId: {
|
|
42
44
|
title: 'Verso do Documento',
|
|
43
45
|
instruction: 'Posicione o verso do seu documento dentro da moldura',
|
|
44
46
|
button: 'Capturar Verso',
|
|
47
|
+
tips: '• Garanta boa iluminação\n• Evite brilhos e sombras\n• Mantenha o documento plano e completo',
|
|
45
48
|
},
|
|
46
49
|
selfie: {
|
|
47
50
|
title: 'Foto do Rosto',
|
|
@@ -53,6 +56,9 @@ export const ptBR: LanguageStrings = {
|
|
|
53
56
|
liveness: {
|
|
54
57
|
title: 'Verificação Facial',
|
|
55
58
|
preparing: 'Preparando verificação...',
|
|
59
|
+
getReady: 'Prepare-se!',
|
|
60
|
+
countdownMessage: 'Você realizará ações.\nSiga as instruções na tela.',
|
|
61
|
+
recordingInstructions: 'Mantenha seu rosto visível e siga as instruções',
|
|
56
62
|
instructions: {
|
|
57
63
|
lookLeft: 'Olhe para a esquerda',
|
|
58
64
|
lookRight: 'Olhe para a direita',
|
|
@@ -63,6 +69,7 @@ export const ptBR: LanguageStrings = {
|
|
|
63
69
|
turnHeadLeft: 'Vire sua cabeça para a esquerda',
|
|
64
70
|
turnHeadRight: 'Vire sua cabeça para a direita',
|
|
65
71
|
stayStill: 'Fique parado',
|
|
72
|
+
openMouth: 'Abra a boca levemente',
|
|
66
73
|
},
|
|
67
74
|
recording: 'Gravando...',
|
|
68
75
|
processing: 'Processando vídeo...',
|
|
@@ -91,7 +98,10 @@ export const ptBR: LanguageStrings = {
|
|
|
91
98
|
},
|
|
92
99
|
|
|
93
100
|
errors: {
|
|
94
|
-
cameraPermissionDenied:
|
|
101
|
+
cameraPermissionDenied: {
|
|
102
|
+
title: 'Permissão de Câmera Necessária',
|
|
103
|
+
message: 'Permissão de câmera negada. Habilite o acesso nas configurações.',
|
|
104
|
+
},
|
|
95
105
|
cameraNotAvailable: 'Câmera não disponível.',
|
|
96
106
|
faceNotDetected: 'Rosto não detectado. Posicione seu rosto claramente.',
|
|
97
107
|
multipleFacesDetected: 'Múltiplos rostos detectados. Apenas uma pessoa deve estar no quadro.',
|
|
@@ -103,6 +113,10 @@ export const ptBR: LanguageStrings = {
|
|
|
103
113
|
networkError: 'Erro de rede. Verifique sua conexão.',
|
|
104
114
|
timeout: 'Tempo esgotado. Tente novamente.',
|
|
105
115
|
unknownError: 'Ocorreu um erro inesperado.',
|
|
116
|
+
videoTooShort: {
|
|
117
|
+
title: 'Gravação Muito Curta',
|
|
118
|
+
message: 'O vídeo deve durar pelo menos 8 segundos. Por favor, tente novamente.',
|
|
119
|
+
},
|
|
106
120
|
},
|
|
107
121
|
|
|
108
122
|
badges: {
|
package/src/i18n/types.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface LanguageStrings {
|
|
|
9
9
|
continue: string;
|
|
10
10
|
close: string;
|
|
11
11
|
done: string;
|
|
12
|
+
grantPermission: string;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
initialization: {
|
|
@@ -37,11 +38,13 @@ export interface LanguageStrings {
|
|
|
37
38
|
title: string;
|
|
38
39
|
instruction: string;
|
|
39
40
|
button: string;
|
|
41
|
+
tips: string;
|
|
40
42
|
};
|
|
41
43
|
backId: {
|
|
42
44
|
title: string;
|
|
43
45
|
instruction: string;
|
|
44
46
|
button: string;
|
|
47
|
+
tips: string;
|
|
45
48
|
};
|
|
46
49
|
selfie: {
|
|
47
50
|
title: string;
|
|
@@ -53,6 +56,9 @@ export interface LanguageStrings {
|
|
|
53
56
|
liveness: {
|
|
54
57
|
title: string;
|
|
55
58
|
preparing: string;
|
|
59
|
+
getReady: string;
|
|
60
|
+
countdownMessage: string;
|
|
61
|
+
recordingInstructions: string;
|
|
56
62
|
instructions: {
|
|
57
63
|
lookLeft: string;
|
|
58
64
|
lookRight: string;
|
|
@@ -63,6 +69,7 @@ export interface LanguageStrings {
|
|
|
63
69
|
turnHeadLeft: string;
|
|
64
70
|
turnHeadRight: string;
|
|
65
71
|
stayStill: string;
|
|
72
|
+
openMouth: string;
|
|
66
73
|
};
|
|
67
74
|
recording: string;
|
|
68
75
|
processing: string;
|
|
@@ -91,7 +98,10 @@ export interface LanguageStrings {
|
|
|
91
98
|
};
|
|
92
99
|
|
|
93
100
|
errors: {
|
|
94
|
-
cameraPermissionDenied:
|
|
101
|
+
cameraPermissionDenied: {
|
|
102
|
+
title: string;
|
|
103
|
+
message: string;
|
|
104
|
+
};
|
|
95
105
|
cameraNotAvailable: string;
|
|
96
106
|
faceNotDetected: string;
|
|
97
107
|
multipleFacesDetected: string;
|
|
@@ -103,6 +113,10 @@ export interface LanguageStrings {
|
|
|
103
113
|
networkError: string;
|
|
104
114
|
timeout: string;
|
|
105
115
|
unknownError: string;
|
|
116
|
+
videoTooShort: {
|
|
117
|
+
title: string;
|
|
118
|
+
message: string;
|
|
119
|
+
};
|
|
106
120
|
};
|
|
107
121
|
|
|
108
122
|
badges: {
|
package/src/types/index.ts
CHANGED