@ssoeasy-dev/proto 1.1.0-beta.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.
@@ -0,0 +1,1462 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.5
4
+ // protoc unknown
5
+ // source: auth/v1/auth.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { CallContext, CallOptions } from "nice-grpc-common";
10
+ import { StatusResponse } from "../../common/v1/types";
11
+ import { Tokens } from "./common";
12
+ import { UserPolicyRequest, UserPolicyResponse } from "./user_policy";
13
+ import {
14
+ Verification,
15
+ VerificationType,
16
+ verificationTypeFromJSON,
17
+ verificationTypeToJSON,
18
+ verificationTypeToNumber,
19
+ } from "./verification";
20
+
21
+ export interface GetMeRequest {
22
+ $type: "auth.v1.GetMeRequest";
23
+ token: string;
24
+ }
25
+
26
+ export interface GetMeResponse {
27
+ $type: "auth.v1.GetMeResponse";
28
+ userId: string;
29
+ login: string;
30
+ }
31
+
32
+ export interface AuthCode {
33
+ $type: "auth.v1.AuthCode";
34
+ id: string;
35
+ value: string;
36
+ expiresAt: number;
37
+ }
38
+
39
+ export interface RegistrationRequest {
40
+ $type: "auth.v1.RegistrationRequest";
41
+ login: string;
42
+ password: string;
43
+ verificationType?: VerificationType | undefined;
44
+ policies: UserPolicyRequest[];
45
+ }
46
+
47
+ export interface RegistrationResponse {
48
+ $type: "auth.v1.RegistrationResponse";
49
+ userId: string;
50
+ credentialId: string;
51
+ policies: UserPolicyResponse[];
52
+ verification?: Verification | undefined;
53
+ }
54
+
55
+ export interface RegistrationCompensateRequest {
56
+ $type: "auth.v1.RegistrationCompensateRequest";
57
+ userId: string;
58
+ credentialId: string;
59
+ verificationId?: string | undefined;
60
+ policyIds: string[];
61
+ }
62
+
63
+ export interface LoginRequest {
64
+ $type: "auth.v1.LoginRequest";
65
+ login: string;
66
+ password: string;
67
+ codeChallenge: string;
68
+ serviceId: string;
69
+ verificationType?: VerificationType | undefined;
70
+ }
71
+
72
+ export interface LoginResponse {
73
+ $type: "auth.v1.LoginResponse";
74
+ code?: AuthCode | undefined;
75
+ verification?: Verification | undefined;
76
+ }
77
+
78
+ export interface CodeVerifier {
79
+ $type: "auth.v1.CodeVerifier";
80
+ code: string;
81
+ verifier: string;
82
+ }
83
+
84
+ export interface AuthorizeRequest {
85
+ $type: "auth.v1.AuthorizeRequest";
86
+ serviceId: string;
87
+ tokens?: Tokens | undefined;
88
+ code?: CodeVerifier | undefined;
89
+ companyId: string;
90
+ }
91
+
92
+ export interface GetCompanyIdByCodeRequest {
93
+ $type: "auth.v1.GetCompanyIdByCodeRequest";
94
+ code: string;
95
+ serviceId: string;
96
+ }
97
+
98
+ export interface GetCompanyIdByCodeResponse {
99
+ $type: "auth.v1.GetCompanyIdByCodeResponse";
100
+ userId: string;
101
+ companyId?: string | undefined;
102
+ }
103
+
104
+ function createBaseGetMeRequest(): GetMeRequest {
105
+ return { $type: "auth.v1.GetMeRequest", token: "" };
106
+ }
107
+
108
+ export const GetMeRequest: MessageFns<GetMeRequest, "auth.v1.GetMeRequest"> = {
109
+ $type: "auth.v1.GetMeRequest" as const,
110
+
111
+ encode(message: GetMeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
112
+ if (message.token !== "") {
113
+ writer.uint32(10).string(message.token);
114
+ }
115
+ return writer;
116
+ },
117
+
118
+ decode(input: BinaryReader | Uint8Array, length?: number): GetMeRequest {
119
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
120
+ const end = length === undefined ? reader.len : reader.pos + length;
121
+ const message = createBaseGetMeRequest();
122
+ while (reader.pos < end) {
123
+ const tag = reader.uint32();
124
+ switch (tag >>> 3) {
125
+ case 1: {
126
+ if (tag !== 10) {
127
+ break;
128
+ }
129
+
130
+ message.token = reader.string();
131
+ continue;
132
+ }
133
+ }
134
+ if ((tag & 7) === 4 || tag === 0) {
135
+ break;
136
+ }
137
+ reader.skip(tag & 7);
138
+ }
139
+ return message;
140
+ },
141
+
142
+ fromJSON(object: any): GetMeRequest {
143
+ return { $type: GetMeRequest.$type, token: isSet(object.token) ? globalThis.String(object.token) : "" };
144
+ },
145
+
146
+ toJSON(message: GetMeRequest): unknown {
147
+ const obj: any = {};
148
+ if (message.token !== "") {
149
+ obj.token = message.token;
150
+ }
151
+ return obj;
152
+ },
153
+
154
+ create<I extends Exact<DeepPartial<GetMeRequest>, I>>(base?: I): GetMeRequest {
155
+ return GetMeRequest.fromPartial(base ?? ({} as any));
156
+ },
157
+ fromPartial<I extends Exact<DeepPartial<GetMeRequest>, I>>(object: I): GetMeRequest {
158
+ const message = createBaseGetMeRequest();
159
+ message.token = object.token ?? "";
160
+ return message;
161
+ },
162
+ };
163
+
164
+ function createBaseGetMeResponse(): GetMeResponse {
165
+ return { $type: "auth.v1.GetMeResponse", userId: "", login: "" };
166
+ }
167
+
168
+ export const GetMeResponse: MessageFns<GetMeResponse, "auth.v1.GetMeResponse"> = {
169
+ $type: "auth.v1.GetMeResponse" as const,
170
+
171
+ encode(message: GetMeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
172
+ if (message.userId !== "") {
173
+ writer.uint32(10).string(message.userId);
174
+ }
175
+ if (message.login !== "") {
176
+ writer.uint32(18).string(message.login);
177
+ }
178
+ return writer;
179
+ },
180
+
181
+ decode(input: BinaryReader | Uint8Array, length?: number): GetMeResponse {
182
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
183
+ const end = length === undefined ? reader.len : reader.pos + length;
184
+ const message = createBaseGetMeResponse();
185
+ while (reader.pos < end) {
186
+ const tag = reader.uint32();
187
+ switch (tag >>> 3) {
188
+ case 1: {
189
+ if (tag !== 10) {
190
+ break;
191
+ }
192
+
193
+ message.userId = reader.string();
194
+ continue;
195
+ }
196
+ case 2: {
197
+ if (tag !== 18) {
198
+ break;
199
+ }
200
+
201
+ message.login = reader.string();
202
+ continue;
203
+ }
204
+ }
205
+ if ((tag & 7) === 4 || tag === 0) {
206
+ break;
207
+ }
208
+ reader.skip(tag & 7);
209
+ }
210
+ return message;
211
+ },
212
+
213
+ fromJSON(object: any): GetMeResponse {
214
+ return {
215
+ $type: GetMeResponse.$type,
216
+ userId: isSet(object.userId)
217
+ ? globalThis.String(object.userId)
218
+ : isSet(object.user_id)
219
+ ? globalThis.String(object.user_id)
220
+ : "",
221
+ login: isSet(object.login) ? globalThis.String(object.login) : "",
222
+ };
223
+ },
224
+
225
+ toJSON(message: GetMeResponse): unknown {
226
+ const obj: any = {};
227
+ if (message.userId !== "") {
228
+ obj.userId = message.userId;
229
+ }
230
+ if (message.login !== "") {
231
+ obj.login = message.login;
232
+ }
233
+ return obj;
234
+ },
235
+
236
+ create<I extends Exact<DeepPartial<GetMeResponse>, I>>(base?: I): GetMeResponse {
237
+ return GetMeResponse.fromPartial(base ?? ({} as any));
238
+ },
239
+ fromPartial<I extends Exact<DeepPartial<GetMeResponse>, I>>(object: I): GetMeResponse {
240
+ const message = createBaseGetMeResponse();
241
+ message.userId = object.userId ?? "";
242
+ message.login = object.login ?? "";
243
+ return message;
244
+ },
245
+ };
246
+
247
+ function createBaseAuthCode(): AuthCode {
248
+ return { $type: "auth.v1.AuthCode", id: "", value: "", expiresAt: 0 };
249
+ }
250
+
251
+ export const AuthCode: MessageFns<AuthCode, "auth.v1.AuthCode"> = {
252
+ $type: "auth.v1.AuthCode" as const,
253
+
254
+ encode(message: AuthCode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
255
+ if (message.id !== "") {
256
+ writer.uint32(10).string(message.id);
257
+ }
258
+ if (message.value !== "") {
259
+ writer.uint32(18).string(message.value);
260
+ }
261
+ if (message.expiresAt !== 0) {
262
+ writer.uint32(24).int64(message.expiresAt);
263
+ }
264
+ return writer;
265
+ },
266
+
267
+ decode(input: BinaryReader | Uint8Array, length?: number): AuthCode {
268
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
269
+ const end = length === undefined ? reader.len : reader.pos + length;
270
+ const message = createBaseAuthCode();
271
+ while (reader.pos < end) {
272
+ const tag = reader.uint32();
273
+ switch (tag >>> 3) {
274
+ case 1: {
275
+ if (tag !== 10) {
276
+ break;
277
+ }
278
+
279
+ message.id = reader.string();
280
+ continue;
281
+ }
282
+ case 2: {
283
+ if (tag !== 18) {
284
+ break;
285
+ }
286
+
287
+ message.value = reader.string();
288
+ continue;
289
+ }
290
+ case 3: {
291
+ if (tag !== 24) {
292
+ break;
293
+ }
294
+
295
+ message.expiresAt = longToNumber(reader.int64());
296
+ continue;
297
+ }
298
+ }
299
+ if ((tag & 7) === 4 || tag === 0) {
300
+ break;
301
+ }
302
+ reader.skip(tag & 7);
303
+ }
304
+ return message;
305
+ },
306
+
307
+ fromJSON(object: any): AuthCode {
308
+ return {
309
+ $type: AuthCode.$type,
310
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
311
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
312
+ expiresAt: isSet(object.expiresAt)
313
+ ? globalThis.Number(object.expiresAt)
314
+ : isSet(object.expires_at)
315
+ ? globalThis.Number(object.expires_at)
316
+ : 0,
317
+ };
318
+ },
319
+
320
+ toJSON(message: AuthCode): unknown {
321
+ const obj: any = {};
322
+ if (message.id !== "") {
323
+ obj.id = message.id;
324
+ }
325
+ if (message.value !== "") {
326
+ obj.value = message.value;
327
+ }
328
+ if (message.expiresAt !== 0) {
329
+ obj.expiresAt = Math.round(message.expiresAt);
330
+ }
331
+ return obj;
332
+ },
333
+
334
+ create<I extends Exact<DeepPartial<AuthCode>, I>>(base?: I): AuthCode {
335
+ return AuthCode.fromPartial(base ?? ({} as any));
336
+ },
337
+ fromPartial<I extends Exact<DeepPartial<AuthCode>, I>>(object: I): AuthCode {
338
+ const message = createBaseAuthCode();
339
+ message.id = object.id ?? "";
340
+ message.value = object.value ?? "";
341
+ message.expiresAt = object.expiresAt ?? 0;
342
+ return message;
343
+ },
344
+ };
345
+
346
+ function createBaseRegistrationRequest(): RegistrationRequest {
347
+ return { $type: "auth.v1.RegistrationRequest", login: "", password: "", verificationType: undefined, policies: [] };
348
+ }
349
+
350
+ export const RegistrationRequest: MessageFns<RegistrationRequest, "auth.v1.RegistrationRequest"> = {
351
+ $type: "auth.v1.RegistrationRequest" as const,
352
+
353
+ encode(message: RegistrationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
354
+ if (message.login !== "") {
355
+ writer.uint32(10).string(message.login);
356
+ }
357
+ if (message.password !== "") {
358
+ writer.uint32(18).string(message.password);
359
+ }
360
+ if (message.verificationType !== undefined) {
361
+ writer.uint32(24).int32(verificationTypeToNumber(message.verificationType));
362
+ }
363
+ for (const v of message.policies) {
364
+ UserPolicyRequest.encode(v!, writer.uint32(34).fork()).join();
365
+ }
366
+ return writer;
367
+ },
368
+
369
+ decode(input: BinaryReader | Uint8Array, length?: number): RegistrationRequest {
370
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
371
+ const end = length === undefined ? reader.len : reader.pos + length;
372
+ const message = createBaseRegistrationRequest();
373
+ while (reader.pos < end) {
374
+ const tag = reader.uint32();
375
+ switch (tag >>> 3) {
376
+ case 1: {
377
+ if (tag !== 10) {
378
+ break;
379
+ }
380
+
381
+ message.login = reader.string();
382
+ continue;
383
+ }
384
+ case 2: {
385
+ if (tag !== 18) {
386
+ break;
387
+ }
388
+
389
+ message.password = reader.string();
390
+ continue;
391
+ }
392
+ case 3: {
393
+ if (tag !== 24) {
394
+ break;
395
+ }
396
+
397
+ message.verificationType = verificationTypeFromJSON(reader.int32());
398
+ continue;
399
+ }
400
+ case 4: {
401
+ if (tag !== 34) {
402
+ break;
403
+ }
404
+
405
+ message.policies.push(UserPolicyRequest.decode(reader, reader.uint32()));
406
+ continue;
407
+ }
408
+ }
409
+ if ((tag & 7) === 4 || tag === 0) {
410
+ break;
411
+ }
412
+ reader.skip(tag & 7);
413
+ }
414
+ return message;
415
+ },
416
+
417
+ fromJSON(object: any): RegistrationRequest {
418
+ return {
419
+ $type: RegistrationRequest.$type,
420
+ login: isSet(object.login) ? globalThis.String(object.login) : "",
421
+ password: isSet(object.password) ? globalThis.String(object.password) : "",
422
+ verificationType: isSet(object.verificationType)
423
+ ? verificationTypeFromJSON(object.verificationType)
424
+ : isSet(object.verification_type)
425
+ ? verificationTypeFromJSON(object.verification_type)
426
+ : undefined,
427
+ policies: globalThis.Array.isArray(object?.policies)
428
+ ? object.policies.map((e: any) => UserPolicyRequest.fromJSON(e))
429
+ : [],
430
+ };
431
+ },
432
+
433
+ toJSON(message: RegistrationRequest): unknown {
434
+ const obj: any = {};
435
+ if (message.login !== "") {
436
+ obj.login = message.login;
437
+ }
438
+ if (message.password !== "") {
439
+ obj.password = message.password;
440
+ }
441
+ if (message.verificationType !== undefined) {
442
+ obj.verificationType = verificationTypeToJSON(message.verificationType);
443
+ }
444
+ if (message.policies?.length) {
445
+ obj.policies = message.policies.map((e) => UserPolicyRequest.toJSON(e));
446
+ }
447
+ return obj;
448
+ },
449
+
450
+ create<I extends Exact<DeepPartial<RegistrationRequest>, I>>(base?: I): RegistrationRequest {
451
+ return RegistrationRequest.fromPartial(base ?? ({} as any));
452
+ },
453
+ fromPartial<I extends Exact<DeepPartial<RegistrationRequest>, I>>(object: I): RegistrationRequest {
454
+ const message = createBaseRegistrationRequest();
455
+ message.login = object.login ?? "";
456
+ message.password = object.password ?? "";
457
+ message.verificationType = object.verificationType ?? undefined;
458
+ message.policies = object.policies?.map((e) => UserPolicyRequest.fromPartial(e)) || [];
459
+ return message;
460
+ },
461
+ };
462
+
463
+ function createBaseRegistrationResponse(): RegistrationResponse {
464
+ return { $type: "auth.v1.RegistrationResponse", userId: "", credentialId: "", policies: [], verification: undefined };
465
+ }
466
+
467
+ export const RegistrationResponse: MessageFns<RegistrationResponse, "auth.v1.RegistrationResponse"> = {
468
+ $type: "auth.v1.RegistrationResponse" as const,
469
+
470
+ encode(message: RegistrationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
471
+ if (message.userId !== "") {
472
+ writer.uint32(10).string(message.userId);
473
+ }
474
+ if (message.credentialId !== "") {
475
+ writer.uint32(18).string(message.credentialId);
476
+ }
477
+ for (const v of message.policies) {
478
+ UserPolicyResponse.encode(v!, writer.uint32(26).fork()).join();
479
+ }
480
+ if (message.verification !== undefined) {
481
+ Verification.encode(message.verification, writer.uint32(34).fork()).join();
482
+ }
483
+ return writer;
484
+ },
485
+
486
+ decode(input: BinaryReader | Uint8Array, length?: number): RegistrationResponse {
487
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
488
+ const end = length === undefined ? reader.len : reader.pos + length;
489
+ const message = createBaseRegistrationResponse();
490
+ while (reader.pos < end) {
491
+ const tag = reader.uint32();
492
+ switch (tag >>> 3) {
493
+ case 1: {
494
+ if (tag !== 10) {
495
+ break;
496
+ }
497
+
498
+ message.userId = reader.string();
499
+ continue;
500
+ }
501
+ case 2: {
502
+ if (tag !== 18) {
503
+ break;
504
+ }
505
+
506
+ message.credentialId = reader.string();
507
+ continue;
508
+ }
509
+ case 3: {
510
+ if (tag !== 26) {
511
+ break;
512
+ }
513
+
514
+ message.policies.push(UserPolicyResponse.decode(reader, reader.uint32()));
515
+ continue;
516
+ }
517
+ case 4: {
518
+ if (tag !== 34) {
519
+ break;
520
+ }
521
+
522
+ message.verification = Verification.decode(reader, reader.uint32());
523
+ continue;
524
+ }
525
+ }
526
+ if ((tag & 7) === 4 || tag === 0) {
527
+ break;
528
+ }
529
+ reader.skip(tag & 7);
530
+ }
531
+ return message;
532
+ },
533
+
534
+ fromJSON(object: any): RegistrationResponse {
535
+ return {
536
+ $type: RegistrationResponse.$type,
537
+ userId: isSet(object.userId)
538
+ ? globalThis.String(object.userId)
539
+ : isSet(object.user_id)
540
+ ? globalThis.String(object.user_id)
541
+ : "",
542
+ credentialId: isSet(object.credentialId)
543
+ ? globalThis.String(object.credentialId)
544
+ : isSet(object.credential_id)
545
+ ? globalThis.String(object.credential_id)
546
+ : "",
547
+ policies: globalThis.Array.isArray(object?.policies)
548
+ ? object.policies.map((e: any) => UserPolicyResponse.fromJSON(e))
549
+ : [],
550
+ verification: isSet(object.verification) ? Verification.fromJSON(object.verification) : undefined,
551
+ };
552
+ },
553
+
554
+ toJSON(message: RegistrationResponse): unknown {
555
+ const obj: any = {};
556
+ if (message.userId !== "") {
557
+ obj.userId = message.userId;
558
+ }
559
+ if (message.credentialId !== "") {
560
+ obj.credentialId = message.credentialId;
561
+ }
562
+ if (message.policies?.length) {
563
+ obj.policies = message.policies.map((e) => UserPolicyResponse.toJSON(e));
564
+ }
565
+ if (message.verification !== undefined) {
566
+ obj.verification = Verification.toJSON(message.verification);
567
+ }
568
+ return obj;
569
+ },
570
+
571
+ create<I extends Exact<DeepPartial<RegistrationResponse>, I>>(base?: I): RegistrationResponse {
572
+ return RegistrationResponse.fromPartial(base ?? ({} as any));
573
+ },
574
+ fromPartial<I extends Exact<DeepPartial<RegistrationResponse>, I>>(object: I): RegistrationResponse {
575
+ const message = createBaseRegistrationResponse();
576
+ message.userId = object.userId ?? "";
577
+ message.credentialId = object.credentialId ?? "";
578
+ message.policies = object.policies?.map((e) => UserPolicyResponse.fromPartial(e)) || [];
579
+ message.verification = (object.verification !== undefined && object.verification !== null)
580
+ ? Verification.fromPartial(object.verification)
581
+ : undefined;
582
+ return message;
583
+ },
584
+ };
585
+
586
+ function createBaseRegistrationCompensateRequest(): RegistrationCompensateRequest {
587
+ return {
588
+ $type: "auth.v1.RegistrationCompensateRequest",
589
+ userId: "",
590
+ credentialId: "",
591
+ verificationId: undefined,
592
+ policyIds: [],
593
+ };
594
+ }
595
+
596
+ export const RegistrationCompensateRequest: MessageFns<
597
+ RegistrationCompensateRequest,
598
+ "auth.v1.RegistrationCompensateRequest"
599
+ > = {
600
+ $type: "auth.v1.RegistrationCompensateRequest" as const,
601
+
602
+ encode(message: RegistrationCompensateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
603
+ if (message.userId !== "") {
604
+ writer.uint32(10).string(message.userId);
605
+ }
606
+ if (message.credentialId !== "") {
607
+ writer.uint32(18).string(message.credentialId);
608
+ }
609
+ if (message.verificationId !== undefined) {
610
+ writer.uint32(26).string(message.verificationId);
611
+ }
612
+ for (const v of message.policyIds) {
613
+ writer.uint32(34).string(v!);
614
+ }
615
+ return writer;
616
+ },
617
+
618
+ decode(input: BinaryReader | Uint8Array, length?: number): RegistrationCompensateRequest {
619
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
620
+ const end = length === undefined ? reader.len : reader.pos + length;
621
+ const message = createBaseRegistrationCompensateRequest();
622
+ while (reader.pos < end) {
623
+ const tag = reader.uint32();
624
+ switch (tag >>> 3) {
625
+ case 1: {
626
+ if (tag !== 10) {
627
+ break;
628
+ }
629
+
630
+ message.userId = reader.string();
631
+ continue;
632
+ }
633
+ case 2: {
634
+ if (tag !== 18) {
635
+ break;
636
+ }
637
+
638
+ message.credentialId = reader.string();
639
+ continue;
640
+ }
641
+ case 3: {
642
+ if (tag !== 26) {
643
+ break;
644
+ }
645
+
646
+ message.verificationId = reader.string();
647
+ continue;
648
+ }
649
+ case 4: {
650
+ if (tag !== 34) {
651
+ break;
652
+ }
653
+
654
+ message.policyIds.push(reader.string());
655
+ continue;
656
+ }
657
+ }
658
+ if ((tag & 7) === 4 || tag === 0) {
659
+ break;
660
+ }
661
+ reader.skip(tag & 7);
662
+ }
663
+ return message;
664
+ },
665
+
666
+ fromJSON(object: any): RegistrationCompensateRequest {
667
+ return {
668
+ $type: RegistrationCompensateRequest.$type,
669
+ userId: isSet(object.userId)
670
+ ? globalThis.String(object.userId)
671
+ : isSet(object.user_id)
672
+ ? globalThis.String(object.user_id)
673
+ : "",
674
+ credentialId: isSet(object.credentialId)
675
+ ? globalThis.String(object.credentialId)
676
+ : isSet(object.credential_id)
677
+ ? globalThis.String(object.credential_id)
678
+ : "",
679
+ verificationId: isSet(object.verificationId)
680
+ ? globalThis.String(object.verificationId)
681
+ : isSet(object.verification_id)
682
+ ? globalThis.String(object.verification_id)
683
+ : undefined,
684
+ policyIds: globalThis.Array.isArray(object?.policyIds)
685
+ ? object.policyIds.map((e: any) => globalThis.String(e))
686
+ : globalThis.Array.isArray(object?.policy_ids)
687
+ ? object.policy_ids.map((e: any) => globalThis.String(e))
688
+ : [],
689
+ };
690
+ },
691
+
692
+ toJSON(message: RegistrationCompensateRequest): unknown {
693
+ const obj: any = {};
694
+ if (message.userId !== "") {
695
+ obj.userId = message.userId;
696
+ }
697
+ if (message.credentialId !== "") {
698
+ obj.credentialId = message.credentialId;
699
+ }
700
+ if (message.verificationId !== undefined) {
701
+ obj.verificationId = message.verificationId;
702
+ }
703
+ if (message.policyIds?.length) {
704
+ obj.policyIds = message.policyIds;
705
+ }
706
+ return obj;
707
+ },
708
+
709
+ create<I extends Exact<DeepPartial<RegistrationCompensateRequest>, I>>(base?: I): RegistrationCompensateRequest {
710
+ return RegistrationCompensateRequest.fromPartial(base ?? ({} as any));
711
+ },
712
+ fromPartial<I extends Exact<DeepPartial<RegistrationCompensateRequest>, I>>(
713
+ object: I,
714
+ ): RegistrationCompensateRequest {
715
+ const message = createBaseRegistrationCompensateRequest();
716
+ message.userId = object.userId ?? "";
717
+ message.credentialId = object.credentialId ?? "";
718
+ message.verificationId = object.verificationId ?? undefined;
719
+ message.policyIds = object.policyIds?.map((e) => e) || [];
720
+ return message;
721
+ },
722
+ };
723
+
724
+ function createBaseLoginRequest(): LoginRequest {
725
+ return {
726
+ $type: "auth.v1.LoginRequest",
727
+ login: "",
728
+ password: "",
729
+ codeChallenge: "",
730
+ serviceId: "",
731
+ verificationType: undefined,
732
+ };
733
+ }
734
+
735
+ export const LoginRequest: MessageFns<LoginRequest, "auth.v1.LoginRequest"> = {
736
+ $type: "auth.v1.LoginRequest" as const,
737
+
738
+ encode(message: LoginRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
739
+ if (message.login !== "") {
740
+ writer.uint32(10).string(message.login);
741
+ }
742
+ if (message.password !== "") {
743
+ writer.uint32(18).string(message.password);
744
+ }
745
+ if (message.codeChallenge !== "") {
746
+ writer.uint32(26).string(message.codeChallenge);
747
+ }
748
+ if (message.serviceId !== "") {
749
+ writer.uint32(34).string(message.serviceId);
750
+ }
751
+ if (message.verificationType !== undefined) {
752
+ writer.uint32(40).int32(verificationTypeToNumber(message.verificationType));
753
+ }
754
+ return writer;
755
+ },
756
+
757
+ decode(input: BinaryReader | Uint8Array, length?: number): LoginRequest {
758
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
759
+ const end = length === undefined ? reader.len : reader.pos + length;
760
+ const message = createBaseLoginRequest();
761
+ while (reader.pos < end) {
762
+ const tag = reader.uint32();
763
+ switch (tag >>> 3) {
764
+ case 1: {
765
+ if (tag !== 10) {
766
+ break;
767
+ }
768
+
769
+ message.login = reader.string();
770
+ continue;
771
+ }
772
+ case 2: {
773
+ if (tag !== 18) {
774
+ break;
775
+ }
776
+
777
+ message.password = reader.string();
778
+ continue;
779
+ }
780
+ case 3: {
781
+ if (tag !== 26) {
782
+ break;
783
+ }
784
+
785
+ message.codeChallenge = reader.string();
786
+ continue;
787
+ }
788
+ case 4: {
789
+ if (tag !== 34) {
790
+ break;
791
+ }
792
+
793
+ message.serviceId = reader.string();
794
+ continue;
795
+ }
796
+ case 5: {
797
+ if (tag !== 40) {
798
+ break;
799
+ }
800
+
801
+ message.verificationType = verificationTypeFromJSON(reader.int32());
802
+ continue;
803
+ }
804
+ }
805
+ if ((tag & 7) === 4 || tag === 0) {
806
+ break;
807
+ }
808
+ reader.skip(tag & 7);
809
+ }
810
+ return message;
811
+ },
812
+
813
+ fromJSON(object: any): LoginRequest {
814
+ return {
815
+ $type: LoginRequest.$type,
816
+ login: isSet(object.login) ? globalThis.String(object.login) : "",
817
+ password: isSet(object.password) ? globalThis.String(object.password) : "",
818
+ codeChallenge: isSet(object.codeChallenge)
819
+ ? globalThis.String(object.codeChallenge)
820
+ : isSet(object.code_challenge)
821
+ ? globalThis.String(object.code_challenge)
822
+ : "",
823
+ serviceId: isSet(object.serviceId)
824
+ ? globalThis.String(object.serviceId)
825
+ : isSet(object.service_id)
826
+ ? globalThis.String(object.service_id)
827
+ : "",
828
+ verificationType: isSet(object.verificationType)
829
+ ? verificationTypeFromJSON(object.verificationType)
830
+ : isSet(object.verification_type)
831
+ ? verificationTypeFromJSON(object.verification_type)
832
+ : undefined,
833
+ };
834
+ },
835
+
836
+ toJSON(message: LoginRequest): unknown {
837
+ const obj: any = {};
838
+ if (message.login !== "") {
839
+ obj.login = message.login;
840
+ }
841
+ if (message.password !== "") {
842
+ obj.password = message.password;
843
+ }
844
+ if (message.codeChallenge !== "") {
845
+ obj.codeChallenge = message.codeChallenge;
846
+ }
847
+ if (message.serviceId !== "") {
848
+ obj.serviceId = message.serviceId;
849
+ }
850
+ if (message.verificationType !== undefined) {
851
+ obj.verificationType = verificationTypeToJSON(message.verificationType);
852
+ }
853
+ return obj;
854
+ },
855
+
856
+ create<I extends Exact<DeepPartial<LoginRequest>, I>>(base?: I): LoginRequest {
857
+ return LoginRequest.fromPartial(base ?? ({} as any));
858
+ },
859
+ fromPartial<I extends Exact<DeepPartial<LoginRequest>, I>>(object: I): LoginRequest {
860
+ const message = createBaseLoginRequest();
861
+ message.login = object.login ?? "";
862
+ message.password = object.password ?? "";
863
+ message.codeChallenge = object.codeChallenge ?? "";
864
+ message.serviceId = object.serviceId ?? "";
865
+ message.verificationType = object.verificationType ?? undefined;
866
+ return message;
867
+ },
868
+ };
869
+
870
+ function createBaseLoginResponse(): LoginResponse {
871
+ return { $type: "auth.v1.LoginResponse", code: undefined, verification: undefined };
872
+ }
873
+
874
+ export const LoginResponse: MessageFns<LoginResponse, "auth.v1.LoginResponse"> = {
875
+ $type: "auth.v1.LoginResponse" as const,
876
+
877
+ encode(message: LoginResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
878
+ if (message.code !== undefined) {
879
+ AuthCode.encode(message.code, writer.uint32(10).fork()).join();
880
+ }
881
+ if (message.verification !== undefined) {
882
+ Verification.encode(message.verification, writer.uint32(18).fork()).join();
883
+ }
884
+ return writer;
885
+ },
886
+
887
+ decode(input: BinaryReader | Uint8Array, length?: number): LoginResponse {
888
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
889
+ const end = length === undefined ? reader.len : reader.pos + length;
890
+ const message = createBaseLoginResponse();
891
+ while (reader.pos < end) {
892
+ const tag = reader.uint32();
893
+ switch (tag >>> 3) {
894
+ case 1: {
895
+ if (tag !== 10) {
896
+ break;
897
+ }
898
+
899
+ message.code = AuthCode.decode(reader, reader.uint32());
900
+ continue;
901
+ }
902
+ case 2: {
903
+ if (tag !== 18) {
904
+ break;
905
+ }
906
+
907
+ message.verification = Verification.decode(reader, reader.uint32());
908
+ continue;
909
+ }
910
+ }
911
+ if ((tag & 7) === 4 || tag === 0) {
912
+ break;
913
+ }
914
+ reader.skip(tag & 7);
915
+ }
916
+ return message;
917
+ },
918
+
919
+ fromJSON(object: any): LoginResponse {
920
+ return {
921
+ $type: LoginResponse.$type,
922
+ code: isSet(object.code) ? AuthCode.fromJSON(object.code) : undefined,
923
+ verification: isSet(object.verification) ? Verification.fromJSON(object.verification) : undefined,
924
+ };
925
+ },
926
+
927
+ toJSON(message: LoginResponse): unknown {
928
+ const obj: any = {};
929
+ if (message.code !== undefined) {
930
+ obj.code = AuthCode.toJSON(message.code);
931
+ }
932
+ if (message.verification !== undefined) {
933
+ obj.verification = Verification.toJSON(message.verification);
934
+ }
935
+ return obj;
936
+ },
937
+
938
+ create<I extends Exact<DeepPartial<LoginResponse>, I>>(base?: I): LoginResponse {
939
+ return LoginResponse.fromPartial(base ?? ({} as any));
940
+ },
941
+ fromPartial<I extends Exact<DeepPartial<LoginResponse>, I>>(object: I): LoginResponse {
942
+ const message = createBaseLoginResponse();
943
+ message.code = (object.code !== undefined && object.code !== null) ? AuthCode.fromPartial(object.code) : undefined;
944
+ message.verification = (object.verification !== undefined && object.verification !== null)
945
+ ? Verification.fromPartial(object.verification)
946
+ : undefined;
947
+ return message;
948
+ },
949
+ };
950
+
951
+ function createBaseCodeVerifier(): CodeVerifier {
952
+ return { $type: "auth.v1.CodeVerifier", code: "", verifier: "" };
953
+ }
954
+
955
+ export const CodeVerifier: MessageFns<CodeVerifier, "auth.v1.CodeVerifier"> = {
956
+ $type: "auth.v1.CodeVerifier" as const,
957
+
958
+ encode(message: CodeVerifier, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
959
+ if (message.code !== "") {
960
+ writer.uint32(10).string(message.code);
961
+ }
962
+ if (message.verifier !== "") {
963
+ writer.uint32(18).string(message.verifier);
964
+ }
965
+ return writer;
966
+ },
967
+
968
+ decode(input: BinaryReader | Uint8Array, length?: number): CodeVerifier {
969
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
970
+ const end = length === undefined ? reader.len : reader.pos + length;
971
+ const message = createBaseCodeVerifier();
972
+ while (reader.pos < end) {
973
+ const tag = reader.uint32();
974
+ switch (tag >>> 3) {
975
+ case 1: {
976
+ if (tag !== 10) {
977
+ break;
978
+ }
979
+
980
+ message.code = reader.string();
981
+ continue;
982
+ }
983
+ case 2: {
984
+ if (tag !== 18) {
985
+ break;
986
+ }
987
+
988
+ message.verifier = reader.string();
989
+ continue;
990
+ }
991
+ }
992
+ if ((tag & 7) === 4 || tag === 0) {
993
+ break;
994
+ }
995
+ reader.skip(tag & 7);
996
+ }
997
+ return message;
998
+ },
999
+
1000
+ fromJSON(object: any): CodeVerifier {
1001
+ return {
1002
+ $type: CodeVerifier.$type,
1003
+ code: isSet(object.code) ? globalThis.String(object.code) : "",
1004
+ verifier: isSet(object.verifier) ? globalThis.String(object.verifier) : "",
1005
+ };
1006
+ },
1007
+
1008
+ toJSON(message: CodeVerifier): unknown {
1009
+ const obj: any = {};
1010
+ if (message.code !== "") {
1011
+ obj.code = message.code;
1012
+ }
1013
+ if (message.verifier !== "") {
1014
+ obj.verifier = message.verifier;
1015
+ }
1016
+ return obj;
1017
+ },
1018
+
1019
+ create<I extends Exact<DeepPartial<CodeVerifier>, I>>(base?: I): CodeVerifier {
1020
+ return CodeVerifier.fromPartial(base ?? ({} as any));
1021
+ },
1022
+ fromPartial<I extends Exact<DeepPartial<CodeVerifier>, I>>(object: I): CodeVerifier {
1023
+ const message = createBaseCodeVerifier();
1024
+ message.code = object.code ?? "";
1025
+ message.verifier = object.verifier ?? "";
1026
+ return message;
1027
+ },
1028
+ };
1029
+
1030
+ function createBaseAuthorizeRequest(): AuthorizeRequest {
1031
+ return { $type: "auth.v1.AuthorizeRequest", serviceId: "", tokens: undefined, code: undefined, companyId: "" };
1032
+ }
1033
+
1034
+ export const AuthorizeRequest: MessageFns<AuthorizeRequest, "auth.v1.AuthorizeRequest"> = {
1035
+ $type: "auth.v1.AuthorizeRequest" as const,
1036
+
1037
+ encode(message: AuthorizeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1038
+ if (message.serviceId !== "") {
1039
+ writer.uint32(10).string(message.serviceId);
1040
+ }
1041
+ if (message.tokens !== undefined) {
1042
+ Tokens.encode(message.tokens, writer.uint32(18).fork()).join();
1043
+ }
1044
+ if (message.code !== undefined) {
1045
+ CodeVerifier.encode(message.code, writer.uint32(26).fork()).join();
1046
+ }
1047
+ if (message.companyId !== "") {
1048
+ writer.uint32(34).string(message.companyId);
1049
+ }
1050
+ return writer;
1051
+ },
1052
+
1053
+ decode(input: BinaryReader | Uint8Array, length?: number): AuthorizeRequest {
1054
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1055
+ const end = length === undefined ? reader.len : reader.pos + length;
1056
+ const message = createBaseAuthorizeRequest();
1057
+ while (reader.pos < end) {
1058
+ const tag = reader.uint32();
1059
+ switch (tag >>> 3) {
1060
+ case 1: {
1061
+ if (tag !== 10) {
1062
+ break;
1063
+ }
1064
+
1065
+ message.serviceId = reader.string();
1066
+ continue;
1067
+ }
1068
+ case 2: {
1069
+ if (tag !== 18) {
1070
+ break;
1071
+ }
1072
+
1073
+ message.tokens = Tokens.decode(reader, reader.uint32());
1074
+ continue;
1075
+ }
1076
+ case 3: {
1077
+ if (tag !== 26) {
1078
+ break;
1079
+ }
1080
+
1081
+ message.code = CodeVerifier.decode(reader, reader.uint32());
1082
+ continue;
1083
+ }
1084
+ case 4: {
1085
+ if (tag !== 34) {
1086
+ break;
1087
+ }
1088
+
1089
+ message.companyId = reader.string();
1090
+ continue;
1091
+ }
1092
+ }
1093
+ if ((tag & 7) === 4 || tag === 0) {
1094
+ break;
1095
+ }
1096
+ reader.skip(tag & 7);
1097
+ }
1098
+ return message;
1099
+ },
1100
+
1101
+ fromJSON(object: any): AuthorizeRequest {
1102
+ return {
1103
+ $type: AuthorizeRequest.$type,
1104
+ serviceId: isSet(object.serviceId)
1105
+ ? globalThis.String(object.serviceId)
1106
+ : isSet(object.service_id)
1107
+ ? globalThis.String(object.service_id)
1108
+ : "",
1109
+ tokens: isSet(object.tokens) ? Tokens.fromJSON(object.tokens) : undefined,
1110
+ code: isSet(object.code) ? CodeVerifier.fromJSON(object.code) : undefined,
1111
+ companyId: isSet(object.companyId)
1112
+ ? globalThis.String(object.companyId)
1113
+ : isSet(object.company_id)
1114
+ ? globalThis.String(object.company_id)
1115
+ : "",
1116
+ };
1117
+ },
1118
+
1119
+ toJSON(message: AuthorizeRequest): unknown {
1120
+ const obj: any = {};
1121
+ if (message.serviceId !== "") {
1122
+ obj.serviceId = message.serviceId;
1123
+ }
1124
+ if (message.tokens !== undefined) {
1125
+ obj.tokens = Tokens.toJSON(message.tokens);
1126
+ }
1127
+ if (message.code !== undefined) {
1128
+ obj.code = CodeVerifier.toJSON(message.code);
1129
+ }
1130
+ if (message.companyId !== "") {
1131
+ obj.companyId = message.companyId;
1132
+ }
1133
+ return obj;
1134
+ },
1135
+
1136
+ create<I extends Exact<DeepPartial<AuthorizeRequest>, I>>(base?: I): AuthorizeRequest {
1137
+ return AuthorizeRequest.fromPartial(base ?? ({} as any));
1138
+ },
1139
+ fromPartial<I extends Exact<DeepPartial<AuthorizeRequest>, I>>(object: I): AuthorizeRequest {
1140
+ const message = createBaseAuthorizeRequest();
1141
+ message.serviceId = object.serviceId ?? "";
1142
+ message.tokens = (object.tokens !== undefined && object.tokens !== null)
1143
+ ? Tokens.fromPartial(object.tokens)
1144
+ : undefined;
1145
+ message.code = (object.code !== undefined && object.code !== null)
1146
+ ? CodeVerifier.fromPartial(object.code)
1147
+ : undefined;
1148
+ message.companyId = object.companyId ?? "";
1149
+ return message;
1150
+ },
1151
+ };
1152
+
1153
+ function createBaseGetCompanyIdByCodeRequest(): GetCompanyIdByCodeRequest {
1154
+ return { $type: "auth.v1.GetCompanyIdByCodeRequest", code: "", serviceId: "" };
1155
+ }
1156
+
1157
+ export const GetCompanyIdByCodeRequest: MessageFns<GetCompanyIdByCodeRequest, "auth.v1.GetCompanyIdByCodeRequest"> = {
1158
+ $type: "auth.v1.GetCompanyIdByCodeRequest" as const,
1159
+
1160
+ encode(message: GetCompanyIdByCodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1161
+ if (message.code !== "") {
1162
+ writer.uint32(10).string(message.code);
1163
+ }
1164
+ if (message.serviceId !== "") {
1165
+ writer.uint32(18).string(message.serviceId);
1166
+ }
1167
+ return writer;
1168
+ },
1169
+
1170
+ decode(input: BinaryReader | Uint8Array, length?: number): GetCompanyIdByCodeRequest {
1171
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1172
+ const end = length === undefined ? reader.len : reader.pos + length;
1173
+ const message = createBaseGetCompanyIdByCodeRequest();
1174
+ while (reader.pos < end) {
1175
+ const tag = reader.uint32();
1176
+ switch (tag >>> 3) {
1177
+ case 1: {
1178
+ if (tag !== 10) {
1179
+ break;
1180
+ }
1181
+
1182
+ message.code = reader.string();
1183
+ continue;
1184
+ }
1185
+ case 2: {
1186
+ if (tag !== 18) {
1187
+ break;
1188
+ }
1189
+
1190
+ message.serviceId = reader.string();
1191
+ continue;
1192
+ }
1193
+ }
1194
+ if ((tag & 7) === 4 || tag === 0) {
1195
+ break;
1196
+ }
1197
+ reader.skip(tag & 7);
1198
+ }
1199
+ return message;
1200
+ },
1201
+
1202
+ fromJSON(object: any): GetCompanyIdByCodeRequest {
1203
+ return {
1204
+ $type: GetCompanyIdByCodeRequest.$type,
1205
+ code: isSet(object.code) ? globalThis.String(object.code) : "",
1206
+ serviceId: isSet(object.serviceId)
1207
+ ? globalThis.String(object.serviceId)
1208
+ : isSet(object.service_id)
1209
+ ? globalThis.String(object.service_id)
1210
+ : "",
1211
+ };
1212
+ },
1213
+
1214
+ toJSON(message: GetCompanyIdByCodeRequest): unknown {
1215
+ const obj: any = {};
1216
+ if (message.code !== "") {
1217
+ obj.code = message.code;
1218
+ }
1219
+ if (message.serviceId !== "") {
1220
+ obj.serviceId = message.serviceId;
1221
+ }
1222
+ return obj;
1223
+ },
1224
+
1225
+ create<I extends Exact<DeepPartial<GetCompanyIdByCodeRequest>, I>>(base?: I): GetCompanyIdByCodeRequest {
1226
+ return GetCompanyIdByCodeRequest.fromPartial(base ?? ({} as any));
1227
+ },
1228
+ fromPartial<I extends Exact<DeepPartial<GetCompanyIdByCodeRequest>, I>>(object: I): GetCompanyIdByCodeRequest {
1229
+ const message = createBaseGetCompanyIdByCodeRequest();
1230
+ message.code = object.code ?? "";
1231
+ message.serviceId = object.serviceId ?? "";
1232
+ return message;
1233
+ },
1234
+ };
1235
+
1236
+ function createBaseGetCompanyIdByCodeResponse(): GetCompanyIdByCodeResponse {
1237
+ return { $type: "auth.v1.GetCompanyIdByCodeResponse", userId: "", companyId: undefined };
1238
+ }
1239
+
1240
+ export const GetCompanyIdByCodeResponse: MessageFns<GetCompanyIdByCodeResponse, "auth.v1.GetCompanyIdByCodeResponse"> =
1241
+ {
1242
+ $type: "auth.v1.GetCompanyIdByCodeResponse" as const,
1243
+
1244
+ encode(message: GetCompanyIdByCodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1245
+ if (message.userId !== "") {
1246
+ writer.uint32(10).string(message.userId);
1247
+ }
1248
+ if (message.companyId !== undefined) {
1249
+ writer.uint32(18).string(message.companyId);
1250
+ }
1251
+ return writer;
1252
+ },
1253
+
1254
+ decode(input: BinaryReader | Uint8Array, length?: number): GetCompanyIdByCodeResponse {
1255
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1256
+ const end = length === undefined ? reader.len : reader.pos + length;
1257
+ const message = createBaseGetCompanyIdByCodeResponse();
1258
+ while (reader.pos < end) {
1259
+ const tag = reader.uint32();
1260
+ switch (tag >>> 3) {
1261
+ case 1: {
1262
+ if (tag !== 10) {
1263
+ break;
1264
+ }
1265
+
1266
+ message.userId = reader.string();
1267
+ continue;
1268
+ }
1269
+ case 2: {
1270
+ if (tag !== 18) {
1271
+ break;
1272
+ }
1273
+
1274
+ message.companyId = reader.string();
1275
+ continue;
1276
+ }
1277
+ }
1278
+ if ((tag & 7) === 4 || tag === 0) {
1279
+ break;
1280
+ }
1281
+ reader.skip(tag & 7);
1282
+ }
1283
+ return message;
1284
+ },
1285
+
1286
+ fromJSON(object: any): GetCompanyIdByCodeResponse {
1287
+ return {
1288
+ $type: GetCompanyIdByCodeResponse.$type,
1289
+ userId: isSet(object.userId)
1290
+ ? globalThis.String(object.userId)
1291
+ : isSet(object.user_id)
1292
+ ? globalThis.String(object.user_id)
1293
+ : "",
1294
+ companyId: isSet(object.companyId)
1295
+ ? globalThis.String(object.companyId)
1296
+ : isSet(object.company_id)
1297
+ ? globalThis.String(object.company_id)
1298
+ : undefined,
1299
+ };
1300
+ },
1301
+
1302
+ toJSON(message: GetCompanyIdByCodeResponse): unknown {
1303
+ const obj: any = {};
1304
+ if (message.userId !== "") {
1305
+ obj.userId = message.userId;
1306
+ }
1307
+ if (message.companyId !== undefined) {
1308
+ obj.companyId = message.companyId;
1309
+ }
1310
+ return obj;
1311
+ },
1312
+
1313
+ create<I extends Exact<DeepPartial<GetCompanyIdByCodeResponse>, I>>(base?: I): GetCompanyIdByCodeResponse {
1314
+ return GetCompanyIdByCodeResponse.fromPartial(base ?? ({} as any));
1315
+ },
1316
+ fromPartial<I extends Exact<DeepPartial<GetCompanyIdByCodeResponse>, I>>(object: I): GetCompanyIdByCodeResponse {
1317
+ const message = createBaseGetCompanyIdByCodeResponse();
1318
+ message.userId = object.userId ?? "";
1319
+ message.companyId = object.companyId ?? undefined;
1320
+ return message;
1321
+ },
1322
+ };
1323
+
1324
+ export type AuthServiceDefinition = typeof AuthServiceDefinition;
1325
+ export const AuthServiceDefinition = {
1326
+ name: "AuthService",
1327
+ fullName: "auth.v1.AuthService",
1328
+ methods: {
1329
+ registration: {
1330
+ name: "Registration",
1331
+ requestType: RegistrationRequest as typeof RegistrationRequest,
1332
+ requestStream: false,
1333
+ responseType: RegistrationResponse as typeof RegistrationResponse,
1334
+ responseStream: false,
1335
+ options: {},
1336
+ },
1337
+ registrationCompensate: {
1338
+ name: "RegistrationCompensate",
1339
+ requestType: RegistrationCompensateRequest as typeof RegistrationCompensateRequest,
1340
+ requestStream: false,
1341
+ responseType: StatusResponse as typeof StatusResponse,
1342
+ responseStream: false,
1343
+ options: {},
1344
+ },
1345
+ login: {
1346
+ name: "Login",
1347
+ requestType: LoginRequest as typeof LoginRequest,
1348
+ requestStream: false,
1349
+ responseType: LoginResponse as typeof LoginResponse,
1350
+ responseStream: false,
1351
+ options: {},
1352
+ },
1353
+ authorize: {
1354
+ name: "Authorize",
1355
+ requestType: AuthorizeRequest as typeof AuthorizeRequest,
1356
+ requestStream: false,
1357
+ responseType: Tokens as typeof Tokens,
1358
+ responseStream: false,
1359
+ options: {},
1360
+ },
1361
+ logout: {
1362
+ name: "Logout",
1363
+ requestType: Tokens as typeof Tokens,
1364
+ requestStream: false,
1365
+ responseType: StatusResponse as typeof StatusResponse,
1366
+ responseStream: false,
1367
+ options: {},
1368
+ },
1369
+ getMe: {
1370
+ name: "GetMe",
1371
+ requestType: GetMeRequest as typeof GetMeRequest,
1372
+ requestStream: false,
1373
+ responseType: GetMeResponse as typeof GetMeResponse,
1374
+ responseStream: false,
1375
+ options: {},
1376
+ },
1377
+ getCompanyIdByCode: {
1378
+ name: "GetCompanyIdByCode",
1379
+ requestType: GetCompanyIdByCodeRequest as typeof GetCompanyIdByCodeRequest,
1380
+ requestStream: false,
1381
+ responseType: GetCompanyIdByCodeResponse as typeof GetCompanyIdByCodeResponse,
1382
+ responseStream: false,
1383
+ options: {},
1384
+ },
1385
+ },
1386
+ } as const;
1387
+
1388
+ export interface AuthServiceImplementation<CallContextExt = {}> {
1389
+ registration(
1390
+ request: RegistrationRequest,
1391
+ context: CallContext & CallContextExt,
1392
+ ): Promise<DeepPartial<RegistrationResponse>>;
1393
+ registrationCompensate(
1394
+ request: RegistrationCompensateRequest,
1395
+ context: CallContext & CallContextExt,
1396
+ ): Promise<DeepPartial<StatusResponse>>;
1397
+ login(request: LoginRequest, context: CallContext & CallContextExt): Promise<DeepPartial<LoginResponse>>;
1398
+ authorize(request: AuthorizeRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Tokens>>;
1399
+ logout(request: Tokens, context: CallContext & CallContextExt): Promise<DeepPartial<StatusResponse>>;
1400
+ getMe(request: GetMeRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetMeResponse>>;
1401
+ getCompanyIdByCode(
1402
+ request: GetCompanyIdByCodeRequest,
1403
+ context: CallContext & CallContextExt,
1404
+ ): Promise<DeepPartial<GetCompanyIdByCodeResponse>>;
1405
+ }
1406
+
1407
+ export interface AuthServiceClient<CallOptionsExt = {}> {
1408
+ registration(
1409
+ request: DeepPartial<RegistrationRequest>,
1410
+ options?: CallOptions & CallOptionsExt,
1411
+ ): Promise<RegistrationResponse>;
1412
+ registrationCompensate(
1413
+ request: DeepPartial<RegistrationCompensateRequest>,
1414
+ options?: CallOptions & CallOptionsExt,
1415
+ ): Promise<StatusResponse>;
1416
+ login(request: DeepPartial<LoginRequest>, options?: CallOptions & CallOptionsExt): Promise<LoginResponse>;
1417
+ authorize(request: DeepPartial<AuthorizeRequest>, options?: CallOptions & CallOptionsExt): Promise<Tokens>;
1418
+ logout(request: DeepPartial<Tokens>, options?: CallOptions & CallOptionsExt): Promise<StatusResponse>;
1419
+ getMe(request: DeepPartial<GetMeRequest>, options?: CallOptions & CallOptionsExt): Promise<GetMeResponse>;
1420
+ getCompanyIdByCode(
1421
+ request: DeepPartial<GetCompanyIdByCodeRequest>,
1422
+ options?: CallOptions & CallOptionsExt,
1423
+ ): Promise<GetCompanyIdByCodeResponse>;
1424
+ }
1425
+
1426
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
1427
+
1428
+ type DeepPartial<T> = T extends Builtin ? T
1429
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
1430
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
1431
+ : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] }
1432
+ : T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
1433
+ : Partial<T>;
1434
+
1435
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
1436
+ type Exact<P, I extends P> = P extends Builtin ? P
1437
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P> | "$type">]: never };
1438
+
1439
+ function longToNumber(int64: { toString(): string }): number {
1440
+ const num = globalThis.Number(int64.toString());
1441
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
1442
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
1443
+ }
1444
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
1445
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
1446
+ }
1447
+ return num;
1448
+ }
1449
+
1450
+ function isSet(value: any): boolean {
1451
+ return value !== null && value !== undefined;
1452
+ }
1453
+
1454
+ interface MessageFns<T, V extends string> {
1455
+ readonly $type: V;
1456
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
1457
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
1458
+ fromJSON(object: any): T;
1459
+ toJSON(message: T): unknown;
1460
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
1461
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
1462
+ }