Skip to content

Commit

Permalink
refactor: consume some base64url decode errors (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
eevleevs committed Aug 10, 2022
1 parent fa19e2d commit caaf2c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/jwe/flattened/decrypt.ts
Expand Up @@ -118,8 +118,8 @@ export async function flattenedDecrypt(

let parsedProt!: JWEHeaderParameters
if (jwe.protected) {
const protectedHeader = base64url(jwe.protected)
try {
const protectedHeader = base64url(jwe.protected)
parsedProt = JSON.parse(decoder.decode(protectedHeader))
} catch {
throw new JWEInvalid('JWE Protected Header is invalid')
Expand Down
2 changes: 1 addition & 1 deletion src/jws/flattened/verify.ts
Expand Up @@ -100,8 +100,8 @@ export async function flattenedVerify(

let parsedProt: JWSHeaderParameters = {}
if (jws.protected) {
const protectedHeader = base64url(jws.protected)
try {
const protectedHeader = base64url(jws.protected)
parsedProt = JSON.parse(decoder.decode(protectedHeader))
} catch {
throw new JWSInvalid('JWS Protected Header is invalid')
Expand Down

0 comments on commit caaf2c3

Please sign in to comment.