@aws-amplify/ui-react-liveness 3.0.13 → 3.0.15
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 -5
- package/dist/esm/components/FaceLivenessDetector/LivenessCheck/LivenessCameraModule.mjs +4 -15
- package/dist/esm/components/FaceLivenessDetector/LivenessCheck/LivenessCheck.mjs +1 -5
- package/dist/esm/components/FaceLivenessDetector/service/machine/index.mjs +144 -158
- package/dist/esm/components/FaceLivenessDetector/service/utils/{CustomWebSocketFetchHandler.mjs → createStreamingClient/CustomWebSocketFetchHandler.mjs} +4 -5
- package/dist/esm/components/FaceLivenessDetector/service/utils/createStreamingClient/Signer.mjs +18 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/createStreamingClient/createStreamingClient.mjs +27 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/createStreamingClient/resolveCredentials.mjs +38 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/liveness.mjs +62 -67
- package/dist/esm/components/FaceLivenessDetector/service/utils/streamProvider.mjs +14 -35
- package/dist/esm/components/FaceLivenessDetector/service/utils/videoRecorder.mjs +1 -2
- package/dist/esm/components/FaceLivenessDetector/shared/DefaultStartScreenComponents.mjs +1 -5
- package/dist/esm/components/FaceLivenessDetector/shared/FaceLivenessErrorModal.mjs +1 -5
- package/dist/esm/components/FaceLivenessDetector/shared/Hint.mjs +1 -5
- package/dist/esm/components/FaceLivenessDetector/types/classNames.mjs +0 -5
- package/dist/esm/version.mjs +1 -1
- package/dist/index.js +294 -275
- package/dist/styles.css +1 -1
- package/dist/types/components/FaceLivenessDetector/hooks/useLivenessActor.d.ts +1 -1
- package/dist/types/components/FaceLivenessDetector/service/machine/index.d.ts +3 -4
- package/dist/types/components/FaceLivenessDetector/service/types/credentials.d.ts +9 -10
- package/dist/types/components/FaceLivenessDetector/service/types/machine.d.ts +17 -18
- package/dist/types/components/FaceLivenessDetector/service/utils/createStreamingClient/Signer.d.ts +6 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/createStreamingClient/createStreamingClient.d.ts +9 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/createStreamingClient/index.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/createStreamingClient/resolveCredentials.d.ts +10 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/liveness.d.ts +7 -9
- package/dist/types/components/FaceLivenessDetector/service/utils/streamProvider.d.ts +3 -10
- package/dist/types/components/FaceLivenessDetector/service/utils/videoRecorder.d.ts +1 -7
- package/dist/types/components/FaceLivenessDetector/shared/index.d.ts +0 -3
- package/dist/types/components/FaceLivenessDetector/types/classNames.d.ts +0 -5
- package/dist/types/version.d.ts +1 -1
- package/package.json +5 -4
- package/dist/types/components/FaceLivenessDetector/shared/GoodFitIllustration.d.ts +0 -7
- package/dist/types/components/FaceLivenessDetector/shared/StartScreenFigure.d.ts +0 -8
- package/dist/types/components/FaceLivenessDetector/shared/TooFarIllustration.d.ts +0 -7
- /package/dist/types/components/FaceLivenessDetector/service/utils/{CustomWebSocketFetchHandler.d.ts → createStreamingClient/CustomWebSocketFetchHandler.d.ts} +0 -0
package/dist/styles.css
CHANGED
|
@@ -4205,7 +4205,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
|
|
|
4205
4205
|
|
|
4206
4206
|
.amplify-liveness-landscape-error-modal {
|
|
4207
4207
|
background-color: var(--amplify-colors-background-primary);
|
|
4208
|
-
direction: column;
|
|
4208
|
+
flex-direction: column;
|
|
4209
4209
|
text-align: center;
|
|
4210
4210
|
align-items: center;
|
|
4211
4211
|
justify-content: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useLivenessActor(): [import("xstate").State<
|
|
1
|
+
export declare function useLivenessActor(): [import("xstate").State<import("../service").LivenessContext, import("../service").LivenessEvent, any, any, any>, (event: import("xstate").SingleOrArray<import("xstate").Event<import("../service").LivenessEvent>> | import("xstate").SCXML.Event<import("../service").LivenessEvent>, payload?: import("xstate").EventData | undefined) => import("xstate").State<import("../service").LivenessContext, import("../service").LivenessEvent, any, any, any>];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { LivenessEvent } from '../types';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const livenessMachine: import("xstate").StateMachine<Partial<import("../types").HydratedLivenessContext>, any, LivenessEvent, {
|
|
1
|
+
import { LivenessContext, LivenessEvent } from '../types';
|
|
2
|
+
export declare const livenessMachine: import("xstate").StateMachine<LivenessContext, any, LivenessEvent, {
|
|
4
3
|
value: any;
|
|
5
|
-
context:
|
|
4
|
+
context: LivenessContext;
|
|
6
5
|
}, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, LivenessEvent, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
+
import { CredentialsAndIdentityId } from 'aws-amplify/auth';
|
|
2
|
+
export type AwsCredentials = CredentialsAndIdentityId['credentials'];
|
|
3
|
+
export interface IdentityProvider<IdentityT extends AwsCredentials> {
|
|
4
|
+
(identityProperties?: Record<string, any>): Promise<IdentityT>;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
7
|
+
* @deprecated `AwsTemporaryCredentials` has been replaced with `AwsCredentials`.
|
|
8
|
+
*
|
|
9
|
+
* The `AwsTemporaryCredentials` type may be removed in a future major version of _@aws-amplify/ui-react-liveness_.
|
|
4
10
|
*/
|
|
5
|
-
export interface AwsCredentials {
|
|
6
|
-
readonly accessKeyId: string;
|
|
7
|
-
readonly secretAccessKey: string;
|
|
8
|
-
}
|
|
9
11
|
export interface AwsTemporaryCredentials extends AwsCredentials {
|
|
10
12
|
readonly sessionToken?: string;
|
|
11
13
|
readonly expiration?: Date;
|
|
12
14
|
}
|
|
13
|
-
export
|
|
14
|
-
(identityProperties?: Record<string, any>): Promise<IdentityT>;
|
|
15
|
-
}
|
|
16
|
-
export type AwsCredentialProvider = IdentityProvider<AwsTemporaryCredentials>;
|
|
15
|
+
export type AwsCredentialProvider = IdentityProvider<AwsCredentials>;
|
|
@@ -36,24 +36,23 @@ export interface VideoAssociatedParams {
|
|
|
36
36
|
selectedDeviceId?: string;
|
|
37
37
|
selectableDevices?: MediaDeviceInfo[];
|
|
38
38
|
}
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
responseStreamActorRef
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
isRecordingStopped: boolean;
|
|
39
|
+
export interface LivenessContext {
|
|
40
|
+
challengeId?: string;
|
|
41
|
+
componentProps?: FaceLivenessDetectorCoreProps;
|
|
42
|
+
errorState?: ErrorState;
|
|
43
|
+
faceMatchAssociatedParams?: FaceMatchAssociatedParams;
|
|
44
|
+
faceMatchStateBeforeStart?: FaceMatchState;
|
|
45
|
+
failedAttempts?: number;
|
|
46
|
+
freshnessColorAssociatedParams?: FreshnessColorAssociatedParams;
|
|
47
|
+
isFaceFarEnoughBeforeRecording?: boolean;
|
|
48
|
+
isRecordingStopped?: boolean;
|
|
49
|
+
livenessStreamProvider?: LivenessStreamProvider;
|
|
50
|
+
maxFailedAttempts?: number;
|
|
51
|
+
ovalAssociatedParams?: OvalAssociatedParams;
|
|
52
|
+
responseStreamActorRef?: ActorRef<any>;
|
|
53
|
+
serverSessionInformation?: SessionInformation;
|
|
54
|
+
shouldDisconnect?: boolean;
|
|
55
|
+
videoAssociatedParams?: VideoAssociatedParams;
|
|
57
56
|
}
|
|
58
57
|
export type LivenessEventTypes = 'BEGIN' | 'START_RECORDING' | 'TIMEOUT' | 'ERROR' | 'CANCEL' | 'SET_SESSION_INFO' | 'DISCONNECT_EVENT' | 'SET_DOM_AND_CAMERA_DETAILS' | 'UPDATE_DEVICE_AND_STREAM' | 'SERVER_ERROR' | 'RUNTIME_ERROR' | 'RETRY_CAMERA_CHECK' | 'MOBILE_LANDSCAPE_WARNING';
|
|
59
58
|
export type LivenessEventData = Record<PropertyKey, any>;
|
package/dist/types/components/FaceLivenessDetector/service/utils/createStreamingClient/Signer.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SignatureV4 } from '@smithy/signature-v4';
|
|
2
|
+
import { HttpRequest as HttpRequest, RequestPresigningArguments } from '@smithy/types';
|
|
3
|
+
export declare const REQUEST_EXPIRY = 299;
|
|
4
|
+
export declare class Signer extends SignatureV4 {
|
|
5
|
+
presign(request: HttpRequest, options?: Omit<RequestPresigningArguments, 'expiresIn'>): Promise<HttpRequest>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RekognitionStreamingClient } from '@aws-sdk/client-rekognitionstreaming';
|
|
2
|
+
import { AwsCredentialProvider } from '../../types';
|
|
3
|
+
interface CreateClientConfig {
|
|
4
|
+
credentialsProvider?: AwsCredentialProvider;
|
|
5
|
+
endpointOverride?: string;
|
|
6
|
+
region: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createStreamingClient({ credentialsProvider, endpointOverride, region, }: CreateClientConfig): Promise<RekognitionStreamingClient>;
|
|
9
|
+
export {};
|
package/dist/types/components/FaceLivenessDetector/service/utils/createStreamingClient/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createStreamingClient } from './createStreamingClient';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AwsCredentialProvider, AwsCredentials } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the `credentials` param to be passed to `RekognitionStreamingClient` which accepts either:
|
|
4
|
+
* - a `credentials` object
|
|
5
|
+
* - a `credentialsProvider` callback
|
|
6
|
+
*
|
|
7
|
+
* @param credentialsProvider optional `credentialsProvider` callback
|
|
8
|
+
* @returns {Promise<AwsCredentials | AwsCredentialProvider>} `credentials` object or valid `credentialsProvider` callback
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveCredentials(credentialsProvider?: AwsCredentialProvider): Promise<AwsCredentials | AwsCredentialProvider>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
import {
|
|
4
|
+
import { SessionInformation } from '@aws-sdk/client-rekognitionstreaming';
|
|
5
5
|
interface OvalBoundingBox {
|
|
6
6
|
ovalBoundingBox: BoundingBox;
|
|
7
7
|
minOvalX: number;
|
|
@@ -36,7 +36,6 @@ export declare function getStaticLivenessOvalDetails({ width, height, widthSeed,
|
|
|
36
36
|
centerYSeed?: number;
|
|
37
37
|
ratioMultiplier?: number;
|
|
38
38
|
}): LivenessOvalDetails;
|
|
39
|
-
export declare function drawStaticOval(canvasEl: HTMLCanvasElement, videoEl: HTMLVideoElement, videoMediaStream: MediaStream): void;
|
|
40
39
|
/**
|
|
41
40
|
* Draws the provided liveness oval on the canvas.
|
|
42
41
|
*/
|
|
@@ -47,18 +46,18 @@ export declare function drawLivenessOvalInCanvas({ canvas, oval, scaleFactor, vi
|
|
|
47
46
|
videoEl: HTMLVideoElement;
|
|
48
47
|
isStartScreen?: boolean;
|
|
49
48
|
}): void;
|
|
49
|
+
export declare function drawStaticOval(canvasEl: HTMLCanvasElement, videoEl: HTMLVideoElement, videoMediaStream: MediaStream): void;
|
|
50
50
|
export declare function clearOvalCanvas({ canvas, }: {
|
|
51
51
|
canvas: HTMLCanvasElement;
|
|
52
52
|
}): void;
|
|
53
|
-
|
|
54
|
-
faceMatchState: FaceMatchState;
|
|
55
|
-
faceMatchPercentage: number;
|
|
56
|
-
}
|
|
53
|
+
export declare function generateBboxFromLandmarks(face: Face, oval: LivenessOvalDetails): BoundingBox;
|
|
57
54
|
/**
|
|
58
55
|
* Returns the state of the provided face with respect to the provided liveness oval.
|
|
59
56
|
*/
|
|
60
|
-
export declare function getFaceMatchStateInLivenessOval(face: Face, ovalDetails: LivenessOvalDetails, initialFaceIntersection: number, sessionInformation: SessionInformation):
|
|
61
|
-
|
|
57
|
+
export declare function getFaceMatchStateInLivenessOval(face: Face, ovalDetails: LivenessOvalDetails, initialFaceIntersection: number, sessionInformation: SessionInformation): {
|
|
58
|
+
faceMatchState: FaceMatchState;
|
|
59
|
+
faceMatchPercentage: number;
|
|
60
|
+
};
|
|
62
61
|
/**
|
|
63
62
|
* Returns the illumination state in the provided video frame.
|
|
64
63
|
*/
|
|
@@ -79,7 +78,6 @@ export declare const LivenessErrorStateStringMap: {
|
|
|
79
78
|
MOBILE_LANDSCAPE_ERROR: string;
|
|
80
79
|
FRESHNESS_TIMEOUT: string;
|
|
81
80
|
};
|
|
82
|
-
export declare const MOCK_COLOR_SEQUENCES: ColorSequence[];
|
|
83
81
|
interface FillOverlayCanvasFractionalInput {
|
|
84
82
|
overlayCanvas: HTMLCanvasElement;
|
|
85
83
|
prevColor: string;
|
|
@@ -4,24 +4,16 @@ import { AwsCredentialProvider } from '../types';
|
|
|
4
4
|
export interface StartLivenessStreamInput {
|
|
5
5
|
sessionId: string;
|
|
6
6
|
}
|
|
7
|
-
export interface StartLivenessStreamOutput {
|
|
8
|
-
sessionId: string;
|
|
7
|
+
export interface StartLivenessStreamOutput extends StartLivenessStreamInput {
|
|
9
8
|
stream: WebSocket;
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
accessKeyId: string;
|
|
13
|
-
secretAccessKey: string;
|
|
14
|
-
sessionToken: string;
|
|
15
|
-
}
|
|
16
|
-
export interface StreamProviderArgs {
|
|
17
|
-
sessionId: string;
|
|
10
|
+
interface StreamProviderArgs extends StartLivenessStreamInput {
|
|
18
11
|
region: string;
|
|
19
12
|
stream: MediaStream;
|
|
20
13
|
videoEl: HTMLVideoElement;
|
|
21
14
|
credentialProvider?: AwsCredentialProvider;
|
|
22
15
|
endpointOverride?: string;
|
|
23
16
|
}
|
|
24
|
-
export declare const TIME_SLICE = 1000;
|
|
25
17
|
export declare class LivenessStreamProvider {
|
|
26
18
|
sessionId: string;
|
|
27
19
|
region: string;
|
|
@@ -45,3 +37,4 @@ export declare class LivenessStreamProvider {
|
|
|
45
37
|
private getAsyncGeneratorFromReadableStream;
|
|
46
38
|
private startLivenessVideoConnection;
|
|
47
39
|
}
|
|
40
|
+
export {};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The options for the video recorder.
|
|
3
|
-
*/
|
|
4
|
-
export interface VideoRecorderOptions {
|
|
5
|
-
}
|
|
6
1
|
/**
|
|
7
2
|
* Helper wrapper class over the native MediaRecorder.
|
|
8
3
|
*/
|
|
@@ -18,10 +13,9 @@ export declare class VideoRecorder {
|
|
|
18
13
|
recorderStarted: Promise<void>;
|
|
19
14
|
private _recorder;
|
|
20
15
|
private _stream;
|
|
21
|
-
private _options;
|
|
22
16
|
private _chunks;
|
|
23
17
|
private _recorderStopped;
|
|
24
|
-
constructor(stream: MediaStream
|
|
18
|
+
constructor(stream: MediaStream);
|
|
25
19
|
getState(): string | undefined;
|
|
26
20
|
start(timeSlice?: number): void;
|
|
27
21
|
stop(): Promise<void>;
|
|
@@ -13,11 +13,6 @@ export declare enum LivenessClassNames {
|
|
|
13
13
|
FreshnessCanvas = "amplify-liveness-freshness-canvas",
|
|
14
14
|
InstructionList = "amplify-liveness-instruction-list",
|
|
15
15
|
InstructionOverlay = "amplify-liveness-instruction-overlay",
|
|
16
|
-
Figure = "amplify-liveness-figure",
|
|
17
|
-
FigureCaption = "amplify-liveness-figure__caption",
|
|
18
|
-
FigureIcon = "amplify-liveness-figure__icon",
|
|
19
|
-
FigureImage = "amplify-liveness-figure__image",
|
|
20
|
-
Figures = "amplify-liveness-figures",
|
|
21
16
|
Hint = "amplify-liveness-hint",
|
|
22
17
|
HintText = "amplify-liveness-hint__text",
|
|
23
18
|
LandscapeErrorModal = "amplify-liveness-landscape-error-modal",
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.
|
|
1
|
+
export declare const VERSION = "3.0.15";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-liveness",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.15",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -47,13 +47,14 @@
|
|
|
47
47
|
"react-dom": "^16.14.0 || ^17.0 || ^18.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@aws-amplify/ui": "6.0.
|
|
51
|
-
"@aws-amplify/ui-react": "6.1.
|
|
50
|
+
"@aws-amplify/ui": "6.0.12",
|
|
51
|
+
"@aws-amplify/ui-react": "6.1.6",
|
|
52
52
|
"@aws-sdk/client-rekognitionstreaming": "3.398.0",
|
|
53
53
|
"@aws-sdk/util-format-url": "^3.410.0",
|
|
54
54
|
"@smithy/eventstream-serde-browser": "^2.0.4",
|
|
55
55
|
"@smithy/fetch-http-handler": "^2.1.3",
|
|
56
56
|
"@smithy/protocol-http": "^3.0.3",
|
|
57
|
+
"@smithy/signature-v4": "2.1.4",
|
|
57
58
|
"@mediapipe/face_detection": "~0.4.0",
|
|
58
59
|
"@tensorflow-models/face-detection": "1.0.2",
|
|
59
60
|
"@tensorflow/tfjs-backend-cpu": "4.11.0",
|
|
@@ -80,7 +81,7 @@
|
|
|
80
81
|
"name": "FaceLivenessDetector",
|
|
81
82
|
"path": "dist/esm/index.mjs",
|
|
82
83
|
"import": "{ FaceLivenessDetector }",
|
|
83
|
-
"limit": "
|
|
84
|
+
"limit": "280 kB"
|
|
84
85
|
}
|
|
85
86
|
]
|
|
86
87
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FlexProps } from '@aws-amplify/ui-react';
|
|
3
|
-
interface StartScreenFigureProps extends FlexProps {
|
|
4
|
-
caption: string;
|
|
5
|
-
variation?: 'defaut' | 'error' | 'success';
|
|
6
|
-
}
|
|
7
|
-
export declare const StartScreenFigure: React.FC<StartScreenFigureProps>;
|
|
8
|
-
export {};
|