Skip to content

Commit

Permalink
fix(auth): fixed passing in private key path (#920)
Browse files Browse the repository at this point in the history
  • Loading branch information
manchuck authored Feb 21, 2024
1 parent 2d0b1b3 commit 0dbb5d2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 17 additions & 0 deletions packages/auth/__tests__/__dataSets__/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,21 @@ export default [
fizz: 'buzz',
})}`,
},
{
label: 'create bearer header with private key path',
method: 'createBearerHeader',
authParameters: {
privateKey: privateKeyPath,
applicationId: applicationId,
jwtOptions: {
jti: 'foo',
fizz: 'buzz',
},
} as AuthParams,
parameters: [],
expected: `Bearer ${tokenGenerate(applicationId, privateKeyString, {
jti: 'foo',
fizz: 'buzz',
})}`,
},
];
4 changes: 1 addition & 3 deletions packages/auth/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ export class Auth implements AuthInterface {
}

this.privateKey
= privateKey instanceof Buffer
? privateKey.toString()
: (opts?.privateKey as string);
= privateKey instanceof Buffer ? privateKey.toString() : privateKey;
}

/**
Expand Down

0 comments on commit 0dbb5d2

Please sign in to comment.