@ssoeasy-dev/proto 1.1.0-dev-develop.5304bf2 → 1.1.0-dev-feat-auth.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.
@@ -7,95 +7,99 @@
7
7
  /* eslint-disable */
8
8
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
9
  import type { CallContext, CallOptions } from "nice-grpc-common";
10
+ import { StatusResponse, Tokens } from "./common";
11
+ import { UserPolicyRequest, UserPolicyResponse } from "./user_policy";
10
12
  import {
13
+ Verification,
11
14
  VerificationType,
12
15
  verificationTypeFromJSON,
13
16
  verificationTypeToJSON,
14
17
  verificationTypeToNumber,
15
18
  } from "./verification";
16
19
 
20
+ export interface AuthCode {
21
+ $type: "auth.v1.AuthCode";
22
+ id: string;
23
+ value: string;
24
+ expiresAt: number;
25
+ }
26
+
17
27
  export interface RegistrationRequest {
18
28
  $type: "auth.v1.RegistrationRequest";
19
- userId: string;
20
- serviceId: string;
21
- companyId: string;
22
- attributeName: string;
23
- attributeValue: string;
24
- contact: string;
25
- verificationType: VerificationType;
29
+ login: string;
26
30
  password: string;
31
+ verificationType?: VerificationType | undefined;
32
+ policies: UserPolicyRequest[];
27
33
  }
28
34
 
29
35
  export interface RegistrationResponse {
30
36
  $type: "auth.v1.RegistrationResponse";
37
+ userId: string;
31
38
  credentialId: string;
32
- attributeId: string;
33
- verificationId: string;
34
- value: string;
35
- expiresAt: number;
39
+ policies: UserPolicyResponse[];
40
+ verification?: Verification | undefined;
36
41
  }
37
42
 
38
43
  export interface RegistrationCompensateRequest {
39
44
  $type: "auth.v1.RegistrationCompensateRequest";
45
+ userId: string;
40
46
  credentialId: string;
41
- verificationId: string;
42
- userAttributeId: string;
47
+ verificationId?: string | undefined;
48
+ policyIds: string[];
43
49
  }
44
50
 
