From 5511766b596bce245f2f9ced5992dd0f566341b6 Mon Sep 17 00:00:00 2001 From: Jeffrey Mesa Date: Sun, 7 Jan 2024 13:00:13 -0400 Subject: [PATCH] fix(liveness): alert on signature inconsistency (#156) * fix(liveness): notify user on invalid `signature` errors closes #155 --- src/components/LivenessQuickStart/index.tsx | 12 +++++++++++- src/dictionaries/en.json | 1 + src/dictionaries/es.json | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/LivenessQuickStart/index.tsx b/src/components/LivenessQuickStart/index.tsx index 64cadf29..964b9d98 100644 --- a/src/components/LivenessQuickStart/index.tsx +++ b/src/components/LivenessQuickStart/index.tsx @@ -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', diff --git a/src/dictionaries/en.json b/src/dictionaries/en.json index 85a9dc8d..d5d9365a 100644 --- a/src/dictionaries/en.json +++ b/src/dictionaries/en.json @@ -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." diff --git a/src/dictionaries/es.json b/src/dictionaries/es.json index eb43591a..054179e9 100644 --- a/src/dictionaries/es.json +++ b/src/dictionaries/es.json @@ -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."