Skip to content

Commit a5ef39b

Browse files
authored
fix(typescript): fix typescript type DecodedJwt (#407)
* fix(typescript): fix typescript type DecodedJwt * Update types.spec.ts * fix: export missing typescript types * Update index.d.ts * Update index.d.ts * Update types.spec.ts * Update index.d.ts * Update types.spec.ts * Update index.d.ts * Update types.spec.ts
1 parent 4d8c66f commit a5ef39b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type VerifierCallback = (e: Error | TokenError | null, payload: any) => void
6666

6767
type DecodedJwt = {
6868
header: { [key: string]: any },
69-
payload: string,
69+
payload: any,
7070
signature: string
7171
}
7272

test/types.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ createVerifier({
6363
// Dynamic key in async style
6464
createVerifier({
6565
clockTimestamp: 10,
66-
async key(_decodedJwt: DecodedJwt) {
66+
async key(decodedJwt: DecodedJwt) {
67+
if (decodedJwt.payload.iss) {
68+
return 'ISS_KEY'
69+
}
6770
return 'KEY'
6871
}
6972
})('456').then(console.log, console.log)

0 commit comments

Comments
 (0)