///
///
import { STRATEGY } from '@bleco/authentication';
import { AnyObject } from '@loopback/repository';
import { Response } from '@loopback/rest';
import { IServiceConfig } from '@loopx/core';
import { User, UserTenant } from '@loopx/user-core';
import { CookieSerializeOptions } from 'cookie';
import { OtpMethodType } from './enums';
import { LocalUserProfile, LoginActivity, SignupRequestDto } from './models';
export declare const AuthDbSourceName = "AuthDB";
export declare const AuthCacheSourceName = "AuthCache";
export interface PagesOptions {
webMessage?: string;
}
export interface IAuthServiceConfig extends Partial {
defaultTenantKey?: string;
defaultRoleKey?: string;
controllers?: string[];
pages?: PagesOptions;
}
export interface IMfaConfig {
secondFactor: STRATEGY;
}
export interface IUserActivity {
markUserActivity: boolean;
}
export interface IOtpConfig {
method: OtpMethodType;
}
export interface IAuthaConfig {
endpoint: string;
appId: string;
appSecret: string;
}
export interface PreSignupFn {
(request: SignupRequestDto): Promise;
}
export interface UserSignupFn {
(model: T & LocalUserProfile, tokenInfo?: AnyObject): Promise;
}
export interface Cookie {
name: string;
value: string;
options: CookieSerializeOptions;
}
export interface ResponseInternal | any[] | null = any> {
status?: number;
headers?: Headers;
body?: Body;
redirect?: string;
cookies?: Cookie[];
}
export interface WebMessageResult {
code: string;
role?: string;
state?: string | null;
}
export interface WebMessageError {
error: string;
error_description: string;
}
export type WebMessageData = WebMessageResult | WebMessageError;
export interface AuthPages {
webMessage(data: WebMessageData, response: Response): void;
}
export interface IAuthClientDTO {
client_id: string;
client_secret: string;
}
export interface ExternalTokens {
externalAuthToken?: string;
externalRefreshToken?: string;
}
export type ActorId = Extract;
export interface ActiveUsersGroupData {
[key: string]: {
[loginType: string]: Array;
};
}
export type OtpRequestMethod = 'email' | 'sms';
export interface IOtpRequest {
/**
* The connection type of the user contact identifier.
*/
method: OtpRequestMethod;
/**
* The contact identifier. It can be phone number or email address.
*/
contact: string;
/**
* The user object if the user is already registered.
*/
user?: User | null;
}