forked from nextauthjs/next-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
84 lines (80 loc) · 2.12 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { Store } from "express-session";
import { RequestHandler } from "express";
import { IpcNetConnectOpts } from "net";
declare namespace nextAuth {
interface IOptions {
bodyParser: boolean;
csrf: boolean;
pathPrefix: string;
expressApp?: Express.Application;
expressSession: RequestHandler;
sessionSecret: string;
sessionStore: Store;
sessionMaxAge: number;
sessionRevalidateAge: number;
sessionResave: boolean;
sessionRolling: boolean;
sessionSaveUninitialized: boolean;
serverUrl?: string;
trustProxy: boolean;
providers: any[];
port?: number;
functions: IFunctions;
}
interface IUserProvider {
name: string;
id: string;
}
interface ISendSignInEmailOpts {
email?: string;
url?: string;
req?: Express.Request;
}
interface ISignInOpts {
email?: string;
password?: string;
}
interface INextAuthSessionData<UserType = {}> extends Session {
maxAge: number;
revalidateAge: number;
csrfToken: string;
user?: UserType;
expires?: number;
}
interface IFunctions<
UserType = {},
IDType = string,
SessionType extends INextAuthSessionData = INextAuthSessionData
> {
find(
id: IDType,
email: string,
emailToken: string,
provider: IUserProvider
): Promise<UserType>;
update: (user: UserType, profile: any) => Promise<UserType>;
insert: (user: UserType, profile: any) => Promise<UserType>;
remove: (id: IDType) => Promise<boolean>;
serialize: (user: UserType) => Promise<IDType>;
deserialize: (id: IDType) => Promise<UserType>;
session?: (
session: INextAuthSessionData,
req: Express.Request
) => SessionType;
sendSignInEmail?: (opts: ISendSignInEmailOpts) => Promise<boolean>;
signIn?: (opts: ISignInOpts) => Promise<UserType>;
}
interface INextAuthResult {
next?: nextApp;
express: Express;
expressApp: Express.Application;
function: IFunctions;
providers: any;
port?: number;
}
}
declare function NextAuth(
nextApp?: NextApp,
options?: nextAuth.IOptions
): Promise<nextAuth.INextAuthResult>;
export = NextAuth;