@getastro/contracts 1.0.0 → 1.0.1

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
@@ -30,6 +30,15 @@ export interface VerifyOtpResponse {
30
30
  refreshToken: string;
31
31
  }
32
32
 
33
+ export interface RefreshRequest {
34
+ refreshToken: string;
35
+ }
36
+
37
+ export interface RefreshResponse {
38
+ accessToken: string;
39
+ refreshToken: string;
40
+ }
41
+
33
42
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
34
43
 
35
44
  /** Сервис аутентификации для управления одноразовыми паролями (OTP) и токенами. */
@@ -42,6 +51,10 @@ export interface AuthServiceClient {
42
51
  /** Проверяет код и возвращает пару JWT токенов при успехе. */
43
52
 
44
53
  verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
54
+
55
+ /** Обновляет access token, используя refresh token. */
56
+
57
+ refresh(request: RefreshRequest): Observable<RefreshResponse>;
45
58
  }
46
59
 
47
60
  /** Сервис аутентификации для управления одноразовыми паролями (OTP) и токенами. */
@@ -54,11 +67,15 @@ export interface AuthServiceController {
54
67
  /** Проверяет код и возвращает пару JWT токенов при успехе. */
55
68
 
56
69
  verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
70
+
71
+ /** Обновляет access token, используя refresh token. */
72
+
73
+ refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
57
74
  }
58
75
 
59
76
  export function AuthServiceControllerMethods() {
60
77
  return function (constructor: Function) {
61
- const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
78
+ const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh"];
62
79
  for (const method of grpcMethods) {
63
80
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
64
81
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getastro/contracts",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/proto/auth.proto CHANGED
@@ -9,6 +9,9 @@ service AuthService {
9
9
 
10
10
  // Проверяет код и возвращает пару JWT токенов при успехе.
11
11
  rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
12
+
13
+ // Обновляет access token, используя refresh token.
14
+ rpc Refresh (RefreshRequest) returns (RefreshResponse);
12
15
  }
13
16
 
14
17
  message SendOtpRequest {
@@ -29,4 +32,13 @@ message VerifyOtpRequest {
29
32
  message VerifyOtpResponse {
30
33
  string access_token = 1;
31
34
  string refresh_token = 2;
35
+ }
36
+
37
+ message RefreshRequest {
38
+ string refresh_token = 1;
39
+ }
40
+
41
+ message RefreshResponse {
42
+ string access_token = 1;
43
+ string refresh_token = 2;
32
44
  }