@payello-module/jwt 1.20240419.1635 → 1.20240419.1640

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payello-module/jwt",
3
- "version": "1.20240419.1635",
3
+ "version": "1.20240419.1640",
4
4
  "author": "Payello <devsupport@payello.com> (https://payello.com/)",
5
5
  "displayName": "@payello-module/jwt",
6
6
  "description": "JSON Web Token Module",
@@ -1 +0,0 @@
1
- export {};
package/dist/test/test.js DELETED
@@ -1,46 +0,0 @@
1
- import { JWT } from "../src/JWT";
2
- import { JWTAlgorithms } from "../src/JWTAlgorithms";
3
- /**
4
- * Ensures that verification works for all algorithms
5
- */
6
- async function Test1() {
7
- for (let key of Object.keys(JWTAlgorithms)) {
8
- console.log("ALG: ", key);
9
- const keys = await JWT.generateKeys(key);
10
- console.log("KEYS: ", keys);
11
- const signed = await JWT.sign({ iss: "Hello" }, key, keys.sign.base64);
12
- console.log("SIGNED: ", signed);
13
- const verify = await JWT.verifySignature(signed, () => { return keys.verify.base64; });
14
- console.log("VERIFIED: ", verify);
15
- if (!verify.verified) {
16
- throw new Error("Not verified!");
17
- }
18
- console.log("----");
19
- }
20
- }
21
- /**
22
- * Ensures that signature manipulation fails for all algorithms
23
- */
24
- async function Test2() {
25
- for (let key of Object.keys(JWTAlgorithms)) {
26
- console.log("ALG: ", key);
27
- const keys = await JWT.generateKeys(key);
28
- console.log("KEYS: ", keys);
29
- const signed = await JWT.sign({ iss: "Hello" }, key, keys.sign.base64);
30
- console.log("SIGNED: ", signed);
31
- const signed2 = await JWT.sign({ iss: "Hello there" }, key, keys.sign.base64);
32
- console.log("SIGNED2: ", signed);
33
- const token = signed.split('.').map(x => (val, index) => {
34
- if (index == 2)
35
- return signed2.split('.')[index];
36
- return val;
37
- }).join('.');
38
- const verify = await JWT.verifySignature(token, () => { return keys.verify.base64; });
39
- console.log("VERIFIED: ", verify);
40
- if (verify.verified) {
41
- throw new Error("Somehow verified (shouldn't be)");
42
- }
43
- console.log("----");
44
- }
45
- }
46
- Test1();
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes