@wildo-ai/platform-config-lib 1.1.10 → 1.1.12
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/dist/esm/_unimplemented/soft-warn.d.ts +24 -49
- package/dist/esm/_unimplemented/soft-warn.d.ts.map +1 -1
- package/dist/esm/_unimplemented/soft-warn.js +24 -49
- package/dist/esm/_unimplemented/soft-warn.js.map +1 -1
- package/dist/esm/blueprint/anchored-region.d.ts +83 -0
- package/dist/esm/blueprint/anchored-region.d.ts.map +1 -0
- package/dist/esm/blueprint/anchored-region.js +263 -0
- package/dist/esm/blueprint/anchored-region.js.map +1 -0
- package/dist/esm/blueprint/blueprint.schemas.d.ts +600 -0
- package/dist/esm/blueprint/blueprint.schemas.d.ts.map +1 -0
- package/dist/esm/blueprint/blueprint.schemas.js +638 -0
- package/dist/esm/blueprint/blueprint.schemas.js.map +1 -0
- package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts +13 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.js +6 -0
- package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts +29 -4
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.js +29 -4
- package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +131 -2
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js +139 -2
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/platform-store-preconnect.d.ts +21 -0
- package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-store-preconnect.js +25 -0
- package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -1
- package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts +80 -0
- package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts.map +1 -0
- package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js +81 -0
- package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js.map +1 -0
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +41 -9
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.js +77 -28
- package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
- package/dist/esm/bootstrap/runtime-network-policy.d.ts +117 -12
- package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-policy.js +222 -23
- package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.d.ts +31 -4
- package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.js +43 -2
- package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
- package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -1
- package/dist/esm/bootstrap/runtime-principal.contracts.d.ts +40 -2
- package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-principal.contracts.js +66 -3
- package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -1
- package/dist/esm/bootstrap/runtime-response-integrity.d.ts +249 -0
- package/dist/esm/bootstrap/runtime-response-integrity.d.ts.map +1 -0
- package/dist/esm/bootstrap/runtime-response-integrity.js +353 -0
- package/dist/esm/bootstrap/runtime-response-integrity.js.map +1 -0
- package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts +32 -0
- package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts.map +1 -0
- package/dist/esm/bootstrap/runtime-secret-env.contracts.js +43 -0
- package/dist/esm/bootstrap/runtime-secret-env.contracts.js.map +1 -0
- package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
- package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts +51 -0
- package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts.map +1 -0
- package/dist/esm/canonical-json/rfc8785-canonical-json.js +231 -0
- package/dist/esm/canonical-json/rfc8785-canonical-json.js.map +1 -0
- package/dist/esm/config-authoring.entry.js.map +1 -1
- package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
- package/dist/esm/credentials/credential-generator.service.js.map +1 -1
- package/dist/esm/index.d.ts +20 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +20 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts +119 -0
- package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/application-legacy-envelope-key.contracts.js +109 -0
- package/dist/esm/key-management/application-legacy-envelope-key.contracts.js.map +1 -0
- package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts +182 -0
- package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/application-signing-key-rotation.contracts.js +145 -0
- package/dist/esm/key-management/application-signing-key-rotation.contracts.js.map +1 -0
- package/dist/esm/key-management/approval-seal-manifested-copy.d.ts +156 -0
- package/dist/esm/key-management/approval-seal-manifested-copy.d.ts.map +1 -0
- package/dist/esm/key-management/approval-seal-manifested-copy.js +617 -0
- package/dist/esm/key-management/approval-seal-manifested-copy.js.map +1 -0
- package/dist/esm/key-management/approval-seal-verifier.d.ts +278 -0
- package/dist/esm/key-management/approval-seal-verifier.d.ts.map +1 -0
- package/dist/esm/key-management/approval-seal-verifier.js +355 -0
- package/dist/esm/key-management/approval-seal-verifier.js.map +1 -0
- package/dist/esm/key-management/approval-seal.contracts.d.ts +128 -0
- package/dist/esm/key-management/approval-seal.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/approval-seal.contracts.js +135 -0
- package/dist/esm/key-management/approval-seal.contracts.js.map +1 -0
- package/dist/esm/key-management/data-key.contracts.d.ts +106 -0
- package/dist/esm/key-management/data-key.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/data-key.contracts.js +54 -0
- package/dist/esm/key-management/data-key.contracts.js.map +1 -0
- package/dist/esm/key-management/es256-jws.d.ts +60 -0
- package/dist/esm/key-management/es256-jws.d.ts.map +1 -0
- package/dist/esm/key-management/es256-jws.js +135 -0
- package/dist/esm/key-management/es256-jws.js.map +1 -0
- package/dist/esm/key-management/key-provider.spi.d.ts +158 -0
- package/dist/esm/key-management/key-provider.spi.d.ts.map +1 -0
- package/dist/esm/key-management/key-provider.spi.js +38 -0
- package/dist/esm/key-management/key-provider.spi.js.map +1 -0
- package/dist/esm/key-management/keyring-rotation.contracts.d.ts +83 -0
- package/dist/esm/key-management/keyring-rotation.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/keyring-rotation.contracts.js +101 -0
- package/dist/esm/key-management/keyring-rotation.contracts.js.map +1 -0
- package/dist/esm/key-management/keyring-status.contracts.d.ts +59 -0
- package/dist/esm/key-management/keyring-status.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/keyring-status.contracts.js +45 -0
- package/dist/esm/key-management/keyring-status.contracts.js.map +1 -0
- package/dist/esm/key-management/pdf-incremental-update.d.ts +158 -0
- package/dist/esm/key-management/pdf-incremental-update.d.ts.map +1 -0
- package/dist/esm/key-management/pdf-incremental-update.js +730 -0
- package/dist/esm/key-management/pdf-incremental-update.js.map +1 -0
- package/dist/esm/key-management/pdf-truetype-font.d.ts +35 -0
- package/dist/esm/key-management/pdf-truetype-font.d.ts.map +1 -0
- package/dist/esm/key-management/pdf-truetype-font.js +152 -0
- package/dist/esm/key-management/pdf-truetype-font.js.map +1 -0
- package/dist/esm/key-management/qr-code.d.ts +38 -0
- package/dist/esm/key-management/qr-code.d.ts.map +1 -0
- package/dist/esm/key-management/qr-code.js +325 -0
- package/dist/esm/key-management/qr-code.js.map +1 -0
- package/dist/esm/key-management/signature-request.contracts.d.ts +91 -0
- package/dist/esm/key-management/signature-request.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/signature-request.contracts.js +96 -0
- package/dist/esm/key-management/signature-request.contracts.js.map +1 -0
- package/dist/esm/key-management/signing-log-export.contracts.d.ts +215 -0
- package/dist/esm/key-management/signing-log-export.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/signing-log-export.contracts.js +268 -0
- package/dist/esm/key-management/signing-log-export.contracts.js.map +1 -0
- package/dist/esm/key-management/vault-custody.contracts.d.ts +98 -0
- package/dist/esm/key-management/vault-custody.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/vault-custody.contracts.js +154 -0
- package/dist/esm/key-management/vault-custody.contracts.js.map +1 -0
- package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -1
- package/dist/esm/lockfile/build-parallelism.js.map +1 -1
- package/dist/esm/lockfile/canonical-json.d.ts +1 -1
- package/dist/esm/lockfile/canonical-json.d.ts.map +1 -1
- package/dist/esm/lockfile/canonical-json.js +1 -1
- package/dist/esm/lockfile/canonical-json.js.map +1 -1
- package/dist/esm/lockfile/file-lock-hold.d.ts.map +1 -1
- package/dist/esm/lockfile/file-lock-hold.js +2 -1
- package/dist/esm/lockfile/file-lock-hold.js.map +1 -1
- package/dist/esm/lockfile/lockfile-io.d.ts +13 -17
- package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
- package/dist/esm/lockfile/lockfile-io.js +29 -30
- package/dist/esm/lockfile/lockfile-io.js.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.d.ts +22 -20
- package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.js +13 -14
- package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +27 -249
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +28 -3
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
- package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts +146 -0
- package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts.map +1 -0
- package/dist/esm/pnpm-settings/application-pnpm-settings.js +573 -0
- package/dist/esm/pnpm-settings/application-pnpm-settings.js.map +1 -0
- package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -1
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js +22 -3
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -1
- package/dist/esm/project-config/application-served-public-documents.loader.d.ts +26 -0
- package/dist/esm/project-config/application-served-public-documents.loader.d.ts.map +1 -0
- package/dist/esm/project-config/application-served-public-documents.loader.js +86 -0
- package/dist/esm/project-config/application-served-public-documents.loader.js.map +1 -0
- package/dist/esm/project-config/backend-compliance-section.reader.d.ts +35 -0
- package/dist/esm/project-config/backend-compliance-section.reader.d.ts.map +1 -0
- package/dist/esm/project-config/backend-compliance-section.reader.js +123 -0
- package/dist/esm/project-config/backend-compliance-section.reader.js.map +1 -0
- package/dist/esm/project-config/backend-compliance-section.worker.d.ts +20 -0
- package/dist/esm/project-config/backend-compliance-section.worker.d.ts.map +1 -0
- package/dist/esm/project-config/backend-compliance-section.worker.js +78 -0
- package/dist/esm/project-config/backend-compliance-section.worker.js.map +1 -0
- package/dist/esm/project-config/config-module-resolution.d.ts +32 -0
- package/dist/esm/project-config/config-module-resolution.d.ts.map +1 -0
- package/dist/esm/project-config/config-module-resolution.js +33 -0
- package/dist/esm/project-config/config-module-resolution.js.map +1 -0
- package/dist/esm/project-config/define-framework-config.js.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.d.ts +344 -69
- package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.js +194 -143
- package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/define-minion-config.d.ts +26 -36
- package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-minion-config.js +64 -25
- package/dist/esm/project-config/define-minion-config.js.map +1 -1
- package/dist/esm/project-config/define-saas-config.d.ts +82 -348
- package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-saas-config.js +262 -103
- package/dist/esm/project-config/define-saas-config.js.map +1 -1
- package/dist/esm/project-config/define-worker-config.d.ts +10 -20
- package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-worker-config.js +10 -12
- package/dist/esm/project-config/define-worker-config.js.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.js +4 -1
- package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/index.d.ts +5 -0
- package/dist/esm/project-config/index.d.ts.map +1 -1
- package/dist/esm/project-config/index.js +5 -0
- package/dist/esm/project-config/index.js.map +1 -1
- package/dist/esm/project-config/loader-instances-zod.d.ts +19 -0
- package/dist/esm/project-config/loader-instances-zod.d.ts.map +1 -0
- package/dist/esm/project-config/loader-instances-zod.js +40 -0
- package/dist/esm/project-config/loader-instances-zod.js.map +1 -0
- package/dist/esm/project-config/loader.d.ts +131 -14
- package/dist/esm/project-config/loader.d.ts.map +1 -1
- package/dist/esm/project-config/loader.js +226 -12
- package/dist/esm/project-config/loader.js.map +1 -1
- package/dist/esm/project-config/minion-liveness.contracts.d.ts +131 -0
- package/dist/esm/project-config/minion-liveness.contracts.d.ts.map +1 -0
- package/dist/esm/project-config/minion-liveness.contracts.js +167 -0
- package/dist/esm/project-config/minion-liveness.contracts.js.map +1 -0
- package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -1
- package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -1
- package/dist/esm/project-config/npm-version-range.d.ts.map +1 -1
- package/dist/esm/project-config/npm-version-range.js +39 -16
- package/dist/esm/project-config/npm-version-range.js.map +1 -1
- package/dist/esm/project-config/owning-package-tsconfig.d.ts +15 -0
- package/dist/esm/project-config/owning-package-tsconfig.d.ts.map +1 -0
- package/dist/esm/project-config/owning-package-tsconfig.js +29 -0
- package/dist/esm/project-config/owning-package-tsconfig.js.map +1 -0
- package/dist/esm/project-config/provider-catalog-types.js.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.d.ts +4 -4
- package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.js +16 -10
- package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts +103 -49
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.js +216 -16
- package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
- package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts +0 -2
- package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.d.ts +0 -17
- package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts +9 -10
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.js +13 -15
- package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/cdn.schemas.d.ts +0 -51
- package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.d.ts +36 -9
- package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.js +54 -11
- package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.d.ts +60 -13
- package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.js +77 -24
- package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.d.ts +72 -85
- package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.js +40 -13
- package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/data-services.schemas.d.ts +0 -8
- package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.d.ts +101 -8
- package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.js +128 -9
- package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +10 -4
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +2 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +4 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +24 -0
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.js +25 -2
- package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
- package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -1
- package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -1
- package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts +276 -0
- package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/platform-key-management.schemas.js +296 -0
- package/dist/esm/project-config/shared/platform-key-management.schemas.js.map +1 -0
- package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +2 -2
- package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/platform-storage.schemas.js +16 -2
- package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/service-definitions.schemas.d.ts +21 -23
- package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/service-definitions.schemas.js +4 -5
- package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +0 -18
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -1
- package/dist/esm/project-config/static-asset-import-noop.d.ts +20 -3
- package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -1
- package/dist/esm/project-config/static-asset-import-noop.js +36 -20
- package/dist/esm/project-config/static-asset-import-noop.js.map +1 -1
- package/dist/esm/registry/artifact-domain.schemas.d.ts +0 -5
- package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
- package/dist/esm/registry/artifact-domain.schemas.js.map +1 -1
- package/dist/esm/registry/digest.schemas.js.map +1 -1
- package/dist/esm/registry/index.d.ts +3 -3
- package/dist/esm/registry/index.d.ts.map +1 -1
- package/dist/esm/registry/index.js +3 -3
- package/dist/esm/registry/index.js.map +1 -1
- package/dist/esm/registry/local-checkout-source.d.ts +22 -2
- package/dist/esm/registry/local-checkout-source.d.ts.map +1 -1
- package/dist/esm/registry/local-checkout-source.js +66 -3
- package/dist/esm/registry/local-checkout-source.js.map +1 -1
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +11 -98
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
- package/dist/esm/registry/lockfile-modules-section.schemas.js +1 -2
- package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.d.ts +40 -17
- package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.d.ts +324 -74
- package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.js +377 -19
- package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
- package/dist/esm/registry/module-search.schemas.d.ts +2 -0
- package/dist/esm/registry/module-search.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-search.schemas.js +14 -1
- package/dist/esm/registry/module-search.schemas.js.map +1 -1
- package/dist/esm/registry/registry-config.schemas.d.ts +0 -18
- package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
- package/dist/esm/registry/registry-config.schemas.js.map +1 -1
- package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -1
- package/dist/esm/registry/registry-defaults.constants.js.map +1 -1
- package/dist/esm/registry/registry-errors.d.ts +103 -5
- package/dist/esm/registry/registry-errors.d.ts.map +1 -1
- package/dist/esm/registry/registry-errors.js +213 -6
- package/dist/esm/registry/registry-errors.js.map +1 -1
- package/dist/esm/registry/registry-keys.schemas.js.map +1 -1
- package/dist/esm/registry/registry-section-schemas.constants.d.ts +5 -0
- package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
- package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -1
- package/dist/esm/registry/registry-url-resolution.d.ts +72 -0
- package/dist/esm/registry/registry-url-resolution.d.ts.map +1 -0
- package/dist/esm/registry/registry-url-resolution.js +157 -0
- package/dist/esm/registry/registry-url-resolution.js.map +1 -0
- package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
- package/dist/esm/release/framework-release.constants.js.map +1 -1
- package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.d.ts +48 -0
- package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.js +53 -0
- package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.d.ts +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-application-secrets.schemas.d.ts +1 -1
- package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-config.schemas.d.ts +2 -2
- package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
- package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -1
- package/dist/esm/workspace-scope/index.js.map +1 -1
- package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
- package/dist/esm/workspace-scope/resolve-homes.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/dist/esm/_unimplemented/index.d.ts +0 -3
- package/dist/esm/_unimplemented/index.d.ts.map +0 -1
- package/dist/esm/_unimplemented/index.js +0 -3
- package/dist/esm/_unimplemented/index.js.map +0 -1
- package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts +0 -137
- package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +0 -1
- package/dist/esm/_unimplemented/unimplemented-field-warning.js +0 -153
- package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +0 -1
- package/dist/esm/project-config/shared/cdn.example.d.ts +0 -14
- package/dist/esm/project-config/shared/cdn.example.d.ts.map +0 -1
- package/dist/esm/project-config/shared/cdn.example.js +0 -38
- package/dist/esm/project-config/shared/cdn.example.js.map +0 -1
- package/dist/esm/project-config/shared/schema-version.schemas.d.ts +0 -15
- package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +0 -1
- package/dist/esm/project-config/shared/schema-version.schemas.js +0 -40
- package/dist/esm/project-config/shared/schema-version.schemas.js.map +0 -1
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # Verifying an approval seal, offline (#2903)
|
|
3
|
+
*
|
|
4
|
+
* Everything a verifier needs travels with the seal: the compact JWS, the stored records of the keys that may have signed
|
|
5
|
+
* it (their public half, scope and issuer, as an export carries them), and, when the person's content is to be shown,
|
|
6
|
+
* the disclosures. Nothing here calls the application or the platform, so a seal verifies after the application is gone.
|
|
7
|
+
*
|
|
8
|
+
* ## What is checked, and on whose authority
|
|
9
|
+
*
|
|
10
|
+
* - The header: ES256 is pinned per key from the key RECORD, never read from the header (RFC 8725 §3.1); `jku`, `x5u`,
|
|
11
|
+
* `jwk` and `x5c` are never followed (RFC 8725 §3.10, RFC 7515 §10.7); a `crit` naming anything is refused, since no
|
|
12
|
+
* extension is understood (RFC 7515 §4.1.11); `typ` must be the approval seal's.
|
|
13
|
+
* - The signature, under the key the `kid` names among those given.
|
|
14
|
+
* - The issuer: the payload's `iss` must be the key record's, and the expected issuer when one is given.
|
|
15
|
+
* - The claims: the version-1 shape, strict.
|
|
16
|
+
* - The key's scope, from its stored record and never from a JWKS member: an organization-scoped key verifies only a seal
|
|
17
|
+
* whose tenant is that organization.
|
|
18
|
+
* - The disclosures: each must digest to the commitment its claim names; a commitment with no disclosure is reported as
|
|
19
|
+
* erased (the person's content was removed, the seal stands).
|
|
20
|
+
* - A FILE deliverable (#2904), when the seal attests one: the file's bytes, hashed and salted with the salt its row
|
|
21
|
+
* kept, must give the commitment the disclosed presentation binds it by. One changed byte fails the seal; bytes not
|
|
22
|
+
* given are reported as such (a missing file), never as a match.
|
|
23
|
+
* - A MANIFESTED COPY (#2907), when the seal's deliverable has one: the copy is rebuilt from its own prefix, the JWS, the
|
|
24
|
+
* inputs it carries (its words, its pinned font, its verification address) and the disclosed approver's printed name,
|
|
25
|
+
* and must equal the bytes given, and the host's record of its hash when the bundle states one; its prefix must then open the seal's commitment
|
|
26
|
+
* to the approved file, which ties the copy to the original without the original being supplied. One changed byte in
|
|
27
|
+
* the approval page fails the seal. A copy the approver's erasure deleted is reported CONTENT_ERASED, never missing.
|
|
28
|
+
* - A COMPROMISED key: the signature may still verify, but the seal is not PROVABLE unless corroborated by evidence the
|
|
29
|
+
* key's holder could not have forged: the decision's payload digest recorded outside the application before the
|
|
30
|
+
* compromise instant (an exported audit event, an immutable sink).
|
|
31
|
+
* - The OPERATOR'S PIN SET, when one is given (#2932): the key must be pinned, by the RFC 7638 thumbprint of the public
|
|
32
|
+
* half the verifier was handed (so a key record that names a pinned `kid` over another key is refused), and the pin's
|
|
33
|
+
* state, scope and compromise instant are used instead of the record's. The record (from a bundle, from the host)
|
|
34
|
+
* only supplies the public half and the issuer; the operator's pin decides whether that half is theirs and what became
|
|
35
|
+
* of it. Without a pin set the records are trusted as given, as before.
|
|
36
|
+
* - The OPERATOR'S KEPT SIGNING-LOG EXPORTS, when given (#2932): a seal under a key compromised after an export that lists
|
|
37
|
+
* it is corroborated by that export, which the host could not have signed after the compromise without the operator's
|
|
38
|
+
* copy disagreeing. Each export is verified here, with the operator's pin set for the export key.
|
|
39
|
+
*
|
|
40
|
+
* spec-cite: RFC 8725 §3.1 (algorithm verification), §3.10 (do not trust received URLs); RFC 7515 §4.1.11 (`crit`),
|
|
41
|
+
* §10.7 (key selection from header parameters). Cited by section; the behaviour is this file's decision.
|
|
42
|
+
*/
|
|
43
|
+
import { createHash } from 'node:crypto';
|
|
44
|
+
import { z } from 'zod';
|
|
45
|
+
import { humanDecisionBoundDeliverableOf, singleJwsTypeOf, CryptoKey_Purpose, CryptoKey_Scope, CryptoKey_VersionState } from '@wildo-ai/saas-models';
|
|
46
|
+
import { ES256_JWS_ALGORITHM, isP256PublicJwk, verifyEs256 } from './es256-jws.js';
|
|
47
|
+
import { decisionPayloadDigestOf, sealClaimsDigestOf } from './signature-request.contracts.js';
|
|
48
|
+
import { VerificationKeyRecordSchema, compareSigningLogExports, pinnedVerificationKeyOf, verifySigningLogExport } from './signing-log-export.contracts.js';
|
|
49
|
+
import { checkApprovalSealManifestedCopy } from './approval-seal-manifested-copy.js';
|
|
50
|
+
import { ApprovalSealClaimsV1Schema, ApprovalSealDisclosureClaim, approvalSealDisclosureDigestOf, approvalSealFileCommitmentOf, } from './approval-seal.contracts.js';
|
|
51
|
+
/** The approval seal's JWS `typ`. */
|
|
52
|
+
const APPROVAL_SEAL_TYP = singleJwsTypeOf(CryptoKey_Purpose.APPROVAL_SEAL);
|
|
53
|
+
/** The payload members the custodian sets; the rest is the decision's committed payload. */
|
|
54
|
+
const CUSTODIAN_SET_CLAIMS = ['iss', 'iat', 'lateSeal'];
|
|
55
|
+
/** What corroborated a seal under a compromised key. */
|
|
56
|
+
export var ApprovalSealCorroborationSource;
|
|
57
|
+
(function (ApprovalSealCorroborationSource) {
|
|
58
|
+
/** The decision's payload digest, recorded outside the application before the compromise. */
|
|
59
|
+
ApprovalSealCorroborationSource["RECORDED_EVIDENCE"] = "recorded_evidence";
|
|
60
|
+
/** A signing-log export the operator kept, signed before the compromise, lists the seal. */
|
|
61
|
+
ApprovalSealCorroborationSource["SIGNING_LOG_EXPORT"] = "signing_log_export";
|
|
62
|
+
})(ApprovalSealCorroborationSource || (ApprovalSealCorroborationSource = {}));
|
|
63
|
+
/** Why a seal does not verify. */
|
|
64
|
+
export var ApprovalSealVerificationFailure;
|
|
65
|
+
(function (ApprovalSealVerificationFailure) {
|
|
66
|
+
/** Not a compact JWS with a JSON header and payload. */
|
|
67
|
+
ApprovalSealVerificationFailure["MALFORMED"] = "malformed";
|
|
68
|
+
/** The header's `alg` is not the one the key record pins. */
|
|
69
|
+
ApprovalSealVerificationFailure["ALGORITHM_NOT_PINNED"] = "algorithm_not_pinned";
|
|
70
|
+
/** The header names a critical extension, and none is understood. */
|
|
71
|
+
ApprovalSealVerificationFailure["CRITICAL_EXTENSION"] = "critical_extension";
|
|
72
|
+
/** The header's `typ` is not the approval seal's. */
|
|
73
|
+
ApprovalSealVerificationFailure["TYPE_MISMATCH"] = "type_mismatch";
|
|
74
|
+
/** No given key has the header's `kid`. */
|
|
75
|
+
ApprovalSealVerificationFailure["UNKNOWN_KEY"] = "unknown_key";
|
|
76
|
+
ApprovalSealVerificationFailure["SIGNATURE_INVALID"] = "signature_invalid";
|
|
77
|
+
/** The payload's issuer is not the key record's, or not the expected one. */
|
|
78
|
+
ApprovalSealVerificationFailure["ISSUER_MISMATCH"] = "issuer_mismatch";
|
|
79
|
+
/** The payload is not the version-1 claims shape. */
|
|
80
|
+
ApprovalSealVerificationFailure["CLAIMS_INVALID"] = "claims_invalid";
|
|
81
|
+
/** The key's stored scope does not cover the seal's tenant (or is not a scope a seal is signed under). */
|
|
82
|
+
ApprovalSealVerificationFailure["TENANT_OUTSIDE_KEY_SCOPE"] = "tenant_outside_key_scope";
|
|
83
|
+
/** A disclosure does not digest to the commitment its claim names. */
|
|
84
|
+
ApprovalSealVerificationFailure["DISCLOSURE_MISMATCH"] = "disclosure_mismatch";
|
|
85
|
+
/** A pin set was given and does not pin the key, or the key handed over is not the one its pinned `kid` names. */
|
|
86
|
+
ApprovalSealVerificationFailure["UNPINNED"] = "unpinned";
|
|
87
|
+
/** A file deliverable's bytes were given and are not the ones the seal binds (#2904). */
|
|
88
|
+
ApprovalSealVerificationFailure["DELIVERABLE_FILE_MISMATCH"] = "deliverable_file_mismatch";
|
|
89
|
+
/**
|
|
90
|
+
* A manifested copy was given and is not this seal's (#2907): its approval page, its attached JWS or its page tree is
|
|
91
|
+
* not what the seal rebuilds, or what precedes them is not the file the seal binds.
|
|
92
|
+
*/
|
|
93
|
+
ApprovalSealVerificationFailure["MANIFESTED_COPY_MISMATCH"] = "manifested_copy_mismatch";
|
|
94
|
+
})(ApprovalSealVerificationFailure || (ApprovalSealVerificationFailure = {}));
|
|
95
|
+
/** What the seal says about the file deliverable it attests (#2904). */
|
|
96
|
+
export var ApprovalSealDeliverableFileStanding;
|
|
97
|
+
(function (ApprovalSealDeliverableFileStanding) {
|
|
98
|
+
/** The bytes given hash, with the row's salt, to the commitment the presentation binds: the file approved. */
|
|
99
|
+
ApprovalSealDeliverableFileStanding["MATCHES"] = "matches";
|
|
100
|
+
/** The bytes given are not the file approved: one changed byte is enough. The seal does not verify. */
|
|
101
|
+
ApprovalSealDeliverableFileStanding["CHANGED"] = "changed";
|
|
102
|
+
/** The seal binds the file and its bytes were not given: the file is missing, or was not supplied. */
|
|
103
|
+
ApprovalSealDeliverableFileStanding["NOT_GIVEN"] = "not_given";
|
|
104
|
+
/**
|
|
105
|
+
* Nothing to compare with: the presentation that holds the commitment is not disclosed (erased with a person it
|
|
106
|
+
* named, or withheld), or it binds no such file.
|
|
107
|
+
*/
|
|
108
|
+
ApprovalSealDeliverableFileStanding["NOT_COMMITTED"] = "not_committed";
|
|
109
|
+
/**
|
|
110
|
+
* A manifested copy (#2907) only: the host states the approver's erasure deleted it. The copy printed the approver's
|
|
111
|
+
* name in clear and a file cannot be scrubbed, so it went; the seal and the original still prove the approval, and the
|
|
112
|
+
* copy can be rebuilt from both should the name ever lawfully be needed again.
|
|
113
|
+
*/
|
|
114
|
+
ApprovalSealDeliverableFileStanding["CONTENT_ERASED"] = "content_erased";
|
|
115
|
+
})(ApprovalSealDeliverableFileStanding || (ApprovalSealDeliverableFileStanding = {}));
|
|
116
|
+
/**
|
|
117
|
+
* What the seal says about one committed disclosure: a person's (approver, requester), what they were shown, what they
|
|
118
|
+
* answered. In none of the three is the seal failed: the signature covers the commitments, never the content (#2924).
|
|
119
|
+
*/
|
|
120
|
+
export var ApprovalSealDisclosureStanding;
|
|
121
|
+
(function (ApprovalSealDisclosureStanding) {
|
|
122
|
+
/** Given, and it digests to the commitment. */
|
|
123
|
+
ApprovalSealDisclosureStanding["DISCLOSED"] = "disclosed";
|
|
124
|
+
/**
|
|
125
|
+
* Committed to, not given, and the bundle states an erasure removed it (`erasedClaims`): UNDISCLOSED (erased). For the
|
|
126
|
+
* presentation this is PRESENTATION_ERASED: an erasure rewrote the stored presentation, and the seal still proves that
|
|
127
|
+
* a presentation with this digest was shown.
|
|
128
|
+
*/
|
|
129
|
+
ApprovalSealDisclosureStanding["ERASED"] = "erased";
|
|
130
|
+
/** Committed to, and not given, with no erasure stated: withheld, or a bundle that does not carry it. */
|
|
131
|
+
ApprovalSealDisclosureStanding["WITHHELD"] = "withheld";
|
|
132
|
+
})(ApprovalSealDisclosureStanding || (ApprovalSealDisclosureStanding = {}));
|
|
133
|
+
function decodeJson(part) {
|
|
134
|
+
if (!part)
|
|
135
|
+
return null;
|
|
136
|
+
try {
|
|
137
|
+
const value = JSON.parse(Buffer.from(part, 'base64url').toString('utf8'));
|
|
138
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) ? value : null;
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function disclosureStanding(claimName, commitment, disclosures, erasedClaims, failures) {
|
|
145
|
+
if (!commitment)
|
|
146
|
+
return undefined;
|
|
147
|
+
const given = disclosures.filter((disclosure) => disclosure.claimName === claimName);
|
|
148
|
+
if (given.length === 0) {
|
|
149
|
+
return { standing: erasedClaims.includes(claimName) ? ApprovalSealDisclosureStanding.ERASED : ApprovalSealDisclosureStanding.WITHHELD };
|
|
150
|
+
}
|
|
151
|
+
const matching = given.find((disclosure) => approvalSealDisclosureDigestOf(disclosure) === commitment);
|
|
152
|
+
if (!matching) {
|
|
153
|
+
// A disclosure that does not open its commitment is not the content: the seal fails, and nothing was disclosed.
|
|
154
|
+
failures.push(ApprovalSealVerificationFailure.DISCLOSURE_MISMATCH);
|
|
155
|
+
return { standing: ApprovalSealDisclosureStanding.WITHHELD };
|
|
156
|
+
}
|
|
157
|
+
return { standing: ApprovalSealDisclosureStanding.DISCLOSED, value: matching.value };
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The file deliverable against the commitment the disclosed presentation binds it by (#2904). A mismatch is a failure:
|
|
161
|
+
* the seal does not attest those bytes.
|
|
162
|
+
*/
|
|
163
|
+
function deliverableFileStandingOf(given, presentation, failures) {
|
|
164
|
+
if (!given)
|
|
165
|
+
return undefined;
|
|
166
|
+
const bound = presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED ? humanDecisionBoundDeliverableOf(presentation.value, given.fileId) : undefined;
|
|
167
|
+
if (!bound)
|
|
168
|
+
return { fileId: given.fileId, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };
|
|
169
|
+
if (!given.bytes)
|
|
170
|
+
return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.NOT_GIVEN };
|
|
171
|
+
const contentSha256 = createHash('sha256').update(given.bytes).digest('hex');
|
|
172
|
+
if (approvalSealFileCommitmentOf(given.salt, contentSha256) === bound.commitment) {
|
|
173
|
+
return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.MATCHES };
|
|
174
|
+
}
|
|
175
|
+
failures.push(ApprovalSealVerificationFailure.DELIVERABLE_FILE_MISMATCH);
|
|
176
|
+
return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.CHANGED };
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The manifested copy against the seal (#2907): rebuilt and compared, then its prefix opened against the commitment the
|
|
180
|
+
* disclosed presentation binds the deliverable by. A mismatch at either step is a failure.
|
|
181
|
+
*/
|
|
182
|
+
function manifestedCopyStandingOf(input, approver, presentation, failures) {
|
|
183
|
+
const given = input.manifestedCopy;
|
|
184
|
+
if (!given)
|
|
185
|
+
return undefined;
|
|
186
|
+
const named = given.fileId ? { fileId: given.fileId } : {};
|
|
187
|
+
if (!given.bytes) {
|
|
188
|
+
return { ...named, standing: given.contentErased ? ApprovalSealDeliverableFileStanding.CONTENT_ERASED : ApprovalSealDeliverableFileStanding.NOT_GIVEN };
|
|
189
|
+
}
|
|
190
|
+
if (approver?.standing !== ApprovalSealDisclosureStanding.DISCLOSED || !approver.value)
|
|
191
|
+
return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };
|
|
192
|
+
const approverName = typeof approver.value.name === 'string' ? approver.value.name : undefined;
|
|
193
|
+
const printed = approverName !== undefined ? { approverName } : {};
|
|
194
|
+
const statedHash = given.contentSha256 === undefined || createHash('sha256').update(given.bytes).digest('hex') === given.contentSha256;
|
|
195
|
+
const check = checkApprovalSealManifestedCopy(given.bytes, { jws: input.jws, ...printed });
|
|
196
|
+
if (!check.matches || !statedHash) {
|
|
197
|
+
failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);
|
|
198
|
+
return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };
|
|
199
|
+
}
|
|
200
|
+
const deliverable = input.deliverableFile;
|
|
201
|
+
const bound = deliverable && presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED
|
|
202
|
+
? humanDecisionBoundDeliverableOf(presentation.value, deliverable.fileId)
|
|
203
|
+
: undefined;
|
|
204
|
+
const stated = { locale: check.statement.locale, ...(check.statement.verificationUrl ? { verificationUrl: check.statement.verificationUrl } : {}) };
|
|
205
|
+
if (!deliverable || !bound)
|
|
206
|
+
return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED, ...printed, ...stated };
|
|
207
|
+
if (approvalSealFileCommitmentOf(deliverable.salt, createHash('sha256').update(check.original).digest('hex')) !== bound.commitment) {
|
|
208
|
+
failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);
|
|
209
|
+
return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };
|
|
210
|
+
}
|
|
211
|
+
return { ...named, standing: ApprovalSealDeliverableFileStanding.MATCHES, ...printed, ...stated };
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* What corroborates a seal under a compromised key, if anything: evidence of its payload recorded before the compromise,
|
|
215
|
+
* or a kept export signed before the compromise that lists this exact seal (its issuer, its key, its signed claims).
|
|
216
|
+
*/
|
|
217
|
+
function corroborationOf(input, key, payload, decisionPayloadDigest) {
|
|
218
|
+
if (key.compromiseInstant === undefined)
|
|
219
|
+
return undefined;
|
|
220
|
+
const compromisedFrom = Date.parse(key.compromiseInstant);
|
|
221
|
+
if (input.corroboration && input.corroboration.decisionPayloadDigest === decisionPayloadDigest && Date.parse(input.corroboration.recordedAt) < compromisedFrom) {
|
|
222
|
+
return ApprovalSealCorroborationSource.RECORDED_EVIDENCE;
|
|
223
|
+
}
|
|
224
|
+
const logged = input.signingLogExports;
|
|
225
|
+
if (!logged)
|
|
226
|
+
return undefined;
|
|
227
|
+
const claimsDigest = sealClaimsDigestOf(payload);
|
|
228
|
+
const evidence = logged.exports.flatMap((jws) => {
|
|
229
|
+
const exported = verifySigningLogExport({ jws, keys: logged.keys, ...(logged.pins ? { pins: logged.pins } : {}), expectedIssuer: key.iss });
|
|
230
|
+
return exported.provable && exported.claims ? [exported.claims] : [];
|
|
231
|
+
});
|
|
232
|
+
// The exports must agree with each other first (#2932 review M3): an export is dated by the instant it states for
|
|
233
|
+
// itself, so a host holding the export key could sign one dated before the compromise; it disagrees with the operator's
|
|
234
|
+
// kept exports (a different hash at some sequence, or a head behind an earlier one), and then none of them corroborates.
|
|
235
|
+
if (!compareSigningLogExports(evidence).consistent)
|
|
236
|
+
return undefined;
|
|
237
|
+
for (const claims of evidence) {
|
|
238
|
+
if (claims.iat * 1000 >= compromisedFrom)
|
|
239
|
+
continue;
|
|
240
|
+
const lists = claims.entries.some((entry) => entry.purpose === CryptoKey_Purpose.APPROVAL_SEAL && entry.kid === key.kid && entry.iss === key.iss && entry.claimsDigest === claimsDigest);
|
|
241
|
+
if (lists)
|
|
242
|
+
return ApprovalSealCorroborationSource.SIGNING_LOG_EXPORT;
|
|
243
|
+
}
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
/** See the file's header. Pure and offline. */
|
|
247
|
+
export function verifyApprovalSeal(input) {
|
|
248
|
+
const failures = [];
|
|
249
|
+
const fail = (failure, extra = {}) => ({ valid: false, provable: false, failures: [...failures, failure], ...extra });
|
|
250
|
+
const parts = input.jws.split('.');
|
|
251
|
+
const header = parts.length === 3 ? decodeJson(parts[0]) : null;
|
|
252
|
+
const payload = parts.length === 3 ? decodeJson(parts[1]) : null;
|
|
253
|
+
if (!header || !payload || !parts[2])
|
|
254
|
+
return fail(ApprovalSealVerificationFailure.MALFORMED);
|
|
255
|
+
const kid = typeof header.kid === 'string' ? header.kid : undefined;
|
|
256
|
+
// The key is chosen by `kid` among the keys the verifier was GIVEN; `jku`/`x5u`/`jwk`/`x5c` are never read.
|
|
257
|
+
const record = kid ? input.keys.find((candidate) => candidate.kid === kid) : undefined;
|
|
258
|
+
if (!record || !isP256PublicJwk(record.publicJwk))
|
|
259
|
+
return fail(ApprovalSealVerificationFailure.UNKNOWN_KEY, kid ? { kid } : {});
|
|
260
|
+
// The operator's pin, when given: the key handed over must be the one the pinned thumbprint names, and the pin (not
|
|
261
|
+
// the record) says what became of it.
|
|
262
|
+
const key = pinnedVerificationKeyOf(record, input.pins);
|
|
263
|
+
if (!key)
|
|
264
|
+
return fail(ApprovalSealVerificationFailure.UNPINNED, { kid });
|
|
265
|
+
if (header.alg !== key.alg || key.alg !== ES256_JWS_ALGORITHM)
|
|
266
|
+
return fail(ApprovalSealVerificationFailure.ALGORITHM_NOT_PINNED, { kid });
|
|
267
|
+
if (header.crit !== undefined)
|
|
268
|
+
return fail(ApprovalSealVerificationFailure.CRITICAL_EXTENSION, { kid });
|
|
269
|
+
if (header.typ !== APPROVAL_SEAL_TYP)
|
|
270
|
+
return fail(ApprovalSealVerificationFailure.TYPE_MISMATCH, { kid });
|
|
271
|
+
if (!verifyEs256(`${parts[0]}.${parts[1]}`, Buffer.from(parts[2], 'base64url'), key.publicJwk)) {
|
|
272
|
+
return fail(ApprovalSealVerificationFailure.SIGNATURE_INVALID, { kid, keyState: key.state });
|
|
273
|
+
}
|
|
274
|
+
const iss = typeof payload.iss === 'string' ? payload.iss : undefined;
|
|
275
|
+
const iat = typeof payload.iat === 'number' ? payload.iat : undefined;
|
|
276
|
+
const lateSeal = payload.lateSeal === true;
|
|
277
|
+
if (!iss || iss !== key.iss || (input.expectedIssuer !== undefined && iss !== input.expectedIssuer))
|
|
278
|
+
failures.push(ApprovalSealVerificationFailure.ISSUER_MISMATCH);
|
|
279
|
+
const committed = Object.fromEntries(Object.entries(payload).filter(([name]) => !CUSTODIAN_SET_CLAIMS.includes(name)));
|
|
280
|
+
const parsed = ApprovalSealClaimsV1Schema.safeParse(committed);
|
|
281
|
+
if (!parsed.success)
|
|
282
|
+
return fail(ApprovalSealVerificationFailure.CLAIMS_INVALID, { kid, keyState: key.state, ...(iss ? { iss } : {}) });
|
|
283
|
+
const claims = parsed.data;
|
|
284
|
+
// The key's scope from its RECORD: an organization key covers only that organization's decisions.
|
|
285
|
+
const scopeCovers = key.scope === CryptoKey_Scope.APPLICATION || (key.scope === CryptoKey_Scope.ORGANIZATION && claims.tenant === key.scopeId);
|
|
286
|
+
if (!scopeCovers)
|
|
287
|
+
failures.push(ApprovalSealVerificationFailure.TENANT_OUTSIDE_KEY_SCOPE);
|
|
288
|
+
const disclosures = input.disclosures ?? [];
|
|
289
|
+
const erased = input.erasedClaims ?? [];
|
|
290
|
+
const approver = disclosureStanding(ApprovalSealDisclosureClaim.APPROVER, claims.approver, disclosures, erased, failures);
|
|
291
|
+
const requester = disclosureStanding(ApprovalSealDisclosureClaim.REQUESTER, claims.requester?.disclosure, disclosures, erased, failures);
|
|
292
|
+
const presentation = disclosureStanding(ApprovalSealDisclosureClaim.PRESENTATION, claims.presentation?.digest, disclosures, erased, failures);
|
|
293
|
+
const statement = disclosureStanding(ApprovalSealDisclosureClaim.STATEMENT, claims.statementDigest, disclosures, erased, failures);
|
|
294
|
+
const deliverableFile = deliverableFileStandingOf(input.deliverableFile, presentation, failures);
|
|
295
|
+
const manifestedCopy = manifestedCopyStandingOf(input, approver, presentation, failures);
|
|
296
|
+
const decisionPayloadDigest = decisionPayloadDigestOf(committed);
|
|
297
|
+
const valid = failures.length === 0;
|
|
298
|
+
const compromised = key.state === CryptoKey_VersionState.COMPROMISED;
|
|
299
|
+
const corroboratedBy = compromised ? corroborationOf(input, key, payload, decisionPayloadDigest) : undefined;
|
|
300
|
+
const corroborated = !compromised || corroboratedBy !== undefined;
|
|
301
|
+
return {
|
|
302
|
+
valid,
|
|
303
|
+
failures,
|
|
304
|
+
provable: valid && corroborated,
|
|
305
|
+
...(corroboratedBy ? { corroboratedBy } : {}),
|
|
306
|
+
kid,
|
|
307
|
+
keyState: key.state,
|
|
308
|
+
claims,
|
|
309
|
+
iss,
|
|
310
|
+
...(iat !== undefined ? { iat, signingWindowSeconds: Math.max(0, iat - claims.decidedAt) } : {}),
|
|
311
|
+
lateSeal,
|
|
312
|
+
decisionPayloadDigest,
|
|
313
|
+
...(approver ? { approver } : {}),
|
|
314
|
+
...(requester ? { requester } : {}),
|
|
315
|
+
...(presentation ? { presentation } : {}),
|
|
316
|
+
...(statement ? { statement } : {}),
|
|
317
|
+
...(deliverableFile ? { deliverableFile } : {}),
|
|
318
|
+
...(manifestedCopy ? { manifestedCopy } : {}),
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
/** A verification key as an export or a CLI file states it (dates as ISO strings): the one shape of a key record. */
|
|
322
|
+
export const ApprovalSealVerificationKeySchema = VerificationKeyRecordSchema;
|
|
323
|
+
/**
|
|
324
|
+
* Evidence recorded outside the application that a decision's payload existed before a key's compromise, as the file an
|
|
325
|
+
* operator keeps it in (`wildo seal verify --corroboration <file>`).
|
|
326
|
+
*/
|
|
327
|
+
export const ApprovalSealCorroborationSchema = z.object({ decisionPayloadDigest: z.string().min(1), recordedAt: z.string().min(1) });
|
|
328
|
+
/**
|
|
329
|
+
* What `wildo seal verify` reads: one seal and everything it needs to verify, offline. A bundle is what the HOST exports,
|
|
330
|
+
* so it carries no pin set, no signing-log exports and no corroboration: each is evidence against the host, and reaches
|
|
331
|
+
* the verifier only from the operator's own files (`ApprovalSealVerificationInput.pins` / `signingLogExports` /
|
|
332
|
+
* `corroboration`). The schema is not strict, so a bundle naming any of them has it stripped on parse rather than
|
|
333
|
+
* believed (#2932 review H1, R1).
|
|
334
|
+
*/
|
|
335
|
+
export const ApprovalSealVerificationBundleSchema = z.object({
|
|
336
|
+
jws: z.string().min(1),
|
|
337
|
+
keys: z.array(ApprovalSealVerificationKeySchema).min(1),
|
|
338
|
+
expectedIssuer: z.string().min(1).optional(),
|
|
339
|
+
disclosures: z.array(z.object({ claimName: z.enum(ApprovalSealDisclosureClaim), salt: z.string().min(1), value: z.record(z.string(), z.unknown()) })).optional(),
|
|
340
|
+
/** The committed claims an erasure removed from the host's row (#2924): see `ApprovalSealVerificationInput.erasedClaims`. */
|
|
341
|
+
erasedClaims: z.array(z.enum(ApprovalSealDisclosureClaim)).optional(),
|
|
342
|
+
/**
|
|
343
|
+
* The file deliverable the seal attests (#2904): its id and the salt its row kept. Never the bytes, which the verifier
|
|
344
|
+
* is given from the file itself (`--deliverable`), and never the clear hash.
|
|
345
|
+
*/
|
|
346
|
+
deliverableFile: z.object({ fileId: z.string().min(1), salt: z.string().min(1) }).optional(),
|
|
347
|
+
/**
|
|
348
|
+
* The deliverable's manifested copy (#2907): its file id, or `contentErased` when the approver's erasure deleted it.
|
|
349
|
+
* Never its bytes, which the verifier is given from the file itself (`--manifested-copy`).
|
|
350
|
+
*/
|
|
351
|
+
manifestedCopy: z.object({ fileId: z.string().min(1).optional(), contentSha256: z.string().regex(/^[0-9a-f]{64}$/).optional(), contentErased: z.literal(true).optional() })
|
|
352
|
+
.refine((copy) => (copy.fileId === undefined) !== (copy.contentErased === undefined), { message: 'A manifested copy is named by its file id, or stated erased: exactly one of the two' })
|
|
353
|
+
.optional(),
|
|
354
|
+
});
|
|
355
|
+
//# sourceMappingURL=approval-seal-verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-seal-verifier.js","sourceRoot":"","sources":["../../../src/key-management/approval-seal-verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,+BAA+B,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe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;IACH,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5F;;;OAGG;IACH,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;SACxK,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,qFAAqF,EAAE,CAAC;SACxL,QAAQ,EAAE;CACd,CAAC,CAAC","sourcesContent":["/**\n * # Verifying an approval seal, offline (#2903)\n *\n * Everything a verifier needs travels with the seal: the compact JWS, the stored records of the keys that may have signed\n * it (their public half, scope and issuer, as an export carries them), and, when the person's content is to be shown,\n * the disclosures. Nothing here calls the application or the platform, so a seal verifies after the application is gone.\n *\n * ## What is checked, and on whose authority\n *\n * - The header: ES256 is pinned per key from the key RECORD, never read from the header (RFC 8725 §3.1); `jku`, `x5u`,\n * `jwk` and `x5c` are never followed (RFC 8725 §3.10, RFC 7515 §10.7); a `crit` naming anything is refused, since no\n * extension is understood (RFC 7515 §4.1.11); `typ` must be the approval seal's.\n * - The signature, under the key the `kid` names among those given.\n * - The issuer: the payload's `iss` must be the key record's, and the expected issuer when one is given.\n * - The claims: the version-1 shape, strict.\n * - The key's scope, from its stored record and never from a JWKS member: an organization-scoped key verifies only a seal\n * whose tenant is that organization.\n * - The disclosures: each must digest to the commitment its claim names; a commitment with no disclosure is reported as\n * erased (the person's content was removed, the seal stands).\n * - A FILE deliverable (#2904), when the seal attests one: the file's bytes, hashed and salted with the salt its row\n * kept, must give the commitment the disclosed presentation binds it by. One changed byte fails the seal; bytes not\n * given are reported as such (a missing file), never as a match.\n * - A MANIFESTED COPY (#2907), when the seal's deliverable has one: the copy is rebuilt from its own prefix, the JWS, the\n * inputs it carries (its words, its pinned font, its verification address) and the disclosed approver's printed name,\n * and must equal the bytes given, and the host's record of its hash when the bundle states one; its prefix must then open the seal's commitment\n * to the approved file, which ties the copy to the original without the original being supplied. One changed byte in\n * the approval page fails the seal. A copy the approver's erasure deleted is reported CONTENT_ERASED, never missing.\n * - A COMPROMISED key: the signature may still verify, but the seal is not PROVABLE unless corroborated by evidence the\n * key's holder could not have forged: the decision's payload digest recorded outside the application before the\n * compromise instant (an exported audit event, an immutable sink).\n * - The OPERATOR'S PIN SET, when one is given (#2932): the key must be pinned, by the RFC 7638 thumbprint of the public\n * half the verifier was handed (so a key record that names a pinned `kid` over another key is refused), and the pin's\n * state, scope and compromise instant are used instead of the record's. The record (from a bundle, from the host)\n * only supplies the public half and the issuer; the operator's pin decides whether that half is theirs and what became\n * of it. Without a pin set the records are trusted as given, as before.\n * - The OPERATOR'S KEPT SIGNING-LOG EXPORTS, when given (#2932): a seal under a key compromised after an export that lists\n * it is corroborated by that export, which the host could not have signed after the compromise without the operator's\n * copy disagreeing. Each export is verified here, with the operator's pin set for the export key.\n *\n * spec-cite: RFC 8725 §3.1 (algorithm verification), §3.10 (do not trust received URLs); RFC 7515 §4.1.11 (`crit`),\n * §10.7 (key selection from header parameters). Cited by section; the behaviour is this file's decision.\n */\nimport { createHash } from 'node:crypto';\nimport { z } from 'zod';\nimport { humanDecisionBoundDeliverableOf, singleJwsTypeOf, CryptoKey_Purpose, CryptoKey_Scope, CryptoKey_VersionState, type CryptoKeyPinSet } from '@wildo-ai/saas-models';\nimport { ES256_JWS_ALGORITHM, isP256PublicJwk, verifyEs256, type P256PublicJwk } from './es256-jws';\nimport { decisionPayloadDigestOf, sealClaimsDigestOf } from './signature-request.contracts';\nimport { VerificationKeyRecordSchema, compareSigningLogExports, pinnedVerificationKeyOf, verifySigningLogExport } from './signing-log-export.contracts';\nimport { checkApprovalSealManifestedCopy } from './approval-seal-manifested-copy';\nimport {\n ApprovalSealClaimsV1Schema,\n ApprovalSealDisclosureClaim,\n approvalSealDisclosureDigestOf,\n approvalSealFileCommitmentOf,\n type ApprovalSealClaimsV1,\n type ApprovalSealDisclosureValue,\n} from './approval-seal.contracts';\n\n/** The approval seal's JWS `typ`. */\nconst APPROVAL_SEAL_TYP = singleJwsTypeOf(CryptoKey_Purpose.APPROVAL_SEAL);\n\n/** The payload members the custodian sets; the rest is the decision's committed payload. */\nconst CUSTODIAN_SET_CLAIMS = ['iss', 'iat', 'lateSeal'] as const;\n\n/** One key that may have signed a seal: its STORED record (scope, issuer, state), as an export carries it. */\nexport interface ApprovalSealVerificationKey {\n readonly kid: string;\n readonly publicJwk: P256PublicJwk;\n /** The algorithm the key record pins. ES256 for every approval-seal key today. */\n readonly alg: typeof ES256_JWS_ALGORITHM;\n readonly scope: CryptoKey_Scope;\n /** The application's id for an APPLICATION key, the organization's for an ORGANIZATION key. */\n readonly scopeId: string;\n readonly iss: string;\n readonly state: CryptoKey_VersionState;\n /** ISO 8601, for a COMPROMISED key: the earliest instant its private half may have been exposed. */\n readonly compromiseInstant?: string;\n}\n\n/** Evidence recorded OUTSIDE the application that the decision's payload existed before a key's compromise. */\nexport interface ApprovalSealCorroboration {\n readonly decisionPayloadDigest: string;\n /** ISO 8601: when the evidence was recorded where the key's holder could not rewrite it. */\n readonly recordedAt: string;\n}\n\nexport interface ApprovalSealVerificationInput {\n readonly jws: string;\n readonly keys: readonly ApprovalSealVerificationKey[];\n /** The issuer the seal must carry, when the verifier knows which application it expects. */\n readonly expectedIssuer?: string;\n readonly disclosures?: readonly ApprovalSealDisclosureValue[];\n /**\n * The committed claims whose content the host no longer holds because an ERASURE removed it (#2924): the approver's\n * own erasure, or a later erasure of the requester or of a person the presentation named (#3001). The host's\n * statement, read as a reason and never as proof: a claim it names and does not give reads ERASED, one it neither\n * names nor gives reads WITHHELD, and either way the seal stands.\n */\n readonly erasedClaims?: readonly ApprovalSealDisclosureClaim[];\n readonly corroboration?: ApprovalSealCorroboration;\n /**\n * The file deliverable the seal attests (#2904): its id and the salt the seal's row kept (a bundle carries both), and\n * the file's BYTES, which the verifier is given by whoever holds the file (`wildo seal verify --deliverable`). Without\n * the bytes the file is reported NOT_GIVEN.\n */\n readonly deliverableFile?: { readonly fileId: string; readonly salt: string; readonly bytes?: Uint8Array };\n /**\n * The manifested copy of that deliverable (#2907): its id as the host names it, or the host's statement that the\n * approver's erasure deleted it (`contentErased`, read as a reason, never as proof), and the copy's BYTES from whoever\n * holds the file (`wildo seal verify --manifested-copy`). Checking it needs the approver disclosed (the copy prints\n * their name) and, to tie it to the approved file, the presentation and `deliverableFile`'s salt. `contentSha256` is\n * the host's record of the copy's hash: it binds what the rebuild takes from the copy itself (its words, its\n * verification address), so a copy reworded since does not verify.\n */\n readonly manifestedCopy?: { readonly fileId?: string; readonly contentSha256?: string; readonly contentErased?: boolean; readonly bytes?: Uint8Array };\n /** The operator's pin set for approval seals (#2932), from a channel the host does not control. */\n readonly pins?: CryptoKeyPinSet;\n /**\n * The signing-log exports the operator kept (#2932), with the records of the keys that signed them and the operator's\n * pin set for SIGNING_LOG_EXPORT. An export that does not verify, or was signed after its own key's compromise, is\n * ignored: it corroborates nothing.\n */\n readonly signingLogExports?: {\n readonly exports: readonly string[];\n readonly keys: readonly ApprovalSealVerificationKey[];\n readonly pins?: CryptoKeyPinSet;\n };\n}\n\n/** What corroborated a seal under a compromised key. */\nexport enum ApprovalSealCorroborationSource {\n /** The decision's payload digest, recorded outside the application before the compromise. */\n RECORDED_EVIDENCE = 'recorded_evidence',\n /** A signing-log export the operator kept, signed before the compromise, lists the seal. */\n SIGNING_LOG_EXPORT = 'signing_log_export',\n}\n\n/** Why a seal does not verify. */\nexport enum ApprovalSealVerificationFailure {\n /** Not a compact JWS with a JSON header and payload. */\n MALFORMED = 'malformed',\n /** The header's `alg` is not the one the key record pins. */\n ALGORITHM_NOT_PINNED = 'algorithm_not_pinned',\n /** The header names a critical extension, and none is understood. */\n CRITICAL_EXTENSION = 'critical_extension',\n /** The header's `typ` is not the approval seal's. */\n TYPE_MISMATCH = 'type_mismatch',\n /** No given key has the header's `kid`. */\n UNKNOWN_KEY = 'unknown_key',\n SIGNATURE_INVALID = 'signature_invalid',\n /** The payload's issuer is not the key record's, or not the expected one. */\n ISSUER_MISMATCH = 'issuer_mismatch',\n /** The payload is not the version-1 claims shape. */\n CLAIMS_INVALID = 'claims_invalid',\n /** The key's stored scope does not cover the seal's tenant (or is not a scope a seal is signed under). */\n TENANT_OUTSIDE_KEY_SCOPE = 'tenant_outside_key_scope',\n /** A disclosure does not digest to the commitment its claim names. */\n DISCLOSURE_MISMATCH = 'disclosure_mismatch',\n /** A pin set was given and does not pin the key, or the key handed over is not the one its pinned `kid` names. */\n UNPINNED = 'unpinned',\n /** A file deliverable's bytes were given and are not the ones the seal binds (#2904). */\n DELIVERABLE_FILE_MISMATCH = 'deliverable_file_mismatch',\n /**\n * A manifested copy was given and is not this seal's (#2907): its approval page, its attached JWS or its page tree is\n * not what the seal rebuilds, or what precedes them is not the file the seal binds.\n */\n MANIFESTED_COPY_MISMATCH = 'manifested_copy_mismatch',\n}\n\n/** What the seal says about the file deliverable it attests (#2904). */\nexport enum ApprovalSealDeliverableFileStanding {\n /** The bytes given hash, with the row's salt, to the commitment the presentation binds: the file approved. */\n MATCHES = 'matches',\n /** The bytes given are not the file approved: one changed byte is enough. The seal does not verify. */\n CHANGED = 'changed',\n /** The seal binds the file and its bytes were not given: the file is missing, or was not supplied. */\n NOT_GIVEN = 'not_given',\n /**\n * Nothing to compare with: the presentation that holds the commitment is not disclosed (erased with a person it\n * named, or withheld), or it binds no such file.\n */\n NOT_COMMITTED = 'not_committed',\n /**\n * A manifested copy (#2907) only: the host states the approver's erasure deleted it. The copy printed the approver's\n * name in clear and a file cannot be scrubbed, so it went; the seal and the original still prove the approval, and the\n * copy can be rebuilt from both should the name ever lawfully be needed again.\n */\n CONTENT_ERASED = 'content_erased',\n}\n\n/**\n * What the seal says about one committed disclosure: a person's (approver, requester), what they were shown, what they\n * answered. In none of the three is the seal failed: the signature covers the commitments, never the content (#2924).\n */\nexport enum ApprovalSealDisclosureStanding {\n /** Given, and it digests to the commitment. */\n DISCLOSED = 'disclosed',\n /**\n * Committed to, not given, and the bundle states an erasure removed it (`erasedClaims`): UNDISCLOSED (erased). For the\n * presentation this is PRESENTATION_ERASED: an erasure rewrote the stored presentation, and the seal still proves that\n * a presentation with this digest was shown.\n */\n ERASED = 'erased',\n /** Committed to, and not given, with no erasure stated: withheld, or a bundle that does not carry it. */\n WITHHELD = 'withheld',\n}\n\nexport interface ApprovalSealVerification {\n /** The signature verifies, under a key whose record covers the seal, over well-formed claims and matching disclosures. */\n readonly valid: boolean;\n readonly failures: readonly ApprovalSealVerificationFailure[];\n /**\n * The seal proves what it says: valid, and its key not compromised, or corroborated before the compromise. A valid seal\n * under a compromised key, uncorroborated, is reported valid and NOT provable.\n */\n readonly provable: boolean;\n /** For a seal under a compromised key, what corroborated it; absent when nothing did (or nothing needed to). */\n readonly corroboratedBy?: ApprovalSealCorroborationSource;\n readonly kid?: string;\n readonly keyState?: CryptoKey_VersionState;\n readonly claims?: ApprovalSealClaimsV1;\n readonly iss?: string;\n /** The signing instant, epoch seconds. */\n readonly iat?: number;\n readonly lateSeal?: boolean;\n /** Seconds between the decision and its signature: what the database held at signing is what is sealed. */\n readonly signingWindowSeconds?: number;\n /** The digest of the decision's committed payload, to compare with the RESOLVED row of an exported trail. */\n readonly decisionPayloadDigest?: string;\n readonly approver?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n readonly requester?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** What the person was shown (#2903 S6), when the seal binds it: DISCLOSED, ERASED (PRESENTATION_ERASED) or WITHHELD. */\n readonly presentation?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** What the person answered, when the seal binds it. */\n readonly statement?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** The file deliverable the seal attests, checked against its bytes (#2904), when one was named. */\n readonly deliverableFile?: { readonly fileId: string; readonly argument?: string; readonly standing: ApprovalSealDeliverableFileStanding };\n /**\n * The manifested copy (#2907), when one was named: MATCHES (the original the seal binds, followed by exactly this seal's\n * approval page naming the disclosed approver), CHANGED, NOT_GIVEN, NOT_COMMITTED (the approver or the commitment is\n * not disclosed, so there is nothing to rebuild or tie it to) or CONTENT_ERASED. `approverName` is the name it prints.\n */\n readonly manifestedCopy?: {\n readonly fileId?: string;\n readonly standing: ApprovalSealDeliverableFileStanding;\n readonly approverName?: string;\n /** What the copy states it was made with, when it rebuilt: its words' language, its verification address. */\n readonly locale?: string;\n readonly verificationUrl?: string;\n };\n}\n\nfunction decodeJson(part: string | undefined): Record<string, unknown> | null {\n if (!part) return null;\n try {\n const value: unknown = JSON.parse(Buffer.from(part, 'base64url').toString('utf8'));\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : null;\n } catch {\n return null;\n }\n}\n\nfunction disclosureStanding(\n claimName: ApprovalSealDisclosureClaim,\n commitment: string | undefined,\n disclosures: readonly ApprovalSealDisclosureValue[],\n erasedClaims: readonly ApprovalSealDisclosureClaim[],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['approver'] {\n if (!commitment) return undefined;\n const given = disclosures.filter((disclosure) => disclosure.claimName === claimName);\n if (given.length === 0) {\n return { standing: erasedClaims.includes(claimName) ? ApprovalSealDisclosureStanding.ERASED : ApprovalSealDisclosureStanding.WITHHELD };\n }\n const matching = given.find((disclosure) => approvalSealDisclosureDigestOf(disclosure) === commitment);\n if (!matching) {\n // A disclosure that does not open its commitment is not the content: the seal fails, and nothing was disclosed.\n failures.push(ApprovalSealVerificationFailure.DISCLOSURE_MISMATCH);\n return { standing: ApprovalSealDisclosureStanding.WITHHELD };\n }\n return { standing: ApprovalSealDisclosureStanding.DISCLOSED, value: matching.value };\n}\n\n/**\n * The file deliverable against the commitment the disclosed presentation binds it by (#2904). A mismatch is a failure:\n * the seal does not attest those bytes.\n */\nfunction deliverableFileStandingOf(\n given: ApprovalSealVerificationInput['deliverableFile'],\n presentation: ApprovalSealVerification['presentation'],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['deliverableFile'] {\n if (!given) return undefined;\n const bound = presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED ? humanDecisionBoundDeliverableOf(presentation.value, given.fileId) : undefined;\n if (!bound) return { fileId: given.fileId, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };\n if (!given.bytes) return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.NOT_GIVEN };\n const contentSha256 = createHash('sha256').update(given.bytes).digest('hex');\n if (approvalSealFileCommitmentOf(given.salt, contentSha256) === bound.commitment) {\n return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.MATCHES };\n }\n failures.push(ApprovalSealVerificationFailure.DELIVERABLE_FILE_MISMATCH);\n return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n}\n\n/**\n * The manifested copy against the seal (#2907): rebuilt and compared, then its prefix opened against the commitment the\n * disclosed presentation binds the deliverable by. A mismatch at either step is a failure.\n */\nfunction manifestedCopyStandingOf(\n input: ApprovalSealVerificationInput,\n approver: ApprovalSealVerification['approver'],\n presentation: ApprovalSealVerification['presentation'],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['manifestedCopy'] {\n const given = input.manifestedCopy;\n if (!given) return undefined;\n const named = given.fileId ? { fileId: given.fileId } : {};\n if (!given.bytes) {\n return { ...named, standing: given.contentErased ? ApprovalSealDeliverableFileStanding.CONTENT_ERASED : ApprovalSealDeliverableFileStanding.NOT_GIVEN };\n }\n if (approver?.standing !== ApprovalSealDisclosureStanding.DISCLOSED || !approver.value) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };\n const approverName = typeof approver.value.name === 'string' ? approver.value.name : undefined;\n const printed = approverName !== undefined ? { approverName } : {};\n const statedHash = given.contentSha256 === undefined || createHash('sha256').update(given.bytes).digest('hex') === given.contentSha256;\n const check = checkApprovalSealManifestedCopy(given.bytes, { jws: input.jws, ...printed });\n if (!check.matches || !statedHash) {\n failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n const deliverable = input.deliverableFile;\n const bound = deliverable && presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED\n ? humanDecisionBoundDeliverableOf(presentation.value, deliverable.fileId)\n : undefined;\n const stated = { locale: check.statement.locale, ...(check.statement.verificationUrl ? { verificationUrl: check.statement.verificationUrl } : {}) };\n if (!deliverable || !bound) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED, ...printed, ...stated };\n if (approvalSealFileCommitmentOf(deliverable.salt, createHash('sha256').update(check.original).digest('hex')) !== bound.commitment) {\n failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n return { ...named, standing: ApprovalSealDeliverableFileStanding.MATCHES, ...printed, ...stated };\n}\n\n/**\n * What corroborates a seal under a compromised key, if anything: evidence of its payload recorded before the compromise,\n * or a kept export signed before the compromise that lists this exact seal (its issuer, its key, its signed claims).\n */\nfunction corroborationOf(\n input: ApprovalSealVerificationInput,\n key: ApprovalSealVerificationKey,\n payload: Readonly<Record<string, unknown>>,\n decisionPayloadDigest: string,\n): ApprovalSealCorroborationSource | undefined {\n if (key.compromiseInstant === undefined) return undefined;\n const compromisedFrom = Date.parse(key.compromiseInstant);\n if (input.corroboration && input.corroboration.decisionPayloadDigest === decisionPayloadDigest && Date.parse(input.corroboration.recordedAt) < compromisedFrom) {\n return ApprovalSealCorroborationSource.RECORDED_EVIDENCE;\n }\n const logged = input.signingLogExports;\n if (!logged) return undefined;\n const claimsDigest = sealClaimsDigestOf(payload);\n const evidence = logged.exports.flatMap((jws) => {\n const exported = verifySigningLogExport({ jws, keys: logged.keys, ...(logged.pins ? { pins: logged.pins } : {}), expectedIssuer: key.iss });\n return exported.provable && exported.claims ? [exported.claims] : [];\n });\n // The exports must agree with each other first (#2932 review M3): an export is dated by the instant it states for\n // itself, so a host holding the export key could sign one dated before the compromise; it disagrees with the operator's\n // kept exports (a different hash at some sequence, or a head behind an earlier one), and then none of them corroborates.\n if (!compareSigningLogExports(evidence).consistent) return undefined;\n for (const claims of evidence) {\n if (claims.iat * 1000 >= compromisedFrom) continue;\n const lists = claims.entries.some((entry) =>\n entry.purpose === CryptoKey_Purpose.APPROVAL_SEAL && entry.kid === key.kid && entry.iss === key.iss && entry.claimsDigest === claimsDigest);\n if (lists) return ApprovalSealCorroborationSource.SIGNING_LOG_EXPORT;\n }\n return undefined;\n}\n\n/** See the file's header. Pure and offline. */\nexport function verifyApprovalSeal(input: ApprovalSealVerificationInput): ApprovalSealVerification {\n const failures: ApprovalSealVerificationFailure[] = [];\n const fail = (failure: ApprovalSealVerificationFailure, extra: Partial<ApprovalSealVerification> = {}): ApprovalSealVerification =>\n ({ valid: false, provable: false, failures: [...failures, failure], ...extra });\n\n const parts = input.jws.split('.');\n const header = parts.length === 3 ? decodeJson(parts[0]) : null;\n const payload = parts.length === 3 ? decodeJson(parts[1]) : null;\n if (!header || !payload || !parts[2]) return fail(ApprovalSealVerificationFailure.MALFORMED);\n\n const kid = typeof header.kid === 'string' ? header.kid : undefined;\n // The key is chosen by `kid` among the keys the verifier was GIVEN; `jku`/`x5u`/`jwk`/`x5c` are never read.\n const record = kid ? input.keys.find((candidate) => candidate.kid === kid) : undefined;\n if (!record || !isP256PublicJwk(record.publicJwk)) return fail(ApprovalSealVerificationFailure.UNKNOWN_KEY, kid ? { kid } : {});\n // The operator's pin, when given: the key handed over must be the one the pinned thumbprint names, and the pin (not\n // the record) says what became of it.\n const key = pinnedVerificationKeyOf(record, input.pins);\n if (!key) return fail(ApprovalSealVerificationFailure.UNPINNED, { kid });\n if (header.alg !== key.alg || key.alg !== ES256_JWS_ALGORITHM) return fail(ApprovalSealVerificationFailure.ALGORITHM_NOT_PINNED, { kid });\n if (header.crit !== undefined) return fail(ApprovalSealVerificationFailure.CRITICAL_EXTENSION, { kid });\n if (header.typ !== APPROVAL_SEAL_TYP) return fail(ApprovalSealVerificationFailure.TYPE_MISMATCH, { kid });\n if (!verifyEs256(`${parts[0]}.${parts[1]}`, Buffer.from(parts[2], 'base64url'), key.publicJwk)) {\n return fail(ApprovalSealVerificationFailure.SIGNATURE_INVALID, { kid, keyState: key.state });\n }\n\n const iss = typeof payload.iss === 'string' ? payload.iss : undefined;\n const iat = typeof payload.iat === 'number' ? payload.iat : undefined;\n const lateSeal = payload.lateSeal === true;\n if (!iss || iss !== key.iss || (input.expectedIssuer !== undefined && iss !== input.expectedIssuer)) failures.push(ApprovalSealVerificationFailure.ISSUER_MISMATCH);\n\n const committed = Object.fromEntries(Object.entries(payload).filter(([name]) => !(CUSTODIAN_SET_CLAIMS as readonly string[]).includes(name)));\n const parsed = ApprovalSealClaimsV1Schema.safeParse(committed);\n if (!parsed.success) return fail(ApprovalSealVerificationFailure.CLAIMS_INVALID, { kid, keyState: key.state, ...(iss ? { iss } : {}) });\n const claims = parsed.data;\n\n // The key's scope from its RECORD: an organization key covers only that organization's decisions.\n const scopeCovers = key.scope === CryptoKey_Scope.APPLICATION || (key.scope === CryptoKey_Scope.ORGANIZATION && claims.tenant === key.scopeId);\n if (!scopeCovers) failures.push(ApprovalSealVerificationFailure.TENANT_OUTSIDE_KEY_SCOPE);\n\n const disclosures = input.disclosures ?? [];\n const erased = input.erasedClaims ?? [];\n const approver = disclosureStanding(ApprovalSealDisclosureClaim.APPROVER, claims.approver, disclosures, erased, failures);\n const requester = disclosureStanding(ApprovalSealDisclosureClaim.REQUESTER, claims.requester?.disclosure, disclosures, erased, failures);\n const presentation = disclosureStanding(ApprovalSealDisclosureClaim.PRESENTATION, claims.presentation?.digest, disclosures, erased, failures);\n const statement = disclosureStanding(ApprovalSealDisclosureClaim.STATEMENT, claims.statementDigest, disclosures, erased, failures);\n const deliverableFile = deliverableFileStandingOf(input.deliverableFile, presentation, failures);\n const manifestedCopy = manifestedCopyStandingOf(input, approver, presentation, failures);\n\n const decisionPayloadDigest = decisionPayloadDigestOf(committed);\n const valid = failures.length === 0;\n const compromised = key.state === CryptoKey_VersionState.COMPROMISED;\n const corroboratedBy = compromised ? corroborationOf(input, key, payload, decisionPayloadDigest) : undefined;\n const corroborated = !compromised || corroboratedBy !== undefined;\n return {\n valid,\n failures,\n provable: valid && corroborated,\n ...(corroboratedBy ? { corroboratedBy } : {}),\n kid,\n keyState: key.state,\n claims,\n iss,\n ...(iat !== undefined ? { iat, signingWindowSeconds: Math.max(0, iat - claims.decidedAt) } : {}),\n lateSeal,\n decisionPayloadDigest,\n ...(approver ? { approver } : {}),\n ...(requester ? { requester } : {}),\n ...(presentation ? { presentation } : {}),\n ...(statement ? { statement } : {}),\n ...(deliverableFile ? { deliverableFile } : {}),\n ...(manifestedCopy ? { manifestedCopy } : {}),\n };\n}\n\n/** A verification key as an export or a CLI file states it (dates as ISO strings): the one shape of a key record. */\nexport const ApprovalSealVerificationKeySchema = VerificationKeyRecordSchema;\n\n/**\n * Evidence recorded outside the application that a decision's payload existed before a key's compromise, as the file an\n * operator keeps it in (`wildo seal verify --corroboration <file>`).\n */\nexport const ApprovalSealCorroborationSchema = z.object({ decisionPayloadDigest: z.string().min(1), recordedAt: z.string().min(1) });\n\n/**\n * What `wildo seal verify` reads: one seal and everything it needs to verify, offline. A bundle is what the HOST exports,\n * so it carries no pin set, no signing-log exports and no corroboration: each is evidence against the host, and reaches\n * the verifier only from the operator's own files (`ApprovalSealVerificationInput.pins` / `signingLogExports` /\n * `corroboration`). The schema is not strict, so a bundle naming any of them has it stripped on parse rather than\n * believed (#2932 review H1, R1).\n */\nexport const ApprovalSealVerificationBundleSchema = z.object({\n jws: z.string().min(1),\n keys: z.array(ApprovalSealVerificationKeySchema).min(1),\n expectedIssuer: z.string().min(1).optional(),\n disclosures: z.array(z.object({ claimName: z.enum(ApprovalSealDisclosureClaim), salt: z.string().min(1), value: z.record(z.string(), z.unknown()) })).optional(),\n /** The committed claims an erasure removed from the host's row (#2924): see `ApprovalSealVerificationInput.erasedClaims`. */\n erasedClaims: z.array(z.enum(ApprovalSealDisclosureClaim)).optional(),\n /**\n * The file deliverable the seal attests (#2904): its id and the salt its row kept. Never the bytes, which the verifier\n * is given from the file itself (`--deliverable`), and never the clear hash.\n */\n deliverableFile: z.object({ fileId: z.string().min(1), salt: z.string().min(1) }).optional(),\n /**\n * The deliverable's manifested copy (#2907): its file id, or `contentErased` when the approver's erasure deleted it.\n * Never its bytes, which the verifier is given from the file itself (`--manifested-copy`).\n */\n manifestedCopy: z.object({ fileId: z.string().min(1).optional(), contentSha256: z.string().regex(/^[0-9a-f]{64}$/).optional(), contentErased: z.literal(true).optional() })\n .refine((copy) => (copy.fileId === undefined) !== (copy.contentErased === undefined), { message: 'A manifested copy is named by its file id, or stated erased: exactly one of the two' })\n .optional(),\n});\nexport type ApprovalSealVerificationBundle = z.infer<typeof ApprovalSealVerificationBundleSchema>;\n"]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ApprovalPresentationProvenance, ApprovalSealMeaning, ApprovalSource, AuthMethod, HumanDecision_AnswerChannel, HumanDecision_DeciderKind, HumanDecision_RequesterKind } from '@wildo-ai/saas-models';
|
|
3
|
+
/**
|
|
4
|
+
* # The approval seal's claims, version 1 (#2903)
|
|
5
|
+
*
|
|
6
|
+
* The shape is fixed once seals exist: a seal made today must verify, and read the same, for as long as its record is
|
|
7
|
+
* kept. A change is a new version (`v`), never an edit of this one. The application builds and checks these claims at
|
|
8
|
+
* commit; the custodian (#2891) checks only what it decides on (`jti`, `decidedAt`, `tenant`) and signs the rest as
|
|
9
|
+
* committed, under the decision-payload digest; the offline verifier checks all of it.
|
|
10
|
+
*
|
|
11
|
+
* ## No person in clear
|
|
12
|
+
*
|
|
13
|
+
* No personal value and no deterministic pseudonym is in the payload. Each person (the approver, and a requester who is
|
|
14
|
+
* a person) appears ONLY as the digest of one salted disclosure, in the SD-JWT disclosure form: SHA-256 over the base64url
|
|
15
|
+
* of the JSON array `[salt, claimName, value]`. The claim name is inside the digest, so a disclosure cannot be replayed
|
|
16
|
+
* into another slot. The disclosure, salt and value included, is kept on the seal's row.
|
|
17
|
+
*
|
|
18
|
+
* spec-cite: N/A — the disclosure form is SD-JWT's (RFC 9901 §4.2.1, salted array), reproduced from its structure rather
|
|
19
|
+
* than quoted; the digest here is over the RFC 8785 canonical form of the array so it can be rebuilt from stored fields.
|
|
20
|
+
*/
|
|
21
|
+
export declare const APPROVAL_SEAL_CLAIMS_VERSION = 1;
|
|
22
|
+
/** The claim names a disclosure may stand for. */
|
|
23
|
+
export declare enum ApprovalSealDisclosureClaim {
|
|
24
|
+
/** The person who decided: printed name, reference, authentication time, session reference, any assertion. */
|
|
25
|
+
APPROVER = "approver",
|
|
26
|
+
/** The person who asked, when a person asked. */
|
|
27
|
+
REQUESTER = "requester",
|
|
28
|
+
/**
|
|
29
|
+
* What the person was shown (#2903 S6): the decision's presentation, its wording and the values decided on. Salted like a
|
|
30
|
+
* person's disclosure, so a seal shared alone cannot confirm a guessed presentation. Kept with the seal when a person
|
|
31
|
+
* is erased: it is the record of what was decided on, not a fact about the person who decided.
|
|
32
|
+
*/
|
|
33
|
+
PRESENTATION = "presentation",
|
|
34
|
+
/** What the person answered (#2903 S6): the option, the values, the arguments they authored, the reason code. */
|
|
35
|
+
STATEMENT = "statement"
|
|
36
|
+
}
|
|
37
|
+
/** The decider's context, as #2905 records it, minus anything that would identify the person (their link id, session). */
|
|
38
|
+
export declare const ApprovalSealDeciderClaimsSchema: z.ZodObject<{
|
|
39
|
+
kind: z.ZodEnum<typeof HumanDecision_DeciderKind>;
|
|
40
|
+
channel: z.ZodEnum<typeof HumanDecision_AnswerChannel>;
|
|
41
|
+
act: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
clientId: z.ZodString;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
authTime: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
amr: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
|
+
stepUpMethod: z.ZodOptional<z.ZodEnum<typeof AuthMethod>>;
|
|
47
|
+
stepUpAt: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
stepUpUserVerified: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
inboundSourceKey: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
/** Who asked. A machine is named by kind only; a person by their disclosure. */
|
|
52
|
+
export declare const ApprovalSealRequesterClaimsSchema: z.ZodObject<{
|
|
53
|
+
kind: z.ZodEnum<typeof HumanDecision_RequesterKind>;
|
|
54
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
55
|
+
disclosure: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
/** The approval seal's claims, version 1: everything but what the custodian sets (`iss`, `iat`, `kid`, `typ`, `lateSeal`). */
|
|
58
|
+
export declare const ApprovalSealClaimsV1Schema: z.ZodObject<{
|
|
59
|
+
v: z.ZodLiteral<1>;
|
|
60
|
+
jti: z.ZodString;
|
|
61
|
+
source: z.ZodEnum<typeof ApprovalSource>;
|
|
62
|
+
decisionRef: z.ZodString;
|
|
63
|
+
step: z.ZodNumber;
|
|
64
|
+
sequence: z.ZodNumber;
|
|
65
|
+
supersedes: z.ZodOptional<z.ZodString>;
|
|
66
|
+
tenant: z.ZodString;
|
|
67
|
+
subject: z.ZodObject<{
|
|
68
|
+
resourceType: z.ZodString;
|
|
69
|
+
resourceId: z.ZodString;
|
|
70
|
+
presentationSchemaVersion: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
presentation: z.ZodOptional<z.ZodObject<{
|
|
73
|
+
id: z.ZodOptional<z.ZodString>;
|
|
74
|
+
provenance: z.ZodEnum<typeof ApprovalPresentationProvenance>;
|
|
75
|
+
digest: z.ZodString;
|
|
76
|
+
}, z.core.$strict>>;
|
|
77
|
+
statementDigest: z.ZodOptional<z.ZodString>;
|
|
78
|
+
meaning: z.ZodEnum<typeof ApprovalSealMeaning>;
|
|
79
|
+
outcome: z.ZodEnum<{
|
|
80
|
+
accepted: import("@wildo-ai/saas-models").HumanDecision_Outcome.ACCEPTED;
|
|
81
|
+
accepted_with_modifications: import("@wildo-ai/saas-models").HumanDecision_Outcome.ACCEPTED_WITH_MODIFICATIONS;
|
|
82
|
+
rejected: import("@wildo-ai/saas-models").HumanDecision_Outcome.REJECTED;
|
|
83
|
+
}>;
|
|
84
|
+
decidedAt: z.ZodNumber;
|
|
85
|
+
decider: z.ZodObject<{
|
|
86
|
+
kind: z.ZodEnum<typeof HumanDecision_DeciderKind>;
|
|
87
|
+
channel: z.ZodEnum<typeof HumanDecision_AnswerChannel>;
|
|
88
|
+
act: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
clientId: z.ZodString;
|
|
90
|
+
}, z.core.$strict>>;
|
|
91
|
+
authTime: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
amr: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
93
|
+
stepUpMethod: z.ZodOptional<z.ZodEnum<typeof AuthMethod>>;
|
|
94
|
+
stepUpAt: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
stepUpUserVerified: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
inboundSourceKey: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, z.core.$strict>;
|
|
98
|
+
requester: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
kind: z.ZodEnum<typeof HumanDecision_RequesterKind>;
|
|
100
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
101
|
+
disclosure: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, z.core.$strict>>;
|
|
103
|
+
approver: z.ZodString;
|
|
104
|
+
}, z.core.$strict>;
|
|
105
|
+
export type ApprovalSealClaimsV1 = z.infer<typeof ApprovalSealClaimsV1Schema>;
|
|
106
|
+
/** One disclosure, as stored on the seal's row. */
|
|
107
|
+
export interface ApprovalSealDisclosureValue {
|
|
108
|
+
readonly claimName: ApprovalSealDisclosureClaim;
|
|
109
|
+
readonly salt: string;
|
|
110
|
+
readonly value: Readonly<Record<string, unknown>>;
|
|
111
|
+
}
|
|
112
|
+
/** A fresh disclosure salt: 128 bits from the CSPRNG, base64url. Never reused. */
|
|
113
|
+
export declare function newApprovalSealDisclosureSalt(): string;
|
|
114
|
+
/** The disclosure's encoded form: base64url of the RFC 8785 canonical JSON array `[salt, claimName, value]`. */
|
|
115
|
+
export declare function encodeApprovalSealDisclosure(disclosure: ApprovalSealDisclosureValue): string;
|
|
116
|
+
/** The commitment a payload carries for a disclosure: base64url SHA-256 of its encoded form. */
|
|
117
|
+
export declare function approvalSealDisclosureDigestOf(disclosure: ApprovalSealDisclosureValue): string;
|
|
118
|
+
/** A new seal id: 128 bits, base64url. */
|
|
119
|
+
export declare function newApprovalSealJti(): string;
|
|
120
|
+
/**
|
|
121
|
+
* The commitment a seal binds a FILE deliverable by (#2904, the form #2903's design names): base64url SHA-256 of the ASCII
|
|
122
|
+
* string `salt + contentSha256`, the salt base64url and the hash the file's lowercase hex SHA-256. The presentation carries
|
|
123
|
+
* the commitment and the seal's row the salt, so the clear hash stays in the file's metadata: a JWS, or a presentation,
|
|
124
|
+
* shared without the salt cannot be used to confirm a guessed document. Given the file's bytes and the salt, anyone can
|
|
125
|
+
* recompute it, and one changed byte changes it.
|
|
126
|
+
*/
|
|
127
|
+
export declare function approvalSealFileCommitmentOf(salt: string, contentSha256: string): string;
|
|
128
|
+
//# sourceMappingURL=approval-seal.contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-seal.contracts.d.ts","sourceRoot":"","sources":["../../../src/key-management/approval-seal.contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,EAEnB,cAAc,EACd,UAAU,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,uBAAuB,CAAC;AAI/B;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C,kDAAkD;AAClD,oBAAY,2BAA2B;IACrC,8GAA8G;IAC9G,QAAQ,aAAa;IACrB,iDAAiD;IACjD,SAAS,cAAc;IACvB;;;;OAIG;IACH,YAAY,iBAAiB;IAC7B,iHAAiH;IACjH,SAAS,cAAc;CACxB;AAKD,0HAA0H;AAC1H,eAAO,MAAM,+BAA+B;;;;;;;;;;;;kBAoB1C,CAAC;AAEH,gFAAgF;AAChF,eAAO,MAAM,iCAAiC;;;;kBAK5C,CAAC;AAEH,8HAA8H;AAC9H,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmCrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,mDAAmD;AACnD,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,SAAS,EAAE,2BAA2B,C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