@a-drowned-fish/om-utils 1.0.25 → 1.0.26
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/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,n,r,i,o,s,a,c,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,n,r,i,o,s,a,c,f=require("@fingerprintjs/fingerprintjs"),u=require("sm-crypto"),h=require("node-forge");function d(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})}function p(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function l(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n}function w(){const t=["getRandomValues","undefined","map","-----BEGIN PUBLIC KEY-----\n","slice","sha1","publicKeyFromPem","37624AsFzQq","util","6QcqZzI","floor","construct","69982aqIOuu","\n-----END PUBLIC KEY-----","msCrypto","369OyrUJw","1508003EFkVXY","from","random","Invalid public key: ","base64","SHA-256","create","toString","hex","2224105BTqEzV","12RhUPPt","84047oxkQjp","sha256","join","6dFGYWt","bytesToHex","pki","isInteger","padStart","encrypt","340kfKDPs","RSA-OAEP","ceil","constructor","RSA encryption failed: ","replace","toUpperCase","25kbzCaC","172182sDvUrb","126432emexGW","message"];return(w=function(){return t})()}function y(t,e){t-=374;return w()[t]}"function"==typeof SuppressedError&&SuppressedError,function(){const t=y,e=w();for(;;)try{if(118612===parseInt(t(389))/1+-parseInt(t(392))/2*(parseInt(t(406))/3)+-parseInt(t(407))/4*(parseInt(t(405))/5)+-parseInt(t(418))/6*(parseInt(t(378))/7)+-parseInt(t(416))/8*(-parseInt(t(377))/9)+-parseInt(t(398))/10*(-parseInt(t(374))/11)+-parseInt(t(388))/12*(-parseInt(t(387))/13))break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),function(){const t=E,e=P();for(;;)try{if(924199===-parseInt(t(250))/1+parseInt(t(223))/2*(-parseInt(t(234))/3)+-parseInt(t(233))/4+-parseInt(t(245))/5+-parseInt(t(235))/6+parseInt(t(239))/7*(-parseInt(t(222))/8)+parseInt(t(248))/9)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const{sm2:m,sm4:v}=u;function I(t){return d(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function E(t,e){t-=215;return P()[t]}function g(t,e={}){const n=E,{allowLeadingZero:r=!1,type:i=n(225)}=e;if(!Number[n(218)](t))throw new Error(n(226));const o={number:n(230),alphanumeric:n(215)},s=o[i]||o.number;let a="";r||i!==n(225)?a+=s[Math.floor(Math[n(241)]()*s[n(228)])]:a+=s[Math[n(219)](9*Math[n(241)]()+1)];for(let e=1;e<t;e++)a+=s[Math.floor(Math[n(241)]()*s[n(228)])];return a}class b{constructor(u,h={}){const w=E;t[w(253)](this,""),e.set(this,""),n[w(253)](this,""),r[w(253)](this,""),i[w(253)](this,!1),o.set(this,""),s.set(this,()=>function(t,e=!1){const n=y;if(!Number[n(395)](t))throw new Error("长度必须是整数");const r="undefined"!=typeof window?window.crypto||window[n(376)]:null;let i="";if(r&&r[n(409)]){const e=Math[n(400)](t/2),o=r[n(409)](new Uint8Array(e));i=Array[n(379)](o)[n(411)](t=>t.toString(16).padStart(2,"0"))[n(391)]("")}else{const e="0123456789abcdef";for(let r=0;r<t;r++)i+=e[Math[n(419)](16*Math[n(380)]())]}return i=i[n(413)](0,t),e?i[n(404)]():i}(16)),a[w(253)](this,t=>{const n=w;var r,i,o,a,c;if(!t)return"";let f=null===(i=null===(r=v.decrypt(t,p(this,e,"f"),{mode:n(231),iv:p(this,s,"f").call(this)}))||void 0===r?void 0:r[n(243)])||void 0===i?void 0:i[n(249)](r);if(/^[0-9A-Fa-f]{64}$/[n(242)](f))f=f[n(232)]();else{const t=null===(o=null==f?void 0:f[n(224)])||void 0===o?void 0:o[n(249)](f,/0201010420([0-9A-Fa-f]{64})/i);if(t&&(null==t?void 0:t[1]))f=null===(c=null===(a=t[1])||void 0===a?void 0:a[n(232)])||void 0===c?void 0:c[n(249)](a);else{const t=f[n(224)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(f=t[1].toUpperCase())}}return f}),c[w(253)](this,()=>d(this,void 0,void 0,function*(){const t=w;return p(this,n,"f")?p(this,n,"f"):p(this,i,"f")?(yield I(100),yield p(this,c,"f")[t(249)](this)):(l(this,i,!0,"f"),f[t(244)]()[t(238)](t=>t.get()).then(e=>{const o=t;return l(this,i,!1,"f"),l(this,n,p(this,r,"f")+e[o(221)],"f"),p(this,n,"f")}))})),this[w(220)]=t=>{const e=w;t&&l(this,o,p(this,a,"f")[e(249)](this,t),"f")},this[w(236)]=()=>d(this,void 0,void 0,function*(){const t=w;p(this,n,"f")||(yield p(this,c,"f")[t(249)](this));const r={d:p(this,n,"f"),n:g(32,{type:t(254)}),t:Date[t(237)]()[t(227)](),s:""},i=r.d+r.t+r.n;return r.s=v[t(229)](i,p(this,e,"f"),{mode:"cbc",iv:p(this,s,"f")[t(249)](this)}),r}),this[w(246)]=()=>d(this,void 0,void 0,function*(){const r=w;var i,s;if(p(this,n,"f")||(yield p(this,c,"f")[r(249)](this)),!p(this,o,"f"))return yield I(100),yield this[r(246)]();const a={"X-T":Date[r(237)]().toString(),"X-N":g(32,{type:r(254)}),"X-DI":p(this,n,"f"),"X-S":""},f=p(this,e,"f")+p(this,n,"f")+a[r(217)]+a[r(251)];return a[r(247)]=null===(s=null===(i=m[r(240)](f,p(this,o,"f"),{hash:!0,der:!1,mode:0,userId:p(this,t,"f")}))||void 0===i?void 0:i[r(232)])||void 0===s?void 0:s.call(i),a});const{uId:b=w(216),deviceId:M,deviceIdPrefix:P=""}=h;l(this,e,u,"f"),l(this,t,b,"f"),l(this,r,P,"f"),M?l(this,n,M,"f"):typeof window!==w(252)&&typeof document!==w(252)&&p(this,c,"f").call(this)}}t=new WeakMap,e=new WeakMap,n=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,s=new WeakMap,a=new WeakMap,c=new WeakMap;const M=function(t){const e=y;let n=null;const r=new Proxy(t,{construct(t,e){const r=y;return n||(n=typeof Reflect!==r(410)&&Reflect[r(420)]?Reflect.construct(t,e):new t(...e),n)}});return r.prototype[e(401)]=r,r}(b);function P(){const t=["encrypt","0123456789","cbc","toUpperCase","8188YaCnrS","2983923RWDNZx","10051278GiPFAX","getRegisterBody","now","then","70vfoWud","doSignature","random","test","trim","load","2790715pYEaME","getPublicHeaders","X-S","54324126ZqDsXR","call","1452751lYjlER","X-T","undefined","set","alphanumeric","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789","1234567812345678","X-N","isInteger","floor","setAccessToken","visitorId","343216nPbFSc","2sGJwNC","match","number","长度必须是整数","toString","length"];return(P=function(){return t})()}exports.BaseOmUtils=b,exports.OmUtils=M,exports.default=M,exports.rsaOaepEncrypt=function(t,e,n={}){const r=y,{outputEncoding:i=r(386),oaepHash:o=r(383),mgf1Hash:s=o}=n,a=function(t){const e=y;return t[e(403)](/-----BEGIN PUBLIC KEY-----/,"")[e(403)](/-----END PUBLIC KEY-----/,"")[e(403)](/\s/g,"")}(e);let c;try{c=h[r(394)][r(415)](a)}catch(t){try{const t=r(412)+a+r(375);c=h[r(394)][r(415)](t)}catch(t){throw new Error(r(381)+(t instanceof Error?t[r(408)]:String(t)))}}const f=o===r(383)?h.md[r(390)][r(384)]():h.md[r(414)][r(384)](),u=s===r(383)?h.md[r(390)][r(384)]():h.md.sha1[r(384)]();let d;try{d=c[r(397)](t,r(399),{md:f,mgf1Md:u})}catch(t){throw new Error(r(402)+(t instanceof Error?t[r(408)]:String(t)))}if(i===r(386))return h[r(417)][r(393)](d);if(i===r(382))return h.util.encode64(d);throw new Error("Unsupported output encoding: "+i)};
|
package/dist/index.es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"@fingerprintjs/fingerprintjs";import e from"sm-crypto";import n from"node-forge";function r(t,e,n,r){return new(n||(n=Promise))(function(i
|
|
1
|
+
import t from"@fingerprintjs/fingerprintjs";import e from"sm-crypto";import n from"node-forge";function r(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})}function o(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function i(t,e,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(t,n):o?o.value=n:e.set(t,n),n}function s(){const t=["getRandomValues","undefined","map","-----BEGIN PUBLIC KEY-----\n","slice","sha1","publicKeyFromPem","37624AsFzQq","util","6QcqZzI","floor","construct","69982aqIOuu","\n-----END PUBLIC KEY-----","msCrypto","369OyrUJw","1508003EFkVXY","from","random","Invalid public key: ","base64","SHA-256","create","toString","hex","2224105BTqEzV","12RhUPPt","84047oxkQjp","sha256","join","6dFGYWt","bytesToHex","pki","isInteger","padStart","encrypt","340kfKDPs","RSA-OAEP","ceil","constructor","RSA encryption failed: ","replace","toUpperCase","25kbzCaC","172182sDvUrb","126432emexGW","message"];return(s=function(){return t})()}function a(t,e){t-=374;return s()[t]}function c(t,e,r={}){const o=a,{outputEncoding:i=o(386),oaepHash:s=o(383),mgf1Hash:c=s}=r,f=function(t){const e=a;return t[e(403)](/-----BEGIN PUBLIC KEY-----/,"")[e(403)](/-----END PUBLIC KEY-----/,"")[e(403)](/\s/g,"")}(e);let h;try{h=n[o(394)][o(415)](f)}catch(t){try{const t=o(412)+f+o(375);h=n[o(394)][o(415)](t)}catch(t){throw new Error(o(381)+(t instanceof Error?t[o(408)]:String(t)))}}const u=s===o(383)?n.md[o(390)][o(384)]():n.md[o(414)][o(384)](),d=c===o(383)?n.md[o(390)][o(384)]():n.md.sha1[o(384)]();let p;try{p=h[o(397)](t,o(399),{md:u,mgf1Md:d})}catch(t){throw new Error(o(402)+(t instanceof Error?t[o(408)]:String(t)))}if(i===o(386))return n[o(417)][o(393)](p);if(i===o(382))return n.util.encode64(p);throw new Error("Unsupported output encoding: "+i)}var f,h,u,d,p,l,w,m,v;"function"==typeof SuppressedError&&SuppressedError,function(){const t=a,e=s();for(;;)try{if(118612===parseInt(t(389))/1+-parseInt(t(392))/2*(parseInt(t(406))/3)+-parseInt(t(407))/4*(parseInt(t(405))/5)+-parseInt(t(418))/6*(parseInt(t(378))/7)+-parseInt(t(416))/8*(-parseInt(t(377))/9)+-parseInt(t(398))/10*(-parseInt(t(374))/11)+-parseInt(t(388))/12*(-parseInt(t(387))/13))break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),function(){const t=g,e=k();for(;;)try{if(924199===-parseInt(t(250))/1+parseInt(t(223))/2*(-parseInt(t(234))/3)+-parseInt(t(233))/4+-parseInt(t(245))/5+-parseInt(t(235))/6+parseInt(t(239))/7*(-parseInt(t(222))/8)+parseInt(t(248))/9)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const{sm2:y,sm4:I}=e;function E(t){return r(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function g(t,e){t-=215;return k()[t]}function b(t,e={}){const n=g,{allowLeadingZero:r=!1,type:o=n(225)}=e;if(!Number[n(218)](t))throw new Error(n(226));const i={number:n(230),alphanumeric:n(215)},s=i[o]||i.number;let a="";r||o!==n(225)?a+=s[Math.floor(Math[n(241)]()*s[n(228)])]:a+=s[Math[n(219)](9*Math[n(241)]()+1)];for(let e=1;e<t;e++)a+=s[Math.floor(Math[n(241)]()*s[n(228)])];return a}class M{constructor(e,n={}){const s=g;f[s(253)](this,""),h.set(this,""),u[s(253)](this,""),d[s(253)](this,""),p[s(253)](this,!1),l.set(this,""),w.set(this,()=>function(t,e=!1){const n=a;if(!Number[n(395)](t))throw new Error("长度必须是整数");const r="undefined"!=typeof window?window.crypto||window[n(376)]:null;let o="";if(r&&r[n(409)]){const e=Math[n(400)](t/2),i=r[n(409)](new Uint8Array(e));o=Array[n(379)](i)[n(411)](t=>t.toString(16).padStart(2,"0"))[n(391)]("")}else{const e="0123456789abcdef";for(let r=0;r<t;r++)o+=e[Math[n(419)](16*Math[n(380)]())]}return o=o[n(413)](0,t),e?o[n(404)]():o}(16)),m[s(253)](this,t=>{const e=s;var n,r,i,a,c;if(!t)return"";let f=null===(r=null===(n=I.decrypt(t,o(this,h,"f"),{mode:e(231),iv:o(this,w,"f").call(this)}))||void 0===n?void 0:n[e(243)])||void 0===r?void 0:r[e(249)](n);if(/^[0-9A-Fa-f]{64}$/[e(242)](f))f=f[e(232)]();else{const t=null===(i=null==f?void 0:f[e(224)])||void 0===i?void 0:i[e(249)](f,/0201010420([0-9A-Fa-f]{64})/i);if(t&&(null==t?void 0:t[1]))f=null===(c=null===(a=t[1])||void 0===a?void 0:a[e(232)])||void 0===c?void 0:c[e(249)](a);else{const t=f[e(224)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(f=t[1].toUpperCase())}}return f}),v[s(253)](this,()=>r(this,void 0,void 0,function*(){const e=s;return o(this,u,"f")?o(this,u,"f"):o(this,p,"f")?(yield E(100),yield o(this,v,"f")[e(249)](this)):(i(this,p,!0,"f"),t[e(244)]()[e(238)](t=>t.get()).then(t=>{const n=e;return i(this,p,!1,"f"),i(this,u,o(this,d,"f")+t[n(221)],"f"),o(this,u,"f")}))})),this[s(220)]=t=>{const e=s;t&&i(this,l,o(this,m,"f")[e(249)](this,t),"f")},this[s(236)]=()=>r(this,void 0,void 0,function*(){const t=s;o(this,u,"f")||(yield o(this,v,"f")[t(249)](this));const e={d:o(this,u,"f"),n:b(32,{type:t(254)}),t:Date[t(237)]()[t(227)](),s:""},n=e.d+e.t+e.n;return e.s=I[t(229)](n,o(this,h,"f"),{mode:"cbc",iv:o(this,w,"f")[t(249)](this)}),e}),this[s(246)]=()=>r(this,void 0,void 0,function*(){const t=s;var e,n;if(o(this,u,"f")||(yield o(this,v,"f")[t(249)](this)),!o(this,l,"f"))return yield E(100),yield this[t(246)]();const r={"X-T":Date[t(237)]().toString(),"X-N":b(32,{type:t(254)}),"X-DI":o(this,u,"f"),"X-S":""},i=o(this,h,"f")+o(this,u,"f")+r[t(217)]+r[t(251)];return r[t(247)]=null===(n=null===(e=y[t(240)](i,o(this,l,"f"),{hash:!0,der:!1,mode:0,userId:o(this,f,"f")}))||void 0===e?void 0:e[t(232)])||void 0===n?void 0:n.call(e),r});const{uId:c=s(216),deviceId:M,deviceIdPrefix:P=""}=n;i(this,h,e,"f"),i(this,f,c,"f"),i(this,d,P,"f"),M?i(this,u,M,"f"):typeof window!==s(252)&&typeof document!==s(252)&&o(this,v,"f").call(this)}}f=new WeakMap,h=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakMap,l=new WeakMap,w=new WeakMap,m=new WeakMap,v=new WeakMap;const P=function(t){const e=a;let n=null;const r=new Proxy(t,{construct(t,e){const r=a;return n||(n=typeof Reflect!==r(410)&&Reflect[r(420)]?Reflect.construct(t,e):new t(...e),n)}});return r.prototype[e(401)]=r,r}(M);function k(){const t=["encrypt","0123456789","cbc","toUpperCase","8188YaCnrS","2983923RWDNZx","10051278GiPFAX","getRegisterBody","now","then","70vfoWud","doSignature","random","test","trim","load","2790715pYEaME","getPublicHeaders","X-S","54324126ZqDsXR","call","1452751lYjlER","X-T","undefined","set","alphanumeric","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789","1234567812345678","X-N","isInteger","floor","setAccessToken","visitorId","343216nPbFSc","2sGJwNC","match","number","长度必须是整数","toString","length"];return(k=function(){return t})()}export{M as BaseOmUtils,P as OmUtils,P as default,c as rsaOaepEncrypt};
|
package/dist/index.iife.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var omUtils=function(t,e,n,r){"use strict";function i(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})}function o(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function s(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n}function a(){const t=["
|
|
1
|
+
var omUtils=function(t,e,n,r){"use strict";function i(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})}function o(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function s(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n}function a(){const t=["getRandomValues","undefined","map","-----BEGIN PUBLIC KEY-----\n","slice","sha1","publicKeyFromPem","37624AsFzQq","util","6QcqZzI","floor","construct","69982aqIOuu","\n-----END PUBLIC KEY-----","msCrypto","369OyrUJw","1508003EFkVXY","from","random","Invalid public key: ","base64","SHA-256","create","toString","hex","2224105BTqEzV","12RhUPPt","84047oxkQjp","sha256","join","6dFGYWt","bytesToHex","pki","isInteger","padStart","encrypt","340kfKDPs","RSA-OAEP","ceil","constructor","RSA encryption failed: ","replace","toUpperCase","25kbzCaC","172182sDvUrb","126432emexGW","message"];return(a=function(){return t})()}function c(t,e){t-=374;return a()[t]}var f,u,h,d,l,p,w,v,y;"function"==typeof SuppressedError&&SuppressedError,function(t){const e=c,n=t();for(;;)try{if(118612===parseInt(e(389))/1+-parseInt(e(392))/2*(parseInt(e(406))/3)+-parseInt(e(407))/4*(parseInt(e(405))/5)+-parseInt(e(418))/6*(parseInt(e(378))/7)+-parseInt(e(416))/8*(-parseInt(e(377))/9)+-parseInt(e(398))/10*(-parseInt(e(374))/11)+-parseInt(e(388))/12*(-parseInt(e(387))/13))break;n.push(n.shift())}catch(t){n.push(n.shift())}}(a),function(t){const e=g,n=t();for(;;)try{if(924199===-parseInt(e(250))/1+parseInt(e(223))/2*(-parseInt(e(234))/3)+-parseInt(e(233))/4+-parseInt(e(245))/5+-parseInt(e(235))/6+parseInt(e(239))/7*(-parseInt(e(222))/8)+parseInt(e(248))/9)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(S);const{sm2:m,sm4:I}=n;function E(t){return i(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function g(t,e){t-=215;return S()[t]}function b(t,e={}){const n=g,{allowLeadingZero:r=!1,type:i=n(225)}=e;if(!Number[n(218)](t))throw new Error(n(226));const o={number:n(230),alphanumeric:n(215)},s=o[i]||o.number;let a="";r||i!==n(225)?a+=s[Math.floor(Math[n(241)]()*s[n(228)])]:a+=s[Math[n(219)](9*Math[n(241)]()+1)];for(let e=1;e<t;e++)a+=s[Math.floor(Math[n(241)]()*s[n(228)])];return a}class M{constructor(t,n={}){const r=g;f[r(253)](this,""),u.set(this,""),h[r(253)](this,""),d[r(253)](this,""),l[r(253)](this,!1),p.set(this,""),w.set(this,()=>function(t,e=!1){const n=c;if(!Number[n(395)](t))throw new Error("长度必须是整数");const r="undefined"!=typeof window?window.crypto||window[n(376)]:null;let i="";if(r&&r[n(409)]){const e=Math[n(400)](t/2),o=r[n(409)](new Uint8Array(e));i=Array[n(379)](o)[n(411)](t=>t.toString(16).padStart(2,"0"))[n(391)]("")}else{const e="0123456789abcdef";for(let r=0;r<t;r++)i+=e[Math[n(419)](16*Math[n(380)]())]}return i=i[n(413)](0,t),e?i[n(404)]():i}(16)),v[r(253)](this,t=>{const e=r;var n,i,s,a,c;if(!t)return"";let f=null===(i=null===(n=I.decrypt(t,o(this,u,"f"),{mode:e(231),iv:o(this,w,"f").call(this)}))||void 0===n?void 0:n[e(243)])||void 0===i?void 0:i[e(249)](n);if(/^[0-9A-Fa-f]{64}$/[e(242)](f))f=f[e(232)]();else{const t=null===(s=null==f?void 0:f[e(224)])||void 0===s?void 0:s[e(249)](f,/0201010420([0-9A-Fa-f]{64})/i);if(t&&(null==t?void 0:t[1]))f=null===(c=null===(a=t[1])||void 0===a?void 0:a[e(232)])||void 0===c?void 0:c[e(249)](a);else{const t=f[e(224)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(f=t[1].toUpperCase())}}return f}),y[r(253)](this,()=>i(this,void 0,void 0,function*(){const t=r;return o(this,h,"f")?o(this,h,"f"):o(this,l,"f")?(yield E(100),yield o(this,y,"f")[t(249)](this)):(s(this,l,!0,"f"),e[t(244)]()[t(238)](t=>t.get()).then(e=>{const n=t;return s(this,l,!1,"f"),s(this,h,o(this,d,"f")+e[n(221)],"f"),o(this,h,"f")}))})),this[r(220)]=t=>{const e=r;t&&s(this,p,o(this,v,"f")[e(249)](this,t),"f")},this[r(236)]=()=>i(this,void 0,void 0,function*(){const t=r;o(this,h,"f")||(yield o(this,y,"f")[t(249)](this));const e={d:o(this,h,"f"),n:b(32,{type:t(254)}),t:Date[t(237)]()[t(227)](),s:""},n=e.d+e.t+e.n;return e.s=I[t(229)](n,o(this,u,"f"),{mode:"cbc",iv:o(this,w,"f")[t(249)](this)}),e}),this[r(246)]=()=>i(this,void 0,void 0,function*(){const t=r;var e,n;if(o(this,h,"f")||(yield o(this,y,"f")[t(249)](this)),!o(this,p,"f"))return yield E(100),yield this[t(246)]();const i={"X-T":Date[t(237)]().toString(),"X-N":b(32,{type:t(254)}),"X-DI":o(this,h,"f"),"X-S":""},s=o(this,u,"f")+o(this,h,"f")+i[t(217)]+i[t(251)];return i[t(247)]=null===(n=null===(e=m[t(240)](s,o(this,p,"f"),{hash:!0,der:!1,mode:0,userId:o(this,f,"f")}))||void 0===e?void 0:e[t(232)])||void 0===n?void 0:n.call(e),i});const{uId:a=r(216),deviceId:M,deviceIdPrefix:P=""}=n;s(this,u,t,"f"),s(this,f,a,"f"),s(this,d,P,"f"),M?s(this,h,M,"f"):typeof window!==r(252)&&typeof document!==r(252)&&o(this,y,"f").call(this)}}f=new WeakMap,u=new WeakMap,h=new WeakMap,d=new WeakMap,l=new WeakMap,p=new WeakMap,w=new WeakMap,v=new WeakMap,y=new WeakMap;const P=function(t){const e=c;let n=null;const r=new Proxy(t,{construct(t,e){const r=c;return n||(n=typeof Reflect!==r(410)&&Reflect[r(420)]?Reflect.construct(t,e):new t(...e),n)}});return r.prototype[e(401)]=r,r}(M);function S(){const t=["encrypt","0123456789","cbc","toUpperCase","8188YaCnrS","2983923RWDNZx","10051278GiPFAX","getRegisterBody","now","then","70vfoWud","doSignature","random","test","trim","load","2790715pYEaME","getPublicHeaders","X-S","54324126ZqDsXR","call","1452751lYjlER","X-T","undefined","set","alphanumeric","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789","1234567812345678","X-N","isInteger","floor","setAccessToken","visitorId","343216nPbFSc","2sGJwNC","match","number","长度必须是整数","toString","length"];return(S=function(){return t})()}return t.BaseOmUtils=M,t.OmUtils=P,t.default=P,t.rsaOaepEncrypt=function(t,e,n={}){const i=c,{outputEncoding:o=i(386),oaepHash:s=i(383),mgf1Hash:a=s}=n,f=function(t){const e=c;return t[e(403)](/-----BEGIN PUBLIC KEY-----/,"")[e(403)](/-----END PUBLIC KEY-----/,"")[e(403)](/\s/g,"")}(e);let u;try{u=r[i(394)][i(415)](f)}catch(t){try{const t=i(412)+f+i(375);u=r[i(394)][i(415)](t)}catch(t){throw new Error(i(381)+(t instanceof Error?t[i(408)]:String(t)))}}const h=s===i(383)?r.md[i(390)][i(384)]():r.md[i(414)][i(384)](),d=a===i(383)?r.md[i(390)][i(384)]():r.md.sha1[i(384)]();let l;try{l=u[i(397)](t,i(399),{md:h,mgf1Md:d})}catch(t){throw new Error(i(402)+(t instanceof Error?t[i(408)]:String(t)))}if(o===i(386))return r[i(417)][i(393)](l);if(o===i(382))return r.util.encode64(l);throw new Error("Unsupported output encoding: "+o)},Object.defineProperty(t,"__esModule",{value:!0}),t}({},FingerprintJS,SMCrypto,forge);
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@fingerprintjs/fingerprintjs"),require("sm-crypto"),require("node-forge")):"function"==typeof define&&define.amd?define(["exports","@fingerprintjs/fingerprintjs","sm-crypto","node-forge"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).omUtils={},t.FingerprintJS,t.SMCrypto,t.forge)}(this,function(t,e,n,r){"use strict";function i(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})}function o(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function s(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n}function a(){const t=["
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@fingerprintjs/fingerprintjs"),require("sm-crypto"),require("node-forge")):"function"==typeof define&&define.amd?define(["exports","@fingerprintjs/fingerprintjs","sm-crypto","node-forge"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).omUtils={},t.FingerprintJS,t.SMCrypto,t.forge)}(this,function(t,e,n,r){"use strict";function i(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})}function o(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function s(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n}function a(){const t=["getRandomValues","undefined","map","-----BEGIN PUBLIC KEY-----\n","slice","sha1","publicKeyFromPem","37624AsFzQq","util","6QcqZzI","floor","construct","69982aqIOuu","\n-----END PUBLIC KEY-----","msCrypto","369OyrUJw","1508003EFkVXY","from","random","Invalid public key: ","base64","SHA-256","create","toString","hex","2224105BTqEzV","12RhUPPt","84047oxkQjp","sha256","join","6dFGYWt","bytesToHex","pki","isInteger","padStart","encrypt","340kfKDPs","RSA-OAEP","ceil","constructor","RSA encryption failed: ","replace","toUpperCase","25kbzCaC","172182sDvUrb","126432emexGW","message"];return(a=function(){return t})()}function c(t,e){t-=374;return a()[t]}var f,u,h,d,p,l,w,y,m;"function"==typeof SuppressedError&&SuppressedError,function(t){const e=c,n=t();for(;;)try{if(118612===parseInt(e(389))/1+-parseInt(e(392))/2*(parseInt(e(406))/3)+-parseInt(e(407))/4*(parseInt(e(405))/5)+-parseInt(e(418))/6*(parseInt(e(378))/7)+-parseInt(e(416))/8*(-parseInt(e(377))/9)+-parseInt(e(398))/10*(-parseInt(e(374))/11)+-parseInt(e(388))/12*(-parseInt(e(387))/13))break;n.push(n.shift())}catch(t){n.push(n.shift())}}(a),function(t){const e=E,n=t();for(;;)try{if(924199===-parseInt(e(250))/1+parseInt(e(223))/2*(-parseInt(e(234))/3)+-parseInt(e(233))/4+-parseInt(e(245))/5+-parseInt(e(235))/6+parseInt(e(239))/7*(-parseInt(e(222))/8)+parseInt(e(248))/9)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(S);const{sm2:v,sm4:I}=n;function g(t){return i(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function E(t,e){t-=215;return S()[t]}function b(t,e={}){const n=E,{allowLeadingZero:r=!1,type:i=n(225)}=e;if(!Number[n(218)](t))throw new Error(n(226));const o={number:n(230),alphanumeric:n(215)},s=o[i]||o.number;let a="";r||i!==n(225)?a+=s[Math.floor(Math[n(241)]()*s[n(228)])]:a+=s[Math[n(219)](9*Math[n(241)]()+1)];for(let e=1;e<t;e++)a+=s[Math.floor(Math[n(241)]()*s[n(228)])];return a}class M{constructor(t,n={}){const r=E;f[r(253)](this,""),u.set(this,""),h[r(253)](this,""),d[r(253)](this,""),p[r(253)](this,!1),l.set(this,""),w.set(this,()=>function(t,e=!1){const n=c;if(!Number[n(395)](t))throw new Error("长度必须是整数");const r="undefined"!=typeof window?window.crypto||window[n(376)]:null;let i="";if(r&&r[n(409)]){const e=Math[n(400)](t/2),o=r[n(409)](new Uint8Array(e));i=Array[n(379)](o)[n(411)](t=>t.toString(16).padStart(2,"0"))[n(391)]("")}else{const e="0123456789abcdef";for(let r=0;r<t;r++)i+=e[Math[n(419)](16*Math[n(380)]())]}return i=i[n(413)](0,t),e?i[n(404)]():i}(16)),y[r(253)](this,t=>{const e=r;var n,i,s,a,c;if(!t)return"";let f=null===(i=null===(n=I.decrypt(t,o(this,u,"f"),{mode:e(231),iv:o(this,w,"f").call(this)}))||void 0===n?void 0:n[e(243)])||void 0===i?void 0:i[e(249)](n);if(/^[0-9A-Fa-f]{64}$/[e(242)](f))f=f[e(232)]();else{const t=null===(s=null==f?void 0:f[e(224)])||void 0===s?void 0:s[e(249)](f,/0201010420([0-9A-Fa-f]{64})/i);if(t&&(null==t?void 0:t[1]))f=null===(c=null===(a=t[1])||void 0===a?void 0:a[e(232)])||void 0===c?void 0:c[e(249)](a);else{const t=f[e(224)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(f=t[1].toUpperCase())}}return f}),m[r(253)](this,()=>i(this,void 0,void 0,function*(){const t=r;return o(this,h,"f")?o(this,h,"f"):o(this,p,"f")?(yield g(100),yield o(this,m,"f")[t(249)](this)):(s(this,p,!0,"f"),e[t(244)]()[t(238)](t=>t.get()).then(e=>{const n=t;return s(this,p,!1,"f"),s(this,h,o(this,d,"f")+e[n(221)],"f"),o(this,h,"f")}))})),this[r(220)]=t=>{const e=r;t&&s(this,l,o(this,y,"f")[e(249)](this,t),"f")},this[r(236)]=()=>i(this,void 0,void 0,function*(){const t=r;o(this,h,"f")||(yield o(this,m,"f")[t(249)](this));const e={d:o(this,h,"f"),n:b(32,{type:t(254)}),t:Date[t(237)]()[t(227)](),s:""},n=e.d+e.t+e.n;return e.s=I[t(229)](n,o(this,u,"f"),{mode:"cbc",iv:o(this,w,"f")[t(249)](this)}),e}),this[r(246)]=()=>i(this,void 0,void 0,function*(){const t=r;var e,n;if(o(this,h,"f")||(yield o(this,m,"f")[t(249)](this)),!o(this,l,"f"))return yield g(100),yield this[t(246)]();const i={"X-T":Date[t(237)]().toString(),"X-N":b(32,{type:t(254)}),"X-DI":o(this,h,"f"),"X-S":""},s=o(this,u,"f")+o(this,h,"f")+i[t(217)]+i[t(251)];return i[t(247)]=null===(n=null===(e=v[t(240)](s,o(this,l,"f"),{hash:!0,der:!1,mode:0,userId:o(this,f,"f")}))||void 0===e?void 0:e[t(232)])||void 0===n?void 0:n.call(e),i});const{uId:a=r(216),deviceId:M,deviceIdPrefix:P=""}=n;s(this,u,t,"f"),s(this,f,a,"f"),s(this,d,P,"f"),M?s(this,h,M,"f"):typeof window!==r(252)&&typeof document!==r(252)&&o(this,m,"f").call(this)}}f=new WeakMap,u=new WeakMap,h=new WeakMap,d=new WeakMap,p=new WeakMap,l=new WeakMap,w=new WeakMap,y=new WeakMap,m=new WeakMap;const P=function(t){const e=c;let n=null;const r=new Proxy(t,{construct(t,e){const r=c;return n||(n=typeof Reflect!==r(410)&&Reflect[r(420)]?Reflect.construct(t,e):new t(...e),n)}});return r.prototype[e(401)]=r,r}(M);function S(){const t=["encrypt","0123456789","cbc","toUpperCase","8188YaCnrS","2983923RWDNZx","10051278GiPFAX","getRegisterBody","now","then","70vfoWud","doSignature","random","test","trim","load","2790715pYEaME","getPublicHeaders","X-S","54324126ZqDsXR","call","1452751lYjlER","X-T","undefined","set","alphanumeric","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789","1234567812345678","X-N","isInteger","floor","setAccessToken","visitorId","343216nPbFSc","2sGJwNC","match","number","长度必须是整数","toString","length"];return(S=function(){return t})()}t.BaseOmUtils=M,t.OmUtils=P,t.default=P,t.rsaOaepEncrypt=function(t,e,n={}){const i=c,{outputEncoding:o=i(386),oaepHash:s=i(383),mgf1Hash:a=s}=n,f=function(t){const e=c;return t[e(403)](/-----BEGIN PUBLIC KEY-----/,"")[e(403)](/-----END PUBLIC KEY-----/,"")[e(403)](/\s/g,"")}(e);let u;try{u=r[i(394)][i(415)](f)}catch(t){try{const t=i(412)+f+i(375);u=r[i(394)][i(415)](t)}catch(t){throw new Error(i(381)+(t instanceof Error?t[i(408)]:String(t)))}}const h=s===i(383)?r.md[i(390)][i(384)]():r.md[i(414)][i(384)](),d=a===i(383)?r.md[i(390)][i(384)]():r.md.sha1[i(384)]();let p;try{p=u[i(397)](t,i(399),{md:h,mgf1Md:d})}catch(t){throw new Error(i(402)+(t instanceof Error?t[i(408)]:String(t)))}if(o===i(386))return r[i(417)][i(393)](p);if(o===i(382))return r.util.encode64(p);throw new Error("Unsupported output encoding: "+o)},Object.defineProperty(t,"__esModule",{value:!0})});
|