@incodetech/core 2.2.0 → 2.3.0-rc.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.
- package/THIRD_PARTY_NOTICES.txt +281 -0
- package/dist/BaseWasmProvider-Dyi6dKp1.d.ts +65 -0
- package/dist/{BrowserDiagnosticsCryptoProvider-B8vorxN5.esm.js → BrowserDiagnosticsCryptoProvider-C_9o3L2L.esm.js} +1 -1
- package/dist/{BrowserVisibilityObserverProvider-BX1BiLDK.esm.js → BrowserVisibilityObserverProvider-BrJN1B8A.esm.js} +2 -0
- package/dist/FaceDetectionProvider-DTetAE8H.esm.js +476 -0
- package/dist/FaceDetectionProvider-LdZ47bWy.d.ts +36 -0
- package/dist/{IIdCaptureCapability-DHTT3FC2.d.ts → IIdCaptureCapability-RNiFhvXR.d.ts} +7 -33
- package/dist/IWasmUtilCapability-CXXDA5l1.d.ts +159 -0
- package/dist/{MotionSensorProvider-DGiV77J_.esm.js → MotionSensorProvider-BgTYwg9L.esm.js} +1 -1
- package/dist/{deepsightService-DLVQS_RH.d.ts → StreamCanvasCapture-B3YT2Bt6.d.ts} +54 -41
- package/dist/{StreamCanvasCapture-D2XcXCZ4.esm.js → StreamCanvasCapture-C9jtgBdT.esm.js} +2 -2
- package/dist/{addressSearch-D1XpBdUS.esm.js → addressSearch-BRSu_aGA.esm.js} +1 -1
- package/dist/advanceableErrors-CpF2cBy6.esm.js +21 -0
- package/dist/ae-signature.d.ts +4 -2
- package/dist/ae-signature.esm.js +1 -1
- package/dist/antifraud.esm.js +2 -2
- package/dist/{antifraudManager-CQFNgSPt.esm.js → antifraudManager-Bg9ynGum.esm.js} +2 -2
- package/dist/{antifraudStateMachine-Bf_JVNwn.esm.js → antifraudStateMachine-BHxehiJZ.esm.js} +1 -1
- package/dist/{apiError-BA1d_au0.esm.js → apiError-D0v5hFyN.esm.js} +14 -2
- package/dist/authentication.d.ts +3 -3
- package/dist/authentication.esm.js +2 -2
- package/dist/{authenticationManager-zh9TC62P.esm.js → authenticationManager-C4B4-29g.esm.js} +5 -5
- package/dist/{authenticationManager-BBMGTcwW.d.ts → authenticationManager-DXTIUcma.d.ts} +7 -1
- package/dist/{authenticationStateMachine-xzi-vnvE.esm.js → authenticationStateMachine-DJ0zUm-A.esm.js} +6 -62
- package/dist/avatar.d.ts +1 -2
- package/dist/avatar.esm.js +1 -1
- package/dist/{backCameraStream-CUeYm5eu.esm.js → backCameraStream-BOtyQowf.esm.js} +83 -22
- package/dist/{camera-_2sXMXiF.esm.js → camera-sIa9ceW2.esm.js} +19 -1
- package/dist/camera.esm.js +1 -1
- package/dist/{canvas-E1zGkel4.esm.js → canvas-BxFzWTt-.esm.js} +19 -0
- package/dist/certificate-issuance.d.ts +2 -302
- package/dist/certificate-issuance.esm.js +3 -66
- package/dist/certificateIssuanceManager-Bfvkq7Cy.esm.js +69 -0
- package/dist/certificateIssuanceManager-DCgEidHz.d.ts +312 -0
- package/dist/{certificateIssuanceStateMachine-D_R92TYu.esm.js → certificateIssuanceStateMachine-BBD5h8c4.esm.js} +1 -1
- package/dist/consent.d.ts +1 -1
- package/dist/consent.esm.js +2 -2
- package/dist/{consentManager-BxjpLZAG.esm.js → consentManager-B5Vqdez-.esm.js} +2 -2
- package/dist/{consentManager-3Pbtj-RV.d.ts → consentManager-uhDPdU6i.d.ts} +4 -4
- package/dist/{consentStateMachine-D9D4ON8Z.esm.js → consentStateMachine-DbUmqWgV.esm.js} +1 -1
- package/dist/createCameraCycleOwnership-DQ5-F2oW.esm.js +826 -0
- package/dist/{createFaceAvatar-DQKaRise.esm.js → createFaceAvatar-BNHdeFj8.esm.js} +2 -2
- package/dist/createFaceAvatar-BlcTYgJv.d.ts +497 -0
- package/dist/cross-document-data-match.esm.js +1 -1
- package/dist/{crossDocumentDataMatchManager-CGT0V6RV.esm.js → crossDocumentDataMatchManager-QMOGwHXR.esm.js} +2 -2
- package/dist/curp-validation.d.ts +1 -1
- package/dist/curp-validation.esm.js +2 -2
- package/dist/{curpValidationManager-6Nmkn5u1.esm.js → curpValidationManager-D1ppROcF.esm.js} +2 -2
- package/dist/{curpValidationManager-DVGr7Fq7.d.ts → curpValidationManager-SSKNrm5Z.d.ts} +1 -1
- package/dist/{curpValidationStateMachine-Ds7KMacK.esm.js → curpValidationStateMachine-DvUPC_8S.esm.js} +1 -1
- package/dist/custom-fields.d.ts +2 -114
- package/dist/custom-fields.esm.js +2 -232
- package/dist/custom-watchlist.d.ts +2 -51
- package/dist/custom-watchlist.esm.js +3 -70
- package/dist/customFieldsManager-2j_PBq4U.esm.js +264 -0
- package/dist/customFieldsManager-8-W2KY4n.d.ts +141 -0
- package/dist/customWatchlistManager-DUVrEdw9.esm.js +73 -0
- package/dist/customWatchlistManager-PBWHr_oM.d.ts +64 -0
- package/dist/{customWatchlistStateMachine-YWSgKLbF.esm.js → customWatchlistStateMachine-qZVgkKgP.esm.js} +1 -1
- package/dist/{deepsightLoader--wMKWECS.esm.js → deepsightLoader-Dm7ejW4v.esm.js} +27 -71
- package/dist/device.d.ts +25 -2
- package/dist/device.esm.js +69 -7
- package/dist/document-capture.d.ts +2 -2
- package/dist/document-capture.esm.js +2 -2
- package/dist/{documentCaptureManager-DsQQhWry.esm.js → documentCaptureManager-DR_Wv-3H.esm.js} +2 -2
- package/dist/{documentCaptureManager-B3t0ydtg.d.ts → documentCaptureManager-DensIj5F.d.ts} +83 -83
- package/dist/{documentCaptureStateMachine-BM4Ex_5x.esm.js → documentCaptureStateMachine-CWOATHfE.esm.js} +5 -5
- package/dist/dynamic-forms.d.ts +1 -1
- package/dist/dynamic-forms.esm.js +2 -2
- package/dist/{dynamicFormsManager-fhK0yINk.d.ts → dynamicFormsManager-D5R_uxLQ.d.ts} +25 -3
- package/dist/{dynamicFormsManager-fFVIRBNv.esm.js → dynamicFormsManager-Dt98SDfV.esm.js} +16 -5
- package/dist/{dynamicFormsStateMachine-D6D7oEYk.esm.js → dynamicFormsStateMachine-obKr4IIp.esm.js} +35 -3
- package/dist/ekyb.d.ts +1 -1
- package/dist/ekyb.esm.js +3 -3
- package/dist/{ekybManager-Y3MkoXpC.esm.js → ekybManager-DNZKrKF3.esm.js} +2 -2
- package/dist/{ekybStateMachine-3nlnqdlr.esm.js → ekybStateMachine-DjhHQXZ8.esm.js} +3 -3
- package/dist/ekyc.esm.js +2 -2
- package/dist/{ekycManager-DgT48ky6.esm.js → ekycManager-CmQBpeiI.esm.js} +2 -2
- package/dist/{ekycStateMachine-CQwqiR-R.esm.js → ekycStateMachine-CmdW2gVm.esm.js} +2 -2
- package/dist/electronic-signature.d.ts +3 -3
- package/dist/electronic-signature.esm.js +2 -2
- package/dist/electronicSignatureManager-Ds-KEVTq.d.ts +2786 -0
- package/dist/{electronicSignatureManager-DGbAJ00W.esm.js → electronicSignatureManager-DzulxM4_.esm.js} +357 -51
- package/dist/email.esm.js +2 -2
- package/dist/{emailManager-BY0jeYwR.esm.js → emailManager-B5ek_UfM.esm.js} +2 -2
- package/dist/{emailStateMachine-Crw8QVmc.esm.js → emailStateMachine-CyPFZ7dW.esm.js} +1 -1
- package/dist/{endpoints-CCzL3XD_.esm.js → endpoints-D3B9mUHh.esm.js} +24 -7
- package/dist/{events-DYiyoSlx.esm.js → events-ijlbX_Wx.esm.js} +2 -2
- package/dist/events.d.ts +1 -1
- package/dist/events.esm.js +1 -1
- package/dist/extensibility.d.ts +24 -64
- package/dist/extensibility.esm.js +35 -29
- package/dist/face-match.esm.js +2 -2
- package/dist/{faceCaptureManagerFactory-BxWPpxyd.d.ts → faceCaptureManagerFactory-CvtqcLxs.d.ts} +87 -54
- package/dist/{faceCaptureManagerFactory-CVnZ0fa5.esm.js → faceCaptureManagerFactory-pCmG4MeF.esm.js} +68 -7
- package/dist/faceCaptureSetup-BSextack.esm.js +2106 -0
- package/dist/{faceMatchManager-Ri4UbNz0.esm.js → faceMatchManager-Caal2zyV.esm.js} +2 -2
- package/dist/{faceMatchStateMachine-20DdZ3jg.esm.js → faceMatchStateMachine-BUc5FXYy.esm.js} +1 -1
- package/dist/{feature-management-CPQ4qv3F.esm.js → feature-management-B0sGlozZ.esm.js} +32 -7
- package/dist/feature-management.d.ts +1 -1
- package/dist/feature-management.esm.js +1 -1
- package/dist/field-comparison.esm.js +1 -1
- package/dist/{fieldComparisonManager-Cg6kPQQx.esm.js → fieldComparisonManager-BIs6HPJG.esm.js} +2 -2
- package/dist/fiscal-qr.d.ts +2 -56
- package/dist/fiscal-qr.esm.js +2 -308
- package/dist/fiscalQrManager-Bp_-3LJr.esm.js +34131 -0
- package/dist/fiscalQrManager-CHcBJwUM.d.ts +68 -0
- package/dist/flow-events.d.ts +1 -1
- package/dist/flow.d.ts +212 -185
- package/dist/flow.esm.js +119 -30
- package/dist/{flowCompletionService-tfeoGre9.esm.js → flowCompletionService-CLtbWhSK.esm.js} +2 -2
- package/dist/{flowServices-f5Ruz7R9.esm.js → flowServices-B5FwukTQ.esm.js} +91 -26
- package/dist/geolocation.esm.js +2 -2
- package/dist/{geolocationManager-CH6RfqFH.esm.js → geolocationManager-DIw-xq9a.esm.js} +2 -2
- package/dist/{geolocationStateMachine-DmbWFely.esm.js → geolocationStateMachine-DpG0TFOU.esm.js} +3 -3
- package/dist/getBrowser-CBiibsL-.esm.js +19 -0
- package/dist/{getBrowser-DNrQeL4T.esm.js → getBrowser-Cbe1C4Tn.esm.js} +2 -1
- package/dist/{getDeviceClass-9y-kbVDw.esm.js → getDeviceClass-5NYZg9s6.esm.js} +2 -2
- package/dist/getParsedUserAgent-B2iFDql1.esm.js +1278 -0
- package/dist/government-validation.d.ts +2 -85
- package/dist/government-validation.esm.js +3 -120
- package/dist/governmentValidationManager-D02vT4yY.d.ts +63 -0
- package/dist/governmentValidationManager-TjC9iVjH.esm.js +79 -0
- package/dist/governmentValidationStateMachine-D1ZnEqdd.esm.js +54 -0
- package/dist/home.d.ts +1 -1
- package/dist/home.esm.js +1 -1
- package/dist/id-ocr.d.ts +2 -2
- package/dist/id-ocr.esm.js +2 -2
- package/dist/id-selfie-flow.d.ts +3 -2
- package/dist/id-selfie-flow.esm.js +11 -10
- package/dist/id-verification.esm.js +2 -2
- package/dist/id.d.ts +29 -5
- package/dist/id.esm.js +48 -46
- package/dist/idCaptureDefaults-BcxjQDI3.esm.js +484 -0
- package/dist/{idCaptureManager-CqrqSjJV.d.ts → idCaptureManager-CvmHOWWd.d.ts} +227 -39
- package/dist/{idCaptureManager-BYwTZ2H8.esm.js → idCaptureManager-Vby8oYqh.esm.js} +259 -46
- package/dist/{idCaptureServices-44kwQItl.esm.js → idCaptureServices-CJIxD9ep.esm.js} +342 -31
- package/dist/idCaptureStateMachine-CmqihkUy.esm.js +5343 -0
- package/dist/{idOcrManager-DXc_xRN7.d.ts → idOcrManager-BF_cXZq8.d.ts} +1 -1
- package/dist/{idOcrManager-BIQYQXXj.esm.js → idOcrManager-DHU22hVn.esm.js} +2 -2
- package/dist/{idOcrStateMachine-cSxzHpHt.esm.js → idOcrStateMachine-33UvRAHE.esm.js} +1 -1
- package/dist/{idVerificationManager-JpV_SAsl.esm.js → idVerificationManager-CyaixD0D.esm.js} +2 -2
- package/dist/{idVerificationStateMachine-nPeUNyFq.esm.js → idVerificationStateMachine-BPGrQZEm.esm.js} +1 -1
- package/dist/identity-reuse.esm.js +2 -2
- package/dist/{identityReuseManager-kNCg9AbD.esm.js → identityReuseManager-CWaNHBO3.esm.js} +2 -2
- package/dist/{identityReuseStateMachine-DyulxDjP.esm.js → identityReuseStateMachine-CQgnATo5.esm.js} +1 -1
- package/dist/{index-CLMF0QLQ.d.ts → index-DLcJT5YP.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/{invokeOnCaptureCallback-GpvMuz9o.esm.js → invokeOnCaptureCallback-BjzPjJ_p.esm.js} +1 -1
- package/dist/mandatory-consent.d.ts +2 -2
- package/dist/mandatory-consent.esm.js +2 -2
- package/dist/{mandatoryConsentManager-DyPzUmsZ.d.ts → mandatoryConsentManager-CJSyhTpi.d.ts} +5 -5
- package/dist/{mandatoryConsentManager-B4Niyg_u.esm.js → mandatoryConsentManager-Du-m-tZ_.esm.js} +2 -2
- package/dist/{mandatoryConsentStateMachine-B4-1u-L8.esm.js → mandatoryConsentStateMachine-DSDAk7WZ.esm.js} +1 -1
- package/dist/multipartRecordingService-B3C_zlev.esm.js +594 -0
- package/dist/{permissionGuards-KINpmKtI.esm.js → permissionGuards-uYZYFu4J.esm.js} +1 -1
- package/dist/{permissionServices-UvUcOSRb.esm.js → permissionServices-Bj_fyWtv.esm.js} +5 -5
- package/dist/personhood.d.ts +6 -5
- package/dist/personhood.esm.js +10 -10
- package/dist/phone.esm.js +2 -2
- package/dist/{phoneManager-FsJ0W2Ei.esm.js → phoneManager-N1-sbrY4.esm.js} +2 -2
- package/dist/{phoneStateMachine-Ba0wKHyX.esm.js → phoneStateMachine-jl8LJKCo.esm.js} +1 -1
- package/dist/{platform-BJrm5nzZ.esm.js → platform-DkcRc9JV.esm.js} +29 -1
- package/dist/qe-signature.d.ts +5 -3
- package/dist/qe-signature.esm.js +2 -2
- package/dist/recordingsRepository-CCWy13M-.esm.js +72 -0
- package/dist/redirect-to-mobile.esm.js +2 -2
- package/dist/{redirectToMobileManager-y4VQB11M.esm.js → redirectToMobileManager-DsFzdTwA.esm.js} +2 -2
- package/dist/{redirectToMobileStateMachine-Cyv2x0PP.esm.js → redirectToMobileStateMachine-v3otpT-L.esm.js} +1 -1
- package/dist/{rolldown-runtime-FZ4Itg2g.esm.js → rolldown-runtime-FDOR9p9I.esm.js} +1 -19
- package/dist/{runChildModule-Dukuw23X.esm.js → runChildModule-TuyGE00X.esm.js} +3 -21
- package/dist/safeStorage-B-trhxg6.esm.js +423 -0
- package/dist/{sdkVersion-D1Bm59g6.esm.js → sdkVersion-CLxKvdyz.esm.js} +1 -1
- package/dist/selfie.d.ts +5 -5
- package/dist/selfie.esm.js +14 -76
- package/dist/{selfieErrorUtils-C2PYBVsp.esm.js → selfieErrorUtils-C77GXJH6.esm.js} +30 -4
- package/dist/{selfieManager-Bj6B2ZVy.esm.js → selfieManager-CihVnODO.esm.js} +5 -5
- package/dist/{selfieManager-DwlCppg0.d.ts → selfieManager-D1KRJ39M.d.ts} +8 -11
- package/dist/selfieStateMachine-fwMmNtOi.esm.js +69 -0
- package/dist/{session-BFdLgN4i.esm.js → session-BHIeAamR.esm.js} +4 -5
- package/dist/session.d.ts +21 -11
- package/dist/session.esm.js +5 -5
- package/dist/{sessionInitializer-dlfDehHk.esm.js → sessionInitializer-BLoK7SP9.esm.js} +187 -68
- package/dist/{setup-BgoWtvIS.d.ts → setup-Cv-JM9QC.d.ts} +63 -69
- package/dist/{setup-BIAtLa8k.esm.js → setup-msLybMbC.esm.js} +226 -100
- package/dist/signature.esm.js +2 -2
- package/dist/{signatureManager-Ca43yhwk.esm.js → signatureManager-ChsB-nMD.esm.js} +2 -2
- package/dist/{signatureStateMachine-K1LMRrxG.esm.js → signatureStateMachine-BHPwkJZS.esm.js} +1 -1
- package/dist/{src-0Jurt29N.esm.js → src-35ekGRzK.esm.js} +1 -1
- package/dist/{stats-B0nFKawG.esm.js → stats-DkK-f8JT.esm.js} +1 -1
- package/dist/stats.esm.js +1 -1
- package/dist/{trueSightService---iW2KKJ.esm.js → trueSightService-CKrrfV0Q.esm.js} +7 -7
- package/dist/trust-graph.esm.js +1 -1
- package/dist/{types-BX_XkMsQ2.d.ts → types-9_esGTPj.d.ts} +1 -1
- package/dist/types-BT_Oalip.d.ts +1 -0
- package/dist/{types-DelMqZLe.d.ts → types-BjSly8cp.d.ts} +1 -1
- package/dist/{types-Hmd7U0JA.d.ts → types-CM-jtjJ2.d.ts} +6 -81
- package/dist/{types-Bdf8_LYB2.d.ts → types-CjKBS37a2.d.ts} +303 -13
- package/dist/{types-DVmXIdzW.d.ts → types-D0gekt4U.d.ts} +38 -5
- package/dist/types-DgDvvzg0.d.ts +10 -0
- package/dist/{types-KPvmag_B.d.ts → types-Do5rEXij.d.ts} +7 -4
- package/dist/types-ZT1XFIJ8.d.ts +6 -0
- package/dist/video-selfie.d.ts +59 -35
- package/dist/video-selfie.esm.js +510 -601
- package/dist/{videoSelfieCameraWarmer-NEhFZvWx.esm.js → videoSelfieCameraWarmer-CB1IzZkt.esm.js} +14 -153
- package/dist/videoSelfieFlowModuleMachine-BUe2uACW.esm.js +32 -0
- package/dist/{videoSelfieStepDetector-D3oo2ofo.d.ts → videoSelfieStepDetector-5YHFe0Mq.d.ts} +21 -5
- package/dist/virtualCameraCheck-WOloJ-do.esm.js +48 -0
- package/dist/warmup-CUUnwYxe.esm.js +714 -0
- package/dist/warmup-Cis2p6O0.d.ts +128 -0
- package/dist/wasm.d.ts +30 -6
- package/dist/wasm.esm.js +36 -4
- package/dist/{wasmDsFlagSync-BqUCwLY8.esm.js → wasmDsFlagSync-B2e8p268.esm.js} +2 -2
- package/dist/{wasmWebClient-DM8lkb0z.esm.js → wasmWebClient-B7baE-Wf.esm.js} +358 -28
- package/dist/watchlist-for-business.d.ts +2 -78
- package/dist/watchlist-for-business.esm.js +3 -102
- package/dist/watchlist.esm.js +2 -2
- package/dist/watchlistForBusinessManager-CpuuB1J2.esm.js +107 -0
- package/dist/watchlistForBusinessManager-CsnJnG-C.d.ts +99 -0
- package/dist/{watchlistForBusinessStateMachine-CxFnlshm.esm.js → watchlistForBusinessStateMachine-DEzgjz7C.esm.js} +13 -6
- package/dist/{watchlistManager-LoNZH9qm.esm.js → watchlistManager-CI8BHFob.esm.js} +2 -2
- package/dist/{watchlistStateMachine-DIKQDoUT.esm.js → watchlistStateMachine-DvOby3a-.esm.js} +1 -1
- package/dist/workflow.d.ts +12 -8
- package/dist/workflow.esm.js +48 -39
- package/package.json +4 -10
- package/dist/BrowserStorageProvider-k-FDkC4W.esm.js +0 -67
- package/dist/FaceDetectionProvider-Mh6q3EbA.d.ts +0 -349
- package/dist/IFaceAvatarCapability-BrL19G0s.d.ts +0 -23
- package/dist/IStorageCapability-ORkQfK3F.d.ts +0 -242
- package/dist/OpenViduRecordingProvider-Du98qevC.esm.js +0 -85
- package/dist/createFaceAvatar-BEj18KXi.d.ts +0 -50
- package/dist/document-upload.d.ts +0 -325
- package/dist/document-upload.esm.js +0 -197
- package/dist/electronicSignatureManager-CcUXQZS7.d.ts +0 -1300
- package/dist/faceCaptureSetup-Cd-04W_X.esm.js +0 -863
- package/dist/getBrowser-Cb8Zgrgp.esm.js +0 -7
- package/dist/getParsedUserAgent-pJjATANs.esm.js +0 -1622
- package/dist/governmentValidationStateMachine-CK9DrZXX.esm.js +0 -226
- package/dist/idCaptureDefaults-WeHbQM7W.esm.js +0 -225
- package/dist/idCaptureStateMachine-kZ5OpdfM.esm.js +0 -3342
- package/dist/lib-DAyUtOTj.esm.js +0 -12420
- package/dist/manualReviewService-D4IkipnN.esm.js +0 -15
- package/dist/mediaRecorderOptions-dALSV8af.esm.js +0 -40
- package/dist/onDeviceFaceResults-CUHwyZT4.esm.js +0 -646
- package/dist/openviduLazy-CCDpFWg1.esm.js +0 -10
- package/dist/recordingService-3NSENVwp.esm.js +0 -329
- package/dist/safeStorage-Ep56I-f_.esm.js +0 -982
- package/dist/selfieStateMachine-CHV_WNst.esm.js +0 -55
- package/dist/trueSight-B_icM8r2.esm.js +0 -1
- package/dist/types-EELWyWpd.d.ts +0 -6
- package/dist/types-Vb4P9ovf.d.ts +0 -22
- package/dist/warmup-Dv2alr2-.d.ts +0 -82
- package/dist/wasmDefaults-DTUrftxR.esm.js +0 -125
- package/dist/{Face2DProvider-UUQt_vRC.esm.js → Face2DProvider-BF48sz5c.esm.js} +1 -1
- package/dist/{PrivacyLensProvider-D8PS7AJa.esm.js → PrivacyLensProvider-EwnC_C5n.esm.js} +1 -1
- /package/dist/{types-BfgmV7s72.d.ts → types-BfgmV7s7.d.ts} +0 -0
- /package/dist/{types-CJ7Yl9K-2.d.ts → types-CJ7Yl9K-.d.ts} +0 -0
|
@@ -0,0 +1,826 @@
|
|
|
1
|
+
import { c as CAMERA_CYCLE_OWNERSHIP_DOMAIN, l as getCameraCycleOwnershipDomain, s as wasmRuntime } from "./warmup-CUUnwYxe.esm.js";
|
|
2
|
+
import { t as getTimestamp } from "./IBrowserEnvironmentCapability-DEaRRk-R.esm.js";
|
|
3
|
+
import { t as api } from "./api-Bx3gKW_y.esm.js";
|
|
4
|
+
import { t as endpoints } from "./endpoints-D3B9mUHh.esm.js";
|
|
5
|
+
import { t as fromCallback } from "./xstate-actors.esm-BXeQ-Ucz.esm.js";
|
|
6
|
+
//#region ../infra/src/capabilities/ICameraCycleCapability.ts
|
|
7
|
+
/**
|
|
8
|
+
* Fixed protected-endpoint identifiers owned by ml-wasm-kit.
|
|
9
|
+
*
|
|
10
|
+
* Keep these values aligned with `ProtectedEndpointCatalog`; callers must not
|
|
11
|
+
* invent endpoint ids or pass raw URLs into the protected upload path.
|
|
12
|
+
*/
|
|
13
|
+
const PROTECTED_CAPTURE_TARGET = {
|
|
14
|
+
selfie: 1,
|
|
15
|
+
authentication: 2,
|
|
16
|
+
frontId: 3,
|
|
17
|
+
backId: 4,
|
|
18
|
+
frontSecondId: 5,
|
|
19
|
+
backSecondId: 6
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/internal/manualReview/manualReviewService.ts
|
|
23
|
+
async function flagFaceManualReview() {
|
|
24
|
+
try {
|
|
25
|
+
await api.put(endpoints.updateSession, { manualSelfieCheckNeeded: true });
|
|
26
|
+
} catch {}
|
|
27
|
+
}
|
|
28
|
+
async function flagIdManualReview() {
|
|
29
|
+
try {
|
|
30
|
+
await api.put(endpoints.updateSession, { manualIdCheckNeeded: true });
|
|
31
|
+
} catch {}
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region ../infra/src/media/imageFile.ts
|
|
35
|
+
const DEFAULT_IMAGE_MIME_TYPE = "image/jpeg";
|
|
36
|
+
const DEFAULT_IMAGE_QUALITY = .92;
|
|
37
|
+
const canNormalizeImageFile = (file) => file.type.startsWith("image/") && typeof document !== "undefined" && typeof Image !== "undefined" && typeof URL !== "undefined" && typeof URL.createObjectURL === "function";
|
|
38
|
+
const readFileAsDataUrl = (file) => new Promise((resolve, reject) => {
|
|
39
|
+
const reader = new FileReader();
|
|
40
|
+
reader.onload = () => {
|
|
41
|
+
const result = reader.result;
|
|
42
|
+
if (typeof result === "string") {
|
|
43
|
+
resolve(result);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
reject(/* @__PURE__ */ new Error("FileReader produced non-string result"));
|
|
47
|
+
};
|
|
48
|
+
reader.onerror = () => {
|
|
49
|
+
reject(reader.error ?? /* @__PURE__ */ new Error("FileReader failed"));
|
|
50
|
+
};
|
|
51
|
+
reader.readAsDataURL(file);
|
|
52
|
+
});
|
|
53
|
+
const loadImage = (url) => new Promise((resolve, reject) => {
|
|
54
|
+
const image = new Image();
|
|
55
|
+
image.onload = () => resolve(image);
|
|
56
|
+
image.onerror = () => reject(/* @__PURE__ */ new Error("Image decoding failed"));
|
|
57
|
+
image.src = url;
|
|
58
|
+
});
|
|
59
|
+
const fileToCanvasDataUrl = async (file, options) => {
|
|
60
|
+
const objectUrl = URL.createObjectURL(file);
|
|
61
|
+
try {
|
|
62
|
+
const image = await loadImage(objectUrl);
|
|
63
|
+
const width = image.naturalWidth || image.width;
|
|
64
|
+
const height = image.naturalHeight || image.height;
|
|
65
|
+
if (width <= 0 || height <= 0) return readFileAsDataUrl(file);
|
|
66
|
+
const canvas = document.createElement("canvas");
|
|
67
|
+
canvas.width = width;
|
|
68
|
+
canvas.height = height;
|
|
69
|
+
const context = canvas.getContext("2d");
|
|
70
|
+
if (!context) return readFileAsDataUrl(file);
|
|
71
|
+
context.fillStyle = "#fff";
|
|
72
|
+
context.fillRect(0, 0, width, height);
|
|
73
|
+
context.drawImage(image, 0, 0, width, height);
|
|
74
|
+
return canvas.toDataURL(options.mimeType ?? DEFAULT_IMAGE_MIME_TYPE, options.quality ?? DEFAULT_IMAGE_QUALITY);
|
|
75
|
+
} finally {
|
|
76
|
+
URL.revokeObjectURL(objectUrl);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const imageFileToDataUrl = async (file, options = {}) => {
|
|
80
|
+
if (!canNormalizeImageFile(file)) return readFileAsDataUrl(file);
|
|
81
|
+
try {
|
|
82
|
+
return await fileToCanvasDataUrl(file, options);
|
|
83
|
+
} catch {
|
|
84
|
+
return readFileAsDataUrl(file);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region ../infra/src/providers/wasm/CameraCycleProvider.ts
|
|
89
|
+
function asRecord(value) {
|
|
90
|
+
return typeof value === "object" && value !== null ? value : null;
|
|
91
|
+
}
|
|
92
|
+
function responseData(value) {
|
|
93
|
+
const response = asRecord(value);
|
|
94
|
+
return asRecord(response?.data) ?? response ?? {};
|
|
95
|
+
}
|
|
96
|
+
function optionalString(value, key) {
|
|
97
|
+
return typeof value[key] === "string" ? value[key] : void 0;
|
|
98
|
+
}
|
|
99
|
+
function optionalNumber(value, key) {
|
|
100
|
+
return typeof value[key] === "number" && Number.isFinite(value[key]) ? value[key] : void 0;
|
|
101
|
+
}
|
|
102
|
+
function optionalBoolean(value, key) {
|
|
103
|
+
return typeof value[key] === "boolean" ? value[key] : void 0;
|
|
104
|
+
}
|
|
105
|
+
function optionalStringArray(value, key) {
|
|
106
|
+
const candidate = value[key];
|
|
107
|
+
return Array.isArray(candidate) && candidate.every((item) => typeof item === "string") ? [...candidate] : void 0;
|
|
108
|
+
}
|
|
109
|
+
function assertResponseTarget(raw, target) {
|
|
110
|
+
const response = asRecord(raw);
|
|
111
|
+
const data = asRecord(response?.data);
|
|
112
|
+
for (const reported of [response?.target, data?.target]) if (reported !== void 0 && reported !== target) throw new Error("[Incode SDK] Protected response target mismatch.");
|
|
113
|
+
}
|
|
114
|
+
function sanitizeSelfie(raw) {
|
|
115
|
+
const data = responseData(raw);
|
|
116
|
+
return {
|
|
117
|
+
kind: "selfie",
|
|
118
|
+
target: PROTECTED_CAPTURE_TARGET.selfie,
|
|
119
|
+
confidence: optionalNumber(data, "confidence"),
|
|
120
|
+
isBright: optionalBoolean(data, "isBright"),
|
|
121
|
+
hasLenses: optionalBoolean(data, "hasLenses"),
|
|
122
|
+
hasFaceMask: optionalBoolean(data, "hasFaceMask"),
|
|
123
|
+
hasClosedEyes: optionalBoolean(data, "hasClosedEyes"),
|
|
124
|
+
hasHeadCover: optionalBoolean(data, "hasHeadCover"),
|
|
125
|
+
sessionStatus: optionalString(data, "sessionStatus")
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function sanitizeAuthentication(raw) {
|
|
129
|
+
const data = responseData(raw);
|
|
130
|
+
const status = optionalString(data, "overallStatus");
|
|
131
|
+
const captureAttemptsLimit = asRecord(data.captureAttemptsLimit);
|
|
132
|
+
const error = asRecord(data.error);
|
|
133
|
+
return {
|
|
134
|
+
kind: "authentication",
|
|
135
|
+
target: PROTECTED_CAPTURE_TARGET.authentication,
|
|
136
|
+
overallStatus: status === "PASS" || status === "FAIL" ? status : void 0,
|
|
137
|
+
attemptsRemaining: optionalNumber(data, "attemptsRemaining") ?? (captureAttemptsLimit ? optionalNumber(captureAttemptsLimit, "remaining") : void 0),
|
|
138
|
+
errorName: optionalString(data, "errorName") ?? (error ? optionalString(error, "name") : void 0)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function sanitizeId(raw, target) {
|
|
142
|
+
const data = responseData(raw);
|
|
143
|
+
const side = optionalString(data, "side");
|
|
144
|
+
return {
|
|
145
|
+
kind: "id",
|
|
146
|
+
target,
|
|
147
|
+
failReason: optionalString(data, "failReason"),
|
|
148
|
+
side: side === "front" || side === "back" ? side : void 0,
|
|
149
|
+
isDocumentExpired: optionalBoolean(data, "isDocumentExpired"),
|
|
150
|
+
classification: optionalBoolean(data, "classification"),
|
|
151
|
+
readability: optionalBoolean(data, "readability"),
|
|
152
|
+
idQualityAttemptApproved: optionalBoolean(data, "idQualityAttemptApproved"),
|
|
153
|
+
sharpness: optionalNumber(data, "sharpness"),
|
|
154
|
+
glare: optionalNumber(data, "glare"),
|
|
155
|
+
skipGlareFront: optionalBoolean(data, "skipGlareFront"),
|
|
156
|
+
skipGlareBack: optionalBoolean(data, "skipGlareBack"),
|
|
157
|
+
showMandatoryConsent: optionalBoolean(data, "showMandatoryConsent"),
|
|
158
|
+
typeOfId: optionalString(data, "typeOfId"),
|
|
159
|
+
skipBackIdCapture: optionalBoolean(data, "skipBackIdCapture"),
|
|
160
|
+
regulationType: optionalString(data, "regulationType"),
|
|
161
|
+
countryCode: optionalString(data, "countryCode"),
|
|
162
|
+
acceptedDocuments: optionalStringArray(data, "acceptedDocuments"),
|
|
163
|
+
forceFrontIdCapture: optionalBoolean(data, "forceFrontIdCapture"),
|
|
164
|
+
idValidationCompleted: optionalBoolean(data, "idValidationCompleted"),
|
|
165
|
+
sessionStatus: optionalString(data, "sessionStatus"),
|
|
166
|
+
success: optionalBoolean(data, "success")
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function sanitizeProtectedResponse(request, raw) {
|
|
170
|
+
assertResponseTarget(raw, request.target);
|
|
171
|
+
switch (request.target) {
|
|
172
|
+
case PROTECTED_CAPTURE_TARGET.selfie: return sanitizeSelfie(raw);
|
|
173
|
+
case PROTECTED_CAPTURE_TARGET.authentication: return sanitizeAuthentication(raw);
|
|
174
|
+
case PROTECTED_CAPTURE_TARGET.frontId:
|
|
175
|
+
case PROTECTED_CAPTURE_TARGET.backId:
|
|
176
|
+
case PROTECTED_CAPTURE_TARGET.frontSecondId:
|
|
177
|
+
case PROTECTED_CAPTURE_TARGET.backSecondId: return sanitizeId(raw, request.target);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
var CameraCycleProvider = class {
|
|
181
|
+
constructor(runtime = wasmRuntime) {
|
|
182
|
+
this.runtime = runtime;
|
|
183
|
+
this[CAMERA_CYCLE_OWNERSHIP_DOMAIN] = getCameraCycleOwnershipDomain(runtime);
|
|
184
|
+
}
|
|
185
|
+
adoptStream(stream, constraints, options) {
|
|
186
|
+
return this.runtime.adoptCameraStream(stream, constraints, options);
|
|
187
|
+
}
|
|
188
|
+
setWorkflowConsuming(workflow, consuming) {
|
|
189
|
+
if (consuming && (workflow === 2 || workflow === 3)) throw new Error("[Incode SDK] Protected still capture is unavailable for video-selfie workflows.");
|
|
190
|
+
return this.runtime.setWorkflowConsuming(workflow, consuming);
|
|
191
|
+
}
|
|
192
|
+
captureProtectedFrame(target) {
|
|
193
|
+
return this.runtime.captureProtectedFrame(target);
|
|
194
|
+
}
|
|
195
|
+
paintFrameToCanvas(canvas, options) {
|
|
196
|
+
return this.runtime.paintFrameToCanvas(canvas, options);
|
|
197
|
+
}
|
|
198
|
+
getCaptureSize() {
|
|
199
|
+
return this.runtime.getCaptureSize();
|
|
200
|
+
}
|
|
201
|
+
getUnprotectedStream() {
|
|
202
|
+
return this.runtime.getUnprotectedStream();
|
|
203
|
+
}
|
|
204
|
+
async postProtectedRequest(request) {
|
|
205
|
+
return sanitizeProtectedResponse(request, await this.runtime.postProtectedRequest(request));
|
|
206
|
+
}
|
|
207
|
+
release() {
|
|
208
|
+
this.runtime.releaseCameraCycle();
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const cameraCycleProvider = new CameraCycleProvider();
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/internal/cameraCycle/protectedAttemptActor.ts
|
|
214
|
+
/**
|
|
215
|
+
* Runs the protected lifecycle inside an owning callback actor. Keeping the
|
|
216
|
+
* implementation callable lets domain controllers compose the exact same
|
|
217
|
+
* lifecycle without placing its capability-bearing input in machine context.
|
|
218
|
+
*/
|
|
219
|
+
const runProtectedAttempt = ({ input, sendBack, receive }) => {
|
|
220
|
+
const abortController = new AbortController();
|
|
221
|
+
let active = true;
|
|
222
|
+
let backgrounded = input.initiallyBackgrounded === true;
|
|
223
|
+
let ready = false;
|
|
224
|
+
let committed = false;
|
|
225
|
+
let finalized = false;
|
|
226
|
+
let deliveryInFlight = false;
|
|
227
|
+
let delivered = false;
|
|
228
|
+
let consuming = false;
|
|
229
|
+
let recorderStarted = false;
|
|
230
|
+
let recorderOperationInFlight = false;
|
|
231
|
+
let recorderPrepared = false;
|
|
232
|
+
let preparedRecording = {};
|
|
233
|
+
let pocCompleted = false;
|
|
234
|
+
let recorderResumedAfterPoc = false;
|
|
235
|
+
let postPocDisplayStream = null;
|
|
236
|
+
let finalizeDeferred = false;
|
|
237
|
+
let pendingReadyStream = null;
|
|
238
|
+
let pendingDeliveryEvent = null;
|
|
239
|
+
let visibilityGeneration = 0;
|
|
240
|
+
let unadoptedStream = input.streamSource.kind === "preAcquired" ? input.streamSource.stream : null;
|
|
241
|
+
let resourcesReleased = false;
|
|
242
|
+
let cycleTransferred = false;
|
|
243
|
+
let commandQueue = Promise.resolve();
|
|
244
|
+
const now = input.getTimestamp ?? getTimestamp;
|
|
245
|
+
let startupStartedAt;
|
|
246
|
+
const startupTiming = {};
|
|
247
|
+
const measure = (operation) => {
|
|
248
|
+
const startedAt = now();
|
|
249
|
+
return {
|
|
250
|
+
value: operation(),
|
|
251
|
+
durationMs: Math.max(0, now() - startedAt)
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
const reportStartupTiming = (consumeMs, totalMs) => {
|
|
255
|
+
if (startupStartedAt === void 0 || !input.onStartupTiming) return;
|
|
256
|
+
try {
|
|
257
|
+
input.onStartupTiming({
|
|
258
|
+
acquireMs: startupTiming.acquireMs ?? 0,
|
|
259
|
+
adoptMs: startupTiming.adoptMs ?? 0,
|
|
260
|
+
prcMs: startupTiming.prcMs ?? 0,
|
|
261
|
+
displayStreamMs: startupTiming.displayStreamMs ?? 0,
|
|
262
|
+
configureMs: startupTiming.configureMs ?? 0,
|
|
263
|
+
recorderMs: startupTiming.recorderMs ?? 0,
|
|
264
|
+
consumeMs,
|
|
265
|
+
totalMs
|
|
266
|
+
});
|
|
267
|
+
} catch {}
|
|
268
|
+
};
|
|
269
|
+
const sendParent = (event) => {
|
|
270
|
+
sendBack(event);
|
|
271
|
+
};
|
|
272
|
+
const releaseRawStream = (stream) => {
|
|
273
|
+
try {
|
|
274
|
+
input.releaseUnadoptedStream(stream);
|
|
275
|
+
} catch {}
|
|
276
|
+
};
|
|
277
|
+
const reportFailure = (stage, code) => {
|
|
278
|
+
if (!active) return;
|
|
279
|
+
sendParent({
|
|
280
|
+
type: "PROTECTED_ATTEMPT_FAILED",
|
|
281
|
+
attemptId: input.attemptId,
|
|
282
|
+
failure: {
|
|
283
|
+
stage,
|
|
284
|
+
code
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
const releaseResources = () => {
|
|
289
|
+
if (resourcesReleased) return;
|
|
290
|
+
resourcesReleased = true;
|
|
291
|
+
abortController.abort();
|
|
292
|
+
if (consuming) {
|
|
293
|
+
try {
|
|
294
|
+
input.cycle.setWorkflowConsuming(input.workflow, false);
|
|
295
|
+
} catch {}
|
|
296
|
+
consuming = false;
|
|
297
|
+
}
|
|
298
|
+
try {
|
|
299
|
+
input.recorder.dispose();
|
|
300
|
+
} catch {}
|
|
301
|
+
recorderStarted = false;
|
|
302
|
+
pendingReadyStream = null;
|
|
303
|
+
postPocDisplayStream = null;
|
|
304
|
+
pendingDeliveryEvent = null;
|
|
305
|
+
finalizeDeferred = false;
|
|
306
|
+
if (unadoptedStream) releaseRawStream(unadoptedStream);
|
|
307
|
+
unadoptedStream = null;
|
|
308
|
+
if (cycleTransferred) input.cycleOwnership.releaseByAttempt();
|
|
309
|
+
else input.cycleOwnership.releaseByController();
|
|
310
|
+
};
|
|
311
|
+
const deactivate = () => {
|
|
312
|
+
if (!active && resourcesReleased) return;
|
|
313
|
+
active = false;
|
|
314
|
+
ready = false;
|
|
315
|
+
releaseResources();
|
|
316
|
+
};
|
|
317
|
+
const failClosed = (stage, code) => {
|
|
318
|
+
reportFailure(stage, code);
|
|
319
|
+
deactivate();
|
|
320
|
+
};
|
|
321
|
+
const stopConsuming = () => {
|
|
322
|
+
if (!consuming) return true;
|
|
323
|
+
try {
|
|
324
|
+
if (!input.cycle.setWorkflowConsuming(input.workflow, false)) return false;
|
|
325
|
+
} catch {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
consuming = false;
|
|
329
|
+
return true;
|
|
330
|
+
};
|
|
331
|
+
const pauseRecorderForBackground = () => {
|
|
332
|
+
if (recorderOperationInFlight) return;
|
|
333
|
+
if (!recorderStarted) return;
|
|
334
|
+
if (recorderPrepared && !recorderResumedAfterPoc) return;
|
|
335
|
+
try {
|
|
336
|
+
input.recorder.pauseForBackground();
|
|
337
|
+
} catch {
|
|
338
|
+
reportFailure("recorder", "protected-attempt-background-pause-failed");
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
const startConsumingAndAnnounceReady = (displayStream) => {
|
|
342
|
+
const consume = measure(() => input.cycle.setWorkflowConsuming(input.workflow, true));
|
|
343
|
+
if (!consume.value) {
|
|
344
|
+
failClosed("consume", "protected-attempt-consume-failed");
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
const startupTotalMs = startupStartedAt === void 0 ? 0 : Math.max(0, now() - startupStartedAt);
|
|
348
|
+
consuming = true;
|
|
349
|
+
ready = true;
|
|
350
|
+
pendingReadyStream = null;
|
|
351
|
+
if (input.resourceSink) {
|
|
352
|
+
input.resourceSink.ready(displayStream);
|
|
353
|
+
sendParent({
|
|
354
|
+
type: "PROTECTED_ATTEMPT_READY_SIGNAL",
|
|
355
|
+
attemptId: input.attemptId
|
|
356
|
+
});
|
|
357
|
+
} else sendParent({
|
|
358
|
+
type: "PROTECTED_ATTEMPT_READY",
|
|
359
|
+
attemptId: input.attemptId,
|
|
360
|
+
displayStream
|
|
361
|
+
});
|
|
362
|
+
reportStartupTiming(consume.durationMs, startupTotalMs);
|
|
363
|
+
return true;
|
|
364
|
+
};
|
|
365
|
+
const start = async () => {
|
|
366
|
+
let stage = "acquire";
|
|
367
|
+
try {
|
|
368
|
+
startupStartedAt = now();
|
|
369
|
+
const acquisitionStartedAt = now();
|
|
370
|
+
const acquired = input.streamSource.kind === "preAcquired" ? {
|
|
371
|
+
stream: input.streamSource.stream,
|
|
372
|
+
constraints: input.streamSource.constraints
|
|
373
|
+
} : await input.streamSource.acquire(abortController.signal);
|
|
374
|
+
startupTiming.acquireMs = Math.max(0, now() - acquisitionStartedAt);
|
|
375
|
+
if (!active || abortController.signal.aborted) {
|
|
376
|
+
releaseRawStream(acquired.stream);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
unadoptedStream = acquired.stream;
|
|
380
|
+
stage = "adopt";
|
|
381
|
+
if (input.beforeAdopt) {
|
|
382
|
+
await input.beforeAdopt(acquired.stream);
|
|
383
|
+
if (!active || abortController.signal.aborted) return;
|
|
384
|
+
}
|
|
385
|
+
const adoption = measure(() => input.cycle.adoptStream(acquired.stream, acquired.constraints, input.captureOptions));
|
|
386
|
+
startupTiming.adoptMs = adoption.durationMs;
|
|
387
|
+
if (!adoption.value) throw new Error("protected camera stream adoption was rejected");
|
|
388
|
+
unadoptedStream = null;
|
|
389
|
+
input.cycleOwnership.transferToAttempt();
|
|
390
|
+
cycleTransferred = true;
|
|
391
|
+
stage = "prc";
|
|
392
|
+
const prcStartedAt = now();
|
|
393
|
+
await input.runPrc();
|
|
394
|
+
startupTiming.prcMs = Math.max(0, now() - prcStartedAt);
|
|
395
|
+
if (!active) return;
|
|
396
|
+
const displayStreamResult = measure(() => input.cycle.getUnprotectedStream());
|
|
397
|
+
startupTiming.displayStreamMs = displayStreamResult.durationMs;
|
|
398
|
+
const displayStream = displayStreamResult.value;
|
|
399
|
+
if (!displayStream) throw new Error("protected camera cycle did not provide a stream");
|
|
400
|
+
stage = "configure";
|
|
401
|
+
const configureStartedAt = now();
|
|
402
|
+
await input.configureWorkflow();
|
|
403
|
+
startupTiming.configureMs = Math.max(0, now() - configureStartedAt);
|
|
404
|
+
if (!active) return;
|
|
405
|
+
recorderOperationInFlight = true;
|
|
406
|
+
const recorderStartedAt = now();
|
|
407
|
+
try {
|
|
408
|
+
await input.recorder.start(displayStream);
|
|
409
|
+
recorderStarted = input.recorder.mode !== "none";
|
|
410
|
+
} catch {
|
|
411
|
+
try {
|
|
412
|
+
input.recorder.dispose();
|
|
413
|
+
} catch {}
|
|
414
|
+
recorderStarted = false;
|
|
415
|
+
} finally {
|
|
416
|
+
startupTiming.recorderMs = Math.max(0, now() - recorderStartedAt);
|
|
417
|
+
recorderOperationInFlight = false;
|
|
418
|
+
}
|
|
419
|
+
if (!active) return;
|
|
420
|
+
if (backgrounded) {
|
|
421
|
+
pauseRecorderForBackground();
|
|
422
|
+
pendingReadyStream = displayStream;
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
stage = "consume";
|
|
426
|
+
startConsumingAndAnnounceReady(displayStream);
|
|
427
|
+
} catch {
|
|
428
|
+
if (!active) return;
|
|
429
|
+
failClosed(stage, `protected-attempt-${stage}-failed`);
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
const commitAutoCapture = (preview) => {
|
|
433
|
+
if (!active || !ready || backgrounded || committed) return;
|
|
434
|
+
if (!stopConsuming()) {
|
|
435
|
+
failClosed("consume", "protected-attempt-stop-consuming-failed");
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
committed = true;
|
|
439
|
+
if (input.resourceSink) {
|
|
440
|
+
input.resourceSink.autoCommitted(preview);
|
|
441
|
+
sendParent({
|
|
442
|
+
type: "PROTECTED_AUTO_COMMITTED_SIGNAL",
|
|
443
|
+
attemptId: input.attemptId
|
|
444
|
+
});
|
|
445
|
+
} else sendParent({
|
|
446
|
+
type: "PROTECTED_AUTO_COMMITTED",
|
|
447
|
+
attemptId: input.attemptId,
|
|
448
|
+
preview
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
const commitManualCapture = () => {
|
|
452
|
+
if (!active || !ready || backgrounded || committed) return;
|
|
453
|
+
let preview;
|
|
454
|
+
try {
|
|
455
|
+
preview = input.cycle.captureProtectedFrame(input.target);
|
|
456
|
+
} catch {
|
|
457
|
+
reportFailure("manualCommit", "protected-attempt-manual-commit-refused");
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if (!stopConsuming()) {
|
|
461
|
+
failClosed("consume", "protected-attempt-stop-consuming-failed");
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
committed = true;
|
|
465
|
+
if (input.resourceSink) {
|
|
466
|
+
input.resourceSink.manualCommitted(preview);
|
|
467
|
+
sendParent({
|
|
468
|
+
type: "PROTECTED_MANUAL_COMMITTED_SIGNAL",
|
|
469
|
+
attemptId: input.attemptId
|
|
470
|
+
});
|
|
471
|
+
} else sendParent({
|
|
472
|
+
type: "PROTECTED_MANUAL_COMMITTED",
|
|
473
|
+
attemptId: input.attemptId,
|
|
474
|
+
preview
|
|
475
|
+
});
|
|
476
|
+
};
|
|
477
|
+
const finalize = async () => {
|
|
478
|
+
if (!active || !ready || finalized) return;
|
|
479
|
+
if (backgrounded) {
|
|
480
|
+
finalizeDeferred = true;
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
if (!committed) {
|
|
484
|
+
reportFailure("poc", "protected-attempt-not-committed");
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
finalizeDeferred = false;
|
|
488
|
+
if (recorderStarted && !recorderPrepared) {
|
|
489
|
+
recorderOperationInFlight = true;
|
|
490
|
+
try {
|
|
491
|
+
preparedRecording = await input.recorder.prepareForPoc();
|
|
492
|
+
recorderPrepared = true;
|
|
493
|
+
} catch {
|
|
494
|
+
if (!active) return;
|
|
495
|
+
failClosed("recorder", "protected-attempt-recorder-finalize-failed");
|
|
496
|
+
return;
|
|
497
|
+
} finally {
|
|
498
|
+
recorderOperationInFlight = false;
|
|
499
|
+
}
|
|
500
|
+
if (!active) return;
|
|
501
|
+
if (backgrounded) {
|
|
502
|
+
pauseRecorderForBackground();
|
|
503
|
+
finalizeDeferred = true;
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
if (!pocCompleted) {
|
|
508
|
+
try {
|
|
509
|
+
await input.runPoc();
|
|
510
|
+
pocCompleted = true;
|
|
511
|
+
} catch {
|
|
512
|
+
if (!active) return;
|
|
513
|
+
failClosed("poc", "protected-attempt-poc-failed");
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
if (!active) return;
|
|
517
|
+
if (backgrounded) {
|
|
518
|
+
finalizeDeferred = true;
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
let displayStream = postPocDisplayStream;
|
|
523
|
+
if (input.recorder.mode === "suspendResume" && recorderStarted && !recorderResumedAfterPoc) {
|
|
524
|
+
displayStream = input.cycle.getUnprotectedStream();
|
|
525
|
+
if (!displayStream) {
|
|
526
|
+
failClosed("recorder", "protected-attempt-resume-stream-missing");
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
try {
|
|
530
|
+
recorderOperationInFlight = true;
|
|
531
|
+
await input.recorder.resumeAfterPoc(displayStream);
|
|
532
|
+
recorderResumedAfterPoc = true;
|
|
533
|
+
postPocDisplayStream = displayStream;
|
|
534
|
+
} catch {
|
|
535
|
+
if (!active) return;
|
|
536
|
+
failClosed("recorder", "protected-attempt-recorder-resume-failed");
|
|
537
|
+
return;
|
|
538
|
+
} finally {
|
|
539
|
+
recorderOperationInFlight = false;
|
|
540
|
+
}
|
|
541
|
+
if (!active) return;
|
|
542
|
+
if (backgrounded) {
|
|
543
|
+
pauseRecorderForBackground();
|
|
544
|
+
finalizeDeferred = true;
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
finalized = true;
|
|
549
|
+
if (input.resourceSink) {
|
|
550
|
+
input.resourceSink.finalized(preparedRecording, displayStream);
|
|
551
|
+
sendParent({
|
|
552
|
+
type: "PROTECTED_ATTEMPT_FINALIZED_SIGNAL",
|
|
553
|
+
attemptId: input.attemptId
|
|
554
|
+
});
|
|
555
|
+
} else sendParent({
|
|
556
|
+
type: "PROTECTED_ATTEMPT_FINALIZED",
|
|
557
|
+
attemptId: input.attemptId,
|
|
558
|
+
recording: preparedRecording,
|
|
559
|
+
displayStream
|
|
560
|
+
});
|
|
561
|
+
};
|
|
562
|
+
const uploadProtected = async (command) => {
|
|
563
|
+
if (!active || !finalized || deliveryInFlight || delivered) return;
|
|
564
|
+
if (backgrounded) {
|
|
565
|
+
pendingDeliveryEvent = {
|
|
566
|
+
type: "PROTECTED_ATTEMPT_FAILED",
|
|
567
|
+
attemptId: input.attemptId,
|
|
568
|
+
failure: {
|
|
569
|
+
stage: "upload",
|
|
570
|
+
code: "protected-attempt-backgrounded"
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
if (command.request.target !== input.target) {
|
|
576
|
+
reportFailure("upload", "protected-attempt-target-mismatch");
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
deliveryInFlight = true;
|
|
580
|
+
try {
|
|
581
|
+
const result = await input.cycle.postProtectedRequest(command.request);
|
|
582
|
+
if (active) {
|
|
583
|
+
if (result.target !== input.target) {
|
|
584
|
+
reportFailure("upload", "protected-attempt-result-target-mismatch");
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
delivered = true;
|
|
588
|
+
const event = input.resourceSink ? (() => {
|
|
589
|
+
input.resourceSink.uploadDone(result);
|
|
590
|
+
return {
|
|
591
|
+
type: "PROTECTED_UPLOAD_DONE_SIGNAL",
|
|
592
|
+
attemptId: input.attemptId
|
|
593
|
+
};
|
|
594
|
+
})() : {
|
|
595
|
+
type: "PROTECTED_UPLOAD_DONE",
|
|
596
|
+
attemptId: input.attemptId,
|
|
597
|
+
result
|
|
598
|
+
};
|
|
599
|
+
if (backgrounded) pendingDeliveryEvent = event;
|
|
600
|
+
else sendParent(event);
|
|
601
|
+
}
|
|
602
|
+
} catch {
|
|
603
|
+
if (backgrounded) pendingDeliveryEvent = {
|
|
604
|
+
type: "PROTECTED_ATTEMPT_FAILED",
|
|
605
|
+
attemptId: input.attemptId,
|
|
606
|
+
failure: {
|
|
607
|
+
stage: "upload",
|
|
608
|
+
code: "protected-attempt-upload-failed"
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
else reportFailure("upload", "protected-attempt-upload-failed");
|
|
612
|
+
} finally {
|
|
613
|
+
deliveryInFlight = false;
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
const uploadFaceResults = async (command) => {
|
|
617
|
+
if (!active || !finalized || deliveryInFlight || delivered) return;
|
|
618
|
+
if (backgrounded) {
|
|
619
|
+
pendingDeliveryEvent = {
|
|
620
|
+
type: "PROTECTED_ATTEMPT_FAILED",
|
|
621
|
+
attemptId: input.attemptId,
|
|
622
|
+
failure: {
|
|
623
|
+
stage: "upload",
|
|
624
|
+
code: "protected-attempt-backgrounded"
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
if (input.target !== PROTECTED_CAPTURE_TARGET.selfie && input.target !== PROTECTED_CAPTURE_TARGET.authentication) {
|
|
630
|
+
reportFailure("upload", "protected-attempt-target-mismatch");
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
if (!input.faceResults) {
|
|
634
|
+
reportFailure("upload", "protected-attempt-face-results-unavailable");
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
deliveryInFlight = true;
|
|
638
|
+
try {
|
|
639
|
+
await input.faceResults.postFaceResults(command.config);
|
|
640
|
+
if (active) {
|
|
641
|
+
delivered = true;
|
|
642
|
+
const result = {
|
|
643
|
+
kind: "onDeviceFace",
|
|
644
|
+
target: input.target
|
|
645
|
+
};
|
|
646
|
+
const event = input.resourceSink ? (() => {
|
|
647
|
+
input.resourceSink.uploadDone(result);
|
|
648
|
+
return {
|
|
649
|
+
type: "PROTECTED_UPLOAD_DONE_SIGNAL",
|
|
650
|
+
attemptId: input.attemptId
|
|
651
|
+
};
|
|
652
|
+
})() : {
|
|
653
|
+
type: "PROTECTED_UPLOAD_DONE",
|
|
654
|
+
attemptId: input.attemptId,
|
|
655
|
+
result
|
|
656
|
+
};
|
|
657
|
+
if (backgrounded) pendingDeliveryEvent = event;
|
|
658
|
+
else sendParent(event);
|
|
659
|
+
}
|
|
660
|
+
} catch {
|
|
661
|
+
if (backgrounded) pendingDeliveryEvent = {
|
|
662
|
+
type: "PROTECTED_ATTEMPT_FAILED",
|
|
663
|
+
attemptId: input.attemptId,
|
|
664
|
+
failure: {
|
|
665
|
+
stage: "upload",
|
|
666
|
+
code: "protected-attempt-upload-failed"
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
else reportFailure("upload", "protected-attempt-upload-failed");
|
|
670
|
+
} finally {
|
|
671
|
+
deliveryInFlight = false;
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
const handleCommand = async (command, receivedVisibilityGeneration) => {
|
|
675
|
+
if (!active) return;
|
|
676
|
+
switch (command.type) {
|
|
677
|
+
case "AUTO_CAPTURE": {
|
|
678
|
+
const preview = input.capturePresentationFrame?.();
|
|
679
|
+
if (preview) commitAutoCapture(preview);
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
case "AUTO_CAPTURED":
|
|
683
|
+
commitAutoCapture(command.preview);
|
|
684
|
+
return;
|
|
685
|
+
case "MANUAL_CAPTURE":
|
|
686
|
+
commitManualCapture();
|
|
687
|
+
return;
|
|
688
|
+
case "FINALIZE":
|
|
689
|
+
await finalize();
|
|
690
|
+
return;
|
|
691
|
+
case "UPLOAD_PROTECTED":
|
|
692
|
+
await uploadProtected(command);
|
|
693
|
+
return;
|
|
694
|
+
case "UPLOAD_FACE_RESULTS":
|
|
695
|
+
await uploadFaceResults(command);
|
|
696
|
+
return;
|
|
697
|
+
case "BACKGROUND": return;
|
|
698
|
+
case "FOREGROUND": {
|
|
699
|
+
if (!backgrounded) return;
|
|
700
|
+
if (receivedVisibilityGeneration !== visibilityGeneration) return;
|
|
701
|
+
let resumedStream = null;
|
|
702
|
+
if (recorderStarted && (!recorderPrepared || recorderResumedAfterPoc)) {
|
|
703
|
+
resumedStream = input.cycle.getUnprotectedStream();
|
|
704
|
+
if (!resumedStream) {
|
|
705
|
+
reportFailure("recorder", "protected-attempt-foreground-stream-missing");
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
recorderOperationInFlight = true;
|
|
709
|
+
try {
|
|
710
|
+
await input.recorder.resumeFromBackground(resumedStream);
|
|
711
|
+
if (!active) return;
|
|
712
|
+
if (receivedVisibilityGeneration !== visibilityGeneration) {
|
|
713
|
+
recorderOperationInFlight = false;
|
|
714
|
+
pauseRecorderForBackground();
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
if (pocCompleted && recorderResumedAfterPoc) postPocDisplayStream = resumedStream;
|
|
718
|
+
} catch {
|
|
719
|
+
if (!active) return;
|
|
720
|
+
reportFailure("recorder", "protected-attempt-background-resume-failed");
|
|
721
|
+
return;
|
|
722
|
+
} finally {
|
|
723
|
+
recorderOperationInFlight = false;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
backgrounded = false;
|
|
727
|
+
if (pendingReadyStream) {
|
|
728
|
+
const readyStream = resumedStream ?? pendingReadyStream;
|
|
729
|
+
try {
|
|
730
|
+
if (!startConsumingAndAnnounceReady(readyStream)) return;
|
|
731
|
+
} catch {
|
|
732
|
+
failClosed("consume", "protected-attempt-consume-failed");
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
if (finalizeDeferred) {
|
|
737
|
+
await finalize();
|
|
738
|
+
if (!active || backgrounded) return;
|
|
739
|
+
}
|
|
740
|
+
if (pendingDeliveryEvent) {
|
|
741
|
+
const event = pendingDeliveryEvent;
|
|
742
|
+
pendingDeliveryEvent = null;
|
|
743
|
+
sendParent(event);
|
|
744
|
+
}
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
case "RELEASE": return;
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
let startup = backgrounded ? null : start();
|
|
751
|
+
const ensureStartup = () => {
|
|
752
|
+
startup ??= start();
|
|
753
|
+
return startup;
|
|
754
|
+
};
|
|
755
|
+
receive((command) => {
|
|
756
|
+
if (command.type === "RELEASE") {
|
|
757
|
+
if (!active) return;
|
|
758
|
+
deactivate();
|
|
759
|
+
sendParent({
|
|
760
|
+
type: "PROTECTED_ATTEMPT_RELEASED",
|
|
761
|
+
attemptId: input.attemptId
|
|
762
|
+
});
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
if (command.type === "BACKGROUND") {
|
|
766
|
+
if (!active) return;
|
|
767
|
+
backgrounded = true;
|
|
768
|
+
visibilityGeneration += 1;
|
|
769
|
+
pauseRecorderForBackground();
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
if (!active) return;
|
|
773
|
+
const receivedVisibilityGeneration = command.type === "FOREGROUND" ? visibilityGeneration : void 0;
|
|
774
|
+
if (command.type === "FOREGROUND" && startup === null) {
|
|
775
|
+
if (receivedVisibilityGeneration !== visibilityGeneration) return;
|
|
776
|
+
backgrounded = false;
|
|
777
|
+
commandQueue = commandQueue.then(async () => {
|
|
778
|
+
await ensureStartup();
|
|
779
|
+
}).catch(() => {
|
|
780
|
+
failClosed("acquire", "protected-attempt-command-failed");
|
|
781
|
+
});
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
commandQueue = commandQueue.then(async () => {
|
|
785
|
+
await ensureStartup();
|
|
786
|
+
await handleCommand(command, receivedVisibilityGeneration);
|
|
787
|
+
}).catch(() => {
|
|
788
|
+
failClosed("internal", "protected-attempt-command-failed");
|
|
789
|
+
});
|
|
790
|
+
});
|
|
791
|
+
return deactivate;
|
|
792
|
+
};
|
|
793
|
+
fromCallback(runProtectedAttempt);
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region ../infra/src/providers/wasm/createCameraCycleOwnership.ts
|
|
796
|
+
/** Creates an attempt lease in the underlying runtime's ownership domain. */
|
|
797
|
+
function createCameraCycleOwnership(cycle) {
|
|
798
|
+
const domain = getCameraCycleOwnershipDomain(cycle);
|
|
799
|
+
const creationSnapshot = domain.snapshot();
|
|
800
|
+
const owner = Symbol("protectedCameraCycleOwner");
|
|
801
|
+
let state = "controller";
|
|
802
|
+
const releaseNative = () => {
|
|
803
|
+
try {
|
|
804
|
+
cycle.release();
|
|
805
|
+
} catch {}
|
|
806
|
+
};
|
|
807
|
+
return {
|
|
808
|
+
transferToAttempt() {
|
|
809
|
+
if (state !== "controller") return;
|
|
810
|
+
state = "attempt";
|
|
811
|
+
domain.transfer(owner);
|
|
812
|
+
},
|
|
813
|
+
releaseByController() {
|
|
814
|
+
if (state !== "controller") return;
|
|
815
|
+
state = "released";
|
|
816
|
+
if (domain.releaseController(creationSnapshot.generation, creationSnapshot.activeOwner === void 0)) releaseNative();
|
|
817
|
+
},
|
|
818
|
+
releaseByAttempt() {
|
|
819
|
+
if (state !== "attempt") return;
|
|
820
|
+
state = "released";
|
|
821
|
+
if (domain.releaseAttempt(owner)) releaseNative();
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
//#endregion
|
|
826
|
+
export { flagFaceManualReview as a, imageFileToDataUrl as i, runProtectedAttempt as n, flagIdManualReview as o, cameraCycleProvider as r, PROTECTED_CAPTURE_TARGET as s, createCameraCycleOwnership as t };
|