UNPKG

@digitalpersona/core

Version:
3 lines (2 loc) 10.1 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(((e=e||self).dp=e.dp||{},e.dp.core=e.dp.core||{}))}(this,function(e){"use strict";var n,t,r=function(){function e(n,t,r){this.href=e.create(n,t,r)}return e.getSanitizedQuery=function(e){return Object.keys(e).map(function(n){return[n,e[n]].map(encodeURIComponent).join("=")}).join("&")},e.create=function(n,t,r){return n+(t?"/"+encodeURI(t):"")+(r?"?"+e.getSanitizedQuery(r):"")},e}();(n=e.BioFactor||(e.BioFactor={}))[n.Multiple=1]="Multiple",n[n.FacialFeatures=2]="FacialFeatures",n[n.Voice=4]="Voice",n[n.Fingerprint=8]="Fingerprint",n[n.Iris=16]="Iris",n[n.Retina=32]="Retina",n[n.HandGeometry=64]="HandGeometry",n[n.SignatureDynamics=128]="SignatureDynamics",n[n.KeystrokeDynamics=256]="KeystrokeDynamics",n[n.LipMovement=512]="LipMovement",n[n.ThermalFaceImage=1024]="ThermalFaceImage",n[n.ThermalHandImage=2048]="ThermalHandImage",n[n.Gait=4096]="Gait",(t=e.BioSampleFormatOwner||(e.BioSampleFormatOwner={}))[t.None=0]="None",t[t.Neurotechnologija=49]="Neurotechnologija",t[t.DigitalPersona=51]="DigitalPersona",t[t.Cognitec=99]="Cognitec",t[t.Innovatrics=53]="Innovatrics";var o,i,a,u=function(){return function(e,n){this.FormatOwner=e,this.FormatID=n}}();(o=e.BioSampleType||(e.BioSampleType={}))[o.Raw=1]="Raw",o[o.Intermediate=2]="Intermediate",o[o.Processed=4]="Processed",o[o.RawWSQCompressed=8]="RawWSQCompressed",o[o.Encrypted=16]="Encrypted",o[o.Signed=32]="Signed",(i=e.BioSamplePurpose||(e.BioSamplePurpose={}))[i.Any=0]="Any",i[i.Verify=1]="Verify",i[i.Identify=2]="Identify",i[i.Enroll=3]="Enroll",i[i.EnrollForVerificationOnly=4]="EnrollForVerificationOnly",i[i.EnrollForIdentificationOnly=5]="EnrollForIdentificationOnly",i[i.Audit=6]="Audit",(a=e.BioSampleEncryption||(e.BioSampleEncryption={}))[a.None=0]="None",a[a.XTEA=1]="XTEA";var f=function(){return function(e,n,t,r,o,i){this.Factor=e,this.Format=n,this.Type=t,this.Purpose=r,this.Quality=o,this.Encryption=i}}(),s=function(){return function(e,n){this.Header=e,this.Data=n,this.Version=1}}(),c=function(){return(c=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function m(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}var l,p=function(){function e(){}return e.fromUtf8=function(e){return decodeURIComponent(escape(y.noBom(e)))},e.fromBase64=function(n){return e.fromUtf8(y.fromBase64(n))},e.fromBase64Url=function(n){return e.fromUtf8(y.fromBase64Url(n))},e.withBom=function(e){return"\ufeff"+e},e.noBom=function(e){return e.replace(/^\uFEFF/,"")},e}(),y=function(){function e(){}return e.fromUtf16=function(e){return unescape(encodeURIComponent(p.noBom(e)))},e.fromBase64=function(e){return atob(e)},e.fromBase64Url=function(n){return e.fromBase64(d.fromBase64Url(n))},e.fromBytes=function(e){return String.fromCharCode.apply(String,function(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat(m(arguments[n]));return e}(e))},e.withBom=function(e){return""+e},e.noBom=function(e){return e.replace(/^\xEF\xBB\xBF/,"")},e}(),d=function(){function e(){}return e.fromUtf8=function(e){return btoa(e)},e.fromUtf16=function(n){return e.fromUtf8(y.fromUtf16(n))},e.fromBase64Url=function(e){return(e.length%4==2?e+"==":e.length%4==3?e+"=":e).replace(/-/g,"+").replace(/_/g,"/")},e.fromBytes=function(n){return e.fromUtf8(y.fromBytes(n))},e.fromJSON=function(n){return e.fromUtf16(JSON.stringify(n))},e}(),h=function(){function e(){}return e.fromBase64=function(e){return e.replace(/\=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.fromUtf8=function(n){return e.fromBase64(d.fromUtf8(n))},e.fromUtf16=function(n){return e.fromBase64(d.fromUtf16(n))},e.fromBytes=function(n){return e.fromUtf8(y.fromBytes(n))},e.fromJSON=function(n){return e.fromUtf16(JSON.stringify(n))},e}(),g=function(){function e(){}return e.fromBytes=function(e){for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",t=0,r=0,o=0,i=0,a=0,u="",f=e.length,s=0,c=5*Math.floor(f/5);s<c;)t=e[s++],r=e[s++],o=e[s++],i=e[s++],a=e[s++],u+=n[t>>>3]+n[31&(t<<2|r>>>6)]+n[r>>>1&31]+n[31&(r<<4|o>>>4)]+n[31&(o<<1|i>>>7)]+n[i>>>2&31]+n[31&(i<<3|a>>>5)]+n[31&a];var m=f-c;if(0===m)return u;switch(m){case 4:i=e[--f];case 3:o=e[--f];case 2:r=e[--f];case 1:t=e[--f]}switch(u+=n[t>>>3],m){case 1:return u+n[t<<2&31]+"======";case 2:return u+n[31&(t<<2|r>>>6)]+n[r>>>1&31]+n[r<<4&31]+"====";case 3:return u+n[31&(t<<2|r>>>6)]+n[r>>>1&31]+n[31&(r<<4|o>>>4)]+n[o<<1&31]+"===";case 4:return u+n[31&(t<<2|r>>>6)]+n[r>>>1&31]+n[31&(r<<4|o>>>4)]+n[31&(o<<1|i>>>7)]+n[i>>>2&31]+n[i<<3&31]+"="}return u},e}();(l=e.UserNameType||(e.UserNameType={}))[l.Unknown=0]="Unknown",l[l.NetBIOSDomain=1]="NetBIOSDomain",l[l.DNSDomain=2]="DNSDomain",l[l.SAM=3]="SAM",l[l.Simple=4]="Simple",l[l.UID=5]="UID",l[l.UPN=6]="UPN",l[l.Display=7]="Display",l[l.SID=8]="SID",l[l.DP=9]="DP";var B,F=function(){function n(n,t){this.name=n||"",this.type=t||(0===this.name.length?e.UserNameType.Unknown:"*"===this.name?e.UserNameType.Unknown:-1!==this.name.indexOf("@")?e.UserNameType.UPN:-1!==this.name.indexOf("\\")?e.UserNameType.SAM:/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(this.name)?e.UserNameType.UID:e.UserNameType.DP)}return n.prototype.isAnonymous=function(){return!this.name||0===this.name.length},n.prototype.isEveryone=function(){return"*"===this.name},n.Anonymous=function(){return new n("",e.UserNameType.Unknown)},n.Everyone=function(){return new n("*",e.UserNameType.Unknown)},n.fromJWT=function(t,r){var o=U.claims(t);return o.sub&&o.sub instanceof n?o.sub:o.wan?new n(o.wan,r):o.sub?new n(o.sub,r||e.UserNameType.DP):n.Anonymous()},n}(),A=function(){return function(e,n,t){this.typ=e,this.cty=t,this.alg=n}}(),U=function(){function e(){}return e.claims=function(e){var n=e.split("."),t=JSON.parse(p.fromBase64Url(n[0]));if("JWT"===t.cty)return c(c({},t),new A);var r=JSON.parse(p.fromBase64Url(n[1]));if("object"==typeof r.sub){var o=r.sub,i=o.name,a=o.type;r.sub=new F(i,a)}return r},e.errors=function(n){var t=[],r=e.claims(n),o=(new Date).getTime()/1e3;return r.iat&&r.nbf&&r.iat>r.nbf&&t.push(new Error("JWT.Error.IssueTimeLaterThanNotBefore")),r.nbf&&r.nbf>o&&t.push(new Error("JWT.Error.NotEffectiveYet")),r.exp&&r.exp<=o&&t.push(new Error("JWT.Error.Expired")),t.length>0?t:null},e}();(B=e.ClaimName||(e.ClaimName={})).TokensId="jti",B.IssuerName="iss",B.IssuedAt="iat",B.Audience="aud",B.NotBefore="nbf",B.ExpiresAfter="exp",B.SubjectName="sub",B.IssuerDomain="dom",B.SubjectUid="uid",B.ADGuid="ad_guid",B.CredentialsUsed="crd",B.Group="group",B.Role="role",B.WindowsAccountName="wan",B.T24Principal="t24";var C,E=function(){function e(e){this.jwt=e}return e.None=function(){return new e("")},e}(),D=function(){function e(e,n,t){void 0===t&&(t=!0),this.id=e,this.data=n?t?h.fromUtf16("string"!=typeof n?JSON.stringify(n):n):JSON.stringify(n):null}return e.None=function(){return new e("")},e.Any=function(){return new e("*")},e.Password="D1A1F561-E14A-4699-9138-2EB523E132CC",e.Fingerprints="AC184A13-60AB-40E5-A514-E10F777EC2F9",e.Face="85AEAA44-413B-4DC1-AF09-ADE15892730A",e.SmartCard="D66CC98D-4153-4987-8EBE-FB46E848EA98",e.ContactlessCard="F674862D-AC70-48CA-B73E-64A22F3BAC44",e.ProximityCard="1F31360C-81C0-4EE0-9ACD-5A4400F66CC2",e.PIN="8A6FCEC3-3C8A-40C2-8AC0-A039EC01BA05",e.SecurityQuestions="B49E99C6-6C94-42DE-ACD7-FD6B415DF503",e.Bluetooth="E750A180-577B-47F7-ACD9-F89A7E27FA49",e.OneTimePassword="324C38BD-0B51-4E4D-BD75-200DA0C8177F",e.U2F="5D5F73AF-BCE5-4161-9584-42A61AED0E48",e.IWA="AE922666-9667-49BC-97DA-1EB0E1EF73D2",e.Email="7845D71D-AB67-4EA7-913C-F81E75C3A087",e.Behavior="193C41F6-5CF6-4525-84CC-223603DAC9AB",e.Cards="FCFA704C-144B-42DB-8DF3-13F5CD20C525",e}();(C=e.FingerPosition||(e.FingerPosition={}))[C.Unknown=0]="Unknown",C[C.RightThumb=1]="RightThumb",C[C.RightIndex=2]="RightIndex",C[C.RightMiddle=3]="RightMiddle",C[C.RightRing=4]="RightRing",C[C.RightLittle=5]="RightLittle",C[C.LeftThumb=6]="LeftThumb",C[C.LeftIndex=7]="LeftIndex",C[C.LeftMiddle=8]="LeftMiddle",C[C.LeftRing=9]="LeftRing",C[C.LeftLittle=10]="LeftLittle";var S,w=function(){function e(e){this.position=e}return e.fromJson=function(n){return new e(n.position)},e}();(S=e.FaceImageType||(e.FaceImageType={}))[S.Jpeg=1]="Jpeg";var T,N=function(){function n(n,t){void 0===t&&(t=e.FaceImageType.Jpeg),this.ImageData=n,this.ImageType=t,this.Version=1}return n.fromDataURL=function(e){return new n(e.replace("data:image/jpeg;base64,",""))},n.fromCanvas=function(e,t){return void 0===t&&(t=1),n.fromDataURL(e.toDataURL("image/jpeg",t))},n.prototype.toBioSample=function(n,t,r){return void 0===n&&(n=new u(e.BioSampleFormatOwner.None,0)),void 0===t&&(t=e.BioSamplePurpose.Any),new s(new f(e.BioFactor.FacialFeatures,n,e.BioSampleType.Raw,t,-1,e.BioSampleEncryption.None),h.fromJSON(this))},n}();(T=e.QuestionType||(e.QuestionType={}))[T.Regular=0]="Regular",T[T.Custom=1]="Custom";var I=function(){function n(n,t,r,o,i){if(this.number=n,this.lang_id=t,this.sublang_id=r,this.keyboard_layout=o,this.text=i,this.version=1,this.type=n<=100?e.QuestionType.Regular:e.QuestionType.Custom,this.type===e.QuestionType.Custom&&!i)throw new Error("Question text is required for custom questions")}return n.fromJson=function(e){var t=e;return new n(t.number,t.lang_id,t.sublang_id,t.keyboard_layout,t.text)},n}(),v=function(){return function(e,n){this.text=n,this.number=e instanceof I?e.number:e}}();e.Answer=v,e.Base32=g,e.Base64=d,e.Base64Url=h,e.BioSample=s,e.BioSampleFormat=u,e.BioSampleHeader=f,e.Credential=D,e.FaceImage=N,e.Finger=w,e.JWT=U,e.Question=I,e.Ticket=E,e.Url=r,e.User=F,e.Utf16=p,e.Utf8=y,Object.defineProperty(e,"__esModule",{value:!0})}); //# sourceMappingURL=index.umd.min.js.map