-
Notifications
You must be signed in to change notification settings - Fork 70
/
types.ts
64 lines (55 loc) · 1.68 KB
/
types.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
// Copyright (c) 2023 Sourcefuse Technologies
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
/* eslint-disable @typescript-eslint/naming-convention */
import {AnyObject} from '@loopback/repository';
import {IServiceConfig} from '@sourceloop/core';
import {STRATEGY} from 'loopback4-authentication';
import {OtpMethodType} from './enums';
import {LocalUserProfileDto, LoginActivity, UserTenant} from './models';
import {SignupRequestDto} from './models/signup-request-dto.model';
import {AuthRefreshTokenRequest} from './modules/auth';
// sonarignore:start
export interface IAuthServiceConfig extends IServiceConfig {
//do nothing
}
// sonarignore:end
export const AuthDbSourceName = 'AuthDB';
export const AuthCacheSourceName = 'AuthCache';
export interface IMfaConfig {
secondFactor: STRATEGY;
}
export interface IUserActivity {
markUserActivity: boolean;
}
export interface IOtpConfig {
method: OtpMethodType;
}
export type PreSignupFn<T, S> = (request: SignupRequestDto<T>) => Promise<S>;
export type UserValidationFn = (
req: AuthRefreshTokenRequest,
payload: AnyObject,
signUpProvider: string,
token?: string,
) => Promise<boolean>;
export type UserSignupFn<T, S> = (
model: T & LocalUserProfileDto,
tokenInfo?: AnyObject,
) => Promise<S>;
export interface IAuthClientDTO {
// sonarignore:start
client_id: string;
client_secret: string;
// sonarignore:end
}
export interface ExternalTokens {
externalAuthToken?: string;
externalRefreshToken?: string;
}
export type ActorId = Extract<keyof UserTenant, string>;
export interface ActiveUsersGroupData {
[key: string]: {
[loginType: string]: Array<LoginActivity>;
};
}