@a-drowned-fish/om-utils 1.0.22 → 1.0.24
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,s,o,a,c=require("@fingerprintjs/fingerprintjs"),f=require("sm-crypto"),u=require("node-forge");function h(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(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(o,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 d(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 l(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,n,r,i,s,o,a,c=require("@fingerprintjs/fingerprintjs"),f=require("sm-crypto"),u=require("node-forge");function h(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(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(o,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 d(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 l(){const t=["encode64","sha1","sha256","438yHvJgY","util","31766THzbsy","SHA-256","215257yHyBCv","1566976ObCnzp","pki","3VJUGVp","bytesToHex","RSA-OAEP","join","hex","2691PMzXya","construct","padStart","9032ptkNVO","Invalid public key: ","RSA encryption failed: ","98175DtpnRM","Unsupported output encoding: ","publicKeyFromPem","620108RoDJwN","\n-----END PUBLIC KEY-----","base64","2778760deKeeI","message","create","-----BEGIN PUBLIC KEY-----\n","replace","from"];return(l=function(){return t})()}function y(t,e){t-=220;return l()[t]}function v(){const t=["now","2TqlFWC","0123456789","doSignature","491169ZLrUuu","test","5576580eVLLoZ","getRegisterBody","68612IJpVIW","then","undefined","2214140uDbhiW","get","match","length","55flQJsk","getPublicHeaders","alphanumeric","9zuQGtl","toString","decrypt","7852856ZyOGSX","X-N","call","toUpperCase","set","6CcqLst","trim","63iatbnl","355891BeRGvV","random","1234567812345678","cbc","floor","number","load","长度必须是整数","isInteger","encrypt","setAccessToken","3089095pbpiYj"];return(v=function(){return t})()}function w(t,e){t-=116;return v()[t]}"function"==typeof SuppressedError&&SuppressedError,function(){const t=y,e=l();for(;;)try{if(222003===-parseInt(t(245))/1+parseInt(t(229))/2*(parseInt(t(248))/3)+parseInt(t(246))/4+parseInt(t(226))/5+parseInt(t(241))/6*(parseInt(t(243))/7)+-parseInt(t(223))/8*(parseInt(t(220))/9)+-parseInt(t(232))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),function(){const t=w,e=v();for(;;)try{if(562060===-parseInt(t(149))/1*(parseInt(t(121))/2)+-parseInt(t(148))/3*(parseInt(t(128))/4)+parseInt(t(119))/5+parseInt(t(146))/6*(parseInt(t(124))/7)+-parseInt(t(141))/8*(parseInt(t(138))/9)+parseInt(t(131))/10*(parseInt(t(135))/11)+parseInt(t(126))/12)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const{sm2:m,sm4:I}=f;function g(t){return h(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function E(t,e={}){const n=w,{allowLeadingZero:r=!1,type:i=n(154)}=e;if(t<=0)return"";if(!Number[n(116)](t))throw new Error(n(156));const s={number:n(122),alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},o=s[i]||s[n(154)];let a="";r||i!==n(154)?a+=o[Math[n(153)](Math[n(150)]()*o[n(134)])]:a+=o[Math[n(153)](9*Math[n(150)]()+1)];for(let e=1;e<t;e++)a+=o[Math[n(153)](Math[n(150)]()*o.length)];return a}class b{constructor(f,u={}){const l=w;t[l(145)](this,""),e[l(145)](this,""),n.set(this,""),r[l(145)](this,""),i[l(145)](this,!1),s[l(145)](this,""),o[l(145)](this,t=>{const n=l;var r,i,s,o,a;if(!t)return"";let c=null===(i=null===(r=I[n(140)](t,p(this,e,"f"),{mode:n(152),iv:E(16,{type:n(137)})}))||void 0===r?void 0:r[n(147)])||void 0===i?void 0:i[n(143)](r);if(/^[0-9A-Fa-f]{64}$/[n(125)](c))c=c[n(144)]();else{const t=null===(s=null==c?void 0:c[n(133)])||void 0===s?void 0:s[n(143)](c,/0201010420([0-9A-Fa-f]{64})/i);if(t&&(null==t?void 0:t[1]))c=null===(a=null===(o=t[1])||void 0===o?void 0:o[n(144)])||void 0===a?void 0:a[n(143)](o);else{const t=c.match(/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(c=t[1][n(144)]())}}return c}),a.set(this,()=>h(this,void 0,void 0,function*(){const t=l;return p(this,n,"f")?p(this,n,"f"):p(this,i,"f")?(yield g(100),yield p(this,a,"f")[t(143)](this)):(d(this,i,!0,"f"),c[t(155)]()[t(129)](e=>e[t(132)]()).then(t=>(d(this,i,!1,"f"),d(this,n,p(this,r,"f")+t.visitorId,"f"),p(this,n,"f"))))})),this[l(118)]=t=>{t&&d(this,s,p(this,o,"f").call(this,t),"f")},this[l(127)]=()=>h(this,void 0,void 0,function*(){const t=l;p(this,n,"f")||(yield p(this,a,"f").call(this));const r={d:p(this,n,"f"),n:E(32,{type:t(137)}),t:Date[t(120)]().toString(),s:""},i=r.d+r.t+r.n;return r.s=I[t(117)](i,p(this,e,"f"),{mode:t(152),iv:E(16,{type:"alphanumeric"})}),r}),this[l(136)]=()=>h(this,void 0,void 0,function*(){const r=l;var i,o;if(p(this,n,"f")||(yield p(this,a,"f")[r(143)](this)),!p(this,s,"f"))return yield g(100),yield this[r(136)]();const c={"X-T":Date[r(120)]()[r(139)](),"X-N":E(32,{type:r(137)}),"X-DI":p(this,n,"f"),"X-S":""},f=p(this,e,"f")+p(this,n,"f")+c[r(142)]+c["X-T"];return c["X-S"]=null===(o=null===(i=m[r(123)](f,p(this,s,"f"),{hash:!0,der:!1,mode:0,userId:p(this,t,"f")}))||void 0===i?void 0:i.toUpperCase)||void 0===o?void 0:o[r(143)](i),c});const{uId:y=l(151),deviceId:v,deviceIdPrefix:b=""}=u;d(this,e,f,"f"),d(this,t,y,"f"),d(this,r,b,"f"),v?d(this,n,v,"f"):typeof window!==l(130)&&"undefined"!=typeof document&&p(this,a,"f")[l(143)](this)}}t=new WeakMap,e=new WeakMap,n=new WeakMap,r=new WeakMap,i=new WeakMap,s=new WeakMap,o=new WeakMap,a=new WeakMap;const M=function(t){let e=null;const n=new Proxy(t,{construct(t,n){const r=y;return e||(e="undefined"!=typeof Reflect&&Reflect[r(221)]?Reflect[r(221)](t,n):new t(...n),e)}});return n.prototype.constructor=n,n}(b);exports.BaseOmUtils=b,exports.OmUtils=M,exports.default=M,exports.rsaOaepEncrypt=function(t,e,n={}){const r=y,{outputEncoding:i=r(252),oaepHash:s=r(244),mgf1Hash:o=s}=n,a=function(t){const e=y;return t.replace(/-----BEGIN PUBLIC KEY-----/,"")[e(236)](/-----END PUBLIC KEY-----/,"")[e(236)](/\s/g,"")}(e);let c;try{c=u.pki[r(228)](a)}catch(t){try{const t=r(235)+a+r(230);c=u[r(247)][r(228)](t)}catch(t){throw new Error(r(224)+(t instanceof Error?t.message:String(t)))}}const f=s===r(244)?u.md[r(240)][r(234)]():u.md.sha1[r(234)](),h=o===r(244)?u.md[r(240)].create():u.md[r(239)][r(234)]();let p;try{p=c.encrypt(t,r(250),{md:f,mgf1Md:h})}catch(t){throw new Error(r(225)+(t instanceof Error?t[r(233)]:String(t)))}if(i===r(252))return u[r(242)][r(249)](p);if("base64"===i)return u[r(242)][r(238)](p);throw new Error(r(227)+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,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 i(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 o(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 s(
|
|
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,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 i(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 o(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 s(){const t=["encode64","sha1","sha256","438yHvJgY","util","31766THzbsy","SHA-256","215257yHyBCv","1566976ObCnzp","pki","3VJUGVp","bytesToHex","RSA-OAEP","join","hex","2691PMzXya","construct","padStart","9032ptkNVO","Invalid public key: ","RSA encryption failed: ","98175DtpnRM","Unsupported output encoding: ","publicKeyFromPem","620108RoDJwN","\n-----END PUBLIC KEY-----","base64","2778760deKeeI","message","create","-----BEGIN PUBLIC KEY-----\n","replace","from"];return(s=function(){return t})()}function a(t,e,r={}){const i=c,{outputEncoding:o=i(252),oaepHash:s=i(244),mgf1Hash:a=s}=r,f=function(t){const e=c;return t.replace(/-----BEGIN PUBLIC KEY-----/,"")[e(236)](/-----END PUBLIC KEY-----/,"")[e(236)](/\s/g,"")}(e);let h;try{h=n.pki[i(228)](f)}catch(t){try{const t=i(235)+f+i(230);h=n[i(247)][i(228)](t)}catch(t){throw new Error(i(224)+(t instanceof Error?t.message:String(t)))}}const u=s===i(244)?n.md[i(240)][i(234)]():n.md.sha1[i(234)](),p=a===i(244)?n.md[i(240)].create():n.md[i(239)][i(234)]();let d;try{d=h.encrypt(t,i(250),{md:u,mgf1Md:p})}catch(t){throw new Error(i(225)+(t instanceof Error?t[i(233)]:String(t)))}if(o===i(252))return n[i(242)][i(249)](d);if("base64"===o)return n[i(242)][i(238)](d);throw new Error(i(227)+o)}function c(t,e){t-=220;return s()[t]}function f(){const t=["now","2TqlFWC","0123456789","doSignature","491169ZLrUuu","test","5576580eVLLoZ","getRegisterBody","68612IJpVIW","then","undefined","2214140uDbhiW","get","match","length","55flQJsk","getPublicHeaders","alphanumeric","9zuQGtl","toString","decrypt","7852856ZyOGSX","X-N","call","toUpperCase","set","6CcqLst","trim","63iatbnl","355891BeRGvV","random","1234567812345678","cbc","floor","number","load","长度必须是整数","isInteger","encrypt","setAccessToken","3089095pbpiYj"];return(f=function(){return t})()}function h(t,e){t-=116;return f()[t]}var u,p,d,l,y,m,v,w;"function"==typeof SuppressedError&&SuppressedError,function(){const t=c,e=s();for(;;)try{if(222003===-parseInt(t(245))/1+parseInt(t(229))/2*(parseInt(t(248))/3)+parseInt(t(246))/4+parseInt(t(226))/5+parseInt(t(241))/6*(parseInt(t(243))/7)+-parseInt(t(223))/8*(parseInt(t(220))/9)+-parseInt(t(232))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),function(){const t=h,e=f();for(;;)try{if(562060===-parseInt(t(149))/1*(parseInt(t(121))/2)+-parseInt(t(148))/3*(parseInt(t(128))/4)+parseInt(t(119))/5+parseInt(t(146))/6*(parseInt(t(124))/7)+-parseInt(t(141))/8*(parseInt(t(138))/9)+parseInt(t(131))/10*(parseInt(t(135))/11)+parseInt(t(126))/12)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const{sm2:I,sm4:g}=e;function E(t){return r(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function b(t,e={}){const n=h,{allowLeadingZero:r=!1,type:i=n(154)}=e;if(t<=0)return"";if(!Number[n(116)](t))throw new Error(n(156));const o={number:n(122),alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},s=o[i]||o[n(154)];let a="";r||i!==n(154)?a+=s[Math[n(153)](Math[n(150)]()*s[n(134)])]:a+=s[Math[n(153)](9*Math[n(150)]()+1)];for(let e=1;e<t;e++)a+=s[Math[n(153)](Math[n(150)]()*s.length)];return a}class M{constructor(e,n={}){const s=h;u[s(145)](this,""),p[s(145)](this,""),d.set(this,""),l[s(145)](this,""),y[s(145)](this,!1),m[s(145)](this,""),v[s(145)](this,t=>{const e=s;var n,r,o,a,c;if(!t)return"";let f=null===(r=null===(n=g[e(140)](t,i(this,p,"f"),{mode:e(152),iv:b(16,{type:e(137)})}))||void 0===n?void 0:n[e(147)])||void 0===r?void 0:r[e(143)](n);if(/^[0-9A-Fa-f]{64}$/[e(125)](f))f=f[e(144)]();else{const t=null===(o=null==f?void 0:f[e(133)])||void 0===o?void 0:o[e(143)](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(144)])||void 0===c?void 0:c[e(143)](a);else{const t=f.match(/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(f=t[1][e(144)]())}}return f}),w.set(this,()=>r(this,void 0,void 0,function*(){const e=s;return i(this,d,"f")?i(this,d,"f"):i(this,y,"f")?(yield E(100),yield i(this,w,"f")[e(143)](this)):(o(this,y,!0,"f"),t[e(155)]()[e(129)](t=>t[e(132)]()).then(t=>(o(this,y,!1,"f"),o(this,d,i(this,l,"f")+t.visitorId,"f"),i(this,d,"f"))))})),this[s(118)]=t=>{t&&o(this,m,i(this,v,"f").call(this,t),"f")},this[s(127)]=()=>r(this,void 0,void 0,function*(){const t=s;i(this,d,"f")||(yield i(this,w,"f").call(this));const e={d:i(this,d,"f"),n:b(32,{type:t(137)}),t:Date[t(120)]().toString(),s:""},n=e.d+e.t+e.n;return e.s=g[t(117)](n,i(this,p,"f"),{mode:t(152),iv:b(16,{type:"alphanumeric"})}),e}),this[s(136)]=()=>r(this,void 0,void 0,function*(){const t=s;var e,n;if(i(this,d,"f")||(yield i(this,w,"f")[t(143)](this)),!i(this,m,"f"))return yield E(100),yield this[t(136)]();const r={"X-T":Date[t(120)]()[t(139)](),"X-N":b(32,{type:t(137)}),"X-DI":i(this,d,"f"),"X-S":""},o=i(this,p,"f")+i(this,d,"f")+r[t(142)]+r["X-T"];return r["X-S"]=null===(n=null===(e=I[t(123)](o,i(this,m,"f"),{hash:!0,der:!1,mode:0,userId:i(this,u,"f")}))||void 0===e?void 0:e.toUpperCase)||void 0===n?void 0:n[t(143)](e),r});const{uId:a=s(151),deviceId:c,deviceIdPrefix:f=""}=n;o(this,p,e,"f"),o(this,u,a,"f"),o(this,l,f,"f"),c?o(this,d,c,"f"):typeof window!==s(130)&&"undefined"!=typeof document&&i(this,w,"f")[s(143)](this)}}u=new WeakMap,p=new WeakMap,d=new WeakMap,l=new WeakMap,y=new WeakMap,m=new WeakMap,v=new WeakMap,w=new WeakMap;const k=function(t){let e=null;const n=new Proxy(t,{construct(t,n){const r=c;return e||(e="undefined"!=typeof Reflect&&Reflect[r(221)]?Reflect[r(221)](t,n):new t(...n),e)}});return n.prototype.constructor=n,n}(M);export{M as BaseOmUtils,k as OmUtils,k as default,a 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,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(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(o,a)}c((r=r.apply(t,e||[])).next())})}function s(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 o(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(
|
|
1
|
+
var omUtils=function(t,e,n,r){"use strict";function i(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(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(o,a)}c((r=r.apply(t,e||[])).next())})}function s(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 o(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=["encode64","sha1","sha256","438yHvJgY","util","31766THzbsy","SHA-256","215257yHyBCv","1566976ObCnzp","pki","3VJUGVp","bytesToHex","RSA-OAEP","join","hex","2691PMzXya","construct","padStart","9032ptkNVO","Invalid public key: ","RSA encryption failed: ","98175DtpnRM","Unsupported output encoding: ","publicKeyFromPem","620108RoDJwN","\n-----END PUBLIC KEY-----","base64","2778760deKeeI","message","create","-----BEGIN PUBLIC KEY-----\n","replace","from"];return(a=function(){return t})()}function c(t,e){t-=220;return a()[t]}function f(){const t=["now","2TqlFWC","0123456789","doSignature","491169ZLrUuu","test","5576580eVLLoZ","getRegisterBody","68612IJpVIW","then","undefined","2214140uDbhiW","get","match","length","55flQJsk","getPublicHeaders","alphanumeric","9zuQGtl","toString","decrypt","7852856ZyOGSX","X-N","call","toUpperCase","set","6CcqLst","trim","63iatbnl","355891BeRGvV","random","1234567812345678","cbc","floor","number","load","长度必须是整数","isInteger","encrypt","setAccessToken","3089095pbpiYj"];return(f=function(){return t})()}function u(t,e){t-=116;return f()[t]}var h,p,d,l,y,v,w,m;"function"==typeof SuppressedError&&SuppressedError,function(t){const e=c,n=t();for(;;)try{if(222003===-parseInt(e(245))/1+parseInt(e(229))/2*(parseInt(e(248))/3)+parseInt(e(246))/4+parseInt(e(226))/5+parseInt(e(241))/6*(parseInt(e(243))/7)+-parseInt(e(223))/8*(parseInt(e(220))/9)+-parseInt(e(232))/10)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(a),function(t){const e=u,n=t();for(;;)try{if(562060===-parseInt(e(149))/1*(parseInt(e(121))/2)+-parseInt(e(148))/3*(parseInt(e(128))/4)+parseInt(e(119))/5+parseInt(e(146))/6*(parseInt(e(124))/7)+-parseInt(e(141))/8*(parseInt(e(138))/9)+parseInt(e(131))/10*(parseInt(e(135))/11)+parseInt(e(126))/12)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(f);const{sm2:I,sm4:g}=n;function E(t){return i(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function b(t,e={}){const n=u,{allowLeadingZero:r=!1,type:i=n(154)}=e;if(t<=0)return"";if(!Number[n(116)](t))throw new Error(n(156));const s={number:n(122),alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},o=s[i]||s[n(154)];let a="";r||i!==n(154)?a+=o[Math[n(153)](Math[n(150)]()*o[n(134)])]:a+=o[Math[n(153)](9*Math[n(150)]()+1)];for(let e=1;e<t;e++)a+=o[Math[n(153)](Math[n(150)]()*o.length)];return a}class M{constructor(t,n={}){const r=u;h[r(145)](this,""),p[r(145)](this,""),d.set(this,""),l[r(145)](this,""),y[r(145)](this,!1),v[r(145)](this,""),w[r(145)](this,t=>{const e=r;var n,i,o,a,c;if(!t)return"";let f=null===(i=null===(n=g[e(140)](t,s(this,p,"f"),{mode:e(152),iv:b(16,{type:e(137)})}))||void 0===n?void 0:n[e(147)])||void 0===i?void 0:i[e(143)](n);if(/^[0-9A-Fa-f]{64}$/[e(125)](f))f=f[e(144)]();else{const t=null===(o=null==f?void 0:f[e(133)])||void 0===o?void 0:o[e(143)](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(144)])||void 0===c?void 0:c[e(143)](a);else{const t=f.match(/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(f=t[1][e(144)]())}}return f}),m.set(this,()=>i(this,void 0,void 0,function*(){const t=r;return s(this,d,"f")?s(this,d,"f"):s(this,y,"f")?(yield E(100),yield s(this,m,"f")[t(143)](this)):(o(this,y,!0,"f"),e[t(155)]()[t(129)](e=>e[t(132)]()).then(t=>(o(this,y,!1,"f"),o(this,d,s(this,l,"f")+t.visitorId,"f"),s(this,d,"f"))))})),this[r(118)]=t=>{t&&o(this,v,s(this,w,"f").call(this,t),"f")},this[r(127)]=()=>i(this,void 0,void 0,function*(){const t=r;s(this,d,"f")||(yield s(this,m,"f").call(this));const e={d:s(this,d,"f"),n:b(32,{type:t(137)}),t:Date[t(120)]().toString(),s:""},n=e.d+e.t+e.n;return e.s=g[t(117)](n,s(this,p,"f"),{mode:t(152),iv:b(16,{type:"alphanumeric"})}),e}),this[r(136)]=()=>i(this,void 0,void 0,function*(){const t=r;var e,n;if(s(this,d,"f")||(yield s(this,m,"f")[t(143)](this)),!s(this,v,"f"))return yield E(100),yield this[t(136)]();const i={"X-T":Date[t(120)]()[t(139)](),"X-N":b(32,{type:t(137)}),"X-DI":s(this,d,"f"),"X-S":""},o=s(this,p,"f")+s(this,d,"f")+i[t(142)]+i["X-T"];return i["X-S"]=null===(n=null===(e=I[t(123)](o,s(this,v,"f"),{hash:!0,der:!1,mode:0,userId:s(this,h,"f")}))||void 0===e?void 0:e.toUpperCase)||void 0===n?void 0:n[t(143)](e),i});const{uId:a=r(151),deviceId:c,deviceIdPrefix:f=""}=n;o(this,p,t,"f"),o(this,h,a,"f"),o(this,l,f,"f"),c?o(this,d,c,"f"):typeof window!==r(130)&&"undefined"!=typeof document&&s(this,m,"f")[r(143)](this)}}h=new WeakMap,p=new WeakMap,d=new WeakMap,l=new WeakMap,y=new WeakMap,v=new WeakMap,w=new WeakMap,m=new WeakMap;const k=function(t){let e=null;const n=new Proxy(t,{construct(t,n){const r=c;return e||(e="undefined"!=typeof Reflect&&Reflect[r(221)]?Reflect[r(221)](t,n):new t(...n),e)}});return n.prototype.constructor=n,n}(M);return t.BaseOmUtils=M,t.OmUtils=k,t.default=k,t.rsaOaepEncrypt=function(t,e,n={}){const i=c,{outputEncoding:s=i(252),oaepHash:o=i(244),mgf1Hash:a=o}=n,f=function(t){const e=c;return t.replace(/-----BEGIN PUBLIC KEY-----/,"")[e(236)](/-----END PUBLIC KEY-----/,"")[e(236)](/\s/g,"")}(e);let u;try{u=r.pki[i(228)](f)}catch(t){try{const t=i(235)+f+i(230);u=r[i(247)][i(228)](t)}catch(t){throw new Error(i(224)+(t instanceof Error?t.message:String(t)))}}const h=o===i(244)?r.md[i(240)][i(234)]():r.md.sha1[i(234)](),p=a===i(244)?r.md[i(240)].create():r.md[i(239)][i(234)]();let d;try{d=u.encrypt(t,i(250),{md:h,mgf1Md:p})}catch(t){throw new Error(i(225)+(t instanceof Error?t[i(233)]:String(t)))}if(s===i(252))return r[i(242)][i(249)](d);if("base64"===s)return r[i(242)][i(238)](d);throw new Error(i(227)+s)},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(
|
|
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=["encode64","sha1","sha256","438yHvJgY","util","31766THzbsy","SHA-256","215257yHyBCv","1566976ObCnzp","pki","3VJUGVp","bytesToHex","RSA-OAEP","join","hex","2691PMzXya","construct","padStart","9032ptkNVO","Invalid public key: ","RSA encryption failed: ","98175DtpnRM","Unsupported output encoding: ","publicKeyFromPem","620108RoDJwN","\n-----END PUBLIC KEY-----","base64","2778760deKeeI","message","create","-----BEGIN PUBLIC KEY-----\n","replace","from"];return(a=function(){return t})()}function c(t,e){t-=220;return a()[t]}function f(){const t=["now","2TqlFWC","0123456789","doSignature","491169ZLrUuu","test","5576580eVLLoZ","getRegisterBody","68612IJpVIW","then","undefined","2214140uDbhiW","get","match","length","55flQJsk","getPublicHeaders","alphanumeric","9zuQGtl","toString","decrypt","7852856ZyOGSX","X-N","call","toUpperCase","set","6CcqLst","trim","63iatbnl","355891BeRGvV","random","1234567812345678","cbc","floor","number","load","长度必须是整数","isInteger","encrypt","setAccessToken","3089095pbpiYj"];return(f=function(){return t})()}function u(t,e){t-=116;return f()[t]}var h,p,d,l,y,v,m,w;"function"==typeof SuppressedError&&SuppressedError,function(t){const e=c,n=t();for(;;)try{if(222003===-parseInt(e(245))/1+parseInt(e(229))/2*(parseInt(e(248))/3)+parseInt(e(246))/4+parseInt(e(226))/5+parseInt(e(241))/6*(parseInt(e(243))/7)+-parseInt(e(223))/8*(parseInt(e(220))/9)+-parseInt(e(232))/10)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(a),function(t){const e=u,n=t();for(;;)try{if(562060===-parseInt(e(149))/1*(parseInt(e(121))/2)+-parseInt(e(148))/3*(parseInt(e(128))/4)+parseInt(e(119))/5+parseInt(e(146))/6*(parseInt(e(124))/7)+-parseInt(e(141))/8*(parseInt(e(138))/9)+parseInt(e(131))/10*(parseInt(e(135))/11)+parseInt(e(126))/12)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(f);const{sm2:I,sm4:g}=n;function b(t){return i(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function E(t,e={}){const n=u,{allowLeadingZero:r=!1,type:i=n(154)}=e;if(t<=0)return"";if(!Number[n(116)](t))throw new Error(n(156));const o={number:n(122),alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},s=o[i]||o[n(154)];let a="";r||i!==n(154)?a+=s[Math[n(153)](Math[n(150)]()*s[n(134)])]:a+=s[Math[n(153)](9*Math[n(150)]()+1)];for(let e=1;e<t;e++)a+=s[Math[n(153)](Math[n(150)]()*s.length)];return a}class M{constructor(t,n={}){const r=u;h[r(145)](this,""),p[r(145)](this,""),d.set(this,""),l[r(145)](this,""),y[r(145)](this,!1),v[r(145)](this,""),m[r(145)](this,t=>{const e=r;var n,i,s,a,c;if(!t)return"";let f=null===(i=null===(n=g[e(140)](t,o(this,p,"f"),{mode:e(152),iv:E(16,{type:e(137)})}))||void 0===n?void 0:n[e(147)])||void 0===i?void 0:i[e(143)](n);if(/^[0-9A-Fa-f]{64}$/[e(125)](f))f=f[e(144)]();else{const t=null===(s=null==f?void 0:f[e(133)])||void 0===s?void 0:s[e(143)](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(144)])||void 0===c?void 0:c[e(143)](a);else{const t=f.match(/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(f=t[1][e(144)]())}}return f}),w.set(this,()=>i(this,void 0,void 0,function*(){const t=r;return o(this,d,"f")?o(this,d,"f"):o(this,y,"f")?(yield b(100),yield o(this,w,"f")[t(143)](this)):(s(this,y,!0,"f"),e[t(155)]()[t(129)](e=>e[t(132)]()).then(t=>(s(this,y,!1,"f"),s(this,d,o(this,l,"f")+t.visitorId,"f"),o(this,d,"f"))))})),this[r(118)]=t=>{t&&s(this,v,o(this,m,"f").call(this,t),"f")},this[r(127)]=()=>i(this,void 0,void 0,function*(){const t=r;o(this,d,"f")||(yield o(this,w,"f").call(this));const e={d:o(this,d,"f"),n:E(32,{type:t(137)}),t:Date[t(120)]().toString(),s:""},n=e.d+e.t+e.n;return e.s=g[t(117)](n,o(this,p,"f"),{mode:t(152),iv:E(16,{type:"alphanumeric"})}),e}),this[r(136)]=()=>i(this,void 0,void 0,function*(){const t=r;var e,n;if(o(this,d,"f")||(yield o(this,w,"f")[t(143)](this)),!o(this,v,"f"))return yield b(100),yield this[t(136)]();const i={"X-T":Date[t(120)]()[t(139)](),"X-N":E(32,{type:t(137)}),"X-DI":o(this,d,"f"),"X-S":""},s=o(this,p,"f")+o(this,d,"f")+i[t(142)]+i["X-T"];return i["X-S"]=null===(n=null===(e=I[t(123)](s,o(this,v,"f"),{hash:!0,der:!1,mode:0,userId:o(this,h,"f")}))||void 0===e?void 0:e.toUpperCase)||void 0===n?void 0:n[t(143)](e),i});const{uId:a=r(151),deviceId:c,deviceIdPrefix:f=""}=n;s(this,p,t,"f"),s(this,h,a,"f"),s(this,l,f,"f"),c?s(this,d,c,"f"):typeof window!==r(130)&&"undefined"!=typeof document&&o(this,w,"f")[r(143)](this)}}h=new WeakMap,p=new WeakMap,d=new WeakMap,l=new WeakMap,y=new WeakMap,v=new WeakMap,m=new WeakMap,w=new WeakMap;const k=function(t){let e=null;const n=new Proxy(t,{construct(t,n){const r=c;return e||(e="undefined"!=typeof Reflect&&Reflect[r(221)]?Reflect[r(221)](t,n):new t(...n),e)}});return n.prototype.constructor=n,n}(M);t.BaseOmUtils=M,t.OmUtils=k,t.default=k,t.rsaOaepEncrypt=function(t,e,n={}){const i=c,{outputEncoding:o=i(252),oaepHash:s=i(244),mgf1Hash:a=s}=n,f=function(t){const e=c;return t.replace(/-----BEGIN PUBLIC KEY-----/,"")[e(236)](/-----END PUBLIC KEY-----/,"")[e(236)](/\s/g,"")}(e);let u;try{u=r.pki[i(228)](f)}catch(t){try{const t=i(235)+f+i(230);u=r[i(247)][i(228)](t)}catch(t){throw new Error(i(224)+(t instanceof Error?t.message:String(t)))}}const h=s===i(244)?r.md[i(240)][i(234)]():r.md.sha1[i(234)](),p=a===i(244)?r.md[i(240)].create():r.md[i(239)][i(234)]();let d;try{d=u.encrypt(t,i(250),{md:h,mgf1Md:p})}catch(t){throw new Error(i(225)+(t instanceof Error?t[i(233)]:String(t)))}if(o===i(252))return r[i(242)][i(249)](d);if("base64"===o)return r[i(242)][i(238)](d);throw new Error(i(227)+o)},Object.defineProperty(t,"__esModule",{value:!0})});
|