You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"The first segment, the JWT header, and the second segment, the JWT payload, must represent a completely valid JSON object conforming to RFC 7159.",
146
-
]),
178
+
expect(error).toStrictEqual({
179
+
task: DebuggerTaskValues.DECODE,
180
+
input: DebuggerInputValues.JWT,
181
+
message: `This tool only supports a JWT that uses the JWS Compact Serialization, which must have three base64url-encoded segments separated by two period ('.') characters as defined on [RFC 7515](https://datatracker.ietf.org/doc/html/rfc7515#section-3.3)`,
182
+
})
147
183
);
148
184
149
185
constresult2=validateJwtFormat(invalidToken2);
150
186
expect(result2.isErr()).toBe(true);
151
187
expect(result2.isOk()).toBe(false);
152
188
result2.mapErr((error)=>
153
-
expect(error).toStrictEqual([
154
-
"The first segment, the JWT header, and the second segment, the JWT payload, must represent a completely valid JSON object conforming to RFC 7159.",
155
-
]),
189
+
expect(error).toStrictEqual({
190
+
task: DebuggerTaskValues.DECODE,
191
+
input: DebuggerInputValues.JWT,
192
+
message: `This tool only supports a JWT that uses the JWS Compact Serialization, which must have three base64url-encoded segments separated by two period ('.') characters as defined on [RFC 7515](https://datatracker.ietf.org/doc/html/rfc7515#section-3.3)`,
193
+
})
156
194
);
157
195
158
196
constresult3=validateJwtFormat(invalidToken3);
159
197
expect(result3.isErr()).toBe(true);
160
198
expect(result3.isOk()).toBe(false);
161
199
result3.mapErr((error)=>
162
-
expect(error).toStrictEqual([
163
-
"The second (payload) segment cannot be an empty string.",
164
-
]),
200
+
expect(error).toStrictEqual({
201
+
task: DebuggerTaskValues.DECODE,
202
+
input: DebuggerInputValues.JWT,
203
+
message: `This tool only supports a JWT that uses the JWS Compact Serialization, which must have three base64url-encoded segments separated by two period ('.') characters as defined on [RFC 7515](https://datatracker.ietf.org/doc/html/rfc7515#section-3.3)`,
204
+
})
165
205
);
166
206
167
207
constresult4=validateJwtFormat(invalidToken4);
168
208
expect(result4.isErr()).toBe(true);
169
209
expect(result4.isOk()).toBe(false);
170
210
result4.mapErr((error)=>
171
-
expect(error).toStrictEqual([
172
-
"The JWT must contain at least one period ('.') character. Source: https://datatracker.ietf.org/doc/html/rfc7519#section-7.2",
173
-
]),
211
+
expect(error).toStrictEqual({
212
+
task: DebuggerTaskValues.DECODE,
213
+
input: DebuggerInputValues.JWT,
214
+
message: `This tool only supports a JWT that uses the JWS Compact Serialization, which must have three base64url-encoded segments separated by two period ('.') characters as defined on [RFC 7515](https://datatracker.ietf.org/doc/html/rfc7515#section-3.3)`,
215
+
})
174
216
);
175
217
176
218
constresult5=validateJwtFormat(invalidToken5);
177
219
expect(result5.isErr()).toBe(true);
178
220
expect(result5.isOk()).toBe(false);
179
221
result5.mapErr((error)=>
180
-
expect(error).toStrictEqual([
181
-
"The JWT must contain at least one period ('.') character. Source: https://datatracker.ietf.org/doc/html/rfc7519#section-7.2",
182
-
]),
222
+
expect(error).toStrictEqual({
223
+
task: DebuggerTaskValues.DECODE,
224
+
input: DebuggerInputValues.JWT,
225
+
message: `JWT must not be empty.`,
226
+
})
183
227
);
184
228
185
229
constresult6=validateJwtFormat(invalidToken6);
186
230
expect(result6.isErr()).toBe(true);
187
231
expect(result6.isOk()).toBe(false);
188
232
result6.mapErr((error)=>
189
-
expect(error).toStrictEqual([
190
-
"Each JWT segment must be a base64url-encoded. The third (signature) segment isn't.",
191
-
]),
233
+
expect(error).toStrictEqual({
234
+
task: DebuggerTaskValues.DECODE,
235
+
input: DebuggerInputValues.JWT,
236
+
message: `This tool only supports a JWT that uses the JWS Compact Serialization, which must have three base64url-encoded segments separated by two period ('.') characters as defined on [RFC 7515](https://datatracker.ietf.org/doc/html/rfc7515#section-3.3)`,
237
+
})
192
238
);
193
239
194
240
constresult7=validateJwtFormat(invalidToken7);
195
241
expect(result7.isErr()).toBe(true);
196
242
expect(result7.isOk()).toBe(false);
197
243
result7.mapErr((error)=>
198
-
expect(error).toStrictEqual([
199
-
"The second segment, the JWT payload, must represent a completely valid JSON object conforming to RFC 7159.",
200
-
]),
244
+
expect(error).toStrictEqual({
245
+
task: DebuggerTaskValues.DECODE,
246
+
input: DebuggerInputValues.JWT,
247
+
message: `The second segment, the JWT payload, must represent a completely valid JSON object conforming to [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519#section-3).`,
248
+
data: {
249
+
header: {
250
+
alg: "HS256",
251
+
},
252
+
payload: "test",
253
+
},
254
+
})
201
255
);
202
256
203
257
constresult8=validateJwtFormat(invalidToken8);
204
258
expect(result8.isErr()).toBe(true);
205
259
expect(result8.isOk()).toBe(false);
206
260
result8.mapErr((error)=>
207
-
expect(error).toStrictEqual([
208
-
"The first segment, the JWT header, and the second segment, the JWT payload, must represent a completely valid JSON object conforming to RFC 7159.",
209
-
]),
261
+
expect(error).toStrictEqual({
262
+
task: DebuggerTaskValues.DECODE,
263
+
input: DebuggerInputValues.JWT,
264
+
message: `This tool only supports a JWT that uses the JWS Compact Serialization, which must have three base64url-encoded segments separated by two period ('.') characters as defined on [RFC 7515](https://datatracker.ietf.org/doc/html/rfc7515#section-3.3)`,
265
+
})
210
266
);
211
267
212
268
constresult9=validateJwtFormat(invalidToken9);
213
269
expect(result9.isErr()).toBe(true);
214
270
expect(result9.isOk()).toBe(false);
215
271
result9.mapErr((error)=>
216
-
expect(error).toStrictEqual([
217
-
"This tool only supports a JWT that uses the JWS Compact Serialization, which must have three base64url-encoded segments separated by two period ('.') characters. Source: https://datatracker.ietf.org/doc/html/rfc7516#section-9",
218
-
]),
272
+
expect(error).toStrictEqual({
273
+
task: DebuggerTaskValues.DECODE,
274
+
input: DebuggerInputValues.JWT,
275
+
message: `This tool only supports a JWT that uses the JWS Compact Serialization, which must have three base64url-encoded segments separated by two period ('.') characters as defined on [RFC 7515](https://datatracker.ietf.org/doc/html/rfc7515#section-3.3)`,
0 commit comments