-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from brunokrebs/type-definition
Type definition
- Loading branch information
Showing
4 changed files
with
78 additions
and
0 deletions.
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