@acequants/aegis-contracts 0.1.0 → 0.1.2

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.
@@ -2,44 +2,84 @@ import type { handleUnaryCall, UntypedServiceImplementation } from "@grpc/grpc-j
2
2
  import _m0 from "protobufjs/minimal";
3
3
  import { Observable } from "rxjs";
4
4
  export declare const protobufPackage = "aegis.auth.v1";
5
- export interface LoginRequest {
6
- username: string;
7
- password: string;
5
+ export interface AuthContext {
6
+ userId: string;
7
+ email: string;
8
+ sessionId: string;
9
+ displayName: string;
8
10
  }
9
- export interface LoginResponse {
11
+ export interface ValidateAccessRequest {
12
+ ip: string;
13
+ userAgent: string;
10
14
  accessToken: string;
11
- refreshToken: string;
15
+ }
16
+ export interface ValidateAccessResponse {
17
+ valid: boolean;
18
+ /** "expired", "revoked", etc. */
19
+ reason: string;
20
+ context?: AuthContext | undefined;
21
+ }
22
+ export interface AuthorizeRequest {
23
+ context?: AuthContext | undefined;
24
+ }
25
+ export interface AuthorizeResponse {
26
+ allowed: boolean;
27
+ reason: string;
12
28
  }
13
29
  export declare const AEGIS_AUTH_V1_PACKAGE_NAME = "aegis.auth.v1";
14
- export declare const LoginRequest: {
15
- encode(message: LoginRequest, writer?: _m0.Writer): _m0.Writer;
16
- decode(input: _m0.Reader | Uint8Array, length?: number): LoginRequest;
30
+ export declare const AuthContext: {
31
+ encode(message: AuthContext, writer?: _m0.Writer): _m0.Writer;
32
+ decode(input: _m0.Reader | Uint8Array, length?: number): AuthContext;
33
+ };
34
+ export declare const ValidateAccessRequest: {
35
+ encode(message: ValidateAccessRequest, writer?: _m0.Writer): _m0.Writer;
36
+ decode(input: _m0.Reader | Uint8Array, length?: number): ValidateAccessRequest;
37
+ };
38
+ export declare const ValidateAccessResponse: {
39
+ encode(message: ValidateAccessResponse, writer?: _m0.Writer): _m0.Writer;
40
+ decode(input: _m0.Reader | Uint8Array, length?: number): ValidateAccessResponse;
17
41
  };
18
- export declare const LoginResponse: {
19
- encode(message: LoginResponse, writer?: _m0.Writer): _m0.Writer;
20
- decode(input: _m0.Reader | Uint8Array, length?: number): LoginResponse;
42
+ export declare const AuthorizeRequest: {
43
+ encode(message: AuthorizeRequest, writer?: _m0.Writer): _m0.Writer;
44
+ decode(input: _m0.Reader | Uint8Array, length?: number): AuthorizeRequest;
45
+ };
46
+ export declare const AuthorizeResponse: {
47
+ encode(message: AuthorizeResponse, writer?: _m0.Writer): _m0.Writer;
48
+ decode(input: _m0.Reader | Uint8Array, length?: number): AuthorizeResponse;
21
49
  };
22
50
  export interface AuthServiceClient {
23
- login(request: LoginRequest): Observable<LoginResponse>;
51
+ validateAccess(request: ValidateAccessRequest): Observable<ValidateAccessResponse>;
52
+ authorize(request: AuthorizeRequest): Observable<AuthorizeResponse>;
24
53
  }
25
54
  export interface AuthServiceController {
26
- login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
55
+ validateAccess(request: ValidateAccessRequest): Promise<ValidateAccessResponse> | Observable<ValidateAccessResponse> | ValidateAccessResponse;
56
+ authorize(request: AuthorizeRequest): Promise<AuthorizeResponse> | Observable<AuthorizeResponse> | AuthorizeResponse;
27
57
  }
28
58
  export declare function AuthServiceControllerMethods(): (constructor: Function) => void;
29
59
  export declare const AUTH_SERVICE_NAME = "AuthService";
30
60
  export type AuthServiceService = typeof AuthServiceService;
31
61
  export declare const AuthServiceService: {
32
- readonly login: {
33
- readonly path: "/aegis.auth.v1.AuthService/Login";
62
+ readonly validateAccess: {
63
+ readonly path: "/aegis.auth.v1.AuthService/ValidateAccess";
64
+ readonly requestStream: false;
65
+ readonly responseStream: false;
66
+ readonly requestSerialize: (value: ValidateAccessRequest) => Buffer<ArrayBuffer>;
67
+ readonly requestDeserialize: (value: Buffer) => ValidateAccessRequest;
68
+ readonly responseSerialize: (value: ValidateAccessResponse) => Buffer<ArrayBuffer>;
69
+ readonly responseDeserialize: (value: Buffer) => ValidateAccessResponse;
70
+ };
71
+ readonly authorize: {
72
+ readonly path: "/aegis.auth.v1.AuthService/Authorize";
34
73
  readonly requestStream: false;
35
74
  readonly responseStream: false;
36
- readonly requestSerialize: (value: LoginRequest) => Buffer<ArrayBuffer>;
37
- readonly requestDeserialize: (value: Buffer) => LoginRequest;
38
- readonly responseSerialize: (value: LoginResponse) => Buffer<ArrayBuffer>;
39
- readonly responseDeserialize: (value: Buffer) => LoginResponse;
75
+ readonly requestSerialize: (value: AuthorizeRequest) => Buffer<ArrayBuffer>;
76
+ readonly requestDeserialize: (value: Buffer) => AuthorizeRequest;
77
+ readonly responseSerialize: (value: AuthorizeResponse) => Buffer<ArrayBuffer>;
78
+ readonly responseDeserialize: (value: Buffer) => AuthorizeResponse;
40
79
  };
41
80
  };
42
81
  export interface AuthServiceServer extends UntypedServiceImplementation {
43
- login: handleUnaryCall<LoginRequest, LoginResponse>;
82
+ validateAccess: handleUnaryCall<ValidateAccessRequest, ValidateAccessResponse>;
83
+ authorize: handleUnaryCall<AuthorizeRequest, AuthorizeResponse>;
44
84
  }
45
85
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../../src/gen/auth/v1/auth.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAEnF,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,0BAA0B,kBAAkB,CAAC;AAM1D,eAAO,MAAM,YAAY;oBACP,YAAY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  export const protobufPackage = "aegis.auth.v1";
9
9
  export const AEGIS_AUTH_V1_PACKAGE_NAME = "aegis.auth.v1";
10
- function createBaseLoginRequest() {
11
- return { username: "", password: "" };
10
+ function createBaseAuthContext() {
11
+ return { userId: "", email: "", sessionId: "", displayName: "" };
12
12
  }
13
- export const LoginRequest = {
13
+ export const AuthContext = {
14
14
  encode(message, writer = _m0.Writer.create()) {
15
- if (message.username !== "") {
16
- writer.uint32(10).string(message.username);
15
+ if (message.userId !== "") {
16
+ writer.uint32(10).string(message.userId);
17
17
  }
18
- if (message.password !== "") {
19
- writer.uint32(18).string(message.password);
18
+ if (message.email !== "") {
19
+ writer.uint32(18).string(message.email);
20
+ }
21
+ if (message.sessionId !== "") {
22
+ writer.uint32(26).string(message.sessionId);
23
+ }
24
+ if (message.displayName !== "") {
25
+ writer.uint32(34).string(message.displayName);
20
26
  }
21
27
  return writer;
22
28
  },
23
29
  decode(input, length) {
24
30
  const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
25
31
  let end = length === undefined ? reader.len : reader.pos + length;
26
- const message = createBaseLoginRequest();
32
+ const message = createBaseAuthContext();
27
33
  while (reader.pos < end) {
28
34
  const tag = reader.uint32();
29
35
  switch (tag >>> 3) {
@@ -31,13 +37,25 @@ export const LoginRequest = {
31
37
  if (tag !== 10) {
32
38
  break;
33
39
  }
34
- message.username = reader.string();
40
+ message.userId = reader.string();
35
41
  continue;
36
42
  case 2:
37
43
  if (tag !== 18) {
38
44
  break;
39
45
  }
40
- message.password = reader.string();
46
+ message.email = reader.string();
47
+ continue;
48
+ case 3:
49
+ if (tag !== 26) {
50
+ break;
51
+ }
52
+ message.sessionId = reader.string();
53
+ continue;
54
+ case 4:
55
+ if (tag !== 34) {
56
+ break;
57
+ }
58
+ message.displayName = reader.string();
41
59
  continue;
42
60
  }
43
61
  if ((tag & 7) === 4 || tag === 0) {
@@ -48,23 +66,26 @@ export const LoginRequest = {
48
66
  return message;
49
67
  },
50
68
  };
51
- function createBaseLoginResponse() {
52
- return { accessToken: "", refreshToken: "" };
69
+ function createBaseValidateAccessRequest() {
70
+ return { ip: "", userAgent: "", accessToken: "" };
53
71
  }
54
- export const LoginResponse = {
72
+ export const ValidateAccessRequest = {
55
73
  encode(message, writer = _m0.Writer.create()) {
56
- if (message.accessToken !== "") {
57
- writer.uint32(10).string(message.accessToken);
74
+ if (message.ip !== "") {
75
+ writer.uint32(10).string(message.ip);
58
76
  }
59
- if (message.refreshToken !== "") {
60
- writer.uint32(18).string(message.refreshToken);
77
+ if (message.userAgent !== "") {
78
+ writer.uint32(18).string(message.userAgent);
79
+ }
80
+ if (message.accessToken !== "") {
81
+ writer.uint32(26).string(message.accessToken);
61
82
  }
62
83
  return writer;
63
84
  },
64
85
  decode(input, length) {
65
86
  const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
66
87
  let end = length === undefined ? reader.len : reader.pos + length;
67
- const message = createBaseLoginResponse();
88
+ const message = createBaseValidateAccessRequest();
68
89
  while (reader.pos < end) {
69
90
  const tag = reader.uint32();
70
91
  switch (tag >>> 3) {
@@ -72,13 +93,142 @@ export const LoginResponse = {
72
93
  if (tag !== 10) {
73
94
  break;
74
95
  }
96
+ message.ip = reader.string();
97
+ continue;
98
+ case 2:
99
+ if (tag !== 18) {
100
+ break;
101
+ }
102
+ message.userAgent = reader.string();
103
+ continue;
104
+ case 3:
105
+ if (tag !== 26) {
106
+ break;
107
+ }
75
108
  message.accessToken = reader.string();
76
109
  continue;
110
+ }
111
+ if ((tag & 7) === 4 || tag === 0) {
112
+ break;
113
+ }
114
+ reader.skipType(tag & 7);
115
+ }
116
+ return message;
117
+ },
118
+ };
119
+ function createBaseValidateAccessResponse() {
120
+ return { valid: false, reason: "" };
121
+ }
122
+ export const ValidateAccessResponse = {
123
+ encode(message, writer = _m0.Writer.create()) {
124
+ if (message.valid !== false) {
125
+ writer.uint32(8).bool(message.valid);
126
+ }
127
+ if (message.reason !== "") {
128
+ writer.uint32(18).string(message.reason);
129
+ }
130
+ if (message.context !== undefined) {
131
+ AuthContext.encode(message.context, writer.uint32(26).fork()).ldelim();
132
+ }
133
+ return writer;
134
+ },
135
+ decode(input, length) {
136
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
137
+ let end = length === undefined ? reader.len : reader.pos + length;
138
+ const message = createBaseValidateAccessResponse();
139
+ while (reader.pos < end) {
140
+ const tag = reader.uint32();
141
+ switch (tag >>> 3) {
142
+ case 1:
143
+ if (tag !== 8) {
144
+ break;
145
+ }
146
+ message.valid = reader.bool();
147
+ continue;
148
+ case 2:
149
+ if (tag !== 18) {
150
+ break;
151
+ }
152
+ message.reason = reader.string();
153
+ continue;
154
+ case 3:
155
+ if (tag !== 26) {
156
+ break;
157
+ }
158
+ message.context = AuthContext.decode(reader, reader.uint32());
159
+ continue;
160
+ }
161
+ if ((tag & 7) === 4 || tag === 0) {
162
+ break;
163
+ }
164
+ reader.skipType(tag & 7);
165
+ }
166
+ return message;
167
+ },
168
+ };
169
+ function createBaseAuthorizeRequest() {
170
+ return {};
171
+ }
172
+ export const AuthorizeRequest = {
173
+ encode(message, writer = _m0.Writer.create()) {
174
+ if (message.context !== undefined) {
175
+ AuthContext.encode(message.context, writer.uint32(10).fork()).ldelim();
176
+ }
177
+ return writer;
178
+ },
179
+ decode(input, length) {
180
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
181
+ let end = length === undefined ? reader.len : reader.pos + length;
182
+ const message = createBaseAuthorizeRequest();
183
+ while (reader.pos < end) {
184
+ const tag = reader.uint32();
185
+ switch (tag >>> 3) {
186
+ case 1:
187
+ if (tag !== 10) {
188
+ break;
189
+ }
190
+ message.context = AuthContext.decode(reader, reader.uint32());
191
+ continue;
192
+ }
193
+ if ((tag & 7) === 4 || tag === 0) {
194
+ break;
195
+ }
196
+ reader.skipType(tag & 7);
197
+ }
198
+ return message;
199
+ },
200
+ };
201
+ function createBaseAuthorizeResponse() {
202
+ return { allowed: false, reason: "" };
203
+ }
204
+ export const AuthorizeResponse = {
205
+ encode(message, writer = _m0.Writer.create()) {
206
+ if (message.allowed !== false) {
207
+ writer.uint32(8).bool(message.allowed);
208
+ }
209
+ if (message.reason !== "") {
210
+ writer.uint32(18).string(message.reason);
211
+ }
212
+ return writer;
213
+ },
214
+ decode(input, length) {
215
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
216
+ let end = length === undefined ? reader.len : reader.pos + length;
217
+ const message = createBaseAuthorizeResponse();
218
+ while (reader.pos < end) {
219
+ const tag = reader.uint32();
220
+ switch (tag >>> 3) {
221
+ case 1:
222
+ if (tag !== 8) {
223
+ break;
224
+ }
225
+ message.allowed = reader.bool();
226
+ continue;
77
227
  case 2:
78
228
  if (tag !== 18) {
79
229
  break;
80
230
  }
81
- message.refreshToken = reader.string();
231
+ message.reason = reader.string();
82
232
  continue;
83
233
  }
84
234
  if ((tag & 7) === 4 || tag === 0) {
@@ -91,7 +241,7 @@ export const LoginResponse = {
91
241
  };
92
242
  export function AuthServiceControllerMethods() {
93
243
  return function (constructor) {
94
- const grpcMethods = ["login"];
244
+ const grpcMethods = ["validateAccess", "authorize"];
95
245
  for (const method of grpcMethods) {
96
246
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
97
247
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -105,13 +255,22 @@ export function AuthServiceControllerMethods() {
105
255
  }
106
256
  export const AUTH_SERVICE_NAME = "AuthService";
107
257
  export const AuthServiceService = {
108
- login: {
109
- path: "/aegis.auth.v1.AuthService/Login",
258
+ validateAccess: {
259
+ path: "/aegis.auth.v1.AuthService/ValidateAccess",
260
+ requestStream: false,
261
+ responseStream: false,
262
+ requestSerialize: (value) => Buffer.from(ValidateAccessRequest.encode(value).finish()),
263
+ requestDeserialize: (value) => ValidateAccessRequest.decode(value),
264
+ responseSerialize: (value) => Buffer.from(ValidateAccessResponse.encode(value).finish()),
265
+ responseDeserialize: (value) => ValidateAccessResponse.decode(value),
266
+ },
267
+ authorize: {
268
+ path: "/aegis.auth.v1.AuthService/Authorize",
110
269
  requestStream: false,
111
270
  responseStream: false,
112
- requestSerialize: (value) => Buffer.from(LoginRequest.encode(value).finish()),
113
- requestDeserialize: (value) => LoginRequest.decode(value),
114
- responseSerialize: (value) => Buffer.from(LoginResponse.encode(value).finish()),
115
- responseDeserialize: (value) => LoginResponse.decode(value),
271
+ requestSerialize: (value) => Buffer.from(AuthorizeRequest.encode(value).finish()),
272
+ requestDeserialize: (value) => AuthorizeRequest.decode(value),
273
+ responseSerialize: (value) => Buffer.from(AuthorizeResponse.encode(value).finish()),
274
+ responseDeserialize: (value) => AuthorizeResponse.decode(value),
116
275
  },
117
276
  };
package/dist/src/index.js CHANGED
@@ -8,8 +8,6 @@ npm i
8
8
  npm run gen
9
9
  npm build
10
10
 
11
- # login and publish (scoped public package)
12
-
13
11
  npm login
14
12
  npm publish --access public
15
13
 
@@ -24,37 +22,3 @@ npm i @acequants/aegis-contracts @grpc/grpc-js protobufjs
24
22
  //registry.npmjs.org/:_authToken=${NPM_TOKEN}
25
23
 
26
24
  */
27
- /*
28
-
29
- Usage
30
-
31
- Generate TS stubs:
32
-
33
- pnpm gen
34
-
35
-
36
- Build:
37
-
38
- pnpm build
39
-
40
-
41
- Publish privately (npm org must be private):
42
-
43
- npm publish --access restricted
44
-
45
-
46
- Consumers install:
47
-
48
- npm install @acequants/contracts
49
-
50
-
51
- Import in services:
52
-
53
- import { userV1 } from "@acequants/contracts";
54
-
55
- const client = new userV1.UserServiceClient(
56
- "localhost:50051",
57
- credentials.createInsecure()
58
- );
59
-
60
- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acequants/aegis-contracts",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -4,18 +4,35 @@ package aegis.auth.v1;
4
4
 
5
5
  option java_multiple_files = true;
6
6
 
7
- // ---- Messages ----
8
- message LoginRequest {
9
- string username = 1;
10
- string password = 2;
7
+ service AuthService {
8
+ rpc ValidateAccess (ValidateAccessRequest) returns (ValidateAccessResponse);
9
+ rpc Authorize (AuthorizeRequest) returns (AuthorizeResponse);
11
10
  }
12
11
 
13
- message LoginResponse {
14
- string accessToken = 1;
15
- string refreshToken = 2;
12
+ message AuthContext {
13
+ string user_id = 1;
14
+ string email = 2;
15
+ string session_id = 3;
16
+ string display_name = 4;
16
17
  }
17
18
 
18
- // ---- Service ----
19
- service AuthService {
20
- rpc Login (LoginRequest) returns (LoginResponse);
19
+ message ValidateAccessRequest {
20
+ string ip = 1;
21
+ string user_agent = 2;
22
+ string access_token = 3;
23
+ }
24
+
25
+ message ValidateAccessResponse {
26
+ bool valid = 1;
27
+ string reason = 2; // "expired", "revoked", etc.
28
+ AuthContext context = 3;
21
29
  }
30
+
31
+ message AuthorizeRequest {
32
+ AuthContext context = 1;
33
+ }
34
+
35
+ message AuthorizeResponse {
36
+ bool allowed = 1;
37
+ string reason = 2;
38
+ }