jwt-license-verifier 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jwt-license-verifier might be problematic. Click here for more details.
- package/LICENSE +21 -0
- package/README.md +25 -0
- package/dist/index.es.js +1 -0
- package/dist/index.js +1 -0
- package/dist/index.umd.js +3 -0
- package/dist/types/src/index.d.ts +53 -0
- package/dist/types/src/licenseVerifier.test.d.ts +1 -0
- package/dist/types/src/nodeinfo.test.d.ts +1 -0
- package/dist/types/test/testUtils.d.ts +4 -0
- package/package.json +83 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
import { JwtPayload } from 'jsonwebtoken';
|
2
|
+
/**
|
3
|
+
* Retrieves system information and generates a NodeInfo string for a given application.
|
4
|
+
* The NodeInfo string is a concatenation of baseboard and system information, hashed and formatted.
|
5
|
+
*
|
6
|
+
* @async
|
7
|
+
* @function
|
8
|
+
* @param {string|undefined} app - The application name (optional) to include in the NodeInfo string.
|
9
|
+
* @returns {Promise<string>} A Promise that resolves to the formatted NodeInfo string.
|
10
|
+
* @throws {Error} If there is an error retrieving system information or hashing the NodeInfo string.
|
11
|
+
*
|
12
|
+
* @example
|
13
|
+
* const nodeInfo = await getNodeInfo('MyApp');
|
14
|
+
* console.log(nodeInfo); // Output: "NI-MyApp-ABCDEF1234567890"
|
15
|
+
*/
|
16
|
+
export declare const getNodeInfo: (app: string | undefined) => Promise<string>;
|
17
|
+
/**
|
18
|
+
* Verifies the authenticity of a license token using a public key and checks if the NodeInfo matches.
|
19
|
+
*
|
20
|
+
* @function
|
21
|
+
* @param {string} appOrLibName - The application or library name that token should be verified against.
|
22
|
+
* @param {string} token - The license token to be verified.
|
23
|
+
* @param {string} publicKey - The public key used for verification.
|
24
|
+
* @returns {Promise<object>} A Promise that resolves to the decoded license information if verification is successful.
|
25
|
+
* @throws {Error} If there is an error during token verification, if the NodeInfo does not match,
|
26
|
+
* or if appOrLibName is null, undefined, or empty or not present in the decoded data.
|
27
|
+
*
|
28
|
+
* @example
|
29
|
+
* try {
|
30
|
+
* const decodedLicense = await verifyLicense('Recaster', 'tokenString', 'publicKeyString');
|
31
|
+
* console.log(decodedLicense);
|
32
|
+
* } catch (error) {
|
33
|
+
* console.error(error.message);
|
34
|
+
* }
|
35
|
+
*/
|
36
|
+
export default function verifyLicense(appOrLibName: string, token: string, publicKey: string): Promise<object>;
|
37
|
+
/**
|
38
|
+
* Decodes a license token without performing verification.
|
39
|
+
*
|
40
|
+
* @function
|
41
|
+
* @param {string} token - The license token to be decoded.
|
42
|
+
* @returns {Promise<object>} A Promise that resolves to the decoded license information.
|
43
|
+
* @throws {Error} If there is an error during token decoding.
|
44
|
+
*
|
45
|
+
* @example
|
46
|
+
* try {
|
47
|
+
* const decodedLicense = await decodeLicense('tokenString');
|
48
|
+
* console.log(decodedLicense);
|
49
|
+
* } catch (error) {
|
50
|
+
* console.error(error.message);
|
51
|
+
* }
|
52
|
+
*/
|
53
|
+
export declare function decodeLicense(token: string, options?: object): Promise<JwtPayload>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/package.json
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
{
|
2
|
+
"name": "jwt-license-verifier",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"description": "Impleo Jwt license verifier",
|
5
|
+
"author": "IMPLEOTV SYSTEMS LTD",
|
6
|
+
"license": "Proprietary",
|
7
|
+
"homepage": "https://www.impleotv.com",
|
8
|
+
"keywords": [
|
9
|
+
"license"
|
10
|
+
],
|
11
|
+
"exports": {
|
12
|
+
".": {
|
13
|
+
"types": "./dist/types",
|
14
|
+
"import": "./dist/index.es.js",
|
15
|
+
"require": "./dist/index.js"
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"main": "./dist/index.js",
|
19
|
+
"module": "./dist/index.es.js",
|
20
|
+
"browser": "./dist/index.umd.js",
|
21
|
+
"types": "./dist/types",
|
22
|
+
"files": [
|
23
|
+
"dist"
|
24
|
+
],
|
25
|
+
"scripts": {
|
26
|
+
"build": "rimraf dist && npm run build:types && npm run build:js",
|
27
|
+
"build:js": "rollup -c",
|
28
|
+
"build:types": "tsc --emitDeclarationOnly",
|
29
|
+
"test": "jest",
|
30
|
+
"prepare": "husky install"
|
31
|
+
},
|
32
|
+
"lint-staged": {
|
33
|
+
"*.{js,jsx,ts,tsx}": [
|
34
|
+
"prettier --write",
|
35
|
+
"git add"
|
36
|
+
],
|
37
|
+
"*.{json,md,yml}": [
|
38
|
+
"prettier --write",
|
39
|
+
"git add"
|
40
|
+
]
|
41
|
+
},
|
42
|
+
"repository": {
|
43
|
+
"type": "git",
|
44
|
+
"url": "git+https://github.com/impleotv/jwt-license-verifier.git"
|
45
|
+
},
|
46
|
+
"dependencies": {
|
47
|
+
"@types/systeminformation": "^3.54.1",
|
48
|
+
"jsonwebtoken": "^9.0.2",
|
49
|
+
"systeminformation": "^5.21.20"
|
50
|
+
},
|
51
|
+
"devDependencies": {
|
52
|
+
"@babel/core": "^7.18.2",
|
53
|
+
"@babel/preset-env": "^7.18.2",
|
54
|
+
"@babel/preset-typescript": "^7.17.12",
|
55
|
+
"@commitlint/cli": "^18.4.3",
|
56
|
+
"@commitlint/config-conventional": "^18.4.3",
|
57
|
+
"@rollup/plugin-babel": "5.3.1",
|
58
|
+
"@rollup/plugin-commonjs": "^22.0.0",
|
59
|
+
"@rollup/plugin-json": "^4.1.0",
|
60
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
61
|
+
"@semantic-release/changelog": "^6.0.3",
|
62
|
+
"@semantic-release/commit-analyzer": "^11.1.0",
|
63
|
+
"@semantic-release/git": "10.0.1",
|
64
|
+
"@semantic-release/github": "^9.2.5",
|
65
|
+
"@semantic-release/npm": "^11.0.2",
|
66
|
+
"@semantic-release/release-notes-generator": "^12.1.0",
|
67
|
+
"@types/jest": "^29.5.11",
|
68
|
+
"@types/jsonwebtoken": "^9.0.5",
|
69
|
+
"husky": "^8.0.0",
|
70
|
+
"jest": "^29.7.0",
|
71
|
+
"lint-staged": "^15.2.0",
|
72
|
+
"prettier": "^3.1.1",
|
73
|
+
"rimraf": "^5.0.5",
|
74
|
+
"rollup": "^2.74.1",
|
75
|
+
"rollup-plugin-terser": "^7.0.2",
|
76
|
+
"semantic-release": "^22.0.12",
|
77
|
+
"ts-jest": "^29.1.1",
|
78
|
+
"typescript": "^4.7.2"
|
79
|
+
},
|
80
|
+
"publishConfig": {
|
81
|
+
"access": "public"
|
82
|
+
}
|
83
|
+
}
|