@candesk/contracts 6.28.0 → 6.29.0

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.
@@ -11,4 +11,6 @@ export declare const AUTH_EVENTS: {
11
11
  readonly STAFF_EMAIL_ASSIGNED: 'auth.staff-email.assigned';
12
12
  readonly STAFF_DEACTIVATED: 'auth.staff.deactivated';
13
13
  readonly STAFF_ACTIVATED: 'auth.staff.activated';
14
+ readonly TOTP_ENABLED: 'auth.totp.enabled';
15
+ readonly TOTP_DISABLED: 'auth.totp.disabled';
14
16
  };
@@ -13,5 +13,7 @@ exports.AUTH_EVENTS = {
13
13
  STAFF_EMAIL_CHANGED: 'auth.staff-email.changed',
14
14
  STAFF_EMAIL_ASSIGNED: 'auth.staff-email.assigned',
15
15
  STAFF_DEACTIVATED: 'auth.staff.deactivated',
16
- STAFF_ACTIVATED: 'auth.staff.activated'
16
+ STAFF_ACTIVATED: 'auth.staff.activated',
17
+ TOTP_ENABLED: 'auth.totp.enabled',
18
+ TOTP_DISABLED: 'auth.totp.disabled'
17
19
  };
@@ -11,3 +11,5 @@ export * from './staff-email-changed.interface';
11
11
  export * from './staff-invited.interface';
12
12
  export * from './telegram-linked.interface';
13
13
  export * from './telegram-unlinked.interface';
14
+ export * from './totp-disabled.interface';
15
+ export * from './totp-enabled.interface';
@@ -27,3 +27,5 @@ __exportStar(require("./staff-email-changed.interface"), exports);
27
27
  __exportStar(require("./staff-invited.interface"), exports);
28
28
  __exportStar(require("./telegram-linked.interface"), exports);
29
29
  __exportStar(require("./telegram-unlinked.interface"), exports);
