@a-drowned-fish/om-utils 1.0.20 → 1.0.21
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=require("@fingerprintjs/fingerprintjs"),u=require("sm-crypto"),f=require("node-forge");function h(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
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,n,r,i,o,s,a,c=require("@fingerprintjs/fingerprintjs"),u=require("sm-crypto"),f=require("node-forge");function h(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 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(t,e){t-=324;return w()[t]}function w(){const t=["81352QGeERN","2471jKuaZF","padStart","RSA-OAEP","util","constructor","2067687gMgTIF","message","replace","map","toString","encrypt","pki","from","create","hex","\n-----END PUBLIC KEY-----","RSA encryption failed: ","sha256","155096Kgmqqx","base64","28kOabrd","30OXYNVF","sha1","SHA-256","publicKeyFromPem","bytesToHex","163095gDDiAY","3016pxwqGc","Unsupported output encoding: ","prototype","construct","37695GzBdqq","4777760dAowKH","join","undefined"];return(w=function(){return t})()}"function"==typeof SuppressedError&&SuppressedError,function(){const t=l,e=w();for(;;)try{if(127616===-parseInt(t(336))/1+-parseInt(t(353))/2+-parseInt(t(349))/3*(parseInt(t(338))/4)+parseInt(t(344))/5*(-parseInt(t(339))/6)+parseInt(t(354))/7*(-parseInt(t(345))/8)+parseInt(t(359))/9+parseInt(t(350))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),function(){const t=g,e=v();for(;;)try{if(819180===parseInt(t(483))/1*(parseInt(t(458))/2)+-parseInt(t(460))/3+parseInt(t(471))/4*(parseInt(t(459))/5)+parseInt(t(477))/6*(-parseInt(t(465))/7)+parseInt(t(485))/8*(parseInt(t(455))/9)+parseInt(t(480))/10*(parseInt(t(489))/11)+parseInt(t(487))/12)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const{sm2:y,sm4:m}=u;function v(){const t=["random","ecb","3165510cEeEjM","now","set","136370LBHPxk","getPublicHeaders","then","3943OwWyrB","setAccessToken","7632YlyWNT","length","4743720bWGrGI","undefined","649HLYpLJ","0123456789","8649yYpFPu","encrypt","toUpperCase","656PBWhlm","145wrrsqV","4460364DNwWtk","floor","X-N","X-T","toString","21rlYOJp","number","decrypt","match","alphanumeric","visitorId","66032VHMDaG","doSignature","长度必须是整数","call"];return(v=function(){return t})()}function I(t){return h(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function g(t,e){t-=455;return v()[t]}function E(t,e={}){const n=g,{allowLeadingZero:r=!1,type:i=n(466)}=e;if(!Number.isInteger(t))throw new Error(n(473));const o={number:n(490),alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},s=o[i]||o[n(466)];let a="";r||i!==n(466)?a+=s[Math[n(461)](Math[n(475)]()*s[n(486)])]:a+=s[Math[n(461)](9*Math[n(475)]()+1)];for(let e=1;e<t;e++)a+=s[Math[n(461)](Math[n(475)]()*s.length)];return a}class b{constructor(u,f={}){const l=g;t[l(479)](this,""),e[l(479)](this,""),n[l(479)](this,""),r.set(this,""),i[l(479)](this,!1),o[l(479)](this,""),s[l(479)](this,t=>{const n=l;var r,i,o,s,a;if(!t)return"";let c=null===(i=null===(r=m[n(467)](t,p(this,e,"f"),{mode:n(476)}))||void 0===r?void 0:r.trim)||void 0===i?void 0:i[n(474)](r);if(/^[0-9A-Fa-f]{64}$/.test(c))c=c.toUpperCase();else{const t=null===(o=null==c?void 0:c[n(468)])||void 0===o?void 0:o.call(c,/0201010420([0-9A-Fa-f]{64})/i);if(t&&(null==t?void 0:t[1]))c=null===(a=null===(s=t[1])||void 0===s?void 0:s.toUpperCase)||void 0===a?void 0:a[n(474)](s);else{const t=c[n(468)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(c=t[1][n(457)]())}}return c}),a[l(479)](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 I(100),yield p(this,a,"f")[t(474)](this)):(d(this,i,!0,"f"),c.load().then(t=>t.get())[t(482)](e=>{const o=t;return d(this,i,!1,"f"),d(this,n,p(this,r,"f")+e[o(470)],"f"),p(this,n,"f")}))})),this[l(484)]=t=>{const e=l;t&&d(this,o,p(this,s,"f")[e(474)](this,t),"f")},this.getRegisterBody=()=>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(469)}),t:Date.now()[t(464)](),s:""},i=r.d+r.t+r.n;return r.s=m[t(456)](i,p(this,e,"f"),{mode:t(476)}),r}),this[l(481)]=()=>h(this,void 0,void 0,function*(){const r=l;var i,s;if(p(this,n,"f")||(yield p(this,a,"f").call(this)),!p(this,o,"f"))return yield I(100),yield this[r(481)]();const c={"X-T":Date[r(478)]()[r(464)](),"X-N":E(32,{type:"alphanumeric"}),"X-DI":p(this,n,"f"),"X-S":""},u=p(this,e,"f")+p(this,n,"f")+c[r(462)]+c[r(463)];return c["X-S"]=null===(s=null===(i=y[r(472)](u,p(this,o,"f"),{hash:!0,der:!1,mode:0,userId:p(this,t,"f")}))||void 0===i?void 0:i[r(457)])||void 0===s?void 0:s[r(474)](i),c});const{uId:w="1234567812345678",deviceId:v,deviceIdPrefix:b=""}=f;d(this,e,u,"f"),d(this,t,w,"f"),d(this,r,b,"f"),v?d(this,n,v,"f"):typeof window!==l(488)&&"undefined"!=typeof document&&p(this,a,"f")[l(474)](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;const M=function(t){const e=l;let n=null;const r=new Proxy(t,{construct(t,e){const r=l;return n||(n=typeof Reflect!==r(352)&&Reflect[r(348)]?Reflect[r(348)](t,e):new t(...e),n)}});return r[e(347)][e(358)]=r,r}(b);exports.BaseOmUtils=b,exports.OmUtils=M,exports.default=M,exports.rsaOaepEncrypt=function(t,e,n={}){const r=l,{outputEncoding:i=r(332),oaepHash:o=r(341),mgf1Hash:s=o}=n,a=function(t){const e=l;return t[e(325)](/-----BEGIN PUBLIC KEY-----/,"")[e(325)](/-----END PUBLIC KEY-----/,"")[e(325)](/\s/g,"")}(e);let c;try{c=f[r(329)][r(342)](a)}catch(t){try{const t="-----BEGIN PUBLIC KEY-----\n"+a+r(333);c=f[r(329)][r(342)](t)}catch(t){throw new Error("Invalid public key: "+(t instanceof Error?t[r(324)]:String(t)))}}const u=o===r(341)?f.md[r(335)][r(331)]():f.md[r(340)][r(331)](),h=s===r(341)?f.md[r(335)].create():f.md[r(340)].create();let p;try{p=c[r(328)](t,r(356),{md:u,mgf1Md:h})}catch(t){throw new Error(r(334)+(t instanceof Error?t[r(324)]:String(t)))}if("hex"===i)return f[r(357)][r(343)](p);if("base64"===i)return f.util.encode64(p);throw new Error(r(346)+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(o
|
|
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(t,e){t-=324;return a()[t]}function a(){const t=["81352QGeERN","2471jKuaZF","padStart","RSA-OAEP","util","constructor","2067687gMgTIF","message","replace","map","toString","encrypt","pki","from","create","hex","\n-----END PUBLIC KEY-----","RSA encryption failed: ","sha256","155096Kgmqqx","base64","28kOabrd","30OXYNVF","sha1","SHA-256","publicKeyFromPem","bytesToHex","163095gDDiAY","3016pxwqGc","Unsupported output encoding: ","prototype","construct","37695GzBdqq","4777760dAowKH","join","undefined"];return(a=function(){return t})()}function c(t,e,r={}){const i=s,{outputEncoding:o=i(332),oaepHash:a=i(341),mgf1Hash:c=a}=r,f=function(t){const e=s;return t[e(325)](/-----BEGIN PUBLIC KEY-----/,"")[e(325)](/-----END PUBLIC KEY-----/,"")[e(325)](/\s/g,"")}(e);let h;try{h=n[i(329)][i(342)](f)}catch(t){try{const t="-----BEGIN PUBLIC KEY-----\n"+f+i(333);h=n[i(329)][i(342)](t)}catch(t){throw new Error("Invalid public key: "+(t instanceof Error?t[i(324)]:String(t)))}}const u=a===i(341)?n.md[i(335)][i(331)]():n.md[i(340)][i(331)](),p=c===i(341)?n.md[i(335)].create():n.md[i(340)].create();let d;try{d=h[i(328)](t,i(356),{md:u,mgf1Md:p})}catch(t){throw new Error(i(334)+(t instanceof Error?t[i(324)]:String(t)))}if("hex"===o)return n[i(357)][i(343)](d);if("base64"===o)return n.util.encode64(d);throw new Error(i(346)+o)}var f,h,u,p,d,l,w,m;"function"==typeof SuppressedError&&SuppressedError,function(){const t=s,e=a();for(;;)try{if(127616===-parseInt(t(336))/1+-parseInt(t(353))/2+-parseInt(t(349))/3*(parseInt(t(338))/4)+parseInt(t(344))/5*(-parseInt(t(339))/6)+parseInt(t(354))/7*(-parseInt(t(345))/8)+parseInt(t(359))/9+parseInt(t(350))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),function(){const t=E,e=I();for(;;)try{if(819180===parseInt(t(483))/1*(parseInt(t(458))/2)+-parseInt(t(460))/3+parseInt(t(471))/4*(parseInt(t(459))/5)+parseInt(t(477))/6*(-parseInt(t(465))/7)+parseInt(t(485))/8*(parseInt(t(455))/9)+parseInt(t(480))/10*(parseInt(t(489))/11)+parseInt(t(487))/12)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const{sm2:y,sm4:v}=e;function I(){const t=["random","ecb","3165510cEeEjM","now","set","136370LBHPxk","getPublicHeaders","then","3943OwWyrB","setAccessToken","7632YlyWNT","length","4743720bWGrGI","undefined","649HLYpLJ","0123456789","8649yYpFPu","encrypt","toUpperCase","656PBWhlm","145wrrsqV","4460364DNwWtk","floor","X-N","X-T","toString","21rlYOJp","number","decrypt","match","alphanumeric","visitorId","66032VHMDaG","doSignature","长度必须是整数","call"];return(I=function(){return t})()}function g(t){return r(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function E(t,e){t-=455;return I()[t]}function b(t,e={}){const n=E,{allowLeadingZero:r=!1,type:i=n(466)}=e;if(!Number.isInteger(t))throw new Error(n(473));const o={number:n(490),alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},s=o[i]||o[n(466)];let a="";r||i!==n(466)?a+=s[Math[n(461)](Math[n(475)]()*s[n(486)])]:a+=s[Math[n(461)](9*Math[n(475)]()+1)];for(let e=1;e<t;e++)a+=s[Math[n(461)](Math[n(475)]()*s.length)];return a}class M{constructor(e,n={}){const s=E;f[s(479)](this,""),h[s(479)](this,""),u[s(479)](this,""),p.set(this,""),d[s(479)](this,!1),l[s(479)](this,""),w[s(479)](this,t=>{const e=s;var n,r,o,a,c;if(!t)return"";let f=null===(r=null===(n=v[e(467)](t,i(this,h,"f"),{mode:e(476)}))||void 0===n?void 0:n.trim)||void 0===r?void 0:r[e(474)](n);if(/^[0-9A-Fa-f]{64}$/.test(f))f=f.toUpperCase();else{const t=null===(o=null==f?void 0:f[e(468)])||void 0===o?void 0:o.call(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.toUpperCase)||void 0===c?void 0:c[e(474)](a);else{const t=f[e(468)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(f=t[1][e(457)]())}}return f}),m[s(479)](this,()=>r(this,void 0,void 0,function*(){const e=s;return i(this,u,"f")?i(this,u,"f"):i(this,d,"f")?(yield g(100),yield i(this,m,"f")[e(474)](this)):(o(this,d,!0,"f"),t.load().then(t=>t.get())[e(482)](t=>{const n=e;return o(this,d,!1,"f"),o(this,u,i(this,p,"f")+t[n(470)],"f"),i(this,u,"f")}))})),this[s(484)]=t=>{const e=s;t&&o(this,l,i(this,w,"f")[e(474)](this,t),"f")},this.getRegisterBody=()=>r(this,void 0,void 0,function*(){const t=s;i(this,u,"f")||(yield i(this,m,"f").call(this));const e={d:i(this,u,"f"),n:b(32,{type:t(469)}),t:Date.now()[t(464)](),s:""},n=e.d+e.t+e.n;return e.s=v[t(456)](n,i(this,h,"f"),{mode:t(476)}),e}),this[s(481)]=()=>r(this,void 0,void 0,function*(){const t=s;var e,n;if(i(this,u,"f")||(yield i(this,m,"f").call(this)),!i(this,l,"f"))return yield g(100),yield this[t(481)]();const r={"X-T":Date[t(478)]()[t(464)](),"X-N":b(32,{type:"alphanumeric"}),"X-DI":i(this,u,"f"),"X-S":""},o=i(this,h,"f")+i(this,u,"f")+r[t(462)]+r[t(463)];return r["X-S"]=null===(n=null===(e=y[t(472)](o,i(this,l,"f"),{hash:!0,der:!1,mode:0,userId:i(this,f,"f")}))||void 0===e?void 0:e[t(457)])||void 0===n?void 0:n[t(474)](e),r});const{uId:a="1234567812345678",deviceId:c,deviceIdPrefix:I=""}=n;o(this,h,e,"f"),o(this,f,a,"f"),o(this,p,I,"f"),c?o(this,u,c,"f"):typeof window!==s(488)&&"undefined"!=typeof document&&i(this,m,"f")[s(474)](this)}}f=new WeakMap,h=new WeakMap,u=new WeakMap,p=new WeakMap,d=new WeakMap,l=new WeakMap,w=new WeakMap,m=new WeakMap;const P=function(t){const e=s;let n=null;const r=new Proxy(t,{construct(t,e){const r=s;return n||(n=typeof Reflect!==r(352)&&Reflect[r(348)]?Reflect[r(348)](t,e):new t(...e),n)}});return r[e(347)][e(358)]=r,r}(M);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(t,e){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(t,e){t-=324;return c()[t]}function c(){const t=["81352QGeERN","2471jKuaZF","padStart","RSA-OAEP","util","constructor","2067687gMgTIF","message","replace","map","toString","encrypt","pki","from","create","hex","\n-----END PUBLIC KEY-----","RSA encryption failed: ","sha256","155096Kgmqqx","base64","28kOabrd","30OXYNVF","sha1","SHA-256","publicKeyFromPem","bytesToHex","163095gDDiAY","3016pxwqGc","Unsupported output encoding: ","prototype","construct","37695GzBdqq","4777760dAowKH","join","undefined"];return(c=function(){return t})()}var u,f,h,d,p,l,w,y;"function"==typeof SuppressedError&&SuppressedError,function(t){const e=a,n=t();for(;;)try{if(127616===-parseInt(e(336))/1+-parseInt(e(353))/2+-parseInt(e(349))/3*(parseInt(e(338))/4)+parseInt(e(344))/5*(-parseInt(e(339))/6)+parseInt(e(354))/7*(-parseInt(e(345))/8)+parseInt(e(359))/9+parseInt(e(350))/10)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(c),function(t){const e=E,n=t();for(;;)try{if(819180===parseInt(e(483))/1*(parseInt(e(458))/2)+-parseInt(e(460))/3+parseInt(e(471))/4*(parseInt(e(459))/5)+parseInt(e(477))/6*(-parseInt(e(465))/7)+parseInt(e(485))/8*(parseInt(e(455))/9)+parseInt(e(480))/10*(parseInt(e(489))/11)+parseInt(e(487))/12)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(I);const{sm2:m,sm4:v}=n;function I(){const t=["random","ecb","3165510cEeEjM","now","set","136370LBHPxk","getPublicHeaders","then","3943OwWyrB","setAccessToken","7632YlyWNT","length","4743720bWGrGI","undefined","649HLYpLJ","0123456789","8649yYpFPu","encrypt","toUpperCase","656PBWhlm","145wrrsqV","4460364DNwWtk","floor","X-N","X-T","toString","21rlYOJp","number","decrypt","match","alphanumeric","visitorId","66032VHMDaG","doSignature","长度必须是整数","call"];return(I=function(){return t})()}function g(t){return i(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function E(t,e){t-=455;return I()[t]}function b(t,e={}){const n=E,{allowLeadingZero:r=!1,type:i=n(466)}=e;if(!Number.isInteger(t))throw new Error(n(473));const o={number:n(490),alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},s=o[i]||o[n(466)];let a="";r||i!==n(466)?a+=s[Math[n(461)](Math[n(475)]()*s[n(486)])]:a+=s[Math[n(461)](9*Math[n(475)]()+1)];for(let e=1;e<t;e++)a+=s[Math[n(461)](Math[n(475)]()*s.length)];return a}class M{constructor(t,n={}){const r=E;u[r(479)](this,""),f[r(479)](this,""),h[r(479)](this,""),d.set(this,""),p[r(479)](this,!1),l[r(479)](this,""),w[r(479)](this,t=>{const e=r;var n,i,s,a,c;if(!t)return"";let u=null===(i=null===(n=v[e(467)](t,o(this,f,"f"),{mode:e(476)}))||void 0===n?void 0:n.trim)||void 0===i?void 0:i[e(474)](n);if(/^[0-9A-Fa-f]{64}$/.test(u))u=u.toUpperCase();else{const t=null===(s=null==u?void 0:u[e(468)])||void 0===s?void 0:s.call(u,/0201010420([0-9A-Fa-f]{64})/i);if(t&&(null==t?void 0:t[1]))u=null===(c=null===(a=t[1])||void 0===a?void 0:a.toUpperCase)||void 0===c?void 0:c[e(474)](a);else{const t=u[e(468)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(u=t[1][e(457)]())}}return u}),y[r(479)](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,y,"f")[t(474)](this)):(s(this,p,!0,"f"),e.load().then(t=>t.get())[t(482)](e=>{const n=t;return s(this,p,!1,"f"),s(this,h,o(this,d,"f")+e[n(470)],"f"),o(this,h,"f")}))})),this[r(484)]=t=>{const e=r;t&&s(this,l,o(this,w,"f")[e(474)](this,t),"f")},this.getRegisterBody=()=>i(this,void 0,void 0,function*(){const t=r;o(this,h,"f")||(yield o(this,y,"f").call(this));const e={d:o(this,h,"f"),n:b(32,{type:t(469)}),t:Date.now()[t(464)](),s:""},n=e.d+e.t+e.n;return e.s=v[t(456)](n,o(this,f,"f"),{mode:t(476)}),e}),this[r(481)]=()=>i(this,void 0,void 0,function*(){const t=r;var e,n;if(o(this,h,"f")||(yield o(this,y,"f").call(this)),!o(this,l,"f"))return yield g(100),yield this[t(481)]();const i={"X-T":Date[t(478)]()[t(464)](),"X-N":b(32,{type:"alphanumeric"}),"X-DI":o(this,h,"f"),"X-S":""},s=o(this,f,"f")+o(this,h,"f")+i[t(462)]+i[t(463)];return i["X-S"]=null===(n=null===(e=m[t(472)](s,o(this,l,"f"),{hash:!0,der:!1,mode:0,userId:o(this,u,"f")}))||void 0===e?void 0:e[t(457)])||void 0===n?void 0:n[t(474)](e),i});const{uId:a="1234567812345678",deviceId:c,deviceIdPrefix:I=""}=n;s(this,f,t,"f"),s(this,u,a,"f"),s(this,d,I,"f"),c?s(this,h,c,"f"):typeof window!==r(488)&&"undefined"!=typeof document&&o(this,y,"f")[r(474)](this)}}u=new WeakMap,f=new WeakMap,h=new WeakMap,d=new WeakMap,p=new WeakMap,l=new WeakMap,w=new WeakMap,y=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(352)&&Reflect[r(348)]?Reflect[r(348)](t,e):new t(...e),n)}});return r[e(347)][e(358)]=r,r}(M);return t.BaseOmUtils=M,t.OmUtils=P,t.default=P,t.rsaOaepEncrypt=function(t,e,n={}){const i=a,{outputEncoding:o=i(332),oaepHash:s=i(341),mgf1Hash:c=s}=n,u=function(t){const e=a;return t[e(325)](/-----BEGIN PUBLIC KEY-----/,"")[e(325)](/-----END PUBLIC KEY-----/,"")[e(325)](/\s/g,"")}(e);let f;try{f=r[i(329)][i(342)](u)}catch(t){try{const t="-----BEGIN PUBLIC KEY-----\n"+u+i(333);f=r[i(329)][i(342)](t)}catch(t){throw new Error("Invalid public key: "+(t instanceof Error?t[i(324)]:String(t)))}}const h=s===i(341)?r.md[i(335)][i(331)]():r.md[i(340)][i(331)](),d=c===i(341)?r.md[i(335)].create():r.md[i(340)].create();let p;try{p=f[i(328)](t,i(356),{md:h,mgf1Md:d})}catch(t){throw new Error(i(334)+(t instanceof Error?t[i(324)]:String(t)))}if("hex"===o)return r[i(357)][i(343)](p);if("base64"===o)return r.util.encode64(p);throw new Error(i(346)+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(t,e){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(t,e){t-=324;return c()[t]}function c(){const t=["81352QGeERN","2471jKuaZF","padStart","RSA-OAEP","util","constructor","2067687gMgTIF","message","replace","map","toString","encrypt","pki","from","create","hex","\n-----END PUBLIC KEY-----","RSA encryption failed: ","sha256","155096Kgmqqx","base64","28kOabrd","30OXYNVF","sha1","SHA-256","publicKeyFromPem","bytesToHex","163095gDDiAY","3016pxwqGc","Unsupported output encoding: ","prototype","construct","37695GzBdqq","4777760dAowKH","join","undefined"];return(c=function(){return t})()}var f,u,h,p,d,l,w,y;"function"==typeof SuppressedError&&SuppressedError,function(t){const e=a,n=t();for(;;)try{if(127616===-parseInt(e(336))/1+-parseInt(e(353))/2+-parseInt(e(349))/3*(parseInt(e(338))/4)+parseInt(e(344))/5*(-parseInt(e(339))/6)+parseInt(e(354))/7*(-parseInt(e(345))/8)+parseInt(e(359))/9+parseInt(e(350))/10)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(c),function(t){const e=E,n=t();for(;;)try{if(819180===parseInt(e(483))/1*(parseInt(e(458))/2)+-parseInt(e(460))/3+parseInt(e(471))/4*(parseInt(e(459))/5)+parseInt(e(477))/6*(-parseInt(e(465))/7)+parseInt(e(485))/8*(parseInt(e(455))/9)+parseInt(e(480))/10*(parseInt(e(489))/11)+parseInt(e(487))/12)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(I);const{sm2:m,sm4:v}=n;function I(){const t=["random","ecb","3165510cEeEjM","now","set","136370LBHPxk","getPublicHeaders","then","3943OwWyrB","setAccessToken","7632YlyWNT","length","4743720bWGrGI","undefined","649HLYpLJ","0123456789","8649yYpFPu","encrypt","toUpperCase","656PBWhlm","145wrrsqV","4460364DNwWtk","floor","X-N","X-T","toString","21rlYOJp","number","decrypt","match","alphanumeric","visitorId","66032VHMDaG","doSignature","长度必须是整数","call"];return(I=function(){return t})()}function g(t){return i(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function E(t,e){t-=455;return I()[t]}function b(t,e={}){const n=E,{allowLeadingZero:r=!1,type:i=n(466)}=e;if(!Number.isInteger(t))throw new Error(n(473));const o={number:n(490),alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},s=o[i]||o[n(466)];let a="";r||i!==n(466)?a+=s[Math[n(461)](Math[n(475)]()*s[n(486)])]:a+=s[Math[n(461)](9*Math[n(475)]()+1)];for(let e=1;e<t;e++)a+=s[Math[n(461)](Math[n(475)]()*s.length)];return a}class M{constructor(t,n={}){const r=E;f[r(479)](this,""),u[r(479)](this,""),h[r(479)](this,""),p.set(this,""),d[r(479)](this,!1),l[r(479)](this,""),w[r(479)](this,t=>{const e=r;var n,i,s,a,c;if(!t)return"";let f=null===(i=null===(n=v[e(467)](t,o(this,u,"f"),{mode:e(476)}))||void 0===n?void 0:n.trim)||void 0===i?void 0:i[e(474)](n);if(/^[0-9A-Fa-f]{64}$/.test(f))f=f.toUpperCase();else{const t=null===(s=null==f?void 0:f[e(468)])||void 0===s?void 0:s.call(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.toUpperCase)||void 0===c?void 0:c[e(474)](a);else{const t=f[e(468)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(f=t[1][e(457)]())}}return f}),y[r(479)](this,()=>i(this,void 0,void 0,function*(){const t=r;return o(this,h,"f")?o(this,h,"f"):o(this,d,"f")?(yield g(100),yield o(this,y,"f")[t(474)](this)):(s(this,d,!0,"f"),e.load().then(t=>t.get())[t(482)](e=>{const n=t;return s(this,d,!1,"f"),s(this,h,o(this,p,"f")+e[n(470)],"f"),o(this,h,"f")}))})),this[r(484)]=t=>{const e=r;t&&s(this,l,o(this,w,"f")[e(474)](this,t),"f")},this.getRegisterBody=()=>i(this,void 0,void 0,function*(){const t=r;o(this,h,"f")||(yield o(this,y,"f").call(this));const e={d:o(this,h,"f"),n:b(32,{type:t(469)}),t:Date.now()[t(464)](),s:""},n=e.d+e.t+e.n;return e.s=v[t(456)](n,o(this,u,"f"),{mode:t(476)}),e}),this[r(481)]=()=>i(this,void 0,void 0,function*(){const t=r;var e,n;if(o(this,h,"f")||(yield o(this,y,"f").call(this)),!o(this,l,"f"))return yield g(100),yield this[t(481)]();const i={"X-T":Date[t(478)]()[t(464)](),"X-N":b(32,{type:"alphanumeric"}),"X-DI":o(this,h,"f"),"X-S":""},s=o(this,u,"f")+o(this,h,"f")+i[t(462)]+i[t(463)];return i["X-S"]=null===(n=null===(e=m[t(472)](s,o(this,l,"f"),{hash:!0,der:!1,mode:0,userId:o(this,f,"f")}))||void 0===e?void 0:e[t(457)])||void 0===n?void 0:n[t(474)](e),i});const{uId:a="1234567812345678",deviceId:c,deviceIdPrefix:I=""}=n;s(this,u,t,"f"),s(this,f,a,"f"),s(this,p,I,"f"),c?s(this,h,c,"f"):typeof window!==r(488)&&"undefined"!=typeof document&&o(this,y,"f")[r(474)](this)}}f=new WeakMap,u=new WeakMap,h=new WeakMap,p=new WeakMap,d=new WeakMap,l=new WeakMap,w=new WeakMap,y=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(352)&&Reflect[r(348)]?Reflect[r(348)](t,e):new t(...e),n)}});return r[e(347)][e(358)]=r,r}(M);t.BaseOmUtils=M,t.OmUtils=P,t.default=P,t.rsaOaepEncrypt=function(t,e,n={}){const i=a,{outputEncoding:o=i(332),oaepHash:s=i(341),mgf1Hash:c=s}=n,f=function(t){const e=a;return t[e(325)](/-----BEGIN PUBLIC KEY-----/,"")[e(325)](/-----END PUBLIC KEY-----/,"")[e(325)](/\s/g,"")}(e);let u;try{u=r[i(329)][i(342)](f)}catch(t){try{const t="-----BEGIN PUBLIC KEY-----\n"+f+i(333);u=r[i(329)][i(342)](t)}catch(t){throw new Error("Invalid public key: "+(t instanceof Error?t[i(324)]:String(t)))}}const h=s===i(341)?r.md[i(335)][i(331)]():r.md[i(340)][i(331)](),p=c===i(341)?r.md[i(335)].create():r.md[i(340)].create();let d;try{d=u[i(328)](t,i(356),{md:h,mgf1Md:p})}catch(t){throw new Error(i(334)+(t instanceof Error?t[i(324)]:String(t)))}if("hex"===o)return r[i(357)][i(343)](d);if("base64"===o)return r.util.encode64(d);throw new Error(i(346)+o)},Object.defineProperty(t,"__esModule",{value:!0})});
|