Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(liveness/nolight): pass in multiple challenges #5047

Closed
wants to merge 7 commits into from

Conversation

esauerbo
Copy link
Contributor

@esauerbo esauerbo commented Mar 7, 2024

Description of changes

  • Updates the sdk to the newer version which accepts multiple challenge types, and pass in multiple challenges in the StartFaceLivenessSession API call.

  • In the state machine, retrieves the selected challenge type from the websocket and event and adds it to the context. Add some utils related to this.

  • Update the CustomWebSocketFetchHandler to the later version included with the new sdk. (The current version of this handler on main is copied directly from the sdk; it was updated in the later version so re-copied it over.)

  • Refactor liveness.ts to work with multiple challenge types.

*This code won't work on it's own. It sends + receives the challenge type, checks for the challenge type, and gets the session information and oval details, but will need the no-light state machine to prevent it from entering the light flashing stage (where it errors out currently).

Issue #, if available

Description of how you validated changes

Checklist

  • Have read the Pull Request Guidelines
  • PR description included
  • Relevant documentation is changed or added (and PR referenced)
  • yarn test passes and tests are updated/added
  • No side effects or sideEffects field updated

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@esauerbo esauerbo requested a review from a team as a code owner March 7, 2024 15:48
Copy link

changeset-bot bot commented Mar 7, 2024

⚠️ No Changeset found

Latest commit: 3947b1b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -1289,7 +1301,15 @@ const responseStreamActor = async (callback: StreamActorCallback) => {
try {
const stream = await responseStream;
for await (const event of stream) {
if (isServerSesssionInformationEvent(event)) {
if (isChallengeEvent(event)) {
Copy link
Contributor Author

@esauerbo esauerbo Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New SDK has new ChallengeEvent on the liveness stream where we can retrieve the challenge type.

@@ -20,13 +20,21 @@ import {
RequestHandler,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is copied (and refactored slightly for our tsconfig) from the updated sdk found here under SDK Previews / Javascript V3.

@@ -20,6 +20,25 @@ import {
REDUCED_THRESHOLD_MOBILE,
} from './constants';

/* Returns the current challenge from the session */
function getChallengeFromSessionInformation(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used alongside functions like getOvalDetailsFromSessionInformation which need to check the challenge type before getting information from the session.
(As opposed to getColorsSequencesFromSessionInformation which is only used for lights flow)

@calebpollman calebpollman changed the base branch from nolight/main to liveness/beta March 15, 2024 17:14
@calebpollman calebpollman changed the base branch from liveness/beta to liveness/no-lights March 15, 2024 17:14
@esauerbo esauerbo deleted the branch liveness/no-lights May 16, 2024 17:36
@esauerbo esauerbo closed this May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant