@lumina-cinema/contracts 1.0.7 → 1.0.9

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/auth.ts CHANGED
@@ -7,59 +7,224 @@
7
7
  /* eslint-disable */
8
8
  import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
9
  import { Observable } from "rxjs";
10
+ import { Empty } from "./google/protobuf/empty";
10
11
 
11
12
  export const protobufPackage = "auth.v1";
12
13
 
14
+ /** / Request to send an OTP to an identifier (email/phone). */
13
15
  export interface SendOtpRequest {
16
+ /** / Target identifier to deliver OTP to (e.g. "+31612345678" or "user@example.com"). */
14
17
  identifier: string;
18
+ /** / Identifier/delivery type. Recommended values: "phone" or "email". */
15
19
  type: string;
16
20
  }
17
21
 
22
+ /** / Send OTP result. */
18
23
  export interface SendOtpResponse {
24
+ /** / True if the OTP was accepted for delivery (does not necessarily guarantee delivery). */
19
25
  ok: boolean;
20
26
  }
21
27
 
28
+ /** / Request to verify an OTP for an identifier. */
22
29
  export interface VerifyOtpRequest {
30
+ /** / Identifier that received the OTP (must match the identifier used in SendOtp). */
23
31
  identifier: string;
32
+ /** / Identifier type used for delivery. Recommended values: "phone" or "email". */
24
33
  type: string;
34
+ /** / OTP code entered by the user. */
25
35
  code: string;
26
36
  }
27
37
 
38
+ /** / Successful OTP verification response. */
28
39
  export interface VerifyOtpResponse {
40
+ /** / Short-lived access token. */
29
41
  accessToken: string;
42
+ /** / Long-lived refresh token used to obtain new access tokens. */
30
43
  refreshToken: string;
31
44
  }
32
45
 
46
+ /** / Request to refresh tokens. */
33
47
  export interface RefreshRequest {
48
+ /** / Refresh token previously issued by the service. */
34
49
  refreshToken: string;
35
50
  }
36
51
 
52
+ /** / Response containing a new token pair. */
37
53
  export interface RefreshResponse {
54
+ /** / New access token. */
38
55
  accessToken: string;
56
+ /** / New refresh token (may be rotated on each refresh). */
57
+ refreshToken: string;
58
+ }
59
+
60
+ /** / Telegram initialization response. */
61
+ export interface TelegramInitResponse {
62
+ /** / Telegram OAuth authorization URL to open in the client. */
63
+ url: string;
64
+ }
65
+
66
+ /** / Telegram verification request. */
67
+ export interface TelegramVerifyRequest {
68
+ /**
69
+ * / Raw query parameters returned by Telegram (must include `hash` and `auth_date`).
70
+ * / The service validates signature and freshness.
71
+ */
72
+ query: { [key: string]: string };
73
+ }
74
+
75
+ export interface TelegramVerifyRequest_QueryEntry {
76
+ key: string;
77
+ value: string;
78
+ }
79
+
80
+ /**
81
+ * / Telegram verification result.
82
+ * / The response depends on whether the account is fully linked.
83
+ */
84
+ export interface TelegramVerifyResponse {
85
+ /** / Bot deep link to continue/complete the flow (e.g. provide phone, confirm consent). */
86
+ url?:
87
+ | string
88
+ | undefined;
89
+ /** / Access token issued when Telegram login can be completed immediately. */
90
+ accessToken?:
91
+ | string
92
+ | undefined;
93
+ /** / Refresh token issued when Telegram login can be completed immediately. */
94
+ refreshToken?: string | undefined;
95
+ }
96
+
97
+ /** / Request to complete Telegram login by providing additional data. */
98
+ export interface TelegramCompleteRequest {
99
+ /** / Telegram session identifier obtained from the bot deep link. */
100
+ sessionId: string;
101
+ /** / Phone number to bind to the Telegram session (recommended E.164 format). */
102
+ phone: string;
103
+ }
104
+
105
+ /** / Telegram completion response. */
106
+ export interface TelegramCompleteResponse {
107
+ /** / Session identifier that can be consumed to exchange for tokens. */
108
+ sessionId: string;
109
+ }
110
+
111
+ /** / Request to exchange a completed Telegram session for tokens. */
112
+ export interface TelegramConsumeRequest {
113
+ /** / Session identifier from TelegramCompleteResponse. */
114
+ sessionId: string;
115
+ }
116
+
117
+ /** / Token pair returned after consuming a Telegram session. */
118
+ export interface TelegramConsumeResponse {
119
+ /** / Access token. */
120
+ accessToken: string;
121
+ /** / Refresh token. */
39
122
  refreshToken: string;
40
123
  }
41
124
 
42
125
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
43
126
 
