@owlmeans/server-auth 0.1.2 → 0.1.3

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.
Files changed (54) hide show
  1. package/README.md +33 -454
  2. package/build/actions/service.d.ts +2 -2
  3. package/build/actions/service.d.ts.map +1 -1
  4. package/build/actions/service.js.map +1 -1
  5. package/build/manager/actions/manager.d.ts +4 -4
  6. package/build/manager/actions/manager.d.ts.map +1 -1
  7. package/build/manager/actions/manager.js.map +1 -1
  8. package/build/manager/exports.d.ts +4 -4
  9. package/build/manager/exports.d.ts.map +1 -1
  10. package/build/manager/exports.js +2 -2
  11. package/build/manager/exports.js.map +1 -1
  12. package/build/manager/main.js +1 -1
  13. package/build/manager/main.js.map +1 -1
  14. package/build/manager/model.js +2 -2
  15. package/build/manager/model.js.map +1 -1
  16. package/build/manager/modules.d.ts +1 -1
  17. package/build/manager/modules.d.ts.map +1 -1
  18. package/build/manager/modules.js +3 -3
  19. package/build/manager/modules.js.map +1 -1
  20. package/build/manager/plugins/re-captcha.js +3 -3
  21. package/build/manager/plugins/re-captcha.js.map +1 -1
  22. package/build/manager/plugins/types.d.ts +1 -1
  23. package/build/manager/plugins/types.d.ts.map +1 -1
  24. package/build/manager/plugins/utils.d.ts +1 -1
  25. package/build/manager/plugins/utils.d.ts.map +1 -1
  26. package/build/manager/plugins/utils.js +2 -2
  27. package/build/manager/plugins/utils.js.map +1 -1
  28. package/build/manager/types.d.ts +1 -1
  29. package/build/manager/types.d.ts.map +1 -1
  30. package/build/modules.d.ts +2 -2
  31. package/build/modules.d.ts.map +1 -1
  32. package/build/modules.js +2 -2
  33. package/build/modules.js.map +1 -1
  34. package/build/types.d.ts +1 -1
  35. package/build/types.d.ts.map +1 -1
  36. package/package.json +30 -26
  37. package/src/actions/service.ts +2 -2
  38. package/src/manager/actions/manager.ts +4 -4
  39. package/src/manager/exports.ts +4 -4
  40. package/src/manager/main.ts +1 -1
  41. package/src/manager/model.ts +2 -2
  42. package/src/manager/modules.ts +3 -3
  43. package/src/manager/plugins/re-captcha.ts +4 -4
  44. package/src/manager/plugins/types.ts +1 -1
  45. package/src/manager/plugins/utils.ts +2 -2
  46. package/src/manager/rely.ts +1 -1
  47. package/src/manager/types.ts +1 -1
  48. package/src/modules.ts +5 -5
  49. package/src/service.ts +1 -1
  50. package/src/types.ts +1 -1
  51. package/tests/context.ts +59 -0
  52. package/tests/service.spec.ts +174 -0
  53. package/tests/tsconfig.json +12 -0
  54. package/tsconfig.json +6 -5
