@aws-amplify/ui-react-liveness 1.0.6 → 2.0.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/dist/esm/components/FaceLivenessDetector/FaceLivenessDetector.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/FaceLivenessDetectorCore.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/LivenessCheck/LivenessCameraModule.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/displayText.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/blazefaceFaceDetection.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/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/components/FaceLivenessDetector/shared/LandscapeErrorModal.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/shared/LivenessIconWithPopover.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/shared/Overlay.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/shared/Toast.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/types/classNames.mjs +1 -1
- package/dist/esm/components/FaceLivenessDetector/utils/getDisplayText.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +135 -9
- package/dist/types/components/FaceLivenessDetector/FaceLivenessDetector.d.ts +1 -4
- package/dist/types/components/FaceLivenessDetector/FaceLivenessDetectorCore.d.ts +11 -0
- package/dist/types/components/FaceLivenessDetector/displayText.d.ts +2 -0
- package/dist/types/components/FaceLivenessDetector/index.d.ts +2 -0
- package/dist/types/components/FaceLivenessDetector/service/types/credentials.d.ts +16 -0
- package/dist/types/components/FaceLivenessDetector/service/types/error.d.ts +2 -1
- package/dist/types/components/FaceLivenessDetector/service/types/index.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/service/types/liveness.d.ts +25 -5
- package/dist/types/components/FaceLivenessDetector/service/types/machine.d.ts +3 -3
- package/dist/types/components/FaceLivenessDetector/service/utils/blazefaceFaceDetection.d.ts +7 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/liveness.d.ts +4 -1
- package/dist/types/components/FaceLivenessDetector/service/utils/streamProvider.d.ts +10 -1
- package/dist/types/components/FaceLivenessDetector/shared/FaceLivenessErrorModal.d.ts +2 -0
- package/dist/types/components/FaceLivenessDetector/types/classNames.d.ts +21 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +5 -6
|
@@ -9,5 +9,6 @@ export declare enum LivenessErrorState {
|
|
|
9
9
|
CAMERA_FRAMERATE_ERROR = "CAMERA_FRAMERATE_ERROR",
|
|
10
10
|
CAMERA_ACCESS_ERROR = "CAMERA_ACCESS_ERROR",
|
|
11
11
|
FACE_DISTANCE_ERROR = "FACE_DISTANCE_ERROR",
|
|
12
|
-
MOBILE_LANDSCAPE_ERROR = "MOBILE_LANDSCAPE_ERROR"
|
|
12
|
+
MOBILE_LANDSCAPE_ERROR = "MOBILE_LANDSCAPE_ERROR",
|
|
13
|
+
MULTIPLE_FACES_ERROR = "MULTIPLE_FACES_ERROR"
|
|
13
14
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { AwsCredentialProvider } from './credentials';
|
|
2
|
+
import { LivenessErrorState } from './error';
|
|
1
3
|
/**
|
|
2
|
-
* The props for the
|
|
4
|
+
* The props for the FaceLivenessDetectorCore which allows for full configuration of auth
|
|
3
5
|
*/
|
|
4
|
-
export interface
|
|
6
|
+
export interface FaceLivenessDetectorCoreProps {
|
|
5
7
|
/**
|
|
6
8
|
* The sessionId as returned by CreateStreamingLivenessSession API
|
|
7
9
|
*/
|
|
@@ -22,7 +24,7 @@ export interface FaceLivenessDetectorProps {
|
|
|
22
24
|
/**
|
|
23
25
|
* Callback called when there is error occured on any step
|
|
24
26
|
*/
|
|
25
|
-
onError?: (
|
|
27
|
+
onError?: (livenessError: LivenessError) => void;
|
|
26
28
|
/**
|
|
27
29
|
* Optional parameter for the disabling the Start/Get Ready Screen, default: false
|
|
28
30
|
*/
|
|
@@ -30,9 +32,18 @@ export interface FaceLivenessDetectorProps {
|
|
|
30
32
|
/**
|
|
31
33
|
* Optional parameter for advanced options for the component
|
|
32
34
|
*/
|
|
33
|
-
config?:
|
|
35
|
+
config?: FaceLivenessDetectorCoreConfig;
|
|
34
36
|
}
|
|
35
|
-
|
|
37
|
+
/**
|
|
38
|
+
* The props for the FaceLivenessDetector extends FaceLivenessDetectorCore with defaults for Amplify Auth configuration
|
|
39
|
+
*/
|
|
40
|
+
export type FaceLivenessDetectorProps = Omit<FaceLivenessDetectorCoreProps, 'config'> & {
|
|
41
|
+
/**
|
|
42
|
+
* Optional parameter for advanced options for the component
|
|
43
|
+
*/
|
|
44
|
+
config?: FaceLivenessDetectorConfig;
|
|
45
|
+
};
|
|
46
|
+
export interface FaceLivenessDetectorCoreConfig {
|
|
36
47
|
/**
|
|
37
48
|
* overrides the Wasm backend binary CDN path
|
|
38
49
|
* default is https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.11.0/dist/.
|
|
@@ -44,7 +55,12 @@ export interface FaceLivenessDetectorConfig {
|
|
|
44
55
|
* default is https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/default/1/model.json?tfjs-format=file
|
|
45
56
|
*/
|
|
46
57
|
faceModelUrl?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Optional parameter allowing usage of custom credential providers when calling the Rekognition stream endpoint
|
|
60
|
+
*/
|
|
61
|
+
credentialProvider?: AwsCredentialProvider;
|
|
47
62
|
}
|
|
63
|
+
export type FaceLivenessDetectorConfig = Omit<FaceLivenessDetectorCoreConfig, 'credentialProvider'>;
|
|
48
64
|
/**
|
|
49
65
|
* The coordiates of any bounding box
|
|
50
66
|
*/
|
|
@@ -83,3 +99,7 @@ export declare enum FaceMatchState {
|
|
|
83
99
|
FACE_IDENTIFIED = "ONE FACE IDENTIFIED",
|
|
84
100
|
TOO_MANY = "TOO MANY FACES"
|
|
85
101
|
}
|
|
102
|
+
export interface LivenessError {
|
|
103
|
+
state: LivenessErrorState;
|
|
104
|
+
error: Error;
|
|
105
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActorRef, Interpreter, State } from 'xstate';
|
|
2
2
|
import { ValidationException, InternalServerException, ThrottlingException, ServiceQuotaExceededException, SessionInformation } from '@aws-sdk/client-rekognitionstreaming';
|
|
3
|
-
import {
|
|
3
|
+
import { FaceLivenessDetectorCoreProps, FaceMatchState, LivenessOvalDetails, IlluminationState } from './liveness';
|
|
4
4
|
import { LivenessErrorState } from './error';
|
|
5
5
|
import { VideoRecorder, LivenessStreamProvider, FreshnessColorDisplay } from '../utils';
|
|
6
6
|
import { Face, FaceDetection } from './faceDetection';
|
|
@@ -38,7 +38,7 @@ export type LivenessContext = Partial<HydratedLivenessContext>;
|
|
|
38
38
|
export interface HydratedLivenessContext {
|
|
39
39
|
maxFailedAttempts: number;
|
|
40
40
|
failedAttempts: number;
|
|
41
|
-
componentProps:
|
|
41
|
+
componentProps: FaceLivenessDetectorCoreProps;
|
|
42
42
|
serverSessionInformation: SessionInformation;
|
|
43
43
|
challengeId: string;
|
|
44
44
|
videoAssociatedParams: VideoAssociatedParams;
|
|
@@ -53,7 +53,7 @@ export interface HydratedLivenessContext {
|
|
|
53
53
|
isFaceFarEnoughBeforeRecording: boolean;
|
|
54
54
|
isRecordingStopped: boolean;
|
|
55
55
|
}
|
|
56
|
-
export type LivenessEventTypes = 'BEGIN' | 'START_RECORDING' | 'TIMEOUT' | 'ERROR' | 'CANCEL' | 'SET_SESSION_INFO' | 'DISCONNECT_EVENT' | 'SET_DOM_AND_CAMERA_DETAILS' | 'SERVER_ERROR' | 'RETRY_CAMERA_CHECK' | 'MOBILE_LANDSCAPE_WARNING';
|
|
56
|
+
export type LivenessEventTypes = 'BEGIN' | 'START_RECORDING' | 'TIMEOUT' | 'ERROR' | 'CANCEL' | 'SET_SESSION_INFO' | 'DISCONNECT_EVENT' | 'SET_DOM_AND_CAMERA_DETAILS' | 'SERVER_ERROR' | 'RUNTIME_ERROR' | 'RETRY_CAMERA_CHECK' | 'MOBILE_LANDSCAPE_WARNING';
|
|
57
57
|
export type LivenessEventData = Record<PropertyKey, any>;
|
|
58
58
|
export interface LivenessEvent {
|
|
59
59
|
type: LivenessEventTypes;
|
package/dist/types/components/FaceLivenessDetector/service/utils/blazefaceFaceDetection.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import '@tensorflow/tfjs-backend-cpu';
|
|
2
2
|
import { FaceDetection, Face } from '../types';
|
|
3
3
|
type BlazeFaceModelBackend = 'wasm' | 'cpu';
|
|
4
|
+
export declare const BLAZEFACE_VERSION = "0.0.7";
|
|
5
|
+
/**
|
|
6
|
+
* WARNING: When updating these links,
|
|
7
|
+
* also make sure to update documentation and the link in the canary/e2e test "canary/e2e/features/liveness/face-detect.feature"
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_BLAZEFACE_URL: string;
|
|
10
|
+
export declare const DEFAULT_TFJS_WASM_URL: string;
|
|
4
11
|
/**
|
|
5
12
|
* The BlazeFace implementation of the FaceDetection interface.
|
|
6
13
|
*/
|
|
@@ -84,7 +84,10 @@ export declare function isFaceDistanceBelowThreshold({ faceDetector, videoEl, ov
|
|
|
84
84
|
ovalDetails: LivenessOvalDetails;
|
|
85
85
|
reduceThreshold?: boolean;
|
|
86
86
|
isMobile?: boolean;
|
|
87
|
-
}): Promise<
|
|
87
|
+
}): Promise<{
|
|
88
|
+
isDistanceBelowThreshold: boolean;
|
|
89
|
+
error?: LivenessErrorState.FACE_DISTANCE_ERROR | LivenessErrorState.MULTIPLE_FACES_ERROR;
|
|
90
|
+
}>;
|
|
88
91
|
export declare function getBoundingBox({ deviceHeight, deviceWidth, height, width, top, left, }: {
|
|
89
92
|
deviceHeight: number;
|
|
90
93
|
deviceWidth: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AmazonAIInterpretPredictionsProvider } from '@aws-amplify/predictions';
|
|
2
2
|
import { ClientSessionInformationEvent, LivenessResponseStream } from '@aws-sdk/client-rekognitionstreaming';
|
|
3
3
|
import { VideoRecorder } from './videoRecorder';
|
|
4
|
+
import { AwsCredentialProvider } from '../types';
|
|
4
5
|
export interface StartLivenessStreamInput {
|
|
5
6
|
sessionId: string;
|
|
6
7
|
}
|
|
@@ -13,18 +14,26 @@ export interface Credentials {
|
|
|
13
14
|
secretAccessKey: string;
|
|
14
15
|
sessionToken: string;
|
|
15
16
|
}
|
|
17
|
+
export interface StreamProviderArgs {
|
|
18
|
+
sessionId: string;
|
|
19
|
+
region: string;
|
|
20
|
+
stream: MediaStream;
|
|
21
|
+
videoEl: HTMLVideoElement;
|
|
22
|
+
credentialProvider?: AwsCredentialProvider;
|
|
23
|
+
}
|
|
16
24
|
export declare const TIME_SLICE = 1000;
|
|
17
25
|
export declare class LivenessStreamProvider extends AmazonAIInterpretPredictionsProvider {
|
|
18
26
|
sessionId: string;
|
|
19
27
|
region: string;
|
|
20
28
|
videoRecorder: VideoRecorder;
|
|
21
29
|
responseStream: AsyncIterable<LivenessResponseStream>;
|
|
30
|
+
credentialProvider?: AwsCredentialProvider;
|
|
22
31
|
private _reader;
|
|
23
32
|
private videoEl;
|
|
24
33
|
private _client;
|
|
25
34
|
private _stream;
|
|
26
35
|
private initPromise;
|
|
27
|
-
constructor(sessionId
|
|
36
|
+
constructor({ sessionId, region, stream, videoEl, credentialProvider, }: StreamProviderArgs);
|
|
28
37
|
getResponseStream(): Promise<AsyncIterable<LivenessResponseStream>>;
|
|
29
38
|
startRecordingLivenessVideo(): void;
|
|
30
39
|
sendClientInfo(clientInfo: ClientSessionInformationEvent): void;
|
|
@@ -16,6 +16,8 @@ export declare const renderErrorModal: ({ errorState, overrideErrorDisplayText,
|
|
|
16
16
|
timeoutMessageText: string;
|
|
17
17
|
faceDistanceHeaderText: string;
|
|
18
18
|
faceDistanceMessageText: string;
|
|
19
|
+
multipleFacesHeaderText: string;
|
|
20
|
+
multipleFacesMessageText: string;
|
|
19
21
|
clientHeaderText: string;
|
|
20
22
|
clientMessageText: string;
|
|
21
23
|
serverHeaderText: string;
|
|
@@ -7,6 +7,8 @@ export declare enum LivenessClassNames {
|
|
|
7
7
|
DescriptionBulletIndex = "amplify-liveness-description-bullet__index",
|
|
8
8
|
DescriptionBulletIndexText = "amplify-liveness-description-bullet__index__text",
|
|
9
9
|
DescriptionBulletMessage = "amplify-liveness-description-bullet__message",
|
|
10
|
+
ErrorModal = "amplify-liveness-error-modal",
|
|
11
|
+
ErrorModalHeading = "amplify-liveness-error-modal__heading",
|
|
10
12
|
FadeOut = "amplify-liveness-fade-out",
|
|
11
13
|
FreshnessCanvas = "amplify-liveness-freshness-canvas",
|
|
12
14
|
InstructionList = "amplify-liveness-instruction-list",
|
|
@@ -16,12 +18,31 @@ export declare enum LivenessClassNames {
|
|
|
16
18
|
FigureIcon = "amplify-liveness-figure__icon",
|
|
17
19
|
FigureImage = "amplify-liveness-figure__image",
|
|
18
20
|
Figures = "amplify-liveness-figures",
|
|
21
|
+
Hint = "amplify-liveness-hint",
|
|
22
|
+
HintText = "amplify-liveness-hint__text",
|
|
23
|
+
LandscapeErrorModal = "amplify-liveness-landscape-error-modal",
|
|
24
|
+
LandscapeErrorModalButton = "amplify-liveness-landscape-error-modal__button",
|
|
25
|
+
LandscapeErrorModalHeader = "amplify-liveness-landscape-error-modal__header",
|
|
19
26
|
Loader = "amplify-liveness-loader",
|
|
20
27
|
MatchIndicator = "amplify-liveness-match-indicator",
|
|
21
28
|
OvalCanvas = "amplify-liveness-oval-canvas",
|
|
29
|
+
OpaqueOverlay = "amplify-liveness-overlay-opaque",
|
|
30
|
+
Overlay = "amplify-liveness-overlay",
|
|
31
|
+
Popover = "amplify-liveness-popover",
|
|
32
|
+
PopoverContainer = "amplify-liveness-popover__container",
|
|
33
|
+
PopoverAnchor = "amplify-liveness-popover__anchor",
|
|
34
|
+
PopoverAnchorSecondary = "amplify-liveness-popover__anchor-secondary",
|
|
22
35
|
RecordingIconContainer = "amplify-liveness-recording-icon-container",
|
|
23
36
|
RecordingIcon = "amplify-liveness-recording-icon",
|
|
37
|
+
StartScreenHeader = "amplify-liveness-start-screen-header",
|
|
38
|
+
StartScreenHeaderBody = "amplify-liveness-start-screen-header__body",
|
|
39
|
+
StartScreenHeaderHeading = "amplify-liveness-start-screen-header__heading",
|
|
40
|
+
StartScreenWarning = "amplify-liveness-start-screen-warning",
|
|
41
|
+
StartScreenInstructions = "amplify-liveness-start-screen-instructions",
|
|
42
|
+
StartScreenInstructionsHeading = "amplify-liveness-start-screen-instructions__heading",
|
|
24
43
|
Toast = "amplify-liveness-toast",
|
|
44
|
+
ToastContainer = "amplify-liveness-toast__container",
|
|
45
|
+
ToastMessage = "amplify-liveness-toast__message",
|
|
25
46
|
Video = "amplify-liveness-video",
|
|
26
47
|
VideoAnchor = "amplify-liveness-video-anchor"
|
|
27
48
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FaceLivenessDetector, FaceLivenessDetectorProps } from './components';
|
|
1
|
+
export { FaceLivenessDetector, FaceLivenessDetectorProps, FaceLivenessDetectorCore, FaceLivenessDetectorCoreProps, AwsCredentialProvider, AwsCredentials, AwsTemporaryCredentials, } from './components';
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "
|
|
1
|
+
export declare const VERSION = "2.0.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-liveness",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"react-dom": ">= 16.14.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@aws-amplify/ui": "5.6.
|
|
52
|
-
"@aws-amplify/ui-react": "5.0.
|
|
51
|
+
"@aws-amplify/ui": "5.6.8",
|
|
52
|
+
"@aws-amplify/ui-react": "5.0.6",
|
|
53
53
|
"@aws-sdk/client-rekognitionstreaming": "3.360.0",
|
|
54
54
|
"@tensorflow-models/blazeface": "0.0.7",
|
|
55
55
|
"@tensorflow/tfjs-backend-cpu": "3.11.0",
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
"@xstate/react": "3.0.0",
|
|
60
60
|
"classnames": "2.3.1",
|
|
61
61
|
"nanoid": "3.1.31",
|
|
62
|
-
"react-countdown-circle-timer": "^2.5.4",
|
|
63
62
|
"tslib": "2.4.1",
|
|
64
63
|
"xstate": "^4.33.6"
|
|
65
64
|
},
|
|
@@ -67,7 +66,7 @@
|
|
|
67
66
|
"@aws-amplify/eslint-config-amplify-ui": "0.0.0",
|
|
68
67
|
"@rollup/plugin-commonjs": "^22.0.1",
|
|
69
68
|
"@rollup/plugin-typescript": "^8.3.1",
|
|
70
|
-
"@size-limit/preset-big-lib": "^
|
|
69
|
+
"@size-limit/preset-big-lib": "^8.2.6",
|
|
71
70
|
"@testing-library/jest-dom": "^5.14.1",
|
|
72
71
|
"@testing-library/react": "^12.0.0",
|
|
73
72
|
"@testing-library/react-hooks": "^7.0.1",
|
|
@@ -87,7 +86,7 @@
|
|
|
87
86
|
"rollup-plugin-node-externals": "^4.1.1",
|
|
88
87
|
"rollup-plugin-styles": "^4.0.0",
|
|
89
88
|
"rollup-plugin-terser": "^7.0.2",
|
|
90
|
-
"size-limit": "^
|
|
89
|
+
"size-limit": "^8.2.6",
|
|
91
90
|
"ts-jest": "^27.0.3",
|
|
92
91
|
"web-streams-polyfill": "^3.2.1"
|
|
93
92
|
},
|