@aepstore-dev/contracts 1.103.0 → 1.104.0

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/proto/auth.proto CHANGED
@@ -1,20 +1,20 @@
1
- syntax = "proto3";
2
-
3
- package auth.v1;
4
-
5
- // Ported from legacy auth-service (@MessagePattern → @GrpcMethod).
6
- // Tokens are HMAC primitives from @aepstore-dev/passport:
7
- // - access token: short TTL, carries userId; the gateway validates it
8
- // locally via PassportAuthGuard (no round-trip here).
9
- // - refresh token: long TTL HMAC + a RefreshToken DB row (device list +
10
- // revocation). Refresh verifies the HMAC AND that the row still exists.
11
- service AuthService {
12
- rpc Login(LoginRequest) returns (AuthResult);
13
- rpc Register(RegisterRequest) returns (AuthResult);
14
- rpc CreateCode(CreateCodeRequest) returns (AuthResult);
15
- rpc VerifyCode(VerifyCodeRequest) returns (AuthResult);
16
- rpc CheckToken(CheckTokenRequest) returns (AuthUser);
17
- rpc RefreshToken(RefreshTokenRequest) returns (AuthResult);
1
+ syntax = "proto3";
2
+
3
+ package auth.v1;
4
+
5
+ // Ported from legacy auth-service (@MessagePattern → @GrpcMethod).
6
+ // Tokens are HMAC primitives from @aepstore-dev/passport:
7
+ // - access token: short TTL, carries userId; the gateway validates it
8
+ // locally via PassportAuthGuard (no round-trip here).
9
+ // - refresh token: long TTL HMAC + a RefreshToken DB row (device list +
10
+ // revocation). Refresh verifies the HMAC AND that the row still exists.
11
+ service AuthService {
12
+ rpc Login(LoginRequest) returns (AuthResult);
13
+ rpc Register(RegisterRequest) returns (AuthResult);
14
+ rpc CreateCode(CreateCodeRequest) returns (AuthResult);
15
+ rpc VerifyCode(VerifyCodeRequest) returns (AuthResult);
16
+ rpc CheckToken(CheckTokenRequest) returns (AuthUser);
17
+ rpc RefreshToken(RefreshTokenRequest) returns (AuthResult);
18
18
  rpc Get2faStatus(Get2faStatusRequest) returns (TwoFactorStatusResponse);
19
19
  rpc GetProfile(GetProfileRequest) returns (AuthUser);
20
20
  rpc CleanupExpiredTotpSetups(Empty) returns (Empty);
@@ -25,45 +25,53 @@ service AuthService {
25
25
  rpc DeletePasskey(DeletePasskeyRequest) returns (DeletePasskeyResponse);
26
26
  rpc GeneratePasskeyAuthenticationOptions(GeneratePasskeyAuthenticationOptionsRequest) returns (PasskeyOptionsResponse);
27
27
  rpc VerifyPasskeyAuthentication(VerifyPasskeyAuthenticationRequest) returns (AuthResult);
28
-
29
- // Logout kill refresh tokens. LogoutCurrent kills only the one whose
30
- // HMAC matches; LogoutAll wipes every row for the user.
31
- rpc LogoutCurrent(LogoutCurrentRequest) returns (LogoutResponse);
32
- rpc LogoutAll(LogoutAllRequest) returns (LogoutResponse);
33
-
34
- // Self-service restore. Verifies credentials + password against a
35
- // soft-deleted user, clears deletedAt/scheduledForHardDelete, and issues
36
- // fresh tokens — the one auth path that DOES read deletedAt accounts.
37
- rpc RestoreLogin(RestoreLoginRequest) returns (AuthResult);
38
-
39
- // Login history. Read-only audit feed for the settings page; rows come
40
- // from LoginEvent. Internal alternative: tasks-service GC.
41
- rpc ListLoginHistory(ListLoginHistoryRequest) returns (ListLoginHistoryResponse);
42
- }
43
-
44
- enum TwoFactorType {
45
- NONE = 0;
46
- APP = 1;
47
- EMAIL = 2;
48
- }
49
-
50
- // ---------------------------------------------------------------------------
51
- // Requests
52
- // ---------------------------------------------------------------------------
53
-
54
- // Login by username OR email (one of the two must be set).
28
+
29
+ // First-party OAuth 2.0 provider. Authorization codes use PKCE S256;
30
+ // access/refresh tokens are opaque, scoped and independently revocable.
31
+ rpc ValidateOAuthAuthorizationRequest(ValidateOAuthAuthorizationRequestInput) returns (OAuthAuthorizationRequestInfo);
32
+ rpc CreateOAuthAuthorizationCode(CreateOAuthAuthorizationCodeRequest) returns (CreateOAuthAuthorizationCodeResponse);
33
+ rpc ExchangeOAuthToken(ExchangeOAuthTokenRequest) returns (OAuthTokenResponse);
34
+ rpc GetOAuthUserInfo(OAuthResourceRequest) returns (OAuthUserInfoResponse);
35
+ rpc ListOAuthProducts(OAuthResourceRequest) returns (OAuthProductsResponse);
36
+
37
+ // Logout kill refresh tokens. LogoutCurrent kills only the one whose
38
+ // HMAC matches; LogoutAll wipes every row for the user.
39
+ rpc LogoutCurrent(LogoutCurrentRequest) returns (LogoutResponse);
40
+ rpc LogoutAll(LogoutAllRequest) returns (LogoutResponse);
41
+
42
+ // Self-service restore. Verifies credentials + password against a
43
+ // soft-deleted user, clears deletedAt/scheduledForHardDelete, and issues
44
+ // fresh tokens — the one auth path that DOES read deletedAt accounts.
45
+ rpc RestoreLogin(RestoreLoginRequest) returns (AuthResult);
46
+
47
+ // Login history. Read-only audit feed for the settings page; rows come
48
+ // from LoginEvent. Internal alternative: tasks-service GC.
49
+ rpc ListLoginHistory(ListLoginHistoryRequest) returns (ListLoginHistoryResponse);
50
+ }
51
+
52
+ enum TwoFactorType {
53
+ NONE = 0;
54
+ APP = 1;
55
+ EMAIL = 2;
56
+ }
57
+
58
+ // ---------------------------------------------------------------------------
59
+ // Requests
60
+ // ---------------------------------------------------------------------------
61
+
62
+ // Login by username OR email (one of the two must be set).
55
63
  message LoginRequest {
56
64
  string password = 1;
57
65
  string credentials = 2; // username OR email — resolved by the service
58
- // Gateway-supplied audit context. LoginEvent rows for LOGIN /
59
- // PASSWORD_FAIL get the same ip/user-agent that REFRESH and RESTORE
60
- // already carry; the gRPC layer has no transport-level access to
66
+ // Gateway-supplied audit context. LoginEvent rows for LOGIN /
67
+ // PASSWORD_FAIL get the same ip/user-agent that REFRESH and RESTORE
68
+ // already carry; the gRPC layer has no transport-level access to
61
69
  // either, so the gateway extracts them from the HTTP request.
62
70
  string user_agent = 3;
63
71
  string ip = 4;
64
72
  string trusted_device_token = 5;
65
73
  }
66
-
74
+
67
75
  message RegisterRequest {
68
76
  string email = 1;
69
77
  string username = 2;
@@ -71,13 +79,13 @@ message RegisterRequest {
71
79
  string ip = 4; // optional, attached by gateway from req
72
80
  string user_agent = 5; // optional, attached by gateway from req
73
81
  }
74
-
82
+
75
83
  // type ∈ { twofa, reset, totp_generate, confirm } (legacy strings)
76
- message CreateCodeRequest {
77
- string email = 1;
78
- string type = 2;
79
- }
80
-
84
+ message CreateCodeRequest {
85
+ string email = 1;
86
+ string type = 2;
87
+ }
88
+
81
89
  // type ∈ { twofa, twofa_activate, twofa_deactivate, reset, totp, totp_activate,
82
90
  // totp_deactivate, backup, regenerate_backup, confirm }
83
91
  // regenerate_backup expects a current TOTP code, not an existing backup code.
@@ -95,21 +103,21 @@ message VerifyCodeRequest {
95
103
  // Public login completions must use challenge_id instead.
96
104
  bool account_verification = 9;
97
105
  }
98
-
99
- message CheckTokenRequest {
100
- string token = 1;
101
- }
102
-
103
- message RefreshTokenRequest {
104
- string refresh_token = 1;
105
- string user_agent = 2; // optional
106
- string ip = 3; // optional
107
- }
108
-
109
- message Get2faStatusRequest {
110
- string username = 1;
111
- }
112
-
106
+
107
+ message CheckTokenRequest {
108
+ string token = 1;
109
+ }
110
+
111
+ message RefreshTokenRequest {
112
+ string refresh_token = 1;
113
+ string user_agent = 2; // optional
114
+ string ip = 3; // optional
115
+ }
116
+
117
+ message Get2faStatusRequest {
118
+ string username = 1;
119
+ }
120
+
113
121
  message GetProfileRequest {
114
122
  string user_id = 1;
115
123
  }
@@ -155,11 +163,94 @@ message VerifyPasskeyAuthenticationRequest {
155
163
  string user_agent = 3;
156
164
  string ip = 4;
157
165
  }
158
-
159
- // ---------------------------------------------------------------------------
160
- // Responses
161
- // ---------------------------------------------------------------------------
162
-
166
+
167
+ message CreateOAuthAuthorizationCodeRequest {
168
+ string user_id = 1;
169
+ string response_type = 2;
170
+ string client_id = 3;
171
+ string redirect_uri = 4;
172
+ repeated string scopes = 5;
173
+ string code_challenge = 6;
174
+ string code_challenge_method = 7;
175
+ }
176
+
177
+ message ValidateOAuthAuthorizationRequestInput {
178
+ string response_type = 1;
179
+ string client_id = 2;
180
+ string redirect_uri = 3;
181
+ repeated string scopes = 4;
182
+ string code_challenge = 5;
183
+ string code_challenge_method = 6;
184
+ }
185
+
186
+ message OAuthAuthorizationRequestInfo {
187
+ string client_id = 1;
188
+ string client_name = 2;
189
+ string redirect_uri = 3;
190
+ repeated string scopes = 4;
191
+ }
192
+
193
+ message CreateOAuthAuthorizationCodeResponse {
194
+ string code = 1;
195
+ string redirect_uri = 2;
196
+ int32 expires_in = 3;
197
+ }
198
+
199
+ message ExchangeOAuthTokenRequest {
200
+ string grant_type = 1;
201
+ string code = 2;
202
+ string refresh_token = 3;
203
+ string client_id = 4;
204
+ string client_secret = 5;
205
+ string redirect_uri = 6;
206
+ string code_verifier = 7;
207
+ }
208
+
209
+ message OAuthTokenResponse {
210
+ string access_token = 1;
211
+ string token_type = 2;
212
+ int32 expires_in = 3;
213
+ string refresh_token = 4;
214
+ string scope = 5;
215
+ }
216
+
217
+ message OAuthResourceRequest {
218
+ string access_token = 1;
219
+ }
220
+
221
+ message OAuthPremiumInfo {
222
+ bool active = 1;
223
+ string expires_at = 2;
224
+ }
225
+
226
+ message OAuthUserInfoResponse {
227
+ string id = 1;
228
+ string email = 2;
229
+ string username = 3;
230
+ string full_name = 4;
231
+ string avatar_url = 5;
232
+ OAuthPremiumInfo premium = 6;
233
+ }
234
+
235
+ message OAuthProduct {
236
+ string id = 1;
237
+ string name = 2;
238
+ string description = 3;
239
+ string preview = 4;
240
+ string price = 5;
241
+ string currency = 6;
242
+ string public_url = 7;
243
+ string moderation_status = 8;
244
+ }
245
+
246
+ message OAuthProductsResponse {
247
+ repeated OAuthProduct items = 1;
248
+ }
249
+
250
+ // ---------------------------------------------------------------------------
251
+ // Responses
252
+ // ---------------------------------------------------------------------------
253
+
163
254
  message AuthUser {
164
255
  string id = 1;
165
256
  string username = 2;
@@ -167,39 +258,39 @@ message AuthUser {
167
258
  string avatar_url = 4;
168
259
  string banner_url = 5;
169
260
  repeated string roles = 6;
170
- // Reserved: 7=role, 8=is_verified, 9=two_factor_type, 10=two_factor_enabled,
171
- // 11=balance. Dropped in contracts 1.51.0 — clients read 2FA flags from
261
+ // Reserved: 7=role, 8=is_verified, 9=two_factor_type, 10=two_factor_enabled,
262
+ // 11=balance. Dropped in contracts 1.51.0 — clients read 2FA flags from
172
263
  // AuthResult / /account/settings, balance from /payments/wallet.
173
264
  reserved 7, 8, 9, 10, 11;
174
265
  reserved "role", "is_verified", "two_factor_type", "two_factor_enabled", "balance";
175
266
  string avatar_border = 12;
176
267
  }
177
-
178
- // Unified result for login/register/createCode/verifyCode/refresh. Which fields
179
- // are populated depends on the flow:
180
- // - fully authenticated → access_token + refresh_token + expires_in + user
181
- // - 2FA required / pending confirm → message + two_factor_required + two_factor_type + user (no tokens)
182
- // - totp_generate → secret + otpauth + qr (+ user)
183
- // - totp_activate → backup_codes (+ tokens/user)
184
- message AuthResult {
185
- string access_token = 1;
186
- string refresh_token = 2;
187
- int32 expires_in = 3;
188
- AuthUser user = 4;
189
-
190
- string message = 5;
191
- // Renamed from `requires_2fa` in 1.52.0: the digit-after-underscore broke
192
- // the grpc proto-loader's camelCase pass (`_2` isn't `_<letter>`), so the
193
- // wire key stayed snake_case and never matched the camelCase handler output
194
- // → always serialised false. `two_factor_required` camelCases cleanly to
195
- // `twoFactorRequired` on every layer. Field number 6 is unchanged (wire-
196
- // compatible).
197
- bool two_factor_required = 6;
198
- TwoFactorType two_factor_type = 7;
199
-
200
- // TOTP setup extras
201
- string secret = 8;
202
- string otpauth = 9;
268
+
269
+ // Unified result for login/register/createCode/verifyCode/refresh. Which fields
270
+ // are populated depends on the flow:
271
+ // - fully authenticated → access_token + refresh_token + expires_in + user
272
+ // - 2FA required / pending confirm → message + two_factor_required + two_factor_type + user (no tokens)
273
+ // - totp_generate → secret + otpauth + qr (+ user)
274
+ // - totp_activate → backup_codes (+ tokens/user)
275
+ message AuthResult {
276
+ string access_token = 1;
277
+ string refresh_token = 2;
278
+ int32 expires_in = 3;
279
+ AuthUser user = 4;
280
+
281
+ string message = 5;
282
+ // Renamed from `requires_2fa` in 1.52.0: the digit-after-underscore broke
283
+ // the grpc proto-loader's camelCase pass (`_2` isn't `_<letter>`), so the
284
+ // wire key stayed snake_case and never matched the camelCase handler output
285
+ // → always serialised false. `two_factor_required` camelCases cleanly to
286
+ // `twoFactorRequired` on every layer. Field number 6 is unchanged (wire-
287
+ // compatible).
288
+ bool two_factor_required = 6;
289
+ TwoFactorType two_factor_type = 7;
290
+
291
+ // TOTP setup extras
292
+ string secret = 8;
293
+ string otpauth = 9;
203
294
  string qr = 10; // data URL (PNG)
204
295
  repeated string backup_codes = 11;
205
296
  string challenge_id = 12;
@@ -207,26 +298,26 @@ message AuthResult {
207
298
  string trusted_device_expires_at = 14;
208
299
  bool security_setup_required = 15;
209
300
  }
210
-
211
- message TwoFactorStatusResponse {
212
- TwoFactorType two_factor_type = 1;
213
- bool has_2fa = 2;
214
- bool is_verified = 3;
215
- }
216
-
217
- message Empty {}
218
-
219
- message LogoutCurrentRequest {
220
- string refresh_token = 1;
221
- }
222
-
223
- message LogoutAllRequest {
224
- string user_id = 1;
225
- // Current session's refresh token — excluded from the wipe so "log out
226
- // everywhere" keeps THIS device signed in. Empty = revoke every session.
227
- string refresh_token = 2;
228
- }
229
-
301
+
302
+ message TwoFactorStatusResponse {
303
+ TwoFactorType two_factor_type = 1;
304
+ bool has_2fa = 2;
305
+ bool is_verified = 3;
306
+ }
307
+
308
+ message Empty {}
309
+
310
+ message LogoutCurrentRequest {
311
+ string refresh_token = 1;
312
+ }
313
+
314
+ message LogoutAllRequest {
315
+ string user_id = 1;
316
+ // Current session's refresh token — excluded from the wipe so "log out
317
+ // everywhere" keeps THIS device signed in. Empty = revoke every session.
318
+ string refresh_token = 2;
319
+ }
320
+
230
321
  message LogoutResponse {
231
322
  bool ok = 1;
232
323
  int32 removed = 2; // number of refresh-token rows deleted
@@ -266,33 +357,33 @@ message ListPasskeysResponse {
266
357
  message DeletePasskeyResponse {
267
358
  bool ok = 1;
268
359
  }
269
-
270
- message RestoreLoginRequest {
271
- string credentials = 1; // email or username
272
- string password = 2;
273
- string user_agent = 3;
274
- string ip = 4;
275
- }
276
-
277
- message ListLoginHistoryRequest {
278
- string user_id = 1;
279
- int32 page = 2;
280
- int32 limit = 3;
281
- }
282
-
283
- message LoginEventRow {
284
- string id = 1;
285
- string type = 2; // LOGIN | LOGOUT | REFRESH | TWO_FA_FAIL | PASSWORD_FAIL | BLOCKED | RESTORE
286
- bool success = 3;
287
- string reason = 4;
288
- string ip = 5;
289
- string user_agent = 6;
290
- string created_at = 7;
291
- }
292
-
293
- message ListLoginHistoryResponse {
294
- repeated LoginEventRow items = 1;
295
- int32 total = 2;
296
- int32 page = 3;
297
- int32 limit = 4;
298
- }
360
+
361
+ message RestoreLoginRequest {
362
+ string credentials = 1; // email or username
363
+ string password = 2;
364
+ string user_agent = 3;
365
+ string ip = 4;
366
+ }
367
+
368
+ message ListLoginHistoryRequest {
369
+ string user_id = 1;
370
+ int32 page = 2;
371
+ int32 limit = 3;
372
+ }
373
+
374
+ message LoginEventRow {
375
+ string id = 1;
376
+ string type = 2; // LOGIN | LOGOUT | REFRESH | TWO_FA_FAIL | PASSWORD_FAIL | BLOCKED | RESTORE
377
+ bool success = 3;
378
+ string reason = 4;
379
+ string ip = 5;
380
+ string user_agent = 6;
381
+ string created_at = 7;
382
+ }
383
+
384
+ message ListLoginHistoryResponse {
385
+ repeated LoginEventRow items = 1;
386
+ int32 total = 2;
387
+ int32 page = 3;
388
+ int32 limit = 4;
389
+ }
package/proto/mail.proto CHANGED
@@ -1,54 +1,54 @@
1
- syntax = "proto3";
2
-
3
- package mail.v1;
4
-
5
- // Legacy mail-service used @EventPattern (fire-and-forget). In the new gRPC
6
- // stack each becomes a unary RPC that returns an Ack. Callers ignore the
7
- // response if they don't care about delivery.
8
- service MailService {
9
- rpc SendReg(SendRegRequest) returns (MailAck);
10
- rpc Send2fa(Send2faRequest) returns (MailAck);
11
- rpc SendPasswordReset(SendPasswordResetRequest) returns (MailAck);
12
- rpc SendRegistrationConfirm(SendRegistrationConfirmRequest) returns (MailAck);
13
-
14
- // GDPR data-export delivery — tasks-service fires after the JSON dump
15
- // lands in S3; mail-service sends the signed URL with a sensible TTL note.
16
- rpc SendDataExportReady(SendDataExportReadyRequest) returns (MailAck);
17
- }
18
-
19
- message MailAck {
20
- bool queued = 1;
21
- }
22
-
23
- message SendRegRequest {
24
- string user_id = 1;
25
- string email = 2;
26
- string username = 3;
27
- string full_name = 4;
28
- }
29
-
30
- message Send2faRequest {
31
- string email = 1;
32
- string code = 2;
33
- string username = 3;
34
- }
35
-
36
- message SendPasswordResetRequest {
37
- string email = 1;
38
- string code = 2;
39
- string username = 3;
40
- }
41
-
42
- message SendRegistrationConfirmRequest {
43
- string email = 1;
44
- string code = 2;
45
- string username = 3;
46
- }
47
-
48
- message SendDataExportReadyRequest {
49
- string email = 1;
50
- string username = 2;
51
- string file_url = 3; // signed S3 URL
52
- int32 url_ttl_hours = 4; // for the message body
53
- int32 file_size = 5;
54
- }
1
+ syntax = "proto3";
2
+
3
+ package mail.v1;
4
+
5
+ // Legacy mail-service used @EventPattern (fire-and-forget). In the new gRPC
6
+ // stack each becomes a unary RPC that returns an Ack. Callers ignore the
7
+ // response if they don't care about delivery.
8
+ service MailService {
9
+ rpc SendReg(SendRegRequest) returns (MailAck);
10
+ rpc Send2fa(Send2faRequest) returns (MailAck);
11
+ rpc SendPasswordReset(SendPasswordResetRequest) returns (MailAck);
12
+ rpc SendRegistrationConfirm(SendRegistrationConfirmRequest) returns (MailAck);
13
+
14
+ // GDPR data-export delivery — tasks-service fires after the JSON dump
15
+ // lands in S3; mail-service sends the signed URL with a sensible TTL note.
16
+ rpc SendDataExportReady(SendDataExportReadyRequest) returns (MailAck);
17
+ }
18
+
19
+ message MailAck {
20
+ bool queued = 1;
21
+ }
22
+
23
+ message SendRegRequest {
24
+ string user_id = 1;
25
+ string email = 2;
26
+ string username = 3;
27
+ string full_name = 4;
28
+ }
29
+
30
+ message Send2faRequest {
31
+ string email = 1;
32
+ string code = 2;
33
+ string username = 3;
34
+ }
35
+
36
+ message SendPasswordResetRequest {
37
+ string email = 1;
38
+ string code = 2;
39
+ string username = 3;
40
+ }
41
+
42
+ message SendRegistrationConfirmRequest {
43
+ string email = 1;
44
+ string code = 2;
45
+ string username = 3;
46
+ }
47
+
48
+ message SendDataExportReadyRequest {
49
+ string email = 1;
50
+ string username = 2;
51
+ string file_url = 3; // signed S3 URL
52
+ int32 url_ttl_hours = 4; // for the message body
53
+ int32 file_size = 5;
54
+ }