@xwing-dev/shared 1.0.3 → 1.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwing-dev/shared",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -10,29 +10,47 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "auth.v1";
12
12
 
13
- export interface SendOtpDto {
13
+ export interface SendOtpRequestDto {
14
14
  identifier: string;
15
- phone?: string | undefined;
16
- email?: string | undefined;
15
+ type: string;
17
16
  }
18
17
 
19
18
  export interface SendOtpResponseDto {
20
19
  message: string;
21
20
  }
22
21
 
22
+ export interface VerifyOtpRequestDto {
23
+ identifier: string;
24
+ type: string;
25
+ code: string;
26
+ }
27
+
28
+ export interface VerifyOtpResponseDto {
29
+ accessToken: string;
30
+ refreshToken: string;
31
+ }
32
+
23
33
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
24
34
 
25
35
  export interface AuthServiceClient {
26
- sendOtp(request: SendOtpDto): Observable<SendOtpResponseDto>;
36
+ sendOtp(request: SendOtpRequestDto): Observable<SendOtpResponseDto>;
37
+
38
+ verifyOtp(request: VerifyOtpRequestDto): Observable<VerifyOtpResponseDto>;
27
39
  }
28
40
 
29
41
  export interface AuthServiceController {
30
- sendOtp(request: SendOtpDto): Promise<SendOtpResponseDto> | Observable<SendOtpResponseDto> | SendOtpResponseDto;
42
+ sendOtp(
43
+ request: SendOtpRequestDto,
44
+ ): Promise<SendOtpResponseDto> | Observable<SendOtpResponseDto> | SendOtpResponseDto;
45
+
46
+ verifyOtp(
47
+ request: VerifyOtpRequestDto,
48
+ ): Promise<VerifyOtpResponseDto> | Observable<VerifyOtpResponseDto> | VerifyOtpResponseDto;
31
49
  }
32
50
 
33
51
  export function AuthServiceControllerMethods() {
34
52
  return function (constructor: Function) {
35
- const grpcMethods: string[] = ["sendOtp"];
53
+ const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
36
54
  for (const method of grpcMethods) {
37
55
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
38
56
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -3,17 +3,26 @@ syntax = "proto3";
3
3
  package auth.v1;
4
4
 
5
5
  service AuthService {
6
- rpc SendOtp(SendOtpDto) returns (SendOtpResponseDto);
6
+ rpc SendOtp(SendOtpRequestDto) returns (SendOtpResponseDto);
7
+ rpc VerifyOtp(VerifyOtpRequestDto) returns (VerifyOtpResponseDto);
7
8
  }
8
9
 
9
- message SendOtpDto {
10
+ message SendOtpRequestDto {
10
11
  string identifier = 1;
11
- oneof type {
12
- string phone = 2;
13
- string email = 3;
14
- }
12
+ string type = 2;
15
13
  }
16
14
 
17
15
  message SendOtpResponseDto {
18
16
  string message = 1;
17
+ }
18
+
19
+ message VerifyOtpRequestDto {
20
+ string identifier = 1;
21
+ string type = 2;
22
+ string code = 3;
23
+ }
24
+
25
+ message VerifyOtpResponseDto {
26
+ string access_token = 1;
27
+ string refresh_token = 2;
19
28
  }