santoid-sdk 7.0.0 → 9.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/CHANGELOG.md +25 -4
- package/README.md +123 -237
- package/api/AbstractService.js +9 -3
- package/api/ApiLivenessSessionService.d.ts +14 -1
- package/api/ApiLivenessSessionService.js +20 -11
- package/browser/index.js +1 -1
- package/browser/liveness-capture.js +2 -0
- package/browser/liveness-capture.js.LICENSE.txt +350 -0
- package/client/age/index.d.ts +18 -0
- package/client/age/index.js +40 -0
- package/client/index.d.ts +4 -2
- package/client/index.js +4 -2
- package/client/liveness/index.d.ts +2 -2
- package/client/liveness/index.js +3 -3
- package/client/liveness/methods/livenessSession/Service.d.ts +10 -3
- package/client/liveness/methods/livenessSession/Service.js +14 -6
- package/client/liveness/methods/livenessSession/index.d.ts +13 -9
- package/client/liveness/methods/livenessSession/index.js +12 -9
- package/client/liveness/methods/livenessSession/isLivenessApproved.d.ts +6 -0
- package/client/liveness/methods/livenessSession/isLivenessApproved.js +13 -0
- package/client/liveness/methods/uploadIdentificationDocument/Service.d.ts +8 -29
- package/client/liveness/methods/uploadIdentificationDocument/Service.js +25 -66
- package/client/liveness/methods/uploadIdentificationDocument/index.d.ts +4 -18
- package/client/liveness/methods/uploadIdentificationDocument/index.js +4 -8
- package/client/liveness-capture/LivenessCapture.d.ts +13 -0
- package/client/liveness-capture/LivenessCapture.js +23 -0
- package/client/liveness-capture/displayText.d.ts +54 -0
- package/client/liveness-capture/displayText.js +57 -0
- package/client/liveness-capture/index.d.ts +36 -0
- package/client/liveness-capture/index.js +2 -0
- package/client/liveness-capture/index.js.LICENSE.txt +350 -0
- package/package.json +11 -4
- package/server/index.d.ts +0 -2
- package/server/index.js +0 -2
- package/server/liveness/index.d.ts +1 -2
- package/server/liveness/index.js +1 -3
- package/server/liveness/methods/uploadIdentificationDocument/Service.d.ts +3 -3
- package/server/liveness/methods/uploadIdentificationDocument/Service.js +2 -2
- package/server/liveness/methods/uploadIdentificationDocument/index.d.ts +7 -21
- package/server/liveness/methods/uploadIdentificationDocument/index.js +4 -10
- package/tsconfig.json +3 -0
- package/tsconfig.prod.json +3 -0
- package/utils/constants.d.ts +1 -2
- package/utils/constants.js +4 -3
- package/utils/error.d.ts +6 -5
- package/utils/error.js +7 -6
- package/utils/index.d.ts +2 -0
- package/utils/index.js +12 -1
- package/utils/types.d.ts +8 -39
- package/webpack.config.cjs +45 -2
- package/client/liveness/methods/livenessDetection/Service.d.ts +0 -28
- package/client/liveness/methods/livenessDetection/Service.js +0 -138
- package/client/liveness/methods/livenessDetection/index.d.ts +0 -23
- package/client/liveness/methods/livenessDetection/index.js +0 -58
- package/server/liveness/methods/livenessDetection/Service.d.ts +0 -6
- package/server/liveness/methods/livenessDetection/Service.js +0 -20
- package/server/liveness/methods/livenessDetection/index.d.ts +0 -13
- package/server/liveness/methods/livenessDetection/index.js +0 -50
- package/utils/websocket.d.ts +0 -18
- package/utils/websocket.js +0 -62
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { ApiTypificationService, type ITypificationResult } from '../../../../api/ApiTypificationService';
|
|
2
2
|
import { ApiFaceMatchService, type IFaceMatchResult } from '../../../../api/ApiFaceMatchService';
|
|
3
|
-
import { type
|
|
3
|
+
import { type IBaseSDKOptions, type TCallbackFunction } from '../../../../utils/types';
|
|
4
4
|
import { SDKError } from '../../../../utils/error';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
options: IServiceOptions<TFrameType, TMediaType>;
|
|
8
|
-
internalOptions: IInternalServiceOptions<TFrameType, TMediaType>;
|
|
5
|
+
export declare class UploadIdentificationDocumentService<TFrameType> {
|
|
6
|
+
options: IServiceOptions<TFrameType>;
|
|
9
7
|
typificationService: ApiTypificationService<TFrameType>;
|
|
10
8
|
faceMatchService: ApiFaceMatchService<TFrameType>;
|
|
11
9
|
results: IUploadIdentificationDocumentResults<TFrameType>;
|
|
12
|
-
constructor(options: IServiceOptions<TFrameType
|
|
10
|
+
constructor(options: IServiceOptions<TFrameType>);
|
|
13
11
|
getResults(): IUploadIdentificationDocumentResults<TFrameType>;
|
|
14
12
|
updateResults(updatedResults: Partial<IUploadIdentificationDocumentResults<TFrameType>>): Promise<void>;
|
|
15
13
|
updateUploadedDocument(file: TFrameType): void;
|
|
16
14
|
waitForResults(requestId: string): Promise<ITypificationResult>;
|
|
17
15
|
waitForResultsFaceMatch(requestId: string): Promise<IFaceMatchResult>;
|
|
18
16
|
startDocumentUpload(file: TFrameType): Promise<void>;
|
|
19
|
-
startLivenessDetection(startLivenessDetectionOptions?: ICustomLivenessOptions<TFrameType, TMediaType>): TLivenessDetectionReturn<TMediaType> | undefined;
|
|
20
17
|
startFaceMatch(firstImage: TFrameType, secondImage: TFrameType): Promise<void>;
|
|
21
|
-
|
|
22
|
-
startAll(file: TFrameType,
|
|
18
|
+
startFaceComparison(selfie: TFrameType): Promise<void>;
|
|
19
|
+
startAll(file: TFrameType, selfie?: TFrameType): Promise<void>;
|
|
23
20
|
}
|
|
24
21
|
type TResultStatuses = 'success' | 'error' | null;
|
|
25
22
|
export interface IUploadIdentificationDocumentResults<TFrameType> {
|
|
@@ -30,12 +27,6 @@ export interface IUploadIdentificationDocumentResults<TFrameType> {
|
|
|
30
27
|
loading: boolean;
|
|
31
28
|
error: SDKError | null;
|
|
32
29
|
};
|
|
33
|
-
liveness: {
|
|
34
|
-
status: TResultStatuses;
|
|
35
|
-
results: ILivenessResults<TFrameType | null | undefined> | null;
|
|
36
|
-
loading: boolean;
|
|
37
|
-
error: SDKError | null;
|
|
38
|
-
};
|
|
39
30
|
faceMatch: {
|
|
40
31
|
status: TResultStatuses;
|
|
41
32
|
results: IFaceMatchResult | null;
|
|
@@ -43,28 +34,16 @@ export interface IUploadIdentificationDocumentResults<TFrameType> {
|
|
|
43
34
|
error: SDKError | null;
|
|
44
35
|
};
|
|
45
36
|
}
|
|
46
|
-
|
|
47
|
-
track?: string;
|
|
48
|
-
token?: string;
|
|
49
|
-
};
|
|
50
|
-
export interface IServiceOptions<TFrameType, TMediaType> extends IBaseSDKOptions {
|
|
51
|
-
livenessDetectionOptions?: ICustomLivenessOptions<TFrameType, TMediaType>;
|
|
37
|
+
export interface IServiceOptions<TFrameType> extends IBaseSDKOptions {
|
|
52
38
|
onUpdate?: (results?: IUploadIdentificationDocumentResults<TFrameType>) => void | Promise<void>;
|
|
53
|
-
onSuccess?: <TFrameType, ResultsType =
|
|
39
|
+
onSuccess?: <TFrameType, ResultsType = IUploadIdentificationDocumentResults<TFrameType>>(results?: ResultsType) => void | Promise<void>;
|
|
54
40
|
onError?: (error?: SDKError) => void | Promise<void>;
|
|
55
41
|
onEnd?: TCallbackFunction;
|
|
56
42
|
onValidationRequested?: (requestInformation: IRequestInformation) => void | Promise<void>;
|
|
57
43
|
onClearInterval?: (interval: ReturnType<typeof setInterval>) => void | Promise<void>;
|
|
58
44
|
}
|
|
59
|
-
type TLivenessDetectionReturn<TMediaType> = Omit<ReturnType<typeof livenessDetection>, 'getVideoStream'> & {
|
|
60
|
-
getVideoStream?: () => TMediaType;
|
|
61
|
-
};
|
|
62
|
-
type TLivenessDetectionFn<TFrameType, TMediaType> = (options: ISDKOptions<TFrameType, TMediaType>) => TLivenessDetectionReturn<TMediaType>;
|
|
63
45
|
interface IRequestInformation {
|
|
64
46
|
track: string;
|
|
65
47
|
requestId: string;
|
|
66
48
|
}
|
|
67
|
-
export interface IInternalServiceOptions<TFrameType, TMediaType> {
|
|
68
|
-
livenessDetection: TLivenessDetectionFn<TFrameType, TMediaType>;
|
|
69
|
-
}
|
|
70
49
|
export {};
|
|
@@ -7,15 +7,13 @@ const error_1 = require("../../../../utils/error");
|
|
|
7
7
|
const uuid_1 = require("uuid");
|
|
8
8
|
const index_1 = require("../../utils/index");
|
|
9
9
|
class UploadIdentificationDocumentService {
|
|
10
|
-
constructor(options
|
|
10
|
+
constructor(options) {
|
|
11
11
|
this.results = {
|
|
12
12
|
uploadedDocument: null,
|
|
13
13
|
typification: { status: null, results: null, loading: false, error: null },
|
|
14
|
-
liveness: { status: null, results: null, loading: false, error: null },
|
|
15
14
|
faceMatch: { status: null, results: null, loading: false, error: null },
|
|
16
15
|
};
|
|
17
16
|
this.options = options;
|
|
18
|
-
this.internalOptions = internalOptions;
|
|
19
17
|
this.typificationService = new ApiTypificationService_1.ApiTypificationService(options, { FormDataClass: FormData, tryDecodeJwt: index_1.tryDecodeJwt });
|
|
20
18
|
this.faceMatchService = new ApiFaceMatchService_1.ApiFaceMatchService(options, { FormDataClass: FormData, tryDecodeJwt: index_1.tryDecodeJwt });
|
|
21
19
|
}
|
|
@@ -24,14 +22,15 @@ class UploadIdentificationDocumentService {
|
|
|
24
22
|
}
|
|
25
23
|
async updateResults(updatedResults) {
|
|
26
24
|
var _a, _b, _c, _d, _e, _f;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
const results = Object.assign(Object.assign({}, this.results), updatedResults);
|
|
26
|
+
this.results = results;
|
|
27
|
+
await ((_b = (_a = this.options).onUpdate) === null || _b === void 0 ? void 0 : _b.call(_a, results));
|
|
28
|
+
// Decide sobre o estado desta atualizacao, nao o de this.results depois do
|
|
29
|
+
// await: com upload e face match em paralelo, as duas atualizacoes finais
|
|
30
|
+
// leriam o mesmo estado e o onSuccess sairia duas vezes.
|
|
31
|
+
const { typification, faceMatch } = results;
|
|
32
|
+
if (typification.results && !typification.loading && !faceMatch.loading) {
|
|
33
|
+
await ((_d = (_c = this.options).onSuccess) === null || _d === void 0 ? void 0 : _d.call(_c, results));
|
|
35
34
|
await ((_f = (_e = this.options).onEnd) === null || _f === void 0 ? void 0 : _f.call(_e));
|
|
36
35
|
}
|
|
37
36
|
}
|
|
@@ -121,47 +120,6 @@ class UploadIdentificationDocumentService {
|
|
|
121
120
|
this.updateResults({ typification: { status: 'error', results: null, loading: false, error: adaptedError } });
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
|
-
startLivenessDetection(startLivenessDetectionOptions) {
|
|
125
|
-
var _a, _b;
|
|
126
|
-
const adaptedLivenessDetection = Object.assign(Object.assign({}, this.options.livenessDetectionOptions), startLivenessDetectionOptions);
|
|
127
|
-
this.updateResults({ liveness: { results: null, status: null, loading: true, error: null } });
|
|
128
|
-
try {
|
|
129
|
-
return this.internalOptions.livenessDetection(Object.assign(Object.assign({ domain: this.options.domain, customId: this.options.customId, customWebSocketUrl: this.options.customWebSocketUrl, token: this.options.token, track: this.options.track }, adaptedLivenessDetection), { onSuccess: async (livenessResults) => {
|
|
130
|
-
var _a;
|
|
131
|
-
await ((_a = adaptedLivenessDetection === null || adaptedLivenessDetection === void 0 ? void 0 : adaptedLivenessDetection.onSuccess) === null || _a === void 0 ? void 0 : _a.call(adaptedLivenessDetection, livenessResults));
|
|
132
|
-
this.updateResults({
|
|
133
|
-
liveness: {
|
|
134
|
-
status: 'success',
|
|
135
|
-
results: (livenessResults),
|
|
136
|
-
loading: false,
|
|
137
|
-
error: null,
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
}, onError: async (livenessErrorDetails) => {
|
|
141
|
-
var _a, _b, _c;
|
|
142
|
-
await ((_a = adaptedLivenessDetection === null || adaptedLivenessDetection === void 0 ? void 0 : adaptedLivenessDetection.onError) === null || _a === void 0 ? void 0 : _a.call(adaptedLivenessDetection, livenessErrorDetails));
|
|
143
|
-
await ((_c = (_b = this.options).onError) === null || _c === void 0 ? void 0 : _c.call(_b, livenessErrorDetails));
|
|
144
|
-
this.updateResults({
|
|
145
|
-
liveness: {
|
|
146
|
-
status: 'error',
|
|
147
|
-
results: null,
|
|
148
|
-
loading: (livenessErrorDetails === null || livenessErrorDetails === void 0 ? void 0 : livenessErrorDetails.code) === 'wrong-position',
|
|
149
|
-
error: livenessErrorDetails !== null && livenessErrorDetails !== void 0 ? livenessErrorDetails : null,
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
} }));
|
|
153
|
-
}
|
|
154
|
-
catch (err) {
|
|
155
|
-
const adaptedError = new error_1.SDKError({
|
|
156
|
-
message: 'Error during liveness detection',
|
|
157
|
-
code: error_1.EUploadIdentificationDocumentErrorCodes.LIVENESS_DETECTION_ERROR,
|
|
158
|
-
fatal: false,
|
|
159
|
-
details: err,
|
|
160
|
-
});
|
|
161
|
-
(_b = (_a = this.options).onError) === null || _b === void 0 ? void 0 : _b.call(_a, adaptedError);
|
|
162
|
-
this.updateResults({ liveness: { status: 'error', results: null, loading: false, error: adaptedError } });
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
123
|
async startFaceMatch(firstImage, secondImage) {
|
|
166
124
|
var _a, _b;
|
|
167
125
|
try {
|
|
@@ -181,26 +139,27 @@ class UploadIdentificationDocumentService {
|
|
|
181
139
|
this.updateResults({ faceMatch: { results: null, status: 'error', loading: false, error: adaptedError } });
|
|
182
140
|
}
|
|
183
141
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
!this.results.typification.loading) {
|
|
191
|
-
await this.startFaceMatch(this.results.uploadedDocument, this.results.liveness.results.successFrames.front);
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
await ((_c = (_b = this.options).onError) === null || _c === void 0 ? void 0 : _c.call(_b, new error_1.SDKError({
|
|
142
|
+
// A selfie vem de quem chama - por exemplo, a foto de referencia da prova de
|
|
143
|
+
// vida (livenessSession). O documento e' o enviado em startDocumentUpload.
|
|
144
|
+
async startFaceComparison(selfie) {
|
|
145
|
+
var _a, _b;
|
|
146
|
+
if (!this.results.uploadedDocument || !selfie) {
|
|
147
|
+
await ((_b = (_a = this.options).onError) === null || _b === void 0 ? void 0 : _b.call(_a, new error_1.SDKError({
|
|
195
148
|
message: 'Unavailable faces',
|
|
196
149
|
code: error_1.EUploadIdentificationDocumentErrorCodes.FACE_MATCH_UNAVAILABLE_FACES_ERROR,
|
|
197
150
|
fatal: false,
|
|
198
151
|
})));
|
|
152
|
+
return;
|
|
199
153
|
}
|
|
154
|
+
await this.startFaceMatch(this.results.uploadedDocument, selfie);
|
|
200
155
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
156
|
+
// Em paralelo: o onSuccess so dispara quando nada mais esta carregando, entao
|
|
157
|
+
// em sequencia ele sairia uma vez sem o face match e outra com ele.
|
|
158
|
+
async startAll(file, selfie) {
|
|
159
|
+
await Promise.all([
|
|
160
|
+
this.startDocumentUpload(file),
|
|
161
|
+
selfie ? this.startFaceComparison(selfie) : undefined,
|
|
162
|
+
]);
|
|
204
163
|
}
|
|
205
164
|
}
|
|
206
165
|
exports.UploadIdentificationDocumentService = UploadIdentificationDocumentService;
|
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import { type IServiceOptions } from './Service';
|
|
2
|
-
|
|
3
|
-
export declare function uploadIdentificationDocument(options: IServiceOptions<TFrameType
|
|
2
|
+
export type TFrameType = File | Blob;
|
|
3
|
+
export declare function uploadIdentificationDocument(options: IServiceOptions<TFrameType>): {
|
|
4
4
|
startDocumentUpload: (file: TFrameType) => Promise<void>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
token?: string | undefined;
|
|
8
|
-
}) | undefined) => (Omit<{
|
|
9
|
-
getVideoStream: () => TMediaType;
|
|
10
|
-
stopLivenessDetection: () => Promise<void>;
|
|
11
|
-
resumeGettingFrames: () => void;
|
|
12
|
-
pauseGettingFrames: () => void;
|
|
13
|
-
}, "getVideoStream"> & {
|
|
14
|
-
getVideoStream?: (() => TMediaType) | undefined;
|
|
15
|
-
}) | undefined;
|
|
16
|
-
startFaceComparison: () => Promise<void>;
|
|
17
|
-
startAll: (file: TFrameType, startLivenessDetectionOptions?: (Omit<import("../../../../utils/types").ISDKOptions<TFrameType, TMediaType>, "track" | "token"> & {
|
|
18
|
-
track?: string | undefined;
|
|
19
|
-
token?: string | undefined;
|
|
20
|
-
}) | undefined) => void;
|
|
5
|
+
startFaceComparison: (selfie: TFrameType) => Promise<void>;
|
|
6
|
+
startAll: (file: TFrameType, selfie?: TFrameType | undefined) => Promise<void>;
|
|
21
7
|
getResults: () => import("./Service").IUploadIdentificationDocumentResults<TFrameType>;
|
|
22
8
|
};
|
|
@@ -2,21 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.uploadIdentificationDocument = void 0;
|
|
4
4
|
const Service_1 = require("./Service");
|
|
5
|
-
const livenessDetection_1 = require("../livenessDetection");
|
|
6
5
|
function uploadIdentificationDocument(options) {
|
|
7
|
-
const uploadIdentificationDocumentService = new Service_1.UploadIdentificationDocumentService(options
|
|
6
|
+
const uploadIdentificationDocumentService = new Service_1.UploadIdentificationDocumentService(options);
|
|
8
7
|
return {
|
|
9
8
|
startDocumentUpload: async (...rest) => {
|
|
10
9
|
await uploadIdentificationDocumentService.startDocumentUpload(...rest);
|
|
11
10
|
},
|
|
12
|
-
startLivenessDetection: (...rest) => {
|
|
13
|
-
return uploadIdentificationDocumentService.startLivenessDetection(...rest);
|
|
14
|
-
},
|
|
15
11
|
startFaceComparison: async (...rest) => {
|
|
16
|
-
await uploadIdentificationDocumentService.
|
|
12
|
+
await uploadIdentificationDocumentService.startFaceComparison(...rest);
|
|
17
13
|
},
|
|
18
|
-
startAll: (...rest) => {
|
|
19
|
-
uploadIdentificationDocumentService.startAll(...rest);
|
|
14
|
+
startAll: async (...rest) => {
|
|
15
|
+
await uploadIdentificationDocumentService.startAll(...rest);
|
|
20
16
|
},
|
|
21
17
|
getResults: (...rest) => {
|
|
22
18
|
return uploadIdentificationDocumentService.getResults(...rest);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type TLivenessCaptureLanguage = 'pt' | 'en';
|
|
3
|
+
export type TLivenessCaptureColorMode = 'light' | 'dark';
|
|
4
|
+
export interface ILivenessCaptureProps {
|
|
5
|
+
sessionId: string;
|
|
6
|
+
region: string;
|
|
7
|
+
language: TLivenessCaptureLanguage;
|
|
8
|
+
colorMode: TLivenessCaptureColorMode;
|
|
9
|
+
onComplete: () => void;
|
|
10
|
+
onError: (message: string, details: unknown) => void;
|
|
11
|
+
onCancel: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function LivenessCapture({ sessionId, region, language, colorMode, onComplete, onError, onCancel, }: ILivenessCaptureProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LivenessCapture = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ui_react_liveness_1 = require("@aws-amplify/ui-react-liveness");
|
|
6
|
+
const ui_react_1 = require("@aws-amplify/ui-react");
|
|
7
|
+
const displayText_1 = require("./displayText");
|
|
8
|
+
const captureTheme = (0, ui_react_1.createTheme)({
|
|
9
|
+
name: 'santoid-liveness-capture',
|
|
10
|
+
overrides: [ui_react_1.defaultDarkModeOverride],
|
|
11
|
+
});
|
|
12
|
+
// Em ingles valem os textos padrao do componente.
|
|
13
|
+
const displayTextByLanguage = {
|
|
14
|
+
pt: displayText_1.portugueseDisplayText,
|
|
15
|
+
en: undefined,
|
|
16
|
+
};
|
|
17
|
+
function LivenessCapture({ sessionId, region, language, colorMode, onComplete, onError, onCancel, }) {
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(ui_react_1.ThemeProvider, { theme: captureTheme, colorMode: colorMode, children: (0, jsx_runtime_1.jsx)(ui_react_liveness_1.FaceLivenessDetector, { sessionId: sessionId, region: region, displayText: displayTextByLanguage[language], onAnalysisComplete: async () => { onComplete(); }, onUserCancel: onCancel, onError: (captureError) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
onError(`${captureError.state}: ${(_b = (_a = captureError.error) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : 'capture failed'}`, captureError);
|
|
21
|
+
} }) }));
|
|
22
|
+
}
|
|
23
|
+
exports.LivenessCapture = LivenessCapture;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare const portugueseDisplayText: {
|
|
2
|
+
readonly cameraMinSpecificationsHeadingText: "Câmera não atende aos requisitos mínimos";
|
|
3
|
+
readonly cameraMinSpecificationsMessageText: "A câmera precisa suportar ao menos 320x240 e 15 quadros por segundo.";
|
|
4
|
+
readonly cameraNotFoundHeadingText: "Câmera não encontrada";
|
|
5
|
+
readonly cameraNotFoundMessageText: "Verifique se há uma câmera conectada e se o navegador tem permissão de acesso.";
|
|
6
|
+
readonly retryCameraPermissionsText: "Tentar novamente";
|
|
7
|
+
readonly waitingCameraPermissionText: "Aguardando permissão de acesso à câmera...";
|
|
8
|
+
readonly a11yVideoLabelText: "Vídeo da câmera para verificação de vivacidade";
|
|
9
|
+
readonly photosensitivityWarningHeadingText: "Aviso de fotossensibilidade";
|
|
10
|
+
readonly photosensitivityWarningBodyText: "Esta verificação exibe luzes coloridas. Tenha cuidado caso você seja fotossensível.";
|
|
11
|
+
readonly photosensitivityWarningInfoText: "Uma pequena porcentagem de pessoas pode ter convulsões ao ser exposta a luzes coloridas. Tenha cuidado se você ou alguém da sua família tiver epilepsia.";
|
|
12
|
+
readonly photosensitivityWarningLabelText: "Mais informações";
|
|
13
|
+
readonly goodFitCaptionText: "Enquadramento correto";
|
|
14
|
+
readonly goodFitAltText: "Rosto totalmente dentro do oval.";
|
|
15
|
+
readonly tooFarCaptionText: "Muito distante";
|
|
16
|
+
readonly tooFarAltText: "Rosto pequeno e distante do oval.";
|
|
17
|
+
readonly startScreenBeginCheckText: "Iniciar verificação";
|
|
18
|
+
readonly hintMoveFaceFrontOfCameraText: "Posicione o rosto em frente à câmera";
|
|
19
|
+
readonly hintTooManyFacesText: "Mantenha apenas um rosto em frente à câmera";
|
|
20
|
+
readonly hintFaceDetectedText: "Rosto detectado";
|
|
21
|
+
readonly hintCanNotIdentifyText: "Rosto não identificado";
|
|
22
|
+
readonly hintTooCloseText: "Afaste-se um pouco";
|
|
23
|
+
readonly hintTooFarText: "Aproxime-se";
|
|
24
|
+
readonly hintHoldFaceForFreshnessText: "Permaneça parado";
|
|
25
|
+
readonly hintConnectingText: "Conectando...";
|
|
26
|
+
readonly hintVerifyingText: "Verificando...";
|
|
27
|
+
readonly hintCheckCompleteText: "Verificação concluída";
|
|
28
|
+
readonly hintIlluminationTooBrightText: "Vá para um ambiente com menos luz";
|
|
29
|
+
readonly hintIlluminationTooDarkText: "Vá para um ambiente mais iluminado";
|
|
30
|
+
readonly hintIlluminationNormalText: "Iluminação adequada";
|
|
31
|
+
readonly hintCenterFaceText: "Centralize seu rosto";
|
|
32
|
+
readonly hintCenterFaceInstructionText: "Instrução: centralize o rosto no oval durante a verificação.";
|
|
33
|
+
readonly hintFaceOffCenterText: "Rosto fora do oval. Centralize-o.";
|
|
34
|
+
readonly hintMatchIndicatorText: "de enquadramento concluído";
|
|
35
|
+
readonly recordingIndicatorText: "Gravando";
|
|
36
|
+
readonly cancelLivenessCheckText: "Cancelar verificação";
|
|
37
|
+
readonly errorLabelText: "Erro";
|
|
38
|
+
readonly connectionTimeoutHeaderText: "Tempo de conexão esgotado";
|
|
39
|
+
readonly connectionTimeoutMessageText: "A conexão está lenta demais para concluir a verificação. Tente novamente.";
|
|
40
|
+
readonly timeoutHeaderText: "Tempo esgotado";
|
|
41
|
+
readonly timeoutMessageText: "O rosto não preencheu o oval a tempo. Tente novamente e mantenha o rosto dentro do oval.";
|
|
42
|
+
readonly faceDistanceHeaderText: "Falha na verificação";
|
|
43
|
+
readonly faceDistanceMessageText: "Evite aproximar-se demais durante a contagem.";
|
|
44
|
+
readonly multipleFacesHeaderText: "Falha na verificação";
|
|
45
|
+
readonly multipleFacesMessageText: "Mais de um rosto detectado. Certifique-se de que apenas um rosto esteja visível.";
|
|
46
|
+
readonly clientHeaderText: "Erro no cliente";
|
|
47
|
+
readonly clientMessageText: "A verificação falhou devido a um problema no dispositivo.";
|
|
48
|
+
readonly serverHeaderText: "Erro no servidor";
|
|
49
|
+
readonly serverMessageText: "Não foi possível concluir a verificação por um erro no servidor.";
|
|
50
|
+
readonly landscapeHeaderText: "Orientação não suportada";
|
|
51
|
+
readonly landscapeMessageText: "Gire o dispositivo para o modo retrato.";
|
|
52
|
+
readonly portraitMessageText: "Use o dispositivo em modo retrato durante a verificação.";
|
|
53
|
+
readonly tryAgainText: "Tentar novamente";
|
|
54
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.portugueseDisplayText = void 0;
|
|
4
|
+
exports.portugueseDisplayText = {
|
|
5
|
+
cameraMinSpecificationsHeadingText: 'Câmera não atende aos requisitos mínimos',
|
|
6
|
+
cameraMinSpecificationsMessageText: 'A câmera precisa suportar ao menos 320x240 e 15 quadros por segundo.',
|
|
7
|
+
cameraNotFoundHeadingText: 'Câmera não encontrada',
|
|
8
|
+
cameraNotFoundMessageText: 'Verifique se há uma câmera conectada e se o navegador tem permissão de acesso.',
|
|
9
|
+
retryCameraPermissionsText: 'Tentar novamente',
|
|
10
|
+
waitingCameraPermissionText: 'Aguardando permissão de acesso à câmera...',
|
|
11
|
+
a11yVideoLabelText: 'Vídeo da câmera para verificação de vivacidade',
|
|
12
|
+
photosensitivityWarningHeadingText: 'Aviso de fotossensibilidade',
|
|
13
|
+
photosensitivityWarningBodyText: 'Esta verificação exibe luzes coloridas. Tenha cuidado caso você seja fotossensível.',
|
|
14
|
+
photosensitivityWarningInfoText: 'Uma pequena porcentagem de pessoas pode ter convulsões ao ser exposta a luzes coloridas. Tenha cuidado se você ou alguém da sua família tiver epilepsia.',
|
|
15
|
+
photosensitivityWarningLabelText: 'Mais informações',
|
|
16
|
+
goodFitCaptionText: 'Enquadramento correto',
|
|
17
|
+
goodFitAltText: 'Rosto totalmente dentro do oval.',
|
|
18
|
+
tooFarCaptionText: 'Muito distante',
|
|
19
|
+
tooFarAltText: 'Rosto pequeno e distante do oval.',
|
|
20
|
+
startScreenBeginCheckText: 'Iniciar verificação',
|
|
21
|
+
hintMoveFaceFrontOfCameraText: 'Posicione o rosto em frente à câmera',
|
|
22
|
+
hintTooManyFacesText: 'Mantenha apenas um rosto em frente à câmera',
|
|
23
|
+
hintFaceDetectedText: 'Rosto detectado',
|
|
24
|
+
hintCanNotIdentifyText: 'Rosto não identificado',
|
|
25
|
+
hintTooCloseText: 'Afaste-se um pouco',
|
|
26
|
+
hintTooFarText: 'Aproxime-se',
|
|
27
|
+
hintHoldFaceForFreshnessText: 'Permaneça parado',
|
|
28
|
+
hintConnectingText: 'Conectando...',
|
|
29
|
+
hintVerifyingText: 'Verificando...',
|
|
30
|
+
hintCheckCompleteText: 'Verificação concluída',
|
|
31
|
+
hintIlluminationTooBrightText: 'Vá para um ambiente com menos luz',
|
|
32
|
+
hintIlluminationTooDarkText: 'Vá para um ambiente mais iluminado',
|
|
33
|
+
hintIlluminationNormalText: 'Iluminação adequada',
|
|
34
|
+
hintCenterFaceText: 'Centralize seu rosto',
|
|
35
|
+
hintCenterFaceInstructionText: 'Instrução: centralize o rosto no oval durante a verificação.',
|
|
36
|
+
hintFaceOffCenterText: 'Rosto fora do oval. Centralize-o.',
|
|
37
|
+
hintMatchIndicatorText: 'de enquadramento concluído',
|
|
38
|
+
recordingIndicatorText: 'Gravando',
|
|
39
|
+
cancelLivenessCheckText: 'Cancelar verificação',
|
|
40
|
+
errorLabelText: 'Erro',
|
|
41
|
+
connectionTimeoutHeaderText: 'Tempo de conexão esgotado',
|
|
42
|
+
connectionTimeoutMessageText: 'A conexão está lenta demais para concluir a verificação. Tente novamente.',
|
|
43
|
+
timeoutHeaderText: 'Tempo esgotado',
|
|
44
|
+
timeoutMessageText: 'O rosto não preencheu o oval a tempo. Tente novamente e mantenha o rosto dentro do oval.',
|
|
45
|
+
faceDistanceHeaderText: 'Falha na verificação',
|
|
46
|
+
faceDistanceMessageText: 'Evite aproximar-se demais durante a contagem.',
|
|
47
|
+
multipleFacesHeaderText: 'Falha na verificação',
|
|
48
|
+
multipleFacesMessageText: 'Mais de um rosto detectado. Certifique-se de que apenas um rosto esteja visível.',
|
|
49
|
+
clientHeaderText: 'Erro no cliente',
|
|
50
|
+
clientMessageText: 'A verificação falhou devido a um problema no dispositivo.',
|
|
51
|
+
serverHeaderText: 'Erro no servidor',
|
|
52
|
+
serverMessageText: 'Não foi possível concluir a verificação por um erro no servidor.',
|
|
53
|
+
landscapeHeaderText: 'Orientação não suportada',
|
|
54
|
+
landscapeMessageText: 'Gire o dispositivo para o modo retrato.',
|
|
55
|
+
portraitMessageText: 'Use o dispositivo em modo retrato durante a verificação.',
|
|
56
|
+
tryAgainText: 'Tentar novamente',
|
|
57
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import '@aws-amplify/ui-react/styles.css';
|
|
2
|
+
import { type TLivenessCaptureColorMode, type TLivenessCaptureLanguage } from './LivenessCapture';
|
|
3
|
+
import { type TLivenessSessionOptions } from '../liveness/methods/livenessSession';
|
|
4
|
+
import { isLivenessApproved } from '../liveness/methods/livenessSession/isLivenessApproved';
|
|
5
|
+
import { type ILivenessSessionResult } from '../../api/ApiLivenessSessionService';
|
|
6
|
+
import { SDKError } from '../../utils/error';
|
|
7
|
+
export { isLivenessApproved };
|
|
8
|
+
export type { TLivenessCaptureColorMode, TLivenessCaptureLanguage };
|
|
9
|
+
export interface ILivenessCaptureResult extends ILivenessSessionResult {
|
|
10
|
+
approved: boolean;
|
|
11
|
+
threshold: number;
|
|
12
|
+
}
|
|
13
|
+
export type TMountLivenessOptions = Omit<TLivenessSessionOptions, 'onResults' | 'onError'> & {
|
|
14
|
+
language?: TLivenessCaptureLanguage;
|
|
15
|
+
colorMode?: TLivenessCaptureColorMode;
|
|
16
|
+
/** Confianca minima para `approved`. Padrao: 80. */
|
|
17
|
+
threshold?: number;
|
|
18
|
+
/** A captura terminou e o resultado esta sendo consultado. */
|
|
19
|
+
onCaptureComplete?: () => void | Promise<void>;
|
|
20
|
+
onResult?: (result: ILivenessCaptureResult) => void | Promise<void>;
|
|
21
|
+
onError?: (error: SDKError) => void | Promise<void>;
|
|
22
|
+
onCancel?: () => void | Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Monta a captura da prova de vida dentro de `element`.
|
|
26
|
+
*
|
|
27
|
+
* Cria a sessao, abre a camera, busca o resultado e entrega em `onResult`
|
|
28
|
+
* com `approved` ja calculado. Funciona em qualquer pagina - com ou sem
|
|
29
|
+
* framework -, porque a captura roda isolada dentro do elemento.
|
|
30
|
+
*
|
|
31
|
+
* O elemento precisa de altura: a captura ocupa o espaco que ele oferece.
|
|
32
|
+
*/
|
|
33
|
+
export declare function mountLiveness(element: HTMLElement, options: TMountLivenessOptions): {
|
|
34
|
+
getSessionId: () => string | null;
|
|
35
|
+
unmount: () => void;
|
|
36
|
+
};
|