@mailwoman/core 11.1.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/arcgis.ts +194 -0
- 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 +50 -0
- package/lib/decoder/types.ts +9 -1
- package/lib/decoder.ts +1 -0
- 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 +7 -27
- package/lib/pipeline/runtime-pipeline.ts +131 -152
- package/lib/pipeline/stage.ts +290 -0
- package/lib/pipeline/types.ts +154 -20
- 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/{scope-config.ts → repo/scope-config.ts} +8 -36
- 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 +76 -4
- package/lib/resolver/types.ts +231 -6
- package/lib/resolver.ts +14 -1
- package/lib/state-machine.ts +1 -1
- package/lib/strings/python-json.ts +15 -5
- package/lib/tokenization/Span.ts +12 -0
- package/lib/utils/chunk-process.ts +2 -2
- package/lib/utils/geodatabase-archive.ts +1 -1
- package/lib/utils/time.ts +190 -6
- package/lib/utils.ts +4 -4
- package/out/api/arcgis.d.ts +76 -0
- package/out/api/arcgis.d.ts.map +1 -1
- package/out/api/arcgis.js +123 -0
- package/out/api/arcgis.js.map +1 -1
- 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 +25 -0
- package/out/decoder/serialize/outline.d.ts.map +1 -0
- package/out/decoder/serialize/outline.js +37 -0
- package/out/decoder/serialize/outline.js.map +1 -0
- 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/decoder.d.ts +1 -0
- package/out/decoder.d.ts.map +1 -1
- package/out/decoder.js +1 -0
- package/out/decoder.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 -25
- package/out/pipeline/result.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts +8 -4
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +56 -109
- 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 +146 -20
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +24 -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/{scope-config.d.ts → repo/scope-config.d.ts} +8 -23
- package/out/repo/scope-config.d.ts.map +1 -0
- package/out/{scope-config.js → repo/scope-config.js} +0 -17
- 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 +46 -4
- package/out/resolver/synthetic-id-ranges.d.ts.map +1 -1
- package/out/resolver/synthetic-id-ranges.js +66 -4
- package/out/resolver/synthetic-id-ranges.js.map +1 -1
- package/out/resolver/types.d.ts +201 -7
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +57 -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 +12 -1
- package/out/strings/python-json.d.ts.map +1 -1
- package/out/strings/python-json.js +9 -4
- package/out/strings/python-json.js.map +1 -1
- package/out/tokenization/Span.d.ts +11 -0
- package/out/tokenization/Span.d.ts.map +1 -1
- package/out/tokenization/Span.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 +46 -3
- package/out/utils/time.d.ts.map +1 -1
- package/out/utils/time.js +139 -6
- 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/{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/{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.d.ts
CHANGED
|
@@ -1,117 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Encodes and verifies offline
|
|
2
|
+
* Encodes and verifies Mailwoman's offline product tokens: platform license keys
|
|
3
|
+
* (`mwl1`) and commercial training grants (`mwt1`).
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
5
|
+
* `@mailwoman/license/product/token` defines the wire format and payload schemas,
|
|
6
|
+
* and `@mailwoman/license/product/trust` holds the trusted public keys.
|
|
7
|
+
* This module adds the Ed25519 signatures, on WebCrypto, so it runs in Node, browsers and Workers.
|
|
6
8
|
*
|
|
7
|
-
* The
|
|
9
|
+
* The Rust verifier in `packages/license/crates/product-license` reads the
|
|
10
|
+
* same fixtures and returns the same statuses.
|
|
8
11
|
*/
|
|
9
|
-
import {
|
|
10
|
-
/**
|
|
11
|
-
* The token format's version prefix.
|
|
12
|
-
*/
|
|
13
|
-
export declare const LICENSE_KEY_PREFIX = "mwl1";
|
|
14
|
-
/**
|
|
15
|
-
* The two branches of the dual license a token can grant.
|
|
16
|
-
*
|
|
17
|
-
* A commercial token releases the holder from the AGPL source offer.
|
|
18
|
-
* An open-source token grants artifact access and leaves every AGPL obligation in place.
|
|
19
|
-
*/
|
|
20
|
-
export declare const LicenseTerms: {
|
|
21
|
-
readonly Commercial: "LicenseRef-Commercial";
|
|
22
|
-
readonly OpenSource: "AGPL-3.0-only";
|
|
23
|
-
};
|
|
24
|
-
export type LicenseTerms = (typeof LicenseTerms)[keyof typeof LicenseTerms];
|
|
25
|
-
/**
|
|
26
|
-
* The route that issued a token.
|
|
27
|
-
*
|
|
28
|
-
* `commercial` is a purchase.
|
|
29
|
-
* `evaluation` is the thirty-day route.
|
|
30
|
-
* The other four are declarations of intent.
|
|
31
|
-
*/
|
|
32
|
-
export declare const LicenseIntent: {
|
|
33
|
-
readonly OpenSource: "open-source";
|
|
34
|
-
readonly NonProfit: "non-profit";
|
|
35
|
-
readonly Academic: "academic";
|
|
36
|
-
readonly Student: "student";
|
|
37
|
-
readonly Evaluation: "evaluation";
|
|
38
|
-
readonly Commercial: "commercial";
|
|
39
|
-
};
|
|
40
|
-
export type LicenseIntent = (typeof LicenseIntent)[keyof typeof LicenseIntent];
|
|
41
|
-
/**
|
|
42
|
-
* The prefix of a scope entry that's an atlas tier rather than a package.
|
|
43
|
-
*/
|
|
44
|
-
export declare const TIER_SCOPE_PREFIX = "tier:";
|
|
45
|
-
/**
|
|
46
|
-
* The schema of a license-key payload.
|
|
47
|
-
*/
|
|
48
|
-
export declare const LicenseKeyPayloadSchema: z.ZodObject<{
|
|
49
|
-
v: z.ZodLiteral<1>;
|
|
50
|
-
kid: z.ZodString;
|
|
51
|
-
licensee: z.ZodString;
|
|
52
|
-
issued: z.ZodString;
|
|
53
|
-
expires: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
-
scope: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>;
|
|
55
|
-
terms: z.ZodEnum<{
|
|
56
|
-
"AGPL-3.0-only": "AGPL-3.0-only";
|
|
57
|
-
"LicenseRef-Commercial": "LicenseRef-Commercial";
|
|
58
|
-
}>;
|
|
59
|
-
lid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
-
agreement: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
-
intent: z.ZodOptional<z.ZodEnum<{
|
|
62
|
-
academic: "academic";
|
|
63
|
-
commercial: "commercial";
|
|
64
|
-
evaluation: "evaluation";
|
|
65
|
-
"non-profit": "non-profit";
|
|
66
|
-
"open-source": "open-source";
|
|
67
|
-
student: "student";
|
|
68
|
-
}>>;
|
|
69
|
-
seq: z.ZodOptional<z.ZodNumber>;
|
|
70
|
-
install: z.ZodOptional<z.ZodUUID>;
|
|
71
|
-
}, z.core.$strip>;
|
|
72
|
-
/**
|
|
73
|
-
* A validated license-key payload.
|
|
74
|
-
*/
|
|
75
|
-
export type LicenseKeyPayload = z.infer<typeof LicenseKeyPayloadSchema>;
|
|
76
|
-
/**
|
|
77
|
-
* A payload the worker issued, identified by its serial.
|
|
78
|
-
*
|
|
79
|
-
* A purchased token also has `agreement`.
|
|
80
|
-
* A declared token has none.
|
|
81
|
-
*/
|
|
82
|
-
export type SelfServiceLicenseKeyPayload = LicenseKeyPayload & {
|
|
83
|
-
lid: string;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Returns whether a payload has a `lid`.
|
|
87
|
-
* The online status routes are keyed by it.
|
|
88
|
-
*/
|
|
89
|
-
export declare function isSelfServicePayload(payload: LicenseKeyPayload): payload is SelfServiceLicenseKeyPayload;
|
|
90
|
-
/**
|
|
91
|
-
* Returns whether a scope admits an artifact.
|
|
92
|
-
* An artifact is a package name or a `tier:<name>` entry.
|
|
93
|
-
*/
|
|
94
|
-
export declare function scopeAdmits(scope: LicenseKeyPayload["scope"], artifact: string): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* The result of verifying a token.
|
|
97
|
-
* Every failure status includes a reason.
|
|
98
|
-
*/
|
|
99
|
-
export type LicenseKeyVerification = {
|
|
100
|
-
status: "valid";
|
|
101
|
-
kid: string;
|
|
102
|
-
payload: LicenseKeyPayload;
|
|
103
|
-
} | {
|
|
104
|
-
status: "expired";
|
|
105
|
-
kid: string;
|
|
106
|
-
payload: LicenseKeyPayload;
|
|
107
|
-
} | {
|
|
108
|
-
status: "unknown_key";
|
|
109
|
-
kid: string;
|
|
110
|
-
reason: string;
|
|
111
|
-
} | {
|
|
112
|
-
status: "invalid";
|
|
113
|
-
reason: string;
|
|
114
|
-
};
|
|
12
|
+
import { type LicenseKeyPayload, type LicenseKeyVerification, type TrainingGrantPayload, type TrainingGrantVerification } from "@mailwoman/license/product/token";
|
|
115
13
|
/**
|
|
116
14
|
* An Ed25519 signing key pair with both keys PEM-encoded.
|
|
117
15
|
*/
|
|
@@ -124,24 +22,28 @@ export interface LicenseSigningKeyPair {
|
|
|
124
22
|
*/
|
|
125
23
|
export declare function generateLicenseSigningKeyPair(): Promise<LicenseSigningKeyPair>;
|
|
126
24
|
/**
|
|
127
|
-
*
|
|
25
|
+
* The key ID of a license signing key: `v<major>-<eight hex digits>`.
|
|
128
26
|
*/
|
|
129
27
|
export declare function licenseKeyID(publicKeyPEM: string, majorVersion: number): Promise<string>;
|
|
130
28
|
/**
|
|
131
|
-
*
|
|
29
|
+
* The key ID of a provenance signing key: `p<major>-<eight hex digits>`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function provenanceKeyID(publicKeyPEM: string, majorVersion: number): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Validates a platform key payload and signs it with the issuer's private key.
|
|
132
34
|
*/
|
|
133
35
|
export declare function encodeLicenseKey(payload: LicenseKeyPayload, privateKeyPEM: string): Promise<string>;
|
|
134
36
|
/**
|
|
135
|
-
*
|
|
37
|
+
* Validates a training grant payload and signs it with the issuer's private key.
|
|
136
38
|
*/
|
|
137
|
-
export declare function
|
|
39
|
+
export declare function encodeTrainingGrant(payload: TrainingGrantPayload, privateKeyPEM: string): Promise<string>;
|
|
138
40
|
/**
|
|
139
41
|
* Decodes a token's payload without verifying its signature.
|
|
140
42
|
* Use the result only for display.
|
|
141
43
|
*/
|
|
142
44
|
export declare function decodeLicenseKeyPayload(token: string): LicenseKeyPayload | null;
|
|
143
45
|
/**
|
|
144
|
-
* Verifies a
|
|
46
|
+
* Verifies a platform license key offline against trusted public keys keyed by key ID.
|
|
145
47
|
*
|
|
146
48
|
* Tests pass `now` to get a fixed clock.
|
|
147
49
|
*/
|
|
@@ -149,4 +51,14 @@ export declare function verifyLicenseKey(token: string, options: {
|
|
|
149
51
|
trustedKeys: Readonly<Record<string, string>>;
|
|
150
52
|
now?: Date;
|
|
151
53
|
}): Promise<LicenseKeyVerification>;
|
|
54
|
+
/**
|
|
55
|
+
* Verifies a commercial training grant offline against trusted public keys keyed by key ID.
|
|
56
|
+
*
|
|
57
|
+
* A valid grant still needs its permissions checked: {@linkcode trainingAdmission} in
|
|
58
|
+
* `@mailwoman/license/product/entitlement` checks that it permits training.
|
|
59
|
+
*/
|
|
60
|
+
export declare function verifyTrainingGrant(token: string, options: {
|
|
61
|
+
trustedKeys: Readonly<Record<string, string>>;
|
|
62
|
+
now?: Date;
|
|
63
|
+
}): Promise<TrainingGrantVerification>;
|
|
152
64
|
//# sourceMappingURL=key.d.ts.map
|
package/out/license/key.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../lib/license/key.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../lib/license/key.ts"],"names":[],"mappings":"AAG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,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAAC,GAAG,CAAC,EAAE,IAAI,CAAA;CAAE,GACpE,OAAO,CAAC,yBAAyB,CAAC,CAEpC"}
|
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,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAU5C;;GAEG;AACH,MAAM,UAAU,6BAA6B;IAC5C,OAAO,sBAAsB,EAAE,CAAA;AAChC,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,KAAK,CAAC,YAAoB,EAAE,YAAoB,EAAE,GAAc;IAC9E,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,WAAW,CAAC,YAAY,C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AO,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"}
|