@readytomog/contracts 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gen/auth.ts +48 -15
- package/package.json +1 -1
- package/proto/auth.proto +21 -8
package/gen/auth.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
9
|
import { Observable } from "rxjs";
|
|
10
|
+
import { Empty } from "./google/protobuf/empty";
|
|
10
11
|
|
|
11
12
|
export const protobufPackage = "auth.v1";
|
|
12
13
|
|
|
@@ -31,23 +32,31 @@ export interface RegistrationResponse {
|
|
|
31
32
|
message: string;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
export interface LogoutRequest {
|
|
35
|
-
userId: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
35
|
export interface LogoutResponse {
|
|
39
36
|
ok: boolean;
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
export interface RefreshAuthRequest {
|
|
43
|
-
userId: number;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
39
|
export interface RefreshAuthResponse {
|
|
47
40
|
accessToken: string;
|
|
48
41
|
refreshToken: string;
|
|
49
42
|
}
|
|
50
43
|
|
|
44
|
+
export interface GenerateSecretResponse {
|
|
45
|
+
qrCode: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface VerifyTokenRequest {
|
|
49
|
+
token: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface VerifyTokenResponse {
|
|
53
|
+
verify: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface DisableTwoFactorResponse {
|
|
57
|
+
disable: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
52
61
|
|
|
53
62
|
export interface AuthServiceClient {
|
|
@@ -55,9 +64,15 @@ export interface AuthServiceClient {
|
|
|
55
64
|
|
|
56
65
|
registration(request: RegistrationRequest): Observable<RegistrationResponse>;
|
|
57
66
|
|
|
58
|
-
logout(request:
|
|
67
|
+
logout(request: Empty): Observable<LogoutResponse>;
|
|
68
|
+
|
|
69
|
+
refreshAuth(request: Empty): Observable<RefreshAuthResponse>;
|
|
70
|
+
|
|
71
|
+
generateSecret(request: Empty): Observable<GenerateSecretResponse>;
|
|
59
72
|
|
|
60
|
-
|
|
73
|
+
verifyToken(request: VerifyTokenRequest): Observable<VerifyTokenResponse>;
|
|
74
|
+
|
|
75
|
+
disableTwoFactor(request: Empty): Observable<DisableTwoFactorResponse>;
|
|
61
76
|
}
|
|
62
77
|
|
|
63
78
|
export interface AuthServiceController {
|
|
@@ -67,16 +82,34 @@ export interface AuthServiceController {
|
|
|
67
82
|
request: RegistrationRequest,
|
|
68
83
|
): Promise<RegistrationResponse> | Observable<RegistrationResponse> | RegistrationResponse;
|
|
69
84
|
|
|
70
|
-
logout(request:
|
|
85
|
+
logout(request: Empty): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
|
86
|
+
|
|
87
|
+
refreshAuth(request: Empty): Promise<RefreshAuthResponse> | Observable<RefreshAuthResponse> | RefreshAuthResponse;
|
|
88
|
+
|
|
89
|
+
generateSecret(
|
|
90
|
+
request: Empty,
|
|
91
|
+
): Promise<GenerateSecretResponse> | Observable<GenerateSecretResponse> | GenerateSecretResponse;
|
|
92
|
+
|
|
93
|
+
verifyToken(
|
|
94
|
+
request: VerifyTokenRequest,
|
|
95
|
+
): Promise<VerifyTokenResponse> | Observable<VerifyTokenResponse> | VerifyTokenResponse;
|
|
71
96
|
|
|
72
|
-
|
|
73
|
-
request:
|
|
74
|
-
): Promise<
|
|
97
|
+
disableTwoFactor(
|
|
98
|
+
request: Empty,
|
|
99
|
+
): Promise<DisableTwoFactorResponse> | Observable<DisableTwoFactorResponse> | DisableTwoFactorResponse;
|
|
75
100
|
}
|
|
76
101
|
|
|
77
102
|
export function AuthServiceControllerMethods() {
|
|
78
103
|
return function (constructor: Function) {
|
|
79
|
-
const grpcMethods: string[] = [
|
|
104
|
+
const grpcMethods: string[] = [
|
|
105
|
+
"login",
|
|
106
|
+
"registration",
|
|
107
|
+
"logout",
|
|
108
|
+
"refreshAuth",
|
|
109
|
+
"generateSecret",
|
|
110
|
+
"verifyToken",
|
|
111
|
+
"disableTwoFactor",
|
|
112
|
+
];
|
|
80
113
|
for (const method of grpcMethods) {
|
|
81
114
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
82
115
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
package/proto/auth.proto
CHANGED
|
@@ -7,8 +7,11 @@ import "google/protobuf/empty.proto";
|
|
|
7
7
|
service AuthService {
|
|
8
8
|
rpc Login (LoginRequest) returns (LoginResponse);
|
|
9
9
|
rpc Registration (RegistrationRequest) returns (RegistrationResponse);
|
|
10
|
-
rpc Logout (
|
|
11
|
-
rpc RefreshAuth (
|
|
10
|
+
rpc Logout (google.protobuf.Empty) returns (LogoutResponse);
|
|
11
|
+
rpc RefreshAuth (google.protobuf.Empty) returns (RefreshAuthResponse);
|
|
12
|
+
rpc GenerateSecret (google.protobuf.Empty) returns (GenerateSecretResponse);
|
|
13
|
+
rpc VerifyToken(VerifyTokenRequest) returns(VerifyTokenResponse);
|
|
14
|
+
rpc DisableTwoFactor(google.protobuf.Empty) returns(DisableTwoFactorResponse);
|
|
12
15
|
};
|
|
13
16
|
|
|
14
17
|
message LoginRequest {
|
|
@@ -32,19 +35,29 @@ message RegistrationResponse {
|
|
|
32
35
|
string message = 1;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
message LogoutRequest {
|
|
36
|
-
int32 userId = 1;
|
|
37
|
-
}
|
|
38
38
|
|
|
39
39
|
message LogoutResponse {
|
|
40
40
|
bool ok = 1;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
message RefreshAuthRequest {
|
|
44
|
-
int32 userId = 1;
|
|
45
|
-
}
|
|
46
43
|
|
|
47
44
|
message RefreshAuthResponse {
|
|
48
45
|
string accessToken = 1;
|
|
49
46
|
string refreshToken = 2;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
message GenerateSecretResponse {
|
|
50
|
+
string qrCode = 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
message VerifyTokenRequest {
|
|
54
|
+
string token = 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
message VerifyTokenResponse {
|
|
58
|
+
bool verify = 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
message DisableTwoFactorResponse {
|
|
62
|
+
bool disable = 1;
|
|
50
63
|
}
|