@owlmeans/client-auth 0.1.18-rc.4 → 0.1.18-rc.41

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 (180) hide show
  1. package/README.md +280 -37
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/client-auth/SKILL.md +139 -21
  4. package/build/components/dispatcher/component.d.ts.map +1 -1
  5. package/build/components/dispatcher/component.js +14 -3
  6. package/build/components/dispatcher/component.js.map +1 -1
  7. package/build/entrypoints.d.ts +7 -0
  8. package/build/entrypoints.d.ts.map +1 -0
  9. package/build/entrypoints.js +7 -0
  10. package/build/entrypoints.js.map +1 -0
  11. package/build/helper.d.ts +2 -1
  12. package/build/helper.d.ts.map +1 -1
  13. package/build/helper.js +24 -3
  14. package/build/helper.js.map +1 -1
  15. package/build/index.d.ts +1 -1
  16. package/build/index.d.ts.map +1 -1
  17. package/build/index.js +1 -1
  18. package/build/index.js.map +1 -1
  19. package/build/login/adopt.d.ts +24 -0
  20. package/build/login/adopt.d.ts.map +1 -0
  21. package/build/login/adopt.js +28 -0
  22. package/build/login/adopt.js.map +1 -0
  23. package/build/login/consts.d.ts +49 -0
  24. package/build/login/consts.d.ts.map +1 -0
  25. package/build/login/consts.js +49 -0
  26. package/build/login/consts.js.map +1 -0
  27. package/build/login/credit.d.ts +24 -0
  28. package/build/login/credit.d.ts.map +1 -0
  29. package/build/login/credit.js +58 -0
  30. package/build/login/credit.js.map +1 -0
  31. package/build/login/env.d.ts +32 -0
  32. package/build/login/env.d.ts.map +1 -0
  33. package/build/login/env.js +84 -0
  34. package/build/login/env.js.map +1 -0
  35. package/build/login/flow.d.ts +20 -0
  36. package/build/login/flow.d.ts.map +1 -0
  37. package/build/login/flow.js +39 -0
  38. package/build/login/flow.js.map +1 -0
  39. package/build/login/hook.d.ts +37 -0
  40. package/build/login/hook.d.ts.map +1 -0
  41. package/build/login/hook.js +72 -0
  42. package/build/login/hook.js.map +1 -0
  43. package/build/login/i18n/be.json +37 -0
  44. package/build/login/i18n/de.json +37 -0
  45. package/build/login/i18n/en.json +37 -0
  46. package/build/login/i18n/es.json +37 -0
  47. package/build/login/i18n/fr.json +37 -0
  48. package/build/login/i18n/pl.json +37 -0
  49. package/build/login/i18n/ru.json +37 -0
  50. package/build/login/i18n/uk.json +37 -0
  51. package/build/login/i18n.d.ts +2 -0
  52. package/build/login/i18n.d.ts.map +1 -0
  53. package/build/login/i18n.js +27 -0
  54. package/build/login/i18n.js.map +1 -0
  55. package/build/login/index.d.ts +15 -0
  56. package/build/login/index.d.ts.map +1 -0
  57. package/build/login/index.js +15 -0
  58. package/build/login/index.js.map +1 -0
  59. package/build/login/methods.d.ts +25 -0
  60. package/build/login/methods.d.ts.map +1 -0
  61. package/build/login/methods.js +97 -0
  62. package/build/login/methods.js.map +1 -0
  63. package/build/login/resume.d.ts +30 -0
  64. package/build/login/resume.d.ts.map +1 -0
  65. package/build/login/resume.js +57 -0
  66. package/build/login/resume.js.map +1 -0
  67. package/build/login/screen.d.ts +17 -0
  68. package/build/login/screen.d.ts.map +1 -0
  69. package/build/login/screen.js +76 -0
  70. package/build/login/screen.js.map +1 -0
  71. package/build/login/service.d.ts +31 -0
  72. package/build/login/service.d.ts.map +1 -0
  73. package/build/login/service.js +148 -0
  74. package/build/login/service.js.map +1 -0
  75. package/build/login/surrogate.d.ts +20 -0
  76. package/build/login/surrogate.d.ts.map +1 -0
  77. package/build/login/surrogate.js +33 -0
  78. package/build/login/surrogate.js.map +1 -0
  79. package/build/login/terms.d.ts +20 -0
  80. package/build/login/terms.d.ts.map +1 -0
  81. package/build/login/terms.js +0 -0
  82. package/build/login/terms.js.map +1 -0
  83. package/build/login/types.d.ts +256 -0
  84. package/build/login/types.d.ts.map +1 -0
  85. package/build/login/types.js +31 -0
  86. package/build/login/types.js.map +1 -0
  87. package/build/manager/components/authentication/control.js +3 -3
  88. package/build/manager/components/authentication/control.js.map +1 -1
  89. package/build/manager/components/authentication/types.d.ts +2 -2
  90. package/build/manager/components/authentication/types.d.ts.map +1 -1
  91. package/build/manager/components/tunnel-consumer.js +2 -2
  92. package/build/manager/components/tunnel-consumer.js.map +1 -1
  93. package/build/manager/entrypoints.d.ts +11 -0
  94. package/build/manager/entrypoints.d.ts.map +1 -0
  95. package/build/manager/entrypoints.js +17 -0
  96. package/build/manager/entrypoints.js.map +1 -0
  97. package/build/manager/plugins/basic-ed25519.d.ts.map +1 -1
  98. package/build/manager/plugins/basic-ed25519.js +5 -0
  99. package/build/manager/plugins/basic-ed25519.js.map +1 -1
  100. package/build/manager/plugins/exports.d.ts +2 -0
  101. package/build/manager/plugins/exports.d.ts.map +1 -1
  102. package/build/manager/plugins/exports.js +2 -0
  103. package/build/manager/plugins/exports.js.map +1 -1
  104. package/build/manager/plugins/index.d.ts +1 -5
  105. package/build/manager/plugins/index.d.ts.map +1 -1
  106. package/build/manager/plugins/index.js +9 -1
  107. package/build/manager/plugins/index.js.map +1 -1
  108. package/build/manager/plugins/methods.d.ts +6 -0
  109. package/build/manager/plugins/methods.d.ts.map +1 -0
  110. package/build/manager/plugins/methods.js +65 -0
  111. package/build/manager/plugins/methods.js.map +1 -0
  112. package/build/manager/plugins/re-captcha.d.ts.map +1 -1
  113. package/build/manager/plugins/re-captcha.js +5 -0
  114. package/build/manager/plugins/re-captcha.js.map +1 -1
  115. package/build/manager/plugins/registry.d.ts +20 -0
  116. package/build/manager/plugins/registry.d.ts.map +1 -0
  117. package/build/manager/plugins/registry.js +19 -0
  118. package/build/manager/plugins/registry.js.map +1 -0
  119. package/build/manager/plugins/tunnel-consumer.d.ts.map +1 -1
  120. package/build/manager/plugins/tunnel-consumer.js +8 -1
  121. package/build/manager/plugins/tunnel-consumer.js.map +1 -1
  122. package/build/manager/plugins/types.d.ts +53 -0
  123. package/build/manager/plugins/types.d.ts.map +1 -1
  124. package/build/service.js +1 -1
  125. package/build/service.js.map +1 -1
  126. package/package.json +36 -27
  127. package/src/components/dispatcher/component.tsx +16 -3
  128. package/src/entrypoints.ts +10 -0
  129. package/src/helper.ts +26 -3
  130. package/src/index.ts +1 -1
  131. package/src/login/adopt.ts +31 -0
  132. package/src/login/consts.ts +64 -0
  133. package/src/login/credit.ts +75 -0
  134. package/src/login/env.ts +86 -0
  135. package/src/login/flow.ts +44 -0
  136. package/src/login/hook.ts +80 -0
  137. package/src/login/i18n/be.json +37 -0
  138. package/src/login/i18n/de.json +37 -0
  139. package/src/login/i18n/en.json +37 -0
  140. package/src/login/i18n/es.json +37 -0
  141. package/src/login/i18n/fr.json +37 -0
  142. package/src/login/i18n/pl.json +37 -0
  143. package/src/login/i18n/ru.json +37 -0
  144. package/src/login/i18n/uk.json +37 -0
  145. package/src/login/i18n.ts +28 -0
  146. package/src/login/index.ts +15 -0
  147. package/src/login/methods.ts +113 -0
  148. package/src/login/resume.ts +58 -0
  149. package/src/login/screen.tsx +136 -0
  150. package/src/login/service.ts +195 -0
  151. package/src/login/surrogate.ts +45 -0
  152. package/src/login/terms.ts +0 -0
  153. package/src/login/types.ts +279 -0
  154. package/src/manager/README.md +37 -80
  155. package/src/manager/components/authentication/control.ts +3 -3
  156. package/src/manager/components/authentication/types.ts +2 -2
  157. package/src/manager/components/tunnel-consumer.tsx +2 -2
  158. package/src/manager/entrypoints.ts +18 -0
  159. package/src/manager/plugins/basic-ed25519.tsx +7 -0
  160. package/src/manager/plugins/exports.ts +2 -0
  161. package/src/manager/plugins/index.ts +10 -4
  162. package/src/manager/plugins/methods.ts +74 -0
  163. package/src/manager/plugins/re-captcha.tsx +7 -0
  164. package/src/manager/plugins/registry.ts +26 -0
  165. package/src/manager/plugins/tunnel-consumer.tsx +10 -1
  166. package/src/manager/plugins/types.ts +54 -0
  167. package/src/service.ts +1 -1
  168. package/tests/context.ts +1 -2
  169. package/tests/login.spec.ts +332 -0
  170. package/build/.gitkeep +0 -0
  171. package/build/manager/modules.d.ts +0 -2
  172. package/build/manager/modules.d.ts.map +0 -1
  173. package/build/manager/modules.js +0 -16
  174. package/build/manager/modules.js.map +0 -1
  175. package/build/modules.d.ts +0 -4
  176. package/build/modules.d.ts.map +0 -1
  177. package/build/modules.js +0 -9
  178. package/build/modules.js.map +0 -1
  179. package/src/manager/modules.ts +0 -18
  180. package/src/modules.ts +0 -13
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.js","sourceRoot":"","sources":["../../../src/manager/plugins/methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAErD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C;;;;;;;;;;;;;GAaG;AACH,MAAM,SAAS,GAAG,CAAC,MAA4B,EAAE,GAAuB,EAAW,EAAE;IACnF,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QAC3D,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,MAAM,CAAC,gBAAgB,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;QAChE,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,CAAA;AACjD,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,KAAK,EAAE,wBAAwB;IAE/B,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,eAAe,EAAE;SAC3B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SACxC,GAAG,CAAC,CAAC,MAAM,EAAe,EAAE;QAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAO,CAAA;QAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAA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S,CAAC,QAAQ,IAAI,IAAI;wBAC5B,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;wBAC1E,CAAC,CAAC,EAAE,CAAC;iBACR,CAAC,CAAA;YACJ,CAAC;SACF,CAAA;IACH,CAAC,CAAC;CACL,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"re-captcha.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/re-captcha.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAGtD,eAAO,MAAM,eAAe,EAAE,oBA0B7B,CAAA"}
1
+ {"version":3,"file":"re-captcha.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/re-captcha.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAGtD,eAAO,MAAM,eAAe,EAAE,oBAiC7B,CAAA"}
@@ -3,6 +3,11 @@ import { AuthenticationStage, AuthenticationType } from '@owlmeans/auth';
3
3
  import { useEffect } from 'react';
