@voice-chat/contracts 1.0.9 → 1.0.10

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 CHANGED
@@ -10,6 +10,23 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "auth.v1";
12
12
 
13
+ export enum TokenType {
14
+ ACCESS = 0,
15
+ REFRESH = 1,
16
+ UNRECOGNIZED = -1,
17
+ }
18
+
19
+ export interface VerifyTokenRequest {
20
+ token: string;
21
+ tokenType: TokenType;
22
+ }
23
+
24
+ export interface VerifyTokenResponse {
25
+ isValid: boolean;
26
+ userId: string;
27
+ username: string;
28
+ }
29
+
13
30
  export interface LoginRequest {
14
31
  email: string;
15
32
  password: string;
@@ -36,27 +53,55 @@ export interface AuthServiceClient {
36
53
  login(request: LoginRequest): Observable<LoginResponse>;
37
54
 
38
55
  registration(request: RegistrationRequest): Observable<RegistrationResponse>;
56
+
57
+ verifyToken(request: VerifyTokenRequest): Observable<VerifyTokenResponse>;
39
58
  }
40
59
 
41
60
  export interface AuthServiceController {
42
- login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
61
+ login(
62
+ request: LoginRequest,
63
+ ): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
43
64
 
44
65
  registration(
45
66
  request: RegistrationRequest,
46
- ): Promise<RegistrationResponse> | Observable<RegistrationResponse> | RegistrationResponse;
67
+ ):
68
+ | Promise<RegistrationResponse>
69
+ | Observable<RegistrationResponse>
70
+ | RegistrationResponse;
71
+
72
+ verifyToken(
73
+ request: VerifyTokenRequest,
74
+ ):
75
+ | Promise<VerifyTokenResponse>
76
+ | Observable<VerifyTokenResponse>
77
+ | VerifyTokenResponse;
47
78
  }
48
79
 
49
80
  export function AuthServiceControllerMethods() {
50
81
  return function (constructor: Function) {
51
- const grpcMethods: string[] = ["login", "registration"];
82
+ const grpcMethods: string[] = ["login", "registration", "verifyToken"];
52
83
  for (const method of grpcMethods) {
53
- const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
54
- GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
84
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(
85
+ constructor.prototype,
86
+ method,
87
+ );
88
+ GrpcMethod("AuthService", method)(
89
+ constructor.prototype[method],
90
+ method,
91
+ descriptor,
92
+ );
55
93
  }
56
94
  const grpcStreamMethods: string[] = [];
57
95
  for (const method of grpcStreamMethods) {
58
- const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
59
- GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
96
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(
97
+ constructor.prototype,
98
+ method,
99
+ );
100
+ GrpcStreamMethod("AuthService", method)(
101
+ constructor.prototype[method],
102
+ method,
103
+ descriptor,
104
+ );
60
105
  }
61
106
  };
62
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voice-chat/contracts",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "api-contracts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/proto/auth.proto CHANGED
@@ -5,6 +5,23 @@ package auth.v1;
5
5
  service AuthService {
6
6
  rpc Login(LoginRequest) returns (LoginResponse);
7
7
  rpc Registration(RegistrationRequest) returns (RegistrationResponse);
8
+ rpc VerifyToken(VerifyTokenRequest) returns (VerifyTokenResponse);
9
+ }
10
+
11
+ enum TokenType {
12
+ ACCESS = 0;
13
+ REFRESH = 1;
14
+ }
15
+
16
+ message VerifyTokenRequest {
17
+ string token = 1;
18
+ TokenType token_type = 2;
19
+ }
20
+
21
+ message VerifyTokenResponse {
22
+ bool is_valid = 1;
23
+ string user_id = 2;
24
+ string username = 3;
8
25
  }
9
26
 
10
27
  message LoginRequest {