@@ -77,13 +77,13 @@ type KeyFetcher =
77
77
78
78
type SignerPayload = Bufferable | Record < string , any >
79
79
80
- declare function SignerSync ( payload : SignerPayload ) : string
81
- declare function SignerAsync ( payload : SignerPayload ) : Promise < string >
82
- declare function SignerAsync ( payload : SignerPayload , cb : SignerCallback ) : void
80
+ declare function SignerSync < T = SignerPayload > ( payload : T ) : string
81
+ declare function SignerAsync < T = SignerPayload > ( payload : T ) : Promise < string >
82
+ declare function SignerAsync < T = SignerPayload > ( payload : T , cb : SignerCallback ) : void
83
83
84
- declare function VerifierSync ( token : Bufferable ) : any
85
- declare function VerifierAsync ( token : Bufferable ) : Promise < any >
86
- declare function VerifierAsync ( token : Bufferable , cb : VerifierCallback ) : void
84
+ declare function VerifierSync < T = Bufferable > ( token : T ) : any
85
+ declare function VerifierAsync < T = Bufferable > ( token : T ) : Promise < any >
86
+ declare function VerifierAsync < T = Bufferable > ( token : T , cb : VerifierCallback ) : void
87
87
88
88
export interface JwtHeader extends Record < string , any > {
89
89
alg : string | Algorithm
@@ -147,10 +147,10 @@ export interface PrivateKey {
147
147
passphrase : string | undefined
148
148
}
149
149
150
- export function createSigner (
150
+ export function createSigner < T = SignerPayload > (
151
151
options ?: Partial < SignerOptions & { key : Bufferable | PrivateKey } >
152
- ) : typeof SignerSync
153
- export function createSigner ( options ?: Partial < SignerOptions & { key : KeyFetcher } > ) : typeof SignerAsync
152
+ ) : typeof SignerSync < T >
153
+ export function createSigner < T = SignerPayload > ( options ?: Partial < SignerOptions & { key : KeyFetcher } > ) : typeof SignerAsync < T >
154
154
export function createDecoder ( options ?: Partial < DecoderOptions > ) : ( token : Bufferable ) => any
155
- export function createVerifier ( options ?: Partial < VerifierOptions & { key : Bufferable } > ) : typeof VerifierSync
156
- export function createVerifier ( options ?: Partial < VerifierOptions & { key : KeyFetcher } > ) : typeof VerifierAsync
155
+ export function createVerifier < T = Bufferable > ( options ?: Partial < VerifierOptions & { key : Bufferable } > ) : typeof VerifierSync < T >
156
+ export function createVerifier < T = Bufferable > ( options ?: Partial < VerifierOptions & { key : KeyFetcher } > ) : typeof VerifierAsync < T >
0 commit comments