Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cybersource/flex-sdk-web

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cybersource/flex-sdk-web - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

4

dist/flex-sdk-web.js

@@ -1,2 +0,2 @@

/*! flex-sdk-web v0.1.2 | (c) CyberSource 2017 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.FLEX=t()}(this,function(){"use strict";function e(){return"undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}function t(){return"undefined"!=typeof XDomainRequest}function r(){return S(e())||t()}function n(e){return null!=e&&"object"===(void 0===e?"undefined":S(e))}function o(e){var t=void 0===e?"undefined":S(e);return null!=e&&("object"===t||"function"===t)}function i(e){var t=o(e)?Object.prototype.toString.call(e):"";return"[object Function]"===t||"[object GeneratorFunction]"===t}function u(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function a(e){return"string"==typeof e||!u(e)&&n(e)&&"[object String]"===Object.prototype.toString.call(e)}function s(e){return JSON.parse(JSON.stringify(e))}function c(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0,o=e.length;n<o;n+=1)r[n]=e.charCodeAt(n);return t}function f(){return window.crypto&&window.crypto.subtle&&"function"==typeof window.crypto.subtle.importKey&&"function"==typeof window.crypto.subtle.encrypt}function l(e){return null!=e&&("object"===(void 0===e?"undefined":S(e))&&(null!=e.kid&&"RSA"===e.kty&&null!=e.n&&null!=e.e))}function p(e){var t=s(e);return/Edge/.test(window.navigator.userAgent)&&delete t.use,window.crypto.subtle.importKey("jwk",t,{name:"RSA-OAEP",hash:{name:"SHA-256"}},!0,["encrypt"])}function y(e,t){return window.crypto.subtle.encrypt({name:"RSA-OAEP",hash:{name:"SHA-256"}},e,c(t))}function h(e,t){return p(e).then(function(e){return y(e,t)}).then(function(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e)))}).catch(function(e){throw e})}function d(e,t){if(!l(e))throw new Error("Invalid jwk");return f()?h(e,t):Promise.resolve(E(e,t))}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,r=void 0;try{r=JSON.parse(e)}catch(t){r=e}return t>=200&&t<400&&null!=r.token?r:{error:r}}function g(e,t){var r={keyId:e,cardInfo:{cardNumber:t.cardNumber,cardType:t.cardType}};return t.cardExpirationMonth&&(r.cardInfo.cardExpirationMonth=t.cardExpirationMonth),t.cardExpirationYear&&(r.cardInfo.cardExpirationYear=t.cardExpirationYear),r}function w(e,t,r){var n=new XMLHttpRequest;n.open("POST",e,!0),n.setRequestHeader("Content-Type","application/json; charset=utf-8"),n.timeout=x,n.ontimeout=function(){return r(v("Request has timed out"))},n.onerror=function(){return r(v(n.responseText,n.status))},n.onload=function(){return r(v(n.responseText,n.status))},n.send(JSON.stringify(t))}function b(e,t,r){var n=new XDomainRequest;n.timeout=x,n.onprogress=function(){},n.ontimeout=function(){r(v("Request has timed out"))},n.onerror=function(){r(v("Detailed error response unavailable in this browser"))},n.onload=function(){var e=void 0;try{e=JSON.parse(n.responseText)}catch(t){e={error:n.responseText}}r(v(e))},n.open("POST",e),n.send(JSON.stringify(t))}function m(r,n,o,i){var u=g(n,o);if(e())w(r,u,i);else{if(!t())throw new Error("Browser does not support CORS requests.");b(r,u,i)}}function A(e,t){if(!i(t))throw new Error("responseHandler is not a function");var r=!0===e.production?R.prod:R.test,n=a(e.encryptionType)?e.encryptionType.toLowerCase():C,o=e.cardInfo;o.cardNumber=o.cardNumber.replace(/\D/g,""),n===K.RSA_OAEP_256?d(e.keystore,o.cardNumber).then(function(n){o.cardNumber=n,m(r,e.kid,o,t)}).catch(function(e){throw e}):m(r,e.kid,o,t)}var S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},k=function(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e,t){!function(t,r){e.exports=function(){function e(e){var t=void 0===e?"undefined":S(e);return null!==e&&("object"===t||"function"===t)}function t(e){return"function"==typeof e}function r(e){G=e}function n(e){W=e}function o(){return void 0!==J?function(){J(u)}:i()}function i(){var e=setTimeout;return function(){return e(u,1)}}function u(){for(var e=0;e<D;e+=2){(0,Z[e])(Z[e+1]),Z[e]=void 0,Z[e+1]=void 0}D=0}function a(e,t){var r=arguments,n=this,o=new this.constructor(c);void 0===o[z]&&j(o);var i=n._state;return i?function(){var e=r[i-1];W(function(){return C(i,o,e,n._result)})}():A(n,o,e,t),o}function s(e){var t=this;if(e&&"object"===(void 0===e?"undefined":S(e))&&e.constructor===t)return e;var r=new t(c);return g(r,e),r}function c(){}function f(){return new TypeError("You cannot resolve a promise with itself")}function l(){return new TypeError("A promises callback cannot return that same promise.")}function p(e){try{return e.then}catch(e){return ne.error=e,ne}}function y(e,t,r,n){try{e.call(t,r,n)}catch(e){return e}}function h(e,t,r){W(function(e){var n=!1,o=y(r,t,function(r){n||(n=!0,t!==r?g(e,r):b(e,r))},function(t){n||(n=!0,m(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&o&&(n=!0,m(e,o))},e)}function d(e,t){t._state===te?b(e,t._result):t._state===re?m(e,t._result):A(t,void 0,function(t){return g(e,t)},function(t){return m(e,t)})}function v(e,r,n){r.constructor===e.constructor&&n===a&&r.constructor.resolve===s?d(e,r):n===ne?(m(e,ne.error),ne.error=null):void 0===n?b(e,r):t(n)?h(e,r,n):b(e,r)}function g(t,r){t===r?m(t,f()):e(r)?v(t,r,p(r)):b(t,r)}function w(e){e._onerror&&e._onerror(e._result),k(e)}function b(e,t){e._state===ee&&(e._result=t,e._state=te,0!==e._subscribers.length&&W(k,e))}function m(e,t){e._state===ee&&(e._state=re,e._result=t,W(w,e))}function A(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+te]=r,o[i+re]=n,0===i&&e._state&&W(k,e)}function k(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n=void 0,o=void 0,i=e._result,u=0;u<t.length;u+=3)n=t[u],o=t[u+r],n?C(r,n,o,i):o(i);e._subscribers.length=0}}function E(){this.error=null}function K(e,t){try{return e(t)}catch(e){return oe.error=e,oe}}function C(e,r,n,o){var i=t(n),u=void 0,a=void 0,s=void 0,c=void 0;if(i){if(u=K(n,o),u===oe?(c=!0,a=u.error,u.error=null):s=!0,r===u)return void m(r,l())}else u=o,s=!0;r._state!==ee||(i&&s?g(r,u):c?m(r,a):e===te?b(r,u):e===re&&m(r,u))}function x(e,t){try{t(function(t){g(e,t)},function(t){m(e,t)})}catch(t){m(e,t)}}function R(){return ie++}function j(e){e[z]=ie++,e._state=void 0,e._result=void 0,e._subscribers=[]}function H(e,t){this._instanceConstructor=e,this.promise=new e(c),this.promise[z]||j(this.promise),I(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?b(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&b(this.promise,this._result))):m(this.promise,O())}function O(){return new Error("Array Methods must be provided an Array")}function P(e){return new H(this,e).promise}function U(e){var t=this;return new t(I(e)?function(r,n){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(r,n)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function M(e){var t=this,r=new t(c);return m(r,e),r}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function T(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function q(e){this[z]=R(),this._result=this._state=void 0,this._subscribers=[],c!==e&&("function"!=typeof e&&L(),this instanceof q?x(this,e):T())}function N(){var e=void 0;if(void 0!==_)e=_;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=q}var B=void 0;B=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var I=B,D=0,J=void 0,G=void 0,W=function(e,t){Z[D]=e,Z[D+1]=t,2===(D+=2)&&(G?G(u):$())},X="undefined"!=typeof window?window:void 0,Y=X||{},F=Y.MutationObserver||Y.WebKitMutationObserver,V="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Q="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Z=new Array(1e3),$=void 0;$=V?function(){return function(){return process.nextTick(u)}}():F?function(){var e=0,t=new F(u),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}():Q?function(){var e=new MessageChannel;return e.port1.onmessage=u,function(){return e.port2.postMessage(0)}}():void 0===X&&"function"==typeof require?function(){try{var e=require,t=e("vertx");return J=t.runOnLoop||t.runOnContext,o()}catch(e){return i()}}():i();var z=Math.random().toString(36).substring(16),ee=void 0,te=1,re=2,ne=new E,oe=new E,ie=0;return H.prototype._enumerate=function(e){for(var t=0;this._state===ee&&t<e.length;t++)this._eachEntry(e[t],t)},H.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===s){var o=p(e);if(o===a&&e._state!==ee)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===q){var i=new r(c);v(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},H.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===ee&&(this._remaining--,e===re?m(n,r):this._result[t]=r),0===this._remaining&&b(n,this._result)},H.prototype._willSettleAt=function(e,t){var r=this;A(e,void 0,function(e){return r._settledAt(te,t,e)},function(e){return r._settledAt(re,t,e)})},q.all=P,q.race=U,q.resolve=s,q.reject=M,q._setScheduler=r,q._setAsap=n,q._asap=W,q.prototype={constructor:q,then:a,catch:function(e){return this.then(null,e)}},q.polyfill=N,q.Promise=q,q}()}()});k.polyfill();!function(e){function t(e){return btoa(e).replace(/\=+$/,"").replace(/\+/g,"-").replace(/\//g,"_")}function r(e){return e+="===",e=e.slice(0,-e.length%4),atob(e.replace(/-/g,"+").replace(/_/g,"/"))}function n(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function o(e){return e instanceof ArrayBuffer&&(e=new Uint8Array(e)),String.fromCharCode.apply(String,e)}function i(e){var t={name:(e.name||e||"").toUpperCase().replace("V","v")};switch(t.name){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":break;case"AES-CBC":case"AES-GCM":case"AES-KW":e.length&&(t.length=e.length);break;case"HMAC":e.hash&&(t.hash=i(e.hash)),e.length&&(t.length=e.length);break;case"RSAES-PKCS1-v1_5":e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;case"RSASSA-PKCS1-v1_5":case"RSA-OAEP":e.hash&&(t.hash=i(e.hash)),e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;default:throw new SyntaxError("Bad algorithm name")}return t}function u(e){return{HMAC:{"SHA-1":"HS1","SHA-256":"HS256","SHA-384":"HS384","SHA-512":"HS512"},"RSASSA-PKCS1-v1_5":{"SHA-1":"RS1","SHA-256":"RS256","SHA-384":"RS384","SHA-512":"RS512"},"RSAES-PKCS1-v1_5":{"":"RSA1_5"},"RSA-OAEP":{"SHA-1":"RSA-OAEP","SHA-256":"RSA-OAEP-256"},"AES-KW":{128:"A128KW",192:"A192KW",256:"A256KW"},"AES-GCM":{128:"A128GCM",192:"A192GCM",256:"A256GCM"},"AES-CBC":{128:"A128CBC",192:"A192CBC",256:"A256CBC"}}[e.name][(e.hash||{}).name||e.length||""]}function a(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&(e=JSON.parse(decodeURIComponent(escape(o(e)))));var t={kty:e.kty,alg:e.alg,ext:e.ext||e.extractable};switch(t.kty){case"oct":t.k=e.k;case"RSA":["n","e","d","p","q","dp","dq","qi","oth"].forEach(function(r){r in e&&(t[r]=e[r])});break;default:throw new TypeError("Unsupported key type")}return t}function s(e){var t=a(e);return m&&(t.extractable=t.ext,delete t.ext),n(unescape(encodeURIComponent(JSON.stringify(t)))).buffer}function c(e){var r=l(e),n=!1;r.length>2&&(n=!0,r.shift());var i={ext:!0};switch(r[0][0]){case"1.2.840.113549.1.1.1":var u=["n","e","d","p","q","dp","dq","qi"],a=l(r[1]);n&&a.shift();for(var s=0;s<a.length;s++)a[s][0]||(a[s]=a[s].subarray(1)),i[u[s]]=t(o(a[s]));i.kty="RSA";break;default:throw new TypeError("Unsupported key type")}return i}function f(e){var t,o=[["",null]],i=!1;switch(e.kty){case"RSA":for(var u=["n","e","d","p","q","dp","dq","qi"],a=[],s=0;s<u.length&&u[s]in e;s++){var c=a[s]=n(r(e[u[s]]));128&c[0]&&(a[s]=new Uint8Array(c.length+1),a[s].set(c,1))}a.length>2&&(i=!0,a.unshift(new Uint8Array([0]))),o[0][0]="1.2.840.113549.1.1.1",t=a;break;default:throw new TypeError("Unsupported key type")}return o.push(new Uint8Array(p(t)).buffer),i?o.unshift(new Uint8Array([0])):o[1]={tag:3,value:o[1]},new Uint8Array(p(o)).buffer}function l(e,t){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t||(t={pos:0,end:e.length}),t.end-t.pos<2||t.end>e.length)throw new RangeError("Malformed DER");var r=e[t.pos++],n=e[t.pos++];if(n>=128){if(n&=127,t.end-t.pos<n)throw new RangeError("Malformed DER");for(var i=0;n--;)i<<=8,i|=e[t.pos++];n=i}if(t.end-t.pos<n)throw new RangeError("Malformed DER");var u;switch(r){case 2:u=e.subarray(t.pos,t.pos+=n);break;case 3:if(e[t.pos++])throw new Error("Unsupported bit string");n--;case 4:u=new Uint8Array(e.subarray(t.pos,t.pos+=n)).buffer;break;case 5:u=null;break;case 6:var a=btoa(o(e.subarray(t.pos,t.pos+=n)));if(!(a in _))throw new Error("Unsupported OBJECT ID "+a);u=_[a];break;case 48:u=[];for(var s=t.pos+n;t.pos<s;)u.push(l(e,t));break;default:throw new Error("Unsupported DER tag 0x"+r.toString(16))}return u}function p(e,t){t||(t=[]);var r=0,o=0,i=t.length+2;if(t.push(0,0),e instanceof Uint8Array){r=2,o=e.length;for(var u=0;u<o;u++)t.push(e[u])}else if(e instanceof ArrayBuffer){r=4,o=e.byteLength,e=new Uint8Array(e);for(var u=0;u<o;u++)t.push(e[u])}else if(null===e)r=5,o=0;else if("string"==typeof e&&e in k){var a=n(atob(k[e]));r=6,o=a.length;for(var u=0;u<o;u++)t.push(a[u])}else if(e instanceof Array){for(var u=0;u<e.length;u++)p(e[u],t);r=48,o=t.length-i}else{if(!("object"===(void 0===e?"undefined":S(e))&&3===e.tag&&e.value instanceof ArrayBuffer))throw new Error("Unsupported DER value "+e);e=new Uint8Array(e.value),r=3,o=e.byteLength,t.push(0);for(var u=0;u<o;u++)t.push(e[u]);o++}if(o>=128){var s=o,o=4;for(t.splice(i,0,s>>24&255,s>>16&255,s>>8&255,255&s);o>1&&!(s>>24);)s<<=8,o--;o<4&&t.splice(i,4-o),o|=128}return t.splice(i-2,2,r,o),t}function y(e,t,r,n){Object.defineProperties(this,{_key:{value:e},type:{value:e.type,enumerable:!0},extractable:{value:void 0===r?e.extractable:r,enumerable:!0},algorithm:{value:void 0===t?e.algorithm:t,enumerable:!0},usages:{value:void 0===n?e.usages:n,enumerable:!0}})}function h(e){return"verify"===e||"encrypt"===e||"wrapKey"===e}function d(e){return"sign"===e||"decrypt"===e||"unwrapKey"===e}if("function"!=typeof Promise)throw"Promise support required";var v=e.crypto||e.msCrypto;if(v){var g=v.subtle||v.webkitSubtle;if(g){var w=e.Crypto||v.constructor||Object,b=e.SubtleCrypto||g.constructor||Object,m=(e.CryptoKey||e.Key||Object,!!e.msCrypto),A=!!v.webkitSubtle;if(m||A){var _={KoZIhvcNAQEB:"1.2.840.113549.1.1.1"},k={"1.2.840.113549.1.1.1":"KoZIhvcNAQEB"};if(["generateKey","importKey","unwrapKey"].forEach(function(e){var t=g[e];g[e]=function(o,f,l){var p,w,b,S=[].slice.call(arguments);switch(e){case"generateKey":p=i(o),w=f,b=l;break;case"importKey":p=i(l),w=S[3],b=S[4],"jwk"===o&&(f=a(f),f.alg||(f.alg=u(p)),f.key_ops||(f.key_ops="oct"!==f.kty?"d"in f?b.filter(d):b.filter(h):b.slice()),S[1]=s(f));break;case"unwrapKey":p=S[4],w=S[5],b=S[6],S[2]=l._key}if("generateKey"===e&&"HMAC"===p.name&&p.hash)return p.length=p.length||{"SHA-1":512,"SHA-256":512,"SHA-384":1024,"SHA-512":1024}[p.hash.name],g.importKey("raw",v.getRandomValues(new Uint8Array(p.length+7>>3)),p,w,b);if(A&&"generateKey"===e&&"RSASSA-PKCS1-v1_5"===p.name&&(!p.modulusLength||p.modulusLength>=2048))return o=i(o),o.name="RSAES-PKCS1-v1_5",delete o.hash,g.generateKey(o,!0,["encrypt","decrypt"]).then(function(e){return Promise.all([g.exportKey("jwk",e.publicKey),g.exportKey("jwk",e.privateKey)])}).then(function(e){return e[0].alg=e[1].alg=u(p),e[0].key_ops=b.filter(h),e[1].key_ops=b.filter(d),Promise.all([g.importKey("jwk",e[0],p,w,e[0].key_ops),g.importKey("jwk",e[1],p,w,e[1].key_ops)])}).then(function(e){return{publicKey:e[0],privateKey:e[1]}});if((A||m&&"SHA-1"===(p.hash||{}).name)&&"importKey"===e&&"jwk"===o&&"HMAC"===p.name&&"oct"===f.kty)return g.importKey("raw",n(r(f.k)),l,S[3],S[4]);if(A&&"importKey"===e&&("spki"===o||"pkcs8"===o))return g.importKey("jwk",c(f),l,S[3],S[4]);if(m&&"unwrapKey"===e)return g.decrypt(S[3],l,f).then(function(e){return g.importKey(o,e,S[4],S[5],S[6])});var _;try{_=t.apply(g,S)}catch(e){return Promise.reject(e)}return m&&(_=new Promise(function(e,t){_.onabort=_.onerror=function(e){t(e)},_.oncomplete=function(t){e(t.target.result)}})),_=_.then(function(e){return"HMAC"===p.name&&(p.length||(p.length=8*e.algorithm.length)),0==p.name.search("RSA")&&(p.modulusLength||(p.modulusLength=(e.publicKey||e).algorithm.modulusLength),p.publicExponent||(p.publicExponent=(e.publicKey||e).algorithm.publicExponent)),e=e.publicKey&&e.privateKey?{publicKey:new y(e.publicKey,p,w,b.filter(h)),privateKey:new y(e.privateKey,p,w,b.filter(d))}:new y(e,p,w,b)})}}),["exportKey","wrapKey"].forEach(function(e){var r=g[e];g[e]=function(i,s,c){var l=[].slice.call(arguments);switch(e){case"exportKey":l[1]=s._key;break;case"wrapKey":l[1]=s._key,l[2]=c._key}if((A||m&&"SHA-1"===(s.algorithm.hash||{}).name)&&"exportKey"===e&&"jwk"===i&&"HMAC"===s.algorithm.name&&(l[0]="raw"),!A||"exportKey"!==e||"spki"!==i&&"pkcs8"!==i||(l[0]="jwk"),m&&"wrapKey"===e)return g.exportKey(i,s).then(function(e){return"jwk"===i&&(e=n(unescape(encodeURIComponent(JSON.stringify(a(e)))))),g.encrypt(l[3],c,e)});var p;try{p=r.apply(g,l)}catch(e){return Promise.reject(e)}return m&&(p=new Promise(function(e,t){p.onabort=p.onerror=function(e){t(e)},p.oncomplete=function(t){e(t.target.result)}})),"exportKey"===e&&"jwk"===i&&(p=p.then(function(e){return(A||m&&"SHA-1"===(s.algorithm.hash||{}).name)&&"HMAC"===s.algorithm.name?{kty:"oct",alg:u(s.algorithm),key_ops:s.usages.slice(),ext:!0,k:t(o(e))}:(e=a(e),e.alg||(e.alg=u(s.algorithm)),e.key_ops||(e.key_ops="public"===s.type?s.usages.filter(h):"private"===s.type?s.usages.filter(d):s.usages.slice()),e)})),!A||"exportKey"!==e||"spki"!==i&&"pkcs8"!==i||(p=p.then(function(e){return e=f(a(e))})),p}}),["encrypt","decrypt","sign","verify"].forEach(function(e){var t=g[e];g[e]=function(r,n,o,u){if(m&&(!o.byteLength||u&&!u.byteLength))throw new Error("Empy input is not allowed");var a=[].slice.call(arguments),s=i(r);if(m&&"decrypt"===e&&"AES-GCM"===s.name){var c=r.tagLength>>3;a[2]=(o.buffer||o).slice(0,o.byteLength-c),r.tag=(o.buffer||o).slice(o.byteLength-c)}a[1]=n._key;var f;try{f=t.apply(g,a)}catch(e){return Promise.reject(e)}return m&&(f=new Promise(function(t,r){f.onabort=f.onerror=function(e){r(e)},f.oncomplete=function(r){var r=r.target.result;if("encrypt"===e&&r instanceof AesGcmEncryptResult){var n=r.ciphertext,o=r.tag;r=new Uint8Array(n.byteLength+o.byteLength),r.set(new Uint8Array(n),0),r.set(new Uint8Array(o),n.byteLength),r=r.buffer}t(r)}})),f}}),m){var E=g.digest;g.digest=function(e,t){if(!t.byteLength)throw new Error("Empy input is not allowed");var r;try{r=E.call(g,e,t)}catch(e){return Promise.reject(e)}return r=new Promise(function(e,t){r.onabort=r.onerror=function(e){t(e)},r.oncomplete=function(t){e(t.target.result)}})},e.crypto=Object.create(v,{getRandomValues:{value:function(e){return v.getRandomValues(e)}},subtle:{value:g}}),e.CryptoKey=y}A&&(v.subtle=g,e.Crypto=w,e.SubtleCrypto=b,e.CryptoKey=y)}}}}(_);var E=function(){throw new Error("Unsupported browser")},K={NONE:"none",RSA_OAEP_256:"rsaoaep256"},C=K.RSA_OAEP_256,x=3e4,R={test:"https://testflex.cybersource.com/cybersource/flex/v1/tokens",prod:"https://flex.cybersource.com/cybersource/flex/v1/tokens"};return{version:"0.1.2",createToken:A,utils:{isBrowserSupported:r,nativeCryptoSupport:f}}});
/*! flex-sdk-web v0.1.3 | (c) CyberSource 2017 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.FLEX=t()}(this,function(){"use strict";function e(){return"undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}function t(){return"undefined"!=typeof XDomainRequest}function r(){return S(e())||t()}function n(e){return null!=e&&"object"===(void 0===e?"undefined":S(e))}function o(e){var t=void 0===e?"undefined":S(e);return null!=e&&("object"===t||"function"===t)}function i(e){var t=o(e)?Object.prototype.toString.call(e):"";return"[object Function]"===t||"[object GeneratorFunction]"===t}function u(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function a(e){return"string"==typeof e||!u(e)&&n(e)&&"[object String]"===Object.prototype.toString.call(e)}function s(e){return JSON.parse(JSON.stringify(e))}function c(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0,o=e.length;n<o;n+=1)r[n]=e.charCodeAt(n);return t}function f(){return window.crypto&&window.crypto.subtle&&"function"==typeof window.crypto.subtle.importKey&&"function"==typeof window.crypto.subtle.encrypt}function l(e){return null!=e&&("object"===(void 0===e?"undefined":S(e))&&(null!=e.kid&&"RSA"===e.kty&&null!=e.n&&null!=e.e))}function p(e){var t=s(e);return/Edge/.test(window.navigator.userAgent)&&delete t.use,window.crypto.subtle.importKey("jwk",t,{name:"RSA-OAEP",hash:{name:"SHA-256"}},!0,["encrypt"])}function y(e,t){return window.crypto.subtle.encrypt({name:"RSA-OAEP",hash:{name:"SHA-256"}},e,c(t))}function h(e,t){return p(e).then(function(e){return y(e,t)}).then(function(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e)))}).catch(function(e){throw e})}function d(e,t){if(!l(e))throw new Error("Invalid jwk");return f()?h(e,t):Promise.resolve(E(e,t))}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,r=void 0;try{r=JSON.parse(e)}catch(t){r=e}return t>=200&&t<400&&null!=r.token?r:{error:r}}function g(e,t){var r={keyId:e,cardInfo:{cardNumber:t.cardNumber,cardType:t.cardType}};return t.cardExpirationMonth&&(r.cardInfo.cardExpirationMonth=t.cardExpirationMonth),t.cardExpirationYear&&(r.cardInfo.cardExpirationYear=t.cardExpirationYear),r}function w(e,t,r){var n=new XMLHttpRequest;n.open("POST",e,!0),n.setRequestHeader("Content-Type","application/json; charset=utf-8"),n.timeout=x,n.ontimeout=function(){return r(v("Request has timed out"))},n.onerror=function(){return r(v(n.responseText,n.status))},n.onload=function(){return r(v(n.responseText,n.status))},n.send(JSON.stringify(t))}function b(e,t,r){var n=new XDomainRequest;n.timeout=x,n.onprogress=function(){},n.ontimeout=function(){r(v("Request has timed out"))},n.onerror=function(){r(v("Detailed error response unavailable in this browser"))},n.onload=function(){var e=void 0;try{e=JSON.parse(n.responseText)}catch(t){e={error:n.responseText}}r(v(e))},n.open("POST",e),n.send(JSON.stringify(t))}function m(r,n,o,i){var u=g(n,o);if(e())w(r,u,i);else{if(!t())throw new Error("Browser does not support CORS requests.");b(r,u,i)}}function A(e,t){if(!i(t))throw new Error("responseHandler is not a function");var r=!0===e.production?R.prod:R.test,n=a(e.encryptionType)?e.encryptionType.toLowerCase():C,o=e.cardInfo||{};o.cardNumber=o.cardNumber?o.cardNumber.replace(/\D/g,""):"",o.cardNumber.length<1&&delete o.cardNumber,new Promise(function(t){o.cardNumber?t(n===K.RSA_OAEP_256?d(e.keystore,o.cardNumber):o.cardNumber):t()}).then(function(n){o.cardNumber=n,m(r,e.kid,o,t)}).catch(function(e){throw e})}var S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},k=function(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e,t){!function(t,r){e.exports=function(){function e(e){var t=void 0===e?"undefined":S(e);return null!==e&&("object"===t||"function"===t)}function t(e){return"function"==typeof e}function r(e){G=e}function n(e){W=e}function o(){return void 0!==J?function(){J(u)}:i()}function i(){var e=setTimeout;return function(){return e(u,1)}}function u(){for(var e=0;e<D;e+=2){(0,Z[e])(Z[e+1]),Z[e]=void 0,Z[e+1]=void 0}D=0}function a(e,t){var r=arguments,n=this,o=new this.constructor(c);void 0===o[z]&&j(o);var i=n._state;return i?function(){var e=r[i-1];W(function(){return C(i,o,e,n._result)})}():A(n,o,e,t),o}function s(e){var t=this;if(e&&"object"===(void 0===e?"undefined":S(e))&&e.constructor===t)return e;var r=new t(c);return g(r,e),r}function c(){}function f(){return new TypeError("You cannot resolve a promise with itself")}function l(){return new TypeError("A promises callback cannot return that same promise.")}function p(e){try{return e.then}catch(e){return ne.error=e,ne}}function y(e,t,r,n){try{e.call(t,r,n)}catch(e){return e}}function h(e,t,r){W(function(e){var n=!1,o=y(r,t,function(r){n||(n=!0,t!==r?g(e,r):b(e,r))},function(t){n||(n=!0,m(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&o&&(n=!0,m(e,o))},e)}function d(e,t){t._state===te?b(e,t._result):t._state===re?m(e,t._result):A(t,void 0,function(t){return g(e,t)},function(t){return m(e,t)})}function v(e,r,n){r.constructor===e.constructor&&n===a&&r.constructor.resolve===s?d(e,r):n===ne?(m(e,ne.error),ne.error=null):void 0===n?b(e,r):t(n)?h(e,r,n):b(e,r)}function g(t,r){t===r?m(t,f()):e(r)?v(t,r,p(r)):b(t,r)}function w(e){e._onerror&&e._onerror(e._result),k(e)}function b(e,t){e._state===ee&&(e._result=t,e._state=te,0!==e._subscribers.length&&W(k,e))}function m(e,t){e._state===ee&&(e._state=re,e._result=t,W(w,e))}function A(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+te]=r,o[i+re]=n,0===i&&e._state&&W(k,e)}function k(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n=void 0,o=void 0,i=e._result,u=0;u<t.length;u+=3)n=t[u],o=t[u+r],n?C(r,n,o,i):o(i);e._subscribers.length=0}}function E(){this.error=null}function K(e,t){try{return e(t)}catch(e){return oe.error=e,oe}}function C(e,r,n,o){var i=t(n),u=void 0,a=void 0,s=void 0,c=void 0;if(i){if(u=K(n,o),u===oe?(c=!0,a=u.error,u.error=null):s=!0,r===u)return void m(r,l())}else u=o,s=!0;r._state!==ee||(i&&s?g(r,u):c?m(r,a):e===te?b(r,u):e===re&&m(r,u))}function x(e,t){try{t(function(t){g(e,t)},function(t){m(e,t)})}catch(t){m(e,t)}}function R(){return ie++}function j(e){e[z]=ie++,e._state=void 0,e._result=void 0,e._subscribers=[]}function H(e,t){this._instanceConstructor=e,this.promise=new e(c),this.promise[z]||j(this.promise),I(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?b(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&b(this.promise,this._result))):m(this.promise,O())}function O(){return new Error("Array Methods must be provided an Array")}function P(e){return new H(this,e).promise}function U(e){var t=this;return new t(I(e)?function(r,n){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(r,n)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function M(e){var t=this,r=new t(c);return m(r,e),r}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function T(e){this[z]=R(),this._result=this._state=void 0,this._subscribers=[],c!==e&&("function"!=typeof e&&L(),this instanceof T?x(this,e):N())}function q(){var e=void 0;if(void 0!==_)e=_;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=T}var B=void 0;B=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var I=B,D=0,J=void 0,G=void 0,W=function(e,t){Z[D]=e,Z[D+1]=t,2===(D+=2)&&(G?G(u):$())},X="undefined"!=typeof window?window:void 0,Y=X||{},F=Y.MutationObserver||Y.WebKitMutationObserver,V="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Q="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Z=new Array(1e3),$=void 0;$=V?function(){return function(){return process.nextTick(u)}}():F?function(){var e=0,t=new F(u),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}():Q?function(){var e=new MessageChannel;return e.port1.onmessage=u,function(){return e.port2.postMessage(0)}}():void 0===X&&"function"==typeof require?function(){try{var e=require,t=e("vertx");return J=t.runOnLoop||t.runOnContext,o()}catch(e){return i()}}():i();var z=Math.random().toString(36).substring(16),ee=void 0,te=1,re=2,ne=new E,oe=new E,ie=0;return H.prototype._enumerate=function(e){for(var t=0;this._state===ee&&t<e.length;t++)this._eachEntry(e[t],t)},H.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===s){var o=p(e);if(o===a&&e._state!==ee)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===T){var i=new r(c);v(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},H.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===ee&&(this._remaining--,e===re?m(n,r):this._result[t]=r),0===this._remaining&&b(n,this._result)},H.prototype._willSettleAt=function(e,t){var r=this;A(e,void 0,function(e){return r._settledAt(te,t,e)},function(e){return r._settledAt(re,t,e)})},T.all=P,T.race=U,T.resolve=s,T.reject=M,T._setScheduler=r,T._setAsap=n,T._asap=W,T.prototype={constructor:T,then:a,catch:function(e){return this.then(null,e)}},T.polyfill=q,T.Promise=T,T}()}()});k.polyfill();!function(e){function t(e){return btoa(e).replace(/\=+$/,"").replace(/\+/g,"-").replace(/\//g,"_")}function r(e){return e+="===",e=e.slice(0,-e.length%4),atob(e.replace(/-/g,"+").replace(/_/g,"/"))}function n(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function o(e){return e instanceof ArrayBuffer&&(e=new Uint8Array(e)),String.fromCharCode.apply(String,e)}function i(e){var t={name:(e.name||e||"").toUpperCase().replace("V","v")};switch(t.name){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":break;case"AES-CBC":case"AES-GCM":case"AES-KW":e.length&&(t.length=e.length);break;case"HMAC":e.hash&&(t.hash=i(e.hash)),e.length&&(t.length=e.length);break;case"RSAES-PKCS1-v1_5":e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;case"RSASSA-PKCS1-v1_5":case"RSA-OAEP":e.hash&&(t.hash=i(e.hash)),e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;default:throw new SyntaxError("Bad algorithm name")}return t}function u(e){return{HMAC:{"SHA-1":"HS1","SHA-256":"HS256","SHA-384":"HS384","SHA-512":"HS512"},"RSASSA-PKCS1-v1_5":{"SHA-1":"RS1","SHA-256":"RS256","SHA-384":"RS384","SHA-512":"RS512"},"RSAES-PKCS1-v1_5":{"":"RSA1_5"},"RSA-OAEP":{"SHA-1":"RSA-OAEP","SHA-256":"RSA-OAEP-256"},"AES-KW":{128:"A128KW",192:"A192KW",256:"A256KW"},"AES-GCM":{128:"A128GCM",192:"A192GCM",256:"A256GCM"},"AES-CBC":{128:"A128CBC",192:"A192CBC",256:"A256CBC"}}[e.name][(e.hash||{}).name||e.length||""]}function a(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&(e=JSON.parse(decodeURIComponent(escape(o(e)))));var t={kty:e.kty,alg:e.alg,ext:e.ext||e.extractable};switch(t.kty){case"oct":t.k=e.k;case"RSA":["n","e","d","p","q","dp","dq","qi","oth"].forEach(function(r){r in e&&(t[r]=e[r])});break;default:throw new TypeError("Unsupported key type")}return t}function s(e){var t=a(e);return A&&(t.extractable=t.ext,delete t.ext),n(unescape(encodeURIComponent(JSON.stringify(t)))).buffer}function c(e){var r=l(e),n=!1;r.length>2&&(n=!0,r.shift());var i={ext:!0};switch(r[0][0]){case"1.2.840.113549.1.1.1":var u=["n","e","d","p","q","dp","dq","qi"],a=l(r[1]);n&&a.shift();for(var s=0;s<a.length;s++)a[s][0]||(a[s]=a[s].subarray(1)),i[u[s]]=t(o(a[s]));i.kty="RSA";break;default:throw new TypeError("Unsupported key type")}return i}function f(e){var t,o=[["",null]],i=!1;switch(e.kty){case"RSA":for(var u=["n","e","d","p","q","dp","dq","qi"],a=[],s=0;s<u.length&&u[s]in e;s++){var c=a[s]=n(r(e[u[s]]));128&c[0]&&(a[s]=new Uint8Array(c.length+1),a[s].set(c,1))}a.length>2&&(i=!0,a.unshift(new Uint8Array([0]))),o[0][0]="1.2.840.113549.1.1.1",t=a;break;default:throw new TypeError("Unsupported key type")}return o.push(new Uint8Array(p(t)).buffer),i?o.unshift(new Uint8Array([0])):o[1]={tag:3,value:o[1]},new Uint8Array(p(o)).buffer}function l(e,t){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t||(t={pos:0,end:e.length}),t.end-t.pos<2||t.end>e.length)throw new RangeError("Malformed DER");var r=e[t.pos++],n=e[t.pos++];if(n>=128){if(n&=127,t.end-t.pos<n)throw new RangeError("Malformed DER");for(var i=0;n--;)i<<=8,i|=e[t.pos++];n=i}if(t.end-t.pos<n)throw new RangeError("Malformed DER");var u;switch(r){case 2:u=e.subarray(t.pos,t.pos+=n);break;case 3:if(e[t.pos++])throw new Error("Unsupported bit string");n--;case 4:u=new Uint8Array(e.subarray(t.pos,t.pos+=n)).buffer;break;case 5:u=null;break;case 6:var a=btoa(o(e.subarray(t.pos,t.pos+=n)));if(!(a in k))throw new Error("Unsupported OBJECT ID "+a);u=k[a];break;case 48:u=[];for(var s=t.pos+n;t.pos<s;)u.push(l(e,t));break;default:throw new Error("Unsupported DER tag 0x"+r.toString(16))}return u}function p(e,t){t||(t=[]);var r=0,o=0,i=t.length+2;if(t.push(0,0),e instanceof Uint8Array){r=2,o=e.length;for(var u=0;u<o;u++)t.push(e[u])}else if(e instanceof ArrayBuffer){r=4,o=e.byteLength,e=new Uint8Array(e);for(var u=0;u<o;u++)t.push(e[u])}else if(null===e)r=5,o=0;else if("string"==typeof e&&e in E){var a=n(atob(E[e]));r=6,o=a.length;for(var u=0;u<o;u++)t.push(a[u])}else if(e instanceof Array){for(var u=0;u<e.length;u++)p(e[u],t);r=48,o=t.length-i}else{if(!("object"===(void 0===e?"undefined":S(e))&&3===e.tag&&e.value instanceof ArrayBuffer))throw new Error("Unsupported DER value "+e);e=new Uint8Array(e.value),r=3,o=e.byteLength,t.push(0);for(var u=0;u<o;u++)t.push(e[u]);o++}if(o>=128){var s=o,o=4;for(t.splice(i,0,s>>24&255,s>>16&255,s>>8&255,255&s);o>1&&!(s>>24);)s<<=8,o--;o<4&&t.splice(i,4-o),o|=128}return t.splice(i-2,2,r,o),t}function y(e,t,r,n){Object.defineProperties(this,{_key:{value:e},type:{value:e.type,enumerable:!0},extractable:{value:void 0===r?e.extractable:r,enumerable:!0},algorithm:{value:void 0===t?e.algorithm:t,enumerable:!0},usages:{value:void 0===n?e.usages:n,enumerable:!0}})}function h(e){return"verify"===e||"encrypt"===e||"wrapKey"===e}function d(e){return"sign"===e||"decrypt"===e||"unwrapKey"===e}if("function"!=typeof Promise)throw"Promise support required";var v=e.crypto||e.msCrypto;if(v){var g=v.subtle||v.webkitSubtle;if(g){var w=e.Crypto||v.constructor||Object,b=e.SubtleCrypto||g.constructor||Object,m=(e.CryptoKey||e.Key||Object,e.navigator.userAgent.indexOf("Edge/")>-1),A=!!e.msCrypto&&!m,_=!v.subtle&&!!v.webkitSubtle;if(A||_){var k={KoZIhvcNAQEB:"1.2.840.113549.1.1.1"},E={"1.2.840.113549.1.1.1":"KoZIhvcNAQEB"};if(["generateKey","importKey","unwrapKey"].forEach(function(e){var t=g[e];g[e]=function(o,f,l){var p,w,b,m=[].slice.call(arguments);switch(e){case"generateKey":p=i(o),w=f,b=l;break;case"importKey":p=i(l),w=m[3],b=m[4],"jwk"===o&&(f=a(f),f.alg||(f.alg=u(p)),f.key_ops||(f.key_ops="oct"!==f.kty?"d"in f?b.filter(d):b.filter(h):b.slice()),m[1]=s(f));break;case"unwrapKey":p=m[4],w=m[5],b=m[6],m[2]=l._key}if("generateKey"===e&&"HMAC"===p.name&&p.hash)return p.length=p.length||{"SHA-1":512,"SHA-256":512,"SHA-384":1024,"SHA-512":1024}[p.hash.name],g.importKey("raw",v.getRandomValues(new Uint8Array(p.length+7>>3)),p,w,b);if(_&&"generateKey"===e&&"RSASSA-PKCS1-v1_5"===p.name&&(!p.modulusLength||p.modulusLength>=2048))return o=i(o),o.name="RSAES-PKCS1-v1_5",delete o.hash,g.generateKey(o,!0,["encrypt","decrypt"]).then(function(e){return Promise.all([g.exportKey("jwk",e.publicKey),g.exportKey("jwk",e.privateKey)])}).then(function(e){return e[0].alg=e[1].alg=u(p),e[0].key_ops=b.filter(h),e[1].key_ops=b.filter(d),Promise.all([g.importKey("jwk",e[0],p,!0,e[0].key_ops),g.importKey("jwk",e[1],p,w,e[1].key_ops)])}).then(function(e){return{publicKey:e[0],privateKey:e[1]}});if((_||A&&"SHA-1"===(p.hash||{}).name)&&"importKey"===e&&"jwk"===o&&"HMAC"===p.name&&"oct"===f.kty)return g.importKey("raw",n(r(f.k)),l,m[3],m[4]);if(_&&"importKey"===e&&("spki"===o||"pkcs8"===o))return g.importKey("jwk",c(f),l,m[3],m[4]);if(A&&"unwrapKey"===e)return g.decrypt(m[3],l,f).then(function(e){return g.importKey(o,e,m[4],m[5],m[6])});var S;try{S=t.apply(g,m)}catch(e){return Promise.reject(e)}return A&&(S=new Promise(function(e,t){S.onabort=S.onerror=function(e){t(e)},S.oncomplete=function(t){e(t.target.result)}})),S=S.then(function(e){return"HMAC"===p.name&&(p.length||(p.length=8*e.algorithm.length)),0==p.name.search("RSA")&&(p.modulusLength||(p.modulusLength=(e.publicKey||e).algorithm.modulusLength),p.publicExponent||(p.publicExponent=(e.publicKey||e).algorithm.publicExponent)),e=e.publicKey&&e.privateKey?{publicKey:new y(e.publicKey,p,w,b.filter(h)),privateKey:new y(e.privateKey,p,w,b.filter(d))}:new y(e,p,w,b)})}}),["exportKey","wrapKey"].forEach(function(e){var r=g[e];g[e]=function(i,s,c){var l=[].slice.call(arguments);switch(e){case"exportKey":l[1]=s._key;break;case"wrapKey":l[1]=s._key,l[2]=c._key}if((_||A&&"SHA-1"===(s.algorithm.hash||{}).name)&&"exportKey"===e&&"jwk"===i&&"HMAC"===s.algorithm.name&&(l[0]="raw"),!_||"exportKey"!==e||"spki"!==i&&"pkcs8"!==i||(l[0]="jwk"),A&&"wrapKey"===e)return g.exportKey(i,s).then(function(e){return"jwk"===i&&(e=n(unescape(encodeURIComponent(JSON.stringify(a(e)))))),g.encrypt(l[3],c,e)});var p;try{p=r.apply(g,l)}catch(e){return Promise.reject(e)}return A&&(p=new Promise(function(e,t){p.onabort=p.onerror=function(e){t(e)},p.oncomplete=function(t){e(t.target.result)}})),"exportKey"===e&&"jwk"===i&&(p=p.then(function(e){return(_||A&&"SHA-1"===(s.algorithm.hash||{}).name)&&"HMAC"===s.algorithm.name?{kty:"oct",alg:u(s.algorithm),key_ops:s.usages.slice(),ext:!0,k:t(o(e))}:(e=a(e),e.alg||(e.alg=u(s.algorithm)),e.key_ops||(e.key_ops="public"===s.type?s.usages.filter(h):"private"===s.type?s.usages.filter(d):s.usages.slice()),e)})),!_||"exportKey"!==e||"spki"!==i&&"pkcs8"!==i||(p=p.then(function(e){return e=f(a(e))})),p}}),["encrypt","decrypt","sign","verify"].forEach(function(e){var t=g[e];g[e]=function(r,n,o,u){if(A&&(!o.byteLength||u&&!u.byteLength))throw new Error("Empy input is not allowed");var a=[].slice.call(arguments),s=i(r);if(A&&"decrypt"===e&&"AES-GCM"===s.name){var c=r.tagLength>>3;a[2]=(o.buffer||o).slice(0,o.byteLength-c),r.tag=(o.buffer||o).slice(o.byteLength-c)}a[1]=n._key;var f;try{f=t.apply(g,a)}catch(e){return Promise.reject(e)}return A&&(f=new Promise(function(t,r){f.onabort=f.onerror=function(e){r(e)},f.oncomplete=function(r){var r=r.target.result;if("encrypt"===e&&r instanceof AesGcmEncryptResult){var n=r.ciphertext,o=r.tag;r=new Uint8Array(n.byteLength+o.byteLength),r.set(new Uint8Array(n),0),r.set(new Uint8Array(o),n.byteLength),r=r.buffer}t(r)}})),f}}),A){var K=g.digest;g.digest=function(e,t){if(!t.byteLength)throw new Error("Empy input is not allowed");var r;try{r=K.call(g,e,t)}catch(e){return Promise.reject(e)}return r=new Promise(function(e,t){r.onabort=r.onerror=function(e){t(e)},r.oncomplete=function(t){e(t.target.result)}})},e.crypto=Object.create(v,{getRandomValues:{value:function(e){return v.getRandomValues(e)}},subtle:{value:g}}),e.CryptoKey=y}_&&(v.subtle=g,e.Crypto=w,e.SubtleCrypto=b,e.CryptoKey=y)}}}}("undefined"==typeof window?"undefined"==typeof self?_:self:window);var E=function(){throw new Error("Unsupported browser")},K={NONE:"none",RSA_OAEP_256:"rsaoaep256"},C=K.RSA_OAEP_256,x=3e4,R={test:"https://testflex.cybersource.com/cybersource/flex/v1/tokens",prod:"https://flex.cybersource.com/cybersource/flex/v1/tokens"};return{version:"0.1.3",createToken:A,utils:{isBrowserSupported:r,nativeCryptoSupport:f}}});
{
"name": "@cybersource/flex-sdk-web",
"version": "0.1.2",
"version": "0.1.3",
"author": "CyberSource",

@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.md",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc