Skip to content

Commit

Permalink
Allow expiresIn to be a string (#376)
Browse files Browse the repository at this point in the history
* Allow expiresIn to be a string

* add test for expiresIn as a string
  • Loading branch information
felixmosh authored Sep 18, 2023
1 parent f836ce1 commit 7b3d317
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export interface JwtHeader {
export interface SignerOptions {
algorithm?: Algorithm
mutatePayload?: boolean
expiresIn?: number
expiresIn?: number | string
notBefore?: number
jti?: string
aud?: string | string[]
Expand Down
7 changes: 7 additions & 0 deletions test/types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ createSigner({
}
})({ key: 1 }).then(console.log, console.log)

// expiresIn as a string
createSigner({
expiresIn: '10min',
key: Buffer.from('KEY'),
algorithm: 'RS256'
})

// Decoding
const decoder = createDecoder({ checkTyp: 'true' })
decoder('FOO')
Expand Down

0 comments on commit 7b3d317

Please sign in to comment.