@mailwoman/core 11.2.0 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/api/ckan.ts +1 -1
- package/lib/api/disk-storage.ts +2 -2
- package/lib/api/ogc.ts +1 -1
- package/lib/api/retry.ts +7 -2
- package/lib/api/test/transport.ts +1 -1
- package/lib/{binary-frame.ts → asset/binary-frame.ts} +1 -1
- package/lib/async/abort.ts +100 -0
- package/lib/{memoize.ts → async/memoize.ts} +2 -2
- package/lib/{promises.ts → async/promises.ts} +1 -1
- package/lib/cloudflare/tokens.ts +1 -1
- package/lib/cloudflare/wrangler.ts +3 -3
- package/lib/crypto/digest.ts +1 -1
- package/lib/crypto/ed25519.ts +8 -0
- package/lib/crypto/node.ts +1 -1
- package/lib/data-root.ts +16 -3
- package/lib/decoder/containment.ts +4 -1
- package/lib/decoder/serialize/outline.ts +19 -6
- package/lib/decoder/types.ts +9 -1
- package/lib/env/schema.ts +5 -0
- package/lib/fs/deflate64.ts +1 -1
- package/lib/fs/lock.ts +183 -25
- package/lib/fs/readers.ts +1 -1
- package/lib/fs/writers.ts +1 -1
- package/lib/geocode/result.ts +50 -6
- package/lib/html/text.ts +2 -2
- package/lib/index.ts +0 -1
- package/lib/layers/artifact.ts +2 -2
- package/lib/layers/coverage.ts +1 -1
- package/lib/layers/manifest.ts +94 -2
- package/lib/layers/provenance.ts +246 -0
- package/lib/layers/publication.ts +4 -3
- package/lib/layers/selection.ts +2 -2
- package/lib/license/branch.ts +66 -0
- package/lib/license/configured.ts +4 -2
- package/lib/license/declaration.ts +1 -1
- package/lib/license/key/file.ts +1 -1
- package/lib/license/key.ts +148 -201
- package/lib/license/provenance.ts +193 -0
- package/lib/license/register.ts +7 -78
- package/lib/license/stamp.ts +8 -2
- package/lib/license/text-url.ts +55 -0
- package/lib/license/training.ts +67 -0
- package/lib/license.ts +7 -6
- package/lib/locale/registry.ts +1 -1
- package/lib/locale/zh-cn-units.ts +1 -1
- package/lib/module/workspace.ts +1 -1
- package/lib/{routing.ts → network/routing.ts} +1 -1
- package/lib/pipeline/result.ts +6 -25
- package/lib/pipeline/runtime-pipeline.ts +129 -144
- package/lib/pipeline/stage.ts +290 -0
- package/lib/pipeline/types.ts +33 -14
- package/lib/pipeline.ts +14 -2
- package/lib/{git.ts → repo/git.ts} +21 -1
- package/lib/{release-config.ts → repo/release-config.ts} +8 -0
- package/lib/{spdx-header.ts → repo/spdx-header.ts} +8 -0
- package/lib/{workspaces.ts → repo/workspaces.ts} +1 -1
- package/lib/resolver/lookup-types.ts +1 -1
- package/lib/resolver/region-database-provider.ts +33 -0
- package/lib/resolver/synthetic-id-ranges.ts +19 -9
- package/lib/resolver/types.ts +220 -7
- package/lib/resolver.ts +14 -1
- package/lib/state-machine.ts +1 -1
- package/lib/strings/python-json.ts +3 -2
- package/lib/utils/chunk-process.ts +2 -2
- package/lib/utils/geodatabase-archive.ts +1 -1
- package/lib/utils/time.ts +136 -12
- package/lib/utils.ts +4 -4
- package/out/api/ckan.js +1 -1
- package/out/api/ckan.js.map +1 -1
- package/out/api/disk-storage.d.ts.map +1 -1
- package/out/api/disk-storage.js +2 -2
- package/out/api/disk-storage.js.map +1 -1
- package/out/api/ogc.js +1 -1
- package/out/api/ogc.js.map +1 -1
- package/out/api/retry.d.ts.map +1 -1
- package/out/api/retry.js +6 -2
- package/out/api/retry.js.map +1 -1
- package/out/api/test/transport.js +1 -1
- package/out/api/test/transport.js.map +1 -1
- package/out/asset/binary-frame.d.ts.map +1 -0
- package/out/{binary-frame.js → asset/binary-frame.js} +1 -1
- package/out/asset/binary-frame.js.map +1 -0
- package/out/asset/load-ledger.d.ts.map +1 -0
- package/out/asset/load-ledger.js.map +1 -0
- package/out/asset/overture-pins.d.ts.map +1 -0
- package/out/asset/overture-pins.js.map +1 -0
- package/out/asset/postcode-prefix-files.d.ts.map +1 -0
- package/out/asset/postcode-prefix-files.js.map +1 -0
- package/out/async/abort.d.ts +57 -0
- package/out/async/abort.d.ts.map +1 -0
- package/out/async/abort.js +89 -0
- package/out/async/abort.js.map +1 -0
- package/out/async/memoize.d.ts.map +1 -0
- package/out/{memoize.js → async/memoize.js} +2 -2
- package/out/async/memoize.js.map +1 -0
- package/out/{promises.d.ts → async/promises.d.ts} +1 -1
- package/out/async/promises.d.ts.map +1 -0
- package/out/{promises.js → async/promises.js} +1 -1
- package/out/async/promises.js.map +1 -0
- package/out/cloudflare/tokens.js +1 -1
- package/out/cloudflare/tokens.js.map +1 -1
- package/out/cloudflare/wrangler.js +3 -3
- package/out/cloudflare/wrangler.js.map +1 -1
- package/out/crypto/digest.d.ts +1 -1
- package/out/crypto/digest.js +1 -1
- package/out/crypto/ed25519.d.ts +7 -0
- package/out/crypto/ed25519.d.ts.map +1 -1
- package/out/crypto/ed25519.js +7 -0
- package/out/crypto/ed25519.js.map +1 -1
- package/out/crypto/hash.d.ts.map +1 -0
- package/out/crypto/hash.js.map +1 -0
- package/out/crypto/node.js +1 -1
- package/out/crypto/node.js.map +1 -1
- package/out/data-root.d.ts +11 -3
- package/out/data-root.d.ts.map +1 -1
- package/out/data-root.js +14 -3
- package/out/data-root.js.map +1 -1
- package/out/decoder/containment.d.ts.map +1 -1
- package/out/decoder/containment.js +1 -1
- package/out/decoder/containment.js.map +1 -1
- package/out/decoder/serialize/outline.d.ts +9 -0
- package/out/decoder/serialize/outline.d.ts.map +1 -1
- package/out/decoder/serialize/outline.js +16 -6
- package/out/decoder/serialize/outline.js.map +1 -1
- package/out/decoder/types.d.ts +8 -0
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/types.js +1 -1
- package/out/decoder/types.js.map +1 -1
- package/out/env/schema.d.ts +1 -0
- package/out/env/schema.d.ts.map +1 -1
- package/out/env/schema.js +4 -0
- package/out/env/schema.js.map +1 -1
- package/out/env.d.ts +1 -0
- package/out/env.d.ts.map +1 -1
- package/out/fs/deflate64.js +1 -1
- package/out/fs/deflate64.js.map +1 -1
- package/out/fs/lock.d.ts +73 -4
- package/out/fs/lock.d.ts.map +1 -1
- package/out/fs/lock.js +96 -19
- package/out/fs/lock.js.map +1 -1
- package/out/fs/readers.js +1 -1
- package/out/fs/readers.js.map +1 -1
- package/out/fs/writers.d.ts +1 -1
- package/out/fs/writers.d.ts.map +1 -1
- package/out/fs/writers.js +1 -1
- package/out/fs/writers.js.map +1 -1
- package/out/geocode/result.d.ts +25 -1
- package/out/geocode/result.d.ts.map +1 -1
- package/out/geocode/result.js +49 -6
- package/out/geocode/result.js.map +1 -1
- package/out/html/text.js +2 -2
- package/out/html/trust-policies.d.ts.map +1 -0
- package/out/html/trust-policies.js.map +1 -0
- package/out/index.d.ts +0 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +0 -1
- package/out/index.js.map +1 -1
- package/out/layers/artifact.js +2 -2
- package/out/layers/artifact.js.map +1 -1
- package/out/layers/coverage.d.ts.map +1 -1
- package/out/layers/coverage.js +1 -1
- package/out/layers/coverage.js.map +1 -1
- package/out/layers/manifest.d.ts +53 -0
- package/out/layers/manifest.d.ts.map +1 -1
- package/out/layers/manifest.js +68 -2
- package/out/layers/manifest.js.map +1 -1
- package/out/layers/provenance.d.ts +127 -0
- package/out/layers/provenance.d.ts.map +1 -0
- package/out/layers/provenance.js +122 -0
- package/out/layers/provenance.js.map +1 -0
- package/out/layers/publication.d.ts.map +1 -1
- package/out/layers/publication.js +3 -3
- package/out/layers/publication.js.map +1 -1
- package/out/layers/selection.d.ts.map +1 -1
- package/out/layers/selection.js +2 -2
- package/out/layers/selection.js.map +1 -1
- package/out/license/branch.d.ts +33 -0
- package/out/license/branch.d.ts.map +1 -0
- package/out/license/branch.js +52 -0
- package/out/license/branch.js.map +1 -0
- package/out/license/configured.d.ts +1 -1
- package/out/license/configured.d.ts.map +1 -1
- package/out/license/configured.js +1 -9
- package/out/license/configured.js.map +1 -1
- package/out/license/declaration.d.ts +1 -1
- package/out/license/declaration.d.ts.map +1 -1
- package/out/license/key/file.js +1 -1
- package/out/license/key/file.js.map +1 -1
- package/out/license/key.d.ts +27 -115
- package/out/license/key.d.ts.map +1 -1
- package/out/license/key.js +98 -164
- package/out/license/key.js.map +1 -1
- package/out/license/provenance.d.ts +47 -0
- package/out/license/provenance.d.ts.map +1 -0
- package/out/license/provenance.js +134 -0
- package/out/license/provenance.js.map +1 -0
- package/out/license/register.d.ts +6 -47
- package/out/license/register.d.ts.map +1 -1
- package/out/license/register.js +7 -58
- package/out/license/register.js.map +1 -1
- package/out/license/stamp.d.ts +7 -1
- package/out/license/stamp.d.ts.map +1 -1
- package/out/license/stamp.js +2 -2
- package/out/license/stamp.js.map +1 -1
- package/out/license/text-url.d.ts +9 -0
- package/out/license/text-url.d.ts.map +1 -0
- package/out/license/text-url.js +49 -0
- package/out/license/text-url.js.map +1 -0
- package/out/license/training.d.ts +29 -0
- package/out/license/training.d.ts.map +1 -0
- package/out/license/training.js +52 -0
- package/out/license/training.js.map +1 -0
- package/out/license.d.ts +7 -6
- package/out/license.d.ts.map +1 -1
- package/out/license.js +7 -6
- package/out/license.js.map +1 -1
- package/out/locale/registry.d.ts.map +1 -1
- package/out/locale/registry.js +1 -1
- package/out/locale/registry.js.map +1 -1
- package/out/locale/zh-cn-units.js +1 -1
- package/out/locale/zh-cn-units.js.map +1 -1
- package/out/math/numeric.d.ts.map +1 -0
- package/out/math/numeric.js.map +1 -0
- package/out/math/random.d.ts.map +1 -0
- package/out/math/random.js.map +1 -0
- package/out/math/stats.d.ts.map +1 -0
- package/out/math/stats.js.map +1 -0
- package/out/module/workspace.js +1 -1
- package/out/module/workspace.js.map +1 -1
- package/out/network/routing.d.ts.map +1 -0
- package/out/{routing.js → network/routing.js} +1 -1
- package/out/network/routing.js.map +1 -0
- package/out/pipeline/result.d.ts +7 -24
- package/out/pipeline/result.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts +7 -2
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +56 -103
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/stage.d.ts +180 -0
- package/out/pipeline/stage.d.ts.map +1 -0
- package/out/pipeline/stage.js +130 -0
- package/out/pipeline/stage.js.map +1 -0
- package/out/pipeline/types.d.ts +31 -12
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +0 -8
- package/out/pipeline/types.js.map +1 -1
- package/out/pipeline.d.ts +5 -3
- package/out/pipeline.d.ts.map +1 -1
- package/out/pipeline.js +2 -1
- package/out/pipeline.js.map +1 -1
- package/out/{git.d.ts → repo/git.d.ts} +10 -1
- package/out/repo/git.d.ts.map +1 -0
- package/out/{git.js → repo/git.js} +14 -1
- package/out/repo/git.js.map +1 -0
- package/out/{release-config.d.ts → repo/release-config.d.ts} +8 -0
- package/out/repo/release-config.d.ts.map +1 -0
- package/out/repo/release-config.js.map +1 -0
- package/out/repo/scope-config.d.ts.map +1 -0
- package/out/repo/scope-config.js.map +1 -0
- package/out/repo/spdx-header.d.ts.map +1 -0
- package/out/{spdx-header.js → repo/spdx-header.js} +7 -0
- package/out/repo/spdx-header.js.map +1 -0
- package/out/repo/vale.d.ts.map +1 -0
- package/out/repo/vale.js.map +1 -0
- package/out/repo/workspaces.d.ts.map +1 -0
- package/out/{workspaces.js → repo/workspaces.js} +1 -1
- package/out/repo/workspaces.js.map +1 -0
- package/out/resolver/lookup-types.d.ts +1 -1
- package/out/resolver/region-database-provider.d.ts +30 -0
- package/out/resolver/region-database-provider.d.ts.map +1 -1
- package/out/resolver/synthetic-id-ranges.d.ts +15 -8
- package/out/resolver/synthetic-id-ranges.d.ts.map +1 -1
- package/out/resolver/synthetic-id-ranges.js +18 -9
- package/out/resolver/synthetic-id-ranges.js.map +1 -1
- package/out/resolver/types.d.ts +192 -8
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +56 -0
- package/out/resolver/types.js.map +1 -1
- package/out/resolver.d.ts +3 -3
- package/out/resolver.d.ts.map +1 -1
- package/out/resolver.js +1 -1
- package/out/resolver.js.map +1 -1
- package/out/scripting/process.d.ts.map +1 -0
- package/out/scripting/process.js.map +1 -0
- package/out/scripting/workers.d.ts.map +1 -0
- package/out/scripting/workers.js.map +1 -0
- package/out/state-machine.d.ts +1 -1
- package/out/strings/python-json.d.ts +2 -1
- package/out/strings/python-json.d.ts.map +1 -1
- package/out/strings/python-json.js +1 -1
- package/out/strings/python-json.js.map +1 -1
- package/out/tools/build-deflate64-wasm.run.js +2 -2
- package/out/tools/build-deflate64-wasm.run.js.map +1 -1
- package/out/tools/coarse-placer/build/dataset.js +1 -1
- package/out/tools/coarse-placer/build/dataset.js.map +1 -1
- package/out/tools/coarse-placer/build/outlier/exposure.js +1 -1
- package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -1
- package/out/tools/coarse-placer/build/outlier/latin.d.ts.map +1 -1
- package/out/tools/coarse-placer/build/outlier/latin.js +5 -1
- package/out/tools/coarse-placer/build/outlier/latin.js.map +1 -1
- package/out/tools/coarse-placer/country-sets.d.ts +2 -2
- package/out/tools/coarse-placer/country-sets.js +2 -2
- package/out/tools/coarse-placer/outlier-rows.js +2 -2
- package/out/tools/coarse-placer/outlier-rows.js.map +1 -1
- package/out/tools/coarse-placer/train.js +1 -1
- package/out/tools/coarse-placer/train.js.map +1 -1
- package/out/tools/generate-language-types.js +2 -2
- package/out/tools/generate-language-types.js.map +1 -1
- package/out/tools/license/product-fixtures.run.d.ts +2 -0
- package/out/tools/license/product-fixtures.run.d.ts.map +1 -0
- package/out/tools/license/product-fixtures.run.js +350 -0
- package/out/tools/license/product-fixtures.run.js.map +1 -0
- package/out/utils/chunk-process.js +2 -2
- package/out/utils/chunk-process.js.map +1 -1
- package/out/utils/geodatabase-archive.js +1 -1
- package/out/utils/geodatabase-archive.js.map +1 -1
- package/out/utils/time.d.ts +15 -4
- package/out/utils/time.d.ts.map +1 -1
- package/out/utils/time.js +114 -12
- package/out/utils/time.js.map +1 -1
- package/out/utils.d.ts +4 -4
- package/out/utils.d.ts.map +1 -1
- package/out/utils.js +4 -4
- package/out/utils.js.map +1 -1
- package/out/values/identical.d.ts.map +1 -0
- package/out/values/identical.js.map +1 -0
- package/out/values/json.d.ts.map +1 -0
- package/out/values/json.js.map +1 -0
- package/out/values/objects.d.ts.map +1 -0
- package/out/values/objects.js.map +1 -0
- package/package.json +278 -243
- package/tools/build-deflate64-wasm.run.ts +2 -2
- package/tools/coarse-placer/build/dataset.ts +1 -1
- package/tools/coarse-placer/build/outlier/exposure.ts +1 -1
- package/tools/coarse-placer/build/outlier/latin.ts +5 -1
- package/tools/coarse-placer/country-sets.ts +2 -2
- package/tools/coarse-placer/outlier-rows.ts +2 -2
- package/tools/coarse-placer/train.ts +1 -1
- package/tools/generate-language-types.ts +2 -2
- package/tools/license/product-fixtures.run.ts +449 -0
- package/lib/collections.ts +0 -5
- package/lib/license/decision.ts +0 -329
- package/lib/license/obligations.ts +0 -256
- package/lib/license/record.ts +0 -277
- package/lib/scripting/ingest-chunk-script.ts +0 -87
- package/out/binary-frame.d.ts.map +0 -1
- package/out/binary-frame.js.map +0 -1
- package/out/collections.d.ts +0 -2
- package/out/collections.d.ts.map +0 -1
- package/out/collections.js +0 -5
- package/out/collections.js.map +0 -1
- package/out/git.d.ts.map +0 -1
- package/out/git.js.map +0 -1
- package/out/hash.d.ts.map +0 -1
- package/out/hash.js.map +0 -1
- package/out/identical.d.ts.map +0 -1
- package/out/identical.js.map +0 -1
- package/out/json.d.ts.map +0 -1
- package/out/json.js.map +0 -1
- package/out/license/decision.d.ts +0 -179
- package/out/license/decision.d.ts.map +0 -1
- package/out/license/decision.js +0 -169
- package/out/license/decision.js.map +0 -1
- package/out/license/obligations.d.ts +0 -102
- package/out/license/obligations.d.ts.map +0 -1
- package/out/license/obligations.js +0 -188
- package/out/license/obligations.js.map +0 -1
- package/out/license/record.d.ts +0 -136
- package/out/license/record.d.ts.map +0 -1
- package/out/license/record.js +0 -222
- package/out/license/record.js.map +0 -1
- package/out/load-ledger.d.ts.map +0 -1
- package/out/load-ledger.js.map +0 -1
- package/out/memoize.d.ts.map +0 -1
- package/out/memoize.js.map +0 -1
- package/out/numeric.d.ts.map +0 -1
- package/out/numeric.js.map +0 -1
- package/out/objects.d.ts.map +0 -1
- package/out/objects.js.map +0 -1
- package/out/overture-pins.d.ts.map +0 -1
- package/out/overture-pins.js.map +0 -1
- package/out/postcode-prefix-files.d.ts.map +0 -1
- package/out/postcode-prefix-files.js.map +0 -1
- package/out/process.d.ts.map +0 -1
- package/out/process.js.map +0 -1
- package/out/promises.d.ts.map +0 -1
- package/out/promises.js.map +0 -1
- package/out/random.d.ts.map +0 -1
- package/out/random.js.map +0 -1
- package/out/release-config.d.ts.map +0 -1
- package/out/release-config.js.map +0 -1
- package/out/routing.d.ts.map +0 -1
- package/out/routing.js.map +0 -1
- package/out/scope-config.d.ts.map +0 -1
- package/out/scope-config.js.map +0 -1
- package/out/scripting/ingest-chunk-script.d.ts +0 -58
- package/out/scripting/ingest-chunk-script.d.ts.map +0 -1
- package/out/scripting/ingest-chunk-script.js +0 -47
- package/out/scripting/ingest-chunk-script.js.map +0 -1
- package/out/spdx-header.d.ts.map +0 -1
- package/out/spdx-header.js.map +0 -1
- package/out/stats.d.ts.map +0 -1
- package/out/stats.js.map +0 -1
- package/out/trust-policies.d.ts.map +0 -1
- package/out/trust-policies.js.map +0 -1
- package/out/vale.d.ts.map +0 -1
- package/out/vale.js.map +0 -1
- package/out/workers.d.ts.map +0 -1
- package/out/workers.js.map +0 -1
- package/out/workspaces.d.ts.map +0 -1
- package/out/workspaces.js.map +0 -1
- /package/lib/{load-ledger.ts → asset/load-ledger.ts} +0 -0
- /package/lib/{overture-pins.ts → asset/overture-pins.ts} +0 -0
- /package/lib/{postcode-prefix-files.ts → asset/postcode-prefix-files.ts} +0 -0
- /package/lib/{hash.ts → crypto/hash.ts} +0 -0
- /package/lib/{trust-policies.ts → html/trust-policies.ts} +0 -0
- /package/lib/{numeric.ts → math/numeric.ts} +0 -0
- /package/lib/{random.ts → math/random.ts} +0 -0
- /package/lib/{stats.ts → math/stats.ts} +0 -0
- /package/lib/{scope-config.ts → repo/scope-config.ts} +0 -0
- /package/lib/{vale.ts → repo/vale.ts} +0 -0
- /package/lib/{process.ts → scripting/process.ts} +0 -0
- /package/lib/{workers.ts → scripting/workers.ts} +0 -0
- /package/lib/{identical.ts → values/identical.ts} +0 -0
- /package/lib/{json.ts → values/json.ts} +0 -0
- /package/lib/{objects.ts → values/objects.ts} +0 -0
- /package/out/{binary-frame.d.ts → asset/binary-frame.d.ts} +0 -0
- /package/out/{load-ledger.d.ts → asset/load-ledger.d.ts} +0 -0
- /package/out/{load-ledger.js → asset/load-ledger.js} +0 -0
- /package/out/{overture-pins.d.ts → asset/overture-pins.d.ts} +0 -0
- /package/out/{overture-pins.js → asset/overture-pins.js} +0 -0
- /package/out/{postcode-prefix-files.d.ts → asset/postcode-prefix-files.d.ts} +0 -0
- /package/out/{postcode-prefix-files.js → asset/postcode-prefix-files.js} +0 -0
- /package/out/{memoize.d.ts → async/memoize.d.ts} +0 -0
- /package/out/{hash.d.ts → crypto/hash.d.ts} +0 -0
- /package/out/{hash.js → crypto/hash.js} +0 -0
- /package/out/{trust-policies.d.ts → html/trust-policies.d.ts} +0 -0
- /package/out/{trust-policies.js → html/trust-policies.js} +0 -0
- /package/out/{numeric.d.ts → math/numeric.d.ts} +0 -0
- /package/out/{numeric.js → math/numeric.js} +0 -0
- /package/out/{random.d.ts → math/random.d.ts} +0 -0
- /package/out/{random.js → math/random.js} +0 -0
- /package/out/{stats.d.ts → math/stats.d.ts} +0 -0
- /package/out/{stats.js → math/stats.js} +0 -0
- /package/out/{routing.d.ts → network/routing.d.ts} +0 -0
- /package/out/{release-config.js → repo/release-config.js} +0 -0
- /package/out/{scope-config.d.ts → repo/scope-config.d.ts} +0 -0
- /package/out/{scope-config.js → repo/scope-config.js} +0 -0
- /package/out/{spdx-header.d.ts → repo/spdx-header.d.ts} +0 -0
- /package/out/{vale.d.ts → repo/vale.d.ts} +0 -0
- /package/out/{vale.js → repo/vale.js} +0 -0
- /package/out/{workspaces.d.ts → repo/workspaces.d.ts} +0 -0
- /package/out/{process.d.ts → scripting/process.d.ts} +0 -0
- /package/out/{process.js → scripting/process.js} +0 -0
- /package/out/{workers.d.ts → scripting/workers.d.ts} +0 -0
- /package/out/{workers.js → scripting/workers.js} +0 -0
- /package/out/{identical.d.ts → values/identical.d.ts} +0 -0
- /package/out/{identical.js → values/identical.js} +0 -0
- /package/out/{json.d.ts → values/json.d.ts} +0 -0
- /package/out/{json.js → values/json.js} +0 -0
- /package/out/{objects.d.ts → values/objects.d.ts} +0 -0
- /package/out/{objects.js → values/objects.js} +0 -0
package/out/license/key.js
CHANGED
|
@@ -1,198 +1,115 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
3
|
/**
|
|
4
|
-
* Encodes and verifies offline
|
|
4
|
+
* Encodes and verifies Mailwoman's offline product tokens: platform license keys
|
|
5
|
+
* (`mwl1`) and commercial training grants (`mwt1`).
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* `@mailwoman/license/product/token` defines the wire format and payload schemas,
|
|
8
|
+
* and `@mailwoman/license/product/trust` holds the trusted public keys.
|
|
9
|
+
* This module adds the Ed25519 signatures, on WebCrypto, so it runs in Node, browsers and Workers.
|
|
8
10
|
*
|
|
9
|
-
* The
|
|
11
|
+
* The Rust verifier in `packages/license/crates/product-license` reads the
|
|
12
|
+
* same fixtures and returns the same statuses.
|
|
10
13
|
*/
|
|
11
|
-
import {
|
|
12
|
-
import { fromBase64URL, toBase64URL, utf8Bytes
|
|
14
|
+
import { LICENSE_KEY_PREFIX, LicenseKeyPayloadSchema, licenseExpiryInstant, schemaIssue, splitProductToken, TRAINING_GRANT_PREFIX, TrainingGrantPayloadSchema, } from "@mailwoman/license/product/token";
|
|
15
|
+
import { fromBase64URL, toBase64URL, utf8Bytes } from "#crypto/base64url";
|
|
13
16
|
import { hexOf, sha256Bytes } from "#crypto/digest";
|
|
14
|
-
import { generateEd25519KeyPair, publicKeyDER, signEd25519, verifyEd25519 } from "#crypto/ed25519";
|
|
15
|
-
import {
|
|
16
|
-
import { parseJSONStrict, stringifyJSON } from "#json";
|
|
17
|
+
import { ED25519_SIGNATURE_BYTES, generateEd25519KeyPair, publicKeyDER, signEd25519, verifyEd25519, } from "#crypto/ed25519";
|
|
18
|
+
import { stringifyJSON } from "#values/json";
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
export const LICENSE_KEY_PREFIX = "mwl1";
|
|
21
|
-
/**
|
|
22
|
-
* The number of dot-separated parts in a token.
|
|
23
|
-
*/
|
|
24
|
-
const LICENSE_KEY_PARTS = 3;
|
|
25
|
-
/**
|
|
26
|
-
* A calendar date in `YYYY-MM-DD` format.
|
|
27
|
-
*/
|
|
28
|
-
const CalendarDate = z.string().regex(/^\d{4}-\d{2}-\d{2}$/u, "expected YYYY-MM-DD");
|
|
29
|
-
/**
|
|
30
|
-
* The two branches of the dual license a token can grant.
|
|
31
|
-
*
|
|
32
|
-
* A commercial token releases the holder from the AGPL source offer.
|
|
33
|
-
* An open-source token grants artifact access and leaves every AGPL obligation in place.
|
|
20
|
+
* Generates a new Ed25519 signing key pair.
|
|
34
21
|
*/
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
22
|
+
export function generateLicenseSigningKeyPair() {
|
|
23
|
+
return generateEd25519KeyPair();
|
|
24
|
+
}
|
|
39
25
|
/**
|
|
40
|
-
*
|
|
26
|
+
* Builds a key ID from a one-letter use, the product major version and the first
|
|
27
|
+
* eight hex digits of the DER key's SHA-256.
|
|
41
28
|
*
|
|
42
|
-
*
|
|
43
|
-
* `evaluation` is the thirty-day route.
|
|
44
|
-
* The other four are declarations of intent.
|
|
45
|
-
*/
|
|
46
|
-
export const LicenseIntent = {
|
|
47
|
-
OpenSource: "open-source",
|
|
48
|
-
NonProfit: "non-profit",
|
|
49
|
-
Academic: "academic",
|
|
50
|
-
Student: "student",
|
|
51
|
-
Evaluation: "evaluation",
|
|
52
|
-
Commercial: "commercial",
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* The prefix of a scope entry that's an atlas tier rather than a package.
|
|
56
|
-
*/
|
|
57
|
-
export const TIER_SCOPE_PREFIX = "tier:";
|
|
58
|
-
/**
|
|
59
|
-
* The schema of a license-key payload.
|
|
29
|
+
* A license key's use is `v`, a provenance key's `p`.
|
|
60
30
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*/
|
|
65
|
-
v: z.literal(1),
|
|
66
|
-
/**
|
|
67
|
-
* The signing key ID selects the trusted public key.
|
|
68
|
-
*/
|
|
69
|
-
kid: z.string().min(1),
|
|
70
|
-
/**
|
|
71
|
-
* The license holder's name appears in `doctor` output.
|
|
72
|
-
*/
|
|
73
|
-
licensee: z.string().min(1),
|
|
74
|
-
issued: CalendarDate,
|
|
75
|
-
/**
|
|
76
|
-
* The last valid date, inclusive.
|
|
77
|
-
* A key without it doesn't expire.
|
|
78
|
-
*/
|
|
79
|
-
expires: CalendarDate.nullable().optional(),
|
|
80
|
-
/**
|
|
81
|
-
* Either `all` or the list of packages and `tier:<name>` entries the token may download.
|
|
82
|
-
*/
|
|
83
|
-
scope: z.union([z.literal("all"), z.array(z.string().min(1)).min(1)]),
|
|
84
|
-
/**
|
|
85
|
-
* The license branch that the key grants.
|
|
86
|
-
*/
|
|
87
|
-
terms: z.enum([LicenseTerms.Commercial, LicenseTerms.OpenSource]),
|
|
88
|
-
/**
|
|
89
|
-
* An opaque serial for checking the license status online.
|
|
90
|
-
*/
|
|
91
|
-
lid: z.string().min(1).nullable().optional(),
|
|
92
|
-
/**
|
|
93
|
-
* The version of the terms that the licensee accepted.
|
|
94
|
-
* A declared token has none.
|
|
95
|
-
*/
|
|
96
|
-
agreement: z.string().min(1).nullable().optional(),
|
|
97
|
-
/**
|
|
98
|
-
* The route that issued the token.
|
|
99
|
-
* A hand-issued token has none.
|
|
100
|
-
*/
|
|
101
|
-
intent: z
|
|
102
|
-
.enum([
|
|
103
|
-
LicenseIntent.OpenSource,
|
|
104
|
-
LicenseIntent.NonProfit,
|
|
105
|
-
LicenseIntent.Academic,
|
|
106
|
-
LicenseIntent.Student,
|
|
107
|
-
LicenseIntent.Evaluation,
|
|
108
|
-
LicenseIntent.Commercial,
|
|
109
|
-
])
|
|
110
|
-
.optional(),
|
|
111
|
-
/**
|
|
112
|
-
* The issuance ordinal within the license, 1 for the first token.
|
|
113
|
-
*/
|
|
114
|
-
seq: z.number().int().min(1).optional(),
|
|
115
|
-
/**
|
|
116
|
-
* The installation id the requesting CLI reported.
|
|
117
|
-
* The token is never bound to it.
|
|
118
|
-
*/
|
|
119
|
-
install: z.uuid().optional(),
|
|
120
|
-
});
|
|
121
|
-
/**
|
|
122
|
-
* Returns whether a payload has a `lid`.
|
|
123
|
-
* The online status routes are keyed by it.
|
|
124
|
-
*/
|
|
125
|
-
export function isSelfServicePayload(payload) {
|
|
126
|
-
return typeof payload.lid === "string";
|
|
31
|
+
async function keyID(publicKeyPEM, majorVersion, use) {
|
|
32
|
+
const digest = hexOf(await sha256Bytes(publicKeyDER(publicKeyPEM))).slice(0, 8);
|
|
33
|
+
return `${use}${majorVersion}-${digest}`;
|
|
127
34
|
}
|
|
128
35
|
/**
|
|
129
|
-
*
|
|
130
|
-
* An artifact is a package name or a `tier:<name>` entry.
|
|
36
|
+
* The key ID of a license signing key: `v<major>-<eight hex digits>`.
|
|
131
37
|
*/
|
|
132
|
-
export function
|
|
133
|
-
return
|
|
38
|
+
export function licenseKeyID(publicKeyPEM, majorVersion) {
|
|
39
|
+
return keyID(publicKeyPEM, majorVersion, "v");
|
|
134
40
|
}
|
|
135
41
|
/**
|
|
136
|
-
*
|
|
42
|
+
* The key ID of a provenance signing key: `p<major>-<eight hex digits>`.
|
|
137
43
|
*/
|
|
138
|
-
export function
|
|
139
|
-
return
|
|
44
|
+
export function provenanceKeyID(publicKeyPEM, majorVersion) {
|
|
45
|
+
return keyID(publicKeyPEM, majorVersion, "p");
|
|
140
46
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const digest = hexOf(await sha256Bytes(publicKeyDER(publicKeyPEM))).slice(0, 8);
|
|
146
|
-
return `v${majorVersion}-${digest}`;
|
|
47
|
+
async function encodeProductToken(prefix, payload, privateKeyPEM) {
|
|
48
|
+
const body = `${prefix}.${toBase64URL(utf8Bytes(stringifyJSON(payload)))}`;
|
|
49
|
+
const signature = await signEd25519(utf8Bytes(body), privateKeyPEM);
|
|
50
|
+
return `${body}.${toBase64URL(signature)}`;
|
|
147
51
|
}
|
|
148
52
|
/**
|
|
149
|
-
* Validates a payload and signs it with the issuer's private key.
|
|
53
|
+
* Validates a platform key payload and signs it with the issuer's private key.
|
|
150
54
|
*/
|
|
151
55
|
export async function encodeLicenseKey(payload, privateKeyPEM) {
|
|
152
|
-
|
|
153
|
-
const body = `${LICENSE_KEY_PREFIX}.${toBase64URL(utf8Bytes(stringifyJSON(checked)))}`;
|
|
154
|
-
const signature = await signEd25519(utf8Bytes(body), privateKeyPEM);
|
|
155
|
-
return `${body}.${toBase64URL(signature)}`;
|
|
56
|
+
return encodeProductToken(LICENSE_KEY_PREFIX, LicenseKeyPayloadSchema.parse(payload), privateKeyPEM);
|
|
156
57
|
}
|
|
157
58
|
/**
|
|
158
|
-
*
|
|
59
|
+
* Validates a training grant payload and signs it with the issuer's private key.
|
|
159
60
|
*/
|
|
160
|
-
export function
|
|
161
|
-
return
|
|
61
|
+
export async function encodeTrainingGrant(payload, privateKeyPEM) {
|
|
62
|
+
return encodeProductToken(TRAINING_GRANT_PREFIX, TrainingGrantPayloadSchema.parse(payload), privateKeyPEM);
|
|
162
63
|
}
|
|
64
|
+
const STRICT_UTF8 = new TextDecoder("utf-8", { fatal: true });
|
|
163
65
|
/**
|
|
164
|
-
*
|
|
165
|
-
*
|
|
66
|
+
* Reads a token of one prefix without checking its signature.
|
|
67
|
+
*
|
|
68
|
+
* It checks the three parts, the payload's base64url, UTF-8 and JSON, and the payload schema, in that order.
|
|
69
|
+
* The first step that fails gives the reason.
|
|
166
70
|
*/
|
|
167
|
-
|
|
168
|
-
const parts = token
|
|
169
|
-
if (
|
|
170
|
-
return
|
|
71
|
+
function readProductToken(token, prefix, schema) {
|
|
72
|
+
const parts = splitProductToken(token);
|
|
73
|
+
if ("reason" in parts) {
|
|
74
|
+
return parts;
|
|
75
|
+
}
|
|
76
|
+
if (parts.prefix !== prefix) {
|
|
77
|
+
return { reason: `a ${parts.prefix} token, not a ${prefix} token` };
|
|
78
|
+
}
|
|
79
|
+
let text;
|
|
80
|
+
try {
|
|
81
|
+
text = STRICT_UTF8.decode(fromBase64URL(parts.payload));
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return { reason: "payload unreadable: not base64url-encoded UTF-8" };
|
|
85
|
+
}
|
|
86
|
+
let value;
|
|
171
87
|
try {
|
|
172
|
-
|
|
88
|
+
// oxlint-disable-next-line no-restricted-properties -- `parseJSONStrict` wraps the error and loses the reason the fixtures record.
|
|
89
|
+
value = JSON.parse(text);
|
|
173
90
|
}
|
|
174
91
|
catch {
|
|
175
|
-
return
|
|
92
|
+
return { reason: "payload unreadable: not JSON" };
|
|
176
93
|
}
|
|
94
|
+
const parsed = schema.safeParse(value);
|
|
95
|
+
return parsed.success
|
|
96
|
+
? { parts, payload: parsed.data }
|
|
97
|
+
: { reason: `payload unreadable: ${schemaIssue(parsed.error)}` };
|
|
177
98
|
}
|
|
178
99
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* Tests pass `now` to get a fixed clock.
|
|
100
|
+
* Decodes a token's payload without verifying its signature.
|
|
101
|
+
* Use the result only for display.
|
|
182
102
|
*/
|
|
183
|
-
export
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
payload = LicenseKeyPayloadSchema.parse(parseJSONStrict(utf8Text(fromBase64URL(payloadPart))));
|
|
192
|
-
}
|
|
193
|
-
catch (error) {
|
|
194
|
-
return { status: "invalid", reason: `payload unreadable: ${errorMessage(error)}` };
|
|
103
|
+
export function decodeLicenseKeyPayload(token) {
|
|
104
|
+
const reading = readProductToken(token, LICENSE_KEY_PREFIX, LicenseKeyPayloadSchema);
|
|
105
|
+
return "payload" in reading ? reading.payload : null;
|
|
106
|
+
}
|
|
107
|
+
async function verifyProductToken(token, prefix, schema, options) {
|
|
108
|
+
const reading = readProductToken(token, prefix, schema);
|
|
109
|
+
if ("reason" in reading) {
|
|
110
|
+
return { status: "invalid", reason: reading.reason };
|
|
195
111
|
}
|
|
112
|
+
const { parts, payload } = reading;
|
|
196
113
|
const publicKeyPEM = options.trustedKeys[payload.kid];
|
|
197
114
|
if (!publicKeyPEM) {
|
|
198
115
|
return {
|
|
@@ -201,14 +118,31 @@ export async function verifyLicenseKey(token, options) {
|
|
|
201
118
|
reason: `signed by key id ${payload.kid}, which this build does not trust`,
|
|
202
119
|
};
|
|
203
120
|
}
|
|
204
|
-
const
|
|
121
|
+
const signature = fromBase64URL(parts.signature);
|
|
122
|
+
const signed = signature.length === ED25519_SIGNATURE_BYTES &&
|
|
123
|
+
(await verifyEd25519(utf8Bytes(parts.signed), publicKeyPEM, signature));
|
|
205
124
|
if (!signed) {
|
|
206
125
|
return { status: "invalid", reason: `signature does not verify under key id ${payload.kid}` };
|
|
207
126
|
}
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
127
|
+
const expires = payload.expires;
|
|
128
|
+
const expired = expires != null && licenseExpiryInstant(expires) < (options.now ?? new Date());
|
|
129
|
+
return { status: expired ? "expired" : "valid", kid: payload.kid, payload };
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Verifies a platform license key offline against trusted public keys keyed by key ID.
|
|
133
|
+
*
|
|
134
|
+
* Tests pass `now` to get a fixed clock.
|
|
135
|
+
*/
|
|
136
|
+
export function verifyLicenseKey(token, options) {
|
|
137
|
+
return verifyProductToken(token, LICENSE_KEY_PREFIX, LicenseKeyPayloadSchema, options);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Verifies a commercial training grant offline against trusted public keys keyed by key ID.
|
|
141
|
+
*
|
|
142
|
+
* A valid grant still needs its permissions checked: {@linkcode trainingAdmission} in
|
|
143
|
+
* `@mailwoman/license/product/entitlement` checks that it permits training.
|
|
144
|
+
*/
|
|
145
|
+
export function verifyTrainingGrant(token, options) {
|
|
146
|
+
return verifyProductToken(token, TRAINING_GRANT_PREFIX, TrainingGrantPayloadSchema, options);
|
|
213
147
|
}
|
|
214
148
|
//# sourceMappingURL=key.js.map
|
package/out/license/key.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../lib/license/key.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE
|
|
1
|
+
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../lib/license/key.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;;;;GAUG;AAEH,OAAO,EACN,kBAAkB,EAElB,uBAAuB,EAEvB,oBAAoB,EAIpB,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EAErB,0BAA0B,GAE1B,MAAM,kCAAkC,CAAA;AAGzC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EACN,uBAAuB,EACvB,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,aAAa,GACb,MAA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EAAE,SAAS,CAAC,CAAC,CAAA;IAExE,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,0CAA0C,OAAO,CAAC,GAAG,EAAE,EAAE,CAAA;IAC9F,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;IAC/B,MAAM,OAAO,GAAG,OAAO,IAAI,IAAI,IAAI,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAA;IAE9F,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,CAAA;AAC5E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC/B,KAAa,EACb,OAAsE;IAEtE,OAAO,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,OAAO,CAAC,CAAA;AACvF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAClC,KAAa,EACb,OAAsE;IAEtE,OAAO,kBAAkB,CAAC,KAAK,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,OAAO,CAAC,CAAA;AAC7F,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signs and verifies model provenance manifests (`<graph>.provenance.json`).
|
|
3
|
+
*
|
|
4
|
+
* `@mailwoman/license/product/provenance` defines the manifest, its payload and the refusal codes.
|
|
5
|
+
* `trainer-export` writes and signs the manifest in Rust when it exports a graph.
|
|
6
|
+
*
|
|
7
|
+
* This module verifies it against the files beside it and the provenance keys in the shared
|
|
8
|
+
* trust register, and it signs the manifest the issuer writes for a customer-submitted model.
|
|
9
|
+
* That signature attests only to the submitted bytes.
|
|
10
|
+
*
|
|
11
|
+
* A provenance key is separate from a license key: the trust register keeps them in
|
|
12
|
+
* separate lists, and a manifest verifies only under a provenance key.
|
|
13
|
+
*/
|
|
14
|
+
import { type BoundArtifact, type ProvenanceManifest, type ProvenancePayload, type ProvenanceVerification } from "@mailwoman/license/product/provenance";
|
|
15
|
+
import { type PathBuilderLike } from "path-ts";
|
|
16
|
+
/**
|
|
17
|
+
* A provenance signing key: its key ID and its PKCS8 private half.
|
|
18
|
+
*/
|
|
19
|
+
export interface ProvenanceSigner {
|
|
20
|
+
kid: string;
|
|
21
|
+
privateKeyPEM: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Hashes each file under `directory` and returns the entries a manifest binds, in the order given.
|
|
25
|
+
*
|
|
26
|
+
* @throws When a file can't be read.
|
|
27
|
+
*/
|
|
28
|
+
export declare function bindArtifacts(directory: PathBuilderLike, paths: readonly string[]): Promise<BoundArtifact[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Validates a payload and returns its manifest, signed when a signer is given.
|
|
31
|
+
*
|
|
32
|
+
* An unsigned manifest must declare the `unattested` attestation, and a signed one must declare another.
|
|
33
|
+
*/
|
|
34
|
+
export declare function encodeProvenanceManifest(payload: ProvenancePayload, signer: ProvenanceSigner | null): Promise<ProvenanceManifest>;
|
|
35
|
+
/**
|
|
36
|
+
* Verifies a manifest file against the files beside it.
|
|
37
|
+
*
|
|
38
|
+
* It checks the manifest and payload schemas, the signature under a trusted provenance key,
|
|
39
|
+
* and each bound file's length and sha256.
|
|
40
|
+
* `requireSignature` refuses an unattested manifest.
|
|
41
|
+
* The commercial production path sets it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function verifyProvenanceManifest(manifestPath: PathBuilderLike, options?: {
|
|
44
|
+
trustedKeys?: Readonly<Record<string, string>>;
|
|
45
|
+
requireSignature?: boolean;
|
|
46
|
+
}): Promise<ProvenanceVerification>;
|
|
47
|
+
//# sourceMappingURL=provenance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../../lib/license/provenance.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACN,KAAK,aAAa,EAElB,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EAGtB,KAAK,sBAAsB,EAC3B,MAAM,uCAAuC,CAAA;AAG9C,OAAO,EAAW,KAAK,eAAe,EAAe,MAAM,SAAS,CAAA;AAQpE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,aAAa,EAAE,MAAM,CAAA;CACrB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAUlH;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC7C,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,gBAAgB,GAAG,IAAI,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CAmB7B;AAiBD;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC7C,YAAY,EAAE,eAAe,EAC7B,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC1F,OAAO,CAAC,sBAAsB,CAAC,CA2EjC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
/**
|
|
4
|
+
* Signs and verifies model provenance manifests (`<graph>.provenance.json`).
|
|
5
|
+
*
|
|
6
|
+
* `@mailwoman/license/product/provenance` defines the manifest, its payload and the refusal codes.
|
|
7
|
+
* `trainer-export` writes and signs the manifest in Rust when it exports a graph.
|
|
8
|
+
*
|
|
9
|
+
* This module verifies it against the files beside it and the provenance keys in the shared
|
|
10
|
+
* trust register, and it signs the manifest the issuer writes for a customer-submitted model.
|
|
11
|
+
* That signature attests only to the submitted bytes.
|
|
12
|
+
*
|
|
13
|
+
* A provenance key is separate from a license key: the trust register keeps them in
|
|
14
|
+
* separate lists, and a manifest verifies only under a provenance key.
|
|
15
|
+
*/
|
|
16
|
+
import { PROVENANCE_PREFIX, ProvenanceManifestSchema, ProvenancePayloadSchema, ProvenanceRefusal, } from "@mailwoman/license/product/provenance";
|
|
17
|
+
import { schemaIssue } from "@mailwoman/license/product/token";
|
|
18
|
+
import { trustedProvenanceSigningKeys } from "@mailwoman/license/product/trust";
|
|
19
|
+
import { dirname, resolvePath } from "path-ts";
|
|
20
|
+
import { fromBase64URL, toBase64URL, utf8Bytes } from "#crypto/base64url";
|
|
21
|
+
import { ED25519_SIGNATURE_BYTES, signEd25519, verifyEd25519 } from "#crypto/ed25519";
|
|
22
|
+
import { sha256Hex } from "#crypto/hash";
|
|
23
|
+
import { readLocalBuffer, readLocalTextFile } from "#fs/readers";
|
|
24
|
+
import { stringifyJSON } from "#values/json";
|
|
25
|
+
/**
|
|
26
|
+
* Hashes each file under `directory` and returns the entries a manifest binds, in the order given.
|
|
27
|
+
*
|
|
28
|
+
* @throws When a file can't be read.
|
|
29
|
+
*/
|
|
30
|
+
export async function bindArtifacts(directory, paths) {
|
|
31
|
+
const bound = [];
|
|
32
|
+
for (const path of paths) {
|
|
33
|
+
const bytes = await readLocalBuffer(resolvePath(directory, path));
|
|
34
|
+
bound.push({ path, sha256: sha256Hex(bytes), bytes: bytes.length });
|
|
35
|
+
}
|
|
36
|
+
return bound;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Validates a payload and returns its manifest, signed when a signer is given.
|
|
40
|
+
*
|
|
41
|
+
* An unsigned manifest must declare the `unattested` attestation, and a signed one must declare another.
|
|
42
|
+
*/
|
|
43
|
+
export async function encodeProvenanceManifest(payload, signer) {
|
|
44
|
+
const checked = ProvenancePayloadSchema.parse(payload);
|
|
45
|
+
if ((checked.attestation === "unattested") !== (signer == null)) {
|
|
46
|
+
throw new Error(`a manifest with attestation ${checked.attestation} must ${signer ? "not " : ""}be signed`);
|
|
47
|
+
}
|
|
48
|
+
const encoded = toBase64URL(utf8Bytes(stringifyJSON(checked)));
|
|
49
|
+
if (!signer)
|
|
50
|
+
return { format: "mailwoman-model-provenance/1", payload: encoded, kid: null, signature: null };
|
|
51
|
+
const signature = await signEd25519(utf8Bytes(`${PROVENANCE_PREFIX}.${encoded}`), signer.privateKeyPEM);
|
|
52
|
+
return {
|
|
53
|
+
format: "mailwoman-model-provenance/1",
|
|
54
|
+
payload: encoded,
|
|
55
|
+
kid: signer.kid,
|
|
56
|
+
signature: toBase64URL(signature),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function manifestRefusal(refusal, reason) {
|
|
60
|
+
return { status: "refused", refusal, reason };
|
|
61
|
+
}
|
|
62
|
+
const STRICT_UTF8 = new TextDecoder("utf-8", { fatal: true });
|
|
63
|
+
function manifestJSON(text) {
|
|
64
|
+
try {
|
|
65
|
+
// oxlint-disable-next-line no-restricted-properties -- an unreadable manifest is a refusal with a reason.
|
|
66
|
+
return JSON.parse(text);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Verifies a manifest file against the files beside it.
|
|
74
|
+
*
|
|
75
|
+
* It checks the manifest and payload schemas, the signature under a trusted provenance key,
|
|
76
|
+
* and each bound file's length and sha256.
|
|
77
|
+
* `requireSignature` refuses an unattested manifest.
|
|
78
|
+
* The commercial production path sets it.
|
|
79
|
+
*/
|
|
80
|
+
export async function verifyProvenanceManifest(manifestPath, options = {}) {
|
|
81
|
+
const manifest = ProvenanceManifestSchema.safeParse(manifestJSON(await readLocalTextFile(manifestPath)));
|
|
82
|
+
if (!manifest.success)
|
|
83
|
+
return manifestRefusal(ProvenanceRefusal.Malformed, `manifest: ${schemaIssue(manifest.error)}`);
|
|
84
|
+
let payloadText;
|
|
85
|
+
try {
|
|
86
|
+
payloadText = STRICT_UTF8.decode(fromBase64URL(manifest.data.payload));
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return manifestRefusal(ProvenanceRefusal.Malformed, "payload is not base64url-encoded UTF-8");
|
|
90
|
+
}
|
|
91
|
+
const payload = ProvenancePayloadSchema.safeParse(manifestJSON(payloadText));
|
|
92
|
+
if (!payload.success)
|
|
93
|
+
return manifestRefusal(ProvenanceRefusal.Malformed, `payload: ${schemaIssue(payload.error)}`);
|
|
94
|
+
const { kid, signature } = manifest.data;
|
|
95
|
+
if (kid == null || signature == null) {
|
|
96
|
+
if (kid != null || signature != null) {
|
|
97
|
+
return manifestRefusal(ProvenanceRefusal.Malformed, "kid and signature must be both present or both null");
|
|
98
|
+
}
|
|
99
|
+
if (payload.data.attestation !== "unattested") {
|
|
100
|
+
return manifestRefusal(ProvenanceRefusal.Unsigned, `an unsigned manifest declares attestation ${payload.data.attestation}`);
|
|
101
|
+
}
|
|
102
|
+
if (options.requireSignature)
|
|
103
|
+
return manifestRefusal(ProvenanceRefusal.Unsigned, "the manifest is unsigned");
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const publicKeyPEM = (options.trustedKeys ?? trustedProvenanceSigningKeys())[kid];
|
|
107
|
+
if (!publicKeyPEM) {
|
|
108
|
+
return manifestRefusal(ProvenanceRefusal.UnknownKey, `signed by provenance key id ${kid}, which this build does not trust`);
|
|
109
|
+
}
|
|
110
|
+
const signatureBytes = fromBase64URL(signature);
|
|
111
|
+
const signed = signatureBytes.length === ED25519_SIGNATURE_BYTES &&
|
|
112
|
+
(await verifyEd25519(utf8Bytes(`${PROVENANCE_PREFIX}.${manifest.data.payload}`), publicKeyPEM, signatureBytes));
|
|
113
|
+
if (!signed)
|
|
114
|
+
return manifestRefusal(ProvenanceRefusal.BadSignature, `signature does not verify under key id ${kid}`);
|
|
115
|
+
if (payload.data.attestation === "unattested") {
|
|
116
|
+
return manifestRefusal(ProvenanceRefusal.Malformed, "a signed manifest declares attestation unattested");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const directory = dirname(resolvePath(manifestPath));
|
|
120
|
+
for (const artifact of payload.data.artifacts) {
|
|
121
|
+
let bytes;
|
|
122
|
+
try {
|
|
123
|
+
bytes = await readLocalBuffer(resolvePath(directory, artifact.path));
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return manifestRefusal(ProvenanceRefusal.ArtifactMismatch, `${artifact.path} is missing beside the manifest`);
|
|
127
|
+
}
|
|
128
|
+
if (bytes.length !== artifact.bytes || sha256Hex(bytes) !== artifact.sha256) {
|
|
129
|
+
return manifestRefusal(ProvenanceRefusal.ArtifactMismatch, `${artifact.path} differs from the bytes the manifest binds`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return { status: "verified", kid, payload: payload.data };
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=provenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provenance.js","sourceRoot":"","sources":["../../lib/license/provenance.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;;;;;;GAYG;AAEH,OAAO,EAEN,iBAAiB,EAEjB,wBAAwB,EAExB,uBAAuB,EACvB,iBAAiB,GAEjB,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAA;AAC/E,OAAO,EAAE,OAAO,EAAwB,WAAW,EAAE,MAAM,SAAS,CAAA;AAEpE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,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E,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAA;AAC1D,CAAC"}
|
|
@@ -1,53 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
* and the well-known JSON on mailwoman.post derive from, so the two cannot disagree.
|
|
2
|
+
* The well-known JSON on mailwoman.post that publishes the license signing keys.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* -
|
|
9
|
-
* - `revoked`: compromised.
|
|
10
|
-
* Online status refuses its tokens at once.
|
|
11
|
-
* The derived trust map omits the key, so the next release stops trusting it offline.
|
|
12
|
-
*
|
|
13
|
-
* `mailwoman license register --write` regenerates the well-known file from this module.
|
|
14
|
-
* The `license-register` health check reports a mismatch between the register and the generated file.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* The three states a signing key moves through, in order.
|
|
18
|
-
* A key never moves back.
|
|
19
|
-
*/
|
|
20
|
-
export declare const LicenseKeyStatus: {
|
|
21
|
-
readonly Active: "active";
|
|
22
|
-
readonly Retired: "retired";
|
|
23
|
-
readonly Revoked: "revoked";
|
|
24
|
-
};
|
|
25
|
-
export type LicenseKeyStatus = (typeof LicenseKeyStatus)[keyof typeof LicenseKeyStatus];
|
|
26
|
-
export interface LicenseSigningKey {
|
|
27
|
-
/**
|
|
28
|
-
* `licenseKeyID(publicKeyPEM, majorVersions[0])`.
|
|
29
|
-
* The register test checks that value for every entry.
|
|
30
|
-
*/
|
|
31
|
-
kid: string;
|
|
32
|
-
publicKeyPEM: string;
|
|
33
|
-
/**
|
|
34
|
-
* The mailwoman major versions this key signs for.
|
|
35
|
-
*/
|
|
36
|
-
majorVersions: readonly number[];
|
|
37
|
-
status: LicenseKeyStatus;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Every signing key ever registered, with its current status.
|
|
41
|
-
*
|
|
42
|
-
* `mailwoman license keygen` prints the entry to add.
|
|
43
|
-
* Keys remain in this list for their full history.
|
|
44
|
-
* Their status records later changes.
|
|
45
|
-
*/
|
|
46
|
-
export declare const LICENSE_SIGNING_KEYS: readonly LicenseSigningKey[];
|
|
47
|
-
/**
|
|
48
|
-
* Key id → PEM public key for offline verification: every key that's not revoked.
|
|
4
|
+
* The keys themselves live in `@mailwoman/license/product/trust`, which reads the
|
|
5
|
+
* one trust register the TypeScript and Rust verifiers share.
|
|
6
|
+
* `mailwoman license register --write` regenerates the well-known file from it, and the
|
|
7
|
+
* `license-register` health check reports a mismatch between the register and the generated file.
|
|
49
8
|
*/
|
|
50
|
-
|
|
9
|
+
import { type LicenseKeyStatus } from "@mailwoman/license/product/trust";
|
|
51
10
|
/**
|
|
52
11
|
* The shape of the well-known file at `/.well-known/mailwoman/license-keys.json`.
|
|
53
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../lib/license/register.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../lib/license/register.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,EAAwB,KAAK,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAE9F;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,MAAM,EAAE,0BAA0B,CAAA;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,KAAK,CAAC;QACX,GAAG,EAAE,MAAM,CAAA;QACX,SAAS,EAAE,SAAS,CAAA;QACpB,SAAS,EAAE,MAAM,CAAA;QACjB,aAAa,EAAE,MAAM,EAAE,CAAA;QACvB,MAAM,EAAE,gBAAgB,CAAA;KACxB,CAAC,CAAA;CACF;AAKD,wBAAgB,oBAAoB,IAAI,oBAAoB,CAY3D"}
|