@payello-module/jwt 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/JWT.js +4 -2
- package/dist/JwtExtract.d.ts +2 -0
- package/package.json +1 -1
package/dist/JWT.js
CHANGED
@@ -59,7 +59,7 @@ export class JWT {
|
|
59
59
|
}
|
60
60
|
// Validates the present of required properties in the payload.
|
61
61
|
const requiredProps = opts.requiredProps || ["jti", "iss", "iat"];
|
62
|
-
for (const prop
|
62
|
+
for (const prop of requiredProps) {
|
63
63
|
if (!payload[prop]) {
|
64
64
|
throw new JwtError(`Payload missing ${prop} value`);
|
65
65
|
}
|
@@ -67,7 +67,9 @@ export class JWT {
|
|
67
67
|
// Returns an object containing the extracted components of the JWT.
|
68
68
|
return {
|
69
69
|
header: header,
|
70
|
+
headerRaw: bits[0],
|
70
71
|
payload: payload,
|
72
|
+
payloadRaw: bits[1],
|
71
73
|
signature: bits[2]
|
72
74
|
};
|
73
75
|
}
|
@@ -86,7 +88,7 @@ export class JWT {
|
|
86
88
|
}
|
87
89
|
let verify = false;
|
88
90
|
// Preparation of the data to verify the signature.
|
89
|
-
const data = `${
|
91
|
+
const data = `${extracted.headerRaw}.${extracted.payloadRaw}`;
|
90
92
|
// Verification of the signature based on the algorithm specified in the header.
|
91
93
|
switch (extracted.header.alg) {
|
92
94
|
case 'HS256':
|
package/dist/JwtExtract.d.ts
CHANGED