Skip to content

Commit e01aa1f

Browse files
committed
2.0.1
1 parent 40e9748 commit e01aa1f

File tree

8 files changed

+34
-19
lines changed

8 files changed

+34
-19
lines changed

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/JwtHandler.d.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
/// <reference types="node" />
12
import * as jwt from "jsonwebtoken";
23
export declare type PubkeyData = {
34
cert: string;
4-
alg: string;
5+
alg?: string;
56
} | undefined | null;
67
export declare type PrivkeyData = {
78
key: string;
@@ -10,13 +11,19 @@ export declare type PrivkeyData = {
1011
} | undefined | null;
1112
export declare type PubkeyResolver = (keyId: string) => PubkeyData | Promise<PubkeyData>;
1213
export declare type PrivkeyResolver = (keyId: string) => PrivkeyData | Promise<PrivkeyData>;
14+
export interface JwtHandlerOptions {
15+
debugNamePrefix: string;
16+
pubkeyResolver?: PubkeyResolver;
17+
privkeyResolver?: PrivkeyResolver;
18+
}
1319
export declare class JwtHandler {
1420
private debug;
1521
private pubkeyResolver;
1622
private privkeyResolver;
1723
private jwtVerifyAsync;
1824
private jwtSignAsync;
19-
constructor(debugNamePrefix: string, pubkeyResolver: PubkeyResolver | null, privkeyResolver: PrivkeyResolver | null);
25+
constructor(options: JwtHandlerOptions);
26+
constructor(debugNamePrefix: string, pubkeyResolver?: PubkeyResolver | null, privkeyResolver?: PrivkeyResolver | null);
2027
/**
2128
* Extract key ID from the given JWT
2229
*
@@ -31,13 +38,17 @@ export declare class JwtHandler {
3138
* @param {Object} options Validation options (jsonwebtoken module options)
3239
* @return {Promise<Object, JsonWebTokenError>} Promise to the JWT body
3340
*/
34-
verify(jwtRaw: string, options?: jwt.VerifyOptions): Promise<string | object>;
41+
verify<T extends string | {
42+
[key: string]: any;
43+
}>(jwtRaw: string, options?: jwt.VerifyOptions): Promise<T>;
3544
/**
3645
* Creates a new JWT with the given body and signs it with the given key
3746
*
3847
* @param {string} tokenBody The body of the JWT token
3948
* @param {string} keyId The ID of the signing key
4049
* @return {Promise<Object, JsonWebTokenError>} Promise to the JWT body
4150
*/
42-
create(tokenBody: object, keyId: string): Promise<string>;
51+
create(tokenBody: string | Buffer | {
52+
[key: string]: any;
53+
}, keyId: string): Promise<string>;
4354
}

dist/src/JwtHandler.js

Lines changed: 13 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/JwtHandler.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/MissingKeyIdError.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/UnknownKeyIdError.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vanioinformatika/jwt-wrapper",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "A wrapper around the jsonwebtoken npm module that handles key ids.",
55
"author": "Gyula Szalai <gyszalai@gmail.com>",
66
"license": "MIT",

0 commit comments

Comments
 (0)