santoid-sdk 1.0.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +113 -29
  2. package/browser/liveness/index.js +1 -0
  3. package/liveness/index.d.ts +9 -0
  4. package/liveness/index.js +29 -0
  5. package/liveness/methods/livenessDetection.d.ts +6 -0
  6. package/{dist/esm/liveness/index.js → liveness/methods/livenessDetection.js} +2 -22
  7. package/liveness/methods/uploadIdentificationDocument.d.ts +91 -0
  8. package/liveness/methods/uploadIdentificationDocument.js +236 -0
  9. package/liveness/utils/index.d.ts +2 -0
  10. package/{dist/esm/liveness → liveness}/utils/index.js +10 -1
  11. package/{dist/esm/liveness → liveness}/utils/types.d.ts +2 -2
  12. package/{dist/node/liveness → liveness}/utils/types.js +1 -1
  13. package/{dist/esm/liveness → liveness}/utils/websocket.js +1 -1
  14. package/{dist/node → node}/auth/index.js +3 -6
  15. package/node/liveness/index.d.ts +9 -0
  16. package/node/liveness/index.js +29 -0
  17. package/node/liveness/methods/livenessDetection.d.ts +6 -0
  18. package/{dist/node/liveness/index.js → node/liveness/methods/livenessDetection.js} +2 -3
  19. package/node/liveness/methods/uploadIdentificationDocument.d.ts +91 -0
  20. package/node/liveness/methods/uploadIdentificationDocument.js +237 -0
  21. package/node/liveness/utils/index.d.ts +2 -0
  22. package/{dist/node → node}/liveness/utils/index.js +10 -1
  23. package/package.json +12 -29
  24. package/tsconfig.json +6 -2
  25. package/tsconfig.prod.json +26 -0
  26. package/{dist/utils → utils}/constants.d.ts +1 -1
  27. package/{dist/utils → utils}/constants.js +1 -1
  28. package/{dist/utils → utils}/types.d.ts +11 -8
  29. package/webpack.config.cjs +12 -2
  30. package/dist/browser/liveness/index.js +0 -1
  31. package/dist/esm/liveness/index.d.ts +0 -9
  32. package/dist/esm/liveness/utils/index.d.ts +0 -1
  33. package/dist/node/liveness/index.d.ts +0 -4
  34. package/dist/node/liveness/utils/index.d.ts +0 -1
  35. package/jest.config.cjs +0 -17
  36. package/src/esm/liveness/index.ts +0 -156
  37. package/src/esm/liveness/utils/getNextFrame.ts +0 -76
  38. package/src/esm/liveness/utils/index.ts +0 -16
  39. package/src/esm/liveness/utils/types.ts +0 -7
  40. package/src/esm/liveness/utils/websocket.ts +0 -33
  41. package/src/index.ts +0 -0
  42. package/src/node/auth/index.ts +0 -43
  43. package/src/node/liveness/index.ts +0 -135
  44. package/src/node/liveness/utils/index.ts +0 -3
  45. package/src/node/liveness/utils/types.ts +0 -8
  46. package/src/node/liveness/utils/websocket.ts +0 -35
  47. package/src/utils/constants.ts +0 -3
  48. package/src/utils/types.ts +0 -46
  49. /package/{dist/index.d.ts → index.d.ts} +0 -0
  50. /package/{dist/index.js → index.js} +0 -0
  51. /package/{dist/esm/liveness → liveness}/utils/getNextFrame.d.ts +0 -0
  52. /package/{dist/esm/liveness → liveness}/utils/getNextFrame.js +0 -0
  53. /package/{dist/esm/liveness → liveness}/utils/websocket.d.ts +0 -0
  54. /package/{dist/node → node}/auth/index.d.ts +0 -0
  55. /package/{dist/node → node}/liveness/utils/types.d.ts +0 -0
  56. /package/{dist/esm → node}/liveness/utils/types.js +0 -0
  57. /package/{dist/node → node}/liveness/utils/websocket.d.ts +0 -0
  58. /package/{dist/node → node}/liveness/utils/websocket.js +0 -0
  59. /package/{dist/utils → utils}/types.js +0 -0
package/README.md CHANGED
@@ -56,9 +56,7 @@ startSDK()
56
56
  ### Prova de Vida
57
57
  Atualmente, o SDK conta com a funcionalidade de **Prova de Vida**, que possibilita a verificação do usuário atual, avaliando se uma pessoa real está realizando as atividades online por meio de uma rápida análise facial.
58
58
 
59
- ### Como utilizar?
60
-
61
- #### Em JavaScript
59
+ #### Utilização em JavaScript
62
60
  Para utilizar a funcionalidade de Prova de Vida, é necessário importar a função para iniciar a verificação e passar alguns parâmetros:
63
61
 
64
62
  ```ts
@@ -91,8 +89,8 @@ async function startLivenessDetection () {
91
89
  errorCallback: ({ errorCode }) => {},
92
90
 
93
91
  // (Opcional) Função executada em caso de sucesso
94
- // O ID da solicitação pode ser recebido pelos parâmetros, como no exemplo abaixo
95
- successCallback: ({ livenessId }) => {},
92
+ // O ID da solicitação e os frames com sucesso podem ser recebidos pelos parâmetros, como no exemplo abaixo
93
+ successCallback: ({ livenessId, successFrames }) => {},
96
94
 
97
95
  // (Opcional) Função executada quando a validação é finalizada
98
96
  endCallback: () => {},
@@ -118,7 +116,7 @@ async function startLivenessDetection () {
118
116
  video.srcObject = videoStream
119
117
  }
120
118
  ```
