@kardalum/plugin-sdk 0.20.0 → 0.21.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/CHANGELOG.md +70 -0
- package/dist/admin-section-registry.d.ts +33 -1
- package/dist/admin-section-registry.js +67 -0
- package/dist/capabilities.js +46 -1
- package/dist/consent-entry.d.ts +11 -0
- package/dist/consent-entry.js +18 -0
- package/dist/content-library.d.ts +17 -0
- package/dist/content-list-extensions.d.ts +50 -0
- package/dist/content-list-extensions.js +11 -0
- package/dist/content-picker/page-picker-sheet.d.ts +2 -0
- package/dist/content-picker/page-picker-sheet.js +1 -1
- package/dist/content-picker/page-picker.d.ts +18 -0
- package/dist/content-picker/page-picker.js +20 -0
- package/dist/datatype-validation.js +10 -2
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +2 -0
- package/dist/entitlement-types.d.ts +18 -1
- package/dist/host-entry.d.ts +7 -1
- package/dist/host-entry.js +14 -1
- package/dist/index.d.ts +35 -7
- package/dist/index.js +46 -5
- package/dist/mail.d.ts +6 -2
- package/dist/manifest-entry.d.ts +22 -4
- package/dist/manifest-entry.js +25 -1
- package/dist/manifest-schema.d.ts +570 -31
- package/dist/manifest-schema.js +240 -12
- package/dist/manifest.d.ts +757 -32
- package/dist/manifest.js +8 -4
- package/dist/plugin-context.d.ts +47 -0
- package/dist/plugin-context.js +27 -0
- package/dist/plugin-permissions.d.ts +18 -0
- package/dist/plugin-permissions.js +25 -0
- package/dist/plugin-screen-context.d.ts +152 -11
- package/dist/plugin-screen-context.js +30 -0
- package/dist/providers.d.ts +47 -2
- package/dist/render-page.d.ts +15 -0
- package/dist/render-page.js +20 -0
- package/dist/richtext/block-panel.d.ts +12 -1
- package/dist/richtext/block-panel.js +27 -21
- package/dist/richtext/button-view.d.ts +11 -0
- package/dist/richtext/button-view.js +45 -0
- package/dist/richtext/content-guard.d.ts +4 -0
- package/dist/richtext/content-guard.js +27 -0
- package/dist/richtext/editor-handle.d.ts +34 -0
- package/dist/richtext/editor-handle.js +225 -0
- package/dist/richtext/extensions.d.ts +6 -0
- package/dist/richtext/extensions.js +16 -0
- package/dist/richtext/insert-menu.d.ts +6 -1
- package/dist/richtext/insert-menu.js +38 -18
- package/dist/richtext/item-attributes.d.ts +6 -0
- package/dist/richtext/item-attributes.js +19 -0
- package/dist/richtext/item-panel.d.ts +25 -0
- package/dist/richtext/item-panel.js +118 -0
- package/dist/richtext/item-view.d.ts +58 -0
- package/dist/richtext/item-view.js +172 -0
- package/dist/richtext/mark-form.d.ts +10 -0
- package/dist/richtext/mark-form.js +38 -0
- package/dist/richtext/paste-choice.d.ts +9 -0
- package/dist/richtext/paste-choice.js +13 -0
- package/dist/richtext/plugin-items.d.ts +72 -0
- package/dist/richtext/plugin-items.js +562 -0
- package/dist/richtext/plugin-mark-tooltips.d.ts +5 -0
- package/dist/richtext/plugin-mark-tooltips.js +44 -0
- package/dist/richtext/plugin-toolbar.d.ts +57 -0
- package/dist/richtext/plugin-toolbar.js +186 -0
- package/dist/richtext/rich-item-icons.d.ts +5 -0
- package/dist/richtext/rich-item-icons.js +42 -0
- package/dist/richtext/rich-items.d.ts +42 -0
- package/dist/richtext/rich-items.js +68 -0
- package/dist/richtext/rich-text-view-host.d.ts +24 -0
- package/dist/richtext/rich-text-view-host.js +11 -0
- package/dist/richtext/toolbar-button.d.ts +16 -0
- package/dist/richtext/toolbar-button.js +9 -0
- package/dist/richtext/url-paste.d.ts +20 -0
- package/dist/richtext/url-paste.js +82 -0
- package/dist/richtext-html-entry.d.ts +5 -0
- package/dist/richtext-html-entry.js +11 -0
- package/dist/sdk-strings.d.ts +59 -0
- package/dist/sdk-strings.js +64 -0
- package/dist/service-contract.d.ts +17 -0
- package/dist/service-contract.js +39 -0
- package/dist/services.d.ts +114 -0
- package/dist/services.js +1 -0
- package/dist/structured-storage-types.d.ts +124 -4
- package/dist/tailwind.js +10 -5
- package/dist/template-reads.d.ts +16 -0
- package/dist/template-reads.js +21 -0
- package/dist/testing-entry.d.ts +38 -0
- package/dist/testing-entry.js +173 -0
- package/dist/text-entry.d.ts +1 -1
- package/dist/text-entry.js +3 -2
- package/dist/tokens/system-dark.css +1 -0
- package/dist/tokens/tailwind-theme.css +2 -0
- package/dist/tokens/tokens.css +4 -0
- package/dist/tokens/tokens.json +5 -1
- package/dist/uploads.d.ts +43 -0
- package/dist/uploads.js +1 -0
- package/dist/user-library.d.ts +51 -0
- package/dist/user-library.js +15 -0
- package/dist/view-helpers.d.ts +18 -0
- package/dist/view-helpers.js +64 -0
- package/dist/views/content-list-view.js +207 -8
- package/dist/views/content-picker-view.js +1 -1
- package/dist/views/rich-text-view.d.ts +2 -0
- package/dist/views/rich-text-view.js +182 -24
- package/dist/views/unreadable-rich-text.d.ts +17 -0
- package/dist/views/unreadable-rich-text.js +40 -0
- package/dist/visitors.d.ts +81 -0
- package/dist/visitors.js +1 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.js +39 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +127 -8
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +82 -7
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +5 -1
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +2 -2
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +11 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +18 -0
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +80 -0
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +41 -2
- package/node_modules/@kardalum/api-schemas/dist/content-reads.schema.d.ts +213 -0
- package/node_modules/@kardalum/api-schemas/dist/content-reads.schema.js +234 -0
- package/node_modules/@kardalum/api-schemas/dist/contribution-issues.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/contribution-issues.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +50 -13
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +19 -10
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +77 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +37 -0
- package/node_modules/@kardalum/api-schemas/dist/experimental-points.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/experimental-points.js +250 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.d.ts +29 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/html-scan.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/html-scan.js +122 -0
- package/node_modules/@kardalum/api-schemas/dist/html-start-tags.d.ts +48 -0
- package/node_modules/@kardalum/api-schemas/dist/html-start-tags.js +381 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +52 -14
- package/node_modules/@kardalum/api-schemas/dist/index.js +53 -9
- package/node_modules/@kardalum/api-schemas/dist/json-depth.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/json-depth.js +20 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +4 -2
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +6 -1
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +178 -2
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +16 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +51 -2
- package/node_modules/@kardalum/api-schemas/dist/page-audience.schema.d.ts +87 -0
- package/node_modules/@kardalum/api-schemas/dist/page-audience.schema.js +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-admin-slots.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-admin-slots.js +61 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +4 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +12 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.d.ts +136 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.js +254 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.js +66 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.d.ts +130 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.js +173 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.d.ts +16 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.js +112 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.js +380 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.js +68 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +18 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +18 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +5 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +10 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +48 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +5 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +6 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-events.d.ts +24 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-events.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-guards.d.ts +112 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-guards.js +118 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +67 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +15 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.d.ts +138 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.js +110 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +80 -15
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +67 -23
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +10 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +33 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +2 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +7 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +43 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +36 -5
- package/node_modules/@kardalum/api-schemas/dist/plugin-rich-text.d.ts +638 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-rich-text.js +533 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-call.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-call.js +32 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.d.ts +193 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.js +123 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.d.ts +209 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.js +372 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-services.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-services.js +204 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +10 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +171 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +406 -42
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.d.ts +69 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.js +149 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-styles.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-styles.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-uploads.d.ts +96 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-uploads.js +185 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.d.ts +213 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.js +131 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.d.ts +54 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.js +154 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.js +124 -0
- package/node_modules/@kardalum/api-schemas/dist/render-cache.d.ts +126 -0
- package/node_modules/@kardalum/api-schemas/dist/render-cache.js +263 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +303 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +61 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.js +108 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +66 -1
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +465 -7
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +15 -118
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +110 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +36 -0
- package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.d.ts +64 -0
- package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +9 -2
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +7 -2
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.d.ts +724 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.js +408 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +5 -3
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +3 -1
- package/node_modules/@kardalum/api-schemas/dist/site-consent.d.ts +77 -0
- package/node_modules/@kardalum/api-schemas/dist/site-consent.js +122 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +33 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +26 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +2 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-accounts.d.ts +482 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-accounts.js +380 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-groups.d.ts +109 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-groups.js +62 -0
- package/node_modules/@kardalum/api-schemas/package.json +1 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +9 -1
- package/node_modules/@kardalum/design-tokens/dist/system-dark.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +4 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +6 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +5 -1
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +4 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +9 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +276 -19
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +23 -0
- package/node_modules/@kardalum/plugin-package/dist/contract-fingerprint.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/contract-fingerprint.js +39 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.d.ts +23 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.js +351 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +21 -8
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +23 -10
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +30 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +6 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +24 -6
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +15 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.js +173 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +14 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.js +35 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.js +71 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +44 -11
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.js +36 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.js +33 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -0
- package/node_modules/@kardalum/plugin-package/dist/index.js +5 -0
- package/node_modules/@kardalum/plugin-package/dist/public-suffix.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/public-suffix.js +23 -0
- package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.js +28 -0
- package/node_modules/@kardalum/plugin-package/package.json +4 -0
- package/node_modules/@kardalum/ui/dist/components/select.d.ts +6 -0
- package/node_modules/@kardalum/ui/dist/components/select.js +7 -0
- package/node_modules/@kardalum/ui/dist/components/textarea.d.ts +6 -0
- package/node_modules/@kardalum/ui/dist/components/textarea.js +7 -0
- package/node_modules/@kardalum/ui/dist/index.d.ts +2 -0
- package/node_modules/@kardalum/ui/dist/index.js +2 -0
- package/package.json +15 -3
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { LoginResponseSchema } from "./auth.schema.js";
|
|
3
|
+
import { PluginLabelSchema, labelMapSchema } from "./plugin-labels.js";
|
|
4
|
+
import { PLUGIN_ID_MAX } from "./plugin-id-rules.js";
|
|
5
|
+
import { PROVIDER_ID_MAX, PROVIDER_LABEL_MAX, PROVIDER_TABLE_FUNCTIONS, PROVIDERS_PER_KIND_MAX, isLowerToken, isProviderText } from "./plugin-providers.js";
|
|
6
|
+
import { SIGN_IN_ATTEMPTS_PER_ADDRESS_MAX, SIGN_IN_DESCRIPTION_MAX, SIGN_IN_LINK_PASSWORD_MAX, isSignInDescription } from "./sign-in.schema.js";
|
|
7
|
+
// M35 U3a (design 2026-11-19-m35-u3-admin-login-step-design.md, D2 to D9): a step a plugin adds to
|
|
8
|
+
// the admin sign-in, after the password or a provider and before the session exists. The rules, the
|
|
9
|
+
// limits and every data shape are here, so the SDK, the server, the delivery check and the admin read
|
|
10
|
+
// one definition. A plugin answers data, never markup; every answer is copied field by field once and
|
|
11
|
+
// the copy is checked, each text by a linear scan after its length cap. No pattern meets plugin text.
|
|
12
|
+
/** D5: the kinds this release knows. "gate" (35-U3b) and "task" are additive; a step ignores what it does not know. */
|
|
13
|
+
export const SIGN_IN_STEP_KINDS = ["factor"];
|
|
14
|
+
/** D5: what a factor's `status` answers. Each later kind brings its own two states. */
|
|
15
|
+
export const SIGN_IN_STEP_STATES = ["setUp", "notSetUp"];
|
|
16
|
+
/** D4: the forms a step is drawn in. Setup during a sign-in (35-U3c) answers `form: "setup"` on the step page. */
|
|
17
|
+
export const SIGN_IN_STEP_FORMS = ["challenge", "setup"];
|
|
18
|
+
export const SIGN_IN_STEP_PARTS = ["main", "alternate"];
|
|
19
|
+
export const SIGN_IN_STEP_TELLS = ["wrong", "expired", "unavailable"];
|
|
20
|
+
/** D4: the codes a step route answers with. */
|
|
21
|
+
export const SIGN_IN_STEP_ERROR_CODES = ["wrong", "expired", "paused", "unavailable"];
|
|
22
|
+
/** D7, D10: what the owner chooses for a step. "everyone" and roles come with required factors (35-U3c). */
|
|
23
|
+
export const SIGN_IN_STEP_WHO = ["setUp"];
|
|
24
|
+
export const SIGN_IN_STEP_FAILURE_RULES = ["refuse", "allow"];
|
|
25
|
+
/** D2: the most steps switched on site-wide. A plugin declares at most PROVIDERS_PER_KIND_MAX. */
|
|
26
|
+
export const SIGN_IN_STEPS_ON_MAX = 10;
|
|
27
|
+
/** D3: the pending sign-in's bounds. */
|
|
28
|
+
export const SIGN_IN_PENDING_TTL_SECONDS = 600;
|
|
29
|
+
export const SIGN_IN_PENDING_WRONG_MAX = 5;
|
|
30
|
+
export const SIGN_IN_PENDING_PER_ACCOUNT_MAX = 5;
|
|
31
|
+
export const SIGN_IN_PENDING_PER_ADDRESS_MAX = SIGN_IN_ATTEMPTS_PER_ADDRESS_MAX;
|
|
32
|
+
export const SIGN_IN_PENDING_LIVE_MAX = 10_000;
|
|
33
|
+
/** D8: a setup row lives as long as a pending sign-in; a person without a password sets up from a session this fresh. */
|
|
34
|
+
export const SIGN_IN_SETUP_TTL_SECONDS = 600;
|
|
35
|
+
export const SIGN_IN_STEP_FRESH_SESSION_MS = 600_000;
|
|
36
|
+
/** D9 (decision 12 (a)): the account brake. */
|
|
37
|
+
export const SIGN_IN_STEP_BRAKE_FAILURES = 10;
|
|
38
|
+
export const SIGN_IN_STEP_BRAKE_WINDOW_MS = 900_000;
|
|
39
|
+
export const SIGN_IN_STEP_BRAKE_PAUSE_MS = 900_000;
|
|
40
|
+
/** D6: the parts' limits. */
|
|
41
|
+
export const SIGN_IN_STEP_FIELDS_MAX = 3;
|
|
42
|
+
export const SIGN_IN_STEP_LEAD_MAX = 2;
|
|
43
|
+
export const SIGN_IN_STEP_LEAD_TEXT_MAX = 400;
|
|
44
|
+
export const SIGN_IN_STEP_LABEL_MAX = PROVIDER_LABEL_MAX;
|
|
45
|
+
export const SIGN_IN_STEP_FIELD_ID_MAX = 32;
|
|
46
|
+
export const SIGN_IN_STEP_CODE_DIGITS_MIN = 4;
|
|
47
|
+
export const SIGN_IN_STEP_CODE_DIGITS_MAX = 10;
|
|
48
|
+
export const SIGN_IN_STEP_TEXT_MAX = 64;
|
|
49
|
+
export const SIGN_IN_STEP_SECRET_MIN = 16;
|
|
50
|
+
export const SIGN_IN_STEP_SECRET_MAX = 128;
|
|
51
|
+
export const SIGN_IN_STEP_KEEP_CODES_MAX = 16;
|
|
52
|
+
export const SIGN_IN_STEP_KEEP_CODE_MIN = 4;
|
|
53
|
+
export const SIGN_IN_STEP_KEEP_CODE_MAX = 32;
|
|
54
|
+
export const SIGN_IN_STEP_STATE_MAX_BYTES = 4096;
|
|
55
|
+
export const SIGN_IN_STEP_KEPT_MAX_BYTES = 8192;
|
|
56
|
+
export const SIGN_IN_STEP_ANSWER_MAX_BYTES = 16_384;
|
|
57
|
+
/** Longer than any field's rule, so a value past its field is still read and answered `wrong`. */
|
|
58
|
+
export const SIGN_IN_STEP_ANSWER_VALUE_MAX = 256;
|
|
59
|
+
/** A step key, `<pluginId>/<stepId>`. */
|
|
60
|
+
export const SIGN_IN_STEP_KEY_MAX = PLUGIN_ID_MAX + 1 + PROVIDER_ID_MAX;
|
|
61
|
+
/** The longest otpauth address (a 253-character host, a 191-character email, a 128-character key, the query). */
|
|
62
|
+
export const SIGN_IN_STEP_OTPAUTH_MAX = 2048;
|
|
63
|
+
const HYPHEN = 45;
|
|
64
|
+
const BASE32 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
65
|
+
export function isSignInStepKind(value) {
|
|
66
|
+
return typeof value === "string" && SIGN_IN_STEP_KINDS.includes(value);
|
|
67
|
+
}
|
|
68
|
+
/** A field id: a-z first, then a-z, 0-9 and "-", 1 to 32, no "-" last. */
|
|
69
|
+
export function isSignInStepFieldId(value) {
|
|
70
|
+
return typeof value === "string" && isLowerToken(value, SIGN_IN_STEP_FIELD_ID_MAX, HYPHEN, false);
|
|
71
|
+
}
|
|
72
|
+
/** An authenticator key: 16 to 128 characters of the RFC 4648 base32 alphabet, upper case, no padding. */
|
|
73
|
+
export function isBase32Secret(value) {
|
|
74
|
+
if (typeof value !== "string" || value.length < SIGN_IN_STEP_SECRET_MIN || value.length > SIGN_IN_STEP_SECRET_MAX)
|
|
75
|
+
return false;
|
|
76
|
+
for (let i = 0; i < value.length; i++)
|
|
77
|
+
if (BASE32.indexOf(value.charAt(i)) === -1)
|
|
78
|
+
return false;
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
/** A code to keep: 4 to 32 characters of A to Z, a to z, 0 to 9 and "-". */
|
|
82
|
+
export function isKeepCode(value) {
|
|
83
|
+
if (typeof value !== "string" || value.length < SIGN_IN_STEP_KEEP_CODE_MIN || value.length > SIGN_IN_STEP_KEEP_CODE_MAX)
|
|
84
|
+
return false;
|
|
85
|
+
for (let i = 0; i < value.length; i++) {
|
|
86
|
+
const c = value.charCodeAt(i);
|
|
87
|
+
const ok = (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || c === HYPHEN;
|
|
88
|
+
if (!ok)
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* D5: the kind rule. Every required function of the table kind (`status`) is always required; a factor
|
|
95
|
+
* also declares every optional one. Both lists are PROVIDER_TABLE_FUNCTIONS.signInStep's, never retyped.
|
|
96
|
+
*/
|
|
97
|
+
export function signInStepFunctionsProblem(kind, present) {
|
|
98
|
+
const missingRequired = PROVIDER_TABLE_FUNCTIONS.signInStep.required.filter((name) => !present.has(name));
|
|
99
|
+
if (missingRequired.length > 0)
|
|
100
|
+
return `${missingRequired.join(", ")} must be a function`;
|
|
101
|
+
if (kind === "factor") {
|
|
102
|
+
const missing = PROVIDER_TABLE_FUNCTIONS.signInStep.optional.filter((name) => !present.has(name));
|
|
103
|
+
if (missing.length > 0)
|
|
104
|
+
return `a factor step declares ${missing.join(", ")} as functions`;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
/** D5: a step entry's own fields (the id and label are the provider table's shared rule). Names a field, never a value. */
|
|
109
|
+
export function signInStepDeclarationProblems(entry, where) {
|
|
110
|
+
const problems = [];
|
|
111
|
+
if (!isSignInStepKind(entry.kind))
|
|
112
|
+
problems.push(`${where}.kind must be one of ${SIGN_IN_STEP_KINDS.map((kind) => `"${kind}"`).join(", ")}`);
|
|
113
|
+
if (entry.description !== undefined && !isSignInDescription(entry.description)) {
|
|
114
|
+
problems.push(`${where}.description is at most ${SIGN_IN_DESCRIPTION_MAX} characters a language, with no control, direction or other hidden character`);
|
|
115
|
+
}
|
|
116
|
+
return problems;
|
|
117
|
+
}
|
|
118
|
+
function recordOf(value) {
|
|
119
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
120
|
+
}
|
|
121
|
+
/** D5: a plugin with a factor step seals its secret (`sealedValues`) in its structured storage. */
|
|
122
|
+
export function signInStepManifestProblems(manifest) {
|
|
123
|
+
const contributions = recordOf(manifest.contributions);
|
|
124
|
+
const steps = contributions?.signInSteps;
|
|
125
|
+
if (!Array.isArray(steps))
|
|
126
|
+
return [];
|
|
127
|
+
const factor = steps.slice(0, PROVIDERS_PER_KIND_MAX + 1).some((entry) => recordOf(entry)?.kind === "factor");
|
|
128
|
+
if (!factor)
|
|
129
|
+
return [];
|
|
130
|
+
const problems = [];
|
|
131
|
+
const sealed = contributions?.sealedValues;
|
|
132
|
+
if (!Array.isArray(sealed) || sealed.length === 0) {
|
|
133
|
+
problems.push("contributions.signInSteps declares a factor step, so contributions.sealedValues must declare a kind: a factor's secret is sealed with context.sealing");
|
|
134
|
+
}
|
|
135
|
+
if (recordOf(manifest.databaseCompatibility)?.storageType !== "structured") {
|
|
136
|
+
problems.push('contributions.signInSteps declares a factor step, so databaseCompatibility.storageType must be "structured": a step\'s context offers structured storage only');
|
|
137
|
+
}
|
|
138
|
+
return problems;
|
|
139
|
+
}
|
|
140
|
+
/** A label map whose every text also passes isProviderText (no hidden character), checked after its length. */
|
|
141
|
+
function stepText(max) {
|
|
142
|
+
return labelMapSchema({ max, trim: true }).refine((map) => Object.values(map).every((text) => typeof text === "string" && isProviderText(text, max)), { message: "a text holds a control, direction or other hidden character" });
|
|
143
|
+
}
|
|
144
|
+
const fieldId = z.string().refine((id) => isSignInStepFieldId(id), { message: `a field id is 1 to ${SIGN_IN_STEP_FIELD_ID_MAX} lower-case letters, digits and "-"` });
|
|
145
|
+
export const SignInStepCodeFieldSchema = z
|
|
146
|
+
.object({ type: z.literal("code"), id: fieldId, label: stepText(SIGN_IN_STEP_LABEL_MAX), digits: z.number().int().min(SIGN_IN_STEP_CODE_DIGITS_MIN).max(SIGN_IN_STEP_CODE_DIGITS_MAX) })
|
|
147
|
+
.strict();
|
|
148
|
+
export const SignInStepTextFieldSchema = z
|
|
149
|
+
.object({ type: z.literal("text"), id: fieldId, label: stepText(SIGN_IN_STEP_LABEL_MAX), max: z.number().int().min(1).max(SIGN_IN_STEP_TEXT_MAX) })
|
|
150
|
+
.strict();
|
|
151
|
+
export const SignInStepFieldSchema = z.discriminatedUnion("type", [SignInStepCodeFieldSchema, SignInStepTextFieldSchema]);
|
|
152
|
+
const fieldsSchema = z
|
|
153
|
+
.array(SignInStepFieldSchema)
|
|
154
|
+
.min(1)
|
|
155
|
+
.max(SIGN_IN_STEP_FIELDS_MAX)
|
|
156
|
+
.refine((fields) => new Set(fields.map((field) => field.id)).size === fields.length, { message: "a field id is used twice" });
|
|
157
|
+
export const SignInStepSetupKeySchema = z
|
|
158
|
+
.object({
|
|
159
|
+
secret: z.string().refine((secret) => isBase32Secret(secret), { message: "the key is 16 to 128 base32 characters" }),
|
|
160
|
+
algorithm: z.enum(["SHA1", "SHA256", "SHA512"]),
|
|
161
|
+
digits: z.union([z.literal(6), z.literal(8)]),
|
|
162
|
+
period: z.union([z.literal(30), z.literal(60)]),
|
|
163
|
+
})
|
|
164
|
+
.strict();
|
|
165
|
+
const keepCodesSchema = z.array(z.string().refine((code) => isKeepCode(code))).min(1).max(SIGN_IN_STEP_KEEP_CODES_MAX);
|
|
166
|
+
/** D6: what the browser draws. `setupKey`, `otpauthUri` and `keepCodes` only on a setup, to the browser that holds it. */
|
|
167
|
+
export const SignInStepDrawableSchema = z
|
|
168
|
+
.object({
|
|
169
|
+
lead: z.array(stepText(SIGN_IN_STEP_LEAD_TEXT_MAX)).max(SIGN_IN_STEP_LEAD_MAX).optional(),
|
|
170
|
+
fields: fieldsSchema,
|
|
171
|
+
alternate: z.object({ label: stepText(SIGN_IN_STEP_LABEL_MAX), fields: fieldsSchema }).strict().optional(),
|
|
172
|
+
submitLabel: stepText(SIGN_IN_STEP_LABEL_MAX).optional(),
|
|
173
|
+
setupKey: SignInStepSetupKeySchema.optional(),
|
|
174
|
+
otpauthUri: z.string().max(SIGN_IN_STEP_OTPAUTH_MAX).optional(),
|
|
175
|
+
keepCodes: keepCodesSchema.optional(),
|
|
176
|
+
})
|
|
177
|
+
.strict();
|
|
178
|
+
/** D6: a plugin's challenge (`challenge` or `setupBegin`). `state` is opaque, sealed by the core, never sent to the browser. */
|
|
179
|
+
export const SignInStepChallengeSchema = z
|
|
180
|
+
.object({
|
|
181
|
+
lead: SignInStepDrawableSchema.shape.lead,
|
|
182
|
+
fields: fieldsSchema,
|
|
183
|
+
alternate: SignInStepDrawableSchema.shape.alternate,
|
|
184
|
+
submitLabel: SignInStepDrawableSchema.shape.submitLabel,
|
|
185
|
+
setupKey: SignInStepSetupKeySchema.optional(),
|
|
186
|
+
keepCodes: keepCodesSchema.optional(),
|
|
187
|
+
state: z
|
|
188
|
+
.string()
|
|
189
|
+
.max(SIGN_IN_STEP_STATE_MAX_BYTES)
|
|
190
|
+
.refine((state) => new TextEncoder().encode(state).length <= SIGN_IN_STEP_STATE_MAX_BYTES, { message: `state is at most ${SIGN_IN_STEP_STATE_MAX_BYTES} bytes` })
|
|
191
|
+
.optional(),
|
|
192
|
+
})
|
|
193
|
+
.strict();
|
|
194
|
+
/** Past this many items or keys an object is not walked; every limit above is far below it. */
|
|
195
|
+
const COPY_ITEMS_MAX = 32;
|
|
196
|
+
/**
|
|
197
|
+
* The deepest part is an alternate field's label: root 0, `alternate` 1, `fields` 2, a field 3, its
|
|
198
|
+
* `label` 4, a label's string 5. Anything past 6 levels is out of shape; 6 leaves one level of headroom.
|
|
199
|
+
*/
|
|
200
|
+
const COPY_DEPTH_MAX = 6;
|
|
201
|
+
/** A plain copy of a plugin's answer: each property read once, lists and objects past COPY_ITEMS_MAX marked too long. */
|
|
202
|
+
function copyPlain(value, depth) {
|
|
203
|
+
if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean")
|
|
204
|
+
return value;
|
|
205
|
+
if (depth >= COPY_DEPTH_MAX)
|
|
206
|
+
return undefined;
|
|
207
|
+
if (Array.isArray(value)) {
|
|
208
|
+
const length = value.length;
|
|
209
|
+
const out = [];
|
|
210
|
+
for (let i = 0; i < Math.min(length, COPY_ITEMS_MAX); i++)
|
|
211
|
+
out.push(copyPlain(value[i], depth + 1));
|
|
212
|
+
if (length > COPY_ITEMS_MAX)
|
|
213
|
+
out.push(undefined);
|
|
214
|
+
return out;
|
|
215
|
+
}
|
|
216
|
+
if (typeof value === "object") {
|
|
217
|
+
const out = {};
|
|
218
|
+
let count = 0;
|
|
219
|
+
for (const key of Object.keys(value)) {
|
|
220
|
+
if (++count > COPY_ITEMS_MAX) {
|
|
221
|
+
out.__tooMany = true;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
out[key] = copyPlain(value[key], depth + 1);
|
|
225
|
+
}
|
|
226
|
+
return out;
|
|
227
|
+
}
|
|
228
|
+
return undefined;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* copyPlain behind one catch: a getter that throws or a Proxy trap that throws makes the answer out of
|
|
232
|
+
* shape (undefined, which every schema below refuses), never an error that escapes the reader (D10:
|
|
233
|
+
* a throw or an answer out of shape is decided by the step's failure rule).
|
|
234
|
+
*/
|
|
235
|
+
function copyAnswer(raw) {
|
|
236
|
+
try {
|
|
237
|
+
return copyPlain(raw, 0);
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* D6: a plugin's challenge as the core keeps it, or null when it is out of shape: the drawable half
|
|
245
|
+
* (at most SIGN_IN_STEP_KEPT_MAX_BYTES as JSON) and the secret half. `form` "challenge" refuses the
|
|
246
|
+
* setup parts. The answer is copied once and the copy is what is checked and kept.
|
|
247
|
+
*/
|
|
248
|
+
export function readSignInStepChallenge(raw, form) {
|
|
249
|
+
const parsed = SignInStepChallengeSchema.safeParse(copyAnswer(raw));
|
|
250
|
+
if (!parsed.success)
|
|
251
|
+
return null;
|
|
252
|
+
const { state, setupKey, keepCodes, ...drawn } = parsed.data;
|
|
253
|
+
if (form === "challenge" && (setupKey !== undefined || keepCodes !== undefined))
|
|
254
|
+
return null;
|
|
255
|
+
const drawable = drawn;
|
|
256
|
+
if (JSON.stringify(drawable).length > SIGN_IN_STEP_KEPT_MAX_BYTES)
|
|
257
|
+
return null;
|
|
258
|
+
return { drawable, secret: { state: state ?? null, setupKey: setupKey ?? null, keepCodes: keepCodes ?? null } };
|
|
259
|
+
}
|
|
260
|
+
/** D6: a status answer of a kind, or null when out of shape (read once). */
|
|
261
|
+
export function readSignInStepStatus(raw, kind) {
|
|
262
|
+
const state = recordOf(copyAnswer(raw))?.state;
|
|
263
|
+
if (kind === "factor" && (state === "setUp" || state === "notSetUp"))
|
|
264
|
+
return state;
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
export const SignInStepVerdictSchema = z.union([
|
|
268
|
+
z.object({ ok: z.literal(true) }).strict(),
|
|
269
|
+
z.object({ ok: z.literal(false), tell: z.enum(SIGN_IN_STEP_TELLS).optional() }).strict(),
|
|
270
|
+
]);
|
|
271
|
+
/** D6: a verify or setupFinish answer, or null when out of shape. */
|
|
272
|
+
export function readSignInStepVerdict(raw) {
|
|
273
|
+
const parsed = SignInStepVerdictSchema.safeParse(copyAnswer(raw));
|
|
274
|
+
return parsed.success ? parsed.data : null;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* D6: the core's check of an answer against the kept challenge, before any plugin call: exactly the
|
|
278
|
+
* chosen part's field ids, a code exactly `digits` ASCII digits, a text 1 to `max` characters with no
|
|
279
|
+
* hidden character. Null when it passes, else "wrong" (counted, and the plugin never sees it).
|
|
280
|
+
*/
|
|
281
|
+
export function signInStepAnswerProblem(drawable, part, answer) {
|
|
282
|
+
const fields = part === "main" ? drawable.fields : drawable.alternate?.fields;
|
|
283
|
+
if (fields === undefined)
|
|
284
|
+
return "wrong";
|
|
285
|
+
if (Object.keys(answer).length !== fields.length)
|
|
286
|
+
return "wrong";
|
|
287
|
+
for (const field of fields) {
|
|
288
|
+
if (!Object.hasOwn(answer, field.id))
|
|
289
|
+
return "wrong";
|
|
290
|
+
const value = answer[field.id];
|
|
291
|
+
if (typeof value !== "string")
|
|
292
|
+
return "wrong";
|
|
293
|
+
if (field.type === "code") {
|
|
294
|
+
if (value.length !== field.digits)
|
|
295
|
+
return "wrong";
|
|
296
|
+
for (let i = 0; i < value.length; i++) {
|
|
297
|
+
const c = value.charCodeAt(i);
|
|
298
|
+
if (c < 48 || c > 57)
|
|
299
|
+
return "wrong";
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
else if (!isProviderText(value, field.max)) {
|
|
303
|
+
return "wrong";
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
/** D6: the otpauth address the core builds for a setup's QR code; the plugin never learns the issuer or the email. */
|
|
309
|
+
export function otpAuthUri(input) {
|
|
310
|
+
const issuer = encodeURIComponent(input.issuer);
|
|
311
|
+
const { secret, algorithm, digits, period } = input.setupKey;
|
|
312
|
+
return `otpauth://totp/${issuer}:${encodeURIComponent(input.account)}?secret=${secret}&issuer=${issuer}&algorithm=${algorithm}&digits=${digits}&period=${period}`;
|
|
313
|
+
}
|
|
314
|
+
/** D5: what a step learns. A union keyed on `audience`; only the admin branch exists (D14). */
|
|
315
|
+
export const SignInStepPersonSchema = z.discriminatedUnion("audience", [
|
|
316
|
+
z
|
|
317
|
+
.object({
|
|
318
|
+
audience: z.literal("admin"),
|
|
319
|
+
userId: z.string(),
|
|
320
|
+
roleId: z.string(),
|
|
321
|
+
method: z.enum(["password", "provider"]),
|
|
322
|
+
provider: z.string().nullable(),
|
|
323
|
+
culture: z.string(),
|
|
324
|
+
})
|
|
325
|
+
.strict(),
|
|
326
|
+
]);
|
|
327
|
+
export const SignInStepStatusSchema = z.object({ state: z.enum(SIGN_IN_STEP_STATES) });
|
|
328
|
+
export const SignInStepAnswerInputSchema = z.object({
|
|
329
|
+
part: z.enum(SIGN_IN_STEP_PARTS),
|
|
330
|
+
answer: z.record(z.string(), z.string()).readonly(),
|
|
331
|
+
state: z.string().nullable(),
|
|
332
|
+
});
|
|
333
|
+
const stepKey = z.string().min(1).max(SIGN_IN_STEP_KEY_MAX);
|
|
334
|
+
const answerRecord = z
|
|
335
|
+
.record(z.string().max(SIGN_IN_STEP_FIELD_ID_MAX), z.string().max(SIGN_IN_STEP_ANSWER_VALUE_MAX))
|
|
336
|
+
.refine((answer) => Object.keys(answer).length <= SIGN_IN_STEP_FIELDS_MAX, { message: `an answer holds at most ${SIGN_IN_STEP_FIELDS_MAX} fields` });
|
|
337
|
+
/** D4: the step to draw (`GET /api/auth/steps/current`, the 202 of a login, `choose`). */
|
|
338
|
+
export const SignInStepPendingSchema = z.object({
|
|
339
|
+
key: stepKey,
|
|
340
|
+
label: PluginLabelSchema,
|
|
341
|
+
description: PluginLabelSchema.optional(),
|
|
342
|
+
kind: z.enum(SIGN_IN_STEP_KINDS),
|
|
343
|
+
form: z.enum(SIGN_IN_STEP_FORMS),
|
|
344
|
+
challenge: SignInStepDrawableSchema,
|
|
345
|
+
others: z.array(z.object({ key: stepKey, label: PluginLabelSchema })).max(SIGN_IN_STEPS_ON_MAX),
|
|
346
|
+
attemptsLeft: z.number().int().min(0).max(SIGN_IN_PENDING_WRONG_MAX),
|
|
347
|
+
expiresAt: z.string().datetime(),
|
|
348
|
+
});
|
|
349
|
+
export const LoginStepResponseSchema = z.object({ step: SignInStepPendingSchema });
|
|
350
|
+
export const SignInStepAnswerRequestSchema = z.object({ key: stepKey, form: z.literal("challenge"), part: z.enum(SIGN_IN_STEP_PARTS), answer: answerRecord }).strict();
|
|
351
|
+
export const SignInStepChooseRequestSchema = z.object({ key: stepKey }).strict();
|
|
352
|
+
/** D4: the last step passed: the login body and the admin path to land on. */
|
|
353
|
+
export const SignInStepCompletedResponseSchema = LoginResponseSchema.extend({ returnTo: z.string().max(600) });
|
|
354
|
+
export const SignInStepErrorSchema = z.object({
|
|
355
|
+
code: z.enum(SIGN_IN_STEP_ERROR_CODES),
|
|
356
|
+
message: z.string(),
|
|
357
|
+
attemptsLeft: z.number().int().min(0).optional(),
|
|
358
|
+
});
|
|
359
|
+
/** D7: one step's settings, one `signInStep.<key>` row. A missing or damaged row reads as the defaults (off). */
|
|
360
|
+
export const SignInStepSettingsSchema = z
|
|
361
|
+
.object({ enabled: z.boolean(), who: z.enum(SIGN_IN_STEP_WHO).default("setUp"), onFailure: z.enum(SIGN_IN_STEP_FAILURE_RULES) })
|
|
362
|
+
.strict();
|
|
363
|
+
export const DEFAULT_SIGN_IN_STEP_SETTINGS = Object.freeze({ enabled: false, who: "setUp", onFailure: "refuse" });
|
|
364
|
+
export function signInStepSettingsKey(stepKey) {
|
|
365
|
+
return `signInStep.${stepKey}`;
|
|
366
|
+
}
|
|
367
|
+
/** D7.1: every write carries the person's password. */
|
|
368
|
+
export const UpdateSignInStepRequestSchema = SignInStepSettingsSchema.extend({ password: z.string().min(1).max(SIGN_IN_LINK_PASSWORD_MAX) }).strict();
|
|
369
|
+
export const SignInStepParamsSchema = z.object({ pluginId: z.string().min(1).max(PLUGIN_ID_MAX), stepId: z.string().min(1).max(PROVIDER_ID_MAX) });
|
|
370
|
+
export const SignInStepStateSchema = z.object({
|
|
371
|
+
key: stepKey,
|
|
372
|
+
pluginId: z.string(),
|
|
373
|
+
stepId: z.string(),
|
|
374
|
+
label: PluginLabelSchema,
|
|
375
|
+
description: PluginLabelSchema.optional(),
|
|
376
|
+
kind: z.enum(SIGN_IN_STEP_KINDS),
|
|
377
|
+
settings: SignInStepSettingsSchema,
|
|
378
|
+
/** Attached, its plugin enabled and not demoted. */
|
|
379
|
+
served: z.boolean(),
|
|
380
|
+
/** The plugin's licence has lapsed: setup answers 503 (D8). */
|
|
381
|
+
readOnly: z.boolean(),
|
|
382
|
+
/** People with a live record for this step. */
|
|
383
|
+
setUpCount: z.number().int().nonnegative(),
|
|
384
|
+
});
|
|
385
|
+
export const SignInStepsResponseSchema = z.object({ steps: z.array(SignInStepStateSchema), serverSwitch: z.boolean(), switchedOnMax: z.number().int() });
|
|
386
|
+
/** D7.1, D8: a password a route refused, by code (a 403, never a 401). */
|
|
387
|
+
/** `sign_in_again`: a person without a password whose session is older than SIGN_IN_STEP_FRESH_SESSION_MS (D8). */
|
|
388
|
+
export const SignInStepPasswordRefusedSchema = z.object({ code: z.enum(["wrong_password", "account_refused", "sign_in_again"]), message: z.string() });
|
|
389
|
+
export const SignInStepConflictSchema = z.object({ code: z.enum(["already_set_up", "not_switched_on", "too_many_on"]), message: z.string() });
|
|
390
|
+
/** D8: the person's own steps on Account, Sign-in methods. */
|
|
391
|
+
export const MySignInStepSchema = z.object({
|
|
392
|
+
key: stepKey,
|
|
393
|
+
label: PluginLabelSchema,
|
|
394
|
+
description: PluginLabelSchema.optional(),
|
|
395
|
+
setUp: z.boolean(),
|
|
396
|
+
setUpAt: z.string().datetime().nullable(),
|
|
397
|
+
served: z.boolean(),
|
|
398
|
+
/** False for a step the person still holds a record for after the owner switched it off: listed so they can remove it. */
|
|
399
|
+
switchedOn: z.boolean(),
|
|
400
|
+
});
|
|
401
|
+
export const MySignInStepsResponseSchema = z.object({ steps: z.array(MySignInStepSchema), passwordSet: z.boolean() });
|
|
402
|
+
export const SignInStepSetupRequestSchema = z.object({ password: z.string().min(1).max(SIGN_IN_LINK_PASSWORD_MAX).optional() }).strict();
|
|
403
|
+
export const SignInStepSetupResponseSchema = z.object({
|
|
404
|
+
setup: z.object({ key: stepKey, label: PluginLabelSchema, challenge: SignInStepDrawableSchema, expiresAt: z.string().datetime() }),
|
|
405
|
+
});
|
|
406
|
+
export const SignInStepSetupFinishRequestSchema = z.object({ part: z.literal("main"), answer: answerRecord }).strict();
|
|
407
|
+
export const SignInStepSetupFinishResponseSchema = z.object({ done: z.literal(true), sessionsEnded: z.number().int().nonnegative() });
|
|
408
|
+
export const SignInStepRemoveRequestSchema = SignInStepSetupRequestSchema;
|
|
@@ -130,7 +130,7 @@ export declare function isSignInDisplayName(value: unknown): value is string;
|
|
|
130
130
|
*/
|
|
131
131
|
export declare function signInDeclarationProblems(entry: Record<string, unknown>, declaredSecretNames: ReadonlySet<string>, where: string): string[];
|
|
132
132
|
/** D46: the codes a failed provider sign-in returns to the admin with, as `signInError`. */
|
|
133
|
-
export declare const SIGN_IN_ERROR_CODES: readonly ["unavailable", "expired", "refused", "failed", "not_linked", "email_unverified", "domain_not_allowed", "email_taken", "new_accounts_unavailable", "account_refused", "relink_required", "domain_not_hosted", "password_required"];
|
|
133
|
+
export declare const SIGN_IN_ERROR_CODES: readonly ["unavailable", "expired", "refused", "failed", "not_linked", "email_unverified", "domain_not_allowed", "email_taken", "new_accounts_unavailable", "account_refused", "relink_required", "domain_not_hosted", "password_required", "step_unavailable"];
|
|
134
134
|
export type SignInErrorCode = (typeof SIGN_IN_ERROR_CODES)[number];
|
|
135
135
|
/** D46: the codes a link attempt returns to Sign-in methods with, as `linkResult`. */
|
|
136
136
|
export declare const SIGN_IN_LINK_RESULTS: readonly ["linked", "already_linked", "linked_elsewhere", "link_failed", "expired", "unavailable", "refused", "failed", "account_refused"];
|
|
@@ -229,8 +229,8 @@ export declare const SignInProviderStateSchema: z.ZodObject<{
|
|
|
229
229
|
}, z.core.$strict>;
|
|
230
230
|
offered: z.ZodBoolean;
|
|
231
231
|
reasons: z.ZodArray<z.ZodEnum<{
|
|
232
|
-
plugin_off: "plugin_off";
|
|
233
232
|
demoted: "demoted";
|
|
233
|
+
plugin_off: "plugin_off";
|
|
234
234
|
switched_off: "switched_off";
|
|
235
235
|
secrets_missing: "secrets_missing";
|
|
236
236
|
public_url_missing: "public_url_missing";
|
|
@@ -280,8 +280,8 @@ export declare const SignInProvidersResponseSchema: z.ZodObject<{
|
|
|
280
280
|
}, z.core.$strict>;
|
|
281
281
|
offered: z.ZodBoolean;
|
|
282
282
|
reasons: z.ZodArray<z.ZodEnum<{
|
|
283
|
-
plugin_off: "plugin_off";
|
|
284
283
|
demoted: "demoted";
|
|
284
|
+
plugin_off: "plugin_off";
|
|
285
285
|
switched_off: "switched_off";
|
|
286
286
|
secrets_missing: "secrets_missing";
|
|
287
287
|
public_url_missing: "public_url_missing";
|
|
@@ -327,6 +327,8 @@ export declare const UpdateSignInProviderRequestSchema: z.ZodObject<{
|
|
|
327
327
|
displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
328
328
|
}, z.core.$strict>;
|
|
329
329
|
export type UpdateSignInProviderRequest = SignInProviderSettings;
|
|
330
|
+
/** D37: the most characters a link request's password may hold (bcrypt reads it and nothing else). */
|
|
331
|
+
export declare const SIGN_IN_LINK_PASSWORD_MAX = 1024;
|
|
330
332
|
/** D37: a link from a session confirms the person's password first. */
|
|
331
333
|
export declare const SignInLinkRequestSchema: z.ZodObject<{
|
|
332
334
|
password: z.ZodString;
|
|
@@ -408,6 +408,8 @@ export const SIGN_IN_ERROR_CODES = [
|
|
|
408
408
|
"domain_not_hosted",
|
|
409
409
|
// M33 K61: an account without a password whose role holds a barred action.
|
|
410
410
|
"password_required",
|
|
411
|
+
// M35 U3a (D4, D10): a step that could not be checked, or a factor the plugin lost.
|
|
412
|
+
"step_unavailable",
|
|
411
413
|
];
|
|
412
414
|
/** D46: the codes a link attempt returns to Sign-in methods with, as `linkResult`. */
|
|
413
415
|
export const SIGN_IN_LINK_RESULTS = [
|
|
@@ -568,7 +570,7 @@ export const SignInProviderParamsSchema = z.object({
|
|
|
568
570
|
/** D50: the body of `PUT /api/manage/v1/sign-in/providers/:pluginId/:providerId`. */
|
|
569
571
|
export const UpdateSignInProviderRequestSchema = SignInProviderSettingsSchema;
|
|
570
572
|
/** D37: the most characters a link request's password may hold (bcrypt reads it and nothing else). */
|
|
571
|
-
const SIGN_IN_LINK_PASSWORD_MAX = 1024;
|
|
573
|
+
export const SIGN_IN_LINK_PASSWORD_MAX = 1024;
|
|
572
574
|
/** D37: a link from a session confirms the person's password first. */
|
|
573
575
|
export const SignInLinkRequestSchema = z.strictObject({
|
|
574
576
|
password: z.string().min(1).max(SIGN_IN_LINK_PASSWORD_MAX),
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** P5-D2: the categories a gated entry, a held embed or a tool names; an entry with none is strictly necessary. The
|
|
2
|
+
* list only grows. */
|
|
3
|
+
export declare const CONSENT_CATEGORIES: readonly ["preferences", "statistics", "marketing", "media"];
|
|
4
|
+
export type ConsentCategory = (typeof CONSENT_CATEGORIES)[number];
|
|
5
|
+
/** P5-D3: the cookie on a plain http page, and on an https page. The `__Host-` prefix makes the browser refuse one set
|
|
6
|
+
* with a Domain or from http, so a sibling subdomain cannot plant a choice (the visitor cookie's rule, visitor-cookie.ts). */
|
|
7
|
+
export declare const CONSENT_COOKIE_NAME = "kardalum_consent";
|
|
8
|
+
export declare const CONSENT_COOKIE_SECURE_NAME = "__Host-kardalum_consent";
|
|
9
|
+
export declare function consentCookieName(secure: boolean): string;
|
|
10
|
+
export declare const CONSENT_FORMAT_VERSION = "v1";
|
|
11
|
+
/** The longest value the reader reads. Today's longest, "v1.9999.999999.preferences.statistics.marketing.media", is 53
|
|
12
|
+
* characters; the room lets an older copy of this reader read the value of a longer list. */
|
|
13
|
+
export declare const CONSENT_COOKIE_VALUE_MAX = 128;
|
|
14
|
+
/** The longest category token the reader accepts; a well-formed token it does not know is skipped (the list grows). */
|
|
15
|
+
export declare const CONSENT_CATEGORY_TOKEN_MAX = 20;
|
|
16
|
+
/** One cap for every Cookie header the core reads: longer reads as no cookie (the consent reader here, and visitors/visitor-cookie.ts, which imports it since 35-P5). */
|
|
17
|
+
export declare const COOKIE_HEADER_MAX = 16384;
|
|
18
|
+
export declare const CONSENT_REVISION_MAX = 9999;
|
|
19
|
+
/** P5-D3: how long a choice is kept when the tool names no lifetime, and the longest it may name. */
|
|
20
|
+
export declare const CONSENT_MAX_AGE_DAYS_DEFAULT = 180;
|
|
21
|
+
export declare const CONSENT_MAX_AGE_DAYS_MAX = 395;
|
|
22
|
+
/** The consent loader's largest size, in bytes. */
|
|
23
|
+
export declare const CONSENT_LOADER_MAX_BYTES = 8192;
|
|
24
|
+
/** P5-D5: how long a render reuses the tool choice it read. */
|
|
25
|
+
export declare const CONSENT_TOOL_MEMO_MS = 1000;
|
|
26
|
+
/** P5-D4: the event every change of the state dispatches on `document`, and the one that asks the tool to open. */
|
|
27
|
+
export declare const CONSENT_EVENT = "kardalum:consent";
|
|
28
|
+
export declare const CONSENT_OPEN_EVENT = "kardalum:consentopen";
|
|
29
|
+
/** P5-D6, P5-D4: the attribute an inert script carries, and the one a theme's "settings" link carries. */
|
|
30
|
+
export declare const CONSENT_MARK_ATTRIBUTE = "data-kardalum-consent";
|
|
31
|
+
export declare const CONSENT_OPEN_ATTRIBUTE = "data-kardalum-consent-open";
|
|
32
|
+
/** P5-D9: the mark on the loader's own tag while a consent tool is chosen and active; unmarked, the loader grants nothing. */
|
|
33
|
+
export declare const CONSENT_TOOL_ATTRIBUTE = "data-kardalum-consent-tool";
|
|
34
|
+
/** P5-D6: the core's own `data-` prefix, which a plugin's head entry may not use. */
|
|
35
|
+
export declare const CORE_DATA_PREFIX = "kardalum-";
|
|
36
|
+
/** A visitor's consent. `decided` false: no valid cookie (nothing granted). `decidedOn` is the day of the choice, `YYYY-MM-DD`. */
|
|
37
|
+
export interface ConsentState {
|
|
38
|
+
readonly decided: boolean;
|
|
39
|
+
readonly granted: readonly ConsentCategory[];
|
|
40
|
+
readonly revision: number | null;
|
|
41
|
+
readonly decidedOn: string | null;
|
|
42
|
+
}
|
|
43
|
+
export declare const UNDECIDED_CONSENT: ConsentState;
|
|
44
|
+
/** What a tool hands `window.kardalum.consent.set`. */
|
|
45
|
+
export interface ConsentChoice {
|
|
46
|
+
granted: readonly ConsentCategory[];
|
|
47
|
+
/** The tool's revision of its own text, 0 to CONSENT_REVISION_MAX; 0 when left out. */
|
|
48
|
+
revision?: number;
|
|
49
|
+
/** 1 to CONSENT_MAX_AGE_DAYS_MAX; CONSENT_MAX_AGE_DAYS_DEFAULT when left out. */
|
|
50
|
+
maxAgeDays?: number;
|
|
51
|
+
}
|
|
52
|
+
/** P5-D4: `window.kardalum.consent` in a visitor's browser, defined by the core's consent loader. */
|
|
53
|
+
export interface KardalumConsentApi {
|
|
54
|
+
readonly categories: readonly ConsentCategory[];
|
|
55
|
+
state(): ConsentState;
|
|
56
|
+
granted(category: ConsentCategory): boolean;
|
|
57
|
+
/** For the chosen consent tool only. Throws TypeError on a bad choice. */
|
|
58
|
+
set(choice: ConsentChoice): ConsentState;
|
|
59
|
+
/** For the chosen consent tool only: forgets the choice (undecided again). */
|
|
60
|
+
reset(): void;
|
|
61
|
+
/** Asks the chosen tool to show its settings (dispatches CONSENT_OPEN_EVENT). */
|
|
62
|
+
open(): void;
|
|
63
|
+
}
|
|
64
|
+
/** P5-D10: the consent a page head or a template call reads; reading it makes the render answer for this cookie alone. */
|
|
65
|
+
export interface PluginConsentView {
|
|
66
|
+
readonly decided: boolean;
|
|
67
|
+
readonly granted: readonly ConsentCategory[];
|
|
68
|
+
has(category: ConsentCategory): boolean;
|
|
69
|
+
}
|
|
70
|
+
export declare function isConsentCategory(value: unknown): value is ConsentCategory;
|
|
71
|
+
/** P5-D3: a cookie value as a decided state, or null for anything the format does not allow. */
|
|
72
|
+
export declare function readConsentCookieValue(value: unknown): ConsentState | null;
|
|
73
|
+
/** P5-D3: the state the first consent cookie of a Cookie header holds, by the name of the page's scheme, or null. A
|
|
74
|
+
* split and a trim. */
|
|
75
|
+
export declare function readConsentCookie(header: unknown, secure: boolean): ConsentState | null;
|
|
76
|
+
/** The state of a Cookie header, undecided where it holds no valid choice. The SDK's `readConsent` wraps it. */
|
|
77
|
+
export declare function consentOfCookieHeader(header: unknown, secure: boolean): ConsentState;
|