318 lines
8.7 KiB
TypeScript
318 lines
8.7 KiB
TypeScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-ts_proto v2.11.6
|
|
// protoc v3.21.12
|
|
// source: identity.proto
|
|
|
|
/* eslint-disable */
|
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
import { Observable } from "rxjs";
|
|
|
|
export const protobufPackage = "identity";
|
|
|
|
export interface LoginRequest {
|
|
username: string;
|
|
password: string;
|
|
}
|
|
|
|
export interface LoginResponse {
|
|
accessToken: string;
|
|
refreshToken: string;
|
|
status: string;
|
|
need2fa: boolean;
|
|
tempToken?: string | undefined;
|
|
message?: string | undefined;
|
|
errorCode?: string | undefined;
|
|
}
|
|
|
|
export interface RefreshRequest {
|
|
refreshToken: string;
|
|
}
|
|
|
|
export interface RefreshResponse {
|
|
accessToken: string;
|
|
refreshToken: string;
|
|
}
|
|
|
|
export interface LogoutRequest {
|
|
accessToken: string;
|
|
}
|
|
|
|
export interface LogoutResponse {
|
|
success: boolean;
|
|
message: string;
|
|
}
|
|
|
|
export interface VerifyTokenRequest {
|
|
token: string;
|
|
}
|
|
|
|
export interface VerifyTokenResponse {
|
|
isValid: boolean;
|
|
errorMessage: string;
|
|
id: string;
|
|
username: string;
|
|
roleLevel: number;
|
|
permissions: string[];
|
|
sessionId: string;
|
|
}
|
|
|
|
export interface GetAccountRoleLevelRequest {
|
|
accountId: string;
|
|
}
|
|
|
|
export interface GetAccountRoleLevelResponse {
|
|
found: boolean;
|
|
roleLevel: number;
|
|
}
|
|
|
|
export interface UnlockPinRequest {
|
|
accessToken: string;
|
|
pinCode: string;
|
|
}
|
|
|
|
export interface UnlockPinResponse {
|
|
success: boolean;
|
|
message: string;
|
|
}
|
|
|
|
export interface Verify2FaRequest {
|
|
tempToken: string;
|
|
totpCode?: string | undefined;
|
|
telegramCode?: string | undefined;
|
|
}
|
|
|
|
export interface Verify2FaResponse {
|
|
accessToken: string;
|
|
refreshToken: string;
|
|
status: string;
|
|
message: string;
|
|
reserveCodes: string[];
|
|
}
|
|
|
|
export interface AuthenticatedAccessRequest {
|
|
accessToken: string;
|
|
}
|
|
|
|
export interface GetTwoFaStatusRequest {
|
|
accessToken: string;
|
|
}
|
|
|
|
export interface GetTwoFaStatusResponse {
|
|
totpEnabled: boolean;
|
|
telegramEnabled: boolean;
|
|
totpEnrollmentPending: boolean;
|
|
telegramEnrollmentPending: boolean;
|
|
}
|
|
|
|
export interface StartTotpEnrollmentResponse {
|
|
secretBase32: string;
|
|
otpauthUri: string;
|
|
issuer: string;
|
|
accountLabel: string;
|
|
}
|
|
|
|
export interface ConfirmTotpEnrollmentRequest {
|
|
accessToken: string;
|
|
totpCode: string;
|
|
}
|
|
|
|
export interface ConfirmTotpEnrollmentResponse {
|
|
status: string;
|
|
message: string;
|
|
reserveCodes: string[];
|
|
}
|
|
|
|
export interface CancelTotpEnrollmentResponse {
|
|
status: string;
|
|
message: string;
|
|
}
|
|
|
|
export interface DisableTotpRequest {
|
|
accessToken: string;
|
|
password: string;
|
|
totpCode?: string | undefined;
|
|
}
|
|
|
|
export interface DisableTotpResponse {
|
|
status: string;
|
|
message: string;
|
|
}
|
|
|
|
export interface StartTelegramEnrollmentResponse {
|
|
enrollmentToken: string;
|
|
deepLink: string;
|
|
botUsername: string;
|
|
expiresAtIso: string;
|
|
}
|
|
|
|
export interface ConfirmTelegramEnrollmentRequest {
|
|
accessToken: string;
|
|
enrollmentToken: string;
|
|
otpCode: string;
|
|
}
|
|
|
|
export interface ConfirmTelegramEnrollmentResponse {
|
|
status: string;
|
|
message: string;
|
|
reserveCodes: string[];
|
|
}
|
|
|
|
export interface DisableTelegramRequest {
|
|
accessToken: string;
|
|
password: string;
|
|
telegramOtpCode?: string | undefined;
|
|
}
|
|
|
|
export interface DisableTelegramResponse {
|
|
status: string;
|
|
message: string;
|
|
}
|
|
|
|
export const IDENTITY_PACKAGE_NAME = "identity";
|
|
|
|
export interface AuthServiceClient {
|
|
login(request: LoginRequest): Observable<LoginResponse>;
|
|
|
|
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
|
|
|
verifyToken(request: VerifyTokenRequest): Observable<VerifyTokenResponse>;
|
|
|
|
getAccountRoleLevel(request: GetAccountRoleLevelRequest): Observable<GetAccountRoleLevelResponse>;
|
|
|
|
logout(request: LogoutRequest): Observable<LogoutResponse>;
|
|
|
|
unlockPin(request: UnlockPinRequest): Observable<UnlockPinResponse>;
|
|
|
|
verify2Fa(request: Verify2FaRequest): Observable<Verify2FaResponse>;
|
|
}
|
|
|
|
export interface AuthServiceController {
|
|
login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
|
|
|
|
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
|
|
|
verifyToken(
|
|
request: VerifyTokenRequest,
|
|
): Promise<VerifyTokenResponse> | Observable<VerifyTokenResponse> | VerifyTokenResponse;
|
|
|
|
getAccountRoleLevel(
|
|
request: GetAccountRoleLevelRequest,
|
|
): Promise<GetAccountRoleLevelResponse> | Observable<GetAccountRoleLevelResponse> | GetAccountRoleLevelResponse;
|
|
|
|
logout(request: LogoutRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
|
|
|
unlockPin(request: UnlockPinRequest): Promise<UnlockPinResponse> | Observable<UnlockPinResponse> | UnlockPinResponse;
|
|
|
|
verify2Fa(request: Verify2FaRequest): Promise<Verify2FaResponse> | Observable<Verify2FaResponse> | Verify2FaResponse;
|
|
}
|
|
|
|
export function AuthServiceControllerMethods() {
|
|
return function (constructor: Function) {
|
|
const grpcMethods: string[] = [
|
|
"login",
|
|
"refresh",
|
|
"verifyToken",
|
|
"getAccountRoleLevel",
|
|
"logout",
|
|
"unlockPin",
|
|
"verify2Fa",
|
|
];
|
|
for (const method of grpcMethods) {
|
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
}
|
|
const grpcStreamMethods: string[] = [];
|
|
for (const method of grpcStreamMethods) {
|
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
}
|
|
};
|
|
}
|
|
|
|
export const AUTH_SERVICE_NAME = "AuthService";
|
|
|
|
export interface TwoFaServiceClient {
|
|
getTwoFaStatus(request: GetTwoFaStatusRequest): Observable<GetTwoFaStatusResponse>;
|
|
|
|
startTotpEnrollment(request: AuthenticatedAccessRequest): Observable<StartTotpEnrollmentResponse>;
|
|
|
|
confirmTotpErollment(request: ConfirmTotpEnrollmentRequest): Observable<ConfirmTotpEnrollmentResponse>;
|
|
|
|
cancelTotpEnrollment(request: AuthenticatedAccessRequest): Observable<CancelTotpEnrollmentResponse>;
|
|
|
|
disableTotp(request: DisableTotpRequest): Observable<DisableTotpResponse>;
|
|
|
|
startTelegramEnrollment(request: AuthenticatedAccessRequest): Observable<StartTelegramEnrollmentResponse>;
|
|
|
|
confirmTelegramEnrollment(request: ConfirmTelegramEnrollmentRequest): Observable<ConfirmTelegramEnrollmentResponse>;
|
|
|
|
disableTelegram(request: DisableTelegramRequest): Observable<DisableTelegramResponse>;
|
|
}
|
|
|
|
export interface TwoFaServiceController {
|
|
getTwoFaStatus(
|
|
request: GetTwoFaStatusRequest,
|
|
): Promise<GetTwoFaStatusResponse> | Observable<GetTwoFaStatusResponse> | GetTwoFaStatusResponse;
|
|
|
|
startTotpEnrollment(
|
|
request: AuthenticatedAccessRequest,
|
|
): Promise<StartTotpEnrollmentResponse> | Observable<StartTotpEnrollmentResponse> | StartTotpEnrollmentResponse;
|
|
|
|
confirmTotpErollment(
|
|
request: ConfirmTotpEnrollmentRequest,
|
|
): Promise<ConfirmTotpEnrollmentResponse> | Observable<ConfirmTotpEnrollmentResponse> | ConfirmTotpEnrollmentResponse;
|
|
|
|
cancelTotpEnrollment(
|
|
request: AuthenticatedAccessRequest,
|
|
): Promise<CancelTotpEnrollmentResponse> | Observable<CancelTotpEnrollmentResponse> | CancelTotpEnrollmentResponse;
|
|
|
|
disableTotp(
|
|
request: DisableTotpRequest,
|
|
): Promise<DisableTotpResponse> | Observable<DisableTotpResponse> | DisableTotpResponse;
|
|
|
|
startTelegramEnrollment(
|
|
request: AuthenticatedAccessRequest,
|
|
):
|
|
| Promise<StartTelegramEnrollmentResponse>
|
|
| Observable<StartTelegramEnrollmentResponse>
|
|
| StartTelegramEnrollmentResponse;
|
|
|
|
confirmTelegramEnrollment(
|
|
request: ConfirmTelegramEnrollmentRequest,
|
|
):
|
|
| Promise<ConfirmTelegramEnrollmentResponse>
|
|
| Observable<ConfirmTelegramEnrollmentResponse>
|
|
| ConfirmTelegramEnrollmentResponse;
|
|
|
|
disableTelegram(
|
|
request: DisableTelegramRequest,
|
|
): Promise<DisableTelegramResponse> | Observable<DisableTelegramResponse> | DisableTelegramResponse;
|
|
}
|
|
|
|
export function TwoFaServiceControllerMethods() {
|
|
return function (constructor: Function) {
|
|
const grpcMethods: string[] = [
|
|
"getTwoFaStatus",
|
|
"startTotpEnrollment",
|
|
"confirmTotpErollment",
|
|
"cancelTotpEnrollment",
|
|
"disableTotp",
|
|
"startTelegramEnrollment",
|
|
"confirmTelegramEnrollment",
|
|
"disableTelegram",
|
|
];
|
|
for (const method of grpcMethods) {
|
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
GrpcMethod("TwoFaService", method)(constructor.prototype[method], method, descriptor);
|
|
}
|
|
const grpcStreamMethods: string[] = [];
|
|
for (const method of grpcStreamMethods) {
|
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
GrpcStreamMethod("TwoFaService", method)(constructor.prototype[method], method, descriptor);
|
|
}
|
|
};
|
|
}
|
|
|
|
export const TWO_FA_SERVICE_NAME = "TwoFaService";
|