30
+ __exportStar(require("./totp-disabled.interface"), exports);
31
+ __exportStar(require("./totp-enabled.interface"), exports);
@@ -0,0 +1,3 @@
1
+ export interface TotpDisabledEvent {
2
+ email: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface TotpEnabledEvent {
2
+ email: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -20,6 +20,7 @@ export interface GetAccountResponse {
20
20
  role: Role;
21
21
  isTelegramLinked: boolean;
22
22
  isIdentityVerified: boolean;
23
+ isTotpEnabled: boolean;
23
24
  }
24
25
  export interface InitEmailChangeRequest {
25
26
  email: string;
@@ -88,6 +89,26 @@ export interface SetIdentityVerifiedRequest {
88
89
  export interface SetIdentityVerifiedResponse {
89
90
  ok: boolean;
90
91
  }
92
+ export interface SetupTotpRequest {
93
+ userId: string;
94
+ }
95
+ export interface SetupTotpResponse {
96
+ secret: string;
97
+ uri: string;
98
+ }
99
+ export interface EnableTotpRequest {
100
+ userId: string;
101
+ code: string;
102
+ }
103
+ export interface EnableTotpResponse {
104
+ ok: boolean;
105
+ }
106
+ export interface DisableTotpRequest {
107
+ userId: string;
108
+ }
109
+ export interface DisableTotpResponse {
110
+ ok: boolean;
111
+ }
91
112
  export interface CreateStaffAccountRequest {
92
113
  email: string;
93
114
  role: Role;
@@ -148,6 +169,13 @@ export interface ChangeStaffEmailRequest {
148
169
  export interface ChangeStaffEmailResponse {
149
170
  account: StaffAccount | undefined;
150
171
  }
172
+ export interface ResetStaffTotpRequest {
173
+ id: string;
174
+ adminId: string;
175
+ }
176
+ export interface ResetStaffTotpResponse {
177
+ account: StaffAccount | undefined;
178
+ }
151
179
  export interface StaffAccount {
152
180
  id: string;
153
181
  email: string;
@@ -155,6 +183,7 @@ export interface StaffAccount {
155
183
  createdAt: string;
156
184
  isActive: boolean;
157
185
  lastActiveAt?: string | undefined;
186
+ isTotpEnabled: boolean;
158
187
  }
159
188
  export interface AccountService {
160
189
  getAccount(request: GetAccountRequest): Promise<GetAccountResponse>;
@@ -167,6 +196,9 @@ export interface AccountService {
167
196
  initAccountDeletion(request: InitAccountDeletionRequest): Promise<InitAccountDeletionResponse>;
168
197
  confirmAccountDeletion(request: ConfirmAccountDeletionRequest): Promise<ConfirmAccountDeletionResponse>;
169
198
  setIdentityVerified(request: SetIdentityVerifiedRequest): Promise<SetIdentityVerifiedResponse>;
199
+ setupTotp(request: SetupTotpRequest): Promise<SetupTotpResponse>;
200
+ enableTotp(request: EnableTotpRequest): Promise<EnableTotpResponse>;
201
+ disableTotp(request: DisableTotpRequest): Promise<DisableTotpResponse>;
170
202
  createStaffAccount(request: CreateStaffAccountRequest): Promise<CreateStaffAccountResponse>;
171
203
  sendStaffInvite(request: SendStaffInviteRequest): Promise<SendStaffInviteResponse>;
172
204
  getStaffAccount(request: GetStaffAccountRequest): Promise<GetStaffAccountResponse>;
@@ -175,4 +207,5 @@ export interface AccountService {
175
207
  changeStaffRole(request: ChangeStaffRoleRequest): Promise<ChangeStaffRoleResponse>;
176
208
  setStaffActive(request: SetStaffActiveRequest): Promise<SetStaffActiveResponse>;
177
209
  changeStaffEmail(request: ChangeStaffEmailRequest): Promise<ChangeStaffEmailResponse>;
210
+ resetStaffTotp(request: ResetStaffTotpRequest): Promise<ResetStaffTotpResponse>;
178
211
  }
@@ -1,11 +1,16 @@
1
1
  import type { Empty } from "./google/protobuf/empty";
2
2
  export declare const protobufPackage = "auth.v1";
3
3
  export declare const protobufFileName = "auth.proto";
4
+ export declare enum LoginMethod {
5
+ EMAIL = 0,
6
+ TOTP = 1,
7
+ UNRECOGNIZED = -1
8
+ }
4
9
  export interface SendOtpRequest {
5
10
  email: string;
6
11
  }
7
12
  export interface SendOtpResponse {
8
- ok: boolean;
13
+ method: LoginMethod;
9
14
  }
10
15
  export interface VerifyOtpRequest {
11
16
  email: string;
package/dist/gen/auth.js CHANGED
@@ -5,6 +5,12 @@
5
5
  // protoc v3.21.12
6
6
  // source: auth.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.protobufFileName = exports.protobufPackage = void 0;
8
+ exports.LoginMethod = exports.protobufFileName = exports.protobufPackage = void 0;
9
9
  exports.protobufPackage = "auth.v1";
10
10
  exports.protobufFileName = "auth.proto";
11
+ var LoginMethod;
12
+ (function (LoginMethod) {
13
+ LoginMethod[LoginMethod["EMAIL"] = 0] = "EMAIL";
14
+ LoginMethod[LoginMethod["TOTP"] = 1] = "TOTP";
15
+ LoginMethod[LoginMethod["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
16
+ })(LoginMethod || (exports.LoginMethod = LoginMethod = {}));
@@ -21,6 +21,7 @@ export interface GetAccountResponse {
21
21
  role: Role;
22
22
  isTelegramLinked: boolean;
23
23
  isIdentityVerified: boolean;
24
+ isTotpEnabled: boolean;
24
25
  }
25
26
  export interface InitEmailChangeRequest {
26
27
  email: string;
@@ -89,6 +90,26 @@ export interface SetIdentityVerifiedRequest {
89
90
  export interface SetIdentityVerifiedResponse {
90
91
  ok: boolean;
91
92
  }
93
+ export interface SetupTotpRequest {
94
+ userId: string;
95
+ }
96
+ export interface SetupTotpResponse {
97
+ secret: string;
98
+ uri: string;
99
+ }
100
+ export interface EnableTotpRequest {
101
+ userId: string;
102
+ code: string;
103
+ }
104
+ export interface EnableTotpResponse {
105
+ ok: boolean;
106
+ }
107
+ export interface DisableTotpRequest {
108
+ userId: string;
109
+ }
110
+ export interface DisableTotpResponse {
111
+ ok: boolean;
112
+ }
92
113
  export interface CreateStaffAccountRequest {
93
114
  email: string;
94
115
  role: Role;
@@ -149,6 +170,13 @@ export interface ChangeStaffEmailRequest {
149
170
  export interface ChangeStaffEmailResponse {
150
171
  account: StaffAccount | undefined;
151
172
  }
173
+ export interface ResetStaffTotpRequest {
174
+ id: string;
175
+ adminId: string;
176
+ }
177
+ export interface ResetStaffTotpResponse {
178
+ account: StaffAccount | undefined;
179
+ }
152
180
  export interface StaffAccount {
153
181
  id: string;
154
182
  email: string;
@@ -156,6 +184,7 @@ export interface StaffAccount {
156
184
  createdAt: string;
157
185
  isActive: boolean;
158
186
  lastActiveAt?: string | undefined;
187
+ isTotpEnabled: boolean;
159
188
  }
160
189
  export declare const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
161
190
  export interface AccountServiceClient {
@@ -169,6 +198,9 @@ export interface AccountServiceClient {
169
198
  initAccountDeletion(request: InitAccountDeletionRequest): Observable<InitAccountDeletionResponse>;
170
199
  confirmAccountDeletion(request: ConfirmAccountDeletionRequest): Observable<ConfirmAccountDeletionResponse>;
171
200
  setIdentityVerified(request: SetIdentityVerifiedRequest): Observable<SetIdentityVerifiedResponse>;
201
+ setupTotp(request: SetupTotpRequest): Observable<SetupTotpResponse>;
202
+ enableTotp(request: EnableTotpRequest): Observable<EnableTotpResponse>;
203
+ disableTotp(request: DisableTotpRequest): Observable<DisableTotpResponse>;
172
204
  createStaffAccount(request: CreateStaffAccountRequest): Observable<CreateStaffAccountResponse>;
173
205
  sendStaffInvite(request: SendStaffInviteRequest): Observable<SendStaffInviteResponse>;
174
206
  getStaffAccount(request: GetStaffAccountRequest): Observable<GetStaffAccountResponse>;
@@ -177,6 +209,7 @@ export interface AccountServiceClient {
177
209
  changeStaffRole(request: ChangeStaffRoleRequest): Observable<ChangeStaffRoleResponse>;
178
210
  setStaffActive(request: SetStaffActiveRequest): Observable<SetStaffActiveResponse>;
179
211
  changeStaffEmail(request: ChangeStaffEmailRequest): Observable<ChangeStaffEmailResponse>;
212
+ resetStaffTotp(request: ResetStaffTotpRequest): Observable<ResetStaffTotpResponse>;
180
213
  }
181
214
  export interface AccountServiceController {
182
215
  getAccount(request: GetAccountRequest): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
@@ -189,6 +222,9 @@ export interface AccountServiceController {
189
222
  initAccountDeletion(request: InitAccountDeletionRequest): Promise<InitAccountDeletionResponse> | Observable<InitAccountDeletionResponse> | InitAccountDeletionResponse;
190
223
  confirmAccountDeletion(request: ConfirmAccountDeletionRequest): Promise<ConfirmAccountDeletionResponse> | Observable<ConfirmAccountDeletionResponse> | ConfirmAccountDeletionResponse;
191
224
  setIdentityVerified(request: SetIdentityVerifiedRequest): Promise<SetIdentityVerifiedResponse> | Observable<SetIdentityVerifiedResponse> | SetIdentityVerifiedResponse;
225
+ setupTotp(request: SetupTotpRequest): Promise<SetupTotpResponse> | Observable<SetupTotpResponse> | SetupTotpResponse;
226
+ enableTotp(request: EnableTotpRequest): Promise<EnableTotpResponse> | Observable<EnableTotpResponse> | EnableTotpResponse;
227
+ disableTotp(request: DisableTotpRequest): Promise<DisableTotpResponse> | Observable<DisableTotpResponse> | DisableTotpResponse;
192
228
  createStaffAccount(request: CreateStaffAccountRequest): Promise<CreateStaffAccountResponse> | Observable<CreateStaffAccountResponse> | CreateStaffAccountResponse;
193
229
  sendStaffInvite(request: SendStaffInviteRequest): Promise<SendStaffInviteResponse> | Observable<SendStaffInviteResponse> | SendStaffInviteResponse;
194
230
  getStaffAccount(request: GetStaffAccountRequest): Promise<GetStaffAccountResponse> | Observable<GetStaffAccountResponse> | GetStaffAccountResponse;
@@ -197,6 +233,7 @@ export interface AccountServiceController {
197
233
  changeStaffRole(request: ChangeStaffRoleRequest): Promise<ChangeStaffRoleResponse> | Observable<ChangeStaffRoleResponse> | ChangeStaffRoleResponse;
198
234
  setStaffActive(request: SetStaffActiveRequest): Promise<SetStaffActiveResponse> | Observable<SetStaffActiveResponse> | SetStaffActiveResponse;
199
235
  changeStaffEmail(request: ChangeStaffEmailRequest): Promise<ChangeStaffEmailResponse> | Observable<ChangeStaffEmailResponse> | ChangeStaffEmailResponse;
236
+ resetStaffTotp(request: ResetStaffTotpRequest): Promise<ResetStaffTotpResponse> | Observable<ResetStaffTotpResponse> | ResetStaffTotpResponse;
200
237
  }
201
238
  export declare function AccountServiceControllerMethods(): (constructor: Function) => void;
202
239
  export declare const ACCOUNT_SERVICE_NAME = "AccountService";
@@ -34,6 +34,9 @@ function AccountServiceControllerMethods() {
34
34
  "initAccountDeletion",
35
35
  "confirmAccountDeletion",
36
36
  "setIdentityVerified",
37
+ "setupTotp",
38
+ "enableTotp",
39
+ "disableTotp",
37
40
  "createStaffAccount",
38
41
  "sendStaffInvite",
39
42
  "getStaffAccount",
@@ -42,6 +45,7 @@ function AccountServiceControllerMethods() {
42
45
  "changeStaffRole",
43
46
  "setStaffActive",
44
47
  "changeStaffEmail",
48
+ "resetStaffTotp",
45
49
  ];
46
50
  for (const method of grpcMethods) {
47
51
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
@@ -2,11 +2,16 @@ import { Observable } from "rxjs";
2
2
  import { Empty } from "./google/protobuf/empty";
3
3
  export declare const protobufPackage = "auth.v1";
4
4
  export declare const protobufFileName = "auth.proto";
5
+ export declare enum LoginMethod {
6
+ EMAIL = 0,
7
+ TOTP = 1,
8
+ UNRECOGNIZED = -1
9
+ }
5
10
  export interface SendOtpRequest {
6
11
  email: string;
7
12
  }
8
13
  export interface SendOtpResponse {
9
- ok: boolean;
14
+ method: LoginMethod;
10
15
  }
11
16
  export interface VerifyOtpRequest {
12
17
  email: string;
package/dist/nest/auth.js CHANGED
@@ -5,12 +5,18 @@
5
5
  // protoc v3.21.12
6
6
  // source: auth.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.AUTH_SERVICE_NAME = exports.AUTH_V1_PACKAGE_NAME = exports.protobufFileName = exports.protobufPackage = void 0;
8
+ exports.AUTH_SERVICE_NAME = exports.AUTH_V1_PACKAGE_NAME = exports.LoginMethod = exports.protobufFileName = exports.protobufPackage = void 0;
9
9
  exports.AuthServiceControllerMethods = AuthServiceControllerMethods;
10
10
  /* eslint-disable */
11
11
  const microservices_1 = require("@nestjs/microservices");
12
12
  exports.protobufPackage = "auth.v1";
13
13
  exports.protobufFileName = "auth.proto";
14
+ var LoginMethod;
15
+ (function (LoginMethod) {
16
+ LoginMethod[LoginMethod["EMAIL"] = 0] = "EMAIL";
17
+ LoginMethod[LoginMethod["TOTP"] = 1] = "TOTP";
18
+ LoginMethod[LoginMethod["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
19
+ })(LoginMethod || (exports.LoginMethod = LoginMethod = {}));
14
20
  exports.AUTH_V1_PACKAGE_NAME = "auth.v1";
15
21
  function AuthServiceControllerMethods() {
16
22
  return function (constructor) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candesk/contracts",
3
- "version": "6.28.0",
3
+ "version": "6.29.0",
4
4
  "description": "Protobuf contracts for CanDesk microservices",
5
5
  "author": {
6
6
  "name": "Alexander Schulz",
@@ -18,6 +18,10 @@ service AccountService {
18
18
 
19
19
  rpc SetIdentityVerified(SetIdentityVerifiedRequest) returns (SetIdentityVerifiedResponse);
20
20
 
21
+ rpc SetupTotp(SetupTotpRequest) returns (SetupTotpResponse);
22
+ rpc EnableTotp(EnableTotpRequest) returns (EnableTotpResponse);
23
+ rpc DisableTotp(DisableTotpRequest) returns (DisableTotpResponse);
24
+
21
25
  rpc CreateStaffAccount(CreateStaffAccountRequest) returns (CreateStaffAccountResponse);
22
26
  rpc SendStaffInvite(SendStaffInviteRequest) returns (SendStaffInviteResponse);
23
27
  rpc GetStaffAccount(GetStaffAccountRequest) returns (GetStaffAccountResponse);
@@ -26,6 +30,7 @@ service AccountService {
26
30
  rpc ChangeStaffRole(ChangeStaffRoleRequest) returns (ChangeStaffRoleResponse);
27
31
  rpc SetStaffActive(SetStaffActiveRequest) returns (SetStaffActiveResponse);
28
32
  rpc ChangeStaffEmail(ChangeStaffEmailRequest) returns (ChangeStaffEmailResponse);
33
+ rpc ResetStaffTotp(ResetStaffTotpRequest) returns (ResetStaffTotpResponse);
29
34
  }
30
35
 
31
36
  message GetAccountRequest {
@@ -41,6 +46,7 @@ message GetAccountResponse {
41
46
  Role role = 6;
42
47
  bool is_telegram_linked = 7;
43
48
  bool is_identity_verified = 8;
49
+ bool is_totp_enabled = 9;
44
50
  }
45
51
 
46
52
  message InitEmailChangeRequest {
@@ -122,6 +128,32 @@ message SetIdentityVerifiedResponse {
122
128
  bool ok = 1;
123
129
  }
124
130
 
131
+ message SetupTotpRequest {
132
+ string user_id = 1;
133
+ }
134
+
135
+ message SetupTotpResponse {
136
+ string secret = 1;
137
+ string uri = 2;
138
+ }
139
+
140
+ message EnableTotpRequest {
141
+ string user_id = 1;
142
+ string code = 2;
143
+ }
144
+
145
+ message EnableTotpResponse {
146
+ bool ok = 1;
147
+ }
148
+
149
+ message DisableTotpRequest {
150
+ string user_id = 1;
151
+ }
152
+
153
+ message DisableTotpResponse {
154
+ bool ok = 1;
155
+ }
156
+
125
157
  message CreateStaffAccountRequest {
126
158
  string email = 1;
127
159
  Role role = 2;
@@ -197,6 +229,15 @@ message ChangeStaffEmailResponse {
197
229
  StaffAccount account = 1;
198
230
  }
199
231
 
232
+ message ResetStaffTotpRequest {
233
+ string id = 1;
234
+ string admin_id = 2;
235
+ }
236
+
237
+ message ResetStaffTotpResponse {
238
+ StaffAccount account = 1;
239
+ }
240
+
200
241
  message StaffAccount {
201
242
  string id = 1;
202
243
  string email = 2;
@@ -205,6 +246,7 @@ message StaffAccount {
205
246
  bool is_active = 5;
206
247
  reserved 6;
207
248
  optional string last_active_at = 7;
249
+ bool is_totp_enabled = 8;
208
250
  }
209
251
 
210
252
  enum Role {
package/proto/auth.proto CHANGED
@@ -27,7 +27,13 @@ message SendOtpRequest {
27
27
  }
28
28
 
29
29
  message SendOtpResponse {
30
- bool ok = 1;
30
+ reserved 1;
31
+ LoginMethod method = 2;
32
+ }
33
+
34
+ enum LoginMethod {
35
+ EMAIL = 0;
36
+ TOTP = 1;
31
37
  }
32
38
 
33
39
  message VerifyOtpRequest {