-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type definition #9
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# Matches multiple files with brace expansion notation | ||
# Set default charset | ||
[*.{js,ts}] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,7 @@ node_modules | |
# Build output | ||
lib | ||
!src/lib | ||
|
||
# IDE files | ||
.idea/ | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
declare module 'jwks-rsa' { | ||
|
||
import * as ExpressJwt from "express-jwt"; | ||
|
||
function JwksRsa(options: JwksRsa.Options): JwksRsa.JwksClient; | ||
|
||
namespace JwksRsa { | ||
class JwksClient { | ||
constructor(options: Options); | ||
|
||
getKeys: (cb: (err: Error, keys: Jwk[]) => any) => any; | ||
getSigningKeys: (cb: (err: Error, keys: Jwk[]) => any) => any; | ||
getSigningKey: (kid: string, cb: (err: Error, key: Jwk) => any) => any; | ||
} | ||
|
||
interface Jwk { | ||
kid: string; | ||
nbf?: number; | ||
publicKey?: string; | ||
rsaPublicKey?: string; | ||
} | ||
|
||
interface Options { | ||
jwksUri: string; | ||
rateLimit?: boolean; | ||
cache?: boolean; | ||
cacheMaxEntries?: number; | ||
cacheMaxAge?: number; | ||
jwksRequestsPerMinute?: number; | ||
strictSsl?: boolean; | ||
handleSigningKeyError?(err: Error, cb: (err: Error) => void): any; | ||
} | ||
|
||
function ExpressJwtSecret(options: JwksRsa.Options): ExpressJwt.SecretCallback; | ||
|
||
function HapiJwt2Key(options: JwksRsa.Options): (name: string, scheme: string, options?: any) => void; | ||
|
||
class ArgumentError extends Error { | ||
constructor(message: string); | ||
} | ||
|
||
class JwksError extends Error { | ||
constructor(message: string); | ||
} | ||
|
||
class JwksRateLimitError extends Error { | ||
constructor(message: string); | ||
} | ||
|
||
class SigningKeyNotFoundError extends Error { | ||
constructor(message: string); | ||
} | ||
} | ||
|
||
export = JwksRsa; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not in devDependencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DevDependencies of dependencies are not installed along. That is, if I have a TypeScript project that has
jwks-rsa
as adependency
,@types/express-jwt
will not get installed if it is defined as adevDependency
instead of as adenpendency
. Then the project won't compile and the developer will have to manually install@types/express-jwt
.My first attempt was to configure it as a
devDependency
, but it didn't work. Also, the publishing page on the TypeScript documentation states that the developer has to: