Skip to content

Commit

Permalink
hotfix: failed liveness check produces 'not match' error
Browse files Browse the repository at this point in the history
  • Loading branch information
serdiukov-o-nordwhale committed Apr 29, 2021
1 parent e7cc55c commit 180fc09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions src/server/verification/api/ZoomAPI.js
Expand Up @@ -391,34 +391,38 @@ class ZoomAPI {
sessionTokenCheckSucceeded
} = faceScanSecurityChecks

const isFaceMapDoesntMatch = 'matchLevel' in response && Number(matchLevel) < 10

if (!success) {
let isFaceMapDoesntMatch = false
let message = `Unknown exception happened during ${operation} request`

if (!sessionTokenCheckSucceeded) {
message = 'Session token is missing or was failed to be checked'
} else if (!replayCheckSucceeded) {
message = 'Replay check was failed'
} else if (isFaceMapDoesntMatch) {
message = "Face map you're trying to enroll doesn't match the already enrolled one"
} else if (!faceScanLivenessCheckSucceeded) {
message = failedLivenessMessage

if (!auditTrailVerificationCheckSucceeded) {
message += ' because the photoshoots evaluated to be of poor quality'
}
} else if (auditTrailVerificationCheckSucceeded) {
// if all security checks have been passed - check for the match level
isFaceMapDoesntMatch = 'matchLevel' in response && Number(matchLevel) < 10

if (isFaceMapDoesntMatch) {
message = "Face map you're trying to enroll doesn't match the already enrolled one"
}
}

const exception = new Error(message)
let { name } = exception

if (!sessionTokenCheckSucceeded || !replayCheckSucceeded) {
name = SecurityCheckFailed
} else if (isFaceMapDoesntMatch) {
name = FacemapDoesNotMatch
} else if (!faceScanLivenessCheckSucceeded) {
name = LivenessCheckFailed
} else if (isFaceMapDoesntMatch) {
name = FacemapDoesNotMatch
}

assign(exception, { name, response })
Expand Down
4 changes: 2 additions & 2 deletions src/server/verification/api/__tests__/__util__/index.js
Expand Up @@ -204,13 +204,13 @@ export default zoomServiceMock => {
const payloadMatcher = enrollmentPayloadMatcher(enrollmentIdentifier)

const reasonFlags = {
faceScanLivenessCheckSucceeded: false,
faceScanLivenessCheckSucceeded: !!faceMapDoesntMatch,
...withReasonFlags
}

const response = {
externalDatabaseRefID: enrollmentIdentifier,
matchLevel: faceMapDoesntMatch ? 0 : 10,
matchLevel: 0,
success: false
}

Expand Down

0 comments on commit 180fc09

Please sign in to comment.