jwt-license-verifier 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import*as t from"crypto";import*as r from"systeminformation";import*as e from"jsonwebtoken";function n(){n=function(){return r};var t,r={},e=Object.prototype,o=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(t){f=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof g?r:g,a=Object.create(o.prototype),c=new N(n||[]);return i(a,"_invoke",{value:j(t,e,c)}),a}function l(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var p="suspendedStart",v="suspendedYield",y="executing",d="completed",m={};function g(){}function w(){}function b(){}var x={};f(x,c,(function(){return this}));var
|
1
|
+
import*as t from"crypto";import*as r from"systeminformation";import*as e from"jsonwebtoken";function n(){n=function(){return r};var t,r={},e=Object.prototype,o=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(t){f=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof g?r:g,a=Object.create(o.prototype),c=new N(n||[]);return i(a,"_invoke",{value:j(t,e,c)}),a}function l(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var p="suspendedStart",v="suspendedYield",y="executing",d="completed",m={};function g(){}function w(){}function b(){}var x={};f(x,c,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(B([])));L&&L!==e&&o.call(L,c)&&(x=L);var k=b.prototype=g.prototype=Object.create(x);function O(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function P(t,r){function e(n,i,a,c){var u=l(t[n],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&o.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}})}function j(r,e,n){var o=p;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=A(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=l(r,e,n);if("normal"===s.type){if(o=n.done?d:v,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function A(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,A(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=l(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function G(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function I(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(G,this),this.reset(!0)}function B(r){if(r||""===r){var e=r[c];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var n=-1,i=function e(){for(;++n<r.length;)if(o.call(r,n))return e.value=r[n],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return w.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:w,configurable:!0}),w.displayName=f(b,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===w||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,f(t,s,"GeneratorFunction")),t.prototype=Object.create(k),t},r.awrap=function(t){return{__await:t}},O(P.prototype),f(P.prototype,u,(function(){return this})),r.AsyncIterator=P,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new P(h(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(k),f(k,s,"Generator"),f(k,c,(function(){return this})),f(k,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=B,N.prototype={constructor:N,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!r)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),m},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),I(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;I(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:B(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function o(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var r=this,e=arguments;return new Promise((function(n,i){var a=t.apply(r,e);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))}}var a=function(){var e=i(n().mark((function e(o){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=i(n().mark((function e(i,a){var c,u,s,f,h;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.baseboard();case 3:return c=e.sent,u="".concat(c.manufacturer,"-:-").concat(c.model,"-:-").concat(c.version,"-::-"),e.next=7,r.system();case 7:s=e.sent,f="".concat(s.serial,"-:-").concat(s.uuid),h=(n=u+f,l=void 0,l=t.createHash("md5").update(n).digest("hex"),"".concat(l.substring(0,8),"-").concat(l.substring(8,12),"-").concat(l.substring(12,16),"-").concat(l.substring(16,20),"-").concat(l.substring(20,32))).toUpperCase(),i("NI-".concat(o||"APP","-").concat(h)),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(0),a();case 17:case"end":return e.stop()}var n,l}),e,null,[[0,14]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function c(t,r,o){return new Promise((function(c,u){if(t&&""!==t.trim())e.verify(r,o||"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA45UBf0Yjw8nGDZDFk9jG\nHPvxW0LO/2k395nnwg/DdrP0WOQOxmxG68Z19+Uk5ISEu441VnDpEcYluvzfGOkR\nbLgx3nAcB818obIoRVZ+Y3xvYrXjJOlzrss++jDMyfIEqMBusm21v3r3PDGa8VpL\nt3/OXL/m6gWt6PAFTs6P307e1oebI53XBod0oTRfcv9sAwX+DosMWoKyR65yKuVg\nTqe9EmjqzZggbwGNQFYv4vUGAg36tFE1BzFsaqQkiXNcDYh3w6OMC9ktrLVX7gJi\nWY4EHImAWEGVCe/1BXY5tJEub2xFL0cyUnoVihwzn/x5ktQ1Bb7B/9PqiMFx98Lx\noQIDAQAB\n-----END PUBLIC KEY-----",function(){var r=i(n().mark((function r(e,o){var i,s,f,h,l,p,v,y,d;return n().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!e){r.next=4;break}u(e),r.next=28;break;case 4:if(o.hasOwnProperty("application")&&(i=o.application.name),o.hasOwnProperty("product")&&(i=o.product.name),i){r.next=9;break}return s=new Error("Neither 'application' nor 'product' was found"),r.abrupt("return",u(s));case 9:if(t==i){r.next=12;break}return f=new Error("You're trying to use the license for ".concat(i," in the ").concat(t," product")),r.abrupt("return",u(f));case 12:if(!o.hasOwnProperty("nodeinfo")){r.next=27;break}if(h=o.libraries||[],l=h.map((function(t){return t.name.toLowerCase()})),(p=t.toLowerCase())!==i.toLocaleLowerCase()&&!l.includes(p)){r.next=23;break}return r.next=19,a(i);case 19:v=r.sent,o.nodeinfo===v?c(o):(y=new Error("Node info does not match"),u(y)),r.next=25;break;case 23:d=new Error("appOrLibName '".concat(t,"' not present in application.name or libraries")),u(d);case 25:r.next=28;break;case 27:c(o||{});case 28:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}());else{var s=new Error("appOrLibName must be a non-empty string");u(s)}}))}function u(t,r){return new Promise((function(n,o){var i=e.decode(t,r||{});i?n(i):o(new Error("Cannot decode token"))}))}export{u as decodeLicense,a as getNodeInfo,c as verifyLicense};
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("crypto"),r=require("systeminformation"),e=require("jsonwebtoken");function n(t){if(t&&t.__esModule)return t;var r=Object.create(null);return t&&Object.keys(t).forEach((function(e){if("default"!==e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}})),r.default=t,Object.freeze(r)}var o=n(t),i=n(r),a=n(e);function c(){c=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||function(t,r,e){t[r]=e.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(t){f=function(t,r,e){return t[r]=e}}function l(t,r,e,n){var i=r&&r.prototype instanceof m?r:m,a=Object.create(i.prototype),c=new A(n||[]);return o(a,"_invoke",{value:j(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=l;var p="suspendedStart",v="suspendedYield",y="executing",d="completed",g={};function m(){}function w(){}function b(){}var x={};f(x,a,(function(){return this}));var L=Object.getPrototypeOf,E=L&&L(L(G([])));E&&E!==e&&n.call(E,a)&&(x=E);var O=b.prototype=m.prototype=Object.create(x);function k(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function P(t,r){function e(o,i,a,c){var u=h(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return i=i?i.then(o,o):o()}})}function j(r,e,n){var o=p;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(r,e,n);if("normal"===s.type){if(o=n.done?d:v,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function I(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,I(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,g):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function N(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function _(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function G(r){if(r||""===r){var e=r[a];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return w.prototype=b,o(O,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=f(b,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===w||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,f(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},r.awrap=function(t){return{__await:t}},k(P.prototype),f(P.prototype,u,(function(){return this})),r.AsyncIterator=P,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new P(l(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(O),f(O,s,"Generator"),f(O,a,(function(){return this})),f(O,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=G,A.prototype={constructor:A,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(_),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),g},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),_(e),g}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;_(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:G(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),g}},r}function u(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function s(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function a(t){u(i,n,o,a,c,"next",t)}function c(t){u(i,n,o,a,c,"throw",t)}a(void 0)}))}}var f=function(){var t=s(c().mark((function t(r){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=s(c().mark((function t(e,n){var a,u,s,f,l;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.baseboard();case 3:return a=t.sent,u="".concat(a.manufacturer,"-:-").concat(a.model,"-:-").concat(a.version,"-::-"),t.next=7,i.system();case 7:s=t.sent,f="".concat(s.serial,"-:-").concat(s.uuid),l=(c=u+f,h=void 0,h=o.createHash("md5").update(c).digest("hex"),"".concat(h.substring(0,8),"-").concat(h.substring(8,12),"-").concat(h.substring(12,16),"-").concat(h.substring(16,20),"-").concat(h.substring(20,32))).toUpperCase(),e("NI-".concat(r||"APP","-").concat(l)),t.next=17;break;case 14:t.prev=14,t.t0=t.catch(0),n();case 17:case"end":return t.stop()}var c,h}),t,null,[[0,14]])})));return function(r,e){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}();exports.decodeLicense=function(t,r){return new Promise((function(e,n){var o=a.decode(t,r||{});o?e(o):n(new Error("Cannot decode token"))}))},exports.getNodeInfo=f,exports.verifyLicense=function(t,r,e){return new Promise((function(n,o){if(t&&""!==t.trim())a.verify(r,e||"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA45UBf0Yjw8nGDZDFk9jG\nHPvxW0LO/2k395nnwg/DdrP0WOQOxmxG68Z19+Uk5ISEu441VnDpEcYluvzfGOkR\nbLgx3nAcB818obIoRVZ+Y3xvYrXjJOlzrss++jDMyfIEqMBusm21v3r3PDGa8VpL\nt3/OXL/m6gWt6PAFTs6P307e1oebI53XBod0oTRfcv9sAwX+DosMWoKyR65yKuVg\nTqe9EmjqzZggbwGNQFYv4vUGAg36tFE1BzFsaqQkiXNcDYh3w6OMC9ktrLVX7gJi\nWY4EHImAWEGVCe/1BXY5tJEub2xFL0cyUnoVihwzn/x5ktQ1Bb7B/9PqiMFx98Lx\noQIDAQAB\n-----END PUBLIC KEY-----",function(){var r=s(c().mark((function r(e,i){var a,u,s,l,h,p,v,y;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!e){r.next=4;break}o(e),r.next=25;break;case 4:if(i.hasOwnProperty("application")&&(a=i.application.name),i.hasOwnProperty("product")&&(a=i.product.name),a){r.next=9;break}return u=new Error("Neither 'application' nor 'product' was found"),r.abrupt("return",o(u));case 9:if(!i.hasOwnProperty("nodeinfo")){r.next=24;break}if(s=i.libraries||[],l=s.map((function(t){return t.name.toLowerCase()})),(h=t.toLowerCase())!==a.toLocaleLowerCase()&&!l.includes(h)){r.next=20;break}return r.next=16,f(a);case 16:p=r.sent,i.nodeinfo===p?n(i):(v=new Error("Node info does not match"),o(v)),r.next=22;break;case 20:y=new Error("appOrLibName '".concat(t,"' not present in application.name or libraries")),o(y);case 22:r.next=25;break;case 24:n(i||{});case 25:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}());else{var i=new Error("appOrLibName must be a non-empty string");o(i)}}))};
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("crypto"),r=require("systeminformation"),e=require("jsonwebtoken");function n(t){if(t&&t.__esModule)return t;var r=Object.create(null);return t&&Object.keys(t).forEach((function(e){if("default"!==e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}})),r.default=t,Object.freeze(r)}var o=n(t),i=n(r),a=n(e);function c(){c=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||function(t,r,e){t[r]=e.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(t){f=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var i=r&&r.prototype instanceof w?r:w,a=Object.create(i.prototype),c=new A(n||[]);return o(a,"_invoke",{value:j(t,e,c)}),a}function l(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var p="suspendedStart",v="suspendedYield",y="executing",d="completed",g={};function w(){}function m(){}function b(){}var x={};f(x,a,(function(){return this}));var L=Object.getPrototypeOf,E=L&&L(L(G([])));E&&E!==e&&n.call(E,a)&&(x=E);var O=b.prototype=w.prototype=Object.create(x);function k(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function P(t,r){function e(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return i=i?i.then(o,o):o()}})}function j(r,e,n){var o=p;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=l(r,e,n);if("normal"===s.type){if(o=n.done?d:v,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function I(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,I(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=l(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,g):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function N(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function _(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function G(r){if(r||""===r){var e=r[a];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return m.prototype=b,o(O,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:m,configurable:!0}),m.displayName=f(b,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===m||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,f(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},r.awrap=function(t){return{__await:t}},k(P.prototype),f(P.prototype,u,(function(){return this})),r.AsyncIterator=P,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new P(h(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(O),f(O,s,"Generator"),f(O,a,(function(){return this})),f(O,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=G,A.prototype={constructor:A,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(_),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),g},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),_(e),g}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;_(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:G(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),g}},r}function u(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function s(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function a(t){u(i,n,o,a,c,"next",t)}function c(t){u(i,n,o,a,c,"throw",t)}a(void 0)}))}}var f=function(){var t=s(c().mark((function t(r){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=s(c().mark((function t(e,n){var a,u,s,f,h;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.baseboard();case 3:return a=t.sent,u="".concat(a.manufacturer,"-:-").concat(a.model,"-:-").concat(a.version,"-::-"),t.next=7,i.system();case 7:s=t.sent,f="".concat(s.serial,"-:-").concat(s.uuid),h=(c=u+f,l=void 0,l=o.createHash("md5").update(c).digest("hex"),"".concat(l.substring(0,8),"-").concat(l.substring(8,12),"-").concat(l.substring(12,16),"-").concat(l.substring(16,20),"-").concat(l.substring(20,32))).toUpperCase(),e("NI-".concat(r||"APP","-").concat(h)),t.next=17;break;case 14:t.prev=14,t.t0=t.catch(0),n();case 17:case"end":return t.stop()}var c,l}),t,null,[[0,14]])})));return function(r,e){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}();exports.decodeLicense=function(t,r){return new Promise((function(e,n){var o=a.decode(t,r||{});o?e(o):n(new Error("Cannot decode token"))}))},exports.getNodeInfo=f,exports.verifyLicense=function(t,r,e){return new Promise((function(n,o){if(t&&""!==t.trim())a.verify(r,e||"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA45UBf0Yjw8nGDZDFk9jG\nHPvxW0LO/2k395nnwg/DdrP0WOQOxmxG68Z19+Uk5ISEu441VnDpEcYluvzfGOkR\nbLgx3nAcB818obIoRVZ+Y3xvYrXjJOlzrss++jDMyfIEqMBusm21v3r3PDGa8VpL\nt3/OXL/m6gWt6PAFTs6P307e1oebI53XBod0oTRfcv9sAwX+DosMWoKyR65yKuVg\nTqe9EmjqzZggbwGNQFYv4vUGAg36tFE1BzFsaqQkiXNcDYh3w6OMC9ktrLVX7gJi\nWY4EHImAWEGVCe/1BXY5tJEub2xFL0cyUnoVihwzn/x5ktQ1Bb7B/9PqiMFx98Lx\noQIDAQAB\n-----END PUBLIC KEY-----",function(){var r=s(c().mark((function r(e,i){var a,u,s,h,l,p,v,y,d;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!e){r.next=4;break}o(e),r.next=28;break;case 4:if(i.hasOwnProperty("application")&&(a=i.application.name),i.hasOwnProperty("product")&&(a=i.product.name),a){r.next=9;break}return u=new Error("Neither 'application' nor 'product' was found"),r.abrupt("return",o(u));case 9:if(t==a){r.next=12;break}return s=new Error("You're trying to use the license for ".concat(a," in the ").concat(t," product")),r.abrupt("return",o(s));case 12:if(!i.hasOwnProperty("nodeinfo")){r.next=27;break}if(h=i.libraries||[],l=h.map((function(t){return t.name.toLowerCase()})),(p=t.toLowerCase())!==a.toLocaleLowerCase()&&!l.includes(p)){r.next=23;break}return r.next=19,f(a);case 19:v=r.sent,i.nodeinfo===v?n(i):(y=new Error("Node info does not match"),o(y)),r.next=25;break;case 23:d=new Error("appOrLibName '".concat(t,"' not present in application.name or libraries")),o(d);case 25:r.next=28;break;case 27:n(i||{});case 28:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}());else{var i=new Error("appOrLibName must be a non-empty string");o(i)}}))};
|