@dimgit9/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
@@ -21,6 +21,17 @@ export interface SendOtpResponse {
21
21
  ok: boolean;
22
22
  }
23
23
 
24
+ export interface VerifyOtpRequest {
25
+ identifier: string;
26
+ type: string;
27
+ code: string;
28
+ }
29
+
30
+ export interface VerifyOtpResponse {
31
+ accessToken: string;
32
+ refreshToken: string;
33
+ }
34
+
24
35
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
25
36
 
26
37
  /** Provides authentication-related RPCs */
@@ -29,6 +40,10 @@ export interface AuthServiceClient {
29
40
  /** SendOtp sends a one-time password (OTP) to the given identifier */
30
41
 
31
42
  sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
43
+
44
+ /** VerifyOtp verifies incoming code */
45
+
46
+ verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
32
47
  }
33
48
 
34
49
  /** Provides authentication-related RPCs */
@@ -37,11 +52,15 @@ export interface AuthServiceController {
37
52
  /** SendOtp sends a one-time password (OTP) to the given identifier */
38
53
 
39
54
  sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
55
+
56
+ /** VerifyOtp verifies incoming code */
57
+
58
+ verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
40
59
  }
41
60
 
42
61
  export function AuthServiceControllerMethods() {
43
62
  return function (constructor: Function) {
44
- const grpcMethods: string[] = ["sendOtp"];
63
+ const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
45
64
  for (const method of grpcMethods) {
46
65
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
47
66
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimgit9/contracts",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Protobuf definitions and generated TS 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,16 +6,28 @@ package auth.v1;
6
6
  service AuthService {
7
7
  // SendOtp sends a one-time password (OTP) to the given identifier
8
8
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
9
+ // VerifyOtp verifies incoming code
10
+ rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
9
11
  }
10
12
 
11
13
  // Req for OTP
12
14
  message SendOtpRequest {
13
- string identifier = 1;
14
- string type = 2;
15
+ string identifier = 1;
16
+ string type = 2;
15
17
  }
16
18
 
17
19
  // Res whether it was successfully sent
18
20
  message SendOtpResponse {
19
- bool ok = 1;
21
+ bool ok = 1;
20
22
  }
21
-
23
+
24
+ message VerifyOtpRequest {
25
+ string identifier = 1;
26
+ string type = 2;
27
+ string code = 3;
28
+ }
29
+
30
+ message VerifyOtpResponse {
31
+ string access_token = 1;
32
+ string refresh_token = 2;
33
+ }