Skip to content

Commit

Permalink
style: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Sep 9, 2022
1 parent ec6a6a5 commit 644a13b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/jwt/verify.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,15 @@ test('Signed JWTs cannot use unencoded payload', async (t) => {

test('signatures are compared before claim set', async (t) => {
// https://github.com/panva/jose/discussions/447
const jwt = await new SignJWT({ exp: 0 }).setProtectedHeader({ alg: 'HS256' }).sign(t.context.secret);
const jwt = await new SignJWT({ exp: 0 })
.setProtectedHeader({ alg: 'HS256' })
.sign(t.context.secret)

// with valid secret should throw exp failing to verify
await t.throwsAsync(jwtVerify(jwt, t.context.secret), { code: 'ERR_JWT_EXPIRED' })

// with invalid secret should throw signature failing to verify
await t.throwsAsync(jwtVerify(jwt, new Uint8Array([0x00, 0x01])), { code: 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED' })
await t.throwsAsync(jwtVerify(jwt, new Uint8Array([0x00, 0x01])), {
code: 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED',
})
})

0 comments on commit 644a13b

Please sign in to comment.