44
127
  export interface AuthServiceClient {
128
+ /**
129
+ * / Sends a one-time password (OTP) to the specified identifier (email/phone).
130
+ * / The identifier format and delivery channel are defined by `type`.
131
+ */
132
+
45
133
  sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
46
134
 
135
+ /**
136
+ * / Verifies the OTP provided by the user.
137
+ * / On success returns a new access/refresh token pair.
138
+ */
139
+
47
140
  verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
48
141
 
142
+ /** / Exchanges a valid refresh token for a new access/refresh token pair. */
143
+
49
144
  refresh(request: RefreshRequest): Observable<RefreshResponse>;
145
+
146
+ /** / Initializes Telegram login flow and returns a Telegram authorization URL. */
147
+
148
+ telegramInit(request: Empty): Observable<TelegramInitResponse>;
149
+
150
+ /**
151
+ * / Verifies Telegram login payload (signature + auth_date) and starts/continues the flow.
152
+ * / Depending on the user state, may return tokens immediately or a bot deep link to complete signup.
153
+ */
154
+
155
+ telegramVerify(request: TelegramVerifyRequest): Observable<TelegramVerifyResponse>;
156
+
157
+ /** / Completes Telegram login flow by binding a phone number to the Telegram session. */
158
+
159
+ telegramComplete(request: TelegramCompleteRequest): Observable<TelegramCompleteResponse>;
160
+
161
+ /**
162
+ * / Consumes a completed Telegram session and returns access/refresh tokens.
163
+ * / Intended to be called once per session_id.
164
+ */
165
+
166
+ telegramConsume(request: TelegramConsumeRequest): Observable<TelegramConsumeResponse>;
50
167
  }
51
168
 
52
169
  export interface AuthServiceController {
170
+ /**
171
+ * / Sends a one-time password (OTP) to the specified identifier (email/phone).
172
+ * / The identifier format and delivery channel are defined by `type`.
173
+ */
174
+
53
175
  sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
54
176
 
177
+ /**
178
+ * / Verifies the OTP provided by the user.
179
+ * / On success returns a new access/refresh token pair.
180
+ */
181
+
55
182
  verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
56
183
 
184
+ /** / Exchanges a valid refresh token for a new access/refresh token pair. */
185
+
57
186
  refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
187
+
188
+ /** / Initializes Telegram login flow and returns a Telegram authorization URL. */
189
+
190
+ telegramInit(request: Empty): Promise<TelegramInitResponse> | Observable<TelegramInitResponse> | TelegramInitResponse;
191
+
192
+ /**
193
+ * / Verifies Telegram login payload (signature + auth_date) and starts/continues the flow.
194
+ * / Depending on the user state, may return tokens immediately or a bot deep link to complete signup.
195
+ */
196
+
197
+ telegramVerify(
198
+ request: TelegramVerifyRequest,
199
+ ): Promise<TelegramVerifyResponse> | Observable<TelegramVerifyResponse> | TelegramVerifyResponse;
200
+
201
+ /** / Completes Telegram login flow by binding a phone number to the Telegram session. */
202
+
203
+ telegramComplete(
204
+ request: TelegramCompleteRequest,
205
+ ): Promise<TelegramCompleteResponse> | Observable<TelegramCompleteResponse> | TelegramCompleteResponse;
206
+
207
+ /**
208
+ * / Consumes a completed Telegram session and returns access/refresh tokens.
209
+ * / Intended to be called once per session_id.
210
+ */
211
+
212
+ telegramConsume(
213
+ request: TelegramConsumeRequest,
214
+ ): Promise<TelegramConsumeResponse> | Observable<TelegramConsumeResponse> | TelegramConsumeResponse;
58
215
  }
59
216
 
