Skip to content

Commit

Permalink
fix(liveness): alert on signature inconsistency (#156)
Browse files Browse the repository at this point in the history
* fix(liveness): notify user on invalid `signature` errors

closes #155
  • Loading branch information
JeffreyArt1 authored Jan 7, 2024
1 parent 3d826da commit 5511766
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/LivenessQuickStart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,21 @@ export function LivenessQuickStart({ cedula }: Props) {
region="us-east-1"
onUserCancel={onUserCancel}
onError={({ error, state }) => {
let message = error.message;

if (message.includes('{"Message"')) {
message = JSON.parse(message).Message?.split(':')[0];
}

if (message.includes('Signature')) {
AlertError(intl.liveness.error.signature);
}

if (state === 'CAMERA_ACCESS_ERROR') {
AlertError(intl.liveness.camera.notFound.heading);
}

Sentry.captureMessage(error.message, {
Sentry.captureMessage(message, {
user: { id: cedula },
extra: { state, error },
level: 'error',
Expand Down
1 change: 1 addition & 0 deletions src/dictionaries/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
"permissions": "Process again"
},
"error": {
"signature": "Signature has expired. Please verify your system's time settings and attempt again.",
"timeout": {
"heading": "Time's up",
"message": "The face did not fill the oval within the time limit. Try again and completely fill the oval with your face in 7 seconds."
Expand Down
1 change: 1 addition & 0 deletions src/dictionaries/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
"permissions": "Procesar de nuevo"
},
"error": {
"signature": "Firma expirada. Verifique la configuración de hora de su sistema e intente de nuevo.",
"timeout": {
"heading": "Se acabó el tiempo",
"message": "La cara no llenó el óvalo dentro del límite de tiempo. Vuelva a intentarlo y llene completamente el óvalo con la cara en 7 segundos."
Expand Down

0 comments on commit 5511766

Please sign in to comment.