@a-drowned-fish/om-utils 1.0.23 → 1.0.25
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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,n,r,i,o,s,a,c,h,u,f=require("@fingerprintjs/fingerprintjs"),d=require("sm-crypto"),p=require("node-forge");function l(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 w(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 v(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 m(){const t=["pki","248tJjSmV","replace","publicKeyFromPem","encrypt","undefined","hex","RSA encryption failed: ","-----BEGIN PUBLIC KEY-----\n","sha1","610491qVPjdK","2639748gfmzyB","bytesToHex","Invalid public key: ","construct","6220280MIxHix","RSA-OAEP","180MhXdii","5rJFzhW","192284JGmcHr","util","10909ZOucyk","sha256","base64","padStart","98427euuncX","map","toString","Unsupported output encoding: ","5402340XmyhUW","create","\n-----END PUBLIC KEY-----","message","SHA-256"];return(m=function(){return t})()}function y(t,e){t-=120;return m()[t]}function I(){const t=["undefined","X-N","alphanumeric","set","toUpperCase","658185ttOqjG","call","X-S","30499zqGAiO","crypto","144VVnvUo","number","load","then","trim","isInteger","getRegisterBody","visitorId","encrypt","floor","getPublicHeaders","doSignature","4235735pAshfN","toString","22jVAZdA","getRandomValues","random","234BXSjJK","1234567812345678","now","12405530VrzKoz","1569212XKMKzt","get","msCrypto","52688hvXhQc","length","match","70911NRzPoI","cbc","test"];return(I=function(){return t})()}"function"==typeof SuppressedError&&SuppressedError,function(){const t=y,e=m();for(;;)try{if(852219===parseInt(t(153))/1*(parseInt(t(149))/2)+-parseInt(t(142))/3+parseInt(t(151))/4+parseInt(t(150))/5*(parseInt(t(143))/6)+parseInt(t(123))/7*(-parseInt(t(133))/8)+-parseInt(t(127))/9+parseInt(t(147))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),function(){const t=k,e=I();for(;;)try{if(461622===parseInt(t(141))/1+parseInt(t(120))/2*(-parseInt(t(133))/3)+parseInt(t(127))/4+parseInt(t(118))/5+parseInt(t(123))/6*(parseInt(t(144))/7)+parseInt(t(130))/8*(-parseInt(t(146))/9)+-parseInt(t(126))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const{sm2:g,sm4:E}=d;function M(t){return l(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function b(t,e={}){const n=k,{allowLeadingZero:r=!1,type:i="number"}=e;if(!Number[n(111)](t))throw new Error("长度必须是整数");const o={number:"0123456789",alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},s=o[i]||o[n(107)];let a="";r||i!==n(107)?a+=s[Math[n(115)](Math.random()*s.length)]:a+=s[Math[n(115)](9*Math[n(122)]()+1)];for(let e=1;e<t;e++)a+=s[Math[n(115)](Math[n(122)]()*s[n(131)])];return a}function k(t,e){t-=107;return I()[t]}class P{constructor(d,p={}){const m=k;t[m(139)](this,""),e[m(139)](this,""),n[m(139)](this,""),r[m(139)](this,""),i[m(139)](this,!1),o[m(139)](this,""),s.set(this,()=>"undefined"!=typeof window&&typeof document!==m(136)),a.set(this,()=>{const t=m;return w(this,s,"f").call(this)?window[t(145)]||window[t(129)]:null}),c[m(139)](this,()=>{const t=m;var e,n;return null===(n=null===(e=w(this,a,"f")[t(142)](this))||void 0===e?void 0:e[t(121)])||void 0===n?void 0:n[t(142)](e,new Uint8Array(16))}),h[m(139)](this,t=>{const n=m;var r,i,o,s,a;if(!t)return"";let h=null===(i=null===(r=E.decrypt(t,w(this,e,"f"),{mode:"cbc",iv:w(this,c,"f")[n(142)](this)}))||void 0===r?void 0:r[n(110)])||void 0===i?void 0:i[n(142)](r);if(/^[0-9A-Fa-f]{64}$/[n(135)](h))h=h.toUpperCase();else{const t=null===(o=null==h?void 0:h[n(132)])||void 0===o?void 0:o[n(142)](h,/0201010420([0-9A-Fa-f]{64})/i);if(t&&(null==t?void 0:t[1]))h=null===(a=null===(s=t[1])||void 0===s?void 0:s[n(140)])||void 0===a?void 0:a[n(142)](s);else{const t=h[n(132)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(h=t[1].toUpperCase())}}return h}),u.set(this,()=>l(this,void 0,void 0,function*(){const t=m;return w(this,n,"f")?w(this,n,"f"):w(this,i,"f")?(yield M(100),yield w(this,u,"f")[t(142)](this)):(v(this,i,!0,"f"),f[t(108)]()[t(109)](e=>e[t(128)]()).then(e=>{const o=t;return v(this,i,!1,"f"),v(this,n,w(this,r,"f")+e[o(113)],"f"),w(this,n,"f")}))})),this.setAccessToken=t=>{const e=m;t&&v(this,o,w(this,h,"f")[e(142)](this,t),"f")},this[m(112)]=()=>l(this,void 0,void 0,function*(){const t=m;w(this,n,"f")||(yield w(this,u,"f").call(this));const r={d:w(this,n,"f"),n:b(32,{type:"alphanumeric"}),t:Date[t(125)]().toString(),s:""},i=r.d+r.t+r.n;return r.s=E[t(114)](i,w(this,e,"f"),{mode:t(134),iv:w(this,c,"f")[t(142)](this)}),r}),this[m(116)]=()=>l(this,void 0,void 0,function*(){const r=m;var i,s;if(w(this,n,"f")||(yield w(this,u,"f")[r(142)](this)),!w(this,o,"f"))return yield M(100),yield this[r(116)]();const a={"X-T":Date.now()[r(119)](),"X-N":b(32,{type:r(138)}),"X-DI":w(this,n,"f"),"X-S":""},c=w(this,e,"f")+w(this,n,"f")+a[r(137)]+a["X-T"];return a[r(143)]=null===(s=null===(i=g[r(117)](c,w(this,o,"f"),{hash:!0,der:!1,mode:0,userId:w(this,t,"f")}))||void 0===i?void 0:i[r(140)])||void 0===s?void 0:s[r(142)](i),a});const{uId:y=m(124),deviceId:I,deviceIdPrefix:P=""}=p;v(this,e,d,"f"),v(this,t,y,"f"),v(this,r,P,"f"),I?v(this,n,I,"f"):typeof window!==m(136)&&typeof document!==m(136)&&w(this,u,"f")[m(142)](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,h=new WeakMap,u=new WeakMap;const S=function(t){let e=null;const n=new Proxy(t,{construct(t,n){const r=y;return e||(e=typeof Reflect!==r(137)&&Reflect[r(146)]?Reflect[r(146)](t,n):new t(...n),e)}});return n.prototype.constructor=n,n}(P);exports.BaseOmUtils=P,exports.OmUtils=S,exports.default=S,exports.rsaOaepEncrypt=function(t,e,n={}){const r=y,{outputEncoding:i=r(138),oaepHash:o="SHA-256",mgf1Hash:s=o}=n,a=function(t){const e=y;return t[e(134)](/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"")[e(134)](/\s/g,"")}(e);let c;try{c=p[r(132)][r(135)](a)}catch(t){try{const t=r(140)+a+r(129);c=p[r(132)][r(135)](t)}catch(t){throw new Error(r(145)+(t instanceof Error?t[r(130)]:String(t)))}}const h=o===r(131)?p.md[r(120)][r(128)]():p.md.sha1[r(128)](),u=s===r(131)?p.md[r(120)][r(128)]():p.md[r(141)].create();let f;try{f=c[r(136)](t,r(148),{md:h,mgf1Md:u})}catch(t){throw new Error(r(139)+(t instanceof Error?t[r(130)]:String(t)))}if(i===r(138))return p[r(152)][r(144)](f);if(i===r(121))return p.util.encode64(f);throw new Error(r(126)+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(t,e,r={}){const i=c,{outputEncoding: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(){const t=["pki","248tJjSmV","replace","publicKeyFromPem","encrypt","undefined","hex","RSA encryption failed: ","-----BEGIN PUBLIC KEY-----\n","sha1","610491qVPjdK","2639748gfmzyB","bytesToHex","Invalid public key: ","construct","6220280MIxHix","RSA-OAEP","180MhXdii","5rJFzhW","192284JGmcHr","util","10909ZOucyk","sha256","base64","padStart","98427euuncX","map","toString","Unsupported output encoding: ","5402340XmyhUW","create","\n-----END PUBLIC KEY-----","message","SHA-256"];return(s=function(){return t})()}function a(t,e,r={}){const i=c,{outputEncoding:o=i(138),oaepHash:s="SHA-256",mgf1Hash:a=s}=r,h=function(t){const e=c;return t[e(134)](/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"")[e(134)](/\s/g,"")}(e);let f;try{f=n[i(132)][i(135)](h)}catch(t){try{const t=i(140)+h+i(129);f=n[i(132)][i(135)](t)}catch(t){throw new Error(i(145)+(t instanceof Error?t[i(130)]:String(t)))}}const u=s===i(131)?n.md[i(120)][i(128)]():n.md.sha1[i(128)](),d=a===i(131)?n.md[i(120)][i(128)]():n.md[i(141)].create();let p;try{p=f[i(136)](t,i(148),{md:u,mgf1Md:d})}catch(t){throw new Error(i(139)+(t instanceof Error?t[i(130)]:String(t)))}if(o===i(138))return n[i(152)][i(144)](p);if(o===i(121))return n.util.encode64(p);throw new Error(i(126)+o)}function c(t,e){t-=120;return s()[t]}var h,f,u,d,p,l,w,m,v,y,I;function g(){const t=["undefined","X-N","alphanumeric","set","toUpperCase","658185ttOqjG","call","X-S","30499zqGAiO","crypto","144VVnvUo","number","load","then","trim","isInteger","getRegisterBody","visitorId","encrypt","floor","getPublicHeaders","doSignature","4235735pAshfN","toString","22jVAZdA","getRandomValues","random","234BXSjJK","1234567812345678","now","12405530VrzKoz","1569212XKMKzt","get","msCrypto","52688hvXhQc","length","match","70911NRzPoI","cbc","test"];return(g=function(){return t})()}"function"==typeof SuppressedError&&SuppressedError,function(){const t=c,e=s();for(;;)try{if(852219===parseInt(t(153))/1*(parseInt(t(149))/2)+-parseInt(t(142))/3+parseInt(t(151))/4+parseInt(t(150))/5*(parseInt(t(143))/6)+parseInt(t(123))/7*(-parseInt(t(133))/8)+-parseInt(t(127))/9+parseInt(t(147))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),function(){const t=S,e=g();for(;;)try{if(461622===parseInt(t(141))/1+parseInt(t(120))/2*(-parseInt(t(133))/3)+parseInt(t(127))/4+parseInt(t(118))/5+parseInt(t(123))/6*(parseInt(t(144))/7)+parseInt(t(130))/8*(-parseInt(t(146))/9)+-parseInt(t(126))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const{sm2:E,sm4:M}=e;function b(t){return r(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function k(t,e={}){const n=S,{allowLeadingZero:r=!1,type:i="number"}=e;if(!Number[n(111)](t))throw new Error("长度必须是整数");const o={number:"0123456789",alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},s=o[i]||o[n(107)];let a="";r||i!==n(107)?a+=s[Math[n(115)](Math.random()*s.length)]:a+=s[Math[n(115)](9*Math[n(122)]()+1)];for(let e=1;e<t;e++)a+=s[Math[n(115)](Math[n(122)]()*s[n(131)])];return a}function S(t,e){t-=107;return g()[t]}class P{constructor(e,n={}){const s=S;h[s(139)](this,""),f[s(139)](this,""),u[s(139)](this,""),d[s(139)](this,""),p[s(139)](this,!1),l[s(139)](this,""),w.set(this,()=>"undefined"!=typeof window&&typeof document!==s(136)),m.set(this,()=>{const t=s;return i(this,w,"f").call(this)?window[t(145)]||window[t(129)]:null}),v[s(139)](this,()=>{const t=s;var e,n;return null===(n=null===(e=i(this,m,"f")[t(142)](this))||void 0===e?void 0:e[t(121)])||void 0===n?void 0:n[t(142)](e,new Uint8Array(16))}),y[s(139)](this,t=>{const e=s;var n,r,o,a,c;if(!t)return"";let h=null===(r=null===(n=M.decrypt(t,i(this,f,"f"),{mode:"cbc",iv:i(this,v,"f")[e(142)](this)}))||void 0===n?void 0:n[e(110)])||void 0===r?void 0:r[e(142)](n);if(/^[0-9A-Fa-f]{64}$/[e(135)](h))h=h.toUpperCase();else{const t=null===(o=null==h?void 0:h[e(132)])||void 0===o?void 0:o[e(142)](h,/0201010420([0-9A-Fa-f]{64})/i);if(t&&(null==t?void 0:t[1]))h=null===(c=null===(a=t[1])||void 0===a?void 0:a[e(140)])||void 0===c?void 0:c[e(142)](a);else{const t=h[e(132)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(h=t[1].toUpperCase())}}return h}),I.set(this,()=>r(this,void 0,void 0,function*(){const e=s;return i(this,u,"f")?i(this,u,"f"):i(this,p,"f")?(yield b(100),yield i(this,I,"f")[e(142)](this)):(o(this,p,!0,"f"),t[e(108)]()[e(109)](t=>t[e(128)]()).then(t=>{const n=e;return o(this,p,!1,"f"),o(this,u,i(this,d,"f")+t[n(113)],"f"),i(this,u,"f")}))})),this.setAccessToken=t=>{const e=s;t&&o(this,l,i(this,y,"f")[e(142)](this,t),"f")},this[s(112)]=()=>r(this,void 0,void 0,function*(){const t=s;i(this,u,"f")||(yield i(this,I,"f").call(this));const e={d:i(this,u,"f"),n:k(32,{type:"alphanumeric"}),t:Date[t(125)]().toString(),s:""},n=e.d+e.t+e.n;return e.s=M[t(114)](n,i(this,f,"f"),{mode:t(134),iv:i(this,v,"f")[t(142)](this)}),e}),this[s(116)]=()=>r(this,void 0,void 0,function*(){const t=s;var e,n;if(i(this,u,"f")||(yield i(this,I,"f")[t(142)](this)),!i(this,l,"f"))return yield b(100),yield this[t(116)]();const r={"X-T":Date.now()[t(119)](),"X-N":k(32,{type:t(138)}),"X-DI":i(this,u,"f"),"X-S":""},o=i(this,f,"f")+i(this,u,"f")+r[t(137)]+r["X-T"];return r[t(143)]=null===(n=null===(e=E[t(117)](o,i(this,l,"f"),{hash:!0,der:!1,mode:0,userId:i(this,h,"f")}))||void 0===e?void 0:e[t(140)])||void 0===n?void 0:n[t(142)](e),r});const{uId:a=s(124),deviceId:c,deviceIdPrefix:g=""}=n;o(this,f,e,"f"),o(this,h,a,"f"),o(this,d,g,"f"),c?o(this,u,c,"f"):typeof window!==s(136)&&typeof document!==s(136)&&i(this,I,"f")[s(142)](this)}}h=new WeakMap,f=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakMap,l=new WeakMap,w=new WeakMap,m=new WeakMap,v=new WeakMap,y=new WeakMap,I=new WeakMap;const A=function(t){let e=null;const n=new Proxy(t,{construct(t,n){const r=c;return e||(e=typeof Reflect!==r(137)&&Reflect[r(146)]?Reflect[r(146)](t,n):new t(...n),e)}});return n.prototype.constructor=n,n}(P);export{P as BaseOmUtils,A as OmUtils,A 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,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=["pki","248tJjSmV","replace","publicKeyFromPem","encrypt","undefined","hex","RSA encryption failed: ","-----BEGIN PUBLIC KEY-----\n","sha1","610491qVPjdK","2639748gfmzyB","bytesToHex","Invalid public key: ","construct","6220280MIxHix","RSA-OAEP","180MhXdii","5rJFzhW","192284JGmcHr","util","10909ZOucyk","sha256","base64","padStart","98427euuncX","map","toString","Unsupported output encoding: ","5402340XmyhUW","create","\n-----END PUBLIC KEY-----","message","SHA-256"];return(a=function(){return t})()}function c(t,e){t-=120;return a()[t]}var h,u,f,d,p,l,w,v,m,y,I;function g(){const t=["undefined","X-N","alphanumeric","set","toUpperCase","658185ttOqjG","call","X-S","30499zqGAiO","crypto","144VVnvUo","number","load","then","trim","isInteger","getRegisterBody","visitorId","encrypt","floor","getPublicHeaders","doSignature","4235735pAshfN","toString","22jVAZdA","getRandomValues","random","234BXSjJK","1234567812345678","now","12405530VrzKoz","1569212XKMKzt","get","msCrypto","52688hvXhQc","length","match","70911NRzPoI","cbc","test"];return(g=function(){return t})()}"function"==typeof SuppressedError&&SuppressedError,function(t){const e=c,n=t();for(;;)try{if(852219===parseInt(e(153))/1*(parseInt(e(149))/2)+-parseInt(e(142))/3+parseInt(e(151))/4+parseInt(e(150))/5*(parseInt(e(143))/6)+parseInt(e(123))/7*(-parseInt(e(133))/8)+-parseInt(e(127))/9+parseInt(e(147))/10)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(a),function(t){const e=k,n=t();for(;;)try{if(461622===parseInt(e(141))/1+parseInt(e(120))/2*(-parseInt(e(133))/3)+parseInt(e(127))/4+parseInt(e(118))/5+parseInt(e(123))/6*(parseInt(e(144))/7)+parseInt(e(130))/8*(-parseInt(e(146))/9)+-parseInt(e(126))/10)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(g);const{sm2:E,sm4:M}=n;function b(t){return i(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function S(t,e={}){const n=k,{allowLeadingZero:r=!1,type:i="number"}=e;if(!Number[n(111)](t))throw new Error("长度必须是整数");const o={number:"0123456789",alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},s=o[i]||o[n(107)];let a="";r||i!==n(107)?a+=s[Math[n(115)](Math.random()*s.length)]:a+=s[Math[n(115)](9*Math[n(122)]()+1)];for(let e=1;e<t;e++)a+=s[Math[n(115)](Math[n(122)]()*s[n(131)])];return a}function k(t,e){t-=107;return g()[t]}class P{constructor(t,n={}){const r=k;h[r(139)](this,""),u[r(139)](this,""),f[r(139)](this,""),d[r(139)](this,""),p[r(139)](this,!1),l[r(139)](this,""),w.set(this,()=>"undefined"!=typeof window&&typeof document!==r(136)),v.set(this,()=>{const t=r;return o(this,w,"f").call(this)?window[t(145)]||window[t(129)]:null}),m[r(139)](this,()=>{const t=r;var e,n;return null===(n=null===(e=o(this,v,"f")[t(142)](this))||void 0===e?void 0:e[t(121)])||void 0===n?void 0:n[t(142)](e,new Uint8Array(16))}),y[r(139)](this,t=>{const e=r;var n,i,s,a,c;if(!t)return"";let h=null===(i=null===(n=M.decrypt(t,o(this,u,"f"),{mode:"cbc",iv:o(this,m,"f")[e(142)](this)}))||void 0===n?void 0:n[e(110)])||void 0===i?void 0:i[e(142)](n);if(/^[0-9A-Fa-f]{64}$/[e(135)](h))h=h.toUpperCase();else{const t=null===(s=null==h?void 0:h[e(132)])||void 0===s?void 0:s[e(142)](h,/0201010420([0-9A-Fa-f]{64})/i);if(t&&(null==t?void 0:t[1]))h=null===(c=null===(a=t[1])||void 0===a?void 0:a[e(140)])||void 0===c?void 0:c[e(142)](a);else{const t=h[e(132)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(h=t[1].toUpperCase())}}return h}),I.set(this,()=>i(this,void 0,void 0,function*(){const t=r;return o(this,f,"f")?o(this,f,"f"):o(this,p,"f")?(yield b(100),yield o(this,I,"f")[t(142)](this)):(s(this,p,!0,"f"),e[t(108)]()[t(109)](e=>e[t(128)]()).then(e=>{const n=t;return s(this,p,!1,"f"),s(this,f,o(this,d,"f")+e[n(113)],"f"),o(this,f,"f")}))})),this.setAccessToken=t=>{const e=r;t&&s(this,l,o(this,y,"f")[e(142)](this,t),"f")},this[r(112)]=()=>i(this,void 0,void 0,function*(){const t=r;o(this,f,"f")||(yield o(this,I,"f").call(this));const e={d:o(this,f,"f"),n:S(32,{type:"alphanumeric"}),t:Date[t(125)]().toString(),s:""},n=e.d+e.t+e.n;return e.s=M[t(114)](n,o(this,u,"f"),{mode:t(134),iv:o(this,m,"f")[t(142)](this)}),e}),this[r(116)]=()=>i(this,void 0,void 0,function*(){const t=r;var e,n;if(o(this,f,"f")||(yield o(this,I,"f")[t(142)](this)),!o(this,l,"f"))return yield b(100),yield this[t(116)]();const i={"X-T":Date.now()[t(119)](),"X-N":S(32,{type:t(138)}),"X-DI":o(this,f,"f"),"X-S":""},s=o(this,u,"f")+o(this,f,"f")+i[t(137)]+i["X-T"];return i[t(143)]=null===(n=null===(e=E[t(117)](s,o(this,l,"f"),{hash:!0,der:!1,mode:0,userId:o(this,h,"f")}))||void 0===e?void 0:e[t(140)])||void 0===n?void 0:n[t(142)](e),i});const{uId:a=r(124),deviceId:c,deviceIdPrefix:g=""}=n;s(this,u,t,"f"),s(this,h,a,"f"),s(this,d,g,"f"),c?s(this,f,c,"f"):typeof window!==r(136)&&typeof document!==r(136)&&o(this,I,"f")[r(142)](this)}}h=new WeakMap,u=new WeakMap,f=new WeakMap,d=new WeakMap,p=new WeakMap,l=new WeakMap,w=new WeakMap,v=new WeakMap,m=new WeakMap,y=new WeakMap,I=new WeakMap;const A=function(t){let e=null;const n=new Proxy(t,{construct(t,n){const r=c;return e||(e=typeof Reflect!==r(137)&&Reflect[r(146)]?Reflect[r(146)](t,n):new t(...n),e)}});return n.prototype.constructor=n,n}(P);return t.BaseOmUtils=P,t.OmUtils=A,t.default=A,t.rsaOaepEncrypt=function(t,e,n={}){const i=c,{outputEncoding:o=i(138),oaepHash:s="SHA-256",mgf1Hash:a=s}=n,h=function(t){const e=c;return t[e(134)](/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"")[e(134)](/\s/g,"")}(e);let u;try{u=r[i(132)][i(135)](h)}catch(t){try{const t=i(140)+h+i(129);u=r[i(132)][i(135)](t)}catch(t){throw new Error(i(145)+(t instanceof Error?t[i(130)]:String(t)))}}const f=s===i(131)?r.md[i(120)][i(128)]():r.md.sha1[i(128)](),d=a===i(131)?r.md[i(120)][i(128)]():r.md[i(141)].create();let p;try{p=u[i(136)](t,i(148),{md:f,mgf1Md:d})}catch(t){throw new Error(i(139)+(t instanceof Error?t[i(130)]:String(t)))}if(o===i(138))return r[i(152)][i(144)](p);if(o===i(121))return r.util.encode64(p);throw new Error(i(126)+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=["pki","248tJjSmV","replace","publicKeyFromPem","encrypt","undefined","hex","RSA encryption failed: ","-----BEGIN PUBLIC KEY-----\n","sha1","610491qVPjdK","2639748gfmzyB","bytesToHex","Invalid public key: ","construct","6220280MIxHix","RSA-OAEP","180MhXdii","5rJFzhW","192284JGmcHr","util","10909ZOucyk","sha256","base64","padStart","98427euuncX","map","toString","Unsupported output encoding: ","5402340XmyhUW","create","\n-----END PUBLIC KEY-----","message","SHA-256"];return(a=function(){return t})()}function c(t,e){t-=120;return a()[t]}var f,u,h,d,p,l,w,y,m,v,I;function g(){const t=["undefined","X-N","alphanumeric","set","toUpperCase","658185ttOqjG","call","X-S","30499zqGAiO","crypto","144VVnvUo","number","load","then","trim","isInteger","getRegisterBody","visitorId","encrypt","floor","getPublicHeaders","doSignature","4235735pAshfN","toString","22jVAZdA","getRandomValues","random","234BXSjJK","1234567812345678","now","12405530VrzKoz","1569212XKMKzt","get","msCrypto","52688hvXhQc","length","match","70911NRzPoI","cbc","test"];return(g=function(){return t})()}"function"==typeof SuppressedError&&SuppressedError,function(t){const e=c,n=t();for(;;)try{if(852219===parseInt(e(153))/1*(parseInt(e(149))/2)+-parseInt(e(142))/3+parseInt(e(151))/4+parseInt(e(150))/5*(parseInt(e(143))/6)+parseInt(e(123))/7*(-parseInt(e(133))/8)+-parseInt(e(127))/9+parseInt(e(147))/10)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(a),function(t){const e=k,n=t();for(;;)try{if(461622===parseInt(e(141))/1+parseInt(e(120))/2*(-parseInt(e(133))/3)+parseInt(e(127))/4+parseInt(e(118))/5+parseInt(e(123))/6*(parseInt(e(144))/7)+parseInt(e(130))/8*(-parseInt(e(146))/9)+-parseInt(e(126))/10)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(g);const{sm2:E,sm4:M}=n;function b(t){return i(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function S(t,e={}){const n=k,{allowLeadingZero:r=!1,type:i="number"}=e;if(!Number[n(111)](t))throw new Error("长度必须是整数");const o={number:"0123456789",alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},s=o[i]||o[n(107)];let a="";r||i!==n(107)?a+=s[Math[n(115)](Math.random()*s.length)]:a+=s[Math[n(115)](9*Math[n(122)]()+1)];for(let e=1;e<t;e++)a+=s[Math[n(115)](Math[n(122)]()*s[n(131)])];return a}function k(t,e){t-=107;return g()[t]}class P{constructor(t,n={}){const r=k;f[r(139)](this,""),u[r(139)](this,""),h[r(139)](this,""),d[r(139)](this,""),p[r(139)](this,!1),l[r(139)](this,""),w.set(this,()=>"undefined"!=typeof window&&typeof document!==r(136)),y.set(this,()=>{const t=r;return o(this,w,"f").call(this)?window[t(145)]||window[t(129)]:null}),m[r(139)](this,()=>{const t=r;var e,n;return null===(n=null===(e=o(this,y,"f")[t(142)](this))||void 0===e?void 0:e[t(121)])||void 0===n?void 0:n[t(142)](e,new Uint8Array(16))}),v[r(139)](this,t=>{const e=r;var n,i,s,a,c;if(!t)return"";let f=null===(i=null===(n=M.decrypt(t,o(this,u,"f"),{mode:"cbc",iv:o(this,m,"f")[e(142)](this)}))||void 0===n?void 0:n[e(110)])||void 0===i?void 0:i[e(142)](n);if(/^[0-9A-Fa-f]{64}$/[e(135)](f))f=f.toUpperCase();else{const t=null===(s=null==f?void 0:f[e(132)])||void 0===s?void 0:s[e(142)](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(140)])||void 0===c?void 0:c[e(142)](a);else{const t=f[e(132)](/04([0-9A-Fa-f]{64})/i);t&&t[1]&&(f=t[1].toUpperCase())}}return f}),I.set(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 b(100),yield o(this,I,"f")[t(142)](this)):(s(this,p,!0,"f"),e[t(108)]()[t(109)](e=>e[t(128)]()).then(e=>{const n=t;return s(this,p,!1,"f"),s(this,h,o(this,d,"f")+e[n(113)],"f"),o(this,h,"f")}))})),this.setAccessToken=t=>{const e=r;t&&s(this,l,o(this,v,"f")[e(142)](this,t),"f")},this[r(112)]=()=>i(this,void 0,void 0,function*(){const t=r;o(this,h,"f")||(yield o(this,I,"f").call(this));const e={d:o(this,h,"f"),n:S(32,{type:"alphanumeric"}),t:Date[t(125)]().toString(),s:""},n=e.d+e.t+e.n;return e.s=M[t(114)](n,o(this,u,"f"),{mode:t(134),iv:o(this,m,"f")[t(142)](this)}),e}),this[r(116)]=()=>i(this,void 0,void 0,function*(){const t=r;var e,n;if(o(this,h,"f")||(yield o(this,I,"f")[t(142)](this)),!o(this,l,"f"))return yield b(100),yield this[t(116)]();const i={"X-T":Date.now()[t(119)](),"X-N":S(32,{type:t(138)}),"X-DI":o(this,h,"f"),"X-S":""},s=o(this,u,"f")+o(this,h,"f")+i[t(137)]+i["X-T"];return i[t(143)]=null===(n=null===(e=E[t(117)](s,o(this,l,"f"),{hash:!0,der:!1,mode:0,userId:o(this,f,"f")}))||void 0===e?void 0:e[t(140)])||void 0===n?void 0:n[t(142)](e),i});const{uId:a=r(124),deviceId:c,deviceIdPrefix:g=""}=n;s(this,u,t,"f"),s(this,f,a,"f"),s(this,d,g,"f"),c?s(this,h,c,"f"):typeof window!==r(136)&&typeof document!==r(136)&&o(this,I,"f")[r(142)](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,v=new WeakMap,I=new WeakMap;const A=function(t){let e=null;const n=new Proxy(t,{construct(t,n){const r=c;return e||(e=typeof Reflect!==r(137)&&Reflect[r(146)]?Reflect[r(146)](t,n):new t(...n),e)}});return n.prototype.constructor=n,n}(P);t.BaseOmUtils=P,t.OmUtils=A,t.default=A,t.rsaOaepEncrypt=function(t,e,n={}){const i=c,{outputEncoding:o=i(138),oaepHash:s="SHA-256",mgf1Hash:a=s}=n,f=function(t){const e=c;return t[e(134)](/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"")[e(134)](/\s/g,"")}(e);let u;try{u=r[i(132)][i(135)](f)}catch(t){try{const t=i(140)+f+i(129);u=r[i(132)][i(135)](t)}catch(t){throw new Error(i(145)+(t instanceof Error?t[i(130)]:String(t)))}}const h=s===i(131)?r.md[i(120)][i(128)]():r.md.sha1[i(128)](),d=a===i(131)?r.md[i(120)][i(128)]():r.md[i(141)].create();let p;try{p=u[i(136)](t,i(148),{md:h,mgf1Md:d})}catch(t){throw new Error(i(139)+(t instanceof Error?t[i(130)]:String(t)))}if(o===i(138))return r[i(152)][i(144)](p);if(o===i(121))return r.util.encode64(p);throw new Error(i(126)+o)},Object.defineProperty(t,"__esModule",{value:!0})});
|