@aws-amplify/ui-react-liveness 2.0.6 → 2.0.8
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/esm/components/FaceLivenessDetector/FaceLivenessDetectorCore.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/LivenessCheck/LivenessCameraModule.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/LivenessCheck/LivenessCheck.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/service/machine/index.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/service/types/error.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/service/utils/CustomWebSocketFetchHandler.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/blazefaceFaceDetection.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/service/utils/constants.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/service/utils/liveness.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/service/utils/streamProvider.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/service/utils/videoRecorder.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/shared/DefaultStartScreenComponents.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/shared/FaceLivenessErrorModal.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/shared/Hint.mjs +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +131 -191
- package/dist/types/components/FaceLivenessDetector/LivenessCheck/LivenessCheck.d.ts +0 -3
- package/dist/types/components/FaceLivenessDetector/index.d.ts +1 -1
- package/dist/types/components/FaceLivenessDetector/service/types/error.d.ts +12 -11
- package/dist/types/components/FaceLivenessDetector/service/types/liveness.d.ts +2 -2
- package/dist/types/components/FaceLivenessDetector/service/types/machine.d.ts +2 -2
- package/dist/types/components/FaceLivenessDetector/service/utils/CustomWebSocketFetchHandler.d.ts +37 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/constants.d.ts +8 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/liveness.d.ts +13 -3
- package/dist/types/components/FaceLivenessDetector/service/utils/streamProvider.d.ts +2 -3
- package/dist/types/components/FaceLivenessDetector/service/utils/videoRecorder.d.ts +4 -1
- package/dist/types/components/FaceLivenessDetector/shared/FaceLivenessErrorModal.d.ts +2 -2
- package/dist/types/components/FaceLivenessDetector/shared/Hint.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +10 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActorRef, Interpreter, State } from 'xstate';
|
|
2
2
|
import { ValidationException, InternalServerException, ThrottlingException, ServiceQuotaExceededException, SessionInformation } from '@aws-sdk/client-rekognitionstreaming';
|
|
3
3
|
import { FaceLivenessDetectorCoreProps, FaceMatchState, LivenessOvalDetails, IlluminationState } from './liveness';
|
|
4
|
-
import {
|
|
4
|
+
import { ErrorState } from './error';
|
|
5
5
|
import { VideoRecorder, LivenessStreamProvider, FreshnessColorDisplay } from '../utils';
|
|
6
6
|
import { Face, FaceDetection } from './faceDetection';
|
|
7
7
|
export interface FaceMatchAssociatedParams {
|
|
@@ -45,7 +45,7 @@ export interface HydratedLivenessContext {
|
|
|
45
45
|
ovalAssociatedParams: OvalAssociatedParams;
|
|
46
46
|
faceMatchAssociatedParams: FaceMatchAssociatedParams;
|
|
47
47
|
freshnessColorAssociatedParams: FreshnessColorAssociatedParams;
|
|
48
|
-
errorState:
|
|
48
|
+
errorState: ErrorState;
|
|
49
49
|
livenessStreamProvider: LivenessStreamProvider;
|
|
50
50
|
responseStreamActorRef: ActorRef<any>;
|
|
51
51
|
shouldDisconnect: boolean;
|
package/dist/types/components/FaceLivenessDetector/service/utils/CustomWebSocketFetchHandler.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { HttpRequest, HttpResponse } from '@smithy/protocol-http';
|
|
2
|
+
import { Provider, RequestHandler, RequestHandlerMetadata } from '@smithy/types';
|
|
3
|
+
export interface WebSocketFetchHandlerOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The maximum time in milliseconds that the connection phase of a request
|
|
6
|
+
* may take before the connection attempt is abandoned.
|
|
7
|
+
*/
|
|
8
|
+
connectionTimeout?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Base handler for websocket requests and HTTP request. By default, the request input and output
|
|
12
|
+
* body will be in a ReadableStream, because of interface consistency among middleware.
|
|
13
|
+
* If ReadableStream is not available, like in React-Native, the response body
|
|
14
|
+
* will be an async iterable.
|
|
15
|
+
*/
|
|
16
|
+
export declare class CustomWebSocketFetchHandler {
|
|
17
|
+
readonly metadata: RequestHandlerMetadata;
|
|
18
|
+
private readonly configPromise;
|
|
19
|
+
private readonly httpHandler;
|
|
20
|
+
private readonly sockets;
|
|
21
|
+
private readonly utf8decoder;
|
|
22
|
+
constructor(options?: WebSocketFetchHandlerOptions | Provider<WebSocketFetchHandlerOptions>, httpHandler?: RequestHandler<any, any>);
|
|
23
|
+
/**
|
|
24
|
+
* Destroys the WebSocketHandler.
|
|
25
|
+
* Closes all sockets from the socket pool.
|
|
26
|
+
*/
|
|
27
|
+
destroy(): void;
|
|
28
|
+
handle(request: HttpRequest): Promise<{
|
|
29
|
+
response: HttpResponse;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Removes all closing/closed sockets from the socket pool for URL.
|
|
33
|
+
*/
|
|
34
|
+
private removeNotUsableSockets;
|
|
35
|
+
private waitForReady;
|
|
36
|
+
private connect;
|
|
37
|
+
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export declare const FACE_DISTANCE_THRESHOLD = 0.32;
|
|
2
2
|
export declare const REDUCED_THRESHOLD = 0.4;
|
|
3
3
|
export declare const REDUCED_THRESHOLD_MOBILE = 0.37;
|
|
4
|
+
export declare const WS_CLOSURE_CODE: {
|
|
5
|
+
SUCCESS_CODE: number;
|
|
6
|
+
DEFAULT_ERROR_CODE: number;
|
|
7
|
+
FACE_FIT_TIMEOUT: number;
|
|
8
|
+
USER_CANCEL: number;
|
|
9
|
+
RUNTIME_ERROR: number;
|
|
10
|
+
USER_ERROR_DURING_CONNECTION: number;
|
|
11
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LivenessOvalDetails, IlluminationState, Face, FaceMatchState, BoundingBox,
|
|
1
|
+
import { LivenessOvalDetails, IlluminationState, Face, FaceMatchState, BoundingBox, ErrorState } from '../types';
|
|
2
2
|
import { FaceDetection } from '../types/faceDetection';
|
|
3
3
|
import { ClientFreshnessColorSequence } from '../types/service';
|
|
4
4
|
import { ColorSequence, SessionInformation } from '@aws-sdk/client-rekognitionstreaming';
|
|
@@ -62,7 +62,17 @@ export declare function estimateIllumination(videoEl: HTMLVideoElement): Illumin
|
|
|
62
62
|
* @param device
|
|
63
63
|
*/
|
|
64
64
|
export declare function isCameraDeviceVirtual(device: MediaDeviceInfo): boolean;
|
|
65
|
-
export declare const LivenessErrorStateStringMap:
|
|
65
|
+
export declare const LivenessErrorStateStringMap: {
|
|
66
|
+
RUNTIME_ERROR: string;
|
|
67
|
+
SERVER_ERROR: string;
|
|
68
|
+
TIMEOUT: string;
|
|
69
|
+
FACE_DISTANCE_ERROR: string;
|
|
70
|
+
MULTIPLE_FACES_ERROR: string;
|
|
71
|
+
CAMERA_FRAMERATE_ERROR: string;
|
|
72
|
+
CAMERA_ACCESS_ERROR: string;
|
|
73
|
+
MOBILE_LANDSCAPE_ERROR: string;
|
|
74
|
+
FRESHNESS_TIMEOUT: string;
|
|
75
|
+
};
|
|
66
76
|
export declare const MOCK_COLOR_SEQUENCES: ColorSequence[];
|
|
67
77
|
interface FillOverlayCanvasFractionalInput {
|
|
68
78
|
overlayCanvas: HTMLCanvasElement;
|
|
@@ -86,7 +96,7 @@ export declare function isFaceDistanceBelowThreshold({ faceDetector, videoEl, ov
|
|
|
86
96
|
isMobile?: boolean;
|
|
87
97
|
}): Promise<{
|
|
88
98
|
isDistanceBelowThreshold: boolean;
|
|
89
|
-
error?:
|
|
99
|
+
error?: ErrorState;
|
|
90
100
|
}>;
|
|
91
101
|
export declare function getBoundingBox({ deviceHeight, deviceWidth, height, width, top, left, }: {
|
|
92
102
|
deviceHeight: number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AmazonAIInterpretPredictionsProvider } from '@aws-amplify/predictions';
|
|
2
1
|
import { ClientSessionInformationEvent, LivenessResponseStream } from '@aws-sdk/client-rekognitionstreaming';
|
|
3
2
|
import { VideoRecorder } from './videoRecorder';
|
|
4
3
|
import { AwsCredentialProvider } from '../types';
|
|
@@ -22,7 +21,7 @@ export interface StreamProviderArgs {
|
|
|
22
21
|
credentialProvider?: AwsCredentialProvider;
|
|
23
22
|
}
|
|
24
23
|
export declare const TIME_SLICE = 1000;
|
|
25
|
-
export declare class LivenessStreamProvider
|
|
24
|
+
export declare class LivenessStreamProvider {
|
|
26
25
|
sessionId: string;
|
|
27
26
|
region: string;
|
|
28
27
|
videoRecorder: VideoRecorder;
|
|
@@ -39,7 +38,7 @@ export declare class LivenessStreamProvider extends AmazonAIInterpretPredictions
|
|
|
39
38
|
sendClientInfo(clientInfo: ClientSessionInformationEvent): void;
|
|
40
39
|
stopVideo(): Promise<void>;
|
|
41
40
|
dispatchStopVideoEvent(): void;
|
|
42
|
-
|
|
41
|
+
endStreamWithCode(code?: number): Promise<undefined>;
|
|
43
42
|
private init;
|
|
44
43
|
private getAsyncGeneratorFromReadableStream;
|
|
45
44
|
private startLivenessVideoConnection;
|
|
@@ -7,7 +7,10 @@ export interface VideoRecorderOptions {
|
|
|
7
7
|
* Helper wrapper class over the native MediaRecorder.
|
|
8
8
|
*/
|
|
9
9
|
export declare class VideoRecorder {
|
|
10
|
-
videoStream: ReadableStream<Blob | string
|
|
10
|
+
videoStream: ReadableStream<Blob | string | {
|
|
11
|
+
type: string;
|
|
12
|
+
code: number;
|
|
13
|
+
}>;
|
|
11
14
|
recordingStartApiTimestamp: number | undefined;
|
|
12
15
|
recorderStartTimestamp: number | undefined;
|
|
13
16
|
recorderEndTimestamp: number | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ErrorState } from '../service';
|
|
3
3
|
import { ErrorDisplayText } from '../displayText';
|
|
4
4
|
export interface CheckScreenComponents {
|
|
5
5
|
ErrorView?: React.ComponentType<FaceLivenessErrorModalProps>;
|
|
@@ -10,7 +10,7 @@ export interface FaceLivenessErrorModalProps {
|
|
|
10
10
|
onRetry: () => void;
|
|
11
11
|
}
|
|
12
12
|
export declare const renderErrorModal: ({ errorState, overrideErrorDisplayText, }: {
|
|
13
|
-
errorState:
|
|
13
|
+
errorState: ErrorState;
|
|
14
14
|
overrideErrorDisplayText?: Partial<{
|
|
15
15
|
timeoutHeaderText: string;
|
|
16
16
|
timeoutMessageText: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IlluminationState, FaceMatchState } from '../service';
|
|
3
3
|
import { HintDisplayText } from '../displayText';
|
|
4
|
-
export declare const selectErrorState: import("../hooks").LivenessSelectorFn<
|
|
4
|
+
export declare const selectErrorState: import("../hooks").LivenessSelectorFn<"TIMEOUT" | "RUNTIME_ERROR" | "FRESHNESS_TIMEOUT" | "SERVER_ERROR" | "CAMERA_FRAMERATE_ERROR" | "CAMERA_ACCESS_ERROR" | "FACE_DISTANCE_ERROR" | "MOBILE_LANDSCAPE_ERROR" | "MULTIPLE_FACES_ERROR" | undefined>;
|
|
5
5
|
export declare const selectFaceMatchState: import("../hooks").LivenessSelectorFn<FaceMatchState | undefined>;
|
|
6
6
|
export declare const selectIlluminationState: import("../hooks").LivenessSelectorFn<IlluminationState | undefined>;
|
|
7
7
|
export declare const selectIsFaceFarEnoughBeforeRecording: import("../hooks").LivenessSelectorFn<boolean | undefined>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FaceLivenessDetector, FaceLivenessDetectorProps, FaceLivenessDetectorCore, FaceLivenessDetectorCoreProps, AwsCredentialProvider, AwsCredentials, AwsTemporaryCredentials, } from './components';
|
|
1
|
+
export { FaceLivenessDetector, FaceLivenessDetectorProps, FaceLivenessDetectorCore, FaceLivenessDetectorCoreProps, AwsCredentialProvider, AwsCredentials, AwsTemporaryCredentials, ErrorState, } from './components';
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.
|
|
1
|
+
export declare const VERSION = "2.0.8";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-liveness",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -48,9 +48,13 @@
|
|
|
48
48
|
"react-dom": ">= 16.14.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@aws-amplify/ui": "5.8.
|
|
52
|
-
"@aws-amplify/ui-react": "5.3.
|
|
53
|
-
"@aws-sdk/client-rekognitionstreaming": "3.
|
|
51
|
+
"@aws-amplify/ui": "5.8.1",
|
|
52
|
+
"@aws-amplify/ui-react": "5.3.1",
|
|
53
|
+
"@aws-sdk/client-rekognitionstreaming": "3.398.0",
|
|
54
|
+
"@aws-sdk/util-format-url": "^3.410.0",
|
|
55
|
+
"@smithy/eventstream-serde-browser": "^2.0.4",
|
|
56
|
+
"@smithy/fetch-http-handler": "^2.1.3",
|
|
57
|
+
"@smithy/protocol-http": "^3.0.3",
|
|
54
58
|
"@tensorflow-models/blazeface": "0.0.7",
|
|
55
59
|
"@tensorflow/tfjs-backend-cpu": "3.11.0",
|
|
56
60
|
"@tensorflow/tfjs-backend-wasm": "3.11.0",
|
|
@@ -78,7 +82,9 @@
|
|
|
78
82
|
"eslint": "^8.44.0",
|
|
79
83
|
"jest": "^27.0.4",
|
|
80
84
|
"jest-canvas-mock": "^2.4.0",
|
|
85
|
+
"jest-websocket-mock": "^2.4.1",
|
|
81
86
|
"jest-when": "^3.5.1",
|
|
87
|
+
"mock-socket": "^9.2.1",
|
|
82
88
|
"react": "^17.0.2",
|
|
83
89
|
"react-dom": "^17.0.2",
|
|
84
90
|
"rimraf": "^3.0.2",
|