@owlmeans/client-auth 0.1.18-rc.13 → 0.1.18-rc.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/client-auth/SKILL.md +7 -1
- package/build/login/credit.d.ts +5 -0
- package/build/login/credit.d.ts.map +1 -1
- package/build/login/credit.js +43 -9
- package/build/login/credit.js.map +1 -1
- package/build/login/flow.d.ts +20 -0
- package/build/login/flow.d.ts.map +1 -0
- package/build/login/flow.js +39 -0
- package/build/login/flow.js.map +1 -0
- package/build/login/i18n/be.json +1 -1
- package/build/login/i18n/de.json +1 -1
- package/build/login/i18n/en.json +1 -1
- package/build/login/i18n/es.json +1 -1
- package/build/login/i18n/pl.json +1 -1
- package/build/login/i18n/ru.json +1 -1
- package/build/login/i18n/uk.json +1 -1
- package/build/login/index.d.ts +1 -0
- package/build/login/index.d.ts.map +1 -1
- package/build/login/index.js +1 -0
- package/build/login/index.js.map +1 -1
- package/build/login/resume.d.ts +10 -0
- package/build/login/resume.d.ts.map +1 -1
- package/build/login/resume.js +22 -0
- package/build/login/resume.js.map +1 -1
- package/build/login/screen.d.ts +13 -0
- package/build/login/screen.d.ts.map +1 -1
- package/build/login/screen.js +27 -14
- package/build/login/screen.js.map +1 -1
- package/build/login/types.d.ts +9 -1
- package/build/login/types.d.ts.map +1 -1
- package/build/manager/plugins/basic-ed25519.d.ts.map +1 -1
- package/build/manager/plugins/basic-ed25519.js +4 -0
- package/build/manager/plugins/basic-ed25519.js.map +1 -1
- package/build/manager/plugins/methods.d.ts +0 -4
- package/build/manager/plugins/methods.d.ts.map +1 -1
- package/build/manager/plugins/methods.js +25 -6
- package/build/manager/plugins/methods.js.map +1 -1
- package/build/manager/plugins/re-captcha.d.ts.map +1 -1
- package/build/manager/plugins/re-captcha.js +3 -0
- package/build/manager/plugins/re-captcha.js.map +1 -1
- package/build/manager/plugins/tunnel-consumer.d.ts.map +1 -1
- package/build/manager/plugins/tunnel-consumer.js +3 -0
- package/build/manager/plugins/tunnel-consumer.js.map +1 -1
- package/build/manager/plugins/types.d.ts +22 -0
- package/build/manager/plugins/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/login/credit.ts +47 -9
- package/src/login/flow.ts +44 -0
- package/src/login/i18n/be.json +1 -1
- package/src/login/i18n/de.json +1 -1
- package/src/login/i18n/en.json +1 -1
- package/src/login/i18n/es.json +1 -1
- package/src/login/i18n/pl.json +1 -1
- package/src/login/i18n/ru.json +1 -1
- package/src/login/i18n/uk.json +1 -1
- package/src/login/index.ts +1 -0
- package/src/login/resume.ts +23 -0
- package/src/login/screen.tsx +27 -13
- package/src/login/types.ts +9 -1
- package/src/manager/plugins/basic-ed25519.tsx +5 -0
- package/src/manager/plugins/methods.ts +29 -7
- package/src/manager/plugins/re-captcha.tsx +4 -0
- package/src/manager/plugins/tunnel-consumer.tsx +4 -0
- package/src/manager/plugins/types.ts +22 -0
- package/tests/login.spec.ts +115 -4
- package/build/.gitkeep +0 -0
|
@@ -2,16 +2,35 @@ import { CAUTHEN_AUTHEN_TYPED } from '@owlmeans/auth';
|
|
|
2
2
|
import { DEFAULT_METHOD_ORDER, LOGIN_SERVICE } from '../../login/consts.js';
|
|
3
3
|
import { listAuthPlugins } from './registry.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Whether a registered plugin may be put on the sign-in screen of THIS application.
|
|
6
|
+
*
|
|
7
|
+
* The registry is global and is filled by side-effect imports, so "registered" means only that
|
|
8
|
+
* some module was pulled into the bundle — three separate reasons why that is not enough:
|
|
6
9
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
+
* 1. No `method`: `re-captcha` is a STEP inside another flow, not a way to sign in.
|
|
11
|
+
* 2. No renderer: a plugin that declares `requiresRenderer` throws the moment its screen mounts
|
|
12
|
+
* unless a UI package (`web-panel`, `mui-panel`) assigned one. An app that imported the plugin
|
|
13
|
+
* host without that package would be offering buttons whose only outcome is a broken page.
|
|
14
|
+
* 3. Not wired: a plugin whose flow needs a service its context never appended fails on the
|
|
15
|
+
* lookup instead. Packages register their plugins in groups, so an app that wanted one of them
|
|
16
|
+
* gets the rest too, and the rest have to be able to say they do not apply here.
|
|
17
|
+
*/
|
|
18
|
+
const offerable = (plugin, ctx) => {
|
|
19
|
+
if (plugin.method == null || plugin.method.hidden === true) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (plugin.requiresRenderer === true && plugin.Renderer == null) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return plugin.method.available?.(ctx) !== false;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Every registered authentication plugin that declares itself offerable, as a sign-in method.
|
|
10
29
|
*/
|
|
11
30
|
export const pluginMethodSource = {
|
|
12
31
|
alias: 'authentication-plugins',
|
|
13
|
-
list:
|
|
14
|
-
.filter(plugin => plugin
|
|
32
|
+
list: ctx => listAuthPlugins()
|
|
33
|
+
.filter(plugin => offerable(plugin, ctx))
|
|
15
34
|
.map((plugin) => {
|
|
16
35
|
const meta = plugin.method;
|
|
17
36
|
const type = plugin.type;
|
|
@@ -1 +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;
|
|
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;;;;;;;;;;;;;GA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eAAO,MAAM,eAAe,EAAE,
|
|
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"}
|
|
@@ -5,6 +5,9 @@ export const reCaptchaPlugin = {
|
|
|
5
5
|
type: AuthenticationType.ReCaptcha,
|
|
6
6
|
// A STEP inside another flow, never a way to sign in — so it is registered and never offered.
|
|
7
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,
|
|
8
11
|
Implementation: Renderer => ({ type, stage, control, params }) => {
|
|
9
12
|
Renderer = Renderer ?? reCaptchaPlugin.Renderer;
|
|
10
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;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,MAAM,CAAC,MAAM,eAAe,GAAyB;IACnD,IAAI,EAAE,kBAAkB,CAAC,SAAS;IAElC,8FAA8F;IAC9F,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAExB,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,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AG,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"}
|
|
@@ -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,
|
|
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,oBAoEpC,CAAA"}
|
|
@@ -8,6 +8,9 @@ import { createWalletFacade } from './tunnel/wallet.js';
|
|
|
8
8
|
export const tunnelConsumerUIPlugin = {
|
|
9
9
|
type: AuthenticationType.WalletConsumer,
|
|
10
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,
|
|
11
14
|
Implementation: renderer => ({ type, stage, control, params }) => {
|
|
12
15
|
type = type ?? AuthenticationType.WalletConsumer;
|
|
13
16
|
const Renderer = renderer
|
|
@@ -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,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE;IAEtC,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;eAC9D,sBAAsB,CAAC,QAAQ,CAAA;QAEpC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,CAAA;QAErC,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,WAAW,CAAC,mDAAmD,CAAC,CAA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,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,IAAgB,EAAE,OAA8B,EAAE,EAAE,CAAC,KAAK,EAAE,IAAa,EAAE,EAAE;IAC/F,MAAM,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAA;IAC7D,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAwB,mBAAmB,CAAC,YAAY,EAAE;YACpF,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,SAAS,IAAI,EAAE;YAC7C,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC,GAAG;YACtC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,QAAQ,CAAC,KAAK;YACpB,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,CAAC,UAAU,CAAC;SACrB,CAAC,CAAA;QAEF,IAAI,IAAI,CAAC,KAAK,KAAK,mBAAmB,CAAC,aAAa,EAAE,CAAC;YACrD,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;gBAC7B,MAAM,IAAI,WAAW,CAAC,kEAAkE,CAAC,CAAA;YAC3F,CAAC;YACD,MAAM,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAA;QACxD,CAAC;QACD,SAAS;IACX,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;QAClB,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC3B,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import type { LoginMethodEmphasis } from '@owlmeans/config';
|
|
3
|
+
import type { LoginMethodContext } from '../../login/types.js';
|
|
3
4
|
import type { AuthenticationControl, AuthenticationRenderer, AuthenticationRendererProps } from '../components/authentication/types.js';
|
|
4
5
|
export interface AuthenticationPlugin extends Pick<AuthenticationControl, "beforeAuthenticate" | "afterAuthenticate">, Pick<Partial<AuthenticationControl>, "authenticate"> {
|
|
5
6
|
type: string;
|
|
6
7
|
Implementation: PluginImplemnetation;
|
|
7
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;
|
|
8
18
|
/**
|
|
9
19
|
* How this method presents itself on the sign-in screen.
|
|
10
20
|
*
|
|
@@ -35,6 +45,18 @@ export interface AuthMethodMeta {
|
|
|
35
45
|
restricted?: boolean;
|
|
36
46
|
/** Registered, but never a choice. */
|
|
37
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;
|
|
38
60
|
}
|
|
39
61
|
export interface PluginImplemnetation {
|
|
40
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,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC3D,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;;;;;;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;
|
|
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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
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"@owlmeans/auth-common": "^0.1.18-rc.9",
|
|
55
55
|
"@owlmeans/basic-envelope": "^0.1.18-rc.9",
|
|
56
56
|
"@owlmeans/basic-keys": "^0.1.18-rc.9",
|
|
57
|
-
"@owlmeans/client": "^0.1.18-rc.
|
|
57
|
+
"@owlmeans/client": "^0.1.18-rc.11",
|
|
58
58
|
"@owlmeans/client-context": "^0.1.18-rc.9",
|
|
59
59
|
"@owlmeans/client-entrypoint": "^0.1.18-rc.9",
|
|
60
|
-
"@owlmeans/client-flow": "^0.1.18-rc.
|
|
60
|
+
"@owlmeans/client-flow": "^0.1.18-rc.12",
|
|
61
61
|
"@owlmeans/client-resource": "^0.1.18-rc.9",
|
|
62
62
|
"@owlmeans/client-socket": "^0.1.18-rc.9",
|
|
63
63
|
"@owlmeans/config": "^0.1.18-rc.8",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@owlmeans/i18n": "^0.1.18-rc.6",
|
|
70
70
|
"@owlmeans/resource": "^0.1.18-rc.7",
|
|
71
71
|
"@owlmeans/socket": "^0.1.18-rc.7",
|
|
72
|
-
"@owlmeans/web-flow": "^0.1.18-rc.
|
|
72
|
+
"@owlmeans/web-flow": "^0.1.18-rc.12",
|
|
73
73
|
"@scure/base": "^2.3.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
package/src/login/credit.ts
CHANGED
|
@@ -7,9 +7,35 @@ export interface ResolvedCredit {
|
|
|
7
7
|
line: string | null
|
|
8
8
|
}
|
|
9
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
|
+
|
|
10
31
|
/**
|
|
11
32
|
* What the bottom of the sign-in screen says.
|
|
12
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
|
+
*
|
|
13
39
|
* The organization falls back to its slug because an organization record carries no readable name
|
|
14
40
|
* — so "no name" is the ordinary case, not an error, and a screen that rendered an empty line for
|
|
15
41
|
* it would be worse than one that renders the slug.
|
|
@@ -21,17 +47,29 @@ export const resolveCredit = (
|
|
|
21
47
|
cfg?: LoginCreditConfig, brand?: BrandSettings, service?: string
|
|
22
48
|
): ResolvedCredit => {
|
|
23
49
|
const poweredBy = cfg?.poweredBy ?? true
|
|
24
|
-
|
|
25
|
-
|
|
50
|
+
const literal = set(cfg?.line)
|
|
51
|
+
if (literal != null) {
|
|
52
|
+
return { poweredBy, line: literal }
|
|
26
53
|
}
|
|
27
54
|
|
|
28
|
-
const product = cfg?.product ?? brand?.name ?? service
|
|
29
|
-
const organization = cfg?.organization ?? brand?.organization
|
|
30
|
-
?? cfg?.entity ?? brand?.entity
|
|
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)
|
|
31
58
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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}`
|
|
35
66
|
|
|
36
|
-
|
|
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
|
+
}
|
|
37
75
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FLOW_PLACEHOLDER, OidcAuthStep, STD_OIDC_FLOW } from '@owlmeans/flow'
|
|
2
|
+
import type { FlowModel } from '@owlmeans/flow'
|
|
3
|
+
import { DEFAULT_ENTITY } from '../consts.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Bring a freshly booted standard OIDC flow to the step an authorization request can be made from.
|
|
7
|
+
*
|
|
8
|
+
* `stdOidcFlow` starts at `Dispatch`, but `OidcAuthService.authenticate` refuses any state that is
|
|
9
|
+
* not `Ephemeral` and returns null — so an application whose flow was only booted can ask for an
|
|
10
|
+
* authorization URL all day and be told nothing, forever. The dispatcher in this package has always
|
|
11
|
+
* done this transition inline; a relying party that replaces that dispatcher (`web-oidc-rp`,
|
|
12
|
+
* `mui-oidc-rp`) inherited the requirement without the code, which is what left a sign-in button
|
|
13
|
+
* that reported no error and did nothing at all.
|
|
14
|
+
*
|
|
15
|
+
* `Ephemeral` is the branch for an application that is its OWN authority — its flow configuration
|
|
16
|
+
* maps the auth service to a placeholder, which is exactly the generated-application case. An app
|
|
17
|
+
* federated with a real auth service keeps its target and is left alone.
|
|
18
|
+
*
|
|
19
|
+
* Idempotent, and safe to call on every attempt: a flow already past `Dispatch`, or one that is
|
|
20
|
+
* not the standard OIDC flow at all, is returned untouched.
|
|
21
|
+
*/
|
|
22
|
+
export const enterOidcAuthorization = (model: FlowModel): FlowModel => {
|
|
23
|
+
const state = model.state()
|
|
24
|
+
if (state.flow !== STD_OIDC_FLOW || state.step !== OidcAuthStep.Dispatch) {
|
|
25
|
+
return model
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const target = model.step().service
|
|
29
|
+
if (state.service == null || state.service === '') {
|
|
30
|
+
model.target(target)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// The entity travels to this app's own backend, which resolves its default provider by `def`
|
|
34
|
+
// alone. It still has to BE there: the init endpoint rejects a body without one.
|
|
35
|
+
if (state.entityId == null) {
|
|
36
|
+
model.entity(DEFAULT_ENTITY)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (target === FLOW_PLACEHOLDER) {
|
|
40
|
+
model.transit(OidcAuthStep.Ephemeral, true)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return model
|
|
44
|
+
}
|
package/src/login/i18n/be.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"method": {
|
|
8
8
|
"google": "Працягнуць з Google",
|
|
9
9
|
"oidc": "Працягнуць з {{provider}}",
|
|
10
|
-
"oidc-default": "Увайсці",
|
|
10
|
+
"oidc-default": "Увайсці / Зарэгістравацца",
|
|
11
11
|
"oidc-client": "Працягнуць з {{provider}}",
|
|
12
12
|
"basic-ed25519": "Увайсці з ключом",
|
|
13
13
|
"pk-supervisor": "Сакрэтны ключ (аператар)",
|
package/src/login/i18n/de.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"method": {
|
|
8
8
|
"google": "Mit Google fortfahren",
|
|
9
9
|
"oidc": "Mit {{provider}} fortfahren",
|
|
10
|
-
"oidc-default": "Anmelden",
|
|
10
|
+
"oidc-default": "Anmelden / Registrieren",
|
|
11
11
|
"oidc-client": "Mit {{provider}} fortfahren",
|
|
12
12
|
"basic-ed25519": "Mit einem Schlüssel anmelden",
|
|
13
13
|
"pk-supervisor": "Geheimer Schlüssel (Betreiber)",
|
package/src/login/i18n/en.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"method": {
|
|
8
8
|
"google": "Continue with Google",
|
|
9
9
|
"oidc": "Continue with {{provider}}",
|
|
10
|
-
"oidc-default": "Sign in",
|
|
10
|
+
"oidc-default": "Sign in / Sign up",
|
|
11
11
|
"oidc-client": "Continue with {{provider}}",
|
|
12
12
|
"basic-ed25519": "Sign in with a key",
|
|
13
13
|
"pk-supervisor": "Secret key (operator)",
|
package/src/login/i18n/es.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"method": {
|
|
8
8
|
"google": "Continuar con Google",
|
|
9
9
|
"oidc": "Continuar con {{provider}}",
|
|
10
|
-
"oidc-default": "Iniciar sesión",
|
|
10
|
+
"oidc-default": "Iniciar sesión / Registrarse",
|
|
11
11
|
"oidc-client": "Continuar con {{provider}}",
|
|
12
12
|
"basic-ed25519": "Iniciar sesión con una clave",
|
|
13
13
|
"pk-supervisor": "Clave secreta (operador)",
|
package/src/login/i18n/pl.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"method": {
|
|
8
8
|
"google": "Kontynuuj z Google",
|
|
9
9
|
"oidc": "Kontynuuj z {{provider}}",
|
|
10
|
-
"oidc-default": "Zaloguj się",
|
|
10
|
+
"oidc-default": "Zaloguj się / Zarejestruj się",
|
|
11
11
|
"oidc-client": "Kontynuuj z {{provider}}",
|
|
12
12
|
"basic-ed25519": "Zaloguj się kluczem",
|
|
13
13
|
"pk-supervisor": "Klucz tajny (operator)",
|
package/src/login/i18n/ru.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"method": {
|
|
8
8
|
"google": "Продолжить с Google",
|
|
9
9
|
"oidc": "Продолжить с {{provider}}",
|
|
10
|
-
"oidc-default": "Войти",
|
|
10
|
+
"oidc-default": "Войти / Зарегистрироваться",
|
|
11
11
|
"oidc-client": "Продолжить с {{provider}}",
|
|
12
12
|
"basic-ed25519": "Войти с ключом",
|
|
13
13
|
"pk-supervisor": "Секретный ключ (оператор)",
|
package/src/login/i18n/uk.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"method": {
|
|
8
8
|
"google": "Продовжити з Google",
|
|
9
9
|
"oidc": "Продовжити з {{provider}}",
|
|
10
|
-
"oidc-default": "Увійти",
|
|
10
|
+
"oidc-default": "Увійти / Зареєструватися",
|
|
11
11
|
"oidc-client": "Продовжити з {{provider}}",
|
|
12
12
|
"basic-ed25519": "Увійти з ключем",
|
|
13
13
|
"pk-supervisor": "Секретний ключ (оператор)",
|
package/src/login/index.ts
CHANGED
package/src/login/resume.ts
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
import { LoginOutcome } from './types.js'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* The message key a FINISHED sign-in attempt should show, or null when it actually went somewhere.
|
|
5
|
+
*
|
|
6
|
+
* A dispatcher may treat `Passed` as "carry on with the ordinary continuation", because it has one.
|
|
7
|
+
* A screen does not: the user clicked, the document did not move, and nothing rendered — which is
|
|
8
|
+
* indistinguishable from a broken button, and is exactly how a null authorization URL used to
|
|
9
|
+
* present itself. Every outcome that leaves the user looking at the same screen therefore has to
|
|
10
|
+
* say something.
|
|
11
|
+
*/
|
|
12
|
+
export const loginAttemptError = (outcome: LoginOutcome | null): string | null => {
|
|
13
|
+
switch (outcome) {
|
|
14
|
+
case LoginOutcome.Gesture:
|
|
15
|
+
// The window never opened. That is the popup blocker, and it has its own copy.
|
|
16
|
+
return 'login.error.blocked'
|
|
17
|
+
case LoginOutcome.Failed:
|
|
18
|
+
case LoginOutcome.Passed:
|
|
19
|
+
return 'login.error.failed'
|
|
20
|
+
default:
|
|
21
|
+
// Handled, Redirected and Orphaned all did something; Orphaned reports itself elsewhere.
|
|
22
|
+
return null
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
3
26
|
/** What a dispatcher does once `login().resume(...)` has answered. */
|
|
4
27
|
export enum ResumeAction {
|
|
5
28
|
/** The plugin took it over — the browser is leaving, or the window is closing. */
|
package/src/login/screen.tsx
CHANGED
|
@@ -9,22 +9,23 @@ import { acceptTerms, resolveTerms, termsAccepted } from './terms.js'
|
|
|
9
9
|
import { resolveCredit } from './credit.js'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* The
|
|
13
|
-
*
|
|
14
|
-
* It exists because a relying party must render SOMETHING rather than start a flow on its own, and
|
|
15
|
-
* a relying party may not depend on a UI family. So this is deliberately plain: raw elements and
|
|
16
|
-
* inline styles, no Tailwind class that a consumer's stylesheet would have to scan for, no shadcn
|
|
17
|
-
* primitive a consumer would have to vendor. An application that registers a real screen through
|
|
18
|
-
* `login().registerScreen(...)` never sees it.
|
|
12
|
+
* The page the card sits in.
|
|
19
13
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
14
|
+
* It carries its own viewport height because this screen is rendered straight out of the
|
|
15
|
+
* dispatcher, into whatever the application happens to have around it — which is usually nothing
|
|
16
|
+
* with a height, so a percentage minimum would resolve to zero and leave the card at the top.
|
|
22
17
|
*/
|
|
23
|
-
const
|
|
24
|
-
|
|
18
|
+
const page: CSSProperties = {
|
|
19
|
+
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
20
|
+
minHeight: '100dvh', padding: '1rem',
|
|
25
21
|
fontFamily: 'system-ui, sans-serif', lineHeight: 1.5,
|
|
26
22
|
}
|
|
27
23
|
|
|
24
|
+
// Centred throughout, so the plain screen and the styled one read the same way.
|
|
25
|
+
const box: CSSProperties = {
|
|
26
|
+
width: '100%', maxWidth: '24rem', padding: '1.5rem', textAlign: 'center',
|
|
27
|
+
}
|
|
28
|
+
|
|
28
29
|
const button = (emphasis?: string): CSSProperties => ({
|
|
29
30
|
display: 'block', width: '100%', marginTop: '.5rem', padding: '.625rem 1rem',
|
|
30
31
|
fontSize: '1rem', cursor: 'pointer', borderRadius: '.375rem',
|
|
@@ -32,6 +33,19 @@ const button = (emphasis?: string): CSSProperties => ({
|
|
|
32
33
|
...(emphasis === 'primary' ? { fontWeight: 600 } : {}),
|
|
33
34
|
})
|
|
34
35
|
|
|
36
|
+
/**
|
|
37
|
+
* The sign-in screen every application gets, whether or not it registered a styled one.
|
|
38
|
+
*
|
|
39
|
+
* It exists because a relying party must render SOMETHING rather than start a flow on its own, and
|
|
40
|
+
* a relying party may not depend on a UI family. So this is deliberately plain: raw elements and
|
|
41
|
+
* inline styles, no Tailwind class that a consumer's stylesheet would have to scan for, no shadcn
|
|
42
|
+
* primitive a consumer would have to vendor. An application that registers a real screen through
|
|
43
|
+
* `login().registerScreen(...)` never sees it.
|
|
44
|
+
*
|
|
45
|
+
* Because it is the floor rather than the design, it still has to be correct: it offers the same
|
|
46
|
+
* methods, enforces the same terms confirmation, centres the same way, and renders the same
|
|
47
|
+
* credit line.
|
|
48
|
+
*/
|
|
35
49
|
export const FallbackLoginScreen: FC<LoginScreenProps> = props => {
|
|
36
50
|
const context = useContext() as unknown as LoginContext
|
|
37
51
|
const t = props.translate ?? ((_key: string, defaultValue: string) => defaultValue)
|
|
@@ -68,7 +82,7 @@ export const FallbackLoginScreen: FC<LoginScreenProps> = props => {
|
|
|
68
82
|
acceptTerms(resolved, value)
|
|
69
83
|
}, [resolved])
|
|
70
84
|
|
|
71
|
-
return <div style={box}>
|
|
85
|
+
return <div data-login-screen style={page}><div style={box}>
|
|
72
86
|
<h1 style={{ fontSize: '1.25rem', marginBottom: '.25rem' }}>
|
|
73
87
|
{props.title ?? t('login.title', 'Sign in')}
|
|
74
88
|
</h1>
|
|
@@ -118,5 +132,5 @@ export const FallbackLoginScreen: FC<LoginScreenProps> = props => {
|
|
|
118
132
|
{credit.poweredBy && credit.line != null && ' · '}
|
|
119
133
|
{credit.line}
|
|
120
134
|
</p>}
|
|
121
|
-
</div>
|
|
135
|
+
</div></div>
|
|
122
136
|
}
|
package/src/login/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentType, ReactNode } from 'react'
|
|
1
|
+
import type { ComponentType, CSSProperties, ReactNode } from 'react'
|
|
2
2
|
import type { LazyService, BasicContext } from '@owlmeans/context'
|
|
3
3
|
import type { LoginMethodEmphasis, LoginScreenConfig, LoginTermsConfig } from '@owlmeans/config'
|
|
4
4
|
|
|
@@ -206,6 +206,14 @@ export interface LoginScreenProps {
|
|
|
206
206
|
footer?: ReactNode
|
|
207
207
|
className?: string
|
|
208
208
|
containerClassName?: string
|
|
209
|
+
/**
|
|
210
|
+
* Inline overrides for the screen's outer box.
|
|
211
|
+
*
|
|
212
|
+
* It exists because the outer box carries its viewport height inline rather than as a utility
|
|
213
|
+
* class, and an escape hatch that a class can no longer provide has to be provided some other
|
|
214
|
+
* way. See the note on the screen itself.
|
|
215
|
+
*/
|
|
216
|
+
style?: CSSProperties
|
|
209
217
|
}
|
|
210
218
|
|
|
211
219
|
export type LoginScreenComponent = ComponentType<LoginScreenProps>
|
|
@@ -9,6 +9,11 @@ export const ed25519BasicUIPlugin: AuthenticationPlugin = {
|
|
|
9
9
|
|
|
10
10
|
method: { order: 300, icon: 'key', emphasis: 'secondary' },
|
|
11
11
|
|
|
12
|
+
// This package ships no UI family, so the form below is a `Renderer` a panel package assigns
|
|
13
|
+
// (`@owlmeans/web-panel/auth/plugins`, `@owlmeans/mui-panel/auth/plugins`). Until one does, the
|
|
14
|
+
// Implementation throws on mount — so the sign-in screen must not offer the method.
|
|
15
|
+
requiresRenderer: true,
|
|
16
|
+
|
|
12
17
|
Implementation: Renderer => ({ type, stage, control, params }) => {
|
|
13
18
|
|
|
14
19
|
type = type ?? AuthenticationType.BasicEd25519
|
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
import { CAUTHEN_AUTHEN_TYPED } from '@owlmeans/auth'
|
|
2
2
|
import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
|
|
3
3
|
import { DEFAULT_METHOD_ORDER, LOGIN_SERVICE } from '../../login/consts.js'
|
|
4
|
-
import type { LoginMethod, LoginMethodSource, LoginService } from '../../login/types.js'
|
|
4
|
+
import type { LoginMethod, LoginMethodContext, LoginMethodSource, LoginService } from '../../login/types.js'
|
|
5
|
+
import type { AuthenticationPlugin } from './types.js'
|
|
5
6
|
import { listAuthPlugins } from './registry.js'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* Whether a registered plugin may be put on the sign-in screen of THIS application.
|
|
10
|
+
*
|
|
11
|
+
* The registry is global and is filled by side-effect imports, so "registered" means only that
|
|
12
|
+
* some module was pulled into the bundle — three separate reasons why that is not enough:
|
|
9
13
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
14
|
+
* 1. No `method`: `re-captcha` is a STEP inside another flow, not a way to sign in.
|
|
15
|
+
* 2. No renderer: a plugin that declares `requiresRenderer` throws the moment its screen mounts
|
|
16
|
+
* unless a UI package (`web-panel`, `mui-panel`) assigned one. An app that imported the plugin
|
|
17
|
+
* host without that package would be offering buttons whose only outcome is a broken page.
|
|
18
|
+
* 3. Not wired: a plugin whose flow needs a service its context never appended fails on the
|
|
19
|
+
* lookup instead. Packages register their plugins in groups, so an app that wanted one of them
|
|
20
|
+
* gets the rest too, and the rest have to be able to say they do not apply here.
|
|
21
|
+
*/
|
|
22
|
+
const offerable = (plugin: AuthenticationPlugin, ctx: LoginMethodContext): boolean => {
|
|
23
|
+
if (plugin.method == null || plugin.method.hidden === true) {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
if (plugin.requiresRenderer === true && plugin.Renderer == null) {
|
|
27
|
+
return false
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return plugin.method.available?.(ctx) !== false
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Every registered authentication plugin that declares itself offerable, as a sign-in method.
|
|
13
35
|
*/
|
|
14
36
|
export const pluginMethodSource: LoginMethodSource = {
|
|
15
37
|
alias: 'authentication-plugins',
|
|
16
38
|
|
|
17
|
-
list:
|
|
18
|
-
.filter(plugin => plugin
|
|
39
|
+
list: ctx => listAuthPlugins()
|
|
40
|
+
.filter(plugin => offerable(plugin, ctx))
|
|
19
41
|
.map((plugin): LoginMethod => {
|
|
20
42
|
const meta = plugin.method!
|
|
21
43
|
const type = plugin.type
|
|
@@ -8,6 +8,10 @@ export const reCaptchaPlugin: AuthenticationPlugin = {
|
|
|
8
8
|
// A STEP inside another flow, never a way to sign in — so it is registered and never offered.
|
|
9
9
|
method: { hidden: true },
|
|
10
10
|
|
|
11
|
+
// Its widget is a `Renderer` a panel package assigns. `hidden` already keeps it off the sign-in
|
|
12
|
+
// screen; this is what the flow that DOES drive it can check before handing it a stage.
|
|
13
|
+
requiresRenderer: true,
|
|
14
|
+
|
|
11
15
|
Implementation: Renderer => ({ type, stage, control, params }) => {
|
|
12
16
|
Renderer = Renderer ?? reCaptchaPlugin.Renderer
|
|
13
17
|
|
|
@@ -15,6 +15,10 @@ export const tunnelConsumerUIPlugin: AuthenticationPlugin = {
|
|
|
15
15
|
|
|
16
16
|
method: { order: 400, icon: 'wallet' },
|
|
17
17
|
|
|
18
|
+
// The PIN form is a `Renderer` a panel package assigns; without one the Implementation throws on
|
|
19
|
+
// mount, so the method must not be offered.
|
|
20
|
+
requiresRenderer: true,
|
|
21
|
+
|
|
18
22
|
Implementation: renderer => ({ type, stage, control, params }) => {
|
|
19
23
|
type = type ?? AuthenticationType.WalletConsumer
|
|
20
24
|
const Renderer: TunnelAuthenticationRenderer | undefined = renderer
|