-
Notifications
You must be signed in to change notification settings - Fork 372
/
options.d.ts
48 lines (48 loc) · 1.72 KB
/
options.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
export declare enum AuthRequestType {
UserAuthentication = "user-authentication",
ChannelAuthorization = "channel-authorization"
}
export interface ChannelAuthorizationData {
auth: string;
channel_data?: string;
shared_secret?: string;
}
export declare type ChannelAuthorizationCallback = (error: Error | null, authData: ChannelAuthorizationData | null) => void;
export interface ChannelAuthorizationRequestParams {
socketId: string;
channelName: string;
}
export interface ChannelAuthorizationHandler {
(params: ChannelAuthorizationRequestParams, callback: ChannelAuthorizationCallback): void;
}
export interface UserAuthenticationData {
auth: string;
user_data: string;
}
export declare type UserAuthenticationCallback = (error: Error | null, authData: UserAuthenticationData | null) => void;
export interface UserAuthenticationRequestParams {
socketId: string;
}
export interface UserAuthenticationHandler {
(params: UserAuthenticationRequestParams, callback: UserAuthenticationCallback): void;
}
export declare type AuthTransportCallback = ChannelAuthorizationCallback | UserAuthenticationCallback;
export interface AuthOptionsT<AuthHandler> {
transport: 'ajax' | 'jsonp';
endpoint: string;
params?: any;
headers?: any;
paramProvider?: () => any;
headerProvider?: () => any;
customHandler?: AuthHandler;
}
export declare type UserAuthenticationOptions = AuthOptionsT<UserAuthenticationHandler>;
export declare type ChannelAuthorizationOptions = AuthOptionsT<ChannelAuthorizationHandler>;
export interface InternalAuthOptions {
transport: 'ajax' | 'jsonp';
endpoint: string;
params?: any;
headers?: any;
paramProvider?: () => any;
headerProvider?: () => any;
}