mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 19:51:53 +00:00
fix typings and add fastify dependency
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { IncomingMessage, Server, ServerResponse } from "http";
|
||||
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify-jwt";
|
||||
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
||||
|
||||
const fastify: FastifyInstance<Server, IncomingMessage, ServerResponse> = {
|
||||
jwt: {
|
||||
|
||||
Vendored
+23
-14
@@ -3,24 +3,33 @@
|
||||
// Definitions by: My Self <https://github.com/jannikkeye>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
import fastify = require("fastify");
|
||||
|
||||
import { Secret, SignOptions, VerifyOptions, VerifyCallback, SignCallback, DecodeOptions } from 'jsonwebtoken';
|
||||
|
||||
export interface FastifyInstance<HttpServer, HttpRequest, HttpResponse> {
|
||||
jwt: jwt;
|
||||
declare module "fastify" {
|
||||
interface FastifyInstance<HttpServer, HttpRequest, HttpResponse> {
|
||||
jwt: jwt;
|
||||
}
|
||||
|
||||
interface jwt {
|
||||
sign: (payload: any, options?: SignOptions, callback?: SignCallback) => void;
|
||||
verify: (token: string, options?: VerifyOptions, callback?: VerifyCallback) => void;
|
||||
decode: (token: string, options?: DecodeOptions) => null | { [key: string]: any } | string;
|
||||
secret: Secret;
|
||||
}
|
||||
|
||||
interface FastifyRequest<HttpRequest> {
|
||||
jwtVerify: (options?: VerifyOptions | VerifyCallback, next?: VerifyCallback) => Promise<null | { [key: string]: any } | string> | null | { [key: string]: any } | string;
|
||||
}
|
||||
|
||||
interface FastifyReply<HttpResponse> {
|
||||
jwtSign: (payload: any, options?: SignOptions | SignCallback, next?: SignCallback) => void;
|
||||
}
|
||||
}
|
||||
|
||||
export interface jwt {
|
||||
sign: (payload: any, options?: SignOptions, callback?: SignCallback) => void;
|
||||
verify: (token: string, options?: VerifyOptions, callback?: VerifyCallback) => void;
|
||||
decode: (token: string, options?: DecodeOptions) => null | { [key: string]: any } | string;
|
||||
secret: Secret;
|
||||
}
|
||||
declare function fastifyJwt (): void;
|
||||
|
||||
export interface FastifyRequest<HttpRequest> {
|
||||
jwtVerify: (options?: VerifyOptions | VerifyCallback, next?: VerifyCallback) => Promise<null | { [key: string]: any } | string> | null | { [key: string]: any } | string;
|
||||
}
|
||||
declare namespace fastifyJwt {}
|
||||
|
||||
export interface FastifyReply<HttpResponse> {
|
||||
jwtSign: (payload: any, options?: SignOptions | SignCallback, next?: SignCallback) => void;
|
||||
}
|
||||
export = fastifyJwt;
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"fastify": "^1.11.2"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user