@candesk/contracts 6.28.0 → 6.30.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,8 @@ export interface GetAccountResponse {
20
20
  role: Role;
21
21
  isTelegramLinked: boolean;
22
22
  isIdentityVerified: boolean;
23
+ isTotpEnabled: boolean;
24
+ createdAt: string;
23
25
  }
24
26
  export interface InitEmailChangeRequest {
25
27
  email: string;
@@ -88,6 +90,26 @@ export interface SetIdentityVerifiedRequest {
88
90
  export interface SetIdentityVerifiedResponse {
89
91
  ok: boolean;
90
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
+ }
91
113
  export interface CreateStaffAccountRequest {
92
114
  email: string;
93
115
  role: Role;
@@ -148,6 +170,13 @@ export interface ChangeStaffEmailRequest {
148
170
  export interface ChangeStaffEmailResponse {
149
171
  account: StaffAccount | undefined;
150
172
  }
173
+ export interface ResetStaffTotpRequest {
174
+ id: string;
175
+ adminId: string;
176
+ }
177
+ export interface ResetStaffTotpResponse {
178
+ account: StaffAccount | undefined;
179
+ }
151
180
  export interface StaffAccount {
152
181
  id: string;
153
182
  email: string;
@@ -155,6 +184,7 @@ export interface StaffAccount {
155
184
  createdAt: string;
156
185
  isActive: boolean;
157
186
  lastActiveAt?: string | undefined;
187
+ isTotpEnabled: boolean;
158
188
  }
159
189
  export interface AccountService {
160
190
  getAccount(request: GetAccountRequest): Promise<GetAccountResponse>;
@@ -167,6 +197,9 @@ export interface AccountService {
167
197
  initAccountDeletion(request: InitAccountDeletionRequest): Promise<InitAccountDeletionResponse>;
168
198
  confirmAccountDeletion(request: ConfirmAccountDeletionRequest): Promise<ConfirmAccountDeletionResponse>;
169
199
  setIdentityVerified(request: SetIdentityVerifiedRequest): Promise<SetIdentityVerifiedResponse>;
200
+ setupTotp(request: SetupTotpRequest): Promise<SetupTotpResponse>;
201
+ enableTotp(request: EnableTotpRequest): Promise<EnableTotpResponse>;
202
+ disableTotp(request: DisableTotpRequest): Promise<DisableTotpResponse>;
170
203
  createStaffAccount(request: CreateStaffAccountRequest): Promise<CreateStaffAccountResponse>;
171
204
  sendStaffInvite(request: SendStaffInviteRequest): Promise<SendStaffInviteResponse>;
172
205
  getStaffAccount(request: GetStaffAccountRequest): Promise<GetStaffAccountResponse>;
@@ -175,4 +208,5 @@ export interface AccountService {
175
208
  changeStaffRole(request: ChangeStaffRoleRequest): Promise<ChangeStaffRoleResponse>;
176
209
  setStaffActive(request: SetStaffActiveRequest): Promise<SetStaffActiveResponse>;
177
210
  changeStaffEmail(request: ChangeStaffEmailRequest): Promise<ChangeStaffEmailResponse>;
211
+ resetStaffTotp(request: ResetStaffTotpRequest): Promise<ResetStaffTotpResponse>;
178
212
  }
@@ -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,8 @@ export interface GetAccountResponse {
21
21
  role: Role;
22
22
  isTelegramLinked: boolean;
23
23
  isIdentityVerified: boolean;
24
+ isTotpEnabled: boolean;
25
+ createdAt: string;
24
26
  }
25
27
  export interface InitEmailChangeRequest {
26
28
  email: string;
@@ -89,6 +91,26 @@ export interface SetIdentityVerifiedRequest {
89
91
  export interface SetIdentityVerifiedResponse {
90
92
  ok: boolean;
91
93
  }
94
+ export interface SetupTotpRequest {
95
+ userId: string;
96
+ }
97
+ export interface SetupTotpResponse {
98
+ secret: string;
99
+ uri: string;
100
+ }
101
+ export interface EnableTotpRequest {
102
+ userId: string;
103
+ code: string;
104
+ }
105
+ export interface EnableTotpResponse {
106
+ ok: boolean;
107
+ }
108
+ export interface DisableTotpRequest {
109
+ userId: string;
110
+ }
111
+ export interface DisableTotpResponse {
112
+ ok: boolean;
113
+ }
92
114
  export interface CreateStaffAccountRequest {
93
115
  email: string;
94
116
  role: Role;
@@ -149,6 +171,13 @@ export interface ChangeStaffEmailRequest {
149
171
  export interface ChangeStaffEmailResponse {
150
172
  account: StaffAccount | undefined;
151
173
  }
174
+ export interface ResetStaffTotpRequest {
175
+ id: string;
176
+ adminId: string;
177
+ }
178
+ export interface ResetStaffTotpResponse {
179
+ account: StaffAccount | undefined;
180
+ }
152
181
  export interface StaffAccount {
153
182
  id: string;
154
183
  email: string;
@@ -156,6 +185,7 @@ export interface StaffAccount {
156
185
  createdAt: string;
157
186
  isActive: boolean;
158
187
  lastActiveAt?: string | undefined;
188
+ isTotpEnabled: boolean;
159
189
  }
160
190
  export declare const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
161
191
  export interface AccountServiceClient {
@@ -169,6 +199,9 @@ export interface AccountServiceClient {
169
199
  initAccountDeletion(request: InitAccountDeletionRequest): Observable<InitAccountDeletionResponse>;
170
200
  confirmAccountDeletion(request: ConfirmAccountDeletionRequest): Observable<ConfirmAccountDeletionResponse>;
171
201
  setIdentityVerified(request: SetIdentityVerifiedRequest): Observable<SetIdentityVerifiedResponse>;
202
+ setupTotp(request: SetupTotpRequest): Observable<SetupTotpResponse>;
203
+ enableTotp(request: EnableTotpRequest): Observable<EnableTotpResponse>;
204
+ disableTotp(request: DisableTotpRequest): Observable<DisableTotpResponse>;
172
205
  createStaffAccount(request: CreateStaffAccountRequest): Observable<CreateStaffAccountResponse>;
173
206
  sendStaffInvite(request: SendStaffInviteRequest): Observable<SendStaffInviteResponse>;
174
207
  getStaffAccount(request: GetStaffAccountRequest): Observable<GetStaffAccountResponse>;
@@ -177,6 +210,7 @@ export interface AccountServiceClient {
177
210
  changeStaffRole(request: ChangeStaffRoleRequest): Observable<ChangeStaffRoleResponse>;
178
211
  setStaffActive(request: SetStaffActiveRequest): Observable<SetStaffActiveResponse>;
179
212
  changeStaffEmail(request: ChangeStaffEmailRequest): Observable<ChangeStaffEmailResponse>;
213
+ resetStaffTotp(request: ResetStaffTotpRequest): Observable<ResetStaffTotpResponse>;
180
214
  }
181
215
  export interface AccountServiceController {
182
216
  getAccount(request: GetAccountRequest): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
@@ -189,6 +223,9 @@ export interface AccountServiceController {
189
223
  initAccountDeletion(request: InitAccountDeletionRequest): Promise<InitAccountDeletionResponse> | Observable<InitAccountDeletionResponse> | InitAccountDeletionResponse;
190
224
  confirmAccountDeletion(request: ConfirmAccountDeletionRequest): Promise<ConfirmAccountDeletionResponse> | Observable<ConfirmAccountDeletionResponse> | ConfirmAccountDeletionResponse;
191
225
  setIdentityVerified(request: SetIdentityVerifiedRequest): Promise<SetIdentityVerifiedResponse> | Observable<SetIdentityVerifiedResponse> | SetIdentityVerifiedResponse;
226
+ setupTotp(request: SetupTotpRequest): Promise<SetupTotpResponse> | Observable<SetupTotpResponse> | SetupTotpResponse;
227
+ enableTotp(request: EnableTotpRequest): Promise<EnableTotpResponse> | Observable<EnableTotpResponse> | EnableTotpResponse;
228
+ disableTotp(request: DisableTotpRequest): Promise<DisableTotpResponse> | Observable<DisableTotpResponse> | DisableTotpResponse;
192
229
  createStaffAccount(request: CreateStaffAccountRequest): Promise<CreateStaffAccountResponse> | Observable<CreateStaffAccountResponse> | CreateStaffAccountResponse;
193
230
  sendStaffInvite(request: SendStaffInviteRequest): Promise<SendStaffInviteResponse> | Observable<SendStaffInviteResponse> | SendStaffInviteResponse;
194
231
  getStaffAccount(request: GetStaffAccountRequest): Promise<GetStaffAccountResponse> | Observable<GetStaffAccountResponse> | GetStaffAccountResponse;
@@ -197,6 +234,7 @@ export interface AccountServiceController {
197
234
  changeStaffRole(request: ChangeStaffRoleRequest): Promise<ChangeStaffRoleResponse> | Observable<ChangeStaffRoleResponse> | ChangeStaffRoleResponse;
198
235
  setStaffActive(request: SetStaffActiveRequest): Promise<SetStaffActiveResponse> | Observable<SetStaffActiveResponse> | SetStaffActiveResponse;
199
236
  changeStaffEmail(request: ChangeStaffEmailRequest): Promise<ChangeStaffEmailResponse> | Observable<ChangeStaffEmailResponse> | ChangeStaffEmailResponse;
237
+ resetStaffTotp(request: ResetStaffTotpRequest): Promise<ResetStaffTotpResponse> | Observable<ResetStaffTotpResponse> | ResetStaffTotpResponse;
200
238
  }
201
239
  export declare function AccountServiceControllerMethods(): (constructor: Function) => void;
202
240
  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.30.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,8 @@ 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;
50
+ string created_at = 10;
44
51
  }
45
52
 
46
53
  message InitEmailChangeRequest {
@@ -122,6 +129,32 @@ message SetIdentityVerifiedResponse {
122
129
  bool ok = 1;
123
130
  }
124
131
 
132
+ message SetupTotpRequest {
133
+ string user_id = 1;
134
+ }
135
+
136
+ message SetupTotpResponse {
137
+ string secret = 1;
138
+ string uri = 2;
139
+ }
140
+
141
+ message EnableTotpRequest {
142
+ string user_id = 1;
143
+ string code = 2;
144
+ }
145
+
146
+ message EnableTotpResponse {
147
+ bool ok = 1;
148
+ }
149
+
150
+ message DisableTotpRequest {
151
+ string user_id = 1;
152
+ }
153
+
154
+ message DisableTotpResponse {
155
+ bool ok = 1;
156
+ }
157
+
125
158
  message CreateStaffAccountRequest {
126
159
  string email = 1;
127
160
  Role role = 2;
@@ -197,6 +230,15 @@ message ChangeStaffEmailResponse {
197
230
  StaffAccount account = 1;
198
231
  }
199
232
 
233
+ message ResetStaffTotpRequest {
234
+ string id = 1;
235
+ string admin_id = 2;
236
+ }
237
+
238
+ message ResetStaffTotpResponse {
239
+ StaffAccount account = 1;
240
+ }
241
+
200
242
  message StaffAccount {
201
243
  string id = 1;
202
244
  string email = 2;
@@ -205,6 +247,7 @@ message StaffAccount {
205
247
  bool is_active = 5;
206
248
  reserved 6;
207
249
  optional string last_active_at = 7;
250
+ bool is_totp_enabled = 8;
208
251
  }
209
252
 
210
253
  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 {