@you-are-hired/contracts 1.1.4 → 1.1.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/gen/account.ts CHANGED
@@ -11,8 +11,15 @@ import { Observable } from "rxjs";
11
11
  export const protobufPackage = "account.v1";
12
12
 
13
13
  export enum Role {
14
- USER = 0,
15
- ADMIN = 1,
14
+ CANDIDATE = 0,
15
+ INTERVIEWER = 1,
16
+ UNRECOGNIZED = -1,
17
+ }
18
+
19
+ export enum TwoFactorMethod {
20
+ TWO_FACTOR_METHOD_UNSPECIFIED = 0,
21
+ EMAIL = 1,
22
+ PHONE = 2,
16
23
  UNRECOGNIZED = -1,
17
24
  }
18
25
 
@@ -27,6 +34,8 @@ export interface GetAccountResponse {
27
34
  isPhoneVerified: boolean;
28
35
  isEmailVerified: boolean;
29
36
  role: Role;
37
+ isTwoFactorEnabled: boolean;
38
+ twoFactorMethod: TwoFactorMethod;
30
39
  }
31
40
 
32
41
  export interface InitEmailChangeRequest {
@@ -67,6 +76,33 @@ export interface ConfirmPhoneChangeResponse {
67
76
  ok: boolean;
68
77
  }
69
78
 
79
+ export interface InitTwoFactorRequest {
80
+ userId: string;
81
+ method: TwoFactorMethod;
82
+ }
83
+
84
+ export interface InitTwoFactorResponse {
85
+ ok: boolean;
86
+ }
87
+
88
+ export interface ConfirmTwoFactorRequest {
89
+ userId: string;
90
+ code: string;
91
+ method: TwoFactorMethod;
92
+ }
93
+
94
+ export interface ConfirmTwoFactorResponse {
95
+ ok: boolean;
96
+ }
97
+
98
+ export interface DisableTwoFactorRequest {
99
+ userId: string;
100
+ }
101
+
102
+ export interface DisableTwoFactorResponse {
103
+ ok: boolean;
104
+ }
105
+
70
106
  export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
71
107
 
72
108
  export interface AccountServiceClient {
@@ -79,6 +115,12 @@ export interface AccountServiceClient {
79
115
  initPhoneChange(request: InitPhoneChangeRequest): Observable<InitPhoneChangeResponse>;
80
116
 
81
117
  confirmPhoneChange(request: ConfirmPhoneChangeRequest): Observable<ConfirmPhoneChangeResponse>;
118
+
119
+ initTwoFactor(request: InitTwoFactorRequest): Observable<InitTwoFactorResponse>;
120
+
121
+ confirmTwoFactor(request: ConfirmTwoFactorRequest): Observable<ConfirmTwoFactorResponse>;
122
+
123
+ disableTwoFactor(request: DisableTwoFactorRequest): Observable<DisableTwoFactorResponse>;
82
124
  }
83
125
 
84
126
  export interface AccountServiceController {
@@ -101,6 +143,18 @@ export interface AccountServiceController {
101
143
  confirmPhoneChange(
102
144
  request: ConfirmPhoneChangeRequest,
103
145
  ): Promise<ConfirmPhoneChangeResponse> | Observable<ConfirmPhoneChangeResponse> | ConfirmPhoneChangeResponse;
146
+
147
+ initTwoFactor(
148
+ request: InitTwoFactorRequest,
149
+ ): Promise<InitTwoFactorResponse> | Observable<InitTwoFactorResponse> | InitTwoFactorResponse;
150
+
151
+ confirmTwoFactor(
152
+ request: ConfirmTwoFactorRequest,
153
+ ): Promise<ConfirmTwoFactorResponse> | Observable<ConfirmTwoFactorResponse> | ConfirmTwoFactorResponse;
154
+
155
+ disableTwoFactor(
156
+ request: DisableTwoFactorRequest,
157
+ ): Promise<DisableTwoFactorResponse> | Observable<DisableTwoFactorResponse> | DisableTwoFactorResponse;
104
158
  }
105
159
 
106
160
  export function AccountServiceControllerMethods() {
@@ -111,6 +165,9 @@ export function AccountServiceControllerMethods() {
111
165
  "confirmEmailChange",
112
166
  "initPhoneChange",
113
167
  "confirmPhoneChange",
168
+ "initTwoFactor",
169
+ "confirmTwoFactor",
170
+ "disableTwoFactor",
114
171
  ];
115
172
  for (const method of grpcMethods) {
116
173
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
package/gen/auth.ts CHANGED
@@ -7,72 +7,86 @@
7
7
  /* eslint-disable */
8
8
  import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
9
  import { Observable } from "rxjs";
10
- import { Empty } from "./google/protobuf/empty";
11
10
 
12
11
  export const protobufPackage = "auth.v1";
13
12
 
14
- export interface SendOTPPRequest {
15
- identifier: string;
16
- type: string;
13
+ export enum Role {
14
+ CANDIDATE = 0,
15
+ INTERVIEWER = 1,
16
+ UNRECOGNIZED = -1,
17
17
  }
18
18
 
19
- export interface SendOTPPResponse {
19
+ export enum TwoFactorMethod {
20
+ TWO_FACTOR_METHOD_UNSPECIFIED = 0,
21
+ EMAIL = 1,
22
+ PHONE = 2,
23
+ UNRECOGNIZED = -1,
24
+ }
25
+
26
+ export interface RegisterRequest {
27
+ email: string;
28
+ password: string;
29
+ role: Role;
30
+ }
31
+
32
+ export interface RegisterResponse {
20
33
  ok: boolean;
21
34
  }
22
35
 
23
- export interface VerifyOTPPRequest {
24
- identifier: string;
25
- type: string;
26
- code: string;
36
+ export interface StartLoginRequest {
37
+ email: string;
38
+ password: string;
27
39
  }
28
40
 
29
- export interface VerifyOTPPResponse {
30
- accessToken: string;
31
- refreshToken: string;
41
+ export interface StartLoginResponse {
42
+ ok: boolean;
32
43
  }
33
44
 
34
- export interface RefreshRequest {
35
- refreshToken: string;
45
+ export interface VerifyLoginCodeRequest {
46
+ email: string;
47
+ code: string;
36
48
  }
37
49
 
38
- export interface RefreshResponse {
50
+ export interface VerifyLoginCodeResponse {
51
+ requiresTwoFactor: boolean;
52
+ twoFactorMethod: TwoFactorMethod;
39
53
  accessToken: string;
40
54
  refreshToken: string;
41
55
  }
42
56
 
43
- export interface TelegramInitResponse {
44
- url: string;
57
+ export interface VerifyTwoFactorCodeRequest {
58
+ email: string;
59
+ code: string;
45
60
  }
46
61
 
47
- export interface TelegramVerifyRequest {
48
- query: { [key: string]: string };
62
+ export interface VerifyTwoFactorCodeResponse {
63
+ accessToken: string;
64
+ refreshToken: string;
49
65
  }
50
66
 
51
- export interface TelegramVerifyRequest_QueryEntry {
52
- key: string;
53
- value: string;
67
+ export interface StartPasswordResetRequest {
68
+ email: string;
54
69
  }
55
70
 
56
- export interface TelegramVerifyResponse {
57
- url?: string | undefined;
58
- accessToken?: string | undefined;
59
- refreshToken?: string | undefined;
71
+ export interface StartPasswordResetResponse {
72
+ ok: boolean;
60
73
  }
61
74
 
62
- export interface TelegramCompleteRequest {
63
- sessionId: string;
64
- phone: string;
75
+ export interface ConfirmPasswordResetRequest {
76
+ email: string;
77
+ code: string;
78
+ newPassword: string;
65
79
  }
66
80
 
67
- export interface TelegramCompleteResponse {
68
- sessionId: string;
81
+ export interface ConfirmPasswordResetResponse {
82
+ ok: boolean;
69
83
  }
70
84
 
71
- export interface TelegramConsumeRequest {
72
- sessionId: string;
85
+ export interface RefreshRequest {
86
+ refreshToken: string;
73
87
  }
74
88
 
75
- export interface TelegramConsumeResponse {
89
+ export interface RefreshResponse {
76
90
  accessToken: string;
77
91
  refreshToken: string;
78
92
  }
@@ -80,55 +94,57 @@ export interface TelegramConsumeResponse {
80
94
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
81
95
 
82
96
  export interface AuthServiceClient {
83
- sendOtp(request: SendOTPPRequest): Observable<SendOTPPResponse>;
97
+ register(request: RegisterRequest): Observable<RegisterResponse>;
84
98
 
85
- verifyOtp(request: VerifyOTPPRequest): Observable<VerifyOTPPResponse>;
99
+ startLogin(request: StartLoginRequest): Observable<StartLoginResponse>;
86
100
 
87
- refresh(request: RefreshRequest): Observable<RefreshResponse>;
101
+ verifyLoginCode(request: VerifyLoginCodeRequest): Observable<VerifyLoginCodeResponse>;
88
102
 
89
- telegramInit(request: Empty): Observable<TelegramInitResponse>;
103
+ verifyTwoFactorCode(request: VerifyTwoFactorCodeRequest): Observable<VerifyTwoFactorCodeResponse>;
90
104
 
91
- telegramVerify(request: TelegramVerifyRequest): Observable<TelegramVerifyResponse>;
105
+ startPasswordReset(request: StartPasswordResetRequest): Observable<StartPasswordResetResponse>;
92
106
 
93
- telegramComplete(request: TelegramCompleteRequest): Observable<TelegramCompleteResponse>;
107
+ confirmPasswordReset(request: ConfirmPasswordResetRequest): Observable<ConfirmPasswordResetResponse>;
94
108
 
95
- telegramConsume(request: TelegramConsumeRequest): Observable<TelegramConsumeResponse>;
109
+ refresh(request: RefreshRequest): Observable<RefreshResponse>;
96
110
  }
97
111
 
98
112
  export interface AuthServiceController {
99
- sendOtp(request: SendOTPPRequest): Promise<SendOTPPResponse> | Observable<SendOTPPResponse> | SendOTPPResponse;
113
+ register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
100
114
 
101
- verifyOtp(
102
- request: VerifyOTPPRequest,
103
- ): Promise<VerifyOTPPResponse> | Observable<VerifyOTPPResponse> | VerifyOTPPResponse;
115
+ startLogin(
116
+ request: StartLoginRequest,
117
+ ): Promise<StartLoginResponse> | Observable<StartLoginResponse> | StartLoginResponse;
104
118
 
105
- refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
119
+ verifyLoginCode(
120
+ request: VerifyLoginCodeRequest,
121
+ ): Promise<VerifyLoginCodeResponse> | Observable<VerifyLoginCodeResponse> | VerifyLoginCodeResponse;
106
122
 
107
- telegramInit(request: Empty): Promise<TelegramInitResponse> | Observable<TelegramInitResponse> | TelegramInitResponse;
123
+ verifyTwoFactorCode(
124
+ request: VerifyTwoFactorCodeRequest,
125
+ ): Promise<VerifyTwoFactorCodeResponse> | Observable<VerifyTwoFactorCodeResponse> | VerifyTwoFactorCodeResponse;
108
126
 
109
- telegramVerify(
110
- request: TelegramVerifyRequest,
111
- ): Promise<TelegramVerifyResponse> | Observable<TelegramVerifyResponse> | TelegramVerifyResponse;
127
+ startPasswordReset(
128
+ request: StartPasswordResetRequest,
129
+ ): Promise<StartPasswordResetResponse> | Observable<StartPasswordResetResponse> | StartPasswordResetResponse;
112
130
 
113
- telegramComplete(
114
- request: TelegramCompleteRequest,
115
- ): Promise<TelegramCompleteResponse> | Observable<TelegramCompleteResponse> | TelegramCompleteResponse;
131
+ confirmPasswordReset(
132
+ request: ConfirmPasswordResetRequest,
133
+ ): Promise<ConfirmPasswordResetResponse> | Observable<ConfirmPasswordResetResponse> | ConfirmPasswordResetResponse;
116
134
 
117
- telegramConsume(
118
- request: TelegramConsumeRequest,
119
- ): Promise<TelegramConsumeResponse> | Observable<TelegramConsumeResponse> | TelegramConsumeResponse;
135
+ refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
120
136
  }
121
137
 
122
138
  export function AuthServiceControllerMethods() {
123
139
  return function (constructor: Function) {
124
140
  const grpcMethods: string[] = [
125
- "sendOtp",
126
- "verifyOtp",
141
+ "register",
142
+ "startLogin",
143
+ "verifyLoginCode",
144
+ "verifyTwoFactorCode",
145
+ "startPasswordReset",
146
+ "confirmPasswordReset",
127
147
  "refresh",
128
- "telegramInit",
129
- "telegramVerify",
130
- "telegramComplete",
131
- "telegramConsume",
132
148
  ];
133
149
  for (const method of grpcMethods) {
134
150
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
@@ -1,7 +1,7 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
3
  // protoc-gen-ts_proto v2.10.1
4
- // protoc v3.21.12
4
+ // protoc v6.33.2
5
5
  // source: google/protobuf/empty.proto
6
6
 
7
7
  /* eslint-disable */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@you-are-hired/contracts",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Proto || RabbitMQ",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -27,6 +27,7 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^25.0.3",
30
+ "grpc-tools": "^1.13.1",
30
31
  "typescript": "^5.9.3"
31
32
  }
32
33
  }
@@ -4,13 +4,13 @@ package account.v1;
4
4
 
5
5
  service AccountService {
6
6
  rpc GetAccount(GetAccountRequest) returns (GetAccountResponse);
7
-
8
7
  rpc InitEmailChange (InitEmailChangeRequest) returns (InitEmailChangeResponse);
9
8
  rpc ConfirmEmailChange (ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
10
-
11
9
  rpc InitPhoneChange (InitPhoneChangeRequest) returns (InitPhoneChangeResponse);
12
10
  rpc ConfirmPhoneChange (ConfirmPhoneChangeRequest) returns (ConfirmPhoneChangeResponse);
13
-
11
+ rpc InitTwoFactor (InitTwoFactorRequest) returns (InitTwoFactorResponse);
12
+ rpc ConfirmTwoFactor (ConfirmTwoFactorRequest) returns (ConfirmTwoFactorResponse);
13
+ rpc DisableTwoFactor (DisableTwoFactorRequest) returns (DisableTwoFactorResponse);
14
14
  }
15
15
 
16
16
  message GetAccountRequest {
@@ -24,6 +24,8 @@ message GetAccountResponse {
24
24
  bool is_phone_verified = 4;
25
25
  bool is_email_verified = 5;
26
26
  Role role = 6;
27
+ bool is_two_factor_enabled = 7;
28
+ TwoFactorMethod two_factor_method = 8;
27
29
  }
28
30
 
29
31
  message InitEmailChangeRequest {
@@ -64,7 +66,40 @@ message ConfirmPhoneChangeResponse {
64
66
  bool ok = 1;
65
67
  }
66
68
 
69
+ message InitTwoFactorRequest {
70
+ string user_id = 1;
71
+ TwoFactorMethod method = 2;
72
+ }
73
+
74
+ message InitTwoFactorResponse {
75
+ bool ok = 1;
76
+ }
77
+
78
+ message ConfirmTwoFactorRequest {
79
+ string user_id = 1;
80
+ string code = 2;
81
+ TwoFactorMethod method = 3;
82
+ }
83
+
84
+ message ConfirmTwoFactorResponse {
85
+ bool ok = 1;
86
+ }
87
+
88
+ message DisableTwoFactorRequest {
89
+ string user_id = 1;
90
+ }
91
+
92
+ message DisableTwoFactorResponse {
93
+ bool ok = 1;
94
+ }
95
+
67
96
  enum Role {
68
- USER = 0;
69
- ADMIN = 1;
97
+ CANDIDATE = 0;
98
+ INTERVIEWER = 1;
99
+ }
100
+
101
+ enum TwoFactorMethod {
102
+ TWO_FACTOR_METHOD_UNSPECIFIED = 0;
103
+ EMAIL = 1;
104
+ PHONE = 2;
70
105
  }
package/proto/auth.proto CHANGED
@@ -2,78 +2,91 @@ syntax = "proto3";
2
2
 
3
3
  package auth.v1;
4
4
 
5
- import "google/protobuf/empty.proto";
6
-
7
5
  service AuthService {
8
- rpc SendOTP(SendOTPPRequest) returns (SendOTPPResponse);
9
- rpc VerifyOTP(VerifyOTPPRequest) returns (VerifyOTPPResponse);
6
+ rpc Register (RegisterRequest) returns (RegisterResponse);
7
+ rpc StartLogin (StartLoginRequest) returns (StartLoginResponse);
8
+ rpc VerifyLoginCode (VerifyLoginCodeRequest) returns (VerifyLoginCodeResponse);
9
+ rpc VerifyTwoFactorCode (VerifyTwoFactorCodeRequest) returns (VerifyTwoFactorCodeResponse);
10
+ rpc StartPasswordReset (StartPasswordResetRequest) returns (StartPasswordResetResponse);
11
+ rpc ConfirmPasswordReset (ConfirmPasswordResetRequest) returns (ConfirmPasswordResetResponse);
10
12
  rpc Refresh (RefreshRequest) returns (RefreshResponse);
13
+ }
14
+
15
+ enum Role {
16
+ CANDIDATE = 0;
17
+ INTERVIEWER = 1;
18
+ }
11
19
 
12
- rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
13
- rpc TelegramVerify (TelegramVerifyRequest) returns (TelegramVerifyResponse);
14
- rpc TelegramComplete (TelegramCompleteRequest) returns (TelegramCompleteResponse);
15
- rpc TelegramConsume (TelegramConsumeRequest) returns (TelegramConsumeResponse);
20
+ enum TwoFactorMethod {
21
+ TWO_FACTOR_METHOD_UNSPECIFIED = 0;
22
+ EMAIL = 1;
23
+ PHONE = 2;
16
24
  }
17
25
 
18
- message SendOTPPRequest {
19
- string identifier = 1;
20
- string type = 2;
26
+ message RegisterRequest {
27
+ string email = 1;
28
+ string password = 2;
29
+ Role role = 3;
21
30
  }
22
31
 
23
- message SendOTPPResponse {
32
+ message RegisterResponse {
24
33
  bool ok = 1;
25
34
  }
26
35
 
27
- message VerifyOTPPRequest {
28
- string identifier = 1;
29
- string type = 2;
30
- string code = 3;
36
+ message StartLoginRequest {
37
+ string email = 1;
38
+ string password = 2;
31
39
  }
32
40
 
33
- message VerifyOTPPResponse {
34
- string access_token = 1;
35
- string refresh_token = 2;
41
+ message StartLoginResponse {
42
+ bool ok = 1;
36
43
  }
37
44
 
38
- message RefreshRequest {
39
- string refresh_token = 1;
45
+ message VerifyLoginCodeRequest {
46
+ string email = 1;
47
+ string code = 2;
40
48
  }
41
49
 
42
- message RefreshResponse {
43
- string access_token = 1;
44
- string refresh_token = 2;
50
+ message VerifyLoginCodeResponse {
51
+ bool requires_two_factor = 1;
52
+ TwoFactorMethod two_factor_method = 2;
53
+ string access_token = 3;
54
+ string refresh_token = 4;
55
+ }
56
+
57
+ message VerifyTwoFactorCodeRequest {
58
+ string email = 1;
59
+ string code = 2;
45
60
  }
46
61
 
47
- message TelegramInitResponse {
48
- string url = 1;
62
+ message VerifyTwoFactorCodeResponse {
63
+ string access_token = 1;
64
+ string refresh_token = 2;
49
65
  }
50
66
 
51
- message TelegramVerifyRequest {
52
- map<string, string> query = 1;
67
+ message StartPasswordResetRequest {
68
+ string email = 1;
53
69
  }
54
70
 
55
- message TelegramVerifyResponse {
56
- oneof result {
57
- string url = 1;
58
- string access_token = 2;
59
- string refresh_token = 3;
60
- }
71
+ message StartPasswordResetResponse {
72
+ bool ok = 1;
61
73
  }
62
74
 
63
- message TelegramCompleteRequest {
64
- string session_id = 1;
65
- string phone = 2;
75
+ message ConfirmPasswordResetRequest {
76
+ string email = 1;
77
+ string code = 2;
78
+ string new_password = 3;
66
79
  }
67
80
 
68
- message TelegramCompleteResponse {
69
- string session_id = 1;
81
+ message ConfirmPasswordResetResponse {
82
+ bool ok = 1;
70
83
  }
71
84
 
72
- message TelegramConsumeRequest {
73
- string session_id = 1;
85
+ message RefreshRequest {
86
+ string refresh_token = 1;
74
87
  }
75
88
 
76
- message TelegramConsumeResponse {
89
+ message RefreshResponse {
77
90
  string access_token = 1;
78
91
  string refresh_token = 2;
79
92
  }