Skip to content

Commit

Permalink
Add types for agent options used by ExpressJwtOptions (#206)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Mcgrath <adam.mcgrath@auth0.com>
  • Loading branch information
davidpatrick and adamjmcgrath committed Dec 22, 2020
1 parent ee90de2 commit 6fa1db0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 34 deletions.
9 changes: 4 additions & 5 deletions index.d.ts
@@ -1,4 +1,6 @@
import { SecretCallback, SecretCallbackLong } from 'express-jwt';
import { AgentOptions as HttpAgentOptions } from 'http';
import { AgentOptions as HttpsAgentOptions } from 'https';

declare function JwksRsa(options: JwksRsa.ClientOptions): JwksRsa.JwksClient;

Expand Down Expand Up @@ -29,6 +31,7 @@ declare namespace JwksRsa {
strictSsl?: boolean;
requestHeaders?: Headers;
timeout?: number;
requestAgentOptions?: HttpAgentOptions | HttpsAgentOptions;
getKeysInterceptor?(cb: (err: Error | null, keys: SigningKey[]) => void): void;
}

Expand All @@ -46,10 +49,6 @@ declare namespace JwksRsa {
publicKey: string;
}

interface AgentOptions {
[key: string]: string;
}

interface Options {
jwksUri: string;
rateLimit?: boolean;
Expand All @@ -59,7 +58,7 @@ declare namespace JwksRsa {
jwksRequestsPerMinute?: number;
strictSsl?: boolean;
requestHeaders?: Headers;
requestAgentOptions?: AgentOptions;
requestAgentOptions?: HttpAgentOptions | HttpsAgentOptions;
handleSigningKeyError?(err: Error, cb: (err: Error) => void): any;
}

Expand Down
38 changes: 10 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -6,7 +6,7 @@
"types": "index.d.ts",
"dependencies": {
"@types/express-jwt": "0.0.42",
"axios": "^0.19.2",
"axios": "^0.20.0",
"debug": "^4.1.0",
"http-proxy-agent": "^4.0.1",
"https-proxy-agent": "^5.0.0",
Expand All @@ -20,6 +20,7 @@
"@types/chai": "^4.2.11",
"@types/mocha": "^5.2.7",
"@types/nock": "^10.0.3",
"@types/node": "^14.14.12",
"babel-cli": "^6.9.0",
"babel-core": "^6.9.0",
"babel-eslint": "^8.2.6",
Expand Down

0 comments on commit 6fa1db0

Please sign in to comment.