{"_id":"@mapmap/territory","_rev":"2-2bb2756011103ff9711d413955771ec7","name":"@mapmap/territory","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@mapmap/territory","version":"0.1.0","keywords":["mapmap","territory","offline","maps","ed25519","blake3","signed-packages"],"author":{"name":"Mapmap AI Ltd"},"license":"MIT","_id":"@mapmap/territory@0.1.0","maintainers":[{"name":"mapmap","email":"matt@mapmap.ai"}],"homepage":"https://mapmap.ai/docs","bugs":{"email":"hello@mapmap.ai"},"bin":{"mapmap-territory":"dist/cli.js"},"dist":{"shasum":"40a3a2d2e9071579987441921a565ff07a1ab7e5","tarball":"https://registry.npmjs.org/@mapmap/territory/-/territory-0.1.0.tgz","fileCount":5,"integrity":"sha512-pDiNmp8UOf4uCk5pvX8BbDe069+xicyW67QV4OK8BjPdbNIcXoEmnwTBcr971F0+PMecb5cKORsOzM8oO5N8nQ==","signatures":[{"sig":"MEQCICW067iKk3Q2/uoHId56kK1MFS/PS41kWSy3zY/S31geAiALeKXAcb7u2A7DPkZUAVo4VOs4JoJhpd21zvT85iZHAw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":114080},"type":"module","engines":{"node":">=20"},"gitHead":"ea121199461a85ed62576a4970758539f789b919","scripts":{"test":"vitest run","build":"tsup","prepack":"npm run build","test:live":"TERRITORY_CLI_LIVE=1 vitest run src/smoke.test.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"mapmap","email":"matt@mapmap.ai"},"repository":{"url":"git+https://github.com/Mapmapai/mapmap.git","type":"git","directory":"territory-cli"},"_npmVersion":"10.9.8","description":"MapMap territory CLI — list, fetch and cryptographically verify signed offline territory packages from a MapMap update channel (ed25519 + BLAKE3, verified on your machine).","directories":{},"_nodeVersion":"22.23.2","dependencies":{"@noble/hashes":"^1.7.0","@noble/ed25519":"^2.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","vitest":"^4.1.11","typescript":"^5.7.2","@types/node":"^26.5.0"},"_npmOperationalInternal":{"tmp":"tmp/territory_0.1.0_1789142680497_0.319085687732223","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@mapmap/territory","version":"0.1.1","description":"MapMap territory CLI — list, fetch and cryptographically verify signed offline territory packages from a MapMap update channel (ed25519 + BLAKE3, verified on your machine).","license":"MIT","author":{"name":"Mapmap AI Ltd"},"repository":{"type":"git","url":"git+https://github.com/Mapmapai/mapmap.git","directory":"territory-cli"},"type":"module","bin":{"mapmap-territory":"dist/cli.js"},"scripts":{"build":"tsup","typecheck":"tsc --noEmit","test":"vitest run","test:watch":"vitest","test:live":"TERRITORY_CLI_LIVE=1 vitest run src/smoke.test.ts","prepack":"npm run build"},"dependencies":{"@noble/ed25519":"^3.2.0","@noble/hashes":"^2.4.0"},"devDependencies":{"@types/node":"^26.5.0","tsup":"^8.3.5","typescript":"^5.7.2","vitest":"^4.1.11"},"keywords":["mapmap","territory","offline","maps","ed25519","blake3","signed-packages"],"homepage":"https://mapmap.ai/docs","bugs":{"email":"hello@mapmap.ai"},"publishConfig":{"access":"public"},"engines":{"node":">=20.19"},"_id":"@mapmap/territory@0.1.1","gitHead":"330b7bd3198f796535a128c799da798baa69b50e","_nodeVersion":"22.23.2","_npmVersion":"10.9.8","dist":{"integrity":"sha512-Dh+R/JwSXr3NRVtzdiE2ivQQa5KMQAGWgKk1hAL5dMp81jdqT8i8jXFQ0eXYTVE+pPIUO+kaHmIVLvXldd7Wjg==","shasum":"b2f34728a55cb9d8aaa9694037c18827624f5ba2","tarball":"https://registry.npmjs.org/@mapmap/territory/-/territory-0.1.1.tgz","fileCount":6,"unpackedSize":115337,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC8DfGDJy+65xYqG/+CU7YAsegYvt9GMI5FfESJoxaWhQIgYmgjlbheTJN7sBsbdpt6CHPSfYRItwoh64abu9euYko="}]},"_npmUser":{"name":"mapmap","email":"matt@mapmap.ai"},"directories":{},"maintainers":[{"name":"mapmap","email":"matt@mapmap.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/territory_0.1.1_1789149143165_0.7553153282007496"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-11T16:04:39.858Z","modified":"2026-09-11T17:52:23.441Z","0.1.0":"2026-09-11T16:04:40.638Z","0.1.1":"2026-09-11T17:52:23.306Z"},"bugs":{"email":"hello@mapmap.ai"},"author":{"name":"Mapmap AI Ltd"},"license":"MIT","homepage":"https://mapmap.ai/docs","keywords":["mapmap","territory","offline","maps","ed25519","blake3","signed-packages"],"repository":{"type":"git","url":"git+https://github.com/Mapmapai/mapmap.git","directory":"territory-cli"},"description":"MapMap territory CLI — list, fetch and cryptographically verify signed offline territory packages from a MapMap update channel (ed25519 + BLAKE3, verified on your machine).","maintainers":[{"name":"mapmap","email":"matt@mapmap.ai"}],"readme":"# @mapmap/territory\n\nTerritory-in-a-file: list, fetch and **cryptographically verify** signed\nMapMap offline territory packages from an update channel: Snowdonia (or the\nwhole UK) in signed files that are yours forever, verified on your machine.\n\n> **Release status.** The package is publish-ready and its release workflow\n> (`.github/workflows/publish-territory-cli.yml`) is wired up, but nothing\n> reaches npm until a `territory-v*` tag is pushed. Until then `npx\n> @mapmap/territory` does not resolve, so run it\n> [from source](#run-from-source-before-publish) instead: build once, then use\n> `node dist/cli.js list` in place of every `npx @mapmap/territory` command\n> below.\n\nEvery byte is authenticated on your machine, never trusted from the wire:\nthe channel index and each package manifest carry detached **ed25519**\nsignatures, and every layer's content is checked against the **BLAKE3**\nhashes inside the signed manifest. A hostile CDN, mirror or gateway can at\nworst refuse to serve you (see `docs/TERRITORY-UPDATES.md` in the MapMap\nrepo for the full trust model).\n\n## Install\n\n```sh\n# No install: npx fetches it per run (needs Node 20+).\nnpx @mapmap/territory list\n\n# Or keep it on PATH as `mapmap-territory`:\nnpm install -g @mapmap/territory\nmapmap-territory list\n```\n\n## Quickstart\n\n```sh\n# 1. A free API key, one call, no signup page (then click the emailed link,\n#    territory downloads need a verified key):\ncurl -X POST https://api.mapmap.ai/v1/keys \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"email\":\"you@example.co.uk\",\"accept_tos\":true}'\nexport MAPMAP_KEY=snk_…\n\n# 2. What territories does the channel carry?\nnpx @mapmap/territory list\n\n# 3. Fetch one, verified end to end:\nnpx @mapmap/territory fetch uk --pubkey ./snfactory-public.hex\n#   ✓ manifest signature valid\n#   uk.pmtiles.tar.zst  1.1 GB downloaded\n#   ✓ render/uk.pmtiles, BLAKE3 verified (1.2 GB)\n#   ✓ signature valid: United Kingdom 2.0.0 is yours forever.\n\n# 4. Any time later, fully offline:\nnpx @mapmap/territory verify ./uk-2.0.0 --pubkey ./snfactory-public.hex\n```\n\n## Commands\n\n| Command | Does |\n|---|---|\n| `list` | Fetches and (with `--pubkey`) verifies the signed channel index, then prints the territories, their latest versions and installed sizes. `--json` prints the raw index. |\n| `fetch <id>` | Downloads a territory's signed manifest and every layer blob with progress, then verifies: ed25519 manifest signature + BLAKE3 content hash of every layer. `--out <dir>` (default `./<id>-<version>`), `--version <v>` (default latest). |\n| `verify <path>` | Offline re-verification. Point it at a fetched directory (full chain: signature + every hash) or at a single `.tar.zst` blob (`--blake3 <hex>` for the expected hash, or it reads the sibling `manifest.json`). |\n\n## Flags\n\n| Flag | Env | Meaning |\n|---|---|---|\n| `--key <snk_…>` | `MAPMAP_KEY` | Gateway API key. `list`/`fetch` need one; `verify` is fully offline. |\n| `--base-url <url>` | `MAPMAP_BASE_URL` | Gateway origin. Default `https://api.mapmap.ai`. |\n| `--pubkey <key>` | `MAPMAP_TERRITORY_PUBKEY` | The publisher's ed25519 public key: 64 hex characters, an SPKI PEM, or a path to a file containing either. |\n| `--out <dir>` | | `fetch` output directory. |\n| `--version <v>` | | `fetch` a specific published version. |\n| `--blake3 <hex>` | | `verify` a lone blob against an explicit content hash. |\n| `--json` | | `list` as JSON. |\n\n## Where does the public key come from?\n\nThe publisher key is **deployment-specific**: each MapMap deployment signs\nits channel with its own factory key (`snfactory keygen`), and the public\nhalf is distributed *out of band* (a compile-time constant in apps, a value\nyour operator hands you, never fetched from the same server that serves\nthe data, which would defeat the purpose). Ask your operator for their\n64-hex key or `.pub` file and pass it with `--pubkey`.\n\nWithout `--pubkey` the CLI still checks every BLAKE3 hash against the\nmanifest and says, loudly, that the publisher signature was not checked.\n\n## Requirements\n\n- **Node 20+** to list, fetch and verify signatures and manifest hashes.\n- **Zstd, for full content verification.** Layer blobs are zstd-compressed,\n  so decompressing and hashing their contents needs one of:\n  Node's built-in zstd (**Node 22.15+**, or 23.8+), or a `zstd` binary on\n  PATH (`brew install zstd` / `apt install zstd`). With neither, the CLI\n  refuses honestly instead of skipping verification; it never pretends a\n  blob it could not read is verified. (The `engines` floor stays at Node 20\n  deliberately: everything except full-content verification works there, and\n  a `zstd` binary covers the rest without a newer Node.)\n- Territory layer downloads need a **verified** (free) key; provisional\n  keys get a 403. Verified-free accounts include 8 GiB/month of offline\n  downloads; plans raise it.\n\n## Run from source (before publish)\n\nUntil the package is on npm, build it and run the CLI directly:\n\n```sh\nnpm install\nnpm run build             # tsup → dist/cli.js\nnode dist/cli.js list     # same CLI as `npx @mapmap/territory list`\n```\n\n## Develop\n\n```sh\nnpm install\nnpm run typecheck\nnpm test          # vitest; fixtures use a throwaway ed25519 key, plus a frozen signed index\nnpm run build     # tsup → dist/cli.js\n\n# Opt-in smoke test against the real channel (needs a verified free key):\nMAPMAP_KEY=snk_… npm run test:live\n```\n\n## Licence\n\nMIT © 2026 Mapmap AI Ltd. (The MapMap platform itself is separately licensed;\nthis CLI only reads the public, signed channel format.)\n","readmeFilename":"README.md"}