@voltom.io/sdk 1.0.5 → 1.0.7
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/dist/assets/locales/ar.json +34 -2
- package/dist/assets/locales/ch.json +34 -2
- package/dist/assets/locales/de.json +34 -2
- package/dist/assets/locales/en.json +34 -2
- package/dist/assets/locales/es.json +34 -2
- package/dist/assets/locales/fr.json +34 -2
- package/dist/assets/locales/it.json +34 -2
- package/dist/assets/locales/ja.json +34 -2
- package/dist/assets/locales/pt.json +34 -2
- package/dist/assets/locales/ru.json +34 -2
- package/dist/assets/locales/zh.json +34 -2
- package/dist/sdk/PoseSilhouette-D2pGu7Lh.js +2 -0
- package/dist/sdk/PoseSuccess-R_8JYo--.js +2 -0
- package/dist/sdk/errors.d.ts +121 -0
- package/dist/sdk/facegate/global.d.ts +1 -1
- package/dist/sdk/facegate.d.ts +42 -19
- package/dist/sdk/facegate.dist.js +4 -4
- package/dist/sdk/facegate.js +1 -1
- package/dist/sdk/facekey.browser-VlDa2K-w.js +2 -0
- package/dist/sdk/facekey.d.ts +50 -26
- package/dist/sdk/facekey.dist.js +6 -6
- package/dist/sdk/facekey.js +1 -1
- package/dist/sdk/presentation-COhoAxj3.js +8 -0
- package/dist/sdk/presentation-ye0KVm6U.js +2 -0
- package/dist/sdk/requests-DW8zDX51.js +65 -0
- package/dist/sdk/verify.d.ts +58 -22
- package/dist/sdk/verify.dist.js +18 -18
- package/dist/sdk/verify.js +1 -1
- package/dist/sdk/view-CF_YOVly.js +3 -0
- package/dist/sdk/view-Cb4XCb-z.js +3 -0
- package/dist/sdk/view-DcbwHph_.js +2 -0
- package/package.json +7 -5
- package/dist/sdk/PoseSilhouette-Bbwmry4Z.js +0 -2
- package/dist/sdk/PoseSuccess-C3aBF88E.js +0 -2
- package/dist/sdk/eyeLevelCamera-DY4onSBz.js +0 -65
- package/dist/sdk/facekey.browser-CVJiBw1f.js +0 -2
- package/dist/sdk/media-BRKPXpu3.js +0 -2
- package/dist/sdk/presentation-B-TOKUZ3.js +0 -8
- package/dist/sdk/presentation-BsnbDv0i.js +0 -2
- package/dist/sdk/view-Bfg8u_hZ.js +0 -2
- package/dist/sdk/view-CHSkN6gO.js +0 -3
- package/dist/sdk/view-DmGKdc3M.js +0 -3
package/dist/sdk/facegate.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! Copyright (c) 2026 VOLTOM. All rights reserved. Proprietary software. See LICENSE at https://voltom.io/license. */
|
|
2
|
-
import{O as e,Y as t,et as n,l as r,n as i,nt as a,r as o,t as s}from"./eyeLevelCamera-DY4onSBz.js";import{D as c,a as l,c as u,d,g as f,h as p,i as m,p as h,s as g,t as _,u as v}from"./media-BRKPXpu3.js";import{n as y}from"./facekey.browser-CVJiBw1f.js";var b=()=>({active:a(!1),phase:a(`idle`),prompt:a(``),completed:a(0),total:a(1),outcome:a(null),captures:a([])}),x=e=>{if(typeof e.clientKey!=`string`||e.clientKey.length<8||e.requireEyeLevelCamera!==void 0&&typeof e.requireEyeLevelCamera!=`boolean`)throw Error(p.INVALID_OPTIONS);return{...e,requireEyeLevelCamera:e.requireEyeLevelCamera??!1}},S=e=>{if(typeof e.action!=`string`||e.action.length<1||e.action.length>255||typeof e.onPass!=`function`||typeof e.onReject!=`function`)throw Error(p.INVALID_OPTIONS);return e},C=e=>{if(typeof e!=`string`||e.length<32||e.length>128)throw Error(p.INVALID_SERVICE_RESPONSE);return e},{detectPictureFaces:w,loadFaceDetector:T}=y,E=3e4,D=e=>new Promise(t=>setTimeout(t,e)),O=async({frame:t,neutral:n,pose:a,requireEyeLevelCamera:c})=>{let l=await w(t,{blendshapes:!0}),u=l.length===1?l[0]:null;if(!u)return{alignment:null,code:null,prompt:`faceNotFound`,ready:!1};let d={pitch:u.pitch,yaw:u.yaw,roll:u.roll},f=u.boundingRect.height/Math.min(t.width,t.height),p=u.boundingRect.x+u.boundingRect.width/2,m=u.boundingRect.y+u.boundingRect.height/2,h=Math.hypot(p-t.width/2,m-t.height/2)<=Math.min(t.width,t.height)*.12;if(f<.5)return{alignment:d,code:null,prompt:`faceTooSmall`,ready:!1};if(!h)return{alignment:d,code:null,prompt:`centerFace`,ready:!1};let g=i({pitch:u.pitch,pose:a,requireEyeLevelCamera:c,options:e});if(g)return{alignment:d,code:g,prompt:s(),ready:!1};let _=o({alignment:d,blendshapes:u.blendshapes,neutral:n,pose:a,options:e});if(_.code){let e=r({pose:a,code:_.code});return{alignment:d,code:_.code,prompt:e.corrective??e.primary,ready:!1}}return{alignment:d,code:null,prompt:r({pose:a,code:null}).primary,ready:!0}},k=class{options;display=b();handles=new Set;controller=null;view=null;prepared=!1;running=!1;disposed=!1;constructor(e){this.options=Object.freeze(x(e))}async caniuse(){return await _()}async prepare(){if(this.disposed)throw Error(p.SDK_NOT_READY);if(!this.prepared){if(await h({language:this.options.language}),await t({filenames:[`fd.ort`,`fe.ort`,`fl.ort`,`fmu.ort`,`ort-wasm-simd-threaded.mjs`,`ort-wasm-simd-threaded.wasm`]}),this.disposed)throw Error(p.SDK_NOT_READY);if(await T({faceDetector:`standard`}),!this.view){let{createFaceGateView:e}=await import(`./view-Bfg8u_hZ.js`);if(this.disposed)throw Error(p.SDK_NOT_READY);this.view=e({options:this.options,display:this.display,onCancel:()=>this.stop()})}if(this.disposed)throw Error(p.SDK_NOT_READY);this.prepared=!0}}arm(e,t){if(this.disposed||!this.prepared)throw Error(p.SDK_NOT_READY);let n=S(t),r,i=()=>{this.runGate(r)};return r={control:e,options:n,detach:()=>e.removeEventListener(`click`,i)},e.addEventListener(`click`,i),this.handles.add(r),r}disarm(e){e.detach(),this.handles.delete(e)}async request({path:e,body:t,signal:n}){let r=await fetch(`${(this.options.apiUrl??`https://api.voltom.io`).replace(/\/$/,``)}/facegate/${e}`,{method:`POST`,headers:{authorization:`Bearer ${this.options.clientKey}`,"content-type":`application/json`},body:JSON.stringify(t),signal:n}),i=await r.json().catch(()=>null);if(!r.ok)throw Error(typeof i?.code==`string`?i.code:p.INVALID_SERVICE_RESPONSE);return i}async capture({video:e,poses:t,signal:i}){let{translate:a}=d({language:this.options.language}),o=[],s=null;for(let[c,u]of t.entries()){let t=0;for(n(()=>{this.display.phase.value=`capturing`,this.display.completed.value=c,this.display.prompt.value=a(r({pose:u,code:null}).primary)});t<3;){await v({video:e,signal:i}),i.throwIfAborted();let n=await createImageBitmap(e);try{let e=await O({frame:n,neutral:s,pose:u,requireEyeLevelCamera:this.options.requireEyeLevelCamera??!1});if(i.throwIfAborted(),t=e.ready?t+1:0,this.display.prompt.value=a(e.prompt),u===`faceStraight`&&e.ready&&(s=e.alignment),t>=3){let e=await m({frame:n});o.push(await l({image:e}))}}finally{n.close()}}this.display.completed.value=c+1}return o}async runGate(e){if(this.disposed||this.running)return;this.running=!0;let t=new AbortController;this.controller=t;let r=t.signal,i=e.options,a=()=>t.abort(new DOMException(p.FACEGATE_ABORTED,`AbortError`)),o=setTimeout(()=>t.abort(new DOMException(p.FACEGATE_TIMEOUT,`TimeoutError`)),E);i.signal?.addEventListener(`abort`,a,{once:!0}),i.signal?.aborted&&t.abort();let s=null;n(()=>{this.display.active.value=!0,this.display.phase.value=`capturing`,this.display.outcome.value=null,this.display.completed.value=0,this.display.total.value=1,this.display.prompt.value=``}),this.view?.open();try{let e=this.view?.video;if(!e)throw Error(p.INVALID_OPTIONS);await g({facingMode:`user`,video:e,signal:r}),r.throwIfAborted();let t=await Promise.all([i.subjectId?.(),i.context?.()]),n=await this.request({path:`challenge`,body:{action:i.action,subjectId:t[0],context:t[1]},signal:r});s=C(n.token),this.display.total.value=n.poses.length;let a=await this.capture({video:e,poses:n.poses,signal:r});r.throwIfAborted(),this.display.phase.value=`checking`,this.display.prompt.value=d({language:this.options.language}).translate(`checkingFaceMatch`);let o=await this.request({path:`verify`,body:{token:n.token,poses:n.poses,faces:a},signal:r});this.display.outcome.value=o.outcome,this.display.phase.value=o.outcome===`pass`?`pass`:`reject`,this.display.prompt.value=``,await D(950),this.view?.close(),o.outcome===`pass`?await i.onPass(n.token):i.onReject({outcome:o.outcome,code:o.code})}catch(e){let t=r.aborted?f({error:r.reason,fallback:p.FACEGATE_ABORTED}):f({error:e,fallback:p.SERVICE_UNAVAILABLE});if(t!==p.FACEGATE_ABORTED&&(this.display.outcome.value=`error`,this.display.phase.value=`reject`,this.display.prompt.value=``,await D(950)),this.view?.close(),s)try{await this.request({path:`abort`,body:{token:s,code:t},signal:AbortSignal.timeout(1e4)})}catch{}i.onReject({outcome:`error`,code:t})}finally{clearTimeout(o),i.signal?.removeEventListener(`abort`,a);let e=this.view?.video;e&&u({video:e}),this.display.active.value=!1,this.controller=null,this.running=!1}}stop(){this.controller&&this.controller.abort(new DOMException(p.FACEGATE_ABORTED,`AbortError`))}dispose(){if(!this.disposed){this.disposed=!0,this.stop();for(let e of this.handles)e.detach();this.handles.clear(),this.view?.close()}}getState(){return{active:this.display.active.value,phase:this.display.phase.value,prompt:this.display.prompt.value,completed:this.display.completed.value,total:this.display.total.value,outcome:this.display.outcome.value}}};c({moduleUrl:import.meta.url});var A=k;export{k as VoltomFaceGate,A as default};
|
|
2
|
+
import{At as e,Bt as t,Ct as n,F as r,Ft as i,Gt as a,Ht as o,Jt as s,Kt as c,L as l,Lt as u,M as d,Mt as f,N as p,Ot as m,P as h,Pt as g,Rt as _,Ut as v,Vt as y,at as b,dt as ee,gt as x,h as S,ht as C,i as w,jt as T,kt as E,lt as D,m as O,mt as k,n as A,ot as te,r as ne,t as re,u as j,ut as M,wt as N,xt as P,yt as F,zt as I}from"./requests-DW8zDX51.js";import{i as L,r as R,t as z}from"./facekey.browser-VlDa2K-w.js";var B=i({id:I()}),V=u().min(1).max(255),H=u().min(1).max(255),U=u().max(500),W=u().min(32).max(128),G=d.pose,K=f(G).min(2).max(4),q=i({action:V,subjectId:H.optional(),metadata:U.optional()}),ie=p.extend({action:V,poses:K}),J=i({gender:T([`female`,`male`]).optional(),age:_([g(),g()]).refine(([e,t])=>e<=t).optional()}),Y=i({token:W,poses:K,faces:f(r).min(2).max(4),assertions:J.optional()}),ae=i({token:W,assertions:J,face:r,reason:E.nullable()}),oe=i({resultId:I(),token:W,outcome:h,reason:E.nullable()}),se=i({search:u().default(``)}),X=i({id:I(),created_at:e({offset:!0}),action:V,subject_id:H.nullable(),outcome:h.nullable(),reason:u().nullable(),country:u().nullable()}),Z={id:B,action:V,subjectId:H,metadata:U,token:W,pose:G,poses:K,intentInput:q,intent:ie,assertions:J,verifyInput:Y,rejectInput:ae,verify:oe,listInput:se,summary:X,detail:X.extend({metadata:U.nullable(),score:g().nullable(),poses:f(G),expires_at:e({offset:!0}),resolved_at:e({offset:!0}).nullable(),consumed_at:e({offset:!0}).nullable(),origin:u().nullable(),ip:u().nullable(),user_agent:u().nullable()}),list:f(X)};f(i({created_at:u(),action:u(),outcome:h.nullable(),country:u().nullable()}));var ce=()=>({active:s(!1),debugEnabled:s(!1),debug:s([]),error:s(null),phase:s(`idle`),prompt:s(``),pose:s(null),framing:s(!0),completed:s(0),total:s(1),outcome:s(null),captures:s([])}),le=({attributes:e,gender:t,age:n})=>e?t&&t!==`any`&&e.gender!==t?v.FACE_GENDER_MISMATCH:n&&(e.age<n[0]||e.age>n[1])?v.FACE_AGE_MISMATCH:null:v.FACE_ATTRIBUTES_UNAVAILABLE,ue=e=>{if(D({options:e,capabilities:[],authorizeRequired:!0}),typeof e.authorize!=`function`||e.requireEyeLevelCamera!==void 0&&typeof e.requireEyeLevelCamera!=`boolean`)throw o({code:v.INVALID_OPTIONS});return{...e,requireEyeLevelCamera:e.requireEyeLevelCamera??!1}},de=e=>{if(M({options:e}),typeof e.action!=`string`||e.action.length<1||e.action.length>255||e.subjectId!==void 0&&(typeof e.subjectId!=`string`||e.subjectId.length<1||e.subjectId.length>255)||e.metadata!==void 0&&(typeof e.metadata!=`string`||e.metadata.length>500)||e.gender!==void 0&&e.gender!==`female`&&e.gender!==`male`&&e.gender!==`any`)throw o({code:v.INVALID_OPTIONS});if(e.age!==void 0){let t=e.age;if(!Array.isArray(t)||t.length!==2||!Number.isFinite(t[0])||!Number.isFinite(t[1])||t[0]>t[1])throw o({code:v.INVALID_OPTIONS})}return e},{detectPictureFaces:fe,loadFaceDetector:pe}=R,{detectFaceLiveness:me,loadFaceLiveness:Q}=L,{detectFaceAttributes:he,loadFaceAttributes:ge}=z,_e=3e4,ve=({payload:e})=>{let t=Z.verify.omit({token:!0}).safeParse(e);if(!t.success||t.data.outcome===`pass`&&t.data.reason!==null)throw o({code:v.INVALID_SERVICE_RESPONSE,cause:e});return t.data},ye=async({frame:e,neutral:t,pose:n,requireEyeLevelCamera:r})=>{let i=await fe(e,{blendshapes:!0}),a=i.length===1?i[0]:null;if(!a)return{framing:!0,alignment:null,code:null,face:null,prompt:`faceNotFound`,ready:!1};let o={pitch:a.pitch,yaw:a.yaw,roll:a.roll},s=a.boundingRect.height/Math.min(e.width,e.height),c=a.boundingRect.x+a.boundingRect.width/2,u=a.boundingRect.y+a.boundingRect.height/2,d=Math.hypot(c-e.width/2,u-e.height/2)<=Math.min(e.width,e.height)*.12;if(s<.5)return{framing:!0,alignment:o,code:null,face:a,prompt:`faceTooSmall`,ready:!1};if(!d)return{framing:!0,alignment:o,code:null,face:a,prompt:`centerFace`,ready:!1};let f=ne({pitch:a.pitch,pose:n,requireEyeLevelCamera:r,options:l});if(f)return{framing:!0,alignment:o,code:f,face:a,prompt:A(),ready:!1};let p=w({alignment:o,blendshapes:a.blendshapes,neutral:t,pose:n,options:l});if(p.code){let e=j({pose:n,code:p.code});return{framing:!1,alignment:o,code:p.code,face:a,prompt:e.corrective??e.primary,ready:!1}}return{framing:!1,alignment:o,code:null,face:a,prompt:j({pose:n,code:null}).primary,ready:!0}},$=class{static Errors=v;static isSdkError=t;options;display=ce();controller=null;view=null;preparing=null;preloading=null;prepared=!1;running=!1;disposed=!1;constructor(e){D({options:e,capabilities:[],authorizeRequired:!0});let{prepare:t=b.prepare,...n}=e,r=ue(n);this.options=Object.freeze({...r,...te(r)}),this.display.debugEnabled.value=this.options.debug??!1,t&&this.prepare().catch(e=>console.error(e))}setDebug({enabled:e}){if(this.disposed)throw o({code:v.SDK_DISPOSED});if(typeof e!=`boolean`)throw o({code:v.INVALID_OPTIONS});this.options=Object.freeze({...this.options,debug:e}),this.display.debugEnabled.value=e,e||(this.display.debug.value=[])}async caniuse(){return await ee()}async preload(){try{await this.preloadInternal()}catch(e){throw y({error:e,fallback:v.MODEL_LOAD_FAILED})}}async preloadInternal(){if(this.disposed)throw o({code:v.SDK_DISPOSED});if(this.preloading)return this.preloading;let e=(async()=>{if(await n({language:this.options.language}),await m({filenames:[`fd.ort`,`fe.ort`,`fl.ort`,`flv.ort`,`flw.ort`,`fa.ort`,`ort-wasm-simd-threaded.mjs`,`ort-wasm-simd-threaded.wasm`]}),this.disposed)throw o({code:v.SDK_DISPOSED})})();this.preloading=e;try{await e}catch(t){throw this.preloading===e&&(this.preloading=null),y({error:t,fallback:v.MODEL_LOAD_FAILED})}}async prepare(){try{await this.prepareInternal()}catch(e){throw y({error:e,fallback:v.MODEL_LOAD_FAILED})}}async prepareInternal(){if(this.disposed)throw o({code:v.SDK_DISPOSED});if(this.prepared)return;if(this.preparing)return this.preparing;let e=(async()=>{if(await this.preload(),this.disposed)throw o({code:v.SDK_DISPOSED});if(await pe({faceDetector:`standard`}),await Q(),!this.view){let{createFaceGateView:e}=await import(`./view-DcbwHph_.js`);if(this.disposed)throw o({code:v.SDK_DISPOSED});this.view=e({options:this.options,display:this.display,onCancel:()=>this.stop()})}if(this.disposed)throw o({code:v.SDK_DISPOSED});this.prepared=!0})();this.preparing=e;try{await e}catch(e){throw y({error:e,fallback:v.MODEL_LOAD_FAILED})}finally{this.preparing===e&&(this.preparing=null)}}async request({path:e,body:t,signal:n}){return await re({apiUrl:this.options.apiUrl,path:`/facegate/${e}`,clientKey:this.options.clientKey,body:JSON.stringify(t),signal:n})}async capture({video:e,poses:t,signal:n,assertions:r}){let{translate:i}=P({language:this.options.language}),a=[],s=null,l=null,u=null;for(let[d,f]of t.entries()){let t=0;for(c(()=>{this.display.phase.value=`capturing`,this.display.completed.value=d,this.display.pose.value=f,this.display.framing.value=!0,this.display.prompt.value=i(j({pose:f,code:null}).primary)});t<3;){await F({video:e,signal:n}),n.throwIfAborted();let d=await createImageBitmap(e);try{let e=await ye({frame:d,neutral:u,pose:f,requireEyeLevelCamera:this.options.requireEyeLevelCamera??!1});if(n.throwIfAborted(),t=e.ready?t+1:0,c(()=>{this.display.prompt.value=i(e.prompt),this.display.framing.value=e.framing}),this.view?.collectCaptureDebug({inspected:e,pose:f,stable:t}),f===`faceStraight`&&e.ready&&(u=e.alignment),t>=3){if(e.face){let t=await me({detection:e.face,frame:d});if(n.throwIfAborted(),!t.live)throw o({code:v.FACE_SPOOF_DETECTED})}r&&f===`faceStraight`&&e.face&&(s=await he({detection:e.face,frame:d}),n.throwIfAborted(),l=le({attributes:s,...r}));let t=await k({frame:d});a.push(await C({image:t}))}}finally{d.close()}}if(this.display.completed.value=d+1,l)break}return{faces:a,attributes:s,reason:l}}async check(e){if(this.disposed)throw o({code:v.SDK_DISPOSED});if(this.running)throw o({code:v.OPERATION_IN_PROGRESS});let t=de(e),n={...t.gender&&t.gender!==`any`?{gender:t.gender}:{},...t.age?{age:t.age}:{}},r=n.gender!==void 0||n.age!==void 0,i=new AbortController,s=i.signal,l=()=>i.abort(o({code:v.OPERATION_CANCELLED})),u;this.running=!0,this.controller=i,t.signal?.addEventListener(`abort`,l,{once:!0}),t.signal?.aborted&&l();try{s.throwIfAborted(),await a({operation:this.prepare(),signal:s}),s.throwIfAborted(),r&&(await a({operation:ge(),signal:s}),s.throwIfAborted()),u=setTimeout(()=>i.abort(o({code:v.OPERATION_TIMEOUT})),_e),c(()=>{this.display.debug.value=[],this.display.active.value=!0,this.display.phase.value=`capturing`,this.display.outcome.value=null,this.display.error.value=null,this.display.completed.value=0,this.display.total.value=1,this.display.pose.value=null,this.display.framing.value=!0,this.display.prompt.value=``}),this.view?.open();let e=this.view?.video;if(!e)throw o({code:v.UI_ELEMENT_NOT_FOUND});await x({facingMode:`user`,video:e,signal:s}),s.throwIfAborted();let l=await a({operation:O({task:()=>this.options.authorize({action:t.action,subjectId:t.subjectId,metadata:t.metadata})}),signal:s});s.throwIfAborted(),S({intent:l,action:t.action});let d=Z.intent.safeParse(l);if(!d.success)throw o({code:v.INVALID_SERVICE_RESPONSE,cause:l});let f=d.data.poses;this.display.total.value=f.length;let p=await this.capture({video:e,poses:f,signal:s,assertions:r?n:void 0});s.throwIfAborted();let m=p.faces;if(p.reason){this.display.outcome.value=`fail`,this.display.phase.value=`reject`,this.display.prompt.value=``;try{await a({operation:this.request({path:`reject`,body:{token:l.token,assertions:n,face:m[0],reason:p.reason},signal:s}),signal:s})}catch{}return await a({operation:N({milliseconds:950}),signal:s}),{resultId:l.resultId,outcome:`fail`,reason:p.reason}}this.display.phase.value=`checking`,this.display.prompt.value=P({language:this.options.language}).translate(`checkingFaceMatch`);let h=ve({payload:await this.request({path:`verify`,body:{token:l.token,poses:f,faces:m,...r?{assertions:n}:{}},signal:s})});if(s.throwIfAborted(),h.outcome===`error`)throw o({code:h.reason??v.INTERNAL_ERROR,resultId:h.resultId,cause:h});return this.display.outcome.value=h.outcome,this.display.phase.value=h.outcome===`pass`?`pass`:`reject`,this.display.prompt.value=``,await a({operation:N({milliseconds:950}),signal:s}),s.throwIfAborted(),{resultId:h.resultId,outcome:h.outcome,reason:h.reason}}catch(e){let t=y({error:e,signal:s}),n=t.code;if(this.display.error.value=t,this.display.active.value&&n!==v.OPERATION_CANCELLED&&(this.display.outcome.value=`error`,this.display.phase.value=`reject`,this.display.prompt.value=``,!s.aborted))try{await a({operation:N({milliseconds:950}),signal:s})}catch{throw y({error:t,signal:s})}throw s.aborted?y({error:t,signal:s}):t}finally{clearTimeout(u),t.signal?.removeEventListener(`abort`,l),this.view?.close(),this.display.active.value=!1,this.controller=null,this.running=!1}}stop(){this.controller&&this.controller.abort(o({code:v.OPERATION_CANCELLED}))}dispose(){this.disposed||(this.disposed=!0,this.stop(),this.view?.close())}getState(){return{active:this.display.active.value,phase:this.display.phase.value,prompt:this.display.prompt.value,completed:this.display.completed.value,total:this.display.total.value,outcome:this.display.outcome.value,error:this.display.error.value}}},be=$;export{v as Errors,$ as VoltomFaceGate,be as default,t as isSdkError};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Copyright (c) 2026 VOLTOM. All rights reserved. Proprietary software. See LICENSE at https://voltom.io/license. */
|
|
2
|
+
import{J as e,X as t,_ as n,b as r,g as i,v as a,x as o,y as s}from"./requests-DW8zDX51.js";var c=t({runtime:e}),l=n({runtime:e}),u=o({runtime:e}),d=r({runtime:e,imageFromImageBitmap:c}),f=i({runtime:e,...l,...u,...d,faceDetection:d}),p=a({runtime:e}),m=s({runtime:e});export{f as a,p as i,u as n,d as r,m as t};
|
package/dist/sdk/facekey.d.ts
CHANGED
|
@@ -1,64 +1,88 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ErrorCode, Errors, isSdkError, VoltomSdkError } from "./errors.js";
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export { type ErrorCode, Errors, isSdkError, type VoltomSdkError } from "./errors.js";
|
|
4
4
|
|
|
5
|
-
export type
|
|
5
|
+
export type Language = "ar" | "ch" | "de" | "en" | "es" | "fr" | "it" | "ja" | "pt" | "ru" | "zh";
|
|
6
6
|
|
|
7
|
-
export type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
7
|
+
export type Theme = "light" | "dark";
|
|
8
|
+
|
|
9
|
+
export type VoltomBrowserSupport = { supported: boolean; unsupportedFeatures: string[] };
|
|
10
|
+
|
|
11
|
+
export type FaceKeyOperation = "enroll" | "unlock";
|
|
13
12
|
|
|
14
13
|
export type FaceKeyCapability = FaceKeyOperation;
|
|
15
14
|
|
|
16
|
-
export type
|
|
15
|
+
export type FaceKeyPose = "faceStraight" | "faceUp" | "faceLeft" | "faceRight" | "faceSmile";
|
|
17
16
|
|
|
18
17
|
export type FaceKeyOperationOptions = { signal?: AbortSignal; debug?: boolean };
|
|
19
18
|
|
|
20
19
|
export type VoltomFaceKeyOptions = {
|
|
21
20
|
clientKey: string;
|
|
21
|
+
authorize: (input: FaceKeyAuthorizeInput) => Promise<FaceKeyIntent>;
|
|
22
|
+
prepare?: boolean;
|
|
22
23
|
requireEyeLevelCamera?: boolean;
|
|
23
24
|
apiUrl?: string;
|
|
25
|
+
sdkUrl?: string;
|
|
24
26
|
debug?: boolean;
|
|
25
|
-
language?:
|
|
27
|
+
language?: Language;
|
|
28
|
+
theme?: Theme;
|
|
26
29
|
capabilities?: FaceKeyCapability[];
|
|
27
|
-
ui?: boolean;
|
|
28
|
-
video?: HTMLVideoElement;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
export type
|
|
32
|
+
export type FaceKeyIntent = {
|
|
33
|
+
resultId: string;
|
|
34
|
+
token: string;
|
|
35
|
+
action: FaceKeyOperation;
|
|
36
|
+
subjectId: string;
|
|
37
|
+
poses?: FaceKeyPose[];
|
|
38
|
+
expiresAt: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type FaceKeyAuthorizeInput = { action: FaceKeyOperation };
|
|
42
|
+
|
|
43
|
+
export type FaceKeyIdentity = { resultId: string; subjectId: string };
|
|
44
|
+
|
|
45
|
+
export type FaceKeyUnlock = {
|
|
46
|
+
resultId: string;
|
|
47
|
+
subjectId: string;
|
|
48
|
+
matched: boolean;
|
|
49
|
+
matches: { pose: FaceKeyPose; matched: boolean; score: number }[];
|
|
50
|
+
reason: ErrorCode | null;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type FaceKeyFramingRejection =
|
|
54
|
+
| "FACE_NOT_DETECTED"
|
|
55
|
+
| "FACE_IN_POLYGON"
|
|
56
|
+
| "FACE_TOO_SMALL"
|
|
57
|
+
| "FACE_NOT_CENTERED"
|
|
58
|
+
| "FACE_CAMERA_ALIGNMENT_REQUIRED";
|
|
32
59
|
|
|
33
60
|
export type FaceKeyInstruction = {
|
|
34
|
-
framing:
|
|
35
|
-
| "FACE_NOT_DETECTED"
|
|
36
|
-
| "FACE_IN_POLYGON"
|
|
37
|
-
| "FACE_TOO_SMALL"
|
|
38
|
-
| "FACE_NOT_CENTERED"
|
|
39
|
-
| "FACE_CAMERA_ALIGNMENT_REQUIRED"
|
|
40
|
-
| null;
|
|
61
|
+
framing: FaceKeyFramingRejection | null;
|
|
41
62
|
retry: string | null;
|
|
42
63
|
};
|
|
43
64
|
|
|
44
65
|
export type VoltomFaceKeyState = {
|
|
45
66
|
operation: FaceKeyOperation;
|
|
46
|
-
phase: "loading" | "capturing" | "
|
|
67
|
+
phase: "loading" | "capturing" | "processing" | "success" | "failure";
|
|
47
68
|
instruction: FaceKeyInstruction | null;
|
|
48
69
|
progress: { completed: number; total: number };
|
|
49
70
|
feedback: { matched: boolean; animating: boolean } | null;
|
|
50
|
-
error:
|
|
51
|
-
match: { accepted: boolean; reason:
|
|
71
|
+
error: VoltomSdkError | null;
|
|
72
|
+
match: { accepted: boolean; reason: ErrorCode | null; reference?: boolean; score: number | null } | null;
|
|
52
73
|
debug: { label: string; valid?: boolean; value: string }[];
|
|
53
74
|
};
|
|
54
75
|
|
|
55
76
|
export declare class VoltomFaceKey {
|
|
77
|
+
static Errors: typeof Errors;
|
|
78
|
+
static isSdkError: typeof isSdkError;
|
|
56
79
|
constructor(options: VoltomFaceKeyOptions);
|
|
57
80
|
preload(): Promise<void>;
|
|
58
81
|
prepare(): Promise<void>;
|
|
59
82
|
caniuse(): Promise<VoltomBrowserSupport>;
|
|
60
|
-
faceEnroll(
|
|
61
|
-
faceUnlock(
|
|
83
|
+
faceEnroll(options?: FaceKeyOperationOptions): Promise<FaceKeyIdentity>;
|
|
84
|
+
faceUnlock(options?: FaceKeyOperationOptions): Promise<FaceKeyUnlock>;
|
|
85
|
+
setDebug({ enabled }: { enabled: boolean }): void;
|
|
62
86
|
stop(): void;
|
|
63
87
|
dispose(): void;
|
|
64
88
|
getState(): VoltomFaceKeyState;
|