@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 +1 -1
- package/dist/test/test.d.ts +0 -1
- package/dist/test/test.js +0 -46
- /package/dist/{src/JWT.d.ts → JWT.d.ts} +0 -0
- /package/dist/{src/JWT.js → JWT.js} +0 -0
- /package/dist/{src/JWTAlgorithms.d.ts → JWTAlgorithms.d.ts} +0 -0
- /package/dist/{src/JWTAlgorithms.js → JWTAlgorithms.js} +0 -0
- /package/dist/{src/JWTKeyPair.d.ts → JWTKeyPair.d.ts} +0 -0
- /package/dist/{src/JWTKeyPair.js → JWTKeyPair.js} +0 -0
- /package/dist/{src/JWTPayload.d.ts → JWTPayload.d.ts} +0 -0
- /package/dist/{src/JWTPayload.js → JWTPayload.js} +0 -0
- /package/dist/{src/JwtError.d.ts → JwtError.d.ts} +0 -0
- /package/dist/{src/JwtError.js → JwtError.js} +0 -0
- /package/dist/{src/JwtExtract.d.ts → JwtExtract.d.ts} +0 -0
- /package/dist/{src/JwtExtract.js → JwtExtract.js} +0 -0
- /package/dist/{src/JwtExtractOpts.d.ts → JwtExtractOpts.d.ts} +0 -0
- /package/dist/{src/JwtExtractOpts.js → JwtExtractOpts.js} +0 -0
- /package/dist/{src/JwtHeader.d.ts → JwtHeader.d.ts} +0 -0
- /package/dist/{src/JwtHeader.js → JwtHeader.js} +0 -0
- /package/dist/{src/JwtSignOpts.d.ts → JwtSignOpts.d.ts} +0 -0
- /package/dist/{src/JwtSignOpts.js → JwtSignOpts.js} +0 -0
- /package/dist/{src/base64_encode_buffer.d.ts → base64_encode_buffer.d.ts} +0 -0
- /package/dist/{src/base64_encode_buffer.js → base64_encode_buffer.js} +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/index.js → index.js} +0 -0
package/package.json
CHANGED
package/dist/test/test.d.ts
DELETED
@@ -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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|