Skip to content

Commit

Permalink
fix(typescript): b64: true is fine to use in JWT, its useless, but al…
Browse files Browse the repository at this point in the history
…lowed (#324)
  • Loading branch information
panva committed Nov 18, 2021
1 parent 444cc3f commit ee401c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/jwt/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class SignJWT extends ProduceJWT {
if (
Array.isArray(this._protectedHeader?.crit) &&
this._protectedHeader.crit.includes('b64') &&
// @ts-expect-error
this._protectedHeader.b64 === false
) {
throw new JWTInvalid('JWTs MUST NOT use unencoded payload')
Expand Down
2 changes: 1 addition & 1 deletion src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ export interface CompactJWSHeaderParameters extends JWSHeaderParameters {
* may also be present.
*/
export interface JWTHeaderParameters extends CompactJWSHeaderParameters {
b64?: never
b64?: true
}

/**
Expand Down

0 comments on commit ee401c9

Please sign in to comment.