Clean up as per review comments
Signed-off-by: Andy Caruso <macaruso@gmail.com>
This commit is contained in:
@@ -24,7 +24,10 @@ const logger = getVoidLogger();
|
||||
|
||||
function jwtKid(jwt: string): string {
|
||||
const header = decodeProtectedHeader(jwt);
|
||||
return header.kid ?? '';
|
||||
if (!header.kid) {
|
||||
throw new Error('JWT Header did not contain a key ID (kid)');
|
||||
}
|
||||
return header.kid;
|
||||
}
|
||||
|
||||
const entityRef = stringifyEntityRef({
|
||||
|
||||
@@ -44,11 +44,6 @@ type Options = {
|
||||
resolverContext: AuthResolverContext;
|
||||
};
|
||||
|
||||
export const getJWTHeaders = (input: string): AwsAlbHeaders => {
|
||||
const encoded = input.split('.')[0];
|
||||
return JSON.parse(Buffer.from(encoded, 'base64').toString('utf8'));
|
||||
};
|
||||
|
||||
export type AwsAlbHeaders = {
|
||||
alg: string;
|
||||
kid: string;
|
||||
|
||||
Reference in New Issue
Block a user