121
- #### Em Node.js
119
+ #### Utilização em Node.js
122
120
  Caso deseje executar a função da prova de vida no servidor (Node.js), é obrigatório informar ao SDK a função de obtenção de frames, a qual deve retornar um Buffer ou semelhante (bytes da imagem do frame).
123
121
 
124
122
  Fique atento ao caminho de importação da função, que muda para o caso de execução no servidor (Node.js):
@@ -144,11 +142,13 @@ Caso deseje utilizar a biblioteca via CDN, importando-a diretamente em uma tag *
144
142
 
145
143
  Ao importar a biblioteca via tag script, a função **livenessDetection** ficará disponível por meio da classe **SantoiDSDK**.
146
144
 
145
+ Substitua o **VERSION** pela versão desejada.
146
+
147
147
  ```html
148
148
  <body>
149
149
  <button onclick="startLiveness()">Iniciar</button>
150
150
 
151
- <script src="https://cdn.jsdelivr.net/npm/santoid-sdk@1.0.6/dist/browser/liveness/index.js"></script>
151
+ <script src="https://cdn.jsdelivr.net/npm/santoid-sdk@VERSION/browser/liveness/index.js"></script>
152
152
 
153
153
  <script>
154
154
  async function startLiveness () {
@@ -163,37 +163,121 @@ Ao importar a biblioteca via tag script, a função **livenessDetection** ficar
163
163
  </body>
164
164
  ```
165
165
 
166
- ## Possíveis dúvidas
166
+ ### Fluxo Completo
167
+ Com a funcionalidade do teste do fluxo completo do Santo iD, é possível iniciar a análise de prova de vida juntamente com a análise de um documento enviado ao mesmo tempo.
168
+
169
+ Ao chamar a função **uploadIdentificationDocument**, ela retorna um determinado conjunto de métodos, os quais possibilitam as análises.
170
+
171
+ Com o método retornado **startAll** é possível iniciar todas as análises simultaneamente, porém também é possível iniciar uma de cada vez com os métodos **startDocumentUpload**, **startLivenessDetection** e **startFaceComparison**.
167
172
 
168
- ### A importação da biblioteca não está funcionando pelos caminhos indicados na documentação
169
- Caso a biblioteca não esteja funcionando pelos caminhos indicados anteriormente para utilização em JavaScript ou Node.js, seja por incompatibilidade com o framework utilizado ou com alguma outra configuração do ambiente, tente adicionar o caminho **dist** após o nome da biblioteca e referenciar o caminho completo até o arquivo **index.js**, como nos exemplos abaixo:
173
+ Entretanto, o método **startFaceComparison** para a comparação entre as faces detectadas será chamado automaticamente quando os outros dois métodos forem chamados, sendo mais útil apenas para reiniciar a comparação em caso de erro.
174
+
175
+ #### Utilização em JavaScript
170
176
 
171
177
  ```ts
172
- // Exemplo 1
173
- import { livenessDetection } from 'santoid-sdk/dist/esm/liveness/index.js'
178
+ import { uploadIdentificationDocument } from 'santoid-sdk/liveness'
174
179
 
175
- // Exemplo 2
176
- import { livenessDetection } from 'santoid-sdk/dist/node/liveness/index.js'
180
+ const { startAll, startDocumentUpload, startLivenessDetection } = uploadIdentificationDocument({
181
+ token: '...',
182
+ track: '...',
183
+ domain: '...',
177
184
 
178
- // Exemplo 3
179
- import { initialize } from 'santoid-sdk/dist/node/auth/index.js'
180
- ```
185
+ resultChangeCallback (results) => {
186
+ // ...
187
+ },
181
188
 
182
- ## Para desenvolvedores
183
- Caso seja um desenvolvedor e deseje realizar alguma alteração no código da biblioteca, abaixo estão alguns comandos úteis que serão necessários:
189
+ errorCallback (error) {
190
+ // ...
191
+ },
184
192
 