4
4
  export const reCaptchaPlugin = {
5
5
  type: AuthenticationType.ReCaptcha,
6
+ // A STEP inside another flow, never a way to sign in — so it is registered and never offered.
7
+ method: { hidden: true },
8
+ // Its widget is a `Renderer` a panel package assigns. `hidden` already keeps it off the sign-in
9
+ // screen; this is what the flow that DOES drive it can check before handing it a stage.
10
+ requiresRenderer: true,
6
11
  Implementation: Renderer => ({ type, stage, control, params }) => {
7
12
  Renderer = Renderer ?? reCaptchaPlugin.Renderer;
8
13
  // ReCaptcha authentication requests allowance unconditionally
@@ -1 +1 @@
1
- {"version":3,"file":"re-captcha.js","sourceRoot":"","sources":["../../../src/manager/plugins/re-captcha.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;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;IAElC,8FAA8F;IAC9F,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAExB,gGAAgG;IAChG,wFAAwF;IACxF,gBAAgB,EAAE,IAAI;IAEtB,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAC/D,QAAQ,GAAG,QAAQ,IAAI,eAAe,CAAC,QAAQ,CAAA;QAE/C,+DAA+D;QAC/D,+CAA+C;QAC/C,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,OAAO,CAAC,KAAK,KAAK,mBAAmB,CAAC,IAAI,EAAE,CAAC;gBAC/C,KAAK,OAAO,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;YACjE,CAAC;QACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;QAEV,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,WAAW,CAAC,8CAA8C,CAAC,CAAA;QACvE,CAAC;QAED,OAAO,KAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAI,CAAA;IACjF,CAAC;IAED;;;OAGG;IACH,YAAY,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;CAC1C,CAAA"}
@@ -0,0 +1,20 @@
1
+ import type { ClientAuthType } from '../components/authentication/types.js';
2
+ import type { AuthenticationPlugin } from './types.js';
3
+ /**
4
+ * The registry every authentication plugin lands in.
5
+ *
6
+ * It stays a plain exported object, and every registration stays a plain assignment, because four
7
+ * packages already write into it from side-effect imports (`web-oidc-rp`, `mui-oidc-rp`,
8
+ * `web-auth`, and this package's own `index`). Hiding it behind an API would break all of them for
9
+ * no gain — the functions below simply read it.
10
+ *
11
+ * It lives in its own module rather than in `index.ts` so that the method source can read it
12
+ * without the two importing each other.
13
+ */
14
+ export declare const plugins: {
15
+ [type: ClientAuthType]: AuthenticationPlugin;
16
+ };
17
+ export declare const registerAuthPlugin: (plugin: AuthenticationPlugin) => AuthenticationPlugin;
18
+ export declare const getAuthPlugin: (type: ClientAuthType) => AuthenticationPlugin | undefined;
19
+ export declare const listAuthPlugins: () => AuthenticationPlugin[];
20
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,EAAE;IAAE,CAAC,IAAI,EAAE,cAAc,GAAG,oBAAoB,CAAA;CAAO,CAAA;AAE3E,eAAO,MAAM,kBAAkB,WAAY,oBAAoB,KAAG,oBAIjE,CAAA;AAED,eAAO,MAAM,aAAa,SAAU,cAAc,KAAG,oBAAoB,GAAG,SAC7D,CAAA;AAEf,eAAO,MAAM,eAAe,QAAO,oBAAoB,EAA4B,CAAA"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The registry every authentication plugin lands in.
3
+ *
4
+ * It stays a plain exported object, and every registration stays a plain assignment, because four
5
+ * packages already write into it from side-effect imports (`web-oidc-rp`, `mui-oidc-rp`,
6
+ * `web-auth`, and this package's own `index`). Hiding it behind an API would break all of them for
7
+ * no gain — the functions below simply read it.
8
+ *
9
+ * It lives in its own module rather than in `index.ts` so that the method source can read it
10
+ * without the two importing each other.
11
+ */
12
+ export const plugins = {};
13
+ export const registerAuthPlugin = (plugin) => {
14
+ plugins[plugin.type] = plugin;
15
+ return plugin;
16
+ };
17
+ export const getAuthPlugin = (type) => plugins[type];
18
+ export const listAuthPlugins = () => Object.values(plugins);
19
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/manager/plugins/registry.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,OAAO,GAAqD,EAAE,CAAA;AAE3E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAA4B,EAAwB,EAAE;IACvF,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAA;IAE7B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAoB,EAAoC,EAAE,CACtF,OAAO,CAAC,IAAI,CAAC,CAAA;AAEf,MAAM,CAAC,MAAM,eAAe,GAAG,GAA2B,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"tunnel-consumer.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/tunnel-consumer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAStD,eAAO,MAAM,sBAAsB,EAAE,oBA8DpC,CAAA"}
1
+ {"version":3,"file":"tunnel-consumer.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/tunnel-consumer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAStD,eAAO,MAAM,sBAAsB,EAAE,oBAuEpC,CAAA"}
@@ -7,11 +7,18 @@ import { RELY_ACTION_TIMEOUT, RELY_PIN_PERFIX } from '@owlmeans/auth-common';
7
7
  import { createWalletFacade } from './tunnel/wallet.js';
8
8
  export const tunnelConsumerUIPlugin = {
9
9
  type: AuthenticationType.WalletConsumer,
10
+ method: { order: 400, icon: 'wallet' },
11
+ // The PIN form is a `Renderer` a panel package assigns; without one the Implementation throws on
12
+ // mount, so the method must not be offered.
13
+ requiresRenderer: true,
10
14
  Implementation: renderer => ({ type, stage, control, params }) => {
11
15
  type = type ?? AuthenticationType.WalletConsumer;
12
16
  const Renderer = renderer
13
17
  ?? tunnelConsumerUIPlugin.Renderer;
14
- const connection = useWs(AUTHEN_RELY);
18
+ // A wallet-tunnel handshake is one-shot and stateful in the browser tab that started it — a
19
+ // reconnect would dial a brand-new rely session the wallet was never asked to approve, so a
20
+ // drop here is a real failure (`SocketTimeout` below), never something to retry underneath.
21
+ const connection = useWs(AUTHEN_RELY, undefined, { reconnect: false });
15
22
  if (Renderer == null) {
16
23
  throw new SyntaxError('Renderer is not defined for WalletConsumer plugin');
17
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tunnel-consumer.js","sourceRoot":"","sources":["../../../src/manager/plugins/tunnel-consumer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAI3G,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,CAAC,MAAM,sBAAsB,GAAyB;IAC1D,IAAI,EAAE,kBAAkB,CAAC,cAAc;IAEvC,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAC/D,IAAI,GAAG,IAAI,IAAI,kBAAkB,CAAC,cAAc,CAAA;QAChD,MAAM,QAAQ,GAA6C,QAAQ;eA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,CAAA;IAC3B,CAAC;AACH,CAAC,CAAA"}
@@ -1,9 +1,62 @@
1
1
  import type { FC } from 'react';
2
+ import type { LoginMethodEmphasis } from '@owlmeans/config';
3
+ import type { LoginMethodContext } from '../../login/types.js';
2
4
  import type { AuthenticationControl, AuthenticationRenderer, AuthenticationRendererProps } from '../components/authentication/types.js';
3
5
  export interface AuthenticationPlugin extends Pick<AuthenticationControl, "beforeAuthenticate" | "afterAuthenticate">, Pick<Partial<AuthenticationControl>, "authenticate"> {
4
6
  type: string;
5
7
  Implementation: PluginImplemnetation;
6
8
  Renderer?: AuthenticationRenderer;
9
+ /**
10
+ * This plugin's `Implementation` cannot render without a `Renderer` a UI package supplies.
11
+ *
12
+ * It is declared rather than inferred because there is nothing to infer it from: a plugin that
13
+ * renders its own form and one that throws `Renderer is not defined` are the same object until
14
+ * the screen mounts. Declaring it is what lets the sign-in screen leave out a method whose
15
+ * renderer nobody registered, instead of offering a button that crashes the page it opens.
16
+ */
17
+ requiresRenderer?: boolean;
18
+ /**
19
+ * How this method presents itself on the sign-in screen.
20
+ *
21
+ * Absent means the plugin is never OFFERED — it is still reachable by type, which is what a
22
+ * step-in-a-flow (re-captcha) and a plugin an app deep-links to both need. Every field is
23
+ * optional so an existing plugin object keeps type-checking without being touched.
24
+ */
25
+ method?: AuthMethodMeta;
26
+ }
27
+ export interface AuthMethodMeta {
28
+ /** Defaults to the plugin's `type`. */
29
+ id?: string;
30
+ /** Literal fallback used when no translation resolves. */
31
+ label?: string;
32
+ /** Key under the `auth` library's `login.method.*`; defaults to the id. */
33
+ i18nKey?: string;
34
+ /** Icon registry NAME, never markup — this package must stay free of an icon library. */
35
+ icon?: string;
36
+ /** Ascending; default 100. */
37
+ order?: number;
38
+ emphasis?: LoginMethodEmphasis;
39
+ /**
40
+ * Never offered unless the configuration explicitly enables it.
41
+ *
42
+ * This is the secret-key gate: an operator login is registered like any other method and must
43
+ * not become offerable merely by being registered.
44
+ */
45
+ restricted?: boolean;
46
+ /** Registered, but never a choice. */
47
+ hidden?: boolean;
48
+ /**
49
+ * Whether the application this method is about to be offered in actually wired it.
50
+ *
51
+ * The plugin registry is global and is written to by side-effect imports, so being registered
52
+ * says only that some bundle pulled the module in — and modules arrive in groups. An app that
53
+ * wanted one method out of a package gets every method that package registers, including ones
54
+ * whose first act is to look up a service its context never appended. This is where a plugin
55
+ * says so, per context, at render time; `false` leaves it off the screen.
56
+ *
57
+ * Absent means "always", which is right for a plugin that needs nothing but itself.
58
+ */
59
+ available?: (ctx: LoginMethodContext) => boolean;
7
60
  }
8
61
  export interface PluginImplemnetation {
9
62
  (Renderer?: AuthenticationRenderer): FC<AuthenticationRendererProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,2BAA2B,EAAG,MAAM,uCAAuC,CAAA;AAExI,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,qBAAqB,EAAE,oBAAoB,GAAG,mBAAmB,CAClE,EAAE,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,oBAAoB,CAAA;IACpC,QAAQ,CAAC,EAAE,sBAAsB,CAAA;CAClC;AAED,MAAM,WAAW,oBAAoB;IACnC,CAAC,QAAQ,CAAC,EAAE,sBAAsB,GAAG,EAAE,CAAC,2BAA2B,CAAC,CAAA;CACrE"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,2BAA2B,EAAG,MAAM,uCAAuC,CAAA;AAExI,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,qBAAqB,EAAE,oBAAoB,GAAG,mBAAmB,CAClE,EAAE,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,oBAAoB,CAAA;IACpC,QAAQ,CAAC,EAAE,sBAAsB,CAAA;IACjC;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,mBAAmB,CAAA;IAC9B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,OAAO,CAAA;CACjD;AAED,MAAM,WAAW,oBAAoB;IACnC,CAAC,QAAQ,CAAC,EAAE,sBAAsB,GAAG,EAAE,CAAC,2BAA2B,CAAC,CAAA;CACrE"}
package/build/service.js CHANGED
@@ -12,7 +12,7 @@ export const makeAuthService = (alias = DEFAULT_ALIAS) => {
12
12
  },
13
13
  authenticate: async (token) => {
14
14
  const context = assertContext(service.ctx, location);
15
- const [authToken] = await context.entrypoint(DISPATCHER_AUTHEN)
15
+ const authToken = await context.entrypoint(DISPATCHER_AUTHEN)
16
16
  .call({ body: token });
17
17
  await service.update(authToken.token);
18
18
  },
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEhE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAGtE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,GAAW,aAAa,EAAe,EAAE;IAC5E,MAAM,QAAQ,GAAG,gBAAgB,KAAK,EAAE,CAAA;IACxC,MAAM,OAAO,GAAgB,aAAa,CAAc,KAAK,EAAE;QAC7D,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,IAAI;QAElD,MAAM,EAAE,KAAK,IAAO,EAAE;YACpB,OAAO,KAAK,CAAM,CAAA;QACpB,CAAC;QAED,YAAY,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YAC1B,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAEpD,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,UAAU,CAA8B,iBAAiB,CAAC;iBACzF,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;YAExB,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC;QAED,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gBACnC,CAAC;YACH,CAAC;YAED,OAAO,OAAO,CAAC,KAAK,IAAI,IAAI,CAAA;QAC9B,CAAC;QAED,IAAI,EAAE,GAAG,EAAE;YACT,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;gBACzB,MAAM,IAAI,kBAAkB,EAAE,CAAA;YAChC,CAAC;YAED,OAAO,OAAO,CAAC,IAAI,CAAA;QACrB,CAAC;QAED,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC;KACjE,CAAC,CAAA;IAEF,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,GAAM,EAAE,KAAK,GAAW,aAAa,EACd,EAAE;IACzB,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAEtC,MAAM,OAAO,GAAG,GAA4B,CAAA;IAE5C,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;IAEhC,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;IAE1C,OAAO,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAE/C,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/client-auth",
3
- "version": "0.1.18-rc.4",
3
+ "version": "0.1.18-rc.41",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -27,12 +27,12 @@
27
27
  "module": "./build/manager/index.js",
28
28
  "types": "./build/manager/index.d.ts"
29
29
  },
30
- "./manager/modules": {
31
- "import": "./build/manager/modules.js",
32
- "require": "./build/manager/modules.js",
33
- "default": "./build/manager/modules.js",
34
- "module": "./build/manager/modules.js",
35
- "types": "./build/manager/modules.d.ts"
30
+ "./manager/entrypoints": {
31
+ "import": "./build/manager/entrypoints.js",
32
+ "require": "./build/manager/entrypoints.js",
33
+ "default": "./build/manager/entrypoints.js",
34
+ "module": "./build/manager/entrypoints.js",
35
+ "types": "./build/manager/entrypoints.d.ts"
36
36
  },
37
37
  "./manager/plugins": {
38
38
  "import": "./build/manager/plugins/exports.js",
@@ -40,27 +40,36 @@
40
40
  "default": "./build/manager/plugins/exports.js",
41
41
  "module": "./build/manager/plugins/exports.js",
42
42
  "types": "./build/manager/plugins/exports.d.ts"
43
+ },
44
+ "./login": {
45
+ "import": "./build/login/index.js",
46
+ "require": "./build/login/index.js",
47
+ "default": "./build/login/index.js",
48
+ "module": "./build/login/index.js",
49
+ "types": "./build/login/index.d.ts"
43
50
  }
44
51
  },
45
52
  "dependencies": {
46
- "@owlmeans/auth": "^0.1.18-rc.4",
47
- "@owlmeans/auth-common": "^0.1.18-rc.4",
48
- "@owlmeans/basic-envelope": "^0.1.18-rc.4",
49
- "@owlmeans/basic-keys": "^0.1.18-rc.4",
50
- "@owlmeans/client": "^0.1.18-rc.4",
51
- "@owlmeans/client-context": "^0.1.18-rc.4",
52
- "@owlmeans/client-flow": "^0.1.18-rc.4",
53
- "@owlmeans/client-entrypoint": "^0.1.18-rc.4",
54
- "@owlmeans/client-resource": "^0.1.18-rc.4",
55
- "@owlmeans/client-socket": "^0.1.18-rc.4",
56
- "@owlmeans/context": "^0.1.18-rc.4",
57
- "@owlmeans/did": "^0.1.18-rc.4",
58
- "@owlmeans/error": "^0.1.18-rc.4",
59
- "@owlmeans/flow": "^0.1.18-rc.4",
60
- "@owlmeans/entrypoint": "^0.1.18-rc.4",
61
- "@owlmeans/resource": "^0.1.18-rc.4",
62
- "@owlmeans/socket": "^0.1.18-rc.4",
63
- "@owlmeans/web-flow": "^0.1.18-rc.4",
53
+ "@owlmeans/auth": "^0.1.18-rc.30",
54
+ "@owlmeans/auth-common": "^0.1.18-rc.32",
55
+ "@owlmeans/basic-envelope": "^0.1.18-rc.31",
56
+ "@owlmeans/basic-keys": "^0.1.18-rc.33",
57
+ "@owlmeans/client": "^0.1.18-rc.35",
58
+ "@owlmeans/client-context": "^0.1.18-rc.33",
59
+ "@owlmeans/client-entrypoint": "^0.1.18-rc.32",
60
+ "@owlmeans/client-flow": "^0.1.18-rc.37",
61
+ "@owlmeans/client-resource": "^0.1.18-rc.32",
62
+ "@owlmeans/client-socket": "^0.1.18-rc.33",
63
+ "@owlmeans/config": "^0.1.18-rc.32",
64
+ "@owlmeans/context": "^0.1.18-rc.28",
65
+ "@owlmeans/did": "^0.1.18-rc.31",
66
+ "@owlmeans/entrypoint": "^0.1.18-rc.31",
67
+ "@owlmeans/error": "^0.1.18-rc.30",
68
+ "@owlmeans/flow": "^0.1.18-rc.33",
69
+ "@owlmeans/i18n": "^0.1.18-rc.31",
70
+ "@owlmeans/resource": "^0.1.18-rc.30",
71
+ "@owlmeans/socket": "^0.1.18-rc.28",
72
+ "@owlmeans/web-flow": "^0.1.18-rc.36",
64
73
  "@scure/base": "^2.3.0"
65
74
  },
66
75
  "peerDependencies": {
@@ -69,8 +78,8 @@
69
78
  },
70
79
  "devDependencies": {
71
80
  "@owlmeans/dep-config": "workspace:*",
72
- "@owlmeans/test-auth": "^0.1.18-rc.4",
73
- "@types/bun": "^1.3.14",
81
+ "@owlmeans/test-auth": "^0.1.18-rc.31",
82
+ "@types/bun": "^1.4.0",
74
83
  "@types/react": "^19.2.17",
75
84
  "nodemon": "^3.1.14",
76
85
  "typescript": "^7.0.2"
@@ -9,7 +9,7 @@ import type { AuthService } from '@owlmeans/auth-common'
9
9
  import { useNavigate } from '@owlmeans/client'
10
10
  import type { AbstractRequest } from '@owlmeans/entrypoint'
11
11
  import type { FlowService } from '@owlmeans/client-flow'
12
- import { DEFAULT_ALIAS as FLOW_SERVICE } from '@owlmeans/client-flow'
12
+ import { DEFAULT_ALIAS as FLOW_SERVICE, resumeSuspendedFlow } from '@owlmeans/client-flow'
13
13
  import { FLOW_PLACEHOLDER, OidcAuthStep, STD_OIDC_FLOW } from '@owlmeans/flow'
14
14
  import { SERVICE_PARAM } from '@owlmeans/web-flow'
15
15
 
@@ -18,8 +18,21 @@ export const DispatcherHOC: TDispatcherHOC = Renderer => ({ context, params, ali
18
18
 
19
19
  const navigator = useNavigate()
20
20
  const navigate = useCallback(async () => {
21
- alias = alias == null || alias === DISPATCHER ? HOME : alias
22
- const module = context.module<ClientEntrypoint<string>>(alias)
21
+ if (alias == null || alias === DISPATCHER) {
22
+ // A sign-in that started elsewhere — a device or authorization-code consent screen, most
23
+ // commonly — suspended itself here before leaving. Resuming it takes priority over the
24
+ // ordinary HOME landing, and does so BEFORE `alias` is overwritten, because once it is
25
+ // `HOME` there is no way back to tell the two cases apart.
26
+ const landing = await resumeSuspendedFlow(context)
27
+ if (landing != null) {
28
+ await navigator.navigate(
29
+ context.entrypoint<ClientEntrypoint<string>>(landing.entrypoint), { query: landing.query }
30
+ )
31
+ return
32
+ }
33
+ alias = HOME
34
+ }
35
+ const module = context.entrypoint<ClientEntrypoint<string>>(alias)
23
36
  if (alias === HOME) {
24
37
  params = {}
25
38
  query = {}
@@ -0,0 +1,10 @@
1
+
2
+ import { bind, bindScreen, stab } from '@owlmeans/client-entrypoint'
3
+ import { authProtocols } from '@owlmeans/auth-common'
4
+
5
+ /** Browser entrypoints for the authentication protocols every client may call. */
6
+ export const entrypoints = [bind(authProtocols.dispatcherAuthenticate)]
7
+
8
+ /** Bind the external-authentication screen to one explicitly selected service. */
9
+ export const bindExternalAuthentication = (service: string) =>
10
+ bindScreen(authProtocols.flowEnter, stab, { routeOptions: { overrides: { service } } })
package/src/helper.ts CHANGED
@@ -2,6 +2,7 @@ import { useContext, useNavigate } from '@owlmeans/client'
2
2
  import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
3
3
  import { provideRequest } from '@owlmeans/client-entrypoint'
4
4
  import { useWs as useWebSocket } from '@owlmeans/client-socket'
5
+ import type { WsOptions } from '@owlmeans/client-socket'
5
6
  import type { AbstractRequest } from '@owlmeans/entrypoint'
6
7
  import type { AuthServiceAppend } from './types.js'
7
8
  import { useEffect, useMemo, useState } from 'react'
@@ -12,7 +13,7 @@ import { AUTH_QUERY, DISPATCHER } from '@owlmeans/auth'
12
13
  // import { OidcAuthStep } from '@owlmeans/flow'
13
14
 
14
15
  export const useWs = (
15
- module: string | ClientEntrypoint<any>, _request?: Partial<AbstractRequest<any>>
16
+ module: string | ClientEntrypoint<any>, _request?: Partial<AbstractRequest<any>>, options?: WsOptions
16
17
  ) => {
17
18
  const ctx = useContext() as unknown as AuthServiceAppend & ClientContext
18
19
 
@@ -20,9 +21,13 @@ export const useWs = (
20
21
  () => typeof module === 'string' ? ctx.entrypoint<ClientEntrypoint>(module) : module, [module]
21
22
  )
22
23
 
24
+ // Captured before the token is filled in below, so a caller who supplied their own token
25
+ // keeps full control of it across a reconnect too — `beforeConnect` only refreshes ours.
26
+ const callerSuppliedToken = _request?.query?.[AUTH_QUERY] != null
27
+
23
28
  const request = useMemo(() => {
24
29
  if (_request == null) {
25
- _request = provideRequest(mod.getAlias(), mod.getPath())
30
+ _request = provideRequest(mod.alias, mod.path())
26
31
  }
27
32
  try {
28
33
  if (_request?.query?.[AUTH_QUERY] == null) {
@@ -38,7 +43,25 @@ export const useWs = (
38
43
  return _request
39
44
  }, [_request])
40
45
 
41
- return useWebSocket(module, request)
46
+ const wsOptions = useMemo<WsOptions>(() => ({
47
+ ...options,
48
+ beforeConnect: async req => {
49
+ // A reconnect can land minutes after the socket first opened — refresh the bearer token
50
+ // on every attempt rather than trust the one `request` was built with, or a token rotated
51
+ // in between reopens the socket with a stale one the guard then rejects.
52
+ if (!callerSuppliedToken) {
53
+ try {
54
+ req.query ??= {}
55
+ req.query[AUTH_QUERY] = ctx.auth().token
56
+ } catch (e) {
57
+ console.error(e)
58
+ }
59
+ }
60
+ await options?.beforeConnect?.(req)
61
+ }
62
+ }), [options, callerSuppliedToken])
63
+
64
+ return useWebSocket(module, request, wsOptions)
42
65
  }
43
66
 
44
67
  export const useSelfAuth = (force: boolean = true/*, entity: string = DEFAULT_ENTITY*/) => {
package/src/index.ts CHANGED
@@ -3,5 +3,5 @@ export * from './components/index.js'
3
3
  export type * from './types.js'
4
4
  export * from './service.js'
5
5
  export * from './consts.js'
6
- export * from './modules.js'
6
+ export * from './entrypoints.js'
7
7
  export * from './helper.js'
@@ -0,0 +1,31 @@
1
+ import type { AuthService } from '@owlmeans/auth-common'
2
+ import { DEFAULT_ALIAS as AUTH_ALIAS } from '../consts.js'
3
+ import type { LoginContext } from './types.js'
4
+
5
+ /**
6
+ * The one path an issued bearer token becomes this context's authentication.
7
+ *
8
+ * Resolved by alias rather than through `ctx.auth()` so the login host does not require
9
+ * `AuthServiceAppend` on the context it is given — a plugin can adopt a token on any context that
10
+ * carries the auth service, including one it did not build.
11
+ *
12
+ * Going through `AuthService.update` matters: it stores the record, decodes the envelope and sets
13
+ * both `auth` and `token` in one place. Writing those three by hand — which is what the popup and
14
+ * the MUI relying party each used to do — leaves the same state on a good day and diverges the
15
+ * moment any of it changes.
16
+ */
17
+ export const adoptToken = async (ctx: LoginContext, token: string): Promise<void> => {
18
+ await ctx.service<AuthService>(AUTH_ALIAS).update(token)
19
+ }
20
+
21
+ /**
22
+ * The one path this context's authentication is dropped, and the exact mirror of {@link adoptToken}.
23
+ *
24
+ * `undefined`, not `null`: `undefined` is the declared clearing value, and on the web the auth
25
+ * service reacts to it by navigating to the dispatcher. Everything that signs a user out goes
26
+ * through here — the hook, both browser plugins and the surrogate screen — so there is one place
27
+ * where "signed out" is defined rather than four that agree until one of them changes.
28
+ */
29
+ export const revokeToken = async (ctx: LoginContext): Promise<void> => {
30
+ await ctx.service<AuthService>(AUTH_ALIAS).update(undefined)
31
+ }
@@ -0,0 +1,64 @@
1
+ export const DEFAULT_ALIAS = 'login-service'
2
+
3
+ export const LOGIN_SERVICE = DEFAULT_ALIAS
4
+
5
+ /** Priority of a plugin that makes no claim about the environment. */
6
+ export const DEFAULT_LOGIN_PRIORITY = 0
7
+
8
+ /** Order given to a method that declares none. */
9
+ export const DEFAULT_METHOD_ORDER = 100
10
+
11
+ /**
12
+ * Name given to the surrogate login window, the marker it records about itself, and the values the
13
+ * two documents exchange.
14
+ *
15
+ * These are a wire protocol between two documents that may be running different builds — an opener
16
+ * holding an older bundle and a surrogate freshly loaded, or the reverse. They are therefore fixed,
17
+ * and must never be "tidied" to match a newer vocabulary. That applies to the query names and the
18
+ * message types added later just as much as to the original three.
19
+ */
20
+ export const LOGIN_SURROGATE_NAME = 'owlmeans-oidc-login'
21
+
22
+ export const LOGIN_TOKEN_MESSAGE = 'owlmeans:oidc:popup-token'
23
+
24
+ export const LOGIN_LOGOUT_MESSAGE = 'owlmeans:oidc:popup-logout'
25
+
26
+ export const LOGIN_SURROGATE_MARKER = '_owlmeans-oidc-popup'
27
+
28
+ export const LOGIN_SURROGATE_WIDTH = 520
29
+
30
+ export const LOGIN_SURROGATE_HEIGHT = 760
31
+
32
+ /**
33
+ * @deprecated Never centered the window — it carried no `left`/`top`, so the surrogate always
34
+ * opened wherever the browser's own default popup placement put it. Superseded by
35
+ * `@owlmeans/web-client`'s `centeredPopupFeatures(LOGIN_SURROGATE_WIDTH, LOGIN_SURROGATE_HEIGHT)`,
36
+ * computed fresh per call since centering depends on where the browser window currently sits.
37
+ * Kept, unchanged, for the same reason as the rest of this block: an already-generated app may
38
+ * carry a copy of code that still imports it.
39
+ */
40
+ export const LOGIN_SURROGATE_FEATURES =
41
+ `popup=yes,width=${LOGIN_SURROGATE_WIDTH},height=${LOGIN_SURROGATE_HEIGHT}`
42
+
43
+ /** How often a surrogate window is checked for having been closed by the user. */
44
+ export const LOGIN_WATCH_INTERVAL = 500
45
+
46
+ /** Carries WHY the surrogate window was opened across the window boundary. */
47
+ export const LOGIN_INTENT_QUERY = 'intent'
48
+
49
+ /**
50
+ * Carries the address the surrogate should run, so the flow parameters the opener's URL held are
51
+ * forwarded rather than discarded.
52
+ */
53
+ export const LOGIN_NEXT_QUERY = 'next'
54
+
55
+ /**
56
+ * Carries the method the user already chose, one window up.
57
+ *
58
+ * A surrogate acting on it is not an auto-redirect in the "never choose for the user" sense: the
59
+ * choice was made, by a person, in the document that opened this one.
60
+ */
61
+ export const LOGIN_METHOD_QUERY = 'method'
62
+
63
+ /** Where a browser records that it agreed to one exact set of legal documents. */
64
+ export const LOGIN_TERMS_STORAGE = '_owlmeans-login-terms'
@@ -0,0 +1,75 @@
1
+ import type { BrandSettings, LoginCreditConfig } from '@owlmeans/config'
2
+
3
+ export interface ResolvedCredit {
4
+ /** Whether "Powered by OwlMeans" is rendered. */
5
+ poweredBy: boolean
6
+ /** The product and organization line, already composed. Null when there is nothing to say. */
7
+ line: string | null
8
+ }
9
+
10
+ /**
11
+ * The years one notice covers.
12
+ *
13
+ * A range only while the first year is genuinely in the past — an app configured with the current
14
+ * year, or with a year a skewed clock puts in the future, still gets a well-formed notice rather
15
+ * than `© 2026–2026` or a range that runs backwards.
16
+ */
17
+ const years = (since: number | undefined, now: number): string =>
18
+ since != null && since > 0 && since < now ? `${since}–${now}` : `${now}`
19
+
20
+ /**
21
+ * A configured value that was actually SET.
22
+ *
23
+ * Empty is how a build-time default spells "unset", and this config is filled from environment
24
+ * variables a platform delivers — `BRANDING_ORGANIZATION: meta.brandingOrganization ?? ''` is the
25
+ * shape of every one of them. `??` does not fall through an empty string, so an undelivered
26
+ * organization used to win the fallback chain and compose a line ending in a bare dash.
27
+ */
28
+ const set = (value?: string | null): string | null =>
29
+ value != null && value.trim() !== '' ? value : null
30
+
31
+ /**
32
+ * What the bottom of the sign-in screen says.
33
+ *
34
+ * It is a copyright notice, so it is composed as one: `© <year> <holder>`. That is the whole
35
+ * reason `copyright` defaults to on — the name on its own reads as a caption, and an application
36
+ * that means to assert a copyright would have had to write the mark and the year into a literal
37
+ * `line` to get one.
38
+ *
39
+ * The organization falls back to its slug because an organization record carries no readable name
40
+ * — so "no name" is the ordinary case, not an error, and a screen that rendered an empty line for
41
+ * it would be worse than one that renders the slug.
42
+ *
43
+ * `line` replaces everything when an app supplies it: a product with its own legal wording should
44
+ * not have to defeat a composition rule to use it.
45
+ */
46
+ export const resolveCredit = (
47
+ cfg?: LoginCreditConfig, brand?: BrandSettings, service?: string
48
+ ): ResolvedCredit => {
49
+ const poweredBy = cfg?.poweredBy ?? true
50
+ const literal = set(cfg?.line)
51
+ if (literal != null) {
52
+ return { poweredBy, line: literal }
53
+ }
54
+
55
+ const product = set(cfg?.product) ?? set(brand?.name) ?? set(service)
56
+ const organization = set(cfg?.organization) ?? set(brand?.organization)
57
+ ?? set(cfg?.entity) ?? set(brand?.entity)
58
+
59
+ // Whoever the notice names. A product with no organization behind it holds its own copyright,
60
+ // which is why this falls through to the product rather than dropping the notice.
61
+ const holder = set(cfg?.holder) ?? organization ?? product
62
+ const wording = typeof cfg?.copyright === 'string' ? set(cfg.copyright) : null
63
+ const notice = cfg?.copyright === false || holder == null
64
+ ? organization
65
+ : wording ?? `© ${years(cfg?.since, new Date().getFullYear())} ${holder}`
66
+
67
+ // The product is named beside the notice only when it is not already the thing being claimed —
68
+ // "OwlMeans — © 2026 OwlMeans" says the name twice and neither time usefully.
69
+ return {
70
+ poweredBy,
71
+ line: product != null && notice != null && product !== holder
72
+ ? `${product} — ${notice}`
73
+ : notice ?? product,
74
+ }
75
+ }