-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
108 lines (106 loc) · 3.66 KB
/
types.ts
File metadata and controls
108 lines (106 loc) · 3.66 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { app, httpRequest, httpResponse, nextFunction } from 'codehooks-js';
import handlebars from 'handlebars';
export interface AuthStrategy {
settings: any,
onSignupUser: (req: httpRequest, res: httpResponse, payload: any) => Promise<any>,
onLoginUser: (req: httpRequest, res: httpResponse, payload: any) => Promise<any>,
sendOTPMail: (content: Object) => Promise<any>,
initialize: (cohoApp: typeof app, settings: any, onSignupUser: (req: httpRequest, res: httpResponse, payload: any) => Promise<any>, onLoginUser: (req: httpRequest, res: httpResponse, payload: any) => Promise<any>, sendMail: (content: Object) => Promise<any>) => void;
login: (req: httpRequest, res: httpResponse) => Promise<void>;
signup?: (req: httpRequest, res: httpResponse) => Promise<void>;
verify?: (req: httpRequest, res: httpResponse) => Promise<void>;
callback?: (req: httpRequest, res: httpResponse, next?: nextFunction) => Promise<void>;
}
export type AuthSettings = {
userCollection?: string,
saltRounds?: number,
JWT_ACCESS_TOKEN_SECRET: string,
JWT_ACCESS_TOKEN_SECRET_EXPIRE?: string,
JWT_REFRESH_TOKEN_SECRET:string,
JWT_REFRESH_TOKEN_SECRET_EXPIRE?: string,
baseUrl: string,
redirectSuccessUrl?: string,
redirectFailUrl?: string,
redirectLogoutUrl?: string,
useCookie?: boolean,
baseAPIRoutes?: string,
defaultUserActive?: boolean,
google?: {
CLIENT_ID: string,
CLIENT_SECRET: string,
REDIRECT_URI?: string,
SCOPE?: string | string[]
},
github?: {
CLIENT_ID: string,
CLIENT_SECRET: string,
REDIRECT_URI?: string,
SCOPE?: string | string[]
},
emailProvider: 'mailgun' | 'postmark' | 'sendgrid' | 'none',
emailSettings?: {
mailgun?: {
MAILGUN_APIKEY: string,
MAILGUN_DOMAIN: string,
MAILGUN_FROM_EMAIL: string,
MAILGUN_FROM_NAME: string
},
sendgrid?: {
SENDGRID_APIKEY: string,
SENDGRID_FROM_EMAIL: string,
SENDGRID_FROM_NAME: string
},
postmark?: {
POSTMARK_APIKEY: string,
POSTMARK_FROM_EMAIL: string,
POSTMARK_FROM_NAME: string
}
},
emailSignupData?: {
subject: string,
title: string,
productName: string,
productUrl: string,
companyName: string,
companyAddress: string,
companySuite: string,
support_email: string,
live_chat_url: string,
help_url: string,
login_url: string,
senderName: string
},
emailOTPData?: {
subject: string,
title: string,
productName: string,
productUrl: string,
companyName: string,
companyAddress: string,
companySuite: string,
support_email: string,
live_chat_url: string,
help_url: string,
login_url: string,
senderName: string
},
labels?: {
signinTitle?: string,
signupTitle?: string,
forgotTitle?: string,
otpTitle?: string
},
templateLoaders?: {
layout?: () => Function;
login?: () => Function;
otp?: () => Function;
signup?: () => Function;
emailTemplateWelcome?: () => Function;
emailTemplateWelcomeText?: () => Function;
emailTemplateOTP?: () => Function;
emailTemplateOTPText?: () => Function;
},
onLoginUser?: (req:httpRequest, res:httpResponse, payload: any) => Promise<any>,
onSignupUser?: (req:httpRequest, res:httpResponse, payload: any) => Promise<any>,
staticHook?: (req:httpRequest, res:httpResponse, next: Function) => void,
}