@rustlimited/contracts 1.0.5 → 1.0.7
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.ts +1 -101
- package/gen/ts/google/protobuf/timestamp.ts +119 -0
- package/package.json +1 -1
- package/proto/auth.proto +5 -65
package/gen/ts/auth.ts
CHANGED
|
@@ -11,123 +11,23 @@ import { Empty } from "./google/protobuf/empty";
|
|
|
11
11
|
|
|
12
12
|
export const protobufPackage = "auth.v1";
|
|
13
13
|
|
|
14
|
-
export interface SendOtpRequest {
|
|
15
|
-
identifier: string;
|
|
16
|
-
type: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface SendOtpResponse {
|
|
20
|
-
ok: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface VerifyOtpRequest {
|
|
24
|
-
identifier: string;
|
|
25
|
-
type: string;
|
|
26
|
-
code: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface VerifyOtpResponse {
|
|
30
|
-
accessToken: string;
|
|
31
|
-
refreshToken: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface RefreshRequest {
|
|
35
|
-
refreshToken: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface RefreshResponse {
|
|
39
|
-
accessToken: string;
|
|
40
|
-
refreshToken: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
14
|
export interface TelegramInitResponse {
|
|
44
15
|
url: string;
|
|
45
16
|
}
|
|
46
17
|
|
|
47
|
-
export interface TelegramVerifyRequest {
|
|
48
|
-
query: { [key: string]: string };
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface TelegramVerifyRequest_QueryEntry {
|
|
52
|
-
key: string;
|
|
53
|
-
value: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface TelegramVerifyResponse {
|
|
57
|
-
url?: string | undefined;
|
|
58
|
-
accessToken?: string | undefined;
|
|
59
|
-
refreshToken?: string | undefined;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface TelegramCompleteRequest {
|
|
63
|
-
sessionId: string;
|
|
64
|
-
phone: string;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface TelegramCompleteResponse {
|
|
68
|
-
sessionId: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface TelegramConsumeRequest {
|
|
72
|
-
sessionId: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface TelegramConsumeResponse {
|
|
76
|
-
accessToken: string;
|
|
77
|
-
refreshToken: string;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
18
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
81
19
|
|
|
82
20
|
export interface AuthServiceClient {
|
|
83
|
-
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
84
|
-
|
|
85
|
-
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
|
86
|
-
|
|
87
|
-
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
|
88
|
-
|
|
89
21
|
telegramInit(request: Empty): Observable<TelegramInitResponse>;
|
|
90
|
-
|
|
91
|
-
telegramVerify(request: TelegramVerifyRequest): Observable<TelegramVerifyResponse>;
|
|
92
|
-
|
|
93
|
-
telegramComplete(request: TelegramCompleteRequest): Observable<TelegramCompleteResponse>;
|
|
94
|
-
|
|
95
|
-
telegramConsume(request: TelegramConsumeRequest): Observable<TelegramConsumeResponse>;
|
|
96
22
|
}
|
|
97
23
|
|
|
98
24
|
export interface AuthServiceController {
|
|
99
|
-
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
100
|
-
|
|
101
|
-
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
|
102
|
-
|
|
103
|
-
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
|
104
|
-
|
|
105
25
|
telegramInit(request: Empty): Promise<TelegramInitResponse> | Observable<TelegramInitResponse> | TelegramInitResponse;
|
|
106
|
-
|
|
107
|
-
telegramVerify(
|
|
108
|
-
request: TelegramVerifyRequest,
|
|
109
|
-
): Promise<TelegramVerifyResponse> | Observable<TelegramVerifyResponse> | TelegramVerifyResponse;
|
|
110
|
-
|
|
111
|
-
telegramComplete(
|
|
112
|
-
request: TelegramCompleteRequest,
|
|
113
|
-
): Promise<TelegramCompleteResponse> | Observable<TelegramCompleteResponse> | TelegramCompleteResponse;
|
|
114
|
-
|
|
115
|
-
telegramConsume(
|
|
116
|
-
request: TelegramConsumeRequest,
|
|
117
|
-
): Promise<TelegramConsumeResponse> | Observable<TelegramConsumeResponse> | TelegramConsumeResponse;
|
|
118
26
|
}
|
|
119
27
|
|
|
120
28
|
export function AuthServiceControllerMethods() {
|
|
121
29
|
return function (constructor: Function) {
|
|
122
|
-
const grpcMethods: string[] = [
|
|
123
|
-
"sendOtp",
|
|
124
|
-
"verifyOtp",
|
|
125
|
-
"refresh",
|
|
126
|
-
"telegramInit",
|
|
127
|
-
"telegramVerify",
|
|
128
|
-
"telegramComplete",
|
|
129
|
-
"telegramConsume",
|
|
130
|
-
];
|
|
30
|
+
const grpcMethods: string[] = ["telegramInit"];
|
|
131
31
|
for (const method of grpcMethods) {
|
|
132
32
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
133
33
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.1
|
|
4
|
+
// protoc v6.33.4
|
|
5
|
+
// source: google/protobuf/timestamp.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
|
|
9
|
+
export const protobufPackage = "google.protobuf";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A Timestamp represents a point in time independent of any time zone or local
|
|
13
|
+
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
14
|
+
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
|
15
|
+
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
|
16
|
+
* Gregorian calendar backwards to year one.
|
|
17
|
+
*
|
|
18
|
+
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
|
19
|
+
* second table is needed for interpretation, using a [24-hour linear
|
|
20
|
+
* smear](https://developers.google.com/time/smear).
|
|
21
|
+
*
|
|
22
|
+
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
|
23
|
+
* restricting to that range, we ensure that we can convert to and from [RFC
|
|
24
|
+
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
|
25
|
+
*
|
|
26
|
+
* # Examples
|
|
27
|
+
*
|
|
28
|
+
* Example 1: Compute Timestamp from POSIX `time()`.
|
|
29
|
+
*
|
|
30
|
+
* Timestamp timestamp;
|
|
31
|
+
* timestamp.set_seconds(time(NULL));
|
|
32
|
+
* timestamp.set_nanos(0);
|
|
33
|
+
*
|
|
34
|
+
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
|
35
|
+
*
|
|
36
|
+
* struct timeval tv;
|
|
37
|
+
* gettimeofday(&tv, NULL);
|
|
38
|
+
*
|
|
39
|
+
* Timestamp timestamp;
|
|
40
|
+
* timestamp.set_seconds(tv.tv_sec);
|
|
41
|
+
* timestamp.set_nanos(tv.tv_usec * 1000);
|
|
42
|
+
*
|
|
43
|
+
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
|
44
|
+
*
|
|
45
|
+
* FILETIME ft;
|
|
46
|
+
* GetSystemTimeAsFileTime(&ft);
|
|
47
|
+
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
|
48
|
+
*
|
|
49
|
+
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
|
50
|
+
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
|
51
|
+
* Timestamp timestamp;
|
|
52
|
+
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
|
53
|
+
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
|
54
|
+
*
|
|
55
|
+
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
|
56
|
+
*
|
|
57
|
+
* long millis = System.currentTimeMillis();
|
|
58
|
+
*
|
|
59
|
+
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
60
|
+
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
61
|
+
*
|
|
62
|
+
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
|
63
|
+
*
|
|
64
|
+
* Instant now = Instant.now();
|
|
65
|
+
*
|
|
66
|
+
* Timestamp timestamp =
|
|
67
|
+
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
|
68
|
+
* .setNanos(now.getNano()).build();
|
|
69
|
+
*
|
|
70
|
+
* Example 6: Compute Timestamp from current time in Python.
|
|
71
|
+
*
|
|
72
|
+
* timestamp = Timestamp()
|
|
73
|
+
* timestamp.GetCurrentTime()
|
|
74
|
+
*
|
|
75
|
+
* # JSON Mapping
|
|
76
|
+
*
|
|
77
|
+
* In JSON format, the Timestamp type is encoded as a string in the
|
|
78
|
+
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
|
79
|
+
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
|
80
|
+
* where {year} is always expressed using four digits while {month}, {day},
|
|
81
|
+
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
|
82
|
+
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
|
83
|
+
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
|
84
|
+
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
|
85
|
+
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
|
86
|
+
* able to accept both UTC and other timezones (as indicated by an offset).
|
|
87
|
+
*
|
|
88
|
+
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
|
89
|
+
* 01:30 UTC on January 15, 2017.
|
|
90
|
+
*
|
|
91
|
+
* In JavaScript, one can convert a Date object to this format using the
|
|
92
|
+
* standard
|
|
93
|
+
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
|
94
|
+
* method. In Python, a standard `datetime.datetime` object can be converted
|
|
95
|
+
* to this format using
|
|
96
|
+
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
|
97
|
+
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
|
98
|
+
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
|
99
|
+
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
|
100
|
+
* ) to obtain a formatter capable of generating timestamps in this format.
|
|
101
|
+
*/
|
|
102
|
+
export interface Timestamp {
|
|
103
|
+
/**
|
|
104
|
+
* Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
|
|
105
|
+
* be between -315576000000 and 315576000000 inclusive (which corresponds to
|
|
106
|
+
* 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
|
|
107
|
+
*/
|
|
108
|
+
seconds: number;
|
|
109
|
+
/**
|
|
110
|
+
* Non-negative fractions of a second at nanosecond resolution. This field is
|
|
111
|
+
* the nanosecond portion of the duration, not an alternative to seconds.
|
|
112
|
+
* Negative second values with fractions must still have non-negative nanos
|
|
113
|
+
* values that count forward in time. Must be between 0 and 999,999,999
|
|
114
|
+
* inclusive.
|
|
115
|
+
*/
|
|
116
|
+
nanos: number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
package/package.json
CHANGED
package/proto/auth.proto
CHANGED
|
@@ -3,77 +3,17 @@ syntax = "proto3";
|
|
|
3
3
|
package auth.v1;
|
|
4
4
|
|
|
5
5
|
import "google/protobuf/empty.proto";
|
|
6
|
+
import "google/protobuf/timestamp.proto";
|
|
6
7
|
|
|
7
|
-
service AuthService {
|
|
8
|
-
rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
|
|
9
|
-
rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
10
|
-
rpc Refresh (RefreshRequest) returns (RefreshResponse);
|
|
8
|
+
service AuthService {
|
|
11
9
|
|
|
12
|
-
rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
|
|
13
|
-
rpc TelegramVerify (TelegramVerifyRequest) returns (TelegramVerifyResponse);
|
|
14
|
-
rpc TelegramComplete (TelegramCompleteRequest) returns (TelegramCompleteResponse);
|
|
15
|
-
rpc TelegramConsume (TelegramConsumeRequest) returns (TelegramConsumeResponse);
|
|
10
|
+
rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
|
|
16
11
|
}
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
string identifier = 1;
|
|
20
|
-
string type = 2;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
message SendOtpResponse {
|
|
24
|
-
bool ok = 1;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
message VerifyOtpRequest {
|
|
28
|
-
string identifier = 1;
|
|
29
|
-
string type = 2;
|
|
30
|
-
string code = 3;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
message VerifyOtpResponse {
|
|
34
|
-
string access_token = 1;
|
|
35
|
-
string refresh_token = 2;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
message RefreshRequest {
|
|
39
|
-
string refresh_token = 1;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
message RefreshResponse {
|
|
43
|
-
string access_token = 1;
|
|
44
|
-
string refresh_token = 2;
|
|
45
|
-
}
|
|
13
|
+
|
|
46
14
|
|
|
47
15
|
message TelegramInitResponse {
|
|
48
16
|
string url = 1;
|
|
49
17
|
}
|
|
50
18
|
|
|
51
|
-
|
|
52
|
-
map<string, string> query = 1;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
message TelegramVerifyResponse {
|
|
56
|
-
oneof result {
|
|
57
|
-
string url = 1;
|
|
58
|
-
string access_token = 2;
|
|
59
|
-
string refresh_token = 3;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
message TelegramCompleteRequest {
|
|
64
|
-
string session_id = 1;
|
|
65
|
-
string phone = 2;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
message TelegramCompleteResponse {
|
|
69
|
-
string session_id = 1;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
message TelegramConsumeRequest {
|
|
73
|
-
string session_id = 1;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
message TelegramConsumeResponse {
|
|
77
|
-
string access_token = 1;
|
|
78
|
-
string refresh_token = 2;
|
|
79
|
-
}
|
|
19
|
+
|