@@ -14,8 +14,8 @@ export type PrivkeyData = { key: string, passphrase: string, alg: string } | und
1414export type PubkeyResolver = ( keyId : string ) => PubkeyData | Promise < PubkeyData >
1515export type PrivkeyResolver = ( keyId : string ) => PrivkeyData | Promise < PrivkeyData >
1616
17- type JwtVerifyAsync = ( token : string , publicKey : string , options ?: jwt . VerifyOptions ) => Promise < object | string >
18- type JwtSignAsync = ( payload : object , privateKey : { } , options ?: jwt . SignOptions ) => Promise < string >
17+ type JwtVerifyAsync = ( token : string , publicKey : string | Buffer , options ?: jwt . VerifyOptions ) => Promise < object | string >
18+ type JwtSignAsync = ( payload : string | Buffer | object , privateKey : { } , options ?: jwt . SignOptions ) => Promise < string >
1919
2020shim ( ) // util.promisify shim
2121
@@ -66,7 +66,7 @@ export class JwtHandler {
6666 * @param {Object } options Validation options (jsonwebtoken module options)
6767 * @return {Promise<Object, JsonWebTokenError> } Promise to the JWT body
6868 */
69- public async verify ( jwtRaw : string , options ?: jwt . VerifyOptions ) : Promise < string | object > {
69+ public async verify ( jwtRaw : string , options ?: jwt . VerifyOptions ) : Promise < string | { [ key : string ] : any } > {
7070 if ( ! jwtRaw ) {
7171 throw new jwt . JsonWebTokenError ( "Empty JWT" )
7272 }
@@ -90,7 +90,7 @@ export class JwtHandler {
9090 * @param {string } keyId The ID of the signing key
9191 * @return {Promise<Object, JsonWebTokenError> } Promise to the JWT body
9292 */
93- public async create ( tokenBody : object , keyId : string ) : Promise < string > {
93+ public async create ( tokenBody : string | Buffer | { [ key : string ] : any } , keyId : string ) : Promise < string > {
9494 debug ( "create, key id: " + keyId )
9595 if ( this . privkeyResolver ) {
9696 const signingKey = await this . privkeyResolver ( keyId )
0 commit comments