diff --git a/notNeededPackages.json b/notNeededPackages.json index 2a645f9c93..701978da24 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -564,6 +564,12 @@ "sourceRepoURL": "https://www.npmjs.com/package/fast-simplex-noise", "asOfVersion": "3.0.0" }, + { + "libraryName": "Fastify-JWT", + "typingsPackageName": "fastify-jwt", + "sourceRepoURL": "https://github.com/fastify/fastify-jwt", + "asOfVersion": "0.8.1" + }, { "libraryName": "fecha", "typingsPackageName": "fecha", diff --git a/types/fastify-jwt/fastify-jwt-tests.ts b/types/fastify-jwt/fastify-jwt-tests.ts deleted file mode 100644 index fc68ac8bcc..0000000000 --- a/types/fastify-jwt/fastify-jwt-tests.ts +++ /dev/null @@ -1,72 +0,0 @@ -import fastify = require("fastify"); -import fastifyJwt = require("fastify-jwt"); - -const app = fastify(); - -app.register(fastifyJwt, { - secret: "super-secret", -}); - -app.register(fastifyJwt, { - secret: (request, reply, callback) => { - return ""; - }, -}); - -app.get("/path", (request, reply) => { - request.jwtVerify(); - request.jwtVerify({}); - request.jwtVerify({}, () => "string"); - request.jwtVerify(() => "string", () => "string"); - - reply.jwtSign("payload"); - reply.jwtSign("payload", {}); - reply.jwtSign("payload", {}, () => "string"); - reply.jwtSign({ a: "b" }, {}, () => "string"); - reply.jwtSign([], {}, () => "string"); - reply.jwtSign(new Buffer("buffer"), {}, () => "string"); - reply.jwtSign("payload", () => "string", () => "string"); -}); - -app.jwt.sign({ a: "b" }, {}, (err, token) => { - if (err) { - throw err; - } - - return token; -}); - -app.jwt.sign("string", { algorithm: "some-algorithm" }, (err, token) => { - if (err) { - throw err; - } - - return token; -}); - -app.jwt.sign([], {}, (err, token) => { - if (err) { - throw err; - } - - return token; -}); - -app.jwt.sign(new Buffer("buffer"), {}, (err, token) => { - if (err) { - throw err; - } - - return token; -}); - -app.jwt.decode("some-token"); -app.jwt.decode("some-token"); -app.jwt.secret = "some-secret"; -app.jwt.verify("some-token", {}, (err) => { - if (err) { - throw err; - } - - return true; -}); diff --git a/types/fastify-jwt/index.d.ts b/types/fastify-jwt/index.d.ts deleted file mode 100644 index 94e6249a3c..0000000000 --- a/types/fastify-jwt/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Type definitions for fastify-jwt 0.4 -// Project: https://github.com/fastify/fastify-jwt#readme -// Definitions by: Jannik Keye -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 -import fastify = require("fastify"); - -import { Secret, SignOptions, VerifyOptions, VerifyCallback, SignCallback, DecodeOptions } from 'jsonwebtoken'; -import { IncomingMessage, ServerResponse } from 'http'; - -declare module "fastify" { - interface FastifyInstance { - jwt: jwt; - } - - interface SignFunction { - (payload: string | Buffer | object, options?: SignOptions): string; - (payload: string | Buffer | object, options?: SignOptions, callback?: SignCallback): void; - } - - interface VerifyFunction { - (token: string, options?: VerifyOptions, callback?: VerifyCallback): void; - (token: string, options?: VerifyOptions): object | string; - } - - interface jwt { - sign: SignFunction; - verify: VerifyFunction; - decode(token: string, options?: DecodeOptions): null | { [key: string]: any } | string; - secret: Secret; - } - - interface FastifyRequest { - jwtVerify: (options?: VerifyOptions | VerifyCallback, next?: VerifyCallback) => Promise | null | { [key: string]: any } | string; - } - - interface FastifyReply { - jwtSign: (payload: string | Buffer | object, options?: SignOptions | SignCallback, next?: SignCallback) => void; - } -} - -declare function fastifyJwt(): void; - -declare namespace fastifyJwt { - type SecretCallback = (request: fastify.FastifyRequest, reply: string | Buffer | object, callback?: VerifyCallback | SignCallback) => void; - - interface FastifyJwtOptions { - secret: string | SecretCallback; - } -} - -export = fastifyJwt; diff --git a/types/fastify-jwt/package.json b/types/fastify-jwt/package.json deleted file mode 100644 index 5eb77c39fa..0000000000 --- a/types/fastify-jwt/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "fastify": ">=1.13.1 || 2.0.0-rc.1" - } -} diff --git a/types/fastify-jwt/tsconfig.json b/types/fastify-jwt/tsconfig.json deleted file mode 100644 index a0149e0fe8..0000000000 --- a/types/fastify-jwt/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "fastify-jwt-tests.ts" - ] -} diff --git a/types/fastify-jwt/tslint.json b/types/fastify-jwt/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/fastify-jwt/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" }