@@ -1 +1 @@
1
- {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../src/manager/modules.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,OAAO,2CAAO,CAAA"}
1
+ {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../src/manager/modules.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,OAAO,mDAAO,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import { AUTHEN, AUTHEN_AUTHEN, AUTHEN_INIT, AUTHEN_RELY, MOD_RECAPTCHA } from '@owlmeans/auth';
2
2
  import { modules as list } from '@owlmeans/auth-common';
3
3
  import { modules as apiConfig } from '@owlmeans/api-config-server';
4
- import { elevate, guard } from '@owlmeans/server-module';
4
+ import { elevate, guard } from '@owlmeans/server-entrypoint';
5
5
  import * as actions from './actions/index.js';
6
- import { module } from '@owlmeans/client-module';
6
+ import { entrypoint } from '@owlmeans/client-entrypoint';
7
7
  import { backend, route, RouteMethod } from '@owlmeans/route';
8
8
  import { handleIntermediate } from '@owlmeans/server-api';
9
9
  import { DEFAULT_RELY } from './consts.js';
@@ -13,7 +13,7 @@ elevate(list, AUTHEN_AUTHEN, actions.authenticate);
13
13
  elevate(list, AUTHEN_RELY, actions.rely, guard(DEFAULT_RELY));
14
14
  export const modules = list;
15
15
  list.push(...apiConfig);
16
- list.push(module(route(MOD_RECAPTCHA, '/api/siteverify', backend({
16
+ list.push(entrypoint(route(MOD_RECAPTCHA, '/api/siteverify', backend({
17
17
  host: 'https://www.google.com',
18
18
  base: 'recaptcha',
19
19
  secure: true,
@@ -1 +1 @@
1
- {"version":3,"file":"modules.js","sourceRoot":"","sources":["../../src/manager/modules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC/F,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,kBAAkB,CACtC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,OAAO,CAAC,aAAa,EAAoB,CACtE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;AAC1B,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAA;AACtD,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;AAClD,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;AAE7D,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAA;AAC3B,IAAI,CAAC,IAAI,CAAC,GAAG,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,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;AAE7D,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAA;AAC3B,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAA;AACvB,IAAI,CAAC,IAAI,CACP,UAAU,CACR,KAAK,CAAC,aAAa,EAAE,iBAAiB,EAAE,OAAO,CAAC;IAC9C,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,IAAI;CACb,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CACtB,CACF,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { AuthenFailed, AuthenticationType, AuthPluginError, MOD_RECAPTCHA, AUTH_SCOPE, AuthRole } from '@owlmeans/auth';
2
2
  import { PLUGINS } from '@owlmeans/config';
3
3
  import { PluginMissconfigured } from '@owlmeans/config';
4
- import { ModuleOutcome } from '@owlmeans/module';
4
+ import { EntrypointOutcome } from '@owlmeans/entrypoint';
5
5
  import { base64 } from '@scure/base';
6
6
  import { randomBytes } from '@noble/hashes/utils';
7
7
  import { assertType } from './utils.js';
@@ -19,7 +19,7 @@ export const reCaptcha = (context) => {
19
19
  if (config.value == null) {
20
20
  throw new PluginMissconfigured('value');
21
21
  }
22
- const validateRecaptcha = context.module(MOD_RECAPTCHA);
22
+ const validateRecaptcha = context.entrypoint(MOD_RECAPTCHA);
23
23
  const [result, status] = await validateRecaptcha.call({
24
24
  body: {
25
25
  secret: config.value,
@@ -27,7 +27,7 @@ export const reCaptcha = (context) => {
27
27
  },
28
28
  headers: { 'content-type': 'application/x-www-form-urlencoded' }
29
29
  });
30
- if (status !== ModuleOutcome.Ok) {
30
+ if (status !== EntrypointOutcome.Ok) {
31
31
  throw new AuthPluginError('recaptcha:api');
32
32
  }
33
33
  if (!result.success) {
@@ -1 +1 @@
1
- {"version":3,"file":"re-captcha.js","sourceRoot":"","sources":["../../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,EAAE,UAAU,CAAC,UAAU;iBAChC;gBACD,OAAO,EAAE,EAAE,cAAc,EAAE,mCAAmC,EAAE;aACjE,CAAC,CAAA;YACF,IAAI,MAAM,KAAK,iBAAiB,CAAC,EAAE,EAAE,CAAC;gBACpC,MAAM,IAAI,eAAe,CAAC,eAAe,CAAC,CAAA;YAC5C,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,IAAI,YAAY,CAAC,YAAY,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,CAAC,CAAA;YACxF,CAAC;YAED,UAAU,CAAC,MAAM,GAAG,CAAC,UAAU,CAAC,CAAA;YAChC,UAAU,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAA;YAChC,UAAU,CAAC,IAAI,GAAG,kBAAkB,CAAC,SAAS,CAAA;YAE9C,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAiC,CAAA;YAC7F,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;gBACtB,UAAU,CAAC,SAAS,GAAG,QAAQ,CAAA;gBAE/B,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;YAC5B,CAAC;YAED,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;QACtB,CAAC;KACF,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import type { AllowanceResponse } from '@owlmeans/auth';
2
2
  import type { AuthModel } from '../types.js';
3
- import type { AbstractRequest } from '@owlmeans/module';
3
+ import type { AbstractRequest } from '@owlmeans/entrypoint';
4
4
  import type { RedisResource } from '@owlmeans/redis-resource';
5
5
  import type { ResourceRecord } from '@owlmeans/resource';
6
6
  export interface AuthPlugin extends Omit<AuthModel, "rely"> {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;IACzD,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CACzB;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe,CAAC;IACxD,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAC;CAAI;AAEN,MAAM,WAAW,UAAW,SAAQ,cAAc,EAAE,iBAAiB;CACpE;AAED,MAAM,WAAW,iBAAkB,SAAQ,aAAa,CAAC,UAAU,CAAC;CAAG"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;IACzD,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CACzB;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe,CAAC;IACxD,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAC;CAAI;AAEN,MAAM,WAAW,UAAW,SAAQ,cAAc,EAAE,iBAAiB;CACpE;AAED,MAAM,WAAW,iBAAkB,SAAQ,aAAa,CAAC,UAAU,CAAC;CAAG"}
@@ -4,5 +4,5 @@ export declare const assertType: (type: string, plugin: AuthPlugin) => void;
4
4
  /**
5
5
  * @throws {AuthUnknown}
6
6
  */
7
- export declare const getPlugin: (type: string, context: AppContext<AppConfig>) => AuthPlugin;
7
+ export declare const getPlugin: (type: string, context: AppContext<AppConfig>) => Promise<AuthPlugin>;
8
8
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAExD,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,EAAE,QAAQ,UAAU,SAI1D,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,SAAS,UAAU,CAAC,SAAS,CAAC,KAAG,UAMxE,CAAA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAExD,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,EAAE,QAAQ,UAAU,SAI1D,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,GAAU,MAAM,MAAM,EAAE,SAAS,UAAU,CAAC,SAAS,CAAC,KAAG,OAAO,CAAC,UAAU,CAOhG,CAAA"}
@@ -1,5 +1,4 @@
1
1
  import { AuthUnknown, TypeMissmatchError } from '@owlmeans/auth';
2
- import { plugins } from './index.js';
3
2
  export const assertType = (type, plugin) => {
4
3
  if (type !== plugin.type) {
5
4
  throw new TypeMissmatchError(plugin.type);
@@ -8,7 +7,8 @@ export const assertType = (type, plugin) => {
8
7
  /**
9
8
  * @throws {AuthUnknown}
10
9
  */
11
- export const getPlugin = (type, context) => {
10
+ export const getPlugin = async (type, context) => {
11
+ const { plugins } = await import('./index.js');
12
12
  const plugin = plugins[type];
13
13
  if (plugin == null) {
14
14
  throw new AuthUnknown(type);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/manager/plugins/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGpC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,MAAkB,EAAE,EAAE;IAC7D,IAAI,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;QACzB,MAAM,IAAI,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC3C,CAAC;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,OAA8B,EAAc,EAAE;IACpF,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAA;AAC/B,CAAC,CAAA"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/manager/plugins/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAIhE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,MAAkB,EAAE,EAAE;IAC7D,IAAI,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;QACzB,MAAM,IAAI,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC3C,CAAC;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,IAAY,EAAE,OAA8B,EAAuB,EAAE;IACnG,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAA;IAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAA;AAC/B,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import type { AllowanceRequest, AllowanceResponse, Auth, AuthCredentials, AuthToken, RelyToken } from '@owlmeans/auth';
2
2
  import type { KlusterConfig } from '@owlmeans/kluster';
3
- import type { GuardService } from '@owlmeans/module';
3
+ import type { GuardService } from '@owlmeans/entrypoint';
4
4
  import type { ApiServerAppend } from '@owlmeans/server-api';
5
5
  import type { ServerContext, ServerConfig } from '@owlmeans/server-context';
6
6
  import type { ServiceRoute } from '@owlmeans/server-route';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACtH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAErE,MAAM,WAAW,SAAU,SAAQ,YAAY,EAAE,aAAa;IAC5D,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAE/D,YAAY,EAAE,CAAC,UAAU,EAAE,eAAe,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;IAEjE,IAAI,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAChE;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SA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AM,WAAW,SAAS;IACxB,IAAI,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAE/D,YAAY,EAAE,CAAC,UAAU,EAAE,eAAe,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;IAEjE,IAAI,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAChE;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC,EACjF,eAAe,EACf,oBAAoB;CAAI;AAE5B,MAAM,WAAW,WAAY,SAAQ,YAAY;CAChD;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,WAAW,CAAC,EAAE,UAAU,CAAA;IACxB,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACtE;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,SAAS,CAAA;CAChB"}
@@ -1,3 +1,3 @@
1
- import type { ServerModule } from '@owlmeans/server-module';
2
- export declare const modules: ServerModule<unknown>[];
1
+ import type { ServerEntrypoint } from '@owlmeans/server-entrypoint';
2
+ export declare const modules: ServerEntrypoint<unknown>[];
3
3
  //# sourceMappingURL=modules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAO3D,eAAO,MAAM,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,EAK1C,CAAA"}
1
+ {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAOnE,eAAO,MAAM,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAK9C,CAAA"}
package/build/modules.js CHANGED
@@ -1,8 +1,8 @@
1
- import { elevate } from '@owlmeans/server-module';
1
+ import { elevate } from '@owlmeans/server-entrypoint';
2
2
  import { modules as list } from '@owlmeans/auth-common';
3
3
  import { DISPATCHER, DISPATCHER_AUTHEN } from '@owlmeans/auth';
4
4
  import { authenticate } from './actions/service.js';
5
- import { stab, elevate as celevate } from '@owlmeans/client-module';
5
+ import { stab, elevate as celevate } from '@owlmeans/client-entrypoint';
6
6
  elevate(list, DISPATCHER_AUTHEN, authenticate);
7
7
  celevate(list, DISPATCHER, stab);
8
8
  export const modules = [
@@ -1 +1 @@
1
- {"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEnE,OAAO,CAAC,IAAI,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAA;AAC9C,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;AAEhC,MAAM,CAAC,MAAM,OAAO,GAA4B;IAC9C,GAAG,IAAI,CAAC,MAAM,CACZ,CAAC,MAAM,EAAmC,EAAE,CAC1C,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAC9D;CACF,CAAA"}
1
+ {"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAEvE,OAAO,CAAC,IAAI,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAA;AAC9C,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;AAEhC,MAAM,CAAC,MAAM,OAAO,GAAgC;IAClD,GAAG,IAAI,CAAC,MAAM,CACZ,CAAC,MAAM,EAAuC,EAAE,CAC9C,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAC9D;CACF,CAAA"}
package/build/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Auth, AuthToken } from '@owlmeans/auth';
2
- import type { GuardService } from '@owlmeans/module';
2
+ import type { GuardService } from '@owlmeans/entrypoint';
3
3
  import type { ResourceRecord } from '@owlmeans/resource';
4
4
  export interface AuthService extends GuardService {
5
5
  authenticate: (token: AuthToken) => Promise<AuthToken>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;IACtD,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACzC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,WAAW,CAAA;CACxB;AAED,MAAM,WAAW,SAAU,SAAQ,cAAc;CAChD"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;IACtD,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACzC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,WAAW,CAAA;CACxB;AAED,MAAM,WAAW,SAAU,SAAQ,cAAc;CAChD"}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@owlmeans/server-auth",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsc -b",
8
8
  "dev": "sleep 276 && nodemon -e ts,tsx,json --watch src --exec \"tsc -p ./tsconfig.json\"",
9
- "watch": "tsc -b -w --preserveWatchOutput --pretty"
9
+ "watch": "tsc -b -w --preserveWatchOutput --pretty",
10
+ "test": "bun test ./tests"
10
11
  },
11
12
  "main": "build/index.js",
12
13
  "module": "build/index.js",
@@ -36,39 +37,42 @@
36
37
  },
37
38
  "dependencies": {
38
39
  "@noble/hashes": "^1.5.0",
39
- "@owlmeans/api": "^0.1.2",
40
- "@owlmeans/api-config-server": "^0.1.2",
41
- "@owlmeans/auth": "^0.1.2",
42
- "@owlmeans/auth-common": "^0.1.2",
43
- "@owlmeans/basic-envelope": "^0.1.2",
44
- "@owlmeans/basic-ids": "^0.1.2",
45
- "@owlmeans/basic-keys": "^0.1.2",
46
- "@owlmeans/client-config": "^0.1.2",
47
- "@owlmeans/client-module": "^0.1.2",
48
- "@owlmeans/config": "^0.1.2",
49
- "@owlmeans/context": "^0.1.2",
50
- "@owlmeans/kluster": "^0.1.2",
51
- "@owlmeans/module": "^0.1.2",
52
- "@owlmeans/redis-resource": "^0.1.2",
53
- "@owlmeans/resource": "^0.1.2",
54
- "@owlmeans/route": "^0.1.2",
55
- "@owlmeans/server-api": "^0.1.2",
56
- "@owlmeans/server-context": "^0.1.2",
57
- "@owlmeans/server-module": "^0.1.2",
58
- "@owlmeans/server-route": "^0.1.2",
59
- "@owlmeans/server-socket": "^0.1.2",
60
- "@owlmeans/socket": "^0.1.2",
61
- "@owlmeans/static-resource": "^0.1.2",
40
+ "@owlmeans/api": "^0.1.3",
41
+ "@owlmeans/api-config-server": "^0.1.3",
42
+ "@owlmeans/auth": "^0.1.3",
43
+ "@owlmeans/auth-common": "^0.1.3",
44
+ "@owlmeans/basic-envelope": "^0.1.3",
45
+ "@owlmeans/basic-ids": "^0.1.3",
46
+ "@owlmeans/basic-keys": "^0.1.3",
47
+ "@owlmeans/client-config": "^0.1.3",
48
+ "@owlmeans/client-entrypoint": "^0.1.3",
49
+ "@owlmeans/config": "^0.1.3",
50
+ "@owlmeans/context": "^0.1.3",
51
+ "@owlmeans/kluster": "^0.1.3",
52
+ "@owlmeans/entrypoint": "^0.1.3",
53
+ "@owlmeans/redis-resource": "^0.1.3",
54
+ "@owlmeans/resource": "^0.1.3",
55
+ "@owlmeans/route": "^0.1.3",
56
+ "@owlmeans/server-api": "^0.1.3",
57
+ "@owlmeans/server-context": "^0.1.3",
58
+ "@owlmeans/server-entrypoint": "^0.1.3",
59
+ "@owlmeans/server-route": "^0.1.3",
60
+ "@owlmeans/server-socket": "^0.1.3",
61
+ "@owlmeans/socket": "^0.1.3",
62
+ "@owlmeans/static-resource": "^0.1.3",
62
63
  "@scure/base": "^1.1.9"
63
64
  },
64
65
  "peerDependencies": {
65
66
  "ajv": "*"
66
67
  },
67
68
  "devDependencies": {
69
+ "@owlmeans/dep-config": "workspace:*",
70
+ "@owlmeans/test-auth": "^0.1.2",
71
+ "@types/bun": "^1.3.0",
68
72
  "@types/node": "^24.10.1",
69
73
  "nodemon": "^3.1.11",
70
74
  "npm-check": "^6.0.1",
71
- "typescript": "^5.8.3"
75
+ "typescript": "^6.0.2"
72
76
  },
73
77
  "publishConfig": {
74
78
  "access": "public"
@@ -1,4 +1,4 @@
1
- import type { RefedModuleHandler } from '@owlmeans/server-module'
1
+ import type { RefedEntrypointHandler } from '@owlmeans/server-entrypoint'
2
2
  import type { AuthToken } from '@owlmeans/auth'
3
3
  import { handleBody } from '@owlmeans/server-api'
4
4
  import { AuthServiceAppend } from '../types.js'
@@ -8,7 +8,7 @@ import { assertContext } from '@owlmeans/context'
8
8
  type Config = ServerConfig
9
9
  type Context = ServerContext<Config> & AuthServiceAppend
10
10
 
11
- export const authenticate: RefedModuleHandler<AuthToken> = handleBody(
11
+ export const authenticate: RefedEntrypointHandler<AuthToken> = handleBody(
12
12
  async (payload: AuthToken, ctx) => {
13
13
  const context = assertContext(ctx, 'authenticate') as Context
14
14
  return await context.auth().authenticate(payload)
@@ -1,21 +1,21 @@
1
1
  import type { AllowanceRequest, AuthCredentials } from '@owlmeans/auth'
2
2
  import { handleBody } from '@owlmeans/server-api'
3
3
  import { makeAuthModel } from '../model.js'
4
- import type { RefedModuleHandler } from '@owlmeans/server-module'
4
+ import type { RefedEntrypointHandler } from '@owlmeans/server-entrypoint'
5
5
  import type { AppContext, AppConfig } from '../types.js'
6
6
  import { handleConnection } from '@owlmeans/server-socket'
7
7
 
8
- export const authenticationInit: RefedModuleHandler<AllowanceRequest> = handleBody(
8
+ export const authenticationInit: RefedEntrypointHandler<AllowanceRequest> = handleBody(
9
9
  async (payload: AllowanceRequest, ctx) =>
10
10
  await makeAuthModel(ctx as AppContext<AppConfig>).init(payload)
11
11
  )
12
12
 
13
- export const authenticate: RefedModuleHandler<AuthCredentials> = handleBody(
13
+ export const authenticate: RefedEntrypointHandler<AuthCredentials> = handleBody(
14
14
  async (payload: AuthCredentials, ctx) =>
15
15
  await makeAuthModel(ctx as AppContext<AppConfig>).authenticate(payload)
16
16
  )
17
17
 
18
- export const rely: RefedModuleHandler<void> = handleConnection(
18
+ export const rely: RefedEntrypointHandler<void> = handleConnection(
19
19
  // @TODO Request will contain information is there requrest
20
20
  // privileged or not (privileged request implies auth provider)
21
21
  async (conn, ctx, req) =>
@@ -5,11 +5,11 @@ export { addWebService } from '@owlmeans/client-config'
5
5
  export { service, TRUSTED } from '@owlmeans/config'
6
6
  export { AppType, assertContext } from '@owlmeans/context'
7
7
  export { klusterize } from '@owlmeans/kluster'
8
- export { elevate } from '@owlmeans/server-module'
9
- export { elevate as celevate, stab } from '@owlmeans/client-module'
10
- export type { RefedModuleHandler } from '@owlmeans/server-module'
8
+ export { elevate } from '@owlmeans/server-entrypoint'
9
+ export { elevate as celevate, stab } from '@owlmeans/client-entrypoint'
10
+ export type { RefedEntrypointHandler } from '@owlmeans/server-entrypoint'
11
11
  export { handleIntermediate, handleBody, handleRequest, handleParams } from '@owlmeans/server-api'
12
- export type { AbstractRequest, AbstractResponse } from '@owlmeans/module'
12
+ export type { AbstractRequest, AbstractResponse } from '@owlmeans/entrypoint'
13
13
  export { backend } from '@owlmeans/route'
14
14
 
15
15
  export { AUTHEN, AUTHEN_AUTHEN, AUTHEN_INIT } from '@owlmeans/auth'
@@ -3,7 +3,7 @@ import { modules } from './modules.js'
3
3
  import type { AppContext, AppConfig } from './types.js'
4
4
 
5
5
  export const main = async <C extends AppConfig, T extends AppContext<C>>(ctx: T) => {
6
- ctx.registerModules(modules)
6
+ ctx.registerEntrypoints(modules)
7
7
  await ctx.configure().init()
8
8
  await ctx.getApiServer().listen()
9
9
  }
@@ -20,7 +20,7 @@ export const makeAuthModel = (context: AppContext<AppConfig>): AuthModel => {
20
20
 
21
21
  const model: AuthModel = {
22
22
  init: async request => {
23
- const plugin = getPlugin(request.type, context)
23
+ const plugin = await getPlugin(request.type, context)
24
24
  const response = await plugin.init(request)
25
25
 
26
26
  const envelope = makeEnvelopeModel(plugin.type)
@@ -63,7 +63,7 @@ export const makeAuthModel = (context: AppContext<AppConfig>): AuthModel => {
63
63
  throw new AuthenPayloadError('userId')
64
64
  }
65
65
 
66
- const plugin = getPlugin(envelope.type(), context)
66
+ const plugin = await getPlugin(envelope.type(), context)
67
67
 
68
68
  // @TODO this token PROBABLY needs to be registered somewhere and rechecked
69
69
  // from time to time to make sure that the session is not deleted
@@ -2,9 +2,9 @@
2
2
  import { AUTHEN, AUTHEN_AUTHEN, AUTHEN_INIT, AUTHEN_RELY, MOD_RECAPTCHA } from '@owlmeans/auth'
3
3
  import { modules as list } from '@owlmeans/auth-common'
4
4
  import { modules as apiConfig } from '@owlmeans/api-config-server'
5
- import { elevate, guard } from '@owlmeans/server-module'
5
+ import { elevate, guard } from '@owlmeans/server-entrypoint'
6
6
  import * as actions from './actions/index.js'
7
- import { module } from '@owlmeans/client-module'
7
+ import { entrypoint } from '@owlmeans/client-entrypoint'
8
8
  import { backend, route, RouteMethod } from '@owlmeans/route'
9
9
  import { handleIntermediate } from '@owlmeans/server-api'
10
10
  import { DEFAULT_RELY } from './consts.js'
@@ -19,7 +19,7 @@ elevate(list, AUTHEN_RELY, actions.rely, guard(DEFAULT_RELY))
19
19
  export const modules = list
20
20
  list.push(...apiConfig)
21
21
  list.push(
22
- module(
22
+ entrypoint(
23
23
  route(MOD_RECAPTCHA, '/api/siteverify', backend({
24
24
  host: 'https://www.google.com',
25
25
  base: 'recaptcha',
@@ -4,8 +4,8 @@ import type { AuthPlugin, RecaptchaRequest, RecpatchaResponse } from './types.js
4
4
  import { PLUGINS } from '@owlmeans/config'
5
5
  import type { PluginConfig } from '@owlmeans/config'
6
6
  import { PluginMissconfigured } from '@owlmeans/config'
7
- import type { ClientModule } from '@owlmeans/client-module'
8
- import { ModuleOutcome } from '@owlmeans/module'
7
+ import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
8
+ import { EntrypointOutcome } from '@owlmeans/entrypoint'
9
9
  import { base64 } from '@scure/base'
10
10
  import { randomBytes } from '@noble/hashes/utils'
11
11
  import { assertType } from './utils.js'
@@ -28,7 +28,7 @@ export const reCaptcha = <C extends AppConfig, T extends AppContext<C>>(context:
28
28
  if (config.value == null) {
29
29
  throw new PluginMissconfigured('value')
30
30
  }
31
- const validateRecaptcha = context.module<ClientModule<RecpatchaResponse>>(MOD_RECAPTCHA)
31
+ const validateRecaptcha = context.entrypoint<ClientEntrypoint<RecpatchaResponse>>(MOD_RECAPTCHA)
32
32
  const [result, status] = await validateRecaptcha.call<RecpatchaResponse, RecaptchaRequest>({
33
33
  body: {
34
34
  secret: config.value,
@@ -36,7 +36,7 @@ export const reCaptcha = <C extends AppConfig, T extends AppContext<C>>(context:
36
36
  },
37
37
  headers: { 'content-type': 'application/x-www-form-urlencoded' }
38
38
  })
39
- if (status !== ModuleOutcome.Ok) {
39
+ if (status !== EntrypointOutcome.Ok) {
40
40
  throw new AuthPluginError('recaptcha:api')
41
41
  }
42
42
  if (!result.success) {
@@ -1,6 +1,6 @@
1
1
  import type { AllowanceResponse } from '@owlmeans/auth'
2
2
  import type { AuthModel } from '../types.js'
3
- import type { AbstractRequest } from '@owlmeans/module'
3
+ import type { AbstractRequest } from '@owlmeans/entrypoint'
4
4
  import type { RedisResource } from '@owlmeans/redis-resource'
5
5
  import type { ResourceRecord } from '@owlmeans/resource'
6
6
 
@@ -1,6 +1,5 @@
1
1
  import { AuthUnknown, TypeMissmatchError } from '@owlmeans/auth'
2
2
  import type { AuthPlugin } from './types.js'
3
- import { plugins } from './index.js'
4
3
  import type { AppContext, AppConfig } from '../types.js'
5
4
 
6
5
  export const assertType = (type: string, plugin: AuthPlugin) => {
@@ -12,7 +11,8 @@ export const assertType = (type: string, plugin: AuthPlugin) => {
12
11
  /**
13
12
  * @throws {AuthUnknown}
14
13
  */
15
- export const getPlugin = (type: string, context: AppContext<AppConfig>): AuthPlugin => {
14
+ export const getPlugin = async (type: string, context: AppContext<AppConfig>): Promise<AuthPlugin> => {
15
+ const { plugins } = await import('./index.js')
16
16
  const plugin = plugins[type]
17
17
  if (plugin == null) {
18
18
  throw new AuthUnknown(type)
@@ -3,7 +3,7 @@ import { DEFAULT_RELY } from './consts.js'
3
3
  import type { AppContext, RelyService } from './types.js'
4
4
  import { AUTH_QUERY, AuthenFailed, AuthenticationType } from '@owlmeans/auth'
5
5
  import type { Auth, AuthCredentials, AuthToken } from '@owlmeans/auth'
6
- import type { AbstractRequest, AbstractResponse } from '@owlmeans/module'
6
+ import type { AbstractRequest, AbstractResponse } from '@owlmeans/entrypoint'
7
7
  import { EnvelopeKind, makeEnvelopeModel } from '@owlmeans/basic-envelope'
8
8
  import type { ServerConfig, ServerContext } from '@owlmeans/server-context'
9
9
  import { AUTH_CACHE, AUTHEN_TIMEFRAME } from '../consts.js'
@@ -1,6 +1,6 @@
1
1
  import type { AllowanceRequest, AllowanceResponse, Auth, AuthCredentials, AuthToken, RelyToken } from '@owlmeans/auth'
2
2
  import type { KlusterConfig } from '@owlmeans/kluster'
3
- import type { GuardService } from '@owlmeans/module'
3
+ import type { GuardService } from '@owlmeans/entrypoint'
4
4
  import type { ApiServerAppend } from '@owlmeans/server-api'
5
5
  import type { ServerContext, ServerConfig } from '@owlmeans/server-context'
6
6
  import type { ServiceRoute } from '@owlmeans/server-route'
package/src/modules.ts CHANGED
@@ -1,17 +1,17 @@
1
1
 
2
- import { elevate } from '@owlmeans/server-module'
2
+ import { elevate } from '@owlmeans/server-entrypoint'
3
3
  import { modules as list } from '@owlmeans/auth-common'
4
4
  import { DISPATCHER, DISPATCHER_AUTHEN } from '@owlmeans/auth'
5
- import type { ServerModule } from '@owlmeans/server-module'
5
+ import type { ServerEntrypoint } from '@owlmeans/server-entrypoint'
6
6
  import { authenticate } from './actions/service.js'
7
- import { stab, elevate as celevate } from '@owlmeans/client-module'
7
+ import { stab, elevate as celevate } from '@owlmeans/client-entrypoint'
8
8
 
9
9
  elevate(list, DISPATCHER_AUTHEN, authenticate)
10
10
  celevate(list, DISPATCHER, stab)
11
11
 
12
- export const modules: ServerModule<unknown>[] = [
12
+ export const modules: ServerEntrypoint<unknown>[] = [
13
13
  ...list.filter(
14
- (module): module is ServerModule<unknown> =>
14
+ (module): module is ServerEntrypoint<unknown> =>
15
15
  [DISPATCHER, DISPATCHER_AUTHEN].includes(module.getAlias())
16
16
  )
17
17
  ]
package/src/service.ts CHANGED
@@ -6,7 +6,7 @@ import { assertContext, createService } from '@owlmeans/context'
6
6
  import { EnvelopeKind, makeEnvelopeModel } from '@owlmeans/basic-envelope'
7
7
  import type { Auth, AuthCredentials } from '@owlmeans/auth'
8
8
  import { AuthenFailed, AuthorizationError, AuthroizationType } from '@owlmeans/auth'
9
- import type { AbstractRequest, AbstractResponse } from '../../module/build/types.js'
9
+ import type { AbstractRequest, AbstractResponse } from '@owlmeans/entrypoint'
10
10
  import type { Resource } from '@owlmeans/resource'
11
11
  import { createStaticResource } from '@owlmeans/static-resource'
12
12
  import { trust, extractAuthToken } from '@owlmeans/auth-common/utils'
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Auth, AuthToken } from '@owlmeans/auth'
2
- import type { GuardService } from '@owlmeans/module'
2
+ import type { GuardService } from '@owlmeans/entrypoint'
3
3
  import type { ResourceRecord } from '@owlmeans/resource'
4
4
 
5
5
  export interface AuthService extends GuardService {
@@ -0,0 +1,59 @@
1
+ import { AppType, Layer, makeBasicContext } from '@owlmeans/context'
2
+ import type { BasicConfig, BasicContext } from '@owlmeans/context'
3
+ import { createStaticResource } from '@owlmeans/static-resource'
4
+ import { makeMemoryTrustedResource, makeFixtureKeyPair } from '@owlmeans/test-auth'
5
+ import type { TrustedRecord } from '@owlmeans/auth-common'
6
+ import { TRUSTED } from '@owlmeans/config'
7
+ import { AUTH_CACHE, AUTH_SRV_KEY, DEFAULT_ALIAS } from '../src/consts.js'
8
+ import { makeAuthService } from '../src/service.js'
9
+
10
+ const SERVICE_NAME = 'server-auth-tests'
11
+ const RESOURCE_KEY = 'server-auth-test-cache'
12
+
13
+ /**
14
+ * Build a test context with:
15
+ * - AUTH_CACHE static resource (anti-replay)
16
+ * - AUTH_SRV_KEY trusted record (external auth service key for verifying incoming credentials)
17
+ * - SERVICE_NAME trusted record (app's own key for signing outgoing bearers)
18
+ * - AuthService registered
19
+ */
20
+ export const makeTestContext = () => {
21
+ const authServiceKP = makeFixtureKeyPair('auth-service-trusted')
22
+ const appKP = makeFixtureKeyPair('server-auth-app')
23
+
24
+ const authServiceRecord: TrustedRecord = {
25
+ id: authServiceKP.exportAddress(),
26
+ name: AUTH_SRV_KEY,
27
+ credential: authServiceKP.exportPublic(),
28
+ scopes: ['*'],
29
+ }
30
+
31
+ const appRecord: TrustedRecord = {
32
+ id: appKP.exportAddress(),
33
+ name: SERVICE_NAME,
34
+ credential: appKP.exportPublic(),
35
+ secret: appKP.export(),
36
+ scopes: ['*'],
37
+ }
38
+
39
+ const cfg: BasicConfig = {
40
+ ready: false,
41
+ service: SERVICE_NAME,
42
+ layer: Layer.Service,
43
+ type: AppType.Backend,
44
+ services: {},
45
+ }
46
+
47
+ const context = makeBasicContext(cfg) as BasicContext<BasicConfig>
48
+
49
+ // Register trusted records (use TRUSTED alias so trust() can find them)
50
+ context.registerResource(makeMemoryTrustedResource([authServiceRecord, appRecord], TRUSTED))
51
+
52
+ // Register AUTH_CACHE static resource
53
+ context.registerResource(createStaticResource(AUTH_CACHE, RESOURCE_KEY))
54
+
55
+ // Register auth service
56
+ context.registerService(makeAuthService(DEFAULT_ALIAS))
57
+
58
+ return { context, authServiceKP, appKP, authServiceRecord }
59
+ }