Skip to content

Commit

Permalink
fixing typing
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcherubini committed Dec 7, 2019
1 parent c339ccd commit 5a88b25
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 35 deletions.
19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
}
};
34 changes: 0 additions & 34 deletions .eslintrc.json

This file was deleted.

130 changes: 130 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.7",
"@types/nock": "^10.0.3",
"@typescript-eslint/eslint-plugin": "^2.10.0",
"@typescript-eslint/parser": "^2.10.0",
"babel-cli": "^6.9.0",
"babel-core": "^6.9.0",
"babel-eslint": "^6.0.4",
Expand Down
29 changes: 28 additions & 1 deletion src/JwksClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,25 @@ const LRU = require('lru-cache')

const {JwksError} = require('./errors')
const SigningKeyNotFoundError = require('./errors/SigningKeyNotFoundError')
/**
* @callbck Callback
* @param {Error} error
* @param {object} key
*/

/**
* @typedef {object} JwksClientOptions
* @prop {boolean} cache
* @prop {boolean} strictSsl
*/

/**
* @class
*/
module.exports.JwksClient = class JwksClient {
/**
* @param {JwksClientOptions} options
*/
constructor (options) {
this.options = {
cache: false,
Expand All @@ -21,7 +38,9 @@ module.exports.JwksClient = class JwksClient {
this.cache = new LRU(options)
}
}

/**
* @param {Callback} cb
*/
getKeys (cb) {
this.logger(`Fetching keys from '${this.options.jwksUri}'`)
request({
Expand All @@ -46,6 +65,9 @@ module.exports.JwksClient = class JwksClient {
})
}

/**
* @param {Callback} cb
*/
getSigningKeys (cb) {
this.getKeys((err, keys) => {
if (err) {
Expand Down Expand Up @@ -79,6 +101,11 @@ module.exports.JwksClient = class JwksClient {
})
}


/**
* @param {string} kid
* @param {Callback} cb
*/
getSigningKey (kid, cb) {
this.logger(`Fetching signing key for '${kid}'`)

Expand Down

0 comments on commit 5a88b25

Please sign in to comment.