@nexiolab/contracts 1.0.1 → 1.0.3

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,18 +10,23 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "auth.v1";
12
12
 
13
- export enum IdentifierType {
14
- EMAIL = 0,
15
- PHONE = 1,
16
- UNRECOGNIZED = -1,
17
- }
18
-
19
13
  export interface SendOtpRequest {
20
14
  identifier: string;
21
- type: IdentifierType;
15
+ type: string;
22
16
  }
23
17
 
24
18
  export interface SendOtpResponse {
19
+ accessToken: string;
20
+ refreshToken: string;
21
+ }
22
+
23
+ export interface VerifyOtpRequest {
24
+ identifier: string;
25
+ type: string;
26
+ code: string;
27
+ }
28
+
29
+ export interface VerifyOtpResponse {
25
30
  ok: boolean;
26
31
  }
27
32
 
@@ -33,6 +38,10 @@ export interface AuthServiceClient {
33
38
  /** SendOtp sends an OTP to the user */
34
39
 
35
40
  sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
41
+
42
+ /** Verifies otp code from user */
43
+
44
+ verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
36
45
  }
37
46
 
38
47
  /** AuthService provides authentication related operations */
@@ -41,11 +50,15 @@ export interface AuthServiceController {
41
50
  /** SendOtp sends an OTP to the user */
42
51
 
43
52
  sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
53
+
54
+ /** Verifies otp code from user */
55
+
56
+ verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
44
57
  }
45
58
 
46
59
  export function AuthServiceControllerMethods() {
47
60
  return function (constructor: Function) {
48
- const grpcMethods: string[] = ["sendOtp"];
61
+ const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
49
62
  for (const method of grpcMethods) {
50
63
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
51
64
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexiolab/contracts",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "scripts": {
6
6
  "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
package/proto/auth.proto CHANGED
@@ -6,18 +6,26 @@ package auth.v1;
6
6
  service AuthService {
7
7
  // SendOtp sends an OTP to the user
8
8
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
9
+ //Verifies otp code from user
10
+ rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse);
9
11
  }
10
12
 
11
13
  message SendOtpRequest {
12
14
  string identifier = 1;
13
- IdentifierType type = 2;
15
+ string type = 2;
14
16
  }
15
17
 
16
- enum IdentifierType {
17
- EMAIL = 0;
18
- PHONE = 1;
18
+ message SendOtpResponse {
19
+ string access_token = 1;
20
+ string refresh_token = 2;
19
21
  }
20
22
 
21
- message SendOtpResponse {
23
+ message VerifyOtpRequest {
24
+ string identifier = 1;
25
+ string type = 2;
26
+ string code = 3;
27
+ }
28
+
29
+ message VerifyOtpResponse {
22
30
  bool ok = 1;
23
31
  }