-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into liveness-user-agent
- Loading branch information
Showing
13 changed files
with
278 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { | ||
RekognitionClient, | ||
CreateFaceLivenessSessionCommand, | ||
} from '@aws-sdk/client-rekognition'; | ||
|
||
/** | ||
* @type {import('@types/aws-lambda').APIGatewayProxyHandler} | ||
*/ | ||
|
||
export const handler = async (event, req) => { | ||
const client = new RekognitionClient({ region: 'us-east-1' }); | ||
const command = new CreateFaceLivenessSessionCommand({}); | ||
const response = await client.send(command); | ||
|
||
return { | ||
statusCode: 200, | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
'Access-Control-Allow-Headers': '*', | ||
}, | ||
body: JSON.stringify({ sessionId: response.SessionId }), | ||
}; | ||
}; |
13 changes: 13 additions & 0 deletions
13
samples/backend-lambda-functions/createSession/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "create", | ||
"version": "2.0.0", | ||
"main": "index.js", | ||
"license": "Apache-2.0", | ||
"type": "module", | ||
"dependencies": { | ||
"@aws-sdk/client-rekognition": "latest" | ||
}, | ||
"devDependencies": { | ||
"@types/aws-lambda": "^8.10.92" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
RekognitionClient, | ||
GetFaceLivenessSessionResultsCommand, | ||
} from '@aws-sdk/client-rekognition'; | ||
|
||
/** | ||
* @type {import('@types/aws-lambda').APIGatewayProxyHandler} | ||
*/ | ||
|
||
export const handler = async (event, req) => { | ||
console.log({ req }); | ||
console.log({ event }); | ||
const client = new RekognitionClient({ region: 'us-east-1' }); | ||
const command = new GetFaceLivenessSessionResultsCommand({ | ||
SessionId: event.pathParameters.sessionId, | ||
}); | ||
const response = await client.send(command); | ||
|
||
const isLive = response.Confidence > 90; | ||
|
||
return { | ||
statusCode: 200, | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
'Access-Control-Allow-Headers': '*', | ||
}, | ||
body: JSON.stringify({ | ||
isLive, | ||
confidenceScore: response.Confidence, | ||
auditImageBytes: Buffer.from( | ||
new Uint8Array(Object.values(response.ReferenceImage.Bytes)) | ||
).toString('base64'), | ||
}), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "getresults", | ||
"version": "2.0.0", | ||
"main": "index.js", | ||
"license": "Apache-2.0", | ||
"type": "module", | ||
"dependencies": { | ||
"@aws-sdk/client-rekognition": "latest" | ||
}, | ||
"devDependencies": { | ||
"@types/aws-lambda": "^8.10.92" | ||
} | ||
} |
Oops, something went wrong.