From ee401c9e0f23f10ff5c0484798cb0cb3e9074b84 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Thu, 18 Nov 2021 08:01:23 +0100 Subject: [PATCH] fix(typescript): b64: true is fine to use in JWT, its useless, but allowed (#324) --- src/jwt/sign.ts | 1 + src/types.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/jwt/sign.ts b/src/jwt/sign.ts index e597ccba40..5550effd1f 100644 --- a/src/jwt/sign.ts +++ b/src/jwt/sign.ts @@ -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') diff --git a/src/types.d.ts b/src/types.d.ts index 7e8ecbb168..6d8bb52bc2 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -734,7 +734,7 @@ export interface CompactJWSHeaderParameters extends JWSHeaderParameters { * may also be present. */ export interface JWTHeaderParameters extends CompactJWSHeaderParameters { - b64?: never + b64?: true } /**