45
- export interface StatusResponse {
46
- $type: "auth.v1.StatusResponse";
47
- success: boolean;
51
+ export interface LoginRequest {
52
+ $type: "auth.v1.LoginRequest";
53
+ login: string;
54
+ password: string;
55
+ codeChallenge: string;
56
+ serviceId: string;
57
+ verificationType?: VerificationType | undefined;
48
58
  }
49
59
 
50
- function createBaseRegistrationRequest(): RegistrationRequest {
51
- return {
52
- $type: "auth.v1.RegistrationRequest",
53
- userId: "",
54
- serviceId: "",
55
- companyId: "",
56
- attributeName: "",
57
- attributeValue: "",
58
- contact: "",
59
- verificationType: VerificationType.email_code,
60
- password: "",
61
- };
60
+ export interface LoginResponse {
61
+ $type: "auth.v1.LoginResponse";
62
+ code?: AuthCode | undefined;
63
+ verification?: Verification | undefined;
62
64
  }
63
65
 
64
- export const RegistrationRequest: MessageFns<RegistrationRequest, "auth.v1.RegistrationRequest"> = {
65
- $type: "auth.v1.RegistrationRequest" as const,
66
+ export interface CodeVerifier {
67
+ $type: "auth.v1.CodeVerifier";
68
+ code: string;
69
+ verifier: string;
70
+ }
66
71
 
67
- encode(message: RegistrationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
68
- if (message.userId !== "") {
69
- writer.uint32(10).string(message.userId);
70
- }
71
- if (message.serviceId !== "") {
72
- writer.uint32(18).string(message.serviceId);
73
- }
74
- if (message.companyId !== "") {
75
- writer.uint32(26).string(message.companyId);
76
- }
77
- if (message.attributeName !== "") {
78
- writer.uint32(34).string(message.attributeName);
79
- }
80
- if (message.attributeValue !== "") {
81
- writer.uint32(42).string(message.attributeValue);
82
- }
83
- if (message.contact !== "") {
84
- writer.uint32(50).string(message.contact);
72
+ export interface AuthtorizeRequest {
73
+ $type: "auth.v1.AuthtorizeRequest";
74
+ serviceId: string;
75
+ tokens?: Tokens | undefined;
76
+ code?: CodeVerifier | undefined;
77
+ }
78
+
79
+ function createBaseAuthCode(): AuthCode {
80
+ return { $type: "auth.v1.AuthCode", id: "", value: "", expiresAt: 0 };
81
+ }
82
+
83
+ export const AuthCode: MessageFns<AuthCode, "auth.v1.AuthCode"> = {
84
+ $type: "auth.v1.AuthCode" as const,
85
+
86
+ encode(message: AuthCode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
87
+ if (message.id !== "") {
88
+ writer.uint32(10).string(message.id);
85
89
  }
86
- if (message.verificationType !== VerificationType.email_code) {
87
- writer.uint32(56).int32(verificationTypeToNumber(message.verificationType));
90
+ if (message.value !== "") {
91
+ writer.uint32(18).string(message.value);
88
92
  }
89
- if (message.password !== "") {
90
- writer.uint32(66).string(message.password);
93
+ if (message.expiresAt !== 0) {
94
+ writer.uint32(24).int64(message.expiresAt);
91
95
  }
92
96
  return writer;
93
97
  },
94
98
 
95
- decode(input: BinaryReader | Uint8Array, length?: number): RegistrationRequest {
99
+ decode(input: BinaryReader | Uint8Array, length?: number): AuthCode {
96
100
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
97
101
  const end = length === undefined ? reader.len : reader.pos + length;
98
- const message = createBaseRegistrationRequest();
102
+ const message = createBaseAuthCode();
99
103
  while (reader.pos < end) {
100
104
  const tag = reader.uint32();
101
105
  switch (tag >>> 3) {
@@ -104,7 +108,7 @@ export const RegistrationRequest: MessageFns<RegistrationRequest, "auth.v1.Regis
104
108
  break;
105
109
  }
106
110
 
107
- message.userId = reader.string();
111
+ message.id = reader.string();
108
112
  continue;
109
113
  }
110
114
  case 2: {
@@ -112,55 +116,125 @@ export const RegistrationRequest: MessageFns<RegistrationRequest, "auth.v1.Regis
112
116
  break;
113
117
  }
114
118
 
115
- message.serviceId = reader.string();
119
+ message.value = reader.string();
116
120
  continue;
117
121
  }
118
122
  case 3: {
119
- if (tag !== 26) {
123
+ if (tag !== 24) {
120
124
  break;
121
125
  }
122
126
 
123
- message.companyId = reader.string();
127
+ message.expiresAt = longToNumber(reader.int64());
124
128
  continue;
125
129
  }
126
- case 4: {
127
- if (tag !== 34) {
128
- break;
129
- }
130
+ }
131
+ if ((tag & 7) === 4 || tag === 0) {
132
+ break;
133
+ }
134
+ reader.skip(tag & 7);
135
+ }
136
+ return message;
137
+ },
130
138
 
131
- message.attributeName = reader.string();
132
- continue;
133
- }
134
- case 5: {
135
- if (tag !== 42) {
139
+ fromJSON(object: any): AuthCode {
140
+ return {
141
+ $type: AuthCode.$type,
142
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
143
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
144
+ expiresAt: isSet(object.expiresAt)
145
+ ? globalThis.Number(object.expiresAt)
146
+ : isSet(object.expires_at)
147
+ ? globalThis.Number(object.expires_at)
148
+ : 0,
149
+ };
150
+ },
151
+
152
+ toJSON(message: AuthCode): unknown {
153
+ const obj: any = {};
154
+ if (message.id !== "") {
155
+ obj.id = message.id;
156
+ }
157
+ if (message.value !== "") {
158
+ obj.value = message.value;
159
+ }
160
+ if (message.expiresAt !== 0) {
161
+ obj.expiresAt = Math.round(message.expiresAt);
162
+ }
163
+ return obj;
164
+ },
165
+
166
+ create<I extends Exact<DeepPartial<AuthCode>, I>>(base?: I): AuthCode {
167
+ return AuthCode.fromPartial(base ?? ({} as any));
168
+ },
169
+ fromPartial<I extends Exact<DeepPartial<AuthCode>, I>>(object: I): AuthCode {
170
+ const message = createBaseAuthCode();
171
+ message.id = object.id ?? "";
172
+ message.value = object.value ?? "";
173
+ message.expiresAt = object.expiresAt ?? 0;
174
+ return message;
175
+ },
176
+ };
177
+
178
+ function createBaseRegistrationRequest(): RegistrationRequest {
179
+ return { $type: "auth.v1.RegistrationRequest", login: "", password: "", verificationType: undefined, policies: [] };
180
+ }
181
+
182
+ export const RegistrationRequest: MessageFns<RegistrationRequest, "auth.v1.RegistrationRequest"> = {
183
+ $type: "auth.v1.RegistrationRequest" as const,
184
+
185
+ encode(message: RegistrationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
186
+ if (message.login !== "") {
187
+ writer.uint32(10).string(message.login);
188
+ }
189
+ if (message.password !== "") {
190
+ writer.uint32(18).string(message.password);
191
+ }
192
+ if (message.verificationType !== undefined) {
193
+ writer.uint32(24).int32(verificationTypeToNumber(message.verificationType));
194
+ }
195
+ for (const v of message.policies) {
196
+ UserPolicyRequest.encode(v!, writer.uint32(34).fork()).join();
197
+ }
198
+ return writer;
199
+ },
200
+
201
+ decode(input: BinaryReader | Uint8Array, length?: number): RegistrationRequest {
202
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
203
+ const end = length === undefined ? reader.len : reader.pos + length;
204
+ const message = createBaseRegistrationRequest();
205
+ while (reader.pos < end) {
206
+ const tag = reader.uint32();
207
+ switch (tag >>> 3) {
208
+ case 1: {
209
+ if (tag !== 10) {
136
210
  break;
137
211
  }
138
212
 
139
- message.attributeValue = reader.string();
213
+ message.login = reader.string();
140
214
  continue;
141
215
  }
142
- case 6: {
143
- if (tag !== 50) {
216
+ case 2: {
217
+ if (tag !== 18) {
144
218
  break;
145
219
  }
146
220
 
147
- message.contact = reader.string();
221
+ message.password = reader.string();
148
222
  continue;
149
223
  }
150
- case 7: {
151
- if (tag !== 56) {
224
+ case 3: {
225
+ if (tag !== 24) {
152
226
  break;
153
227
  }
154
228
 
155
229
  message.verificationType = verificationTypeFromJSON(reader.int32());
156
230
  continue;
157
231
  }
158
- case 8: {
159
- if (tag !== 66) {
232
+ case 4: {
233
+ if (tag !== 34) {
160
234
  break;
161
235
  }
162
236
 
163
- message.password = reader.string();
237
+ message.policies.push(UserPolicyRequest.decode(reader, reader.uint32()));
164
238
  continue;
165
239
  }
166
240
  }
@@ -175,66 +249,32 @@ export const RegistrationRequest: MessageFns<RegistrationRequest, "auth.v1.Regis
175
249
  fromJSON(object: any): RegistrationRequest {
176
250
  return {
177
251
  $type: RegistrationRequest.$type,
178
- userId: isSet(object.userId)
179
- ? globalThis.String(object.userId)
180
- : isSet(object.user_id)
181
- ? globalThis.String(object.user_id)
182
- : "",
183
- serviceId: isSet(object.serviceId)
184
- ? globalThis.String(object.serviceId)
185
- : isSet(object.service_id)
186
- ? globalThis.String(object.service_id)
187
- : "",
188
- companyId: isSet(object.companyId)
189
- ? globalThis.String(object.companyId)
190
- : isSet(object.company_id)
191
- ? globalThis.String(object.company_id)
192
- : "",
193
- attributeName: isSet(object.attributeName)
194
- ? globalThis.String(object.attributeName)
195
- : isSet(object.attribute_name)
196
- ? globalThis.String(object.attribute_name)
197
- : "",
198
- attributeValue: isSet(object.attributeValue)
199
- ? globalThis.String(object.attributeValue)
200
- : isSet(object.attribute_value)
201
- ? globalThis.String(object.attribute_value)
202
- : "",
203
- contact: isSet(object.contact) ? globalThis.String(object.contact) : "",
252
+ login: isSet(object.login) ? globalThis.String(object.login) : "",
253
+ password: isSet(object.password) ? globalThis.String(object.password) : "",
204
254
  verificationType: isSet(object.verificationType)
205
255
  ? verificationTypeFromJSON(object.verificationType)
206
256
  : isSet(object.verification_type)
207
257
  ? verificationTypeFromJSON(object.verification_type)
208
- : VerificationType.email_code,
209
- password: isSet(object.password) ? globalThis.String(object.password) : "",
258
+ : undefined,
259
+ policies: globalThis.Array.isArray(object?.policies)
260
+ ? object.policies.map((e: any) => UserPolicyRequest.fromJSON(e))
261
+ : [],
210
262
  };
211
263
  },
212
264
 
213
265
  toJSON(message: RegistrationRequest): unknown {
214
266
  const obj: any = {};
215
- if (message.userId !== "") {
216
- obj.userId = message.userId;
267
+ if (message.login !== "") {
268
+ obj.login = message.login;
217
269
  }
218
- if (message.serviceId !== "") {
219
- obj.serviceId = message.serviceId;
220
- }
221
- if (message.companyId !== "") {
222
- obj.companyId = message.companyId;
223
- }
224
- if (message.attributeName !== "") {
225
- obj.attributeName = message.attributeName;
226
- }
227
- if (message.attributeValue !== "") {
228
- obj.attributeValue = message.attributeValue;
229
- }
230
- if (message.contact !== "") {
231
- obj.contact = message.contact;
270
+ if (message.password !== "") {
271
+ obj.password = message.password;
232
272
  }
233
- if (message.verificationType !== VerificationType.email_code) {
273
+ if (message.verificationType !== undefined) {
234
274
  obj.verificationType = verificationTypeToJSON(message.verificationType);
235
275
  }
236
- if (message.password !== "") {
237
- obj.password = message.password;
276
+ if (message.policies?.length) {
277
+ obj.policies = message.policies.map((e) => UserPolicyRequest.toJSON(e));
238
278
  }
239
279
  return obj;
240
280
  },
@@ -244,47 +284,33 @@ export const RegistrationRequest: MessageFns<RegistrationRequest, "auth.v1.Regis
244
284
  },
245
285
  fromPartial<I extends Exact<DeepPartial<RegistrationRequest>, I>>(object: I): RegistrationRequest {
246
286
  const message = createBaseRegistrationRequest();
247
- message.userId = object.userId ?? "";
248
- message.serviceId = object.serviceId ?? "";
249
- message.companyId = object.companyId ?? "";
250
- message.attributeName = object.attributeName ?? "";
251
- message.attributeValue = object.attributeValue ?? "";
252
- message.contact = object.contact ?? "";
253
- message.verificationType = object.verificationType ?? VerificationType.email_code;
287
+ message.login = object.login ?? "";
254
288
  message.password = object.password ?? "";
289
+ message.verificationType = object.verificationType ?? undefined;
290
+ message.policies = object.policies?.map((e) => UserPolicyRequest.fromPartial(e)) || [];
255
291
  return message;
256
292
  },
257
293
  };
258
294
 
259
295
  function createBaseRegistrationResponse(): RegistrationResponse {
260
- return {
261
- $type: "auth.v1.RegistrationResponse",
262
- credentialId: "",
263
- attributeId: "",
264
- verificationId: "",
265
- value: "",
266
- expiresAt: 0,
267
- };
296
+ return { $type: "auth.v1.RegistrationResponse", userId: "", credentialId: "", policies: [], verification: undefined };
268
297
  }
269
298
 
270
299
  export const RegistrationResponse: MessageFns<RegistrationResponse, "auth.v1.RegistrationResponse"> = {
271
300
  $type: "auth.v1.RegistrationResponse" as const,
272
301
 
273
302
  encode(message: RegistrationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
274
- if (message.credentialId !== "") {
275
- writer.uint32(10).string(message.credentialId);
276
- }
277
- if (message.attributeId !== "") {
278
- writer.uint32(18).string(message.attributeId);
303
+ if (message.userId !== "") {
304
+ writer.uint32(10).string(message.userId);
279
305
  }
280
- if (message.verificationId !== "") {
281
- writer.uint32(26).string(message.verificationId);
306
+ if (message.credentialId !== "") {
307
+ writer.uint32(18).string(message.credentialId);
282
308
  }
283
- if (message.value !== "") {
284
- writer.uint32(34).string(message.value);
309
+ for (const v of message.policies) {
310
+ UserPolicyResponse.encode(v!, writer.uint32(26).fork()).join();
285
311
  }
286
- if (message.expiresAt !== 0) {
287
- writer.uint32(40).int64(message.expiresAt);
312
+ if (message.verification !== undefined) {
313
+ Verification.encode(message.verification, writer.uint32(34).fork()).join();
288
314
  }
289
315
  return writer;
290
316
  },
@@ -301,7 +327,7 @@ export const RegistrationResponse: MessageFns<RegistrationResponse, "auth.v1.Reg
301
327
  break;
302
328
  }
303
329
 
304
- message.credentialId = reader.string();
330
+ message.userId = reader.string();
305
331
  continue;
306
332
  }
307
333
  case 2: {
@@ -309,7 +335,7 @@ export const RegistrationResponse: MessageFns<RegistrationResponse, "auth.v1.Reg
309
335
  break;
310
336
  }
311
337
 
312
- message.attributeId = reader.string();
338
+ message.credentialId = reader.string();
313
339
  continue;
314
340
  }
315
341
  case 3: {
@@ -317,7 +343,7 @@ export const RegistrationResponse: MessageFns<RegistrationResponse, "auth.v1.Reg
317
343
  break;
318
344
  }
319
345
 
320
- message.verificationId = reader.string();
346
+ message.policies.push(UserPolicyResponse.decode(reader, reader.uint32()));
321
347
  continue;
322
348
  }
323
349
  case 4: {
@@ -325,15 +351,7 @@ export const RegistrationResponse: MessageFns<RegistrationResponse, "auth.v1.Reg
325
351
  break;
326
352
  }
327
353
 
328
- message.value = reader.string();
329
- continue;
330
- }
331
- case 5: {
332
- if (tag !== 40) {
333
- break;
334
- }
335
-
336
- message.expiresAt = longToNumber(reader.int64());
354
+ message.verification = Verification.decode(reader, reader.uint32());
337
355
  continue;
338
356
  }
339
357
  }
@@ -348,46 +366,36 @@ export const RegistrationResponse: MessageFns<RegistrationResponse, "auth.v1.Reg
348
366
  fromJSON(object: any): RegistrationResponse {
349
367
  return {
350
368
  $type: RegistrationResponse.$type,
369
+ userId: isSet(object.userId)
370
+ ? globalThis.String(object.userId)
371
+ : isSet(object.user_id)
372
+ ? globalThis.String(object.user_id)
373
+ : "",
351
374
  credentialId: isSet(object.credentialId)
352
375
  ? globalThis.String(object.credentialId)
353
376
  : isSet(object.credential_id)
354
377
  ? globalThis.String(object.credential_id)
355
378
  : "",
356
- attributeId: isSet(object.attributeId)
357
- ? globalThis.String(object.attributeId)
358
- : isSet(object.attribute_id)
359
- ? globalThis.String(object.attribute_id)
360
- : "",
361
- verificationId: isSet(object.verificationId)
362
- ? globalThis.String(object.verificationId)
363
- : isSet(object.verification_id)
364
- ? globalThis.String(object.verification_id)
365
- : "",
366
- value: isSet(object.value) ? globalThis.String(object.value) : "",
367
- expiresAt: isSet(object.expiresAt)
368
- ? globalThis.Number(object.expiresAt)
369
- : isSet(object.expires_at)
370
- ? globalThis.Number(object.expires_at)
371
- : 0,
379
+ policies: globalThis.Array.isArray(object?.policies)
380
+ ? object.policies.map((e: any) => UserPolicyResponse.fromJSON(e))
381
+ : [],
382
+ verification: isSet(object.verification) ? Verification.fromJSON(object.verification) : undefined,
372
383
  };
373
384
  },
374
385
 
375
386
  toJSON(message: RegistrationResponse): unknown {
376
387
  const obj: any = {};
388
+ if (message.userId !== "") {
389
+ obj.userId = message.userId;
390
+ }
377
391
  if (message.credentialId !== "") {
378
392
  obj.credentialId = message.credentialId;
379
393
  }
380
- if (message.attributeId !== "") {
381
- obj.attributeId = message.attributeId;
382
- }
383
- if (message.verificationId !== "") {
384
- obj.verificationId = message.verificationId;
385
- }
386
- if (message.value !== "") {
387
- obj.value = message.value;
394
+ if (message.policies?.length) {
395
+ obj.policies = message.policies.map((e) => UserPolicyResponse.toJSON(e));
388
396
  }
389
- if (message.expiresAt !== 0) {
390
- obj.expiresAt = Math.round(message.expiresAt);
397
+ if (message.verification !== undefined) {
398
+ obj.verification = Verification.toJSON(message.verification);
391
399
  }
392
400
  return obj;
393
401
  },
@@ -397,17 +405,24 @@ export const RegistrationResponse: MessageFns<RegistrationResponse, "auth.v1.Reg
397
405
  },
398
406
  fromPartial<I extends Exact<DeepPartial<RegistrationResponse>, I>>(object: I): RegistrationResponse {
399
407
  const message = createBaseRegistrationResponse();
408
+ message.userId = object.userId ?? "";
400
409
  message.credentialId = object.credentialId ?? "";
401
- message.attributeId = object.attributeId ?? "";
402
- message.verificationId = object.verificationId ?? "";
403
- message.value = object.value ?? "";
404
- message.expiresAt = object.expiresAt ?? 0;
410
+ message.policies = object.policies?.map((e) => UserPolicyResponse.fromPartial(e)) || [];
411
+ message.verification = (object.verification !== undefined && object.verification !== null)
412
+ ? Verification.fromPartial(object.verification)
413
+ : undefined;
405
414
  return message;
406
415
  },
407
416
  };
408
417
 
409
418
  function createBaseRegistrationCompensateRequest(): RegistrationCompensateRequest {
410
- return { $type: "auth.v1.RegistrationCompensateRequest", credentialId: "", verificationId: "", userAttributeId: "" };
419
+ return {
420
+ $type: "auth.v1.RegistrationCompensateRequest",
421
+ userId: "",
422
+ credentialId: "",
423
+ verificationId: undefined,
424
+ policyIds: [],
425
+ };
411
426
  }
412
427
 
413
428
  export const RegistrationCompensateRequest: MessageFns<
@@ -417,14 +432,17 @@ export const RegistrationCompensateRequest: MessageFns<
417
432
  $type: "auth.v1.RegistrationCompensateRequest" as const,
418
433
 
419
434
  encode(message: RegistrationCompensateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
435
+ if (message.userId !== "") {
436
+ writer.uint32(10).string(message.userId);
437
+ }
420
438
  if (message.credentialId !== "") {
421
- writer.uint32(10).string(message.credentialId);
439
+ writer.uint32(18).string(message.credentialId);
422
440
  }
423
- if (message.verificationId !== "") {
424
- writer.uint32(18).string(message.verificationId);
441
+ if (message.verificationId !== undefined) {
442
+ writer.uint32(26).string(message.verificationId);
425
443
  }
426
- if (message.userAttributeId !== "") {
427
- writer.uint32(26).string(message.userAttributeId);
444
+ for (const v of message.policyIds) {
445
+ writer.uint32(34).string(v!);
428
446
  }
429
447
  return writer;
430
448
  },
@@ -441,7 +459,7 @@ export const RegistrationCompensateRequest: MessageFns<
441
459
  break;
442
460
  }
443
461
 
444
- message.credentialId = reader.string();
462
+ message.userId = reader.string();
445
463
  continue;
446
464
  }
447
465
  case 2: {
@@ -449,7 +467,7 @@ export const RegistrationCompensateRequest: MessageFns<
449
467
  break;
450
468
  }
451
469
 
452
- message.verificationId = reader.string();
470
+ message.credentialId = reader.string();
453
471
  continue;
454
472
  }
455
473
  case 3: {
@@ -457,7 +475,15 @@ export const RegistrationCompensateRequest: MessageFns<
457
475
  break;
458
476
  }
459
477
 
460
- message.userAttributeId = reader.string();
478
+ message.verificationId = reader.string();
479
+ continue;
480
+ }
481
+ case 4: {
482
+ if (tag !== 34) {
483
+ break;
484
+ }
485
+
486
+ message.policyIds.push(reader.string());
461
487
  continue;
462
488
  }
463
489
  }
@@ -472,6 +498,11 @@ export const RegistrationCompensateRequest: MessageFns<
472
498
  fromJSON(object: any): RegistrationCompensateRequest {
473
499
  return {
474
500
  $type: RegistrationCompensateRequest.$type,
501
+ userId: isSet(object.userId)
502
+ ? globalThis.String(object.userId)
503
+ : isSet(object.user_id)
504
+ ? globalThis.String(object.user_id)
505
+ : "",
475
506
  credentialId: isSet(object.credentialId)
476
507
  ? globalThis.String(object.credentialId)
477
508
  : isSet(object.credential_id)
@@ -481,25 +512,28 @@ export const RegistrationCompensateRequest: MessageFns<
481
512
  ? globalThis.String(object.verificationId)
482
513
  : isSet(object.verification_id)
483
514
  ? globalThis.String(object.verification_id)
484
- : "",
485
- userAttributeId: isSet(object.userAttributeId)
486
- ? globalThis.String(object.userAttributeId)
487
- : isSet(object.user_attribute_id)
488
- ? globalThis.String(object.user_attribute_id)
489
- : "",
515
+ : undefined,
516
+ policyIds: globalThis.Array.isArray(object?.policyIds)
517
+ ? object.policyIds.map((e: any) => globalThis.String(e))
518
+ : globalThis.Array.isArray(object?.policy_ids)
519
+ ? object.policy_ids.map((e: any) => globalThis.String(e))
520
+ : [],
490
521
  };
491
522
  },
492
523
 
493
524
  toJSON(message: RegistrationCompensateRequest): unknown {
494
525
  const obj: any = {};
526
+ if (message.userId !== "") {
527
+ obj.userId = message.userId;
528
+ }
495
529
  if (message.credentialId !== "") {
496
530
  obj.credentialId = message.credentialId;
497
531
  }
498
- if (message.verificationId !== "") {
532
+ if (message.verificationId !== undefined) {
499
533
  obj.verificationId = message.verificationId;
500
534
  }
501
- if (message.userAttributeId !== "") {
502
- obj.userAttributeId = message.userAttributeId;
535
+ if (message.policyIds?.length) {
536
+ obj.policyIds = message.policyIds;
503
537
  }
504
538
  return obj;
505
539
  },
@@ -511,40 +545,279 @@ export const RegistrationCompensateRequest: MessageFns<
511
545
  object: I,
512
546
  ): RegistrationCompensateRequest {
513
547
  const message = createBaseRegistrationCompensateRequest();
548
+ message.userId = object.userId ?? "";
514
549
  message.credentialId = object.credentialId ?? "";
515
- message.verificationId = object.verificationId ?? "";
516
- message.userAttributeId = object.userAttributeId ?? "";
550
+ message.verificationId = object.verificationId ?? undefined;
551
+ message.policyIds = object.policyIds?.map((e) => e) || [];
517
552
  return message;
518
553
  },
519
554
  };
520
555
 
521
- function createBaseStatusResponse(): StatusResponse {
522
- return { $type: "auth.v1.StatusResponse", success: false };
556
+ function createBaseLoginRequest(): LoginRequest {
557
+ return {
558
+ $type: "auth.v1.LoginRequest",
559
+ login: "",
560
+ password: "",
561
+ codeChallenge: "",
562
+ serviceId: "",
563
+ verificationType: undefined,
564
+ };
523
565
  }
524
566
 
525
- export const StatusResponse: MessageFns<StatusResponse, "auth.v1.StatusResponse"> = {
526
- $type: "auth.v1.StatusResponse" as const,
567
+ export const LoginRequest: MessageFns<LoginRequest, "auth.v1.LoginRequest"> = {
568
+ $type: "auth.v1.LoginRequest" as const,
527
569
 
528
- encode(message: StatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
529
- if (message.success !== false) {
530
- writer.uint32(8).bool(message.success);
570
+ encode(message: LoginRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
571
+ if (message.login !== "") {
572
+ writer.uint32(10).string(message.login);
573
+ }
574
+ if (message.password !== "") {
575
+ writer.uint32(18).string(message.password);
576
+ }
577
+ if (message.codeChallenge !== "") {
578
+ writer.uint32(26).string(message.codeChallenge);
579
+ }
580
+ if (message.serviceId !== "") {
581
+ writer.uint32(34).string(message.serviceId);
582
+ }
583
+ if (message.verificationType !== undefined) {
584
+ writer.uint32(40).int32(verificationTypeToNumber(message.verificationType));
585
+ }
586
+ return writer;
587
+ },
588
+
589
+ decode(input: BinaryReader | Uint8Array, length?: number): LoginRequest {
590
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
591
+ const end = length === undefined ? reader.len : reader.pos + length;
592
+ const message = createBaseLoginRequest();
593
+ while (reader.pos < end) {
594
+ const tag = reader.uint32();
595
+ switch (tag >>> 3) {
596
+ case 1: {
597
+ if (tag !== 10) {
598
+ break;
599
+ }
600
+
601
+ message.login = reader.string();
602
+ continue;
603
+ }
604
+ case 2: {
605
+ if (tag !== 18) {
606
+ break;
607
+ }
608
+
609
+ message.password = reader.string();
610
+ continue;
611
+ }
612
+ case 3: {
613
+ if (tag !== 26) {
614
+ break;
615
+ }
616
+
617
+ message.codeChallenge = reader.string();
618
+ continue;
619
+ }
620
+ case 4: {
621
+ if (tag !== 34) {
622
+ break;
623
+ }
624
+
625
+ message.serviceId = reader.string();
626
+ continue;
627
+ }
628
+ case 5: {
629
+ if (tag !== 40) {
630
+ break;
631
+ }
632
+
633
+ message.verificationType = verificationTypeFromJSON(reader.int32());
634
+ continue;
635
+ }
636
+ }
637
+ if ((tag & 7) === 4 || tag === 0) {
638
+ break;
639
+ }
640
+ reader.skip(tag & 7);
641
+ }
642
+ return message;
643
+ },
644
+
645
+ fromJSON(object: any): LoginRequest {
646
+ return {
647
+ $type: LoginRequest.$type,
648
+ login: isSet(object.login) ? globalThis.String(object.login) : "",
649
+ password: isSet(object.password) ? globalThis.String(object.password) : "",
650
+ codeChallenge: isSet(object.codeChallenge)
651
+ ? globalThis.String(object.codeChallenge)
652
+ : isSet(object.code_challenge)
653
+ ? globalThis.String(object.code_challenge)
654
+ : "",
655
+ serviceId: isSet(object.serviceId)
656
+ ? globalThis.String(object.serviceId)
657
+ : isSet(object.service_id)
658
+ ? globalThis.String(object.service_id)
659
+ : "",
660
+ verificationType: isSet(object.verificationType)
661
+ ? verificationTypeFromJSON(object.verificationType)
662
+ : isSet(object.verification_type)
663
+ ? verificationTypeFromJSON(object.verification_type)
664
+ : undefined,
665
+ };
666
+ },
667
+
668
+ toJSON(message: LoginRequest): unknown {
669
+ const obj: any = {};
670
+ if (message.login !== "") {
671
+ obj.login = message.login;
672
+ }
673
+ if (message.password !== "") {
674
+ obj.password = message.password;
675
+ }
676
+ if (message.codeChallenge !== "") {
677
+ obj.codeChallenge = message.codeChallenge;
678
+ }
679
+ if (message.serviceId !== "") {
680
+ obj.serviceId = message.serviceId;
681
+ }
682
+ if (message.verificationType !== undefined) {
683
+ obj.verificationType = verificationTypeToJSON(message.verificationType);
684
+ }
685
+ return obj;
686
+ },
687
+
688
+ create<I extends Exact<DeepPartial<LoginRequest>, I>>(base?: I): LoginRequest {
689
+ return LoginRequest.fromPartial(base ?? ({} as any));
690
+ },
691
+ fromPartial<I extends Exact<DeepPartial<LoginRequest>, I>>(object: I): LoginRequest {
692
+ const message = createBaseLoginRequest();
693
+ message.login = object.login ?? "";
694
+ message.password = object.password ?? "";
695
+ message.codeChallenge = object.codeChallenge ?? "";
696
+ message.serviceId = object.serviceId ?? "";
697
+ message.verificationType = object.verificationType ?? undefined;
698
+ return message;
699
+ },
700
+ };
701
+
702
+ function createBaseLoginResponse(): LoginResponse {
703
+ return { $type: "auth.v1.LoginResponse", code: undefined, verification: undefined };
704
+ }
705
+
706
+ export const LoginResponse: MessageFns<LoginResponse, "auth.v1.LoginResponse"> = {
707
+ $type: "auth.v1.LoginResponse" as const,
708
+
709
+ encode(message: LoginResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
710
+ if (message.code !== undefined) {
711
+ AuthCode.encode(message.code, writer.uint32(10).fork()).join();
712
+ }
713
+ if (message.verification !== undefined) {
714
+ Verification.encode(message.verification, writer.uint32(18).fork()).join();
715
+ }
716
+ return writer;
717
+ },
718
+
719
+ decode(input: BinaryReader | Uint8Array, length?: number): LoginResponse {
720
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
721
+ const end = length === undefined ? reader.len : reader.pos + length;
722
+ const message = createBaseLoginResponse();
723
+ while (reader.pos < end) {
724
+ const tag = reader.uint32();
725
+ switch (tag >>> 3) {
726
+ case 1: {
727
+ if (tag !== 10) {
728
+ break;
729
+ }
730
+
731
+ message.code = AuthCode.decode(reader, reader.uint32());
732
+ continue;
733
+ }
734
+ case 2: {
735
+ if (tag !== 18) {
736
+ break;
737
+ }
738
+
739
+ message.verification = Verification.decode(reader, reader.uint32());
740
+ continue;
741
+ }
742
+ }
743
+ if ((tag & 7) === 4 || tag === 0) {
744
+ break;
745
+ }
746
+ reader.skip(tag & 7);
747
+ }
748
+ return message;
749
+ },
750
+
751
+ fromJSON(object: any): LoginResponse {
752
+ return {
753
+ $type: LoginResponse.$type,
754
+ code: isSet(object.code) ? AuthCode.fromJSON(object.code) : undefined,
755
+ verification: isSet(object.verification) ? Verification.fromJSON(object.verification) : undefined,
756
+ };
757
+ },
758
+
759
+ toJSON(message: LoginResponse): unknown {
760
+ const obj: any = {};
761
+ if (message.code !== undefined) {
762
+ obj.code = AuthCode.toJSON(message.code);
763
+ }
764
+ if (message.verification !== undefined) {
765
+ obj.verification = Verification.toJSON(message.verification);
766
+ }
767
+ return obj;
768
+ },
769
+
770
+ create<I extends Exact<DeepPartial<LoginResponse>, I>>(base?: I): LoginResponse {
771
+ return LoginResponse.fromPartial(base ?? ({} as any));
772
+ },
773
+ fromPartial<I extends Exact<DeepPartial<LoginResponse>, I>>(object: I): LoginResponse {
774
+ const message = createBaseLoginResponse();
775
+ message.code = (object.code !== undefined && object.code !== null) ? AuthCode.fromPartial(object.code) : undefined;
776
+ message.verification = (object.verification !== undefined && object.verification !== null)
777
+ ? Verification.fromPartial(object.verification)
778
+ : undefined;
779
+ return message;
780
+ },
781
+ };
782
+
783
+ function createBaseCodeVerifier(): CodeVerifier {
784
+ return { $type: "auth.v1.CodeVerifier", code: "", verifier: "" };
785
+ }
786
+
787
+ export const CodeVerifier: MessageFns<CodeVerifier, "auth.v1.CodeVerifier"> = {
788
+ $type: "auth.v1.CodeVerifier" as const,
789
+
790
+ encode(message: CodeVerifier, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
791
+ if (message.code !== "") {
792
+ writer.uint32(10).string(message.code);
793
+ }
794
+ if (message.verifier !== "") {
795
+ writer.uint32(18).string(message.verifier);
531
796
  }
532
797
  return writer;
533
798
  },
534
799
 
535
- decode(input: BinaryReader | Uint8Array, length?: number): StatusResponse {
800
+ decode(input: BinaryReader | Uint8Array, length?: number): CodeVerifier {
536
801
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
537
802
  const end = length === undefined ? reader.len : reader.pos + length;
538
- const message = createBaseStatusResponse();
803
+ const message = createBaseCodeVerifier();
539
804
  while (reader.pos < end) {
540
805
  const tag = reader.uint32();
541
806
  switch (tag >>> 3) {
542
807
  case 1: {
543
- if (tag !== 8) {
808
+ if (tag !== 10) {
544
809
  break;
545
810
  }
546
811
 
547
- message.success = reader.bool();
812
+ message.code = reader.string();
813
+ continue;
814
+ }
815
+ case 2: {
816
+ if (tag !== 18) {
817
+ break;
818
+ }
819
+
820
+ message.verifier = reader.string();
548
821
  continue;
549
822
  }
550
823
  }
@@ -556,24 +829,135 @@ export const StatusResponse: MessageFns<StatusResponse, "auth.v1.StatusResponse"
556
829
  return message;
557
830
  },
558
831
 
559
- fromJSON(object: any): StatusResponse {
560
- return { $type: StatusResponse.$type, success: isSet(object.success) ? globalThis.Boolean(object.success) : false };
832
+ fromJSON(object: any): CodeVerifier {
833
+ return {
834
+ $type: CodeVerifier.$type,
835
+ code: isSet(object.code) ? globalThis.String(object.code) : "",
836
+ verifier: isSet(object.verifier) ? globalThis.String(object.verifier) : "",
837
+ };
561
838
  },
562
839
 
563
- toJSON(message: StatusResponse): unknown {
840
+ toJSON(message: CodeVerifier): unknown {
564
841
  const obj: any = {};
565
- if (message.success !== false) {
566
- obj.success = message.success;
842
+ if (message.code !== "") {
843
+ obj.code = message.code;
844
+ }
845
+ if (message.verifier !== "") {
846
+ obj.verifier = message.verifier;
567
847
  }
568
848
  return obj;
569
849
  },
570
850
 
571
- create<I extends Exact<DeepPartial<StatusResponse>, I>>(base?: I): StatusResponse {
572
- return StatusResponse.fromPartial(base ?? ({} as any));
851
+ create<I extends Exact<DeepPartial<CodeVerifier>, I>>(base?: I): CodeVerifier {
852
+ return CodeVerifier.fromPartial(base ?? ({} as any));
573
853
  },
574
- fromPartial<I extends Exact<DeepPartial<StatusResponse>, I>>(object: I): StatusResponse {
575
- const message = createBaseStatusResponse();
576
- message.success = object.success ?? false;
854
+ fromPartial<I extends Exact<DeepPartial<CodeVerifier>, I>>(object: I): CodeVerifier {
855
+ const message = createBaseCodeVerifier();
856
+ message.code = object.code ?? "";
857
+ message.verifier = object.verifier ?? "";
858
+ return message;
859
+ },
860
+ };
861
+
862
+ function createBaseAuthtorizeRequest(): AuthtorizeRequest {
863
+ return { $type: "auth.v1.AuthtorizeRequest", serviceId: "", tokens: undefined, code: undefined };
864
+ }
865
+
866
+ export const AuthtorizeRequest: MessageFns<AuthtorizeRequest, "auth.v1.AuthtorizeRequest"> = {
867
+ $type: "auth.v1.AuthtorizeRequest" as const,
868
+
869
+ encode(message: AuthtorizeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
870
+ if (message.serviceId !== "") {
871
+ writer.uint32(10).string(message.serviceId);
872
+ }
873
+ if (message.tokens !== undefined) {
874
+ Tokens.encode(message.tokens, writer.uint32(18).fork()).join();
875
+ }
876
+ if (message.code !== undefined) {
877
+ CodeVerifier.encode(message.code, writer.uint32(26).fork()).join();
878
+ }
879
+ return writer;
880
+ },
881
+
882
+ decode(input: BinaryReader | Uint8Array, length?: number): AuthtorizeRequest {
883
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
884
+ const end = length === undefined ? reader.len : reader.pos + length;
885
+ const message = createBaseAuthtorizeRequest();
886
+ while (reader.pos < end) {
887
+ const tag = reader.uint32();
888
+ switch (tag >>> 3) {
889
+ case 1: {
890
+ if (tag !== 10) {
891
+ break;
892
+ }
893
+
894
+ message.serviceId = reader.string();
895
+ continue;
896
+ }
897
+ case 2: {
898
+ if (tag !== 18) {
899
+ break;
900
+ }
901
+
902
+ message.tokens = Tokens.decode(reader, reader.uint32());
903
+ continue;
904
+ }
905
+ case 3: {
906
+ if (tag !== 26) {
907
+ break;
908
+ }
909
+
910
+ message.code = CodeVerifier.decode(reader, reader.uint32());
911
+ continue;
912
+ }
913
+ }
914
+ if ((tag & 7) === 4 || tag === 0) {
915
+ break;
916
+ }
917
+ reader.skip(tag & 7);
918
+ }
919
+ return message;
920
+ },
921
+
922
+ fromJSON(object: any): AuthtorizeRequest {
923
+ return {
924
+ $type: AuthtorizeRequest.$type,
925
+ serviceId: isSet(object.serviceId)
926
+ ? globalThis.String(object.serviceId)
927
+ : isSet(object.service_id)
928
+ ? globalThis.String(object.service_id)
929
+ : "",
930
+ tokens: isSet(object.tokens) ? Tokens.fromJSON(object.tokens) : undefined,
931
+ code: isSet(object.code) ? CodeVerifier.fromJSON(object.code) : undefined,
932
+ };
933
+ },
934
+
935
+ toJSON(message: AuthtorizeRequest): unknown {
936
+ const obj: any = {};
937
+ if (message.serviceId !== "") {
938
+ obj.serviceId = message.serviceId;
939
+ }
940
+ if (message.tokens !== undefined) {
941
+ obj.tokens = Tokens.toJSON(message.tokens);
942
+ }
943
+ if (message.code !== undefined) {
944
+ obj.code = CodeVerifier.toJSON(message.code);
945
+ }
946
+ return obj;
947
+ },
948
+
949
+ create<I extends Exact<DeepPartial<AuthtorizeRequest>, I>>(base?: I): AuthtorizeRequest {
950
+ return AuthtorizeRequest.fromPartial(base ?? ({} as any));
951
+ },
952
+ fromPartial<I extends Exact<DeepPartial<AuthtorizeRequest>, I>>(object: I): AuthtorizeRequest {
953
+ const message = createBaseAuthtorizeRequest();
954
+ message.serviceId = object.serviceId ?? "";
955
+ message.tokens = (object.tokens !== undefined && object.tokens !== null)
956
+ ? Tokens.fromPartial(object.tokens)
957
+ : undefined;
958
+ message.code = (object.code !== undefined && object.code !== null)
959
+ ? CodeVerifier.fromPartial(object.code)
960
+ : undefined;
577
961
  return message;
578
962
  },
579
963
  };
@@ -599,6 +983,30 @@ export const AuthServiceDefinition = {
599
983
  responseStream: false,
600
984
  options: {},
601
985
  },
986
+ login: {
987
+ name: "Login",
988
+ requestType: LoginRequest,
989
+ requestStream: false,
990
+ responseType: LoginResponse,
991
+ responseStream: false,
992
+ options: {},
993
+ },
994
+ authtorize: {
995
+ name: "Authtorize",
996
+ requestType: AuthtorizeRequest,
997
+ requestStream: false,
998
+ responseType: Tokens,
999
+ responseStream: false,
1000
+ options: {},
1001
+ },
1002
+ logout: {
1003
+ name: "Logout",
1004
+ requestType: Tokens,
1005
+ requestStream: false,
1006
+ responseType: StatusResponse,
1007
+ responseStream: false,
1008
+ options: {},
1009
+ },
602
1010
  },
603
1011
  } as const;
604
1012
 
@@ -611,6 +1019,9 @@ export interface AuthServiceImplementation<CallContextExt = {}> {
611
1019
  request: RegistrationCompensateRequest,
612
1020
  context: CallContext & CallContextExt,
613
1021
  ): Promise<DeepPartial<StatusResponse>>;
1022
+ login(request: LoginRequest, context: CallContext & CallContextExt): Promise<DeepPartial<LoginResponse>>;
1023
+ authtorize(request: AuthtorizeRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Tokens>>;
1024
+ logout(request: Tokens, context: CallContext & CallContextExt): Promise<DeepPartial<StatusResponse>>;
614
1025
  }
615
1026
 
616
1027
  export interface AuthServiceClient<CallOptionsExt = {}> {
@@ -622,6 +1033,9 @@ export interface AuthServiceClient<CallOptionsExt = {}> {
622
1033
  request: DeepPartial<RegistrationCompensateRequest>,
623
1034
  options?: CallOptions & CallOptionsExt,
624
1035
  ): Promise<StatusResponse>;
1036
+ login(request: DeepPartial<LoginRequest>, options?: CallOptions & CallOptionsExt): Promise<LoginResponse>;
1037
+ authtorize(request: DeepPartial<AuthtorizeRequest>, options?: CallOptions & CallOptionsExt): Promise<Tokens>;
1038
+ logout(request: DeepPartial<Tokens>, options?: CallOptions & CallOptionsExt): Promise<StatusResponse>;
625
1039
  }
626
1040
 
627
1041
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;