forked from fastify/fastify-jwt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
49 lines (43 loc) · 1.46 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import * as fastify from "fastify";
import { IncomingMessage, Server, ServerResponse } from "http";
import { DecodeOptions, Secret, SignOptions, VerifyCallback, VerifyOptions } from "jsonwebtoken";
declare module "fastify"
{
interface Jwt
{
decode: (token: string, options?: DecodeOptions) => null | { [key: string]: any } | string;
options: {
/**
* decodeOptions
*/
decode: DecodeOptions,
/**
* signOptions
*/
sign: SignOptions,
/**
* verifyOptions
*/
verify: VerifyOptions,
};
secret: Secret;
sign: (playload: string | Buffer | object, options?: SignOptions, callback?: VerifyCallback) => string;
verify: (token: string, options?: VerifyOptions, callback?: VerifyCallback) => Promise<object | string>;
}
interface FastifyInstance<HttpServer = Server, HttpRequest = IncomingMessage, HttpResponse = ServerResponse>
{
jwt: Jwt;
}
interface FastifyRequest<
HttpRequest,
Query = DefaultQuery,
Params = DefaultParams,
Headers = DefaultHeaders,
Body = DefaultBody
>
{
jwtVerify(callback?: VerifyCallback): Promise<any>;
}
}
declare const fastifyJWT: fastify.Plugin<Server, IncomingMessage, ServerResponse, { secret: Secret }>;
export = fastifyJWT;