Files
outline/server/typings/socketio-auth.d.ts
2022-01-06 18:24:28 -08:00

29 lines
656 B
TypeScript

declare module "socketio-auth" {
import IO from "socket.io";
type AuthenticatedSocket = IO.Socket & {
client: IO.Client & {
user: any;
};
};
type AuthenticateCallback = (
socket: AuthenticatedSocket,
data: { token: string },
callback: (err: Error | null, allow: boolean) => void
) => Promise<void>;
type PostAuthenticateCallback = (
socket: AuthenticatedSocket
) => Promise<void>;
type AuthenticationConfig = {
authenticate: AuthenticateCallback;
postAuthenticate: PostAuthenticateCallback;
};
const SocketAuth: (io: IO.Server, config: AuthenticationConfig) => void;
export = SocketAuth;
}