185
- ### Instalação de dependências
186
- ```
187
- yarn
188
- ```
193
+ successCallback (results) {
194
+ // ...
195
+ },
196
+
197
+ endCallback () {
198
+ // ...
199
+ },
200
+ })
201
+
202
+ // Iniciar análises ao mesmo tempo
203
+ startAll(file, {
204
+ // Opções para o liveness detection
205
+ // São os mesmos da função livenessDetection, porém não é necessário fornecer o token, a track e o domain novamente aqui
206
+
207
+ nextStepCallback (step) {
208
+ // ...
209
+ },
189
210
 
190
- ### Realizar build
211
+ errorCallback (error) {
212
+ // ...
213
+ },
214
+
215
+ successCallback (results) {
216
+ // ...
217
+ },
218
+
219
+ endCallback () {
220
+ // ...
221
+ },
222
+
223
+ // Opcional no ambiente client - Método para fornecer os frames para análise
224
+ getNextFrame () {
225
+ return file
226
+ },
227
+ })
228
+
229
+ // Iniciar análises separadamente
230
+ startDocumentUpload(file)
231
+ startLivenessDetection({
232
+ // Opções para o liveness detection
233
+
234
+ nextStepCallback (step) {
235
+ // ...
236
+ },
237
+
238
+ // ...
239
+ })
191
240
  ```
192
- yarn build
241
+
242
+ #### Utilização em Node.js
243
+ De forma semelhante à funcionalidade da Prova de Vida, para o Node.js o caminho da importação muda e a função getNextFrame passa a ser obrigatória e deve ser fornecida às opções para o livenessDetection.
244
+
245
+ ```ts
246
+ import { uploadIdentificationDocument } from 'santoid-sdk/node/liveness'
247
+
248
+ const { startAll, startDocumentUpload, startLivenessDetection } = uploadIdentificationDocument({
249
+ // ...
250
+ })
251
+
252
+ startAll(file, {
253
+ // ...
254
+
255
+ getNextFrame () {
256
+ return someBuffer
257
+ },
258
+ })
193
259
  ```
194
260
 
195
- ### Publicação da biblioteca
261
+ #### Utilização via CDN
262
+ De forma semelhante à funcionalidade da Prova de Vida, a funcionalidade do teste do fluxo completo também é disponibilizada globalmente por meio da classe SantoiDSDK.
263
+
264
+ Substitua o **VERSION** pela versão desejada.
265
+
266
+ ```html
267
+ <body>
268
+ <button onclick="startUploadIdentificationDocument()">Iniciar</button>
269
+
270
+ <script src="https://cdn.jsdelivr.net/npm/santoid-sdk@VERSION/browser/liveness/index.js"></script>
271
+
272
+ <script>
273
+ async function startUploadIdentificationDocument () {
274
+ const { startAll } = SantoiDSDK.uploadIdentificationDocument({
275
+ // ...
276
+ })
277
+ }
278
+ </script>
279
+ </body>
196
280
  ```
197
- npm login
198
- npm publish
199
- ```
281
+
282
+ ## Para desenvolvedores
283
+ Caso seja um desenvolvedor da SantoDigital que deseje realizar alterações no SDK, confira o arquivo CONTRIBUTING.md presente na versão do projeto que está no repositório.
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("SantoiDSDK",[],t):"object"==typeof exports?exports.SantoiDSDK=t():e.SantoiDSDK=t()}(this,(()=>(()=>{"use strict";var e={890:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.uploadIdentificationDocument=t.livenessDetection=void 0;const i=n(897),s=n(468);var a=n(897);Object.defineProperty(t,"livenessDetection",{enumerable:!0,get:function(){return a.livenessDetection}});var c=n(468);Object.defineProperty(t,"uploadIdentificationDocument",{enumerable:!0,get:function(){return c.uploadIdentificationDocument}}),o(n(815),t);class l{}l.livenessDetection=i.livenessDetection,l.uploadIdentificationDocument=s.uploadIdentificationDocument,t.default=l},897:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.livenessDetection=void 0;const r=n(661),o=n(882),i=n(800);t.livenessDetection=async function(e){var t,n,s;let a,c=!1,l=!1,u=!1,d=!0;const f={front:void 0,right:void 0,left:void 0,up:void 0,bottom:void 0};let p,h,m,v="front";async function y(e,t,n){var r;n&&clearInterval(n),t&&(0,i.disconnectFromWebSocket)(t),a&&a.stopGetNextFrame(),!u&&await(null===(r=e.endCallback)||void 0===r?void 0:r.call(e)),u=!0,c=!0}try{return m=await(0,i.connectToWebSocket)(e),await(null===(t=e.nextStepCallback)||void 0===t?void 0:t.call(e,"front")),await(null===(n=e.frontCallback)||void 0===n?void 0:n.call(e)),e.getNextFrame||a||(a=await(0,o.builtInGetNextFrame)()),h=setInterval((async()=>{try{if(d){let t;t=e.getNextFrame?await e.getNextFrame():await(null==a?void 0:a.getNextFrame()),t&&(null==m||m.send(t),p=t,d=!1)}}catch(t){await y(e,m,h)}}),r.SEND_FRAMES_INTERVAL_MS),m.addEventListener("message",(async t=>{var n;const r=await async function(e,t){var n,r,o;const i=t.data;let s;try{s=JSON.parse(i)}catch(e){console.error("Cannot parse API message",e)}return(null==s?void 0:s.next_step)&&!s.error&&(await(null===(n=e.nextStepCallback)||void 0===n?void 0:n.call(e,s.next_step)),await(null===(r=e[`${s.next_step}Callback`])||void 0===r?void 0:r.call(e))),(null==s?void 0:s.error)&&await(null===(o=e.errorCallback)||void 0===o?void 0:o.call(e,{code:"wrong-position"})),s}(e,t);r&&(d=!!(null==r?void 0:r.can_send_next_bytes)),(null==r?void 0:r.validation)&&v&&(f[v]=p),(null==r?void 0:r.next_step)&&(v=r.next_step),(null==r?void 0:r.success)&&(f.bottom=p,l=!0,await(null===(n=e.successCallback)||void 0===n?void 0:n.call(e,{livenessId:r.livenessId,successFrames:f})),await y(e,m,h))})),m.addEventListener("error",(async()=>{var t;!l&&(null===(t=e.errorCallback)||void 0===t||t.call(e,{code:"internal-error"})),await y(e,m,h)})),m.addEventListener("close",(async()=>{var t;c||(!l&&(null===(t=e.errorCallback)||void 0===t||t.call(e,{code:"internal-error"})),await y(e,m,h))})),{stopLivenessDetection:async()=>{await y(e,m,h)},videoStream:null==a?void 0:a.videoStream}}catch(t){throw!l&&(null===(s=e.errorCallback)||void 0===s||s.call(e,{code:"internal-error"})),await y(e,m,h),t}}},468:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.uploadIdentificationDocument=void 0;const o=r(n(218)),i=n(661),s=n(228),a=n(897);t.uploadIdentificationDocument=function(e){let t={uploadedDocument:null,typification:{status:null,results:null,loading:!1,error:null},liveness:{status:null,results:null,loading:!1,error:null},faceMatch:{status:null,results:null,loading:!1,error:null}};function n(){var n;t.uploadedDocument&&(null===(n=t.liveness.results)||void 0===n?void 0:n.successFrames.front)&&!t.faceMatch.results&&!t.faceMatch.loading&&async function(t,n){var a,c,l;try{r({faceMatch:{status:null,results:null,loading:!0,error:null}});const a=await async function(e,t,n){var r,a,c;const l=new FormData;l.append("track",e.track),l.append("firstImage",t),l.append("secondImage",n);const u=(0,s.tryDecodeJwt)(e.token),d=null!==(r=e.domain)&&void 0!==r?r:null===(a=null==u?void 0:u.claims)||void 0===a?void 0:a.domain,f={params:{sensitive_data_compliance:!0},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.token}`}};return f.headers&&d&&(f.headers.Domain=d),(await o.default.post(`${null!==(c=null==e?void 0:e.customApiUrl)&&void 0!==c?c:i.API_GATEWAY_URL}/api/v1/facematch/pair`,l,f)).data}(e,t,n);r({faceMatch:{results:a,status:"success",loading:!1,error:null}})}catch(t){await(null===(a=e.errorCallback)||void 0===a?void 0:a.call(e,{code:"face-match-error",details:null===(c=null==t?void 0:t.response)||void 0===c?void 0:c.data})),r({faceMatch:{results:null,status:"error",loading:!1,error:null===(l=null==t?void 0:t.response)||void 0===l?void 0:l.data}})}}(t.uploadedDocument,t.liveness.results.successFrames.front)}function r(r){var o,i,s;if(t=Object.assign(Object.assign({},t),r),null===(o=e.resultChangeCallback)||void 0===o||o.call(e,t),Object.entries(t).every((([e,t])=>"uploadedDocument"===e||!!t.results)))return null===(i=e.successCallback)||void 0===i||i.call(e,t),void(null===(s=e.endCallback)||void 0===s||s.call(e));n()}async function c(a){var c,l,u;try{r({typification:{status:null,results:null,loading:!0,error:null}}),function(e){t.uploadedDocument=e,n()}(a);const c=await async function(e,t){var n,r,a;const c=new FormData;c.append("track",e.track),c.append("imageFile",t);const l=(0,s.tryDecodeJwt)(e.token),u=null!==(n=e.domain)&&void 0!==n?n:null===(r=null==l?void 0:l.claims)||void 0===r?void 0:r.domain,d={headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.token}`}};return d.headers&&u&&(d.headers.Domain=u),(await o.default.post(`${null!==(a=null==e?void 0:e.customApiUrl)&&void 0!==a?a:i.API_GATEWAY_URL}/api/v3/typification/predict`,c,d)).data}(e,a);r({typification:{status:"success",results:c,loading:!1,error:null}})}catch(t){await(null===(c=e.errorCallback)||void 0===c?void 0:c.call(e,{code:"typification-error",details:null===(l=null==t?void 0:t.response)||void 0===l?void 0:l.data})),r({typification:{status:"error",results:null,loading:!1,error:null===(u=null==t?void 0:t.response)||void 0===u?void 0:u.data}})}}async function l(t){var n,o,i,s,c;const l=Object.assign({},t);delete l.successCallback,delete l.errorCallback,r({liveness:{results:null,status:null,loading:!0,error:null}});try{return await(0,a.livenessDetection)(Object.assign(Object.assign({domain:e.domain,customId:e.customId,customWebSocketUrl:e.customWebSocketUrl,successCallback:e=>{var n;null===(n=null==t?void 0:t.successCallback)||void 0===n||n.call(t,e),r({liveness:{status:"success",results:e,loading:!1,error:null}})},errorCallback:async n=>{var o,i;"wrong-position"===(null==n?void 0:n.code)?null===(o=null==t?void 0:t.errorCallback)||void 0===o||o.call(t,n):null===(i=e.errorCallback)||void 0===i||i.call(e,n),r({liveness:{status:"error",results:null,loading:"wrong-position"===(null==n?void 0:n.code),error:n}})}},l),{token:null!==(n=l.token)&&void 0!==n?n:e.token,track:null!==(o=l.track)&&void 0!==o?o:e.track}))}catch(t){await(null===(i=e.errorCallback)||void 0===i?void 0:i.call(e,{code:"liveness-error",details:null===(s=null==t?void 0:t.response)||void 0===s?void 0:s.data})),r({liveness:{status:"error",results:null,loading:!1,error:null===(c=null==t?void 0:t.response)||void 0===c?void 0:c.data}})}}return{getResults:function(){return t},startDocumentUpload:c,startLivenessDetection:l,startFaceComparison:n,startAll:function(e,t){c(e),l(t)}}}},882:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.builtInGetNextFrame=void 0,t.builtInGetNextFrame=async function(){let e,t,n,r;return e&&t&&n||(e=await navigator.mediaDevices.getUserMedia({video:!0}),t=document.createElement("video"),t.setAttribute("autoplay","true"),t.style.transform="scale(-1, 1)",t.style.position="absolute",t.style.left="99999px",document.body.appendChild(t),t.srcObject=e,n=document.createElement("canvas"),r=n.getContext("2d")),{getNextFrame:async function(){if(n&&t)return n.width=t.videoWidth,n.height=t.videoHeight,null==r||r.drawImage(t,0,0,n.width,n.height),await new Promise(((e,t)=>{n?n.toBlob((t=>{e(t)})):e(null)}));throw new Error("Cannot found video element")},stopGetNextFrame:function(){t&&(document.body.removeChild(t),t=void 0),n&&(n=void 0),r&&(r=void 0),null==e||e.getTracks().forEach((e=>{e.stop()})),e=void 0},videoStream:e}}},228:(e,t)=>{function n(e){const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(window.atob(t).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""));return JSON.parse(n)}Object.defineProperty(t,"__esModule",{value:!0}),t.tryDecodeJwt=t.decodeJwt=void 0,t.decodeJwt=n,t.tryDecodeJwt=function(e){try{return n(e)}catch(e){return null}}},815:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(539),t)},800:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.disconnectFromWebSocket=t.connectToWebSocket=void 0;const r=n(228),o=n(661);t.connectToWebSocket=async function(e){var t,n;const i=(0,r.decodeJwt)(e.token),s=`?x_endpoint_api_userinfo=${e.token}&domain=${null!==(t=e.domain)&&void 0!==t?t:i.claims.domain}&track=${e.track}&customerRequestId=${e.customId}`,a=new WebSocket(`${null!==(n=e.customWebSocketUrl)&&void 0!==n?n:o.WEBSOCKET_BASE_URL}${s}`);return await async function(e){if(await new Promise((t=>{const n=setInterval((()=>{[3,1].includes(e.readyState)&&(clearInterval(n),t())}),5)})),3===e.readyState)throw new Error("Cannot connect to server")}(a),a},t.disconnectFromWebSocket=function(e){var t;[2,3].includes(e.readyState)||null===(t=e.close)||void 0===t||t.call(e)}},661:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SEND_FRAMES_INTERVAL_MS=t.API_GATEWAY_URL=t.WEBSOCKET_BASE_URL=void 0,t.WEBSOCKET_BASE_URL="wss://santoid-liveness-w4ynos5dlq-ue.a.run.app/api/v1/liveness/ws",t.API_GATEWAY_URL="https://api.santoid.com.br",t.SEND_FRAMES_INTERVAL_MS=100},539:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},218:(e,t,n)=>{function r(e,t){return function(){return e.apply(t,arguments)}}const{toString:o}=Object.prototype,{getPrototypeOf:i}=Object,s=(a=Object.create(null),e=>{const t=o.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const c=e=>(e=e.toLowerCase(),t=>s(t)===e),l=e=>t=>typeof t===e,{isArray:u}=Array,d=l("undefined"),f=c("ArrayBuffer"),p=l("string"),h=l("function"),m=l("number"),v=e=>null!==e&&"object"==typeof e,y=e=>{if("object"!==s(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},b=c("Date"),g=c("File"),w=c("Blob"),E=c("FileList"),O=c("URLSearchParams");function S(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),u(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function A(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,_=e=>!d(e)&&e!==R,C=(T="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>T&&e instanceof T);var T;const j=c("HTMLFormElement"),x=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),D=c("RegExp"),N=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};S(n,((n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)})),Object.defineProperties(e,r)},P="abcdefghijklmnopqrstuvwxyz",k="0123456789",F={DIGIT:k,ALPHA:P,ALPHA_DIGIT:P+P.toUpperCase()+k},U=c("AsyncFunction");var L={isArray:u,isArrayBuffer:f,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=s(e))||"object"===t&&h(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:p,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:v,isPlainObject:y,isUndefined:d,isDate:b,isFile:g,isBlob:w,isRegExp:D,isFunction:h,isStream:e=>v(e)&&h(e.pipe),isURLSearchParams:O,isTypedArray:C,isFileList:E,forEach:S,merge:function e(){const{caseless:t}=_(this)&&this||{},n={},r=(r,o)=>{const i=t&&A(n,o)||o;y(n[i])&&y(r)?n[i]=e(n[i],r):y(r)?n[i]=e({},r):u(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&S(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:o}={})=>(S(t,((t,o)=>{n&&h(t)?e[o]=r(t,n):e[o]=t}),{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:c,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(u(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:j,hasOwnProperty:x,hasOwnProp:x,reduceDescriptors:N,freezeMethods:e=>{N(e,((t,n)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];h(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return u(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:A,global:R,isContextDefined:_,ALPHABET:F,generateString:(e=16,t=F.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(v(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=u(e)?[]:{};return S(e,((e,t)=>{const i=n(e,r+1);!d(i)&&(o[t]=i)})),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:U,isThenable:e=>e&&(v(e)||h(e))&&h(e.then)&&h(e.catch)};function B(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}L.inherits(B,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:L.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const I=B.prototype,M={};function q(e){return L.isPlainObject(e)||L.isArray(e)}function W(e){return L.endsWith(e,"[]")?e.slice(0,-2):e}function J(e,t,n){return e?e.concat(t).map((function(e,t){return e=W(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{M[e]={value:e}})),Object.defineProperties(B,M),Object.defineProperty(I,"isAxiosError",{value:!0}),B.from=(e,t,n,r,o,i)=>{const s=Object.create(I);return L.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),B.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const z=L.toFlatObject(L,{},null,(function(e){return/^is[A-Z]/.test(e)}));function H(e,t,n){if(!L.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=L.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!L.isUndefined(t[e])}))).metaTokens,o=n.visitor||l,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&L.isSpecCompliantForm(t);if(!L.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(L.isDate(e))return e.toISOString();if(!a&&L.isBlob(e))throw new B("Blob is not supported. Use a Buffer instead.");return L.isArrayBuffer(e)||L.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(L.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(L.isArray(e)&&function(e){return L.isArray(e)&&!e.some(q)}(e)||(L.isFileList(e)||L.endsWith(n,"[]"))&&(a=L.toArray(e)))return n=W(n),a.forEach((function(e,r){!L.isUndefined(e)&&null!==e&&t.append(!0===s?J([n],r,i):null===s?n:n+"[]",c(e))})),!1;return!!q(e)||(t.append(J(o,n,i),c(e)),!1)}const u=[],d=Object.assign(z,{defaultVisitor:l,convertValue:c,isVisitable:q});if(!L.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!L.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),L.forEach(n,(function(n,i){!0===(!(L.isUndefined(n)||null===n)&&o.call(t,n,L.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])})),u.pop()}}(e),t}function K(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function $(e,t){this._pairs=[],e&&H(e,this,t)}const G=$.prototype;function V(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function X(e,t,n){if(!t)return e;const r=n&&n.encode||V,o=n&&n.serialize;let i;if(i=o?o(t,n):L.isURLSearchParams(t)?t.toString():new $(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}G.append=function(e,t){this._pairs.push([e,t])},G.toString=function(e){const t=e?function(t){return e.call(this,t,K)}:K;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Y=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){L.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Q={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Z={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:$,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&"undefined"!=typeof window&&"undefined"!=typeof document})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function ee(e){function t(e,n,r,o){let i=e[o++];const s=Number.isFinite(+i),a=o>=e.length;return i=!i&&L.isArray(r)?r.length:i,a?(L.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s):(r[i]&&L.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&L.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s)}if(L.isFormData(e)&&L.isFunction(e.entries)){const n={};return L.forEachEntry(e,((e,r)=>{t(function(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const te={transitional:Q,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=L.isObject(e);if(o&&L.isHTMLForm(e)&&(e=new FormData(e)),L.isFormData(e))return r&&r?JSON.stringify(ee(e)):e;if(L.isArrayBuffer(e)||L.isBuffer(e)||L.isStream(e)||L.isFile(e)||L.isBlob(e))return e;if(L.isArrayBufferView(e))return e.buffer;if(L.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return H(e,new Z.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return Z.isNode&&L.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=L.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return H(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(L.isString(e))try{return(0,JSON.parse)(e),L.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||te.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(e&&L.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw B.from(e,B.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Z.classes.FormData,Blob:Z.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};L.forEach(["delete","get","head","post","put","patch"],(e=>{te.headers[e]={}}));var ne=te;const re=L.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),oe=Symbol("internals");function ie(e){return e&&String(e).trim().toLowerCase()}function se(e){return!1===e||null==e?e:L.isArray(e)?e.map(se):String(e)}function ae(e,t,n,r,o){return L.isFunction(r)?r.call(this,t,n):(o&&(t=n),L.isString(t)?L.isString(r)?-1!==t.indexOf(r):L.isRegExp(r)?r.test(t):void 0:void 0)}class ce{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ie(t);if(!o)throw new Error("header name must be a non-empty string");const i=L.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=se(e))}const i=(e,t)=>L.forEach(e,((e,n)=>o(e,n,t)));return L.isPlainObject(e)||e instanceof this.constructor?i(e,t):L.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&re[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t):null!=e&&o(t,e,n),this}get(e,t){if(e=ie(e)){const n=L.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(L.isFunction(t))return t.call(this,e,n);if(L.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ie(e)){const n=L.findKey(this,e);return!(!n||void 0===this[n]||t&&!ae(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ie(e)){const o=L.findKey(n,e);!o||t&&!ae(0,n[o],o,t)||(delete n[o],r=!0)}}return L.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!ae(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return L.forEach(this,((r,o)=>{const i=L.findKey(n,o);if(i)return t[i]=se(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();s!==o&&delete t[o],t[s]=se(r),n[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return L.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&L.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[oe]=this[oe]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ie(e);t[r]||(function(e,t){const n=L.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return L.isArray(e)?e.forEach(r):r(e),this}}ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),L.reduceDescriptors(ce.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),L.freezeMethods(ce);var le=ce;function ue(e,t){const n=this||ne,r=t||n,o=le.from(r.headers);let i=r.data;return L.forEach(e,(function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)})),o.normalize(),i}function de(e){return!(!e||!e.__CANCEL__)}function fe(e,t,n){B.call(this,null==e?"canceled":e,B.ERR_CANCELED,t,n),this.name="CanceledError"}L.inherits(fe,B,{__CANCEL__:!0});var pe=Z.isStandardBrowserEnv?{write:function(e,t,n,r,o,i){const s=[];s.push(e+"="+encodeURIComponent(t)),L.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),L.isString(r)&&s.push("path="+r),L.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function he(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var me=Z.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=L.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function ve(e,t){let n=0;const r=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[s];o||(o=c),n[i]=a,r[i]=c;let u=s,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const f=l&&c-l;return f?Math.round(1e3*d/f):void 0}}(50,250);return o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,a=i-n,c=r(a);n=i;const l={loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:o};l[t?"download":"upload"]=!0,e(l)}}const ye={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let r=e.data;const o=le.from(e.headers).normalize(),i=e.responseType;let s,a;function c(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}L.isFormData(r)&&(Z.isStandardBrowserEnv||Z.isStandardBrowserWebWorkerEnv?o.setContentType(!1):o.getContentType(/^\s*multipart\/form-data/)?L.isString(a=o.getContentType())&&o.setContentType(a.replace(/^\s*(multipart\/form-data);+/,"$1")):o.setContentType("multipart/form-data"));let l=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(t+":"+n))}const u=he(e.baseURL,e.url);function d(){if(!l)return;const r=le.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders());!function(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new B("Request failed with status code "+n.status,[B.ERR_BAD_REQUEST,B.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),c()}),(function(e){n(e),c()}),{data:i&&"text"!==i&&"json"!==i?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:r,config:e,request:l}),l=null}if(l.open(e.method.toUpperCase(),X(u,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=d:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(d)},l.onabort=function(){l&&(n(new B("Request aborted",B.ECONNABORTED,e,l)),l=null)},l.onerror=function(){n(new B("Network Error",B.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||Q;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new B(t,r.clarifyTimeoutError?B.ETIMEDOUT:B.ECONNABORTED,e,l)),l=null},Z.isStandardBrowserEnv){const t=(e.withCredentials||me(u))&&e.xsrfCookieName&&pe.read(e.xsrfCookieName);t&&o.set(e.xsrfHeaderName,t)}void 0===r&&o.setContentType(null),"setRequestHeader"in l&&L.forEach(o.toJSON(),(function(e,t){l.setRequestHeader(t,e)})),L.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),i&&"json"!==i&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",ve(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",ve(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=t=>{l&&(n(!t||t.type?new fe(null,e,l):t),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const f=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);f&&-1===Z.protocols.indexOf(f)?n(new B("Unsupported protocol "+f+":",B.ERR_BAD_REQUEST,e)):l.send(r||null)}))}};L.forEach(ye,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const be=e=>`- ${e}`,ge=e=>L.isFunction(e)||null===e||!1===e;var we=e=>{e=L.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i<t;i++){let t;if(n=e[i],r=n,!ge(n)&&(r=ye[(t=String(n)).toLowerCase()],void 0===r))throw new B(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+i]=r}if(!r){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new B("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(be).join("\n"):" "+be(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function Ee(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fe(null,e)}function Oe(e){return Ee(e),e.headers=le.from(e.headers),e.data=ue.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),we(e.adapter||ne.adapter)(e).then((function(t){return Ee(e),t.data=ue.call(e,e.transformResponse,t),t.headers=le.from(t.headers),t}),(function(t){return de(t)||(Ee(e),t&&t.response&&(t.response.data=ue.call(e,e.transformResponse,t.response),t.response.headers=le.from(t.response.headers))),Promise.reject(t)}))}const Se=e=>e instanceof le?e.toJSON():e;function Ae(e,t){t=t||{};const n={};function r(e,t,n){return L.isPlainObject(e)&&L.isPlainObject(t)?L.merge.call({caseless:n},e,t):L.isPlainObject(t)?L.merge({},t):L.isArray(t)?t.slice():t}function o(e,t,n){return L.isUndefined(t)?L.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!L.isUndefined(t))return r(void 0,t)}function s(e,t){return L.isUndefined(t)?L.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>o(Se(e),Se(t),!0)};return L.forEach(Object.keys(Object.assign({},e,t)),(function(r){const i=c[r]||o,s=i(e[r],t[r],r);L.isUndefined(s)&&i!==a||(n[r]=s)})),n}const Re={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Re[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const _e={};Re.transitional=function(e,t,n){function r(e,t){return"[Axios v1.5.1] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new B(r(o," has been removed"+(t?" in "+t:"")),B.ERR_DEPRECATED);return t&&!_e[o]&&(_e[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var Ce={assertOptions:function(e,t,n){if("object"!=typeof e)throw new B("options must be an object",B.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new B("option "+i+" must be "+n,B.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new B("Unknown option "+i,B.ERR_BAD_OPTION)}},validators:Re};const Te=Ce.validators;class je{constructor(e){this.defaults=e,this.interceptors={request:new Y,response:new Y}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ae(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Ce.assertOptions(n,{silentJSONParsing:Te.transitional(Te.boolean),forcedJSONParsing:Te.transitional(Te.boolean),clarifyTimeoutError:Te.transitional(Te.boolean)},!1),null!=r&&(L.isFunction(r)?t.paramsSerializer={serialize:r}:Ce.assertOptions(r,{encode:Te.function,serialize:Te.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&L.merge(o.common,o[t.method]);o&&L.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=le.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,d=0;if(!a){const e=[Oe.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=s.length;let f=t;for(d=0;d<u;){const e=s[d++],t=s[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=Oe.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return X(he((e=Ae(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}L.forEach(["delete","get","head","options"],(function(e){je.prototype[e]=function(t,n){return this.request(Ae(n||{},{method:e,url:t,data:(n||{}).data}))}})),L.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(Ae(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}je.prototype[e]=t(),je.prototype[e+"Form"]=t(!0)}));var xe=je;class De{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new fe(e,r,o),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new De((function(t){e=t})),cancel:e}}}var Ne=De;const Pe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Pe).forEach((([e,t])=>{Pe[t]=e}));var ke=Pe;const Fe=function e(t){const n=new xe(t),o=r(xe.prototype.request,n);return L.extend(o,xe.prototype,n,{allOwnKeys:!0}),L.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return e(Ae(t,n))},o}(ne);Fe.Axios=xe,Fe.CanceledError=fe,Fe.CancelToken=Ne,Fe.isCancel=de,Fe.VERSION="1.5.1",Fe.toFormData=H,Fe.AxiosError=B,Fe.Cancel=Fe.CanceledError,Fe.all=function(e){return Promise.all(e)},Fe.spread=function(e){return function(t){return e.apply(null,t)}},Fe.isAxiosError=function(e){return L.isObject(e)&&!0===e.isAxiosError},Fe.mergeConfig=Ae,Fe.AxiosHeaders=le,Fe.formToJSON=e=>ee(L.isHTMLForm(e)?new FormData(e):e),Fe.getAdapter=we,Fe.HttpStatusCode=ke,Fe.default=Fe,e.exports=Fe}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var r=n(890);return r.default})()));
@@ -0,0 +1,9 @@
1
+ import { livenessDetection } from './methods/livenessDetection';
2
+ import { uploadIdentificationDocument } from './methods/uploadIdentificationDocument';
3
+ export { livenessDetection } from './methods/livenessDetection';
4
+ export { uploadIdentificationDocument } from './methods/uploadIdentificationDocument';
5
+ export * from './utils/types';
6
+ export default class SantoiDSDK {
7
+ static livenessDetection: typeof livenessDetection;
8
+ static uploadIdentificationDocument: typeof uploadIdentificationDocument;
9
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.uploadIdentificationDocument = exports.livenessDetection = void 0;
18
+ const livenessDetection_1 = require("./methods/livenessDetection");
19
+ const uploadIdentificationDocument_1 = require("./methods/uploadIdentificationDocument");
20
+ var livenessDetection_2 = require("./methods/livenessDetection");
21
+ Object.defineProperty(exports, "livenessDetection", { enumerable: true, get: function () { return livenessDetection_2.livenessDetection; } });
22
+ var uploadIdentificationDocument_2 = require("./methods/uploadIdentificationDocument");
23
+ Object.defineProperty(exports, "uploadIdentificationDocument", { enumerable: true, get: function () { return uploadIdentificationDocument_2.uploadIdentificationDocument; } });
24
+ __exportStar(require("./utils/types"), exports);
25
+ class SantoiDSDK {
26
+ }
27
+ SantoiDSDK.livenessDetection = livenessDetection_1.livenessDetection;
28
+ SantoiDSDK.uploadIdentificationDocument = uploadIdentificationDocument_1.uploadIdentificationDocument;
29
+ exports.default = SantoiDSDK;
@@ -0,0 +1,6 @@
1
+ import { type TWebSDKOptions } from '../utils/types';
2
+ export type FrameType = File | Blob | null | undefined;
3
+ export declare function livenessDetection(options: TWebSDKOptions): Promise<{
4
+ stopLivenessDetection: () => Promise<void>;
5
+ videoStream: MediaStream | undefined;
6
+ }>;
@@ -1,24 +1,9 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
3
  exports.livenessDetection = void 0;
18
4
  const constants_1 = require("../../utils/constants");
19
- const getNextFrame_1 = require("./utils/getNextFrame");
20
- const websocket_1 = require("./utils/websocket");
21
- __exportStar(require("./utils/types"), exports);
5
+ const getNextFrame_1 = require("../utils/getNextFrame");
6
+ const websocket_1 = require("../utils/websocket");
22
7
  async function onWebSocketMessage(options, event) {
23
8
  var _a, _b, _c;
24
9
  const message = event.data;
@@ -142,8 +127,3 @@ async function livenessDetection(options) {
142
127
  }
143
128
  }
144
129
  exports.livenessDetection = livenessDetection;
145
- // Class for use in browsers
146
- class SantoiDSDK {
147
- }
148
- SantoiDSDK.livenessDetection = livenessDetection;
149
- exports.default = SantoiDSDK;
@@ -0,0 +1,91 @@
1
+ import { type ILivenessResults, type TWebSDKOptions, type IBaseSDKOptions, type TCallbackFunction, type TErrorCode } from '../utils/types';
2
+ type TResultStatuses = 'success' | 'error' | null;
3
+ type FileType = Blob | File;
4
+ interface ITypificationResult {
5
+ n_documents: number;
6
+ predictOCR: Array<{
7
+ typification: {
8
+ document_type: string;
9
+ ocr_success: boolean;
10
+ typification_score: number;
11
+ };
12
+ ocr_error?: boolean | null;
13
+ ocr_message?: {
14
+ template: string;
15
+ labels: any;
16
+ } | null;
17
+ ocr_extraction: {
18
+ template: string;
19
+ labels: Array<{
20
+ x: number;
21
+ y: number;
22
+ w: number;
23
+ h: number;
24
+ bottomRight: number[];
25
+ topLeft: number[];
26
+ dataField?: string;
27
+ dataFieldValue?: boolean;
28
+ ocr?: string | null;
29
+ ocr_score?: number;
30
+ cropBase64?: string | null;
31
+ serpro_query?: {
32
+ serpro_data: any;
33
+ search_logs: {
34
+ document: string;
35
+ type: string;
36
+ search_time: string;
37
+ status_code: number;
38
+ message: string;
39
+ };
40
+ };
41
+ validation?: Record<string, number | boolean>;
42
+ }> | null;
43
+ } | boolean;
44
+ }>;
45
+ }
46
+ interface IFaceMatchResult {
47
+ comparison_score: number;
48
+ similarity_score: number;
49
+ match: boolean;
50
+ }
51
+ interface IUploadIdentificationDocumentResults {
52
+ uploadedDocument: FileType | null;
53
+ typification: {
54
+ status: TResultStatuses;
55
+ results: ITypificationResult | null;
56
+ loading: boolean;
57
+ error: any;
58
+ };
59
+ liveness: {
60
+ status: TResultStatuses;
61
+ results: ILivenessResults<FileType | null | undefined> | null;
62
+ loading: boolean;
63
+ error: any;
64
+ };
65
+ faceMatch: {
66
+ status: TResultStatuses;
67
+ results: IFaceMatchResult | null;
68
+ loading: boolean;
69
+ error: any;
70
+ };
71
+ }
72
+ interface IUploadIdentificationDocumentOptions extends IBaseSDKOptions {
73
+ resultChangeCallback: (results?: IUploadIdentificationDocumentResults) => void | Promise<void>;
74
+ successCallback: <FrameType, ResultsType = ILivenessResults<FrameType>>(results?: ResultsType) => void | Promise<void>;
75
+ errorCallback?: (error?: {
76
+ code: TErrorCode;
77
+ details?: any;
78
+ }) => void | Promise<void>;
79
+ endCallback?: TCallbackFunction;
80
+ }
81
+ export declare function uploadIdentificationDocument(options: IUploadIdentificationDocumentOptions): {
82
+ getResults: () => IUploadIdentificationDocumentResults;
83
+ startDocumentUpload: (file: FileType) => Promise<void>;
84
+ startLivenessDetection: (startLivenessDetectionOptions?: TWebSDKOptions) => Promise<{
85
+ stopLivenessDetection: () => Promise<void>;
86
+ videoStream: MediaStream | undefined;
87
+ } | undefined>;
88
+ startFaceComparison: () => void;
89
+ startAll: (file: FileType, startLivenessDetectionOptions?: TWebSDKOptions) => void;
90
+ };
91
+ export {};