Skip to content

Commit

Permalink
refactor: src/util/decode_protected_header.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Mar 13, 2023
1 parent 96658e8 commit 5716725
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/decode_protected_header.ts
Expand Up @@ -18,7 +18,7 @@ export type ProtectedHeaderParameters = JWSHeaderParameters & JWEHeaderParameter
* @param token JWE/JWS/JWT token in any JOSE serialization.
*/
export function decodeProtectedHeader(token: string | object) {
let protectedB64u!: string
let protectedB64u!: unknown

if (typeof token === 'string') {
const parts = token.split('.')
Expand All @@ -27,7 +27,7 @@ export function decodeProtectedHeader(token: string | object) {
}
} else if (typeof token === 'object' && token) {
if ('protected' in token) {
protectedB64u = (<{ protected: string }>token).protected
protectedB64u = token.protected
} else {
throw new TypeError('Token does not contain a Protected Header')
}
Expand Down

0 comments on commit 5716725

Please sign in to comment.