@kya-os/consent 0.1.49 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -9
- package/dist/bundle/browser.d.ts +18 -0
- package/dist/bundle/browser.d.ts.map +1 -0
- package/dist/bundle/browser.js +18 -0
- package/dist/bundle/browser.js.map +1 -0
- package/dist/bundle/inline.d.ts.map +1 -1
- package/dist/bundle/inline.js +4 -4
- package/dist/bundle/inline.js.map +1 -1
- package/dist/bundle/shell.d.ts +4 -2
- package/dist/bundle/shell.d.ts.map +1 -1
- package/dist/bundle/shell.js +16 -43
- package/dist/bundle/shell.js.map +1 -1
- package/dist/cjs/bundle/inline.js +4 -4
- package/dist/cjs/bundle/inline.js.map +1 -1
- package/dist/cjs/bundle/shell.js +16 -43
- package/dist/cjs/bundle/shell.js.map +1 -1
- package/dist/cjs/components/consent-agent-header.js +81 -21
- package/dist/cjs/components/consent-agent-header.js.map +1 -1
- package/dist/cjs/components/consent-button.js +16 -13
- package/dist/cjs/components/consent-button.js.map +1 -1
- package/dist/cjs/components/consent-capabilities-screen.js +15 -5
- package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
- package/dist/cjs/components/consent-checkbox.js +21 -17
- package/dist/cjs/components/consent-checkbox.js.map +1 -1
- package/dist/cjs/components/consent-connector-header.js +14 -3
- package/dist/cjs/components/consent-connector-header.js.map +1 -1
- package/dist/cjs/components/consent-permissions.js +16 -15
- package/dist/cjs/components/consent-permissions.js.map +1 -1
- package/dist/cjs/components/consent-revocation-notice.js +23 -5
- package/dist/cjs/components/consent-revocation-notice.js.map +1 -1
- package/dist/cjs/components/consent-shell.js +35 -17
- package/dist/cjs/components/consent-shell.js.map +1 -1
- package/dist/cjs/components/consent-terms.js +27 -23
- package/dist/cjs/components/consent-terms.js.map +1 -1
- package/dist/cjs/components/mcp-consent.js +222 -45
- package/dist/cjs/components/mcp-consent.js.map +1 -1
- package/dist/cjs/constants/auth-modes.js +1 -1
- package/dist/cjs/constants/auth-modes.js.map +1 -1
- package/dist/cjs/constants/colors.js +7 -2
- package/dist/cjs/constants/colors.js.map +1 -1
- package/dist/cjs/constants/defaults.js +1 -1
- package/dist/cjs/copy/tokens.js +45 -1
- package/dist/cjs/copy/tokens.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/mcp-app/inline.js +2 -2
- package/dist/cjs/mcp-app/inline.js.map +1 -1
- package/dist/cjs/react/index.js +1 -1
- package/dist/cjs/resolution/resolve-branding.js +3 -1
- package/dist/cjs/resolution/resolve-branding.js.map +1 -1
- package/dist/cjs/resolution/resolve-config.js +3 -0
- package/dist/cjs/resolution/resolve-config.js.map +1 -1
- package/dist/cjs/schemas/api.schemas.js +1 -1
- package/dist/cjs/schemas/branding.schemas.js +3 -0
- package/dist/cjs/schemas/branding.schemas.js.map +1 -1
- package/dist/cjs/schemas/capabilities.schemas.js +48 -3
- package/dist/cjs/schemas/capabilities.schemas.js.map +1 -1
- package/dist/cjs/schemas/config.schemas.js +1 -0
- package/dist/cjs/schemas/config.schemas.js.map +1 -1
- package/dist/cjs/schemas/modes.schemas.js +1 -0
- package/dist/cjs/schemas/modes.schemas.js.map +1 -1
- package/dist/cjs/styles/contrast.js +100 -0
- package/dist/cjs/styles/contrast.js.map +1 -0
- package/dist/cjs/styles/css-variables.js +36 -1
- package/dist/cjs/styles/css-variables.js.map +1 -1
- package/dist/cjs/styles/index.js +2 -1
- package/dist/cjs/styles/index.js.map +1 -1
- package/dist/cjs/styles/stylesheet.js +10 -5
- package/dist/cjs/styles/stylesheet.js.map +1 -1
- package/dist/cjs/styles/theme.js +29 -1
- package/dist/cjs/styles/theme.js.map +1 -1
- package/dist/cjs/styles/tokens.js +8 -8
- package/dist/cjs/styles/tokens.js.map +1 -1
- package/dist/cjs/templates/base/components.js +1 -1
- package/dist/cjs/templates/index.js +1 -0
- package/dist/cjs/templates/index.js.map +1 -1
- package/dist/cjs/templates/modes/credentials.template.js +15 -13
- package/dist/cjs/templates/modes/credentials.template.js.map +1 -1
- package/dist/cjs/templates/modes/index.js +3 -1
- package/dist/cjs/templates/modes/index.js.map +1 -1
- package/dist/cjs/templates/modes/passkey.template.js +178 -0
- package/dist/cjs/templates/modes/passkey.template.js.map +1 -0
- package/dist/cjs/templates/modes/success.template.js +2 -7
- package/dist/cjs/templates/modes/success.template.js.map +1 -1
- package/dist/cjs/templates/registry.js +4 -3
- package/dist/cjs/templates/registry.js.map +1 -1
- package/dist/cjs/types/capabilities.types.js +27 -2
- package/dist/cjs/types/capabilities.types.js.map +1 -1
- package/dist/cjs/types/index.js +1 -1
- package/dist/cjs/types/modes.types.js +11 -4
- package/dist/cjs/types/modes.types.js.map +1 -1
- package/dist/components/consent-agent-header.d.ts +16 -3
- package/dist/components/consent-agent-header.d.ts.map +1 -1
- package/dist/components/consent-agent-header.js +81 -21
- package/dist/components/consent-agent-header.js.map +1 -1
- package/dist/components/consent-button.d.ts +6 -5
- package/dist/components/consent-button.d.ts.map +1 -1
- package/dist/components/consent-button.js +18 -15
- package/dist/components/consent-button.js.map +1 -1
- package/dist/components/consent-capabilities-screen.d.ts +3 -1
- package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
- package/dist/components/consent-capabilities-screen.js +15 -5
- package/dist/components/consent-capabilities-screen.js.map +1 -1
- package/dist/components/consent-checkbox.d.ts +4 -2
- package/dist/components/consent-checkbox.d.ts.map +1 -1
- package/dist/components/consent-checkbox.js +23 -19
- package/dist/components/consent-checkbox.js.map +1 -1
- package/dist/components/consent-connector-header.d.ts.map +1 -1
- package/dist/components/consent-connector-header.js +14 -3
- package/dist/components/consent-connector-header.js.map +1 -1
- package/dist/components/consent-passkey.d.ts +128 -0
- package/dist/components/consent-passkey.d.ts.map +1 -0
- package/dist/components/consent-passkey.js +408 -0
- package/dist/components/consent-passkey.js.map +1 -0
- package/dist/components/consent-permissions.d.ts +4 -3
- package/dist/components/consent-permissions.d.ts.map +1 -1
- package/dist/components/consent-permissions.js +18 -17
- package/dist/components/consent-permissions.js.map +1 -1
- package/dist/components/consent-revocation-notice.d.ts +8 -0
- package/dist/components/consent-revocation-notice.d.ts.map +1 -1
- package/dist/components/consent-revocation-notice.js +23 -5
- package/dist/components/consent-revocation-notice.js.map +1 -1
- package/dist/components/consent-shell.d.ts +2 -2
- package/dist/components/consent-shell.d.ts.map +1 -1
- package/dist/components/consent-shell.js +37 -19
- package/dist/components/consent-shell.js.map +1 -1
- package/dist/components/consent-terms.d.ts +4 -2
- package/dist/components/consent-terms.d.ts.map +1 -1
- package/dist/components/consent-terms.js +29 -25
- package/dist/components/consent-terms.js.map +1 -1
- package/dist/components/mcp-consent.d.ts +11 -3
- package/dist/components/mcp-consent.d.ts.map +1 -1
- package/dist/components/mcp-consent.js +222 -45
- package/dist/components/mcp-consent.js.map +1 -1
- package/dist/consent.js +1102 -140
- package/dist/consent.min.js +481 -228
- package/dist/constants/auth-modes.js +1 -1
- package/dist/constants/auth-modes.js.map +1 -1
- package/dist/constants/colors.d.ts +7 -2
- package/dist/constants/colors.d.ts.map +1 -1
- package/dist/constants/colors.js +7 -2
- package/dist/constants/colors.js.map +1 -1
- package/dist/constants/defaults.d.ts +1 -1
- package/dist/constants/defaults.js +1 -1
- package/dist/copy/tokens.d.ts +45 -1
- package/dist/copy/tokens.d.ts.map +1 -1
- package/dist/copy/tokens.js +45 -1
- package/dist/copy/tokens.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp-app/inline.d.ts.map +1 -1
- package/dist/mcp-app/inline.js +2 -2
- package/dist/mcp-app/inline.js.map +1 -1
- package/dist/passkey/index.d.ts +19 -0
- package/dist/passkey/index.d.ts.map +1 -0
- package/dist/passkey/index.js +18 -0
- package/dist/passkey/index.js.map +1 -0
- package/dist/passkey/react.d.ts +34 -0
- package/dist/passkey/react.d.ts.map +1 -0
- package/dist/passkey/react.js +39 -0
- package/dist/passkey/react.js.map +1 -0
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/resolution/resolve-branding.d.ts.map +1 -1
- package/dist/resolution/resolve-branding.js +3 -1
- package/dist/resolution/resolve-branding.js.map +1 -1
- package/dist/resolution/resolve-config.d.ts.map +1 -1
- package/dist/resolution/resolve-config.js +3 -0
- package/dist/resolution/resolve-config.js.map +1 -1
- package/dist/schemas/api.schemas.d.ts +55 -9
- package/dist/schemas/api.schemas.d.ts.map +1 -1
- package/dist/schemas/api.schemas.js +1 -1
- package/dist/schemas/branding.schemas.d.ts +24 -0
- package/dist/schemas/branding.schemas.d.ts.map +1 -1
- package/dist/schemas/branding.schemas.js +3 -0
- package/dist/schemas/branding.schemas.js.map +1 -1
- package/dist/schemas/capabilities.schemas.d.ts +38 -4
- package/dist/schemas/capabilities.schemas.d.ts.map +1 -1
- package/dist/schemas/capabilities.schemas.js +47 -2
- package/dist/schemas/capabilities.schemas.js.map +1 -1
- package/dist/schemas/config.schemas.d.ts +88 -12
- package/dist/schemas/config.schemas.d.ts.map +1 -1
- package/dist/schemas/config.schemas.js +1 -0
- package/dist/schemas/config.schemas.js.map +1 -1
- package/dist/schemas/modes.schemas.d.ts +8 -0
- package/dist/schemas/modes.schemas.d.ts.map +1 -1
- package/dist/schemas/modes.schemas.js +1 -0
- package/dist/schemas/modes.schemas.js.map +1 -1
- package/dist/styles/contrast.d.ts +33 -0
- package/dist/styles/contrast.d.ts.map +1 -0
- package/dist/styles/contrast.js +92 -0
- package/dist/styles/contrast.js.map +1 -0
- package/dist/styles/css-variables.d.ts +20 -0
- package/dist/styles/css-variables.d.ts.map +1 -1
- package/dist/styles/css-variables.js +35 -1
- package/dist/styles/css-variables.js.map +1 -1
- package/dist/styles/index.d.ts +2 -1
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/index.js +2 -1
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/stylesheet.d.ts +1 -1
- package/dist/styles/stylesheet.d.ts.map +1 -1
- package/dist/styles/stylesheet.js +10 -5
- package/dist/styles/stylesheet.js.map +1 -1
- package/dist/styles/theme.d.ts +32 -1
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles/theme.js +29 -1
- package/dist/styles/theme.js.map +1 -1
- package/dist/styles/tokens.d.ts +5 -5
- package/dist/styles/tokens.js +8 -8
- package/dist/styles/tokens.js.map +1 -1
- package/dist/templates/base/components.d.ts +1 -1
- package/dist/templates/base/components.js +1 -1
- package/dist/templates/index.d.ts +1 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +1 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/modes/credentials.template.d.ts +5 -5
- package/dist/templates/modes/credentials.template.d.ts.map +1 -1
- package/dist/templates/modes/credentials.template.js +15 -13
- package/dist/templates/modes/credentials.template.js.map +1 -1
- package/dist/templates/modes/index.d.ts +1 -0
- package/dist/templates/modes/index.d.ts.map +1 -1
- package/dist/templates/modes/index.js +1 -0
- package/dist/templates/modes/index.js.map +1 -1
- package/dist/templates/modes/passkey.template.d.ts +62 -0
- package/dist/templates/modes/passkey.template.d.ts.map +1 -0
- package/dist/templates/modes/passkey.template.js +174 -0
- package/dist/templates/modes/passkey.template.js.map +1 -0
- package/dist/templates/modes/success.template.d.ts.map +1 -1
- package/dist/templates/modes/success.template.js +2 -7
- package/dist/templates/modes/success.template.js.map +1 -1
- package/dist/templates/registry.d.ts +3 -3
- package/dist/templates/registry.d.ts.map +1 -1
- package/dist/templates/registry.js +6 -5
- package/dist/templates/registry.js.map +1 -1
- package/dist/types/api.types.d.ts +1 -1
- package/dist/types/branding.types.d.ts +6 -0
- package/dist/types/branding.types.d.ts.map +1 -1
- package/dist/types/capabilities.types.d.ts +44 -7
- package/dist/types/capabilities.types.d.ts.map +1 -1
- package/dist/types/capabilities.types.js +26 -2
- package/dist/types/capabilities.types.js.map +1 -1
- package/dist/types/config.types.d.ts +11 -2
- package/dist/types/config.types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/modes.types.d.ts +31 -4
- package/dist/types/modes.types.d.ts.map +1 -1
- package/dist/types/modes.types.js +10 -3
- package/dist/types/modes.types.js.map +1 -1
- package/dist/types/page.types.d.ts +8 -2
- package/dist/types/page.types.d.ts.map +1 -1
- package/package.json +29 -5
package/dist/consent.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
4
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
5
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
6
|
for (var i6 = decorators.length - 1, decorator; i6 >= 0; i6--)
|
|
@@ -8,6 +9,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
8
9
|
if (kind && result) __defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
12
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
11
13
|
|
|
12
14
|
// ../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.js
|
|
13
15
|
var t = globalThis;
|
|
@@ -662,7 +664,7 @@ ConsentButton.styles = i`
|
|
|
662
664
|
}
|
|
663
665
|
|
|
664
666
|
button {
|
|
665
|
-
/* Base styles - matches
|
|
667
|
+
/* Base styles - matches Checkpoint PreviewButton exactly */
|
|
666
668
|
padding: 0.75rem 1rem;
|
|
667
669
|
height: 2.75rem;
|
|
668
670
|
border-radius: 0.5rem;
|
|
@@ -670,7 +672,9 @@ ConsentButton.styles = i`
|
|
|
670
672
|
font-weight: 500;
|
|
671
673
|
font-family: inherit;
|
|
672
674
|
cursor: pointer;
|
|
673
|
-
transition:
|
|
675
|
+
transition:
|
|
676
|
+
opacity 0.15s ease,
|
|
677
|
+
background-color 0.15s ease;
|
|
674
678
|
border: none;
|
|
675
679
|
width: 100%;
|
|
676
680
|
display: inline-flex;
|
|
@@ -680,23 +684,23 @@ ConsentButton.styles = i`
|
|
|
680
684
|
}
|
|
681
685
|
|
|
682
686
|
/* Primary variant */
|
|
683
|
-
:host([variant=
|
|
687
|
+
:host([variant="primary"]) button {
|
|
684
688
|
background-color: var(--consent-primary, #2563eb);
|
|
685
|
-
color: white;
|
|
689
|
+
color: var(--consent-on-primary, white);
|
|
686
690
|
}
|
|
687
691
|
|
|
688
|
-
:host([variant=
|
|
692
|
+
:host([variant="primary"]) button:hover:not(:disabled) {
|
|
689
693
|
opacity: 0.9;
|
|
690
694
|
}
|
|
691
695
|
|
|
692
696
|
/* Secondary variant */
|
|
693
|
-
:host([variant=
|
|
697
|
+
:host([variant="secondary"]) button {
|
|
694
698
|
background-color: transparent;
|
|
695
699
|
color: #374151;
|
|
696
700
|
border: 1px solid #d1d5db;
|
|
697
701
|
}
|
|
698
702
|
|
|
699
|
-
:host([variant=
|
|
703
|
+
:host([variant="secondary"]) button:hover:not(:disabled) {
|
|
700
704
|
background-color: #f9fafb;
|
|
701
705
|
}
|
|
702
706
|
|
|
@@ -819,14 +823,14 @@ ConsentCheckbox.styles = i`
|
|
|
819
823
|
opacity: 0.6;
|
|
820
824
|
}
|
|
821
825
|
|
|
822
|
-
/* Custom checkbox styling - matches
|
|
823
|
-
input[type=
|
|
826
|
+
/* Custom checkbox styling - matches Checkpoint exactly */
|
|
827
|
+
input[type="checkbox"] {
|
|
824
828
|
/* Reset */
|
|
825
829
|
appearance: none;
|
|
826
830
|
-webkit-appearance: none;
|
|
827
831
|
margin: 0;
|
|
828
832
|
|
|
829
|
-
/* Size - matches
|
|
833
|
+
/* Size - matches Checkpoint w-4 h-4 */
|
|
830
834
|
width: 1rem;
|
|
831
835
|
height: 1rem;
|
|
832
836
|
min-width: 1rem;
|
|
@@ -842,39 +846,41 @@ ConsentCheckbox.styles = i`
|
|
|
842
846
|
/* Interaction */
|
|
843
847
|
cursor: pointer;
|
|
844
848
|
position: relative;
|
|
845
|
-
transition:
|
|
849
|
+
transition:
|
|
850
|
+
background-color 0.15s ease,
|
|
851
|
+
border-color 0.15s ease;
|
|
846
852
|
}
|
|
847
853
|
|
|
848
|
-
input[type=
|
|
854
|
+
input[type="checkbox"]:hover:not(:disabled) {
|
|
849
855
|
border-color: var(--consent-primary, #2563eb);
|
|
850
856
|
}
|
|
851
857
|
|
|
852
|
-
input[type=
|
|
858
|
+
input[type="checkbox"]:focus-visible {
|
|
853
859
|
outline: 2px solid var(--consent-primary, #2563eb);
|
|
854
860
|
outline-offset: 2px;
|
|
855
861
|
}
|
|
856
862
|
|
|
857
863
|
/* Checked state */
|
|
858
|
-
input[type=
|
|
864
|
+
input[type="checkbox"]:checked {
|
|
859
865
|
background-color: var(--consent-primary, #2563eb);
|
|
860
866
|
border-color: var(--consent-primary, #2563eb);
|
|
861
867
|
}
|
|
862
868
|
|
|
863
869
|
/* Checkmark */
|
|
864
|
-
input[type=
|
|
865
|
-
content:
|
|
870
|
+
input[type="checkbox"]:checked::after {
|
|
871
|
+
content: "";
|
|
866
872
|
position: absolute;
|
|
867
873
|
left: 4px;
|
|
868
874
|
top: 1px;
|
|
869
875
|
width: 5px;
|
|
870
876
|
height: 9px;
|
|
871
|
-
border: solid white;
|
|
877
|
+
border: solid var(--consent-on-primary, white);
|
|
872
878
|
border-width: 0 2px 2px 0;
|
|
873
879
|
transform: rotate(45deg);
|
|
874
880
|
}
|
|
875
881
|
|
|
876
882
|
/* Disabled */
|
|
877
|
-
input[type=
|
|
883
|
+
input[type="checkbox"]:disabled {
|
|
878
884
|
cursor: not-allowed;
|
|
879
885
|
opacity: 0.5;
|
|
880
886
|
}
|
|
@@ -886,7 +892,7 @@ ConsentCheckbox.styles = i`
|
|
|
886
892
|
|
|
887
893
|
/* Links in label */
|
|
888
894
|
::slotted(a) {
|
|
889
|
-
color: var(--consent-primary, #2563eb);
|
|
895
|
+
color: var(--consent-link, var(--consent-primary, #2563eb));
|
|
890
896
|
text-decoration: underline;
|
|
891
897
|
}
|
|
892
898
|
|
|
@@ -1181,7 +1187,130 @@ ConsentInput = __decorateClass([
|
|
|
1181
1187
|
t3("consent-input")
|
|
1182
1188
|
], ConsentInput);
|
|
1183
1189
|
|
|
1190
|
+
// src/constants/colors.ts
|
|
1191
|
+
var DEFAULT_COLORS = {
|
|
1192
|
+
/** Primary brand color - Tailwind blue-600 */
|
|
1193
|
+
PRIMARY: "#2563EB",
|
|
1194
|
+
/** Secondary/accent color - Tailwind blue-100 */
|
|
1195
|
+
SECONDARY: "#DBEAFE",
|
|
1196
|
+
/**
|
|
1197
|
+
* Text on a secondary fill (the scope badges), kept wherever it reaches
|
|
1198
|
+
* WCAG AA on the brand's secondary color.
|
|
1199
|
+
*/
|
|
1200
|
+
ON_SECONDARY: "#0E2249",
|
|
1201
|
+
/** Background color */
|
|
1202
|
+
BACKGROUND: "#F9FAFB",
|
|
1203
|
+
/** Text colors */
|
|
1204
|
+
TEXT_PRIMARY: "#111827",
|
|
1205
|
+
TEXT_SECONDARY: "#6B7280",
|
|
1206
|
+
TEXT_MUTED: "#9CA3AF",
|
|
1207
|
+
/** Border colors */
|
|
1208
|
+
BORDER: "#E5E7EB",
|
|
1209
|
+
BORDER_DARK: "#D1D5DB",
|
|
1210
|
+
/** Success color - Tailwind green-600 */
|
|
1211
|
+
SUCCESS: "#16A34A",
|
|
1212
|
+
/** Error color - Tailwind red-600 */
|
|
1213
|
+
ERROR: "#DC2626",
|
|
1214
|
+
/** Warning color - Tailwind amber-500 */
|
|
1215
|
+
WARNING: "#F59E0B"
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
// src/styles/contrast.ts
|
|
1219
|
+
var AA_TEXT_CONTRAST = 4.5;
|
|
1220
|
+
var WHITE = "#FFFFFF";
|
|
1221
|
+
var BLACK = "#000000";
|
|
1222
|
+
var HEX_COLOR = /^#[0-9A-Fa-f]{6}$/;
|
|
1223
|
+
function isHexColor(value) {
|
|
1224
|
+
return typeof value === "string" && HEX_COLOR.test(value);
|
|
1225
|
+
}
|
|
1226
|
+
function channels(hex) {
|
|
1227
|
+
if (!isHexColor(hex)) {
|
|
1228
|
+
throw new RangeError(
|
|
1229
|
+
`Expected a #rrggbb color, got ${JSON.stringify(hex)}`
|
|
1230
|
+
);
|
|
1231
|
+
}
|
|
1232
|
+
return [1, 3, 5].map((at) => parseInt(hex.slice(at, at + 2), 16));
|
|
1233
|
+
}
|
|
1234
|
+
function toHex(rgb) {
|
|
1235
|
+
return `#${rgb.map((c4) => c4.toString(16).padStart(2, "0")).join("")}`.toUpperCase();
|
|
1236
|
+
}
|
|
1237
|
+
function linear(value) {
|
|
1238
|
+
const c4 = value / 255;
|
|
1239
|
+
return c4 <= 0.03928 ? c4 / 12.92 : ((c4 + 0.055) / 1.055) ** 2.4;
|
|
1240
|
+
}
|
|
1241
|
+
function relativeLuminance(hex) {
|
|
1242
|
+
const [r7, g2, b3] = channels(hex);
|
|
1243
|
+
return 0.2126 * linear(r7) + 0.7152 * linear(g2) + 0.0722 * linear(b3);
|
|
1244
|
+
}
|
|
1245
|
+
function contrastRatio(a3, b3) {
|
|
1246
|
+
const la = relativeLuminance(a3);
|
|
1247
|
+
const lb = relativeLuminance(b3);
|
|
1248
|
+
return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
|
|
1249
|
+
}
|
|
1250
|
+
function readableTextOn(background, preferred) {
|
|
1251
|
+
if (preferred !== void 0 && contrastRatio(preferred, background) >= AA_TEXT_CONTRAST) {
|
|
1252
|
+
return preferred;
|
|
1253
|
+
}
|
|
1254
|
+
return contrastRatio(BLACK, background) >= contrastRatio(WHITE, background) ? BLACK : WHITE;
|
|
1255
|
+
}
|
|
1256
|
+
function readableTextColor(color, surface = WHITE) {
|
|
1257
|
+
if (contrastRatio(color, surface) >= AA_TEXT_CONTRAST) return color;
|
|
1258
|
+
const [r7, g2, b3] = channels(color);
|
|
1259
|
+
const [tr, tg, tb] = channels(readableTextOn(surface));
|
|
1260
|
+
const toward = (c4, target, amount) => {
|
|
1261
|
+
const exact = c4 + (target - c4) * amount;
|
|
1262
|
+
return target > c4 ? Math.ceil(exact) : Math.floor(exact);
|
|
1263
|
+
};
|
|
1264
|
+
const mix = (amount) => toHex([
|
|
1265
|
+
toward(r7, tr, amount),
|
|
1266
|
+
toward(g2, tg, amount),
|
|
1267
|
+
toward(b3, tb, amount)
|
|
1268
|
+
]);
|
|
1269
|
+
let low = 0;
|
|
1270
|
+
let high = 1;
|
|
1271
|
+
for (let step = 0; step < 16; step++) {
|
|
1272
|
+
const middle = (low + high) / 2;
|
|
1273
|
+
if (contrastRatio(mix(middle), surface) >= AA_TEXT_CONTRAST) high = middle;
|
|
1274
|
+
else low = middle;
|
|
1275
|
+
}
|
|
1276
|
+
return mix(high);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
// src/styles/css-variables.ts
|
|
1280
|
+
var CSS_VAR_NAMES = {
|
|
1281
|
+
PRIMARY: "--consent-primary",
|
|
1282
|
+
SECONDARY: "--consent-secondary",
|
|
1283
|
+
PRIMARY_RGB: "--consent-primary-rgb",
|
|
1284
|
+
SECONDARY_RGB: "--consent-secondary-rgb",
|
|
1285
|
+
ON_PRIMARY: "--consent-on-primary",
|
|
1286
|
+
ON_SECONDARY: "--consent-on-secondary",
|
|
1287
|
+
LINK: "--consent-link",
|
|
1288
|
+
BACKGROUND: "--consent-background",
|
|
1289
|
+
TEXT_PRIMARY: "--consent-text-primary",
|
|
1290
|
+
TEXT_SECONDARY: "--consent-text-secondary",
|
|
1291
|
+
BORDER: "--consent-border"
|
|
1292
|
+
};
|
|
1293
|
+
function generateContrastCSSVariables(primary, secondary) {
|
|
1294
|
+
return {
|
|
1295
|
+
...isHexColor(primary) && {
|
|
1296
|
+
"--consent-on-primary": readableTextOn(primary),
|
|
1297
|
+
"--consent-link": readableTextColor(primary)
|
|
1298
|
+
},
|
|
1299
|
+
...isHexColor(secondary) && {
|
|
1300
|
+
"--consent-on-secondary": readableTextOn(
|
|
1301
|
+
secondary,
|
|
1302
|
+
DEFAULT_COLORS.ON_SECONDARY
|
|
1303
|
+
)
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1184
1308
|
// src/components/consent-shell.ts
|
|
1309
|
+
var CONTRAST_VARS = [
|
|
1310
|
+
CSS_VAR_NAMES.ON_PRIMARY,
|
|
1311
|
+
CSS_VAR_NAMES.ON_SECONDARY,
|
|
1312
|
+
CSS_VAR_NAMES.LINK
|
|
1313
|
+
];
|
|
1185
1314
|
var ConsentShell = class extends i4 {
|
|
1186
1315
|
constructor() {
|
|
1187
1316
|
super(...arguments);
|
|
@@ -1224,6 +1353,15 @@ var ConsentShell = class extends i4 {
|
|
|
1224
1353
|
if (changedProperties.has("primaryColor") || changedProperties.has("secondaryColor")) {
|
|
1225
1354
|
this.style.setProperty("--consent-primary", this.primaryColor);
|
|
1226
1355
|
this.style.setProperty("--consent-secondary", this.secondaryColor);
|
|
1356
|
+
const derived = generateContrastCSSVariables(
|
|
1357
|
+
this.primaryColor,
|
|
1358
|
+
this.secondaryColor
|
|
1359
|
+
);
|
|
1360
|
+
for (const name of CONTRAST_VARS) {
|
|
1361
|
+
const value = derived[name];
|
|
1362
|
+
if (value) this.style.setProperty(name, value);
|
|
1363
|
+
else this.style.removeProperty(name);
|
|
1364
|
+
}
|
|
1227
1365
|
}
|
|
1228
1366
|
}
|
|
1229
1367
|
render() {
|
|
@@ -1250,8 +1388,9 @@ ConsentShell.styles = i`
|
|
|
1250
1388
|
:host {
|
|
1251
1389
|
display: block;
|
|
1252
1390
|
/* System font stack with font smoothing for crisp text */
|
|
1253
|
-
font-family:
|
|
1254
|
-
|
|
1391
|
+
font-family:
|
|
1392
|
+
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
|
|
1393
|
+
Arial, sans-serif;
|
|
1255
1394
|
-webkit-font-smoothing: antialiased;
|
|
1256
1395
|
-moz-osx-font-smoothing: grayscale;
|
|
1257
1396
|
/* Allow customization via CSS variables */
|
|
@@ -1259,7 +1398,7 @@ ConsentShell.styles = i`
|
|
|
1259
1398
|
--_secondary: var(--consent-secondary, #dbeafe);
|
|
1260
1399
|
}
|
|
1261
1400
|
|
|
1262
|
-
/* Container - matches
|
|
1401
|
+
/* Container - matches Checkpoint PreviewShell exactly */
|
|
1263
1402
|
.container {
|
|
1264
1403
|
background: white;
|
|
1265
1404
|
border-radius: 20px;
|
|
@@ -1577,7 +1716,7 @@ ConsentPermissions.styles = i`
|
|
|
1577
1716
|
.icon-check svg {
|
|
1578
1717
|
width: 0.75rem;
|
|
1579
1718
|
height: 0.75rem;
|
|
1580
|
-
color: white;
|
|
1719
|
+
color: var(--consent-on-primary, white);
|
|
1581
1720
|
}
|
|
1582
1721
|
|
|
1583
1722
|
.icon-bullet {
|
|
@@ -1645,13 +1784,13 @@ ConsentPermissions.styles = i`
|
|
|
1645
1784
|
}
|
|
1646
1785
|
|
|
1647
1786
|
.checkbox:checked::after {
|
|
1648
|
-
content:
|
|
1787
|
+
content: "";
|
|
1649
1788
|
position: absolute;
|
|
1650
1789
|
left: 4px;
|
|
1651
1790
|
top: 1px;
|
|
1652
1791
|
width: 5px;
|
|
1653
1792
|
height: 9px;
|
|
1654
|
-
border: solid white;
|
|
1793
|
+
border: solid var(--consent-on-primary, white);
|
|
1655
1794
|
border-width: 0 2px 2px 0;
|
|
1656
1795
|
transform: rotate(45deg);
|
|
1657
1796
|
}
|
|
@@ -1683,7 +1822,10 @@ __decorateClass([
|
|
|
1683
1822
|
try {
|
|
1684
1823
|
const parsed = JSON.parse(value);
|
|
1685
1824
|
if (!Array.isArray(parsed)) {
|
|
1686
|
-
console.warn(
|
|
1825
|
+
console.warn(
|
|
1826
|
+
"[consent-permissions] Expected array, got:",
|
|
1827
|
+
typeof parsed
|
|
1828
|
+
);
|
|
1687
1829
|
return [];
|
|
1688
1830
|
}
|
|
1689
1831
|
return parsed;
|
|
@@ -1813,13 +1955,13 @@ ConsentTerms.styles = i`
|
|
|
1813
1955
|
opacity: 0.6;
|
|
1814
1956
|
}
|
|
1815
1957
|
|
|
1816
|
-
/* Custom checkbox styling - matches
|
|
1817
|
-
input[type=
|
|
1958
|
+
/* Custom checkbox styling - matches Checkpoint exactly */
|
|
1959
|
+
input[type="checkbox"] {
|
|
1818
1960
|
appearance: none;
|
|
1819
1961
|
-webkit-appearance: none;
|
|
1820
1962
|
margin: 0;
|
|
1821
1963
|
|
|
1822
|
-
/* Size - matches
|
|
1964
|
+
/* Size - matches Checkpoint w-4 h-4 */
|
|
1823
1965
|
width: 1rem;
|
|
1824
1966
|
height: 1rem;
|
|
1825
1967
|
min-width: 1rem;
|
|
@@ -1835,39 +1977,41 @@ ConsentTerms.styles = i`
|
|
|
1835
1977
|
/* Interaction */
|
|
1836
1978
|
cursor: pointer;
|
|
1837
1979
|
position: relative;
|
|
1838
|
-
transition:
|
|
1980
|
+
transition:
|
|
1981
|
+
background-color 0.15s ease,
|
|
1982
|
+
border-color 0.15s ease;
|
|
1839
1983
|
}
|
|
1840
1984
|
|
|
1841
|
-
input[type=
|
|
1985
|
+
input[type="checkbox"]:hover:not(:disabled) {
|
|
1842
1986
|
border-color: var(--_primary);
|
|
1843
1987
|
}
|
|
1844
1988
|
|
|
1845
|
-
input[type=
|
|
1989
|
+
input[type="checkbox"]:focus-visible {
|
|
1846
1990
|
outline: 2px solid var(--_primary);
|
|
1847
1991
|
outline-offset: 2px;
|
|
1848
1992
|
}
|
|
1849
1993
|
|
|
1850
1994
|
/* Checked state */
|
|
1851
|
-
input[type=
|
|
1995
|
+
input[type="checkbox"]:checked {
|
|
1852
1996
|
background-color: var(--_primary);
|
|
1853
1997
|
border-color: var(--_primary);
|
|
1854
1998
|
}
|
|
1855
1999
|
|
|
1856
2000
|
/* Checkmark */
|
|
1857
|
-
input[type=
|
|
1858
|
-
content:
|
|
2001
|
+
input[type="checkbox"]:checked::after {
|
|
2002
|
+
content: "";
|
|
1859
2003
|
position: absolute;
|
|
1860
2004
|
left: 4px;
|
|
1861
2005
|
top: 1px;
|
|
1862
2006
|
width: 5px;
|
|
1863
2007
|
height: 9px;
|
|
1864
|
-
border: solid white;
|
|
2008
|
+
border: solid var(--consent-on-primary, white);
|
|
1865
2009
|
border-width: 0 2px 2px 0;
|
|
1866
2010
|
transform: rotate(45deg);
|
|
1867
2011
|
}
|
|
1868
2012
|
|
|
1869
2013
|
/* Disabled */
|
|
1870
|
-
input[type=
|
|
2014
|
+
input[type="checkbox"]:disabled {
|
|
1871
2015
|
cursor: not-allowed;
|
|
1872
2016
|
opacity: 0.5;
|
|
1873
2017
|
}
|
|
@@ -1879,7 +2023,7 @@ ConsentTerms.styles = i`
|
|
|
1879
2023
|
|
|
1880
2024
|
/* Links */
|
|
1881
2025
|
a {
|
|
1882
|
-
color: var(--_primary);
|
|
2026
|
+
color: var(--consent-link, var(--_primary));
|
|
1883
2027
|
text-decoration: underline;
|
|
1884
2028
|
text-underline-offset: 2px;
|
|
1885
2029
|
}
|
|
@@ -2630,15 +2774,22 @@ var CONSENT_COPY_TOKENS = {
|
|
|
2630
2774
|
* `{Verb}` → operator verb, default "use".
|
|
2631
2775
|
* `{Org}` → organization display name (serif italic at render time).
|
|
2632
2776
|
*/
|
|
2633
|
-
template: "{Agent} would like to {Verb} at {Org} for you."
|
|
2777
|
+
template: "{Agent} would like to {Verb} at {Org} for you.",
|
|
2778
|
+
fallbackTemplate: "{Agent} is requesting permission at {Org}."
|
|
2634
2779
|
},
|
|
2635
2780
|
subhead: {
|
|
2636
2781
|
/** `{Agent}` → agent display name. */
|
|
2637
|
-
template: "Pick what {Agent} is allowed to do on your behalf. You stay in charge
|
|
2782
|
+
template: "Pick what {Agent} is allowed to do on your behalf. You stay in charge: change or cancel anytime."
|
|
2638
2783
|
},
|
|
2639
2784
|
agentTile: {
|
|
2640
2785
|
verifiedPill: "Verified",
|
|
2641
2786
|
unverifiedPill: "UNVERIFIED",
|
|
2787
|
+
/**
|
|
2788
|
+
* Read by screen readers before the domain in a domain-bound agent's
|
|
2789
|
+
* pill, which shows only the domain. Never "Verified": a domain binding
|
|
2790
|
+
* names the client, it does not verify it.
|
|
2791
|
+
*/
|
|
2792
|
+
domainPillPrefix: "Identified by",
|
|
2642
2793
|
/** `{Vendor}` → vendor name. `{Surface}` → surface label. */
|
|
2643
2794
|
metaTemplate: "Made by {Vendor} \xB7 Asking from your {Surface} \xB7 {Connected}",
|
|
2644
2795
|
connectedJustNow: "Connected just now",
|
|
@@ -2671,7 +2822,12 @@ var CONSENT_COPY_TOKENS = {
|
|
|
2671
2822
|
/** `{Days}` → inactivity days, default 90. */
|
|
2672
2823
|
inactivityTemplate: "Permissions automatically expire after {Days} days of inactivity.",
|
|
2673
2824
|
/** Native authorization follows the issued grant's fixed deadline. */
|
|
2674
|
-
fixedExpiryNotice: "Permissions expire at the time shown after approval. Continued use does not extend them."
|
|
2825
|
+
fixedExpiryNotice: "Permissions expire at the time shown after approval. Continued use does not extend them.",
|
|
2826
|
+
/**
|
|
2827
|
+
* Grants with a fixed lifetime set by the server (a delegation mandate).
|
|
2828
|
+
* `{Duration}` → "1 day" or "N days".
|
|
2829
|
+
*/
|
|
2830
|
+
fixedDurationTemplate: "Permissions expire {Duration} after approval. Continued use does not extend them."
|
|
2675
2831
|
},
|
|
2676
2832
|
actions: {
|
|
2677
2833
|
/** Light theme primary. `{Agent}` → agent display name. */
|
|
@@ -2689,6 +2845,38 @@ var CONSENT_COPY_TOKENS = {
|
|
|
2689
2845
|
/** Dark theme. */
|
|
2690
2846
|
securedBy: "Secured by Checkpoint",
|
|
2691
2847
|
howThisWorks: "How does this work?"
|
|
2848
|
+
},
|
|
2849
|
+
/**
|
|
2850
|
+
* `consent-passkey` defaults. `PasskeyConfig.instructions`, `buttonText`
|
|
2851
|
+
* and `unsupportedText` override these for both ceremonies.
|
|
2852
|
+
*/
|
|
2853
|
+
passkey: {
|
|
2854
|
+
register: {
|
|
2855
|
+
title: "Create a passkey",
|
|
2856
|
+
instructions: "Your device asks for your fingerprint, face or screen lock. The passkey stays on this device.",
|
|
2857
|
+
button: "Create a passkey",
|
|
2858
|
+
done: "Passkey created"
|
|
2859
|
+
},
|
|
2860
|
+
authenticate: {
|
|
2861
|
+
title: "Use your passkey",
|
|
2862
|
+
instructions: "Confirm with your fingerprint, face or screen lock to approve this request.",
|
|
2863
|
+
button: "Use your passkey",
|
|
2864
|
+
done: "Passkey confirmed"
|
|
2865
|
+
},
|
|
2866
|
+
checking: "Checking this device for passkey support",
|
|
2867
|
+
waiting: "Waiting for your device",
|
|
2868
|
+
unsupportedTitle: "This device can't use a passkey",
|
|
2869
|
+
unsupportedText: "This request needs a passkey, and this browser can't create or use one. Open the link on a device with a screen lock and a current browser.",
|
|
2870
|
+
compatibilityInfo: "Passkeys work in current versions of Chrome, Edge, Firefox and Safari on a device with a screen lock.",
|
|
2871
|
+
/** Keyed by `PasskeyCeremonyError.code` from `@kya-os/id/wallet/passkey`. */
|
|
2872
|
+
errors: {
|
|
2873
|
+
not_allowed: "The passkey request was cancelled or timed out, or no passkey matched. Try again.",
|
|
2874
|
+
invalid_state: "This device already holds a passkey for this account. Use that passkey instead.",
|
|
2875
|
+
not_supported: "This browser or device can't complete a user-verified passkey check.",
|
|
2876
|
+
security: "Passkeys can't be used on this page.",
|
|
2877
|
+
aborted: "The passkey request was interrupted. Try again.",
|
|
2878
|
+
unknown: "The passkey check failed. Try again."
|
|
2879
|
+
}
|
|
2692
2880
|
}
|
|
2693
2881
|
};
|
|
2694
2882
|
function formatToken(template, values) {
|
|
@@ -2698,6 +2886,20 @@ function formatToken(template, values) {
|
|
|
2698
2886
|
});
|
|
2699
2887
|
}
|
|
2700
2888
|
|
|
2889
|
+
// src/types/capabilities.types.ts
|
|
2890
|
+
var AGENT_VERIFICATIONS = [
|
|
2891
|
+
"verified",
|
|
2892
|
+
"domain",
|
|
2893
|
+
"unverified"
|
|
2894
|
+
];
|
|
2895
|
+
function agentVerification(agent) {
|
|
2896
|
+
const stated = agent.verification;
|
|
2897
|
+
if (stated !== void 0 && AGENT_VERIFICATIONS.includes(stated)) {
|
|
2898
|
+
return stated === "domain" && !agent.domain?.trim() ? "unverified" : stated;
|
|
2899
|
+
}
|
|
2900
|
+
return agent.verified === true ? "verified" : "unverified";
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2701
2903
|
// src/components/consent-agent-header.ts
|
|
2702
2904
|
var ConsentAgentHeader = class extends i4 {
|
|
2703
2905
|
constructor() {
|
|
@@ -2705,6 +2907,7 @@ var ConsentAgentHeader = class extends i4 {
|
|
|
2705
2907
|
this.agentName = "";
|
|
2706
2908
|
this.vendor = "";
|
|
2707
2909
|
this.surfaceLabel = "";
|
|
2910
|
+
this.domain = "";
|
|
2708
2911
|
this.verified = false;
|
|
2709
2912
|
this.logoUrl = "";
|
|
2710
2913
|
this.connectedAt = "";
|
|
@@ -2735,10 +2938,25 @@ var ConsentAgentHeader = class extends i4 {
|
|
|
2735
2938
|
Connected: this.renderConnectedFragment()
|
|
2736
2939
|
});
|
|
2737
2940
|
}
|
|
2941
|
+
renderPill() {
|
|
2942
|
+
const tokens = CONSENT_COPY_TOKENS.agentTile;
|
|
2943
|
+
const state = agentVerification({
|
|
2944
|
+
verification: this.verification,
|
|
2945
|
+
verified: this.verified,
|
|
2946
|
+
domain: this.domain
|
|
2947
|
+
});
|
|
2948
|
+
if (state === "domain") {
|
|
2949
|
+
return b2`<span class="pill domain" part="pill"
|
|
2950
|
+
><span class="visually-hidden">${tokens.domainPillPrefix} </span
|
|
2951
|
+
>${this.domain.trim()}</span
|
|
2952
|
+
>`;
|
|
2953
|
+
}
|
|
2954
|
+
return b2`<span class="pill ${state}" part="pill">
|
|
2955
|
+
${state === "verified" ? tokens.verifiedPill : tokens.unverifiedPill}
|
|
2956
|
+
</span>`;
|
|
2957
|
+
}
|
|
2738
2958
|
render() {
|
|
2739
2959
|
const initial = (this.agentName || "?").trim().charAt(0).toUpperCase();
|
|
2740
|
-
const verifiedLabel = this.verified ? CONSENT_COPY_TOKENS.agentTile.verifiedPill : CONSENT_COPY_TOKENS.agentTile.unverifiedPill;
|
|
2741
|
-
const verifiedClass = this.verified ? "verified" : "unverified";
|
|
2742
2960
|
return b2`
|
|
2743
2961
|
<div class="tile" part="tile">
|
|
2744
2962
|
<div class="logo" aria-hidden="true">
|
|
@@ -2747,9 +2965,7 @@ var ConsentAgentHeader = class extends i4 {
|
|
|
2747
2965
|
<div class="body">
|
|
2748
2966
|
<div class="row-name">
|
|
2749
2967
|
<span class="name">${this.agentName || A}</span>
|
|
2750
|
-
|
|
2751
|
-
${verifiedLabel}
|
|
2752
|
-
</span>
|
|
2968
|
+
${this.renderPill()}
|
|
2753
2969
|
</div>
|
|
2754
2970
|
<div class="meta">${this.renderMeta()}</div>
|
|
2755
2971
|
</div>
|
|
@@ -2773,30 +2989,33 @@ ConsentAgentHeader.styles = i`
|
|
|
2773
2989
|
border: 1px solid var(--cs-surface-border, transparent);
|
|
2774
2990
|
}
|
|
2775
2991
|
|
|
2992
|
+
/* Agent tile: white with a light border in every theme, 44px outside. */
|
|
2776
2993
|
.logo {
|
|
2994
|
+
box-sizing: border-box;
|
|
2777
2995
|
width: 44px;
|
|
2778
2996
|
height: 44px;
|
|
2779
2997
|
border-radius: 12px;
|
|
2780
2998
|
flex-shrink: 0;
|
|
2781
|
-
background: var(--cs-
|
|
2999
|
+
background: var(--cs-agent-tile-bg, #ffffff);
|
|
2782
3000
|
display: flex;
|
|
2783
3001
|
align-items: center;
|
|
2784
3002
|
justify-content: center;
|
|
2785
3003
|
overflow: hidden;
|
|
2786
|
-
border: 1px solid var(--cs-
|
|
3004
|
+
border: 1px solid var(--cs-agent-tile-border, rgba(15, 23, 42, 0.08));
|
|
2787
3005
|
}
|
|
2788
3006
|
|
|
3007
|
+
/* Contained, not cropped: 28px leaves an 8px inset inside the 44px tile. */
|
|
2789
3008
|
.logo img {
|
|
2790
|
-
width:
|
|
2791
|
-
height:
|
|
2792
|
-
object-fit:
|
|
3009
|
+
width: 28px;
|
|
3010
|
+
height: 28px;
|
|
3011
|
+
object-fit: contain;
|
|
2793
3012
|
}
|
|
2794
3013
|
|
|
2795
3014
|
.logo .placeholder {
|
|
2796
3015
|
width: 100%;
|
|
2797
3016
|
height: 100%;
|
|
2798
|
-
background:
|
|
2799
|
-
color: var(--cs-
|
|
3017
|
+
background: transparent;
|
|
3018
|
+
color: var(--cs-agent-tile-text, #0f172a);
|
|
2800
3019
|
display: flex;
|
|
2801
3020
|
align-items: center;
|
|
2802
3021
|
justify-content: center;
|
|
@@ -2821,7 +3040,7 @@ ConsentAgentHeader.styles = i`
|
|
|
2821
3040
|
.name {
|
|
2822
3041
|
font-size: 16px;
|
|
2823
3042
|
font-weight: 600;
|
|
2824
|
-
color: var(--cs-text-primary, #
|
|
3043
|
+
color: var(--cs-text-primary, #0f172a);
|
|
2825
3044
|
letter-spacing: -0.01em;
|
|
2826
3045
|
}
|
|
2827
3046
|
|
|
@@ -2837,19 +3056,52 @@ ConsentAgentHeader.styles = i`
|
|
|
2837
3056
|
}
|
|
2838
3057
|
|
|
2839
3058
|
.pill.verified {
|
|
2840
|
-
background: var(--cs-pill-verified-bg, #
|
|
3059
|
+
background: var(--cs-pill-verified-bg, #dcfce7);
|
|
2841
3060
|
color: var(--cs-pill-verified-text, #166534);
|
|
2842
3061
|
}
|
|
2843
3062
|
|
|
2844
3063
|
.pill.unverified {
|
|
2845
|
-
background: var(--cs-pill-unverified-bg, #
|
|
3064
|
+
background: var(--cs-pill-unverified-bg, #f1f5f9);
|
|
2846
3065
|
color: var(--cs-pill-unverified-text, #475569);
|
|
2847
3066
|
letter-spacing: 0.08em;
|
|
2848
3067
|
}
|
|
2849
3068
|
|
|
3069
|
+
/*
|
|
3070
|
+
* Domain-bound: a tint and an outline from the brand primary, with the
|
|
3071
|
+
* theme's own text color, so the domain reads in light and dark
|
|
3072
|
+
* whatever the brand color is.
|
|
3073
|
+
*/
|
|
3074
|
+
.pill.domain {
|
|
3075
|
+
background: var(
|
|
3076
|
+
--cs-pill-domain-bg,
|
|
3077
|
+
color-mix(in srgb, var(--consent-primary, #2563eb) 14%, transparent)
|
|
3078
|
+
);
|
|
3079
|
+
box-shadow: inset 0 0 0 1px
|
|
3080
|
+
var(
|
|
3081
|
+
--cs-pill-domain-border,
|
|
3082
|
+
color-mix(in srgb, var(--consent-primary, #2563eb) 40%, transparent)
|
|
3083
|
+
);
|
|
3084
|
+
color: var(--cs-pill-domain-text, var(--cs-text-primary, #0f172a));
|
|
3085
|
+
font-weight: 500;
|
|
3086
|
+
letter-spacing: 0;
|
|
3087
|
+
overflow-wrap: anywhere;
|
|
3088
|
+
}
|
|
3089
|
+
|
|
3090
|
+
.visually-hidden {
|
|
3091
|
+
position: absolute;
|
|
3092
|
+
width: 1px;
|
|
3093
|
+
height: 1px;
|
|
3094
|
+
margin: -1px;
|
|
3095
|
+
padding: 0;
|
|
3096
|
+
overflow: hidden;
|
|
3097
|
+
clip: rect(0, 0, 0, 0);
|
|
3098
|
+
white-space: nowrap;
|
|
3099
|
+
border: 0;
|
|
3100
|
+
}
|
|
3101
|
+
|
|
2850
3102
|
.meta {
|
|
2851
3103
|
font-size: 12px;
|
|
2852
|
-
color: var(--cs-text-tertiary, #
|
|
3104
|
+
color: var(--cs-text-tertiary, #64748b);
|
|
2853
3105
|
line-height: 1.5;
|
|
2854
3106
|
}
|
|
2855
3107
|
`;
|
|
@@ -2862,6 +3114,12 @@ __decorateClass([
|
|
|
2862
3114
|
__decorateClass([
|
|
2863
3115
|
n4({ type: String })
|
|
2864
3116
|
], ConsentAgentHeader.prototype, "surfaceLabel", 2);
|
|
3117
|
+
__decorateClass([
|
|
3118
|
+
n4({ type: String })
|
|
3119
|
+
], ConsentAgentHeader.prototype, "verification", 2);
|
|
3120
|
+
__decorateClass([
|
|
3121
|
+
n4({ type: String })
|
|
3122
|
+
], ConsentAgentHeader.prototype, "domain", 2);
|
|
2865
3123
|
__decorateClass([
|
|
2866
3124
|
n4({ type: Boolean })
|
|
2867
3125
|
], ConsentAgentHeader.prototype, "verified", 2);
|
|
@@ -3680,9 +3938,7 @@ var ConsentRevocationNotice = class extends i4 {
|
|
|
3680
3938
|
RevocationPath: this.revocationPath,
|
|
3681
3939
|
Org: this.orgName
|
|
3682
3940
|
});
|
|
3683
|
-
const expiry = this.
|
|
3684
|
-
Days: this.inactivityDays
|
|
3685
|
-
});
|
|
3941
|
+
const expiry = this.expiryCopy();
|
|
3686
3942
|
return b2`
|
|
3687
3943
|
<svg
|
|
3688
3944
|
class="icon"
|
|
@@ -3703,6 +3959,18 @@ var ConsentRevocationNotice = class extends i4 {
|
|
|
3703
3959
|
</div>
|
|
3704
3960
|
`;
|
|
3705
3961
|
}
|
|
3962
|
+
expiryCopy() {
|
|
3963
|
+
if (this.fixedExpiry) return CONSENT_COPY_TOKENS.footer.fixedExpiryNotice;
|
|
3964
|
+
const fixedDays = this.fixedExpiryDays;
|
|
3965
|
+
if (fixedDays !== void 0 && Number.isInteger(fixedDays) && fixedDays > 0) {
|
|
3966
|
+
return formatToken(CONSENT_COPY_TOKENS.footer.fixedDurationTemplate, {
|
|
3967
|
+
Duration: fixedDays === 1 ? "1 day" : `${fixedDays} days`
|
|
3968
|
+
});
|
|
3969
|
+
}
|
|
3970
|
+
return formatToken(CONSENT_COPY_TOKENS.footer.inactivityTemplate, {
|
|
3971
|
+
Days: this.inactivityDays
|
|
3972
|
+
});
|
|
3973
|
+
}
|
|
3706
3974
|
};
|
|
3707
3975
|
ConsentRevocationNotice.styles = i`
|
|
3708
3976
|
:host {
|
|
@@ -3749,6 +4017,9 @@ __decorateClass([
|
|
|
3749
4017
|
__decorateClass([
|
|
3750
4018
|
n4({ type: Boolean, attribute: "fixed-expiry" })
|
|
3751
4019
|
], ConsentRevocationNotice.prototype, "fixedExpiry", 2);
|
|
4020
|
+
__decorateClass([
|
|
4021
|
+
n4({ type: Number, attribute: "fixed-expiry-days" })
|
|
4022
|
+
], ConsentRevocationNotice.prototype, "fixedExpiryDays", 2);
|
|
3752
4023
|
ConsentRevocationNotice = __decorateClass([
|
|
3753
4024
|
t3("consent-revocation-notice")
|
|
3754
4025
|
], ConsentRevocationNotice);
|
|
@@ -3854,9 +4125,12 @@ ConsentConnectorHeader.styles = i`
|
|
|
3854
4125
|
border: 1px solid var(--cs-surface-border, rgba(15, 23, 42, 0.08));
|
|
3855
4126
|
}
|
|
3856
4127
|
|
|
4128
|
+
/* Agent tile: white with a light border in every theme. border-box keeps
|
|
4129
|
+
it 56px outside; the shared .tile (server) box is left unchanged. */
|
|
3857
4130
|
.tile.client {
|
|
3858
|
-
|
|
3859
|
-
|
|
4131
|
+
box-sizing: border-box;
|
|
4132
|
+
background: var(--cs-agent-tile-bg, #FFFFFF);
|
|
4133
|
+
border: 1px solid var(--cs-agent-tile-border, rgba(15, 23, 42, 0.08));
|
|
3860
4134
|
}
|
|
3861
4135
|
|
|
3862
4136
|
.tile img {
|
|
@@ -3865,6 +4139,14 @@ ConsentConnectorHeader.styles = i`
|
|
|
3865
4139
|
object-fit: cover;
|
|
3866
4140
|
}
|
|
3867
4141
|
|
|
4142
|
+
/* Agent marks are contained, not cropped: 36px leaves a 10px inset inside
|
|
4143
|
+
the centred 56px tile, so non-square logos keep their full shape. */
|
|
4144
|
+
.tile.client img {
|
|
4145
|
+
width: 36px;
|
|
4146
|
+
height: 36px;
|
|
4147
|
+
object-fit: contain;
|
|
4148
|
+
}
|
|
4149
|
+
|
|
3868
4150
|
.tile .monogram {
|
|
3869
4151
|
width: 100%;
|
|
3870
4152
|
height: 100%;
|
|
@@ -3876,7 +4158,7 @@ ConsentConnectorHeader.styles = i`
|
|
|
3876
4158
|
}
|
|
3877
4159
|
|
|
3878
4160
|
.tile.client .monogram {
|
|
3879
|
-
color: var(--cs-
|
|
4161
|
+
color: var(--cs-agent-tile-text, #0F172A);
|
|
3880
4162
|
}
|
|
3881
4163
|
|
|
3882
4164
|
.tile.server .monogram {
|
|
@@ -3953,6 +4235,9 @@ ConsentConnectorHeader = __decorateClass([
|
|
|
3953
4235
|
// src/styles/theme.ts
|
|
3954
4236
|
var FIXED_RISK_CHIP_BG = "#FCE7B6";
|
|
3955
4237
|
var FIXED_RISK_CHIP_TEXT = "#7A4F00";
|
|
4238
|
+
var FIXED_AGENT_TILE_BG = "#FFFFFF";
|
|
4239
|
+
var FIXED_AGENT_TILE_BORDER = "rgba(15, 23, 42, 0.08)";
|
|
4240
|
+
var FIXED_AGENT_TILE_TEXT = "#0F172A";
|
|
3956
4241
|
var lightTheme = {
|
|
3957
4242
|
surfaceBg: "#F4F1EA",
|
|
3958
4243
|
surfaceCard: "#FFFFFF",
|
|
@@ -3970,7 +4255,10 @@ var lightTheme = {
|
|
|
3970
4255
|
chipRiskBg: FIXED_RISK_CHIP_BG,
|
|
3971
4256
|
chipRiskText: FIXED_RISK_CHIP_TEXT,
|
|
3972
4257
|
focusRing: "rgba(15, 23, 42, 0.35)",
|
|
3973
|
-
cardShadow: "0 30px 80px -40px rgba(15, 23, 42, 0.40)"
|
|
4258
|
+
cardShadow: "0 30px 80px -40px rgba(15, 23, 42, 0.40)",
|
|
4259
|
+
agentTileBg: FIXED_AGENT_TILE_BG,
|
|
4260
|
+
agentTileBorder: FIXED_AGENT_TILE_BORDER,
|
|
4261
|
+
agentTileText: FIXED_AGENT_TILE_TEXT
|
|
3974
4262
|
};
|
|
3975
4263
|
var darkTheme = {
|
|
3976
4264
|
surfaceBg: "#0B0808",
|
|
@@ -3989,14 +4277,23 @@ var darkTheme = {
|
|
|
3989
4277
|
chipRiskBg: FIXED_RISK_CHIP_BG,
|
|
3990
4278
|
chipRiskText: FIXED_RISK_CHIP_TEXT,
|
|
3991
4279
|
focusRing: "rgba(248, 250, 252, 0.55)",
|
|
3992
|
-
cardShadow: "0 40px 90px -40px rgba(0, 0, 0, 0.85)"
|
|
4280
|
+
cardShadow: "0 40px 90px -40px rgba(0, 0, 0, 0.85)",
|
|
4281
|
+
agentTileBg: FIXED_AGENT_TILE_BG,
|
|
4282
|
+
agentTileBorder: FIXED_AGENT_TILE_BORDER,
|
|
4283
|
+
agentTileText: FIXED_AGENT_TILE_TEXT
|
|
3993
4284
|
};
|
|
3994
4285
|
function getConsentTheme(theme) {
|
|
3995
4286
|
return theme === "dark" ? darkTheme : lightTheme;
|
|
3996
4287
|
}
|
|
3997
4288
|
function themeToCssVariables(tokens) {
|
|
4289
|
+
const resolved = {
|
|
4290
|
+
...tokens,
|
|
4291
|
+
agentTileBg: tokens.agentTileBg ?? FIXED_AGENT_TILE_BG,
|
|
4292
|
+
agentTileBorder: tokens.agentTileBorder ?? FIXED_AGENT_TILE_BORDER,
|
|
4293
|
+
agentTileText: tokens.agentTileText ?? FIXED_AGENT_TILE_TEXT
|
|
4294
|
+
};
|
|
3998
4295
|
const declarations = [];
|
|
3999
|
-
for (const [key, value] of Object.entries(
|
|
4296
|
+
for (const [key, value] of Object.entries(resolved)) {
|
|
4000
4297
|
declarations.push(` --cs-${camelToKebab(key)}: ${value};`);
|
|
4001
4298
|
}
|
|
4002
4299
|
return declarations.join("\n");
|
|
@@ -4044,6 +4341,7 @@ var AUTH_MODES = {
|
|
|
4044
4341
|
/** Identity verification (future) - Auth → Consent → Success (3 screens) */
|
|
4045
4342
|
IDV: "idv"
|
|
4046
4343
|
};
|
|
4344
|
+
var PASSKEY_CEREMONIES = ["register", "authenticate"];
|
|
4047
4345
|
var PROVIDER_TYPES = {
|
|
4048
4346
|
/** Consent-only - no authentication, just clickwrap agreement */
|
|
4049
4347
|
NONE: "none",
|
|
@@ -4109,7 +4407,7 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
4109
4407
|
super(...arguments);
|
|
4110
4408
|
this.capabilities = [];
|
|
4111
4409
|
this.orgName = "";
|
|
4112
|
-
this.headlineVerb = "
|
|
4410
|
+
this.headlineVerb = "";
|
|
4113
4411
|
this.revocationPath = "Account \u2192 Connected Agents";
|
|
4114
4412
|
this.inactivityDays = 90;
|
|
4115
4413
|
this.fixedExpiry = false;
|
|
@@ -4222,13 +4520,17 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
4222
4520
|
}
|
|
4223
4521
|
}
|
|
4224
4522
|
renderHeadline() {
|
|
4225
|
-
const agentName = this.agentMetadata?.name || "
|
|
4523
|
+
const agentName = this.agentMetadata?.name?.trim() || "An assistant";
|
|
4226
4524
|
const tokens = CONSENT_COPY_TOKENS;
|
|
4227
|
-
const
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4525
|
+
const verb = this.headlineVerb.trim();
|
|
4526
|
+
const raw = formatToken(
|
|
4527
|
+
verb && verb !== "use" ? tokens.headline.template : tokens.headline.fallbackTemplate,
|
|
4528
|
+
{
|
|
4529
|
+
Agent: "@@AGENT@@",
|
|
4530
|
+
Verb: verb,
|
|
4531
|
+
Org: "@@ORG@@"
|
|
4532
|
+
}
|
|
4533
|
+
);
|
|
4232
4534
|
const escaped = escapeHtml(raw);
|
|
4233
4535
|
const withSerifEntities = escaped.replace("@@AGENT@@", `<em>${escapeHtml(agentName)}</em>`).replace(
|
|
4234
4536
|
"@@ORG@@",
|
|
@@ -4267,13 +4569,15 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
4267
4569
|
>
|
|
4268
4570
|
${this.renderHeadline()}
|
|
4269
4571
|
<p class="subhead" part="subhead">${subhead}</p>
|
|
4572
|
+
<slot name="recovery"></slot>
|
|
4270
4573
|
<slot name="identity"></slot>
|
|
4271
4574
|
${this.agentMetadata ? b2`<consent-agent-header
|
|
4272
4575
|
part="agent"
|
|
4273
4576
|
agentName="${this.agentMetadata.name}"
|
|
4274
4577
|
vendor="${this.agentMetadata.vendor || ""}"
|
|
4275
4578
|
surfaceLabel="${this.agentMetadata.surfaceLabel || ""}"
|
|
4276
|
-
|
|
4579
|
+
verification="${agentVerification(this.agentMetadata)}"
|
|
4580
|
+
domain="${this.agentMetadata.domain || ""}"
|
|
4277
4581
|
logoUrl="${this.agentMetadata.logoUrl || ""}"
|
|
4278
4582
|
connectedAt="${this.agentMetadata.connectedAt || ""}"
|
|
4279
4583
|
></consent-agent-header>` : A}
|
|
@@ -4309,6 +4613,7 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
4309
4613
|
orgName="${this.orgName || "this site"}"
|
|
4310
4614
|
inactivityDays=${this.inactivityDays}
|
|
4311
4615
|
?fixed-expiry=${this.fixedExpiry}
|
|
4616
|
+
fixed-expiry-days=${this.fixedExpiryDays ?? A}
|
|
4312
4617
|
></consent-revocation-notice
|
|
4313
4618
|
></slot>
|
|
4314
4619
|
<consent-action-bar
|
|
@@ -4440,6 +4745,9 @@ __decorateClass([
|
|
|
4440
4745
|
__decorateClass([
|
|
4441
4746
|
n4({ type: Boolean, attribute: "fixed-expiry" })
|
|
4442
4747
|
], ConsentCapabilitiesScreen.prototype, "fixedExpiry", 2);
|
|
4748
|
+
__decorateClass([
|
|
4749
|
+
n4({ type: Number, attribute: "fixed-expiry-days" })
|
|
4750
|
+
], ConsentCapabilitiesScreen.prototype, "fixedExpiryDays", 2);
|
|
4443
4751
|
__decorateClass([
|
|
4444
4752
|
n4({ type: String })
|
|
4445
4753
|
], ConsentCapabilitiesScreen.prototype, "theme", 2);
|
|
@@ -4489,29 +4797,6 @@ function escapeHtml(value) {
|
|
|
4489
4797
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
4490
4798
|
}
|
|
4491
4799
|
|
|
4492
|
-
// src/constants/colors.ts
|
|
4493
|
-
var DEFAULT_COLORS = {
|
|
4494
|
-
/** Primary brand color - Tailwind blue-600 */
|
|
4495
|
-
PRIMARY: "#2563EB",
|
|
4496
|
-
/** Secondary/accent color - Tailwind blue-100 */
|
|
4497
|
-
SECONDARY: "#DBEAFE",
|
|
4498
|
-
/** Background color */
|
|
4499
|
-
BACKGROUND: "#F9FAFB",
|
|
4500
|
-
/** Text colors */
|
|
4501
|
-
TEXT_PRIMARY: "#111827",
|
|
4502
|
-
TEXT_SECONDARY: "#6B7280",
|
|
4503
|
-
TEXT_MUTED: "#9CA3AF",
|
|
4504
|
-
/** Border colors */
|
|
4505
|
-
BORDER: "#E5E7EB",
|
|
4506
|
-
BORDER_DARK: "#D1D5DB",
|
|
4507
|
-
/** Success color - Tailwind green-600 */
|
|
4508
|
-
SUCCESS: "#16A34A",
|
|
4509
|
-
/** Error color - Tailwind red-600 */
|
|
4510
|
-
ERROR: "#DC2626",
|
|
4511
|
-
/** Warning color - Tailwind amber-500 */
|
|
4512
|
-
WARNING: "#F59E0B"
|
|
4513
|
-
};
|
|
4514
|
-
|
|
4515
4800
|
// src/constants/defaults.ts
|
|
4516
4801
|
var DEFAULT_BRANDING = {
|
|
4517
4802
|
primaryColor: DEFAULT_COLORS.PRIMARY,
|
|
@@ -4584,7 +4869,11 @@ function generateBrandingCSSVars(branding) {
|
|
|
4584
4869
|
"--consent-primary": branding.primaryColor,
|
|
4585
4870
|
"--consent-secondary": branding.secondaryColor,
|
|
4586
4871
|
"--consent-primary-rgb": hexToRgb(branding.primaryColor),
|
|
4587
|
-
"--consent-secondary-rgb": hexToRgb(branding.secondaryColor)
|
|
4872
|
+
"--consent-secondary-rgb": hexToRgb(branding.secondaryColor),
|
|
4873
|
+
...generateContrastCSSVariables(
|
|
4874
|
+
branding.primaryColor,
|
|
4875
|
+
branding.secondaryColor
|
|
4876
|
+
)
|
|
4588
4877
|
};
|
|
4589
4878
|
}
|
|
4590
4879
|
function resolveConsentBranding(branding) {
|
|
@@ -4742,6 +5031,8 @@ function resolveConsentConfig(config, agentName) {
|
|
|
4742
5031
|
success,
|
|
4743
5032
|
customFields,
|
|
4744
5033
|
expirationDays,
|
|
5034
|
+
// Passthrough: set only when the server bound a delegation mandate.
|
|
5035
|
+
fixedExpiryDays: config?.fixedExpiryDays,
|
|
4745
5036
|
authMode,
|
|
4746
5037
|
// Passthrough mode configs
|
|
4747
5038
|
credentials: config?.credentials,
|
|
@@ -4849,9 +5140,10 @@ var McpConsent = class extends i4 {
|
|
|
4849
5140
|
this.credentialProviderUserId = "";
|
|
4850
5141
|
this.oauthUrl = "";
|
|
4851
5142
|
this.nativeScopeSelection = false;
|
|
5143
|
+
this.requestExpiresAt = 0;
|
|
4852
5144
|
this.capabilities = [];
|
|
4853
5145
|
this.orgName = "";
|
|
4854
|
-
this.headlineVerb = "
|
|
5146
|
+
this.headlineVerb = "";
|
|
4855
5147
|
this.revocationPath = "Account \u2192 Connected Agents";
|
|
4856
5148
|
this.inactivityDays = 90;
|
|
4857
5149
|
this.consentTheme = "light";
|
|
@@ -4866,6 +5158,13 @@ var McpConsent = class extends i4 {
|
|
|
4866
5158
|
this.resendCooldown = 0;
|
|
4867
5159
|
this.selectedScopes = [];
|
|
4868
5160
|
this.closeFailed = false;
|
|
5161
|
+
this.restartApprovalPage = () => {
|
|
5162
|
+
if (!this.approvalRecovery?.reload || !this.anchorSid || typeof window === "undefined")
|
|
5163
|
+
return;
|
|
5164
|
+
const target = new URL("/consent", window.location.origin);
|
|
5165
|
+
target.searchParams.set("sid", this.anchorSid);
|
|
5166
|
+
window.location.assign(target.toString());
|
|
5167
|
+
};
|
|
4869
5168
|
this.onCapabilitiesAllow = (event) => {
|
|
4870
5169
|
if (this.loading) return;
|
|
4871
5170
|
const selection = resolveCapabilitySelection(
|
|
@@ -4916,6 +5215,7 @@ var McpConsent = class extends i4 {
|
|
|
4916
5215
|
this.currentMode = this.mode ?? determineAuthMode(this.config) ?? AUTH_MODES.CONSENT_ONLY;
|
|
4917
5216
|
this.selectedScopes = [...this.scopes];
|
|
4918
5217
|
this.readIdentityAssertionFromLocation();
|
|
5218
|
+
this.scheduleRequestExpiry();
|
|
4919
5219
|
}
|
|
4920
5220
|
/**
|
|
4921
5221
|
* Read the grant-bound signed identity assertion the worker delivers via
|
|
@@ -4949,12 +5249,15 @@ var McpConsent = class extends i4 {
|
|
|
4949
5249
|
}
|
|
4950
5250
|
disconnectedCallback() {
|
|
4951
5251
|
super.disconnectedCallback();
|
|
5252
|
+
clearTimeout(this.requestExpiryTimer);
|
|
4952
5253
|
if (this.resendCooldownInterval !== void 0) {
|
|
4953
5254
|
clearInterval(this.resendCooldownInterval);
|
|
4954
5255
|
this.resendCooldownInterval = void 0;
|
|
4955
5256
|
}
|
|
4956
5257
|
}
|
|
4957
5258
|
updated(changedProperties) {
|
|
5259
|
+
if (changedProperties.has("requestExpiresAt") || changedProperties.has("nativeScopeSelection"))
|
|
5260
|
+
this.scheduleRequestExpiry();
|
|
4958
5261
|
if (changedProperties.has("config") || changedProperties.has("agentName")) {
|
|
4959
5262
|
this.resolved = resolveConsentConfig(this.config, this.agentName);
|
|
4960
5263
|
}
|
|
@@ -4965,14 +5268,11 @@ var McpConsent = class extends i4 {
|
|
|
4965
5268
|
this.selectedScopes = [...this.scopes];
|
|
4966
5269
|
}
|
|
4967
5270
|
if (this.resolved) {
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
"--consent-secondary",
|
|
4974
|
-
this.resolved.branding.secondaryColor
|
|
4975
|
-
);
|
|
5271
|
+
for (const [name, value] of Object.entries(
|
|
5272
|
+
this.resolved.branding.cssVars
|
|
5273
|
+
)) {
|
|
5274
|
+
if (value) this.style.setProperty(name, value);
|
|
5275
|
+
}
|
|
4976
5276
|
}
|
|
4977
5277
|
}
|
|
4978
5278
|
// === FORM SUBMISSION ===
|
|
@@ -5026,6 +5326,9 @@ var McpConsent = class extends i4 {
|
|
|
5026
5326
|
*/
|
|
5027
5327
|
async handleApprove(e8) {
|
|
5028
5328
|
e8?.preventDefault();
|
|
5329
|
+
if (this.nativeScopeSelection && this.requestExpiresAt > 0 && Date.now() >= this.requestExpiresAt)
|
|
5330
|
+
this.setApprovalRecovery("kyaos/pickup-expired");
|
|
5331
|
+
if (this.approvalRecovery) return;
|
|
5029
5332
|
if (this.loading) {
|
|
5030
5333
|
return;
|
|
5031
5334
|
}
|
|
@@ -5043,6 +5346,7 @@ var McpConsent = class extends i4 {
|
|
|
5043
5346
|
}
|
|
5044
5347
|
this.loading = true;
|
|
5045
5348
|
this.error = void 0;
|
|
5349
|
+
let credentialsRejected = false;
|
|
5046
5350
|
try {
|
|
5047
5351
|
const formData = new FormData();
|
|
5048
5352
|
formData.append("tool", this.tool);
|
|
@@ -5099,17 +5403,35 @@ var McpConsent = class extends i4 {
|
|
|
5099
5403
|
Object.entries(this.formData).forEach(([key, value]) => {
|
|
5100
5404
|
formData.append(key, value);
|
|
5101
5405
|
});
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5406
|
+
let response;
|
|
5407
|
+
try {
|
|
5408
|
+
response = await fetch(`${this.serverUrl}/consent/approve`, {
|
|
5409
|
+
method: "POST",
|
|
5410
|
+
body: formData
|
|
5411
|
+
});
|
|
5412
|
+
} catch (error) {
|
|
5413
|
+
if (this.nativeScopeSelection)
|
|
5414
|
+
this.setApprovalRecovery("kyaos/consent-network-interrupted");
|
|
5415
|
+
throw error;
|
|
5416
|
+
}
|
|
5106
5417
|
if (!response.ok) {
|
|
5107
|
-
const errorData = await response.json().catch(() =>
|
|
5418
|
+
const errorData = await response.json().catch(() => null);
|
|
5419
|
+
const data = errorData && typeof errorData === "object" ? errorData : {};
|
|
5420
|
+
if (this.nativeScopeSelection) {
|
|
5421
|
+
const code = typeof data.error_code === "string" ? data.error_code : void 0;
|
|
5422
|
+
credentialsRejected = this.currentMode === AUTH_MODES.CREDENTIALS && response.status === 401 && code === "kyaos/credentials-not-accepted";
|
|
5423
|
+
if (!credentialsRejected)
|
|
5424
|
+
this.setApprovalRecovery(
|
|
5425
|
+
code ?? (response.status === 410 ? "kyaos/pickup-expired" : "kyaos/consent-request-unavailable")
|
|
5426
|
+
);
|
|
5427
|
+
}
|
|
5108
5428
|
throw new Error(
|
|
5109
|
-
|
|
5429
|
+
credentialsRejected ? "Those credentials were not accepted. Please check them and try again." : typeof data.error === "string" ? data.error : typeof data.message === "string" ? data.message : "Approval failed"
|
|
5110
5430
|
);
|
|
5111
5431
|
}
|
|
5112
5432
|
const result = await response.json();
|
|
5433
|
+
if (this.nativeScopeSelection && (!result || result.success !== true || typeof result.delegation_id !== "string" || !result.delegation_id))
|
|
5434
|
+
throw new Error("Invalid approval response");
|
|
5113
5435
|
if (result.redirectUrl) {
|
|
5114
5436
|
this.dispatchEvent(
|
|
5115
5437
|
new CustomEvent("mcp-consent:approve", {
|
|
@@ -5134,10 +5456,13 @@ var McpConsent = class extends i4 {
|
|
|
5134
5456
|
})
|
|
5135
5457
|
);
|
|
5136
5458
|
} catch (e9) {
|
|
5137
|
-
this.
|
|
5459
|
+
if (this.nativeScopeSelection && !credentialsRejected && !this.approvalRecovery)
|
|
5460
|
+
this.setApprovalRecovery("kyaos/consent-request-unavailable");
|
|
5461
|
+
const message = this.approvalRecoveryMessage() ?? (e9 instanceof Error ? e9.message : "Unknown error");
|
|
5462
|
+
this.error = message;
|
|
5138
5463
|
this.dispatchEvent(
|
|
5139
5464
|
new CustomEvent("mcp-consent:error", {
|
|
5140
|
-
detail: { error:
|
|
5465
|
+
detail: { error: message },
|
|
5141
5466
|
bubbles: true,
|
|
5142
5467
|
composed: true
|
|
5143
5468
|
})
|
|
@@ -5197,6 +5522,7 @@ var McpConsent = class extends i4 {
|
|
|
5197
5522
|
<section class="agent-key" aria-label="Agent key">
|
|
5198
5523
|
<p><strong>Agent key</strong></p>
|
|
5199
5524
|
<p>This permission is bound to this key.</p>
|
|
5525
|
+
<p>The agent provider has not been verified.</p>
|
|
5200
5526
|
<code>${this.agentDid}</code>
|
|
5201
5527
|
</section>
|
|
5202
5528
|
`;
|
|
@@ -5272,9 +5598,60 @@ var McpConsent = class extends i4 {
|
|
|
5272
5598
|
</div>
|
|
5273
5599
|
`;
|
|
5274
5600
|
}
|
|
5601
|
+
approvalRecoveryMessage() {
|
|
5602
|
+
return this.approvalRecovery?.message;
|
|
5603
|
+
}
|
|
5604
|
+
setApprovalRecovery(code) {
|
|
5605
|
+
const expired = code === "kyaos/pickup-expired";
|
|
5606
|
+
const invalidForm = code === "kyaos/consent-form-invalid";
|
|
5607
|
+
const mismatch = code === "kyaos/session-mismatch";
|
|
5608
|
+
const missing = code === "kyaos/consent-request-not-found";
|
|
5609
|
+
const network = code === "kyaos/consent-network-interrupted";
|
|
5610
|
+
this.approvalRecovery = {
|
|
5611
|
+
code: expired || invalidForm || mismatch || missing || network ? code : "kyaos/consent-request-unavailable",
|
|
5612
|
+
title: expired ? "This approval request has expired" : invalidForm ? "We couldn't verify this approval page" : mismatch ? "This sign-in could not be verified" : missing ? "This approval request is no longer available" : network ? "The connection was interrupted" : "We couldn't check this approval request",
|
|
5613
|
+
message: expired || missing || mismatch ? "Return to your assistant for a new approval link, then review the permissions again." : invalidForm ? "Reload and sign in again, then review the permissions. This submission did not approve access." : network ? "We couldn't confirm whether approval completed. Return to your assistant to check the request before trying again." : "Return to your assistant to check this request before trying again.",
|
|
5614
|
+
// Only a server-confirmed valid pinned anchor permits a GET restart.
|
|
5615
|
+
reload: invalidForm
|
|
5616
|
+
};
|
|
5617
|
+
}
|
|
5618
|
+
scheduleRequestExpiry() {
|
|
5619
|
+
clearTimeout(this.requestExpiryTimer);
|
|
5620
|
+
if (!this.nativeScopeSelection || !Number.isSafeInteger(this.requestExpiresAt) || this.requestExpiresAt <= 0)
|
|
5621
|
+
return;
|
|
5622
|
+
const remaining = this.requestExpiresAt - Date.now();
|
|
5623
|
+
if (remaining <= 0) {
|
|
5624
|
+
if (this.step !== "success")
|
|
5625
|
+
this.setApprovalRecovery("kyaos/pickup-expired");
|
|
5626
|
+
} else {
|
|
5627
|
+
this.requestExpiryTimer = setTimeout(
|
|
5628
|
+
() => {
|
|
5629
|
+
if (this.step !== "success")
|
|
5630
|
+
this.setApprovalRecovery("kyaos/pickup-expired");
|
|
5631
|
+
},
|
|
5632
|
+
Math.min(remaining, 2147483647)
|
|
5633
|
+
);
|
|
5634
|
+
}
|
|
5635
|
+
}
|
|
5275
5636
|
renderError() {
|
|
5637
|
+
if (this.approvalRecovery)
|
|
5638
|
+
return b2` <section
|
|
5639
|
+
class="error-message"
|
|
5640
|
+
role="alert"
|
|
5641
|
+
aria-live="assertive"
|
|
5642
|
+
aria-atomic="true"
|
|
5643
|
+
>
|
|
5644
|
+
<h2>${this.approvalRecovery.title}</h2>
|
|
5645
|
+
<p>${this.approvalRecovery.message}</p>
|
|
5646
|
+
${this.approvalRecovery.reload ? b2`<consent-button
|
|
5647
|
+
variant="secondary"
|
|
5648
|
+
@click=${this.restartApprovalPage}
|
|
5649
|
+
>Reload and sign in again</consent-button
|
|
5650
|
+
>` : A}
|
|
5651
|
+
<p><small>Reference: ${this.approvalRecovery.code}</small></p>
|
|
5652
|
+
</section>`;
|
|
5276
5653
|
if (!this.error) return A;
|
|
5277
|
-
return b2`<div class="error-message">${this.error}</div>`;
|
|
5654
|
+
return b2`<div class="error-message" role="alert">${this.error}</div>`;
|
|
5278
5655
|
}
|
|
5279
5656
|
/**
|
|
5280
5657
|
* Whether the user's identity has already been established, either via a
|
|
@@ -5300,7 +5677,7 @@ var McpConsent = class extends i4 {
|
|
|
5300
5677
|
<consent-button
|
|
5301
5678
|
variant="primary"
|
|
5302
5679
|
?loading=${this.loading}
|
|
5303
|
-
?disabled=${this.currentMode === AUTH_MODES.CONSENT_ONLY && this.resolved?.terms.required && !this.termsAccepted}
|
|
5680
|
+
?disabled=${!!this.approvalRecovery || this.currentMode === AUTH_MODES.CONSENT_ONLY && this.resolved?.terms.required && !this.termsAccepted}
|
|
5304
5681
|
@click=${this.handleApprove}
|
|
5305
5682
|
>
|
|
5306
5683
|
${submitText ?? this.resolved?.ui.submitButtonText ?? "Allow access"}
|
|
@@ -5372,7 +5749,7 @@ var McpConsent = class extends i4 {
|
|
|
5372
5749
|
<p style="text-align: right; margin-bottom: 1rem;">
|
|
5373
5750
|
<a
|
|
5374
5751
|
href=${creds.forgotPasswordUrl}
|
|
5375
|
-
style="font-size: 0.75rem; color: var(--_primary);"
|
|
5752
|
+
style="font-size: 0.75rem; color: var(--consent-link, var(--_primary));"
|
|
5376
5753
|
>
|
|
5377
5754
|
Forgot password?
|
|
5378
5755
|
</a>
|
|
@@ -5412,14 +5789,13 @@ var McpConsent = class extends i4 {
|
|
|
5412
5789
|
>
|
|
5413
5790
|
<div slot="content">
|
|
5414
5791
|
${this.renderError()} ${this.renderAgentInfo()}
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
></consent-oauth-button>
|
|
5792
|
+
${this.approvalRecovery ? A : b2`<consent-oauth-button
|
|
5793
|
+
provider=${provider}
|
|
5794
|
+
provider-name=${providerName}
|
|
5795
|
+
url=${oauthButtonUrl}
|
|
5796
|
+
button-text=${oauth?.buttonText ?? `Continue with ${providerName}`}
|
|
5797
|
+
full-width
|
|
5798
|
+
></consent-oauth-button>`}
|
|
5423
5799
|
</div>
|
|
5424
5800
|
${this.renderFooter({ allowSubmit: this.hasEstablishedIdentity })}
|
|
5425
5801
|
</consent-shell>
|
|
@@ -5680,17 +6056,6 @@ var McpConsent = class extends i4 {
|
|
|
5680
6056
|
const credentials = shouldSelectAllCapabilities(this.currentMode);
|
|
5681
6057
|
const allSelected = this.requiresAllCapabilities;
|
|
5682
6058
|
return b2`
|
|
5683
|
-
${error ? b2`<div
|
|
5684
|
-
role="alert"
|
|
5685
|
-
style="
|
|
5686
|
-
color: var(--cs-text-danger, #b91c1c);
|
|
5687
|
-
margin: 0 auto 12px;
|
|
5688
|
-
max-width: 560px;
|
|
5689
|
-
font-size: 13px;
|
|
5690
|
-
"
|
|
5691
|
-
>
|
|
5692
|
-
${error}
|
|
5693
|
-
</div>` : A}
|
|
5694
6059
|
<consent-capabilities-screen
|
|
5695
6060
|
.capabilities=${flatCapabilities}
|
|
5696
6061
|
.agentMetadata=${this.agentMetadata}
|
|
@@ -5701,15 +6066,26 @@ var McpConsent = class extends i4 {
|
|
|
5701
6066
|
revocationPath="${this.revocationPath}"
|
|
5702
6067
|
inactivityDays=${this.inactivityDays}
|
|
5703
6068
|
?fixed-expiry=${this.nativeScopeSelection}
|
|
6069
|
+
fixed-expiry-days=${this.resolved?.fixedExpiryDays ?? A}
|
|
5704
6070
|
theme="${this.consentTheme}"
|
|
5705
6071
|
how-it-works-url="${this.howItWorksUrl}"
|
|
5706
6072
|
?loading=${this.loading}
|
|
5707
6073
|
?all-selected=${allSelected}
|
|
6074
|
+
?disabled=${!!this.approvalRecovery}
|
|
5708
6075
|
?require-all=${allSelected}
|
|
5709
|
-
?allow-disabled=${!projection.ok || credentials && !areCredentialsComplete(this.formData)}
|
|
6076
|
+
?allow-disabled=${!!this.approvalRecovery || !projection.ok || credentials && !areCredentialsComplete(this.formData)}
|
|
5710
6077
|
@capabilities-allow=${this.onCapabilitiesAllow}
|
|
5711
6078
|
@capabilities-deny=${this.handleDeny}
|
|
5712
6079
|
>
|
|
6080
|
+
${error || this.approvalRecovery ? b2`<div slot="recovery">
|
|
6081
|
+
${this.renderError()}${!this.error && !this.approvalRecovery && error ? b2`<div class="error-message" role="alert">${error}</div>` : A}
|
|
6082
|
+
</div>` : A}
|
|
6083
|
+
${this.nativeScopeSelection && (!this.approvalRecovery || this.approvalRecovery.reload) && Number.isSafeInteger(this.requestExpiresAt) && this.requestExpiresAt > 0 ? b2`<p slot="details">
|
|
6084
|
+
Approval request expires at
|
|
6085
|
+
<time datetime=${new Date(this.requestExpiresAt).toISOString()}
|
|
6086
|
+
>${new Date(this.requestExpiresAt).toLocaleString()}</time
|
|
6087
|
+
>.
|
|
6088
|
+
</p>` : A}
|
|
5713
6089
|
${this.nativeScopeSelection && this.agentDid ? b2`<div slot="agent-key">${this.renderNativeAgentKey()}</div>` : A}
|
|
5714
6090
|
${allSelected ? b2`<div slot="auth">
|
|
5715
6091
|
<p>
|
|
@@ -5848,6 +6224,19 @@ McpConsent.styles = i`
|
|
|
5848
6224
|
font-size: 0.875rem;
|
|
5849
6225
|
}
|
|
5850
6226
|
|
|
6227
|
+
.error-message h2 {
|
|
6228
|
+
font: inherit;
|
|
6229
|
+
font-weight: 650;
|
|
6230
|
+
margin: 0 0 0.5rem;
|
|
6231
|
+
}
|
|
6232
|
+
.error-message p {
|
|
6233
|
+
margin: 0.5rem 0;
|
|
6234
|
+
line-height: 1.5;
|
|
6235
|
+
}
|
|
6236
|
+
.error-message small {
|
|
6237
|
+
overflow-wrap: anywhere;
|
|
6238
|
+
}
|
|
6239
|
+
|
|
5851
6240
|
/* Form fields */
|
|
5852
6241
|
.form-fields {
|
|
5853
6242
|
display: flex;
|
|
@@ -6020,7 +6409,7 @@ McpConsent.styles = i`
|
|
|
6020
6409
|
|
|
6021
6410
|
.permission-badge {
|
|
6022
6411
|
background: var(--_secondary);
|
|
6023
|
-
color: #0e2249;
|
|
6412
|
+
color: var(--consent-on-secondary, #0e2249);
|
|
6024
6413
|
font-family:
|
|
6025
6414
|
"Geist",
|
|
6026
6415
|
-apple-system,
|
|
@@ -6103,7 +6492,7 @@ McpConsent.styles = i`
|
|
|
6103
6492
|
.otp-resend button {
|
|
6104
6493
|
background: none;
|
|
6105
6494
|
border: none;
|
|
6106
|
-
color: var(--_primary);
|
|
6495
|
+
color: var(--consent-link, var(--_primary));
|
|
6107
6496
|
cursor: pointer;
|
|
6108
6497
|
text-decoration: underline;
|
|
6109
6498
|
}
|
|
@@ -6203,6 +6592,12 @@ __decorateClass([
|
|
|
6203
6592
|
__decorateClass([
|
|
6204
6593
|
n4({ type: Boolean, attribute: "native-scope-selection" })
|
|
6205
6594
|
], McpConsent.prototype, "nativeScopeSelection", 2);
|
|
6595
|
+
__decorateClass([
|
|
6596
|
+
n4({ type: Number, attribute: "request-expires-at" })
|
|
6597
|
+
], McpConsent.prototype, "requestExpiresAt", 2);
|
|
6598
|
+
__decorateClass([
|
|
6599
|
+
r5()
|
|
6600
|
+
], McpConsent.prototype, "approvalRecovery", 2);
|
|
6206
6601
|
__decorateClass([
|
|
6207
6602
|
n4({
|
|
6208
6603
|
type: Array,
|
|
@@ -6333,6 +6728,572 @@ __decorateClass([
|
|
|
6333
6728
|
McpConsent = __decorateClass([
|
|
6334
6729
|
t3("mcp-consent")
|
|
6335
6730
|
], McpConsent);
|
|
6731
|
+
|
|
6732
|
+
// ../../node_modules/.pnpm/@kya-os+id@0.6.0_@cfworker+json-schema@4.1.1_better-auth@1.7.7_@opentelemetry+api@1.9.0_7249a8d4ac238abc31d023752ef508a4/node_modules/@kya-os/id/dist/base64url.js
|
|
6733
|
+
function bytesToBase64Url(bytes) {
|
|
6734
|
+
let b642;
|
|
6735
|
+
if (typeof Buffer !== "undefined") {
|
|
6736
|
+
b642 = Buffer.from(bytes).toString("base64");
|
|
6737
|
+
} else {
|
|
6738
|
+
let bin = "";
|
|
6739
|
+
for (let i6 = 0; i6 < bytes.length; i6++)
|
|
6740
|
+
bin += String.fromCharCode(bytes[i6]);
|
|
6741
|
+
b642 = btoa(bin);
|
|
6742
|
+
}
|
|
6743
|
+
return b642.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
6744
|
+
}
|
|
6745
|
+
function base64UrlToBytes(b64url) {
|
|
6746
|
+
const pad = b64url.length % 4;
|
|
6747
|
+
const padded = pad === 2 ? `${b64url}==` : pad === 3 ? `${b64url}=` : pad === 1 ? "" : b64url;
|
|
6748
|
+
const b642 = padded.replace(/-/g, "+").replace(/_/g, "/");
|
|
6749
|
+
if (typeof Buffer !== "undefined") {
|
|
6750
|
+
return new Uint8Array(Buffer.from(b642, "base64"));
|
|
6751
|
+
}
|
|
6752
|
+
const bin = atob(b642);
|
|
6753
|
+
const out = new Uint8Array(bin.length);
|
|
6754
|
+
for (let i6 = 0; i6 < bin.length; i6++)
|
|
6755
|
+
out[i6] = bin.charCodeAt(i6);
|
|
6756
|
+
return out;
|
|
6757
|
+
}
|
|
6758
|
+
function base64UrlToBytesStrict(s4) {
|
|
6759
|
+
if (typeof s4 !== "string")
|
|
6760
|
+
return null;
|
|
6761
|
+
if (!/^[A-Za-z0-9_-]*$/.test(s4) || s4.length % 4 === 1)
|
|
6762
|
+
return null;
|
|
6763
|
+
const bytes = base64UrlToBytes(s4);
|
|
6764
|
+
return bytesToBase64Url(bytes) === s4 ? bytes : null;
|
|
6765
|
+
}
|
|
6766
|
+
|
|
6767
|
+
// ../../node_modules/.pnpm/@kya-os+id@0.6.0_@cfworker+json-schema@4.1.1_better-auth@1.7.7_@opentelemetry+api@1.9.0_7249a8d4ac238abc31d023752ef508a4/node_modules/@kya-os/id/dist/passkey/types.js
|
|
6768
|
+
var PASSKEY_COSE_ALGORITHMS = Object.freeze([
|
|
6769
|
+
-8,
|
|
6770
|
+
-7,
|
|
6771
|
+
-257
|
|
6772
|
+
]);
|
|
6773
|
+
|
|
6774
|
+
// ../../node_modules/.pnpm/@kya-os+id@0.6.0_@cfworker+json-schema@4.1.1_better-auth@1.7.7_@opentelemetry+api@1.9.0_7249a8d4ac238abc31d023752ef508a4/node_modules/@kya-os/id/dist/wallet/passkey.js
|
|
6775
|
+
var PasskeyCeremonyError = class extends Error {
|
|
6776
|
+
constructor(code, message, options) {
|
|
6777
|
+
super(message, options);
|
|
6778
|
+
__publicField(this, "code");
|
|
6779
|
+
this.name = "PasskeyCeremonyError";
|
|
6780
|
+
this.code = code;
|
|
6781
|
+
}
|
|
6782
|
+
};
|
|
6783
|
+
async function isPasskeySupported() {
|
|
6784
|
+
if (typeof window === "undefined")
|
|
6785
|
+
return false;
|
|
6786
|
+
if (window.isSecureContext === false)
|
|
6787
|
+
return false;
|
|
6788
|
+
if (typeof PublicKeyCredential === "undefined")
|
|
6789
|
+
return false;
|
|
6790
|
+
return credentialsContainer() !== null;
|
|
6791
|
+
}
|
|
6792
|
+
async function createPasskey(o8) {
|
|
6793
|
+
const json = {
|
|
6794
|
+
rp: { id: o8.rpId, name: o8.rpName },
|
|
6795
|
+
user: { id: o8.user.id, name: o8.user.name, displayName: o8.user.displayName },
|
|
6796
|
+
challenge: o8.challenge,
|
|
6797
|
+
pubKeyCredParams: PASSKEY_COSE_ALGORITHMS.map((alg) => ({
|
|
6798
|
+
type: "public-key",
|
|
6799
|
+
alg
|
|
6800
|
+
})),
|
|
6801
|
+
excludeCredentials: (o8.excludeCredentialIds ?? []).map((id) => ({
|
|
6802
|
+
id,
|
|
6803
|
+
type: "public-key"
|
|
6804
|
+
})),
|
|
6805
|
+
authenticatorSelection: {
|
|
6806
|
+
residentKey: "required",
|
|
6807
|
+
requireResidentKey: true,
|
|
6808
|
+
userVerification: "required"
|
|
6809
|
+
},
|
|
6810
|
+
attestation: "none",
|
|
6811
|
+
...o8.timeoutMs === void 0 ? {} : { timeout: o8.timeoutMs }
|
|
6812
|
+
};
|
|
6813
|
+
const manual = {
|
|
6814
|
+
...json,
|
|
6815
|
+
user: { ...json.user, id: toBuffer(json.user.id, "user.id") },
|
|
6816
|
+
challenge: toBuffer(json.challenge, "challenge"),
|
|
6817
|
+
excludeCredentials: json.excludeCredentials.map((c4) => ({
|
|
6818
|
+
...c4,
|
|
6819
|
+
id: toBuffer(c4.id, "excludeCredentialIds[]")
|
|
6820
|
+
}))
|
|
6821
|
+
};
|
|
6822
|
+
const container = requireCredentialsContainer();
|
|
6823
|
+
let credential;
|
|
6824
|
+
try {
|
|
6825
|
+
const parsers = jsonParsers();
|
|
6826
|
+
const publicKey = typeof parsers.parseCreationOptionsFromJSON === "function" ? parsers.parseCreationOptionsFromJSON(json) : manual;
|
|
6827
|
+
credential = await container.create({ publicKey });
|
|
6828
|
+
} catch (err) {
|
|
6829
|
+
throw toCeremonyError(err);
|
|
6830
|
+
}
|
|
6831
|
+
if (!credential) {
|
|
6832
|
+
throw new PasskeyCeremonyError("unknown", "navigator.credentials.create() resolved with no credential");
|
|
6833
|
+
}
|
|
6834
|
+
return registrationToJSON(credential);
|
|
6835
|
+
}
|
|
6836
|
+
async function getPasskeyAssertion(o8) {
|
|
6837
|
+
const json = {
|
|
6838
|
+
challenge: o8.challenge,
|
|
6839
|
+
rpId: o8.rpId,
|
|
6840
|
+
allowCredentials: (o8.allowCredentialIds ?? []).map((id) => ({
|
|
6841
|
+
id,
|
|
6842
|
+
type: "public-key"
|
|
6843
|
+
})),
|
|
6844
|
+
userVerification: "required",
|
|
6845
|
+
...o8.timeoutMs === void 0 ? {} : { timeout: o8.timeoutMs }
|
|
6846
|
+
};
|
|
6847
|
+
const manual = {
|
|
6848
|
+
...json,
|
|
6849
|
+
challenge: toBuffer(json.challenge, "challenge"),
|
|
6850
|
+
allowCredentials: json.allowCredentials.map((c4) => ({
|
|
6851
|
+
...c4,
|
|
6852
|
+
id: toBuffer(c4.id, "allowCredentialIds[]")
|
|
6853
|
+
}))
|
|
6854
|
+
};
|
|
6855
|
+
const container = requireCredentialsContainer();
|
|
6856
|
+
let credential;
|
|
6857
|
+
try {
|
|
6858
|
+
const parsers = jsonParsers();
|
|
6859
|
+
const publicKey = typeof parsers.parseRequestOptionsFromJSON === "function" ? parsers.parseRequestOptionsFromJSON(json) : manual;
|
|
6860
|
+
credential = await container.get({ publicKey });
|
|
6861
|
+
} catch (err) {
|
|
6862
|
+
throw toCeremonyError(err);
|
|
6863
|
+
}
|
|
6864
|
+
if (!credential) {
|
|
6865
|
+
throw new PasskeyCeremonyError("unknown", "navigator.credentials.get() resolved with no credential");
|
|
6866
|
+
}
|
|
6867
|
+
return assertionToJSON(credential);
|
|
6868
|
+
}
|
|
6869
|
+
var CODE_BY_DOM_NAME = {
|
|
6870
|
+
NotAllowedError: "not_allowed",
|
|
6871
|
+
InvalidStateError: "invalid_state",
|
|
6872
|
+
NotSupportedError: "not_supported",
|
|
6873
|
+
// Raised when the authenticator cannot meet a requirement (user
|
|
6874
|
+
// verification, discoverable credential): the same outcome for the caller.
|
|
6875
|
+
ConstraintError: "not_supported",
|
|
6876
|
+
SecurityError: "security",
|
|
6877
|
+
AbortError: "aborted"
|
|
6878
|
+
};
|
|
6879
|
+
var MESSAGE_BY_CODE = {
|
|
6880
|
+
not_allowed: "The passkey ceremony was cancelled, timed out, or found no matching passkey",
|
|
6881
|
+
invalid_state: "This authenticator already holds a passkey for this account",
|
|
6882
|
+
not_supported: "This browser or authenticator cannot create or use a user-verified passkey",
|
|
6883
|
+
security: "The passkey RP ID is not valid for this page's origin",
|
|
6884
|
+
aborted: "The passkey ceremony was aborted",
|
|
6885
|
+
unknown: "The passkey ceremony failed"
|
|
6886
|
+
};
|
|
6887
|
+
function toCeremonyError(err) {
|
|
6888
|
+
const name = typeof err === "object" && err !== null && "name" in err ? String(err.name) : "";
|
|
6889
|
+
const code = CODE_BY_DOM_NAME[name] ?? "unknown";
|
|
6890
|
+
return new PasskeyCeremonyError(code, MESSAGE_BY_CODE[code], { cause: err });
|
|
6891
|
+
}
|
|
6892
|
+
function credentialsContainer() {
|
|
6893
|
+
const container = typeof navigator === "undefined" ? void 0 : navigator.credentials;
|
|
6894
|
+
if (!container || typeof container.create !== "function" || typeof container.get !== "function") {
|
|
6895
|
+
return null;
|
|
6896
|
+
}
|
|
6897
|
+
return container;
|
|
6898
|
+
}
|
|
6899
|
+
function requireCredentialsContainer() {
|
|
6900
|
+
const container = typeof PublicKeyCredential === "undefined" ? null : credentialsContainer();
|
|
6901
|
+
if (!container) {
|
|
6902
|
+
throw new PasskeyCeremonyError("not_supported", "WebAuthn is not available in this runtime");
|
|
6903
|
+
}
|
|
6904
|
+
return container;
|
|
6905
|
+
}
|
|
6906
|
+
function jsonParsers() {
|
|
6907
|
+
return PublicKeyCredential;
|
|
6908
|
+
}
|
|
6909
|
+
function toBuffer(value, field) {
|
|
6910
|
+
const bytes = base64UrlToBytesStrict(value);
|
|
6911
|
+
if (!bytes) {
|
|
6912
|
+
throw new TypeError(`passkey option ${field} must be base64url without padding`);
|
|
6913
|
+
}
|
|
6914
|
+
const out = new ArrayBuffer(bytes.length);
|
|
6915
|
+
new Uint8Array(out).set(bytes);
|
|
6916
|
+
return out;
|
|
6917
|
+
}
|
|
6918
|
+
function b64(buffer) {
|
|
6919
|
+
return bytesToBase64Url(ArrayBuffer.isView(buffer) ? new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength) : new Uint8Array(buffer));
|
|
6920
|
+
}
|
|
6921
|
+
function attachment(credential) {
|
|
6922
|
+
const value = credential.authenticatorAttachment;
|
|
6923
|
+
return value === "platform" || value === "cross-platform" ? { authenticatorAttachment: value } : {};
|
|
6924
|
+
}
|
|
6925
|
+
function extensionResults(credential) {
|
|
6926
|
+
return typeof credential.getClientExtensionResults === "function" ? credential.getClientExtensionResults() : {};
|
|
6927
|
+
}
|
|
6928
|
+
function registrationToJSON(credential) {
|
|
6929
|
+
if (typeof credential.toJSON === "function") {
|
|
6930
|
+
return credential.toJSON();
|
|
6931
|
+
}
|
|
6932
|
+
const response = credential.response;
|
|
6933
|
+
const transports = response.getTransports?.();
|
|
6934
|
+
const publicKeyAlgorithm = response.getPublicKeyAlgorithm?.();
|
|
6935
|
+
const publicKey = response.getPublicKey?.();
|
|
6936
|
+
const authenticatorData = response.getAuthenticatorData?.();
|
|
6937
|
+
return {
|
|
6938
|
+
id: credential.id,
|
|
6939
|
+
rawId: b64(credential.rawId),
|
|
6940
|
+
type: "public-key",
|
|
6941
|
+
response: {
|
|
6942
|
+
clientDataJSON: b64(response.clientDataJSON),
|
|
6943
|
+
attestationObject: b64(response.attestationObject),
|
|
6944
|
+
...Array.isArray(transports) ? { transports: [...transports] } : {},
|
|
6945
|
+
...typeof publicKeyAlgorithm === "number" ? { publicKeyAlgorithm } : {},
|
|
6946
|
+
...publicKey ? { publicKey: b64(publicKey) } : {},
|
|
6947
|
+
...authenticatorData ? { authenticatorData: b64(authenticatorData) } : {}
|
|
6948
|
+
},
|
|
6949
|
+
clientExtensionResults: extensionResults(credential),
|
|
6950
|
+
...attachment(credential)
|
|
6951
|
+
};
|
|
6952
|
+
}
|
|
6953
|
+
function assertionToJSON(credential) {
|
|
6954
|
+
if (typeof credential.toJSON === "function") {
|
|
6955
|
+
return credential.toJSON();
|
|
6956
|
+
}
|
|
6957
|
+
const response = credential.response;
|
|
6958
|
+
return {
|
|
6959
|
+
id: credential.id,
|
|
6960
|
+
rawId: b64(credential.rawId),
|
|
6961
|
+
type: "public-key",
|
|
6962
|
+
response: {
|
|
6963
|
+
clientDataJSON: b64(response.clientDataJSON),
|
|
6964
|
+
authenticatorData: b64(response.authenticatorData),
|
|
6965
|
+
signature: b64(response.signature),
|
|
6966
|
+
...response.userHandle ? { userHandle: b64(response.userHandle) } : {}
|
|
6967
|
+
},
|
|
6968
|
+
clientExtensionResults: extensionResults(credential),
|
|
6969
|
+
...attachment(credential)
|
|
6970
|
+
};
|
|
6971
|
+
}
|
|
6972
|
+
|
|
6973
|
+
// src/components/consent-passkey.ts
|
|
6974
|
+
var CONSENT_PASSKEY_EVENTS = {
|
|
6975
|
+
/** The ceremony succeeded. Detail: {@link ConsentPasskeyCompleteDetail}. */
|
|
6976
|
+
complete: "consent-passkey:complete",
|
|
6977
|
+
/** The ceremony failed. Detail: {@link ConsentPasskeyErrorDetail}. */
|
|
6978
|
+
error: "consent-passkey:error",
|
|
6979
|
+
/** This browser can't run a ceremony. Detail: {@link ConsentPasskeyUnsupportedDetail}. */
|
|
6980
|
+
unsupported: "consent-passkey:unsupported"
|
|
6981
|
+
};
|
|
6982
|
+
var ERROR_COPY = CONSENT_COPY_TOKENS.passkey.errors;
|
|
6983
|
+
var ConsentPasskey = class extends i4 {
|
|
6984
|
+
constructor() {
|
|
6985
|
+
super(...arguments);
|
|
6986
|
+
this.disabled = false;
|
|
6987
|
+
this.supportResult = null;
|
|
6988
|
+
this.phase = "checking";
|
|
6989
|
+
/** Bumped on every start and every new step, so a stale result is dropped. */
|
|
6990
|
+
this.run = 0;
|
|
6991
|
+
}
|
|
6992
|
+
/**
|
|
6993
|
+
* Whether this browser can run a passkey ceremony: `null` until the
|
|
6994
|
+
* support check answers, then `true` or `false`. It is set before
|
|
6995
|
+
* `consent-passkey:unsupported` fires. That event fires as the element
|
|
6996
|
+
* connects, so a host that attaches listeners later (a React effect, a
|
|
6997
|
+
* late script) reads this instead.
|
|
6998
|
+
*/
|
|
6999
|
+
get supported() {
|
|
7000
|
+
return this.supportResult;
|
|
7001
|
+
}
|
|
7002
|
+
connectedCallback() {
|
|
7003
|
+
super.connectedCallback();
|
|
7004
|
+
this.supportCheck ?? (this.supportCheck = this.checkSupport());
|
|
7005
|
+
}
|
|
7006
|
+
willUpdate(changed) {
|
|
7007
|
+
if (changed.has("options") || changed.has("ceremony")) {
|
|
7008
|
+
this.run++;
|
|
7009
|
+
this.errorCode = void 0;
|
|
7010
|
+
if (this.phase === "running" || this.phase === "done") {
|
|
7011
|
+
this.phase = "ready";
|
|
7012
|
+
}
|
|
7013
|
+
}
|
|
7014
|
+
}
|
|
7015
|
+
async checkSupport() {
|
|
7016
|
+
let supported = false;
|
|
7017
|
+
try {
|
|
7018
|
+
supported = await isPasskeySupported();
|
|
7019
|
+
} catch {
|
|
7020
|
+
supported = false;
|
|
7021
|
+
}
|
|
7022
|
+
this.supportResult = supported;
|
|
7023
|
+
if (supported) {
|
|
7024
|
+
if (this.phase === "checking") this.phase = "ready";
|
|
7025
|
+
return;
|
|
7026
|
+
}
|
|
7027
|
+
this.phase = "unsupported";
|
|
7028
|
+
this.emit(
|
|
7029
|
+
CONSENT_PASSKEY_EVENTS.unsupported,
|
|
7030
|
+
{ ceremony: this.validCeremony() }
|
|
7031
|
+
);
|
|
7032
|
+
}
|
|
7033
|
+
validCeremony() {
|
|
7034
|
+
const value = this.ceremony;
|
|
7035
|
+
return PASSKEY_CEREMONIES.find((ceremony) => ceremony === value);
|
|
7036
|
+
}
|
|
7037
|
+
canStart() {
|
|
7038
|
+
return this.phase === "ready" && !this.disabled && this.validCeremony() !== void 0 && typeof this.options === "object" && this.options !== null;
|
|
7039
|
+
}
|
|
7040
|
+
/** The button's click handler: the only path that starts a ceremony. */
|
|
7041
|
+
async handleClick() {
|
|
7042
|
+
const ceremony = this.validCeremony();
|
|
7043
|
+
const options = this.options;
|
|
7044
|
+
if (!this.canStart() || ceremony === void 0 || !options) return;
|
|
7045
|
+
const run = ++this.run;
|
|
7046
|
+
this.phase = "running";
|
|
7047
|
+
this.errorCode = void 0;
|
|
7048
|
+
let detail;
|
|
7049
|
+
try {
|
|
7050
|
+
detail = ceremony === "register" ? {
|
|
7051
|
+
ceremony,
|
|
7052
|
+
response: await createPasskey(options)
|
|
7053
|
+
} : {
|
|
7054
|
+
ceremony,
|
|
7055
|
+
response: await getPasskeyAssertion(options)
|
|
7056
|
+
};
|
|
7057
|
+
} catch (error) {
|
|
7058
|
+
if (run !== this.run) return;
|
|
7059
|
+
const failure = toErrorDetail(error);
|
|
7060
|
+
this.phase = "ready";
|
|
7061
|
+
this.errorCode = failure.code;
|
|
7062
|
+
this.emit(
|
|
7063
|
+
CONSENT_PASSKEY_EVENTS.error,
|
|
7064
|
+
failure
|
|
7065
|
+
);
|
|
7066
|
+
return;
|
|
7067
|
+
}
|
|
7068
|
+
if (run !== this.run) return;
|
|
7069
|
+
this.phase = "done";
|
|
7070
|
+
this.emit(
|
|
7071
|
+
CONSENT_PASSKEY_EVENTS.complete,
|
|
7072
|
+
detail
|
|
7073
|
+
);
|
|
7074
|
+
}
|
|
7075
|
+
emit(name, detail) {
|
|
7076
|
+
this.dispatchEvent(
|
|
7077
|
+
new CustomEvent(name, { detail, bubbles: true, composed: true })
|
|
7078
|
+
);
|
|
7079
|
+
}
|
|
7080
|
+
render() {
|
|
7081
|
+
const copy = CONSENT_COPY_TOKENS.passkey;
|
|
7082
|
+
const ceremonyCopy = copy[this.validCeremony() ?? "authenticate"];
|
|
7083
|
+
const showCompatibility = this.config?.showCompatibilityInfo !== false;
|
|
7084
|
+
if (this.phase === "unsupported") {
|
|
7085
|
+
return b2`
|
|
7086
|
+
<div class="container" part="container">
|
|
7087
|
+
<div class="heading">
|
|
7088
|
+
${renderIcon()}
|
|
7089
|
+
<div>
|
|
7090
|
+
<p class="title" part="title">${copy.unsupportedTitle}</p>
|
|
7091
|
+
<p class="instructions" part="instructions">
|
|
7092
|
+
${this.config?.unsupportedText || copy.unsupportedText}
|
|
7093
|
+
</p>
|
|
7094
|
+
</div>
|
|
7095
|
+
</div>
|
|
7096
|
+
${showCompatibility ? b2`<p class="compatibility" part="compatibility">
|
|
7097
|
+
${copy.compatibilityInfo}
|
|
7098
|
+
</p>` : A}
|
|
7099
|
+
</div>
|
|
7100
|
+
`;
|
|
7101
|
+
}
|
|
7102
|
+
const running = this.phase === "running";
|
|
7103
|
+
const done = this.phase === "done";
|
|
7104
|
+
const status = running ? copy.waiting : this.phase === "checking" ? copy.checking : done ? ceremonyCopy.done : "";
|
|
7105
|
+
const errorCode = this.errorCode;
|
|
7106
|
+
return b2`
|
|
7107
|
+
<div
|
|
7108
|
+
class="container"
|
|
7109
|
+
part="container"
|
|
7110
|
+
aria-busy=${running ? "true" : "false"}
|
|
7111
|
+
>
|
|
7112
|
+
<div class="heading">
|
|
7113
|
+
${renderIcon()}
|
|
7114
|
+
<div>
|
|
7115
|
+
<p class="title" part="title">${ceremonyCopy.title}</p>
|
|
7116
|
+
<p class="instructions" part="instructions">
|
|
7117
|
+
${this.config?.instructions || ceremonyCopy.instructions}
|
|
7118
|
+
</p>
|
|
7119
|
+
</div>
|
|
7120
|
+
</div>
|
|
7121
|
+
<button
|
|
7122
|
+
part="button"
|
|
7123
|
+
type="button"
|
|
7124
|
+
?disabled=${!this.canStart()}
|
|
7125
|
+
@click=${this.handleClick}
|
|
7126
|
+
>
|
|
7127
|
+
${this.config?.buttonText || ceremonyCopy.button}
|
|
7128
|
+
</button>
|
|
7129
|
+
<p class="status" part="status" role="status" aria-live="polite">
|
|
7130
|
+
${status}
|
|
7131
|
+
</p>
|
|
7132
|
+
${errorCode ? b2`<p class="error" part="error" role="alert">
|
|
7133
|
+
${ERROR_COPY[errorCode]}
|
|
7134
|
+
</p>` : A}
|
|
7135
|
+
${errorCode === "not_supported" && showCompatibility ? b2`<p class="compatibility" part="compatibility">
|
|
7136
|
+
${copy.compatibilityInfo}
|
|
7137
|
+
</p>` : A}
|
|
7138
|
+
</div>
|
|
7139
|
+
`;
|
|
7140
|
+
}
|
|
7141
|
+
};
|
|
7142
|
+
ConsentPasskey.styles = i`
|
|
7143
|
+
:host {
|
|
7144
|
+
display: block;
|
|
7145
|
+
color: var(--cs-text-primary, #0f172a);
|
|
7146
|
+
font-family: inherit;
|
|
7147
|
+
}
|
|
7148
|
+
|
|
7149
|
+
.container {
|
|
7150
|
+
display: flex;
|
|
7151
|
+
flex-direction: column;
|
|
7152
|
+
gap: 12px;
|
|
7153
|
+
padding: 16px;
|
|
7154
|
+
border-radius: 12px;
|
|
7155
|
+
border: 1px solid var(--cs-surface-border, rgba(15, 23, 42, 0.1));
|
|
7156
|
+
background: var(--cs-surface-card, #ffffff);
|
|
7157
|
+
}
|
|
7158
|
+
|
|
7159
|
+
.heading {
|
|
7160
|
+
display: flex;
|
|
7161
|
+
align-items: flex-start;
|
|
7162
|
+
gap: 12px;
|
|
7163
|
+
}
|
|
7164
|
+
|
|
7165
|
+
.icon {
|
|
7166
|
+
width: 36px;
|
|
7167
|
+
height: 36px;
|
|
7168
|
+
flex-shrink: 0;
|
|
7169
|
+
padding: 8px;
|
|
7170
|
+
box-sizing: border-box;
|
|
7171
|
+
border-radius: 10px;
|
|
7172
|
+
background: var(--cs-surface-inset, #f1ece2);
|
|
7173
|
+
color: var(--cs-text-secondary, #334155);
|
|
7174
|
+
}
|
|
7175
|
+
|
|
7176
|
+
.title {
|
|
7177
|
+
margin: 0;
|
|
7178
|
+
font-size: 15px;
|
|
7179
|
+
font-weight: 600;
|
|
7180
|
+
line-height: 1.4;
|
|
7181
|
+
}
|
|
7182
|
+
|
|
7183
|
+
.instructions {
|
|
7184
|
+
margin: 2px 0 0;
|
|
7185
|
+
font-size: 13.5px;
|
|
7186
|
+
line-height: 1.5;
|
|
7187
|
+
color: var(--cs-text-secondary, #334155);
|
|
7188
|
+
}
|
|
7189
|
+
|
|
7190
|
+
button {
|
|
7191
|
+
width: 100%;
|
|
7192
|
+
padding: 14px 18px;
|
|
7193
|
+
border: none;
|
|
7194
|
+
border-radius: 999px;
|
|
7195
|
+
min-height: var(--cs-action-min-height, 0px);
|
|
7196
|
+
background: var(--cs-surface-accent, #0f172a);
|
|
7197
|
+
color: var(--cs-surface-accent-text, #ffffff);
|
|
7198
|
+
font-size: var(--cs-action-font-size, 15px);
|
|
7199
|
+
font-weight: 500;
|
|
7200
|
+
font-family: inherit;
|
|
7201
|
+
cursor: pointer;
|
|
7202
|
+
transition: opacity 0.15s ease;
|
|
7203
|
+
}
|
|
7204
|
+
|
|
7205
|
+
button:hover:not(:disabled) {
|
|
7206
|
+
opacity: 0.92;
|
|
7207
|
+
}
|
|
7208
|
+
|
|
7209
|
+
button:disabled {
|
|
7210
|
+
opacity: 0.5;
|
|
7211
|
+
cursor: not-allowed;
|
|
7212
|
+
}
|
|
7213
|
+
|
|
7214
|
+
button:focus-visible {
|
|
7215
|
+
outline: 2px solid var(--cs-focus-ring, #0f172a);
|
|
7216
|
+
outline-offset: 3px;
|
|
7217
|
+
}
|
|
7218
|
+
|
|
7219
|
+
.status {
|
|
7220
|
+
margin: 0;
|
|
7221
|
+
min-height: 1em;
|
|
7222
|
+
font-size: 12.5px;
|
|
7223
|
+
color: var(--cs-text-tertiary, #64748b);
|
|
7224
|
+
}
|
|
7225
|
+
|
|
7226
|
+
.status:empty {
|
|
7227
|
+
display: none;
|
|
7228
|
+
}
|
|
7229
|
+
|
|
7230
|
+
.error {
|
|
7231
|
+
margin: 0;
|
|
7232
|
+
padding: 10px 12px;
|
|
7233
|
+
border-radius: 10px;
|
|
7234
|
+
background: var(--cs-chip-risk-bg, #fce7b6);
|
|
7235
|
+
color: var(--cs-chip-risk-text, #7a4f00);
|
|
7236
|
+
font-size: 13px;
|
|
7237
|
+
line-height: 1.45;
|
|
7238
|
+
}
|
|
7239
|
+
|
|
7240
|
+
.compatibility {
|
|
7241
|
+
margin: 0;
|
|
7242
|
+
font-size: 12.5px;
|
|
7243
|
+
line-height: 1.5;
|
|
7244
|
+
color: var(--cs-text-tertiary, #64748b);
|
|
7245
|
+
}
|
|
7246
|
+
`;
|
|
7247
|
+
__decorateClass([
|
|
7248
|
+
n4({ type: String, reflect: true })
|
|
7249
|
+
], ConsentPasskey.prototype, "ceremony", 2);
|
|
7250
|
+
__decorateClass([
|
|
7251
|
+
n4({ attribute: false })
|
|
7252
|
+
], ConsentPasskey.prototype, "options", 2);
|
|
7253
|
+
__decorateClass([
|
|
7254
|
+
n4({ attribute: false })
|
|
7255
|
+
], ConsentPasskey.prototype, "config", 2);
|
|
7256
|
+
__decorateClass([
|
|
7257
|
+
n4({ type: Boolean, reflect: true })
|
|
7258
|
+
], ConsentPasskey.prototype, "disabled", 2);
|
|
7259
|
+
__decorateClass([
|
|
7260
|
+
r5()
|
|
7261
|
+
], ConsentPasskey.prototype, "supportResult", 2);
|
|
7262
|
+
__decorateClass([
|
|
7263
|
+
r5()
|
|
7264
|
+
], ConsentPasskey.prototype, "phase", 2);
|
|
7265
|
+
__decorateClass([
|
|
7266
|
+
r5()
|
|
7267
|
+
], ConsentPasskey.prototype, "errorCode", 2);
|
|
7268
|
+
ConsentPasskey = __decorateClass([
|
|
7269
|
+
t3("consent-passkey")
|
|
7270
|
+
], ConsentPasskey);
|
|
7271
|
+
function toErrorDetail(error) {
|
|
7272
|
+
if (error instanceof PasskeyCeremonyError) {
|
|
7273
|
+
return { code: error.code, message: error.message };
|
|
7274
|
+
}
|
|
7275
|
+
return {
|
|
7276
|
+
code: "unknown",
|
|
7277
|
+
message: error instanceof Error ? error.message : String(error)
|
|
7278
|
+
};
|
|
7279
|
+
}
|
|
7280
|
+
function renderIcon() {
|
|
7281
|
+
return b2`
|
|
7282
|
+
<svg
|
|
7283
|
+
class="icon"
|
|
7284
|
+
viewBox="0 0 24 24"
|
|
7285
|
+
fill="none"
|
|
7286
|
+
stroke="currentColor"
|
|
7287
|
+
stroke-width="1.6"
|
|
7288
|
+
stroke-linecap="round"
|
|
7289
|
+
stroke-linejoin="round"
|
|
7290
|
+
aria-hidden="true"
|
|
7291
|
+
>
|
|
7292
|
+
<circle cx="8" cy="9" r="4" />
|
|
7293
|
+
<path d="M11 12.5 20 21.5M16.5 18l2-2M14.5 16l2-2" />
|
|
7294
|
+
</svg>
|
|
7295
|
+
`;
|
|
7296
|
+
}
|
|
6336
7297
|
export {
|
|
6337
7298
|
CONSENT_CAPABILITIES_FEATURES,
|
|
6338
7299
|
ConsentActionBar,
|
|
@@ -6346,6 +7307,7 @@ export {
|
|
|
6346
7307
|
ConsentInput,
|
|
6347
7308
|
ConsentOAuthButton,
|
|
6348
7309
|
ConsentOTPInput,
|
|
7310
|
+
ConsentPasskey,
|
|
6349
7311
|
ConsentPermissions,
|
|
6350
7312
|
ConsentRevocationNotice,
|
|
6351
7313
|
ConsentShell,
|