60
217
  export function AuthServiceControllerMethods() {
61
218
  return function (constructor: Function) {
62
- const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh"];
219
+ const grpcMethods: string[] = [
220
+ "sendOtp",
221
+ "verifyOtp",
222
+ "refresh",
223
+ "telegramInit",
224
+ "telegramVerify",
225
+ "telegramComplete",
226
+ "telegramConsume",
227
+ ];
63
228
  for (const method of grpcMethods) {
64
229
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
65
230
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -0,0 +1,23 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.10.1
4
+ // protoc v3.21.12
5
+ // source: google/protobuf/empty.proto
6
+
7
+ /* eslint-disable */
8
+
9
+ export const protobufPackage = "google.protobuf";
10
+
11
+ /**
12
+ * A generic empty message that you can re-use to avoid defining duplicated
13
+ * empty messages in your APIs. A typical example is to use it as the request
14
+ * or the response type of an API method. For instance:
15
+ *
16
+ * service Foo {
17
+ * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
18
+ * }
19
+ */
20
+ export interface Empty {
21
+ }
22
+
23
+ export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumina-cinema/contracts",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Protobuf definitions and generated Typescript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/proto/auth.proto CHANGED
@@ -2,37 +2,140 @@ syntax = "proto3";
2
2
 
3
3
  package auth.v1;
4
4
 
5
+ import "google/protobuf/empty.proto";
6
+
5
7
  service AuthService {
8
+ /// Sends a one-time password (OTP) to the specified identifier (email/phone).
9
+ /// The identifier format and delivery channel are defined by `type`.
6
10
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
11
+
12
+ /// Verifies the OTP provided by the user.
13
+ /// On success returns a new access/refresh token pair.
7
14
  rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse);
15
+
16
+ /// Exchanges a valid refresh token for a new access/refresh token pair.
8
17
  rpc Refresh(RefreshRequest) returns (RefreshResponse);
18
+
19
+ /// Initializes Telegram login flow and returns a Telegram authorization URL.
20
+ rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
21
+
22
+ /// Verifies Telegram login payload (signature + auth_date) and starts/continues the flow.
23
+ /// Depending on the user state, may return tokens immediately or a bot deep link to complete signup.
24
+ rpc TelegramVerify (TelegramVerifyRequest) returns (TelegramVerifyResponse);
25
+
26
+ /// Completes Telegram login flow by binding a phone number to the Telegram session.
27
+ rpc TelegramComplete (TelegramCompleteRequest) returns (TelegramCompleteResponse);
28
+
29
+ /// Consumes a completed Telegram session and returns access/refresh tokens.
30
+ /// Intended to be called once per session_id.
31
+ rpc TelegramConsume (TelegramConsumeRequest) returns (TelegramConsumeResponse);
9
32
  }
10
33
 
34
+ /// Request to send an OTP to an identifier (email/phone).
11
35
  message SendOtpRequest {
36
+ /// Target identifier to deliver OTP to (e.g. "+31612345678" or "user@example.com").
12
37
  string identifier = 1;
13
- string type = 2;
38
+
39
+ /// Identifier/delivery type. Recommended values: "phone" or "email".
40
+ string type = 2;
14
41
  }
15
42
 
43
+ /// Send OTP result.
16
44
  message SendOtpResponse {
45
+ /// True if the OTP was accepted for delivery (does not necessarily guarantee delivery).
17
46
  bool ok = 1;
18
47
  }
19
48
 
49
+ /// Request to verify an OTP for an identifier.
20
50
  message VerifyOtpRequest {
51
+ /// Identifier that received the OTP (must match the identifier used in SendOtp).
21
52
  string identifier = 1;
22
- string type = 2;
23
- string code = 3;
53
+
54
+ /// Identifier type used for delivery. Recommended values: "phone" or "email".
55
+ string type = 2;
56
+
57
+ /// OTP code entered by the user.
58
+ string code = 3;
24
59
  }
25
60
 
61
+ /// Successful OTP verification response.
26
62
  message VerifyOtpResponse {
27
- string access_token = 1;
63
+ /// Short-lived access token.
64
+ string access_token = 1;
65
+
66
+ /// Long-lived refresh token used to obtain new access tokens.
28
67
  string refresh_token = 2;
29
68
  }
30
69
 
70
+ /// Request to refresh tokens.
31
71
  message RefreshRequest {
72
+ /// Refresh token previously issued by the service.
32
73
  string refresh_token = 1;
33
74
  }
34
75
 
76
+ /// Response containing a new token pair.
35
77
  message RefreshResponse {
36
- string access_token = 1;
78
+ /// New access token.
79
+ string access_token = 1;
80
+
81
+ /// New refresh token (may be rotated on each refresh).
82
+ string refresh_token = 2;
83
+ }
84
+
85
+ /// Telegram initialization response.
86
+ message TelegramInitResponse {
87
+ /// Telegram OAuth authorization URL to open in the client.
88
+ string url = 1;
89
+ }
90
+
91
+ /// Telegram verification request.
92
+ message TelegramVerifyRequest {
93
+ /// Raw query parameters returned by Telegram (must include `hash` and `auth_date`).
94
+ /// The service validates signature and freshness.
95
+ map<string, string> query = 1;
96
+ }
97
+
98
+ /// Telegram verification result.
99
+ /// The response depends on whether the account is fully linked.
100
+ message TelegramVerifyResponse {
101
+ oneof result {
102
+ /// Bot deep link to continue/complete the flow (e.g. provide phone, confirm consent).
103
+ string url = 1;
104
+
105
+ /// Access token issued when Telegram login can be completed immediately.
106
+ string access_token = 2;
107
+
108
+ /// Refresh token issued when Telegram login can be completed immediately.
109
+ string refresh_token = 3;
110
+ }
111
+ }
112
+
113
+ /// Request to complete Telegram login by providing additional data.
114
+ message TelegramCompleteRequest {
115
+ /// Telegram session identifier obtained from the bot deep link.
116
+ string session_id = 1;
117
+
118
+ /// Phone number to bind to the Telegram session (recommended E.164 format).
119
+ string phone = 2;
120
+ }
121
+
122
+ /// Telegram completion response.
123
+ message TelegramCompleteResponse {
124
+ /// Session identifier that can be consumed to exchange for tokens.
125
+ string session_id = 1;
126
+ }
127
+
128
+ /// Request to exchange a completed Telegram session for tokens.
129
+ message TelegramConsumeRequest {
130
+ /// Session identifier from TelegramCompleteResponse.
131
+ string session_id = 1;
132
+ }
133
+
134
+ /// Token pair returned after consuming a Telegram session.
135
+ message TelegramConsumeResponse {
136
+ /// Access token.
137
+ string access_token = 1;
138
+
139
+ /// Refresh token.
37
140
  string refresh_token = 2;
38
- }
141
+ }