@ssoeasy-dev/proto 1.1.0-dev-feat-auth.1 → 1.1.0-dev-feat-auth.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/gen/ts/auth/v1/auth.ts
CHANGED
|
@@ -69,8 +69,8 @@ export interface CodeVerifier {
|
|
|
69
69
|
verifier: string;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export interface
|
|
73
|
-
$type: "auth.v1.
|
|
72
|
+
export interface AuthorizeRequest {
|
|
73
|
+
$type: "auth.v1.AuthorizeRequest";
|
|
74
74
|
serviceId: string;
|
|
75
75
|
tokens?: Tokens | undefined;
|
|
76
76
|
code?: CodeVerifier | undefined;
|
|
@@ -859,14 +859,14 @@ export const CodeVerifier: MessageFns<CodeVerifier, "auth.v1.CodeVerifier"> = {
|
|
|
859
859
|
},
|
|
860
860
|
};
|
|
861
861
|
|
|
862
|
-
function
|
|
863
|
-
return { $type: "auth.v1.
|
|
862
|
+
function createBaseAuthorizeRequest(): AuthorizeRequest {
|
|
863
|
+
return { $type: "auth.v1.AuthorizeRequest", serviceId: "", tokens: undefined, code: undefined };
|
|
864
864
|
}
|
|
865
865
|
|
|
866
|
-
export const
|
|
867
|
-
$type: "auth.v1.
|
|
866
|
+
export const AuthorizeRequest: MessageFns<AuthorizeRequest, "auth.v1.AuthorizeRequest"> = {
|
|
867
|
+
$type: "auth.v1.AuthorizeRequest" as const,
|
|
868
868
|
|
|
869
|
-
encode(message:
|
|
869
|
+
encode(message: AuthorizeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
870
870
|
if (message.serviceId !== "") {
|
|
871
871
|
writer.uint32(10).string(message.serviceId);
|
|
872
872
|
}
|
|
@@ -879,10 +879,10 @@ export const AuthtorizeRequest: MessageFns<AuthtorizeRequest, "auth.v1.Authtoriz
|
|
|
879
879
|
return writer;
|
|
880
880
|
},
|
|
881
881
|
|
|
882
|
-
decode(input: BinaryReader | Uint8Array, length?: number):
|
|
882
|
+
decode(input: BinaryReader | Uint8Array, length?: number): AuthorizeRequest {
|
|
883
883
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
884
884
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
885
|
-
const message =
|
|
885
|
+
const message = createBaseAuthorizeRequest();
|
|
886
886
|
while (reader.pos < end) {
|
|
887
887
|
const tag = reader.uint32();
|
|
888
888
|
switch (tag >>> 3) {
|
|
@@ -919,9 +919,9 @@ export const AuthtorizeRequest: MessageFns<AuthtorizeRequest, "auth.v1.Authtoriz
|
|
|
919
919
|
return message;
|
|
920
920
|
},
|
|
921
921
|
|
|
922
|
-
fromJSON(object: any):
|
|
922
|
+
fromJSON(object: any): AuthorizeRequest {
|
|
923
923
|
return {
|
|
924
|
-
$type:
|
|
924
|
+
$type: AuthorizeRequest.$type,
|
|
925
925
|
serviceId: isSet(object.serviceId)
|
|
926
926
|
? globalThis.String(object.serviceId)
|
|
927
927
|
: isSet(object.service_id)
|
|
@@ -932,7 +932,7 @@ export const AuthtorizeRequest: MessageFns<AuthtorizeRequest, "auth.v1.Authtoriz
|
|
|
932
932
|
};
|
|
933
933
|
},
|
|
934
934
|
|
|
935
|
-
toJSON(message:
|
|
935
|
+
toJSON(message: AuthorizeRequest): unknown {
|
|
936
936
|
const obj: any = {};
|
|
937
937
|
if (message.serviceId !== "") {
|
|
938
938
|
obj.serviceId = message.serviceId;
|
|
@@ -946,11 +946,11 @@ export const AuthtorizeRequest: MessageFns<AuthtorizeRequest, "auth.v1.Authtoriz
|
|
|
946
946
|
return obj;
|
|
947
947
|
},
|
|
948
948
|
|
|
949
|
-
create<I extends Exact<DeepPartial<
|
|
950
|
-
return
|
|
949
|
+
create<I extends Exact<DeepPartial<AuthorizeRequest>, I>>(base?: I): AuthorizeRequest {
|
|
950
|
+
return AuthorizeRequest.fromPartial(base ?? ({} as any));
|
|
951
951
|
},
|
|
952
|
-
fromPartial<I extends Exact<DeepPartial<
|
|
953
|
-
const message =
|
|
952
|
+
fromPartial<I extends Exact<DeepPartial<AuthorizeRequest>, I>>(object: I): AuthorizeRequest {
|
|
953
|
+
const message = createBaseAuthorizeRequest();
|
|
954
954
|
message.serviceId = object.serviceId ?? "";
|
|
955
955
|
message.tokens = (object.tokens !== undefined && object.tokens !== null)
|
|
956
956
|
? Tokens.fromPartial(object.tokens)
|
|
@@ -991,9 +991,9 @@ export const AuthServiceDefinition = {
|
|
|
991
991
|
responseStream: false,
|
|
992
992
|
options: {},
|
|
993
993
|
},
|
|
994
|
-
|
|
995
|
-
name: "
|
|
996
|
-
requestType:
|
|
994
|
+
authorize: {
|
|
995
|
+
name: "Authorize",
|
|
996
|
+
requestType: AuthorizeRequest,
|
|
997
997
|
requestStream: false,
|
|
998
998
|
responseType: Tokens,
|
|
999
999
|
responseStream: false,
|
|
@@ -1020,7 +1020,7 @@ export interface AuthServiceImplementation<CallContextExt = {}> {
|
|
|
1020
1020
|
context: CallContext & CallContextExt,
|
|
1021
1021
|
): Promise<DeepPartial<StatusResponse>>;
|
|
1022
1022
|
login(request: LoginRequest, context: CallContext & CallContextExt): Promise<DeepPartial<LoginResponse>>;
|
|
1023
|
-
|
|
1023
|
+
authorize(request: AuthorizeRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Tokens>>;
|
|
1024
1024
|
logout(request: Tokens, context: CallContext & CallContextExt): Promise<DeepPartial<StatusResponse>>;
|
|
1025
1025
|
}
|
|
1026
1026
|
|
|
@@ -1034,7 +1034,7 @@ export interface AuthServiceClient<CallOptionsExt = {}> {
|
|
|
1034
1034
|
options?: CallOptions & CallOptionsExt,
|
|
1035
1035
|
): Promise<StatusResponse>;
|
|
1036
1036
|
login(request: DeepPartial<LoginRequest>, options?: CallOptions & CallOptionsExt): Promise<LoginResponse>;
|
|
1037
|
-
|
|
1037
|
+
authorize(request: DeepPartial<AuthorizeRequest>, options?: CallOptions & CallOptionsExt): Promise<Tokens>;
|
|
1038
1038
|
logout(request: DeepPartial<Tokens>, options?: CallOptions & CallOptionsExt): Promise<StatusResponse>;
|
|
1039
1039
|
}
|
|
1040
1040
|
|
|
@@ -8,23 +8,23 @@
|
|
|
8
8
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
9
|
|
|
10
10
|
export enum AttributeType {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
ATTRIBUTE_TYPE_BOOLEAN = "ATTRIBUTE_TYPE_BOOLEAN",
|
|
12
|
+
ATTRIBUTE_TYPE_STRING = "ATTRIBUTE_TYPE_STRING",
|
|
13
|
+
ATTRIBUTE_TYPE_NUMBER = "ATTRIBUTE_TYPE_NUMBER",
|
|
14
14
|
UNRECOGNIZED = "UNRECOGNIZED",
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function attributeTypeFromJSON(object: any): AttributeType {
|
|
18
18
|
switch (object) {
|
|
19
19
|
case 0:
|
|
20
|
-
case "
|
|
21
|
-
return AttributeType.
|
|
20
|
+
case "ATTRIBUTE_TYPE_BOOLEAN":
|
|
21
|
+
return AttributeType.ATTRIBUTE_TYPE_BOOLEAN;
|
|
22
22
|
case 1:
|
|
23
|
-
case "
|
|
24
|
-
return AttributeType.
|
|
23
|
+
case "ATTRIBUTE_TYPE_STRING":
|
|
24
|
+
return AttributeType.ATTRIBUTE_TYPE_STRING;
|
|
25
25
|
case 2:
|
|
26
|
-
case "
|
|
27
|
-
return AttributeType.
|
|
26
|
+
case "ATTRIBUTE_TYPE_NUMBER":
|
|
27
|
+
return AttributeType.ATTRIBUTE_TYPE_NUMBER;
|
|
28
28
|
case -1:
|
|
29
29
|
case "UNRECOGNIZED":
|
|
30
30
|
default:
|
|
@@ -34,12 +34,12 @@ export function attributeTypeFromJSON(object: any): AttributeType {
|
|
|
34
34
|
|
|
35
35
|
export function attributeTypeToJSON(object: AttributeType): string {
|
|
36
36
|
switch (object) {
|
|
37
|
-
case AttributeType.
|
|
38
|
-
return "
|
|
39
|
-
case AttributeType.
|
|
40
|
-
return "
|
|
41
|
-
case AttributeType.
|
|
42
|
-
return "
|
|
37
|
+
case AttributeType.ATTRIBUTE_TYPE_BOOLEAN:
|
|
38
|
+
return "ATTRIBUTE_TYPE_BOOLEAN";
|
|
39
|
+
case AttributeType.ATTRIBUTE_TYPE_STRING:
|
|
40
|
+
return "ATTRIBUTE_TYPE_STRING";
|
|
41
|
+
case AttributeType.ATTRIBUTE_TYPE_NUMBER:
|
|
42
|
+
return "ATTRIBUTE_TYPE_NUMBER";
|
|
43
43
|
case AttributeType.UNRECOGNIZED:
|
|
44
44
|
default:
|
|
45
45
|
return "UNRECOGNIZED";
|
|
@@ -48,11 +48,11 @@ export function attributeTypeToJSON(object: AttributeType): string {
|
|
|
48
48
|
|
|
49
49
|
export function attributeTypeToNumber(object: AttributeType): number {
|
|
50
50
|
switch (object) {
|
|
51
|
-
case AttributeType.
|
|
51
|
+
case AttributeType.ATTRIBUTE_TYPE_BOOLEAN:
|
|
52
52
|
return 0;
|
|
53
|
-
case AttributeType.
|
|
53
|
+
case AttributeType.ATTRIBUTE_TYPE_STRING:
|
|
54
54
|
return 1;
|
|
55
|
-
case AttributeType.
|
|
55
|
+
case AttributeType.ATTRIBUTE_TYPE_NUMBER:
|
|
56
56
|
return 2;
|
|
57
57
|
case AttributeType.UNRECOGNIZED:
|
|
58
58
|
default:
|
|
@@ -10,19 +10,19 @@ import type { CallContext, CallOptions } from "nice-grpc-common";
|
|
|
10
10
|
import { StatusResponse } from "./common";
|
|
11
11
|
|
|
12
12
|
export enum VerificationType {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
VERIFICATION_TYPE_EMMAIL_CODE = "VERIFICATION_TYPE_EMMAIL_CODE",
|
|
14
|
+
VERIFICATION_TYPE_EMAIL_LINK = "VERIFICATION_TYPE_EMAIL_LINK",
|
|
15
15
|
UNRECOGNIZED = "UNRECOGNIZED",
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function verificationTypeFromJSON(object: any): VerificationType {
|
|
19
19
|
switch (object) {
|
|
20
20
|
case 0:
|
|
21
|
-
case "
|
|
22
|
-
return VerificationType.
|
|
21
|
+
case "VERIFICATION_TYPE_EMMAIL_CODE":
|
|
22
|
+
return VerificationType.VERIFICATION_TYPE_EMMAIL_CODE;
|
|
23
23
|
case 1:
|
|
24
|
-
case "
|
|
25
|
-
return VerificationType.
|
|
24
|
+
case "VERIFICATION_TYPE_EMAIL_LINK":
|
|
25
|
+
return VerificationType.VERIFICATION_TYPE_EMAIL_LINK;
|
|
26
26
|
case -1:
|
|
27
27
|
case "UNRECOGNIZED":
|
|
28
28
|
default:
|
|
@@ -32,10 +32,10 @@ export function verificationTypeFromJSON(object: any): VerificationType {
|
|
|
32
32
|
|
|
33
33
|
export function verificationTypeToJSON(object: VerificationType): string {
|
|
34
34
|
switch (object) {
|
|
35
|
-
case VerificationType.
|
|
36
|
-
return "
|
|
37
|
-
case VerificationType.
|
|
38
|
-
return "
|
|
35
|
+
case VerificationType.VERIFICATION_TYPE_EMMAIL_CODE:
|
|
36
|
+
return "VERIFICATION_TYPE_EMMAIL_CODE";
|
|
37
|
+
case VerificationType.VERIFICATION_TYPE_EMAIL_LINK:
|
|
38
|
+
return "VERIFICATION_TYPE_EMAIL_LINK";
|
|
39
39
|
case VerificationType.UNRECOGNIZED:
|
|
40
40
|
default:
|
|
41
41
|
return "UNRECOGNIZED";
|
|
@@ -44,9 +44,9 @@ export function verificationTypeToJSON(object: VerificationType): string {
|
|
|
44
44
|
|
|
45
45
|
export function verificationTypeToNumber(object: VerificationType): number {
|
|
46
46
|
switch (object) {
|
|
47
|
-
case VerificationType.
|
|
47
|
+
case VerificationType.VERIFICATION_TYPE_EMMAIL_CODE:
|
|
48
48
|
return 0;
|
|
49
|
-
case VerificationType.
|
|
49
|
+
case VerificationType.VERIFICATION_TYPE_EMAIL_LINK:
|
|
50
50
|
return 1;
|
|
51
51
|
case VerificationType.UNRECOGNIZED:
|
|
52
52
|
default:
|
|
@@ -54,6 +54,59 @@ export function verificationTypeToNumber(object: VerificationType): number {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
export enum VerificationStatus {
|
|
58
|
+
VERIFICATION_STATUS_WAIT = "VERIFICATION_STATUS_WAIT",
|
|
59
|
+
VERIFICATION_STATUS_EXPIRES = "VERIFICATION_STATUS_EXPIRES",
|
|
60
|
+
VERIFICATION_STATUS_VERIFIED = "VERIFICATION_STATUS_VERIFIED",
|
|
61
|
+
UNRECOGNIZED = "UNRECOGNIZED",
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function verificationStatusFromJSON(object: any): VerificationStatus {
|
|
65
|
+
switch (object) {
|
|
66
|
+
case 0:
|
|
67
|
+
case "VERIFICATION_STATUS_WAIT":
|
|
68
|
+
return VerificationStatus.VERIFICATION_STATUS_WAIT;
|
|
69
|
+
case 1:
|
|
70
|
+
case "VERIFICATION_STATUS_EXPIRES":
|
|
71
|
+
return VerificationStatus.VERIFICATION_STATUS_EXPIRES;
|
|
72
|
+
case 2:
|
|
73
|
+
case "VERIFICATION_STATUS_VERIFIED":
|
|
74
|
+
return VerificationStatus.VERIFICATION_STATUS_VERIFIED;
|
|
75
|
+
case -1:
|
|
76
|
+
case "UNRECOGNIZED":
|
|
77
|
+
default:
|
|
78
|
+
return VerificationStatus.UNRECOGNIZED;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function verificationStatusToJSON(object: VerificationStatus): string {
|
|
83
|
+
switch (object) {
|
|
84
|
+
case VerificationStatus.VERIFICATION_STATUS_WAIT:
|
|
85
|
+
return "VERIFICATION_STATUS_WAIT";
|
|
86
|
+
case VerificationStatus.VERIFICATION_STATUS_EXPIRES:
|
|
87
|
+
return "VERIFICATION_STATUS_EXPIRES";
|
|
88
|
+
case VerificationStatus.VERIFICATION_STATUS_VERIFIED:
|
|
89
|
+
return "VERIFICATION_STATUS_VERIFIED";
|
|
90
|
+
case VerificationStatus.UNRECOGNIZED:
|
|
91
|
+
default:
|
|
92
|
+
return "UNRECOGNIZED";
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function verificationStatusToNumber(object: VerificationStatus): number {
|
|
97
|
+
switch (object) {
|
|
98
|
+
case VerificationStatus.VERIFICATION_STATUS_WAIT:
|
|
99
|
+
return 0;
|
|
100
|
+
case VerificationStatus.VERIFICATION_STATUS_EXPIRES:
|
|
101
|
+
return 1;
|
|
102
|
+
case VerificationStatus.VERIFICATION_STATUS_VERIFIED:
|
|
103
|
+
return 2;
|
|
104
|
+
case VerificationStatus.UNRECOGNIZED:
|
|
105
|
+
default:
|
|
106
|
+
return -1;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
57
110
|
export interface Verification {
|
|
58
111
|
$type: "auth.v1.Verification";
|
|
59
112
|
id: string;
|
|
@@ -65,7 +118,6 @@ export interface VerificateRequest {
|
|
|
65
118
|
$type: "auth.v1.VerificateRequest";
|
|
66
119
|
id: string;
|
|
67
120
|
value: string;
|
|
68
|
-
code: string;
|
|
69
121
|
}
|
|
70
122
|
|
|
71
123
|
export interface RefreshRequest {
|
|
@@ -74,6 +126,16 @@ export interface RefreshRequest {
|
|
|
74
126
|
type: VerificationType;
|
|
75
127
|
}
|
|
76
128
|
|
|
129
|
+
export interface CheckStatusRequest {
|
|
130
|
+
$type: "auth.v1.CheckStatusRequest";
|
|
131
|
+
id: string;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface CheckStatusResponse {
|
|
135
|
+
$type: "auth.v1.CheckStatusResponse";
|
|
136
|
+
status: VerificationStatus;
|
|
137
|
+
}
|
|
138
|
+
|
|
77
139
|
function createBaseVerification(): Verification {
|
|
78
140
|
return { $type: "auth.v1.Verification", id: "", value: "", expiresAt: 0 };
|
|
79
141
|
}
|
|
@@ -174,7 +236,7 @@ export const Verification: MessageFns<Verification, "auth.v1.Verification"> = {
|
|
|
174
236
|
};
|
|
175
237
|
|
|
176
238
|
function createBaseVerificateRequest(): VerificateRequest {
|
|
177
|
-
return { $type: "auth.v1.VerificateRequest", id: "", value: ""
|
|
239
|
+
return { $type: "auth.v1.VerificateRequest", id: "", value: "" };
|
|
178
240
|
}
|
|
179
241
|
|
|
180
242
|
export const VerificateRequest: MessageFns<VerificateRequest, "auth.v1.VerificateRequest"> = {
|
|
@@ -187,9 +249,6 @@ export const VerificateRequest: MessageFns<VerificateRequest, "auth.v1.Verificat
|
|
|
187
249
|
if (message.value !== "") {
|
|
188
250
|
writer.uint32(18).string(message.value);
|
|
189
251
|
}
|
|
190
|
-
if (message.code !== "") {
|
|
191
|
-
writer.uint32(26).string(message.code);
|
|
192
|
-
}
|
|
193
252
|
return writer;
|
|
194
253
|
},
|
|
195
254
|
|
|
@@ -216,14 +275,6 @@ export const VerificateRequest: MessageFns<VerificateRequest, "auth.v1.Verificat
|
|
|
216
275
|
message.value = reader.string();
|
|
217
276
|
continue;
|
|
218
277
|
}
|
|
219
|
-
case 3: {
|
|
220
|
-
if (tag !== 26) {
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
message.code = reader.string();
|
|
225
|
-
continue;
|
|
226
|
-
}
|
|
227
278
|
}
|
|
228
279
|
if ((tag & 7) === 4 || tag === 0) {
|
|
229
280
|
break;
|
|
@@ -238,7 +289,6 @@ export const VerificateRequest: MessageFns<VerificateRequest, "auth.v1.Verificat
|
|
|
238
289
|
$type: VerificateRequest.$type,
|
|
239
290
|
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
|
240
291
|
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
241
|
-
code: isSet(object.code) ? globalThis.String(object.code) : "",
|
|
242
292
|
};
|
|
243
293
|
},
|
|
244
294
|
|
|
@@ -250,9 +300,6 @@ export const VerificateRequest: MessageFns<VerificateRequest, "auth.v1.Verificat
|
|
|
250
300
|
if (message.value !== "") {
|
|
251
301
|
obj.value = message.value;
|
|
252
302
|
}
|
|
253
|
-
if (message.code !== "") {
|
|
254
|
-
obj.code = message.code;
|
|
255
|
-
}
|
|
256
303
|
return obj;
|
|
257
304
|
},
|
|
258
305
|
|
|
@@ -263,13 +310,12 @@ export const VerificateRequest: MessageFns<VerificateRequest, "auth.v1.Verificat
|
|
|
263
310
|
const message = createBaseVerificateRequest();
|
|
264
311
|
message.id = object.id ?? "";
|
|
265
312
|
message.value = object.value ?? "";
|
|
266
|
-
message.code = object.code ?? "";
|
|
267
313
|
return message;
|
|
268
314
|
},
|
|
269
315
|
};
|
|
270
316
|
|
|
271
317
|
function createBaseRefreshRequest(): RefreshRequest {
|
|
272
|
-
return { $type: "auth.v1.RefreshRequest", userId: "", type: VerificationType.
|
|
318
|
+
return { $type: "auth.v1.RefreshRequest", userId: "", type: VerificationType.VERIFICATION_TYPE_EMMAIL_CODE };
|
|
273
319
|
}
|
|
274
320
|
|
|
275
321
|
export const RefreshRequest: MessageFns<RefreshRequest, "auth.v1.RefreshRequest"> = {
|
|
@@ -279,7 +325,7 @@ export const RefreshRequest: MessageFns<RefreshRequest, "auth.v1.RefreshRequest"
|
|
|
279
325
|
if (message.userId !== "") {
|
|
280
326
|
writer.uint32(10).string(message.userId);
|
|
281
327
|
}
|
|
282
|
-
if (message.type !== VerificationType.
|
|
328
|
+
if (message.type !== VerificationType.VERIFICATION_TYPE_EMMAIL_CODE) {
|
|
283
329
|
writer.uint32(16).int32(verificationTypeToNumber(message.type));
|
|
284
330
|
}
|
|
285
331
|
return writer;
|
|
@@ -325,7 +371,7 @@ export const RefreshRequest: MessageFns<RefreshRequest, "auth.v1.RefreshRequest"
|
|
|
325
371
|
: isSet(object.user_id)
|
|
326
372
|
? globalThis.String(object.user_id)
|
|
327
373
|
: "",
|
|
328
|
-
type: isSet(object.type) ? verificationTypeFromJSON(object.type) : VerificationType.
|
|
374
|
+
type: isSet(object.type) ? verificationTypeFromJSON(object.type) : VerificationType.VERIFICATION_TYPE_EMMAIL_CODE,
|
|
329
375
|
};
|
|
330
376
|
},
|
|
331
377
|
|
|
@@ -334,7 +380,7 @@ export const RefreshRequest: MessageFns<RefreshRequest, "auth.v1.RefreshRequest"
|
|
|
334
380
|
if (message.userId !== "") {
|
|
335
381
|
obj.userId = message.userId;
|
|
336
382
|
}
|
|
337
|
-
if (message.type !== VerificationType.
|
|
383
|
+
if (message.type !== VerificationType.VERIFICATION_TYPE_EMMAIL_CODE) {
|
|
338
384
|
obj.type = verificationTypeToJSON(message.type);
|
|
339
385
|
}
|
|
340
386
|
return obj;
|
|
@@ -346,7 +392,132 @@ export const RefreshRequest: MessageFns<RefreshRequest, "auth.v1.RefreshRequest"
|
|
|
346
392
|
fromPartial<I extends Exact<DeepPartial<RefreshRequest>, I>>(object: I): RefreshRequest {
|
|
347
393
|
const message = createBaseRefreshRequest();
|
|
348
394
|
message.userId = object.userId ?? "";
|
|
349
|
-
message.type = object.type ?? VerificationType.
|
|
395
|
+
message.type = object.type ?? VerificationType.VERIFICATION_TYPE_EMMAIL_CODE;
|
|
396
|
+
return message;
|
|
397
|
+
},
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
function createBaseCheckStatusRequest(): CheckStatusRequest {
|
|
401
|
+
return { $type: "auth.v1.CheckStatusRequest", id: "" };
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export const CheckStatusRequest: MessageFns<CheckStatusRequest, "auth.v1.CheckStatusRequest"> = {
|
|
405
|
+
$type: "auth.v1.CheckStatusRequest" as const,
|
|
406
|
+
|
|
407
|
+
encode(message: CheckStatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
408
|
+
if (message.id !== "") {
|
|
409
|
+
writer.uint32(10).string(message.id);
|
|
410
|
+
}
|
|
411
|
+
return writer;
|
|
412
|
+
},
|
|
413
|
+
|
|
414
|
+
decode(input: BinaryReader | Uint8Array, length?: number): CheckStatusRequest {
|
|
415
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
416
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
417
|
+
const message = createBaseCheckStatusRequest();
|
|
418
|
+
while (reader.pos < end) {
|
|
419
|
+
const tag = reader.uint32();
|
|
420
|
+
switch (tag >>> 3) {
|
|
421
|
+
case 1: {
|
|
422
|
+
if (tag !== 10) {
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
message.id = reader.string();
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
reader.skip(tag & 7);
|
|
434
|
+
}
|
|
435
|
+
return message;
|
|
436
|
+
},
|
|
437
|
+
|
|
438
|
+
fromJSON(object: any): CheckStatusRequest {
|
|
439
|
+
return { $type: CheckStatusRequest.$type, id: isSet(object.id) ? globalThis.String(object.id) : "" };
|
|
440
|
+
},
|
|
441
|
+
|
|
442
|
+
toJSON(message: CheckStatusRequest): unknown {
|
|
443
|
+
const obj: any = {};
|
|
444
|
+
if (message.id !== "") {
|
|
445
|
+
obj.id = message.id;
|
|
446
|
+
}
|
|
447
|
+
return obj;
|
|
448
|
+
},
|
|
449
|
+
|
|
450
|
+
create<I extends Exact<DeepPartial<CheckStatusRequest>, I>>(base?: I): CheckStatusRequest {
|
|
451
|
+
return CheckStatusRequest.fromPartial(base ?? ({} as any));
|
|
452
|
+
},
|
|
453
|
+
fromPartial<I extends Exact<DeepPartial<CheckStatusRequest>, I>>(object: I): CheckStatusRequest {
|
|
454
|
+
const message = createBaseCheckStatusRequest();
|
|
455
|
+
message.id = object.id ?? "";
|
|
456
|
+
return message;
|
|
457
|
+
},
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
function createBaseCheckStatusResponse(): CheckStatusResponse {
|
|
461
|
+
return { $type: "auth.v1.CheckStatusResponse", status: VerificationStatus.VERIFICATION_STATUS_WAIT };
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export const CheckStatusResponse: MessageFns<CheckStatusResponse, "auth.v1.CheckStatusResponse"> = {
|
|
465
|
+
$type: "auth.v1.CheckStatusResponse" as const,
|
|
466
|
+
|
|
467
|
+
encode(message: CheckStatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
468
|
+
if (message.status !== VerificationStatus.VERIFICATION_STATUS_WAIT) {
|
|
469
|
+
writer.uint32(8).int32(verificationStatusToNumber(message.status));
|
|
470
|
+
}
|
|
471
|
+
return writer;
|
|
472
|
+
},
|
|
473
|
+
|
|
474
|
+
decode(input: BinaryReader | Uint8Array, length?: number): CheckStatusResponse {
|
|
475
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
476
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
477
|
+
const message = createBaseCheckStatusResponse();
|
|
478
|
+
while (reader.pos < end) {
|
|
479
|
+
const tag = reader.uint32();
|
|
480
|
+
switch (tag >>> 3) {
|
|
481
|
+
case 1: {
|
|
482
|
+
if (tag !== 8) {
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
message.status = verificationStatusFromJSON(reader.int32());
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
493
|
+
reader.skip(tag & 7);
|
|
494
|
+
}
|
|
495
|
+
return message;
|
|
496
|
+
},
|
|
497
|
+
|
|
498
|
+
fromJSON(object: any): CheckStatusResponse {
|
|
499
|
+
return {
|
|
500
|
+
$type: CheckStatusResponse.$type,
|
|
501
|
+
status: isSet(object.status)
|
|
502
|
+
? verificationStatusFromJSON(object.status)
|
|
503
|
+
: VerificationStatus.VERIFICATION_STATUS_WAIT,
|
|
504
|
+
};
|
|
505
|
+
},
|
|
506
|
+
|
|
507
|
+
toJSON(message: CheckStatusResponse): unknown {
|
|
508
|
+
const obj: any = {};
|
|
509
|
+
if (message.status !== VerificationStatus.VERIFICATION_STATUS_WAIT) {
|
|
510
|
+
obj.status = verificationStatusToJSON(message.status);
|
|
511
|
+
}
|
|
512
|
+
return obj;
|
|
513
|
+
},
|
|
514
|
+
|
|
515
|
+
create<I extends Exact<DeepPartial<CheckStatusResponse>, I>>(base?: I): CheckStatusResponse {
|
|
516
|
+
return CheckStatusResponse.fromPartial(base ?? ({} as any));
|
|
517
|
+
},
|
|
518
|
+
fromPartial<I extends Exact<DeepPartial<CheckStatusResponse>, I>>(object: I): CheckStatusResponse {
|
|
519
|
+
const message = createBaseCheckStatusResponse();
|
|
520
|
+
message.status = object.status ?? VerificationStatus.VERIFICATION_STATUS_WAIT;
|
|
350
521
|
return message;
|
|
351
522
|
},
|
|
352
523
|
};
|
|
@@ -372,17 +543,33 @@ export const VerificationServiceDefinition = {
|
|
|
372
543
|
responseStream: false,
|
|
373
544
|
options: {},
|
|
374
545
|
},
|
|
546
|
+
checkStatus: {
|
|
547
|
+
name: "CheckStatus",
|
|
548
|
+
requestType: CheckStatusRequest,
|
|
549
|
+
requestStream: false,
|
|
550
|
+
responseType: CheckStatusResponse,
|
|
551
|
+
responseStream: false,
|
|
552
|
+
options: {},
|
|
553
|
+
},
|
|
375
554
|
},
|
|
376
555
|
} as const;
|
|
377
556
|
|
|
378
557
|
export interface VerificationServiceImplementation<CallContextExt = {}> {
|
|
379
558
|
verificate(request: VerificateRequest, context: CallContext & CallContextExt): Promise<DeepPartial<StatusResponse>>;
|
|
380
559
|
refresh(request: RefreshRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Verification>>;
|
|
560
|
+
checkStatus(
|
|
561
|
+
request: CheckStatusRequest,
|
|
562
|
+
context: CallContext & CallContextExt,
|
|
563
|
+
): Promise<DeepPartial<CheckStatusResponse>>;
|
|
381
564
|
}
|
|
382
565
|
|
|
383
566
|
export interface VerificationServiceClient<CallOptionsExt = {}> {
|
|
384
567
|
verificate(request: DeepPartial<VerificateRequest>, options?: CallOptions & CallOptionsExt): Promise<StatusResponse>;
|
|
385
568
|
refresh(request: DeepPartial<RefreshRequest>, options?: CallOptions & CallOptionsExt): Promise<Verification>;
|
|
569
|
+
checkStatus(
|
|
570
|
+
request: DeepPartial<CheckStatusRequest>,
|
|
571
|
+
options?: CallOptions & CallOptionsExt,
|
|
572
|
+
): Promise<CheckStatusResponse>;
|
|
386
573
|
}
|
|
387
574
|
|
|
388
575
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
package/package.json
CHANGED
package/proto/auth/v1/auth.proto
CHANGED
|
@@ -10,7 +10,7 @@ service AuthService {
|
|
|
10
10
|
rpc Registration(RegistrationRequest) returns (RegistrationResponse);
|
|
11
11
|
rpc RegistrationCompensate(RegistrationCompensateRequest) returns (auth.v1.StatusResponse);
|
|
12
12
|
rpc Login(LoginRequest) returns (LoginResponse);
|
|
13
|
-
rpc
|
|
13
|
+
rpc Authorize(AuthorizeRequest) returns (auth.v1.Tokens);
|
|
14
14
|
rpc Logout(Tokens) returns (auth.v1.StatusResponse);
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -59,7 +59,7 @@ message CodeVerifier {
|
|
|
59
59
|
string verifier = 2;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
message
|
|
62
|
+
message AuthorizeRequest {
|
|
63
63
|
string service_id = 1;
|
|
64
64
|
optional auth.v1.Tokens tokens = 2;
|
|
65
65
|
optional CodeVerifier code = 3;
|
|
@@ -7,11 +7,12 @@ import "auth/v1/common.proto";
|
|
|
7
7
|
service VerificationService {
|
|
8
8
|
rpc Verificate(VerificateRequest) returns (auth.v1.StatusResponse);
|
|
9
9
|
rpc Refresh(RefreshRequest) returns (Verification);
|
|
10
|
+
rpc CheckStatus(CheckStatusRequest) returns (CheckStatusResponse);
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
enum VerificationType {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
VERIFICATION_TYPE_EMMAIL_CODE = 0;
|
|
15
|
+
VERIFICATION_TYPE_EMAIL_LINK = 1;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
message Verification {
|
|
@@ -23,10 +24,23 @@ message Verification {
|
|
|
23
24
|
message VerificateRequest {
|
|
24
25
|
string id = 1;
|
|
25
26
|
string value = 2;
|
|
26
|
-
string code = 3;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
message RefreshRequest {
|
|
30
30
|
string user_id = 1;
|
|
31
31
|
VerificationType type = 2;
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
enum VerificationStatus {
|
|
35
|
+
VERIFICATION_STATUS_WAIT = 0;
|
|
36
|
+
VERIFICATION_STATUS_EXPIRES = 1;
|
|
37
|
+
VERIFICATION_STATUS_VERIFIED = 2;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
message CheckStatusRequest {
|
|
41
|
+
string id = 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
message CheckStatusResponse {
|
|
45
|
+
VerificationStatus status = 1;
|
|
46
|
+
}
|