@aepstore-dev/contracts 1.18.1 → 1.20.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,126 +1,126 @@
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
- rpc Get2faStatus(Get2faStatusRequest) returns (TwoFactorStatusResponse);
19
- rpc GetProfile(GetProfileRequest) returns (AuthUser);
20
- rpc CleanupExpiredTotpSetups(Empty) returns (Empty);
21
- }
22
-
23
- enum TwoFactorType {
24
- NONE = 0;
25
- APP = 1;
26
- EMAIL = 2;
27
- }
28
-
29
- // ---------------------------------------------------------------------------
30
- // Requests
31
- // ---------------------------------------------------------------------------
32
-
33
- // Login by username OR email (one of the two must be set).
34
- message LoginRequest {
35
- string password = 1;
36
- string credentials = 2; // username OR email — resolved by the service
37
- }
38
-
39
- message RegisterRequest {
40
- string email = 1;
41
- string username = 2;
42
- string password = 3;
43
- string ip = 4; // optional, attached by gateway from req
44
- }
45
-
46
- // type ∈ { twofa, reset, totp_generate, totp_activate, confirm } (legacy strings)
47
- message CreateCodeRequest {
48
- string email = 1;
49
- string type = 2;
50
- }
51
-
52
- // type ∈ { twofa, twofa_deactivate, reset, totp, totp_deactivate, backup, confirm }
53
- // new_password is only used by the 'reset' flow.
54
- message VerifyCodeRequest {
55
- string email = 1;
56
- string code = 2;
57
- string type = 3;
58
- string new_password = 4; // optional
59
- }
60
-
61
- message CheckTokenRequest {
62
- string token = 1;
63
- }
64
-
65
- message RefreshTokenRequest {
66
- string refresh_token = 1;
67
- string user_agent = 2; // optional
68
- string ip = 3; // optional
69
- }
70
-
71
- message Get2faStatusRequest {
72
- string username = 1;
73
- }
74
-
75
- message GetProfileRequest {
76
- string user_id = 1;
77
- }
78
-
79
- // ---------------------------------------------------------------------------
80
- // Responses
81
- // ---------------------------------------------------------------------------
82
-
83
- message AuthUser {
84
- string id = 1;
85
- string username = 2;
86
- string email = 3;
87
- string avatar_url = 4;
88
- string banner_url = 5;
89
- repeated string roles = 6;
90
- string role = 7; // primary role (roles[0])
91
- bool is_verified = 8;
92
- TwoFactorType two_factor_type = 9;
93
- bool two_factor_enabled = 10;
94
- string balance = 11; // Decimal as string (D7)
95
- }
96
-
97
- // Unified result for login/register/createCode/verifyCode/refresh. Which fields
98
- // are populated depends on the flow:
99
- // - fully authenticated → access_token + refresh_token + expires_in + user
100
- // - 2FA required / pending confirm → message + requires_2fa + two_factor_type + user (no tokens)
101
- // - totp_generate → secret + otpauth + qr (+ user)
102
- // - totp_activate → backup_codes (+ tokens/user)
103
- message AuthResult {
104
- string access_token = 1;
105
- string refresh_token = 2;
106
- int32 expires_in = 3;
107
- AuthUser user = 4;
108
-
109
- string message = 5;
110
- bool requires_2fa = 6;
111
- TwoFactorType two_factor_type = 7;
112
-
113
- // TOTP setup extras
114
- string secret = 8;
115
- string otpauth = 9;
116
- string qr = 10; // data URL (PNG)
117
- repeated string backup_codes = 11;
118
- }
119
-
120
- message TwoFactorStatusResponse {
121
- TwoFactorType two_factor_type = 1;
122
- bool has_2fa = 2;
123
- bool is_verified = 3;
124
- }
125
-
126
- message Empty {}
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
+ rpc Get2faStatus(Get2faStatusRequest) returns (TwoFactorStatusResponse);
19
+ rpc GetProfile(GetProfileRequest) returns (AuthUser);
20
+ rpc CleanupExpiredTotpSetups(Empty) returns (Empty);
21
+ }
22
+
23
+ enum TwoFactorType {
24
+ NONE = 0;
25
+ APP = 1;
26
+ EMAIL = 2;
27
+ }
28
+
29
+ // ---------------------------------------------------------------------------
30
+ // Requests
31
+ // ---------------------------------------------------------------------------
32
+
33
+ // Login by username OR email (one of the two must be set).
34
+ message LoginRequest {
35
+ string password = 1;
36
+ string credentials = 2; // username OR email — resolved by the service
37
+ }
38
+
39
+ message RegisterRequest {
40
+ string email = 1;
41
+ string username = 2;
42
+ string password = 3;
43
+ string ip = 4; // optional, attached by gateway from req
44
+ }
45
+
46
+ // type ∈ { twofa, reset, totp_generate, totp_activate, confirm } (legacy strings)
47
+ message CreateCodeRequest {
48
+ string email = 1;
49
+ string type = 2;
50
+ }
51
+
52
+ // type ∈ { twofa, twofa_deactivate, reset, totp, totp_deactivate, backup, confirm }
53
+ // new_password is only used by the 'reset' flow.
54
+ message VerifyCodeRequest {
55
+ string email = 1;
56
+ string code = 2;
57
+ string type = 3;
58
+ string new_password = 4; // optional
59
+ }
60
+
61
+ message CheckTokenRequest {
62
+ string token = 1;
63
+ }
64
+
65
+ message RefreshTokenRequest {
66
+ string refresh_token = 1;
67
+ string user_agent = 2; // optional
68
+ string ip = 3; // optional
69
+ }
70
+
71
+ message Get2faStatusRequest {
72
+ string username = 1;
73
+ }
74
+
75
+ message GetProfileRequest {
76
+ string user_id = 1;
77
+ }
78
+
79
+ // ---------------------------------------------------------------------------
80
+ // Responses
81
+ // ---------------------------------------------------------------------------
82
+
83
+ message AuthUser {
84
+ string id = 1;
85
+ string username = 2;
86
+ string email = 3;
87
+ string avatar_url = 4;
88
+ string banner_url = 5;
89
+ repeated string roles = 6;
90
+ string role = 7; // primary role (roles[0])
91
+ bool is_verified = 8;
92
+ TwoFactorType two_factor_type = 9;
93
+ bool two_factor_enabled = 10;
94
+ string balance = 11; // Decimal as string (D7)
95
+ }
96
+
97
+ // Unified result for login/register/createCode/verifyCode/refresh. Which fields
98
+ // are populated depends on the flow:
99
+ // - fully authenticated → access_token + refresh_token + expires_in + user
100
+ // - 2FA required / pending confirm → message + requires_2fa + two_factor_type + user (no tokens)
101
+ // - totp_generate → secret + otpauth + qr (+ user)
102
+ // - totp_activate → backup_codes (+ tokens/user)
103
+ message AuthResult {
104
+ string access_token = 1;
105
+ string refresh_token = 2;
106
+ int32 expires_in = 3;
107
+ AuthUser user = 4;
108
+
109
+ string message = 5;
110
+ bool requires_2fa = 6;
111
+ TwoFactorType two_factor_type = 7;
112
+
113
+ // TOTP setup extras
114
+ string secret = 8;
115
+ string otpauth = 9;
116
+ string qr = 10; // data URL (PNG)
117
+ repeated string backup_codes = 11;
118
+ }
119
+
120
+ message TwoFactorStatusResponse {
121
+ TwoFactorType two_factor_type = 1;
122
+ bool has_2fa = 2;
123
+ bool is_verified = 3;
124
+ }
125
+
126
+ message Empty {}
package/proto/mail.proto CHANGED
@@ -1,42 +1,42 @@
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
-
15
- message MailAck {
16
- bool queued = 1;
17
- }
18
-
19
- message SendRegRequest {
20
- string user_id = 1;
21
- string email = 2;
22
- string username = 3;
23
- string full_name = 4;
24
- }
25
-
26
- message Send2faRequest {
27
- string email = 1;
28
- string code = 2;
29
- string username = 3;
30
- }
31
-
32
- message SendPasswordResetRequest {
33
- string email = 1;
34
- string code = 2;
35
- string username = 3;
36
- }
37
-
38
- message SendRegistrationConfirmRequest {
39
- string email = 1;
40
- string code = 2;
41
- string username = 3;
42
- }
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
+
15
+ message MailAck {
16
+ bool queued = 1;
17
+ }
18
+
19
+ message SendRegRequest {
20
+ string user_id = 1;
21
+ string email = 2;
22
+ string username = 3;
23
+ string full_name = 4;
24
+ }
25
+
26
+ message Send2faRequest {
27
+ string email = 1;
28
+ string code = 2;
29
+ string username = 3;
30
+ }
31
+
32
+ message SendPasswordResetRequest {
33
+ string email = 1;
34
+ string code = 2;
35
+ string username = 3;
36
+ }
37
+
38
+ message SendRegistrationConfirmRequest {
39
+ string email = 1;
40
+ string code = 2;
41
+ string username = 3;
42
+ }