The Hiking World

Verify a trail record

Load the record and the public key, rebuild the canonical JSON, and check the Ed25519 signature in your own code. This page can run that check in the browser. It does not ask the server to approve the record. There is no offline snapshot file and no mcp verify command.

What is signed

Ed25519 signs the UTF-8 bytes of the canonical JSON. Node’s crypto.sign(null, bytes, key) signs those bytes directly. It does not hash them first. canonicalSha256 is a separate SHA-256 of the same bytes, published so you can see you rebuilt the same string. keyId, signedAt, and the signature are not inside the signed JSON. signedAt is the newest verifiedDate found in the payload, or undated.

The signed object is exactly:

  • slug, name, country (or null), catalogVersion
  • facts.lengthKm, facts.ascentM, facts.descentM, facts.highPointM, facts.lowPointM. Each published fact is value, source, verifiedDate, provisional. A withheld ascent and descent are JSON null, not omitted. Distance, high point, and low point are always objects.
  • ascentSuppressed (boolean) and highPointCaveat (string or null)
  • permits: permitType, costLocal, issuer, sourceUrl, verifiedDate, status, stale. Quota text, the legacy cost string, and legalInstrument are not in the signed row.
  • geometrySource, gpsTrack

Not signed: the prose, the geometry coordinates, water, hazards, alerts, season text, and the trail-content sidecar. A signature does not cover those.

Canonical bytes

Object keys are sorted at every level. Array order is kept. undefined fields are dropped. null is kept. The encoding is UTF-8. JSON.stringify writes numbers: 2736 stays an integer, 38.29 stays a decimal. There is no extra whitespace.

Worked example

Inca Trail, checked on 2026-10-15 against key id 3ad491a01aea. Catalog version 57b5635dd4f3. A later catalog version is a different payload. Signature gzHBpywGXoNIE5pyYypmJzLWwa8V+QrAFFchfgZXRtRMcAdFFGSIDs2xK4F4dg03NT5NYnVf3miSlm3Gl2TZCw==. SHA-256 of the bytes below is cad2efb92b83a698e2636a4975cb1446ae38695c9365cc3c58b762720e138cde.

{"ascentSuppressed":false,"catalogVersion":"57b5635dd4f3","country":"Peru","facts":{"ascentM":{"provisional":true,"source":"derived:glo30/v1","value":2736,"verifiedDate":"2026-09-21"},"descentM":{"provisional":true,"source":"derived:glo30/v1","value":3397,"verifiedDate":"2026-09-21"},"highPointM":{"provisional":false,"source":"derived:glo30/v1","value":4201,"verifiedDate":"2026-09-21"},"lengthKm":{"provisional":true,"source":"osm:relation:15703494","value":38.29,"verifiedDate":"2026-09-21"},"lowPointM":{"provisional":false,"source":"derived:glo30/v1","value":1976,"verifiedDate":"2026-09-21"}},"geometrySource":"osm:relation:15703494","gpsTrack":true,"highPointCaveat":null,"name":"Inca Trail (Classic 4-day)","permits":[{"costLocal":"S/ 292.00 (Tarifa General, TUSNE 2025 — RM 000451-2024-MC); estudiante S/147, menores S/135","issuer":"Ministerio de Cultura del Perú — Dirección Desconcentrada de Cultura Cusco","permitType":"Camino Inka — Ruta 1/2/3 (Tarifa General)","sourceUrl":"https://transparencia.cultura.gob.pe/sites/default/files/transparencia/2024/12/resoluciones-ministeriales/resolucionministerial-000451-2024-mcanexotusne2025.pdf","stale":false,"status":"verified-official","verifiedDate":"2026-10-11"}],"slug":"inca-trail"}

Rebuild a live record

For a current response, map data.distanceKm to facts.lengthKm and the other four facts the same way. Set catalogVersion from the response version. Copy only the seven permit fields. When ascent is withheld, the published ascentM and descentM are null and ascentSuppressed is true. highPointCaveat is null on the current catalog: no record stores a known high more than 150 m above the DEM high. That sentence, when it exists, is signed and is not a separate field on the trail JSON.

import { createHash, createPublicKey, verify } from "node:crypto";

function canonicalize(value) {
  if (value === null || typeof value !== "object") return value;
  if (Array.isArray(value)) return value.map(canonicalize);
  const sorted = {};
  for (const key of Object.keys(value).sort()) {
    if (value[key] === undefined) continue;
    sorted[key] = canonicalize(value[key]);
  }
  return sorted;
}
const stableStringify = (value) => JSON.stringify(canonicalize(value));

const record = await fetch("https://www.thehikingworld.com/api/v1/trails/inca-trail").then((r) => r.json());
const key = await fetch("https://www.thehikingworld.com/.well-known/provenance-key.json").then((r) => r.json());
const data = record.data;
const payload = {
  slug: data.slug,
  name: data.name,
  country: data.country || null,
  catalogVersion: record.version,
  facts: {
    lengthKm: data.distanceKm,
    ascentM: data.ascentM,
    descentM: data.descentM,
    highPointM: data.highPointM,
    lowPointM: data.lowPointM,
  },
  ascentSuppressed: data.ascentM == null,
  highPointCaveat: null,
  permits: data.permits.map((row) => ({
    permitType: row.permitType,
    costLocal: row.costLocal,
    issuer: row.issuer,
    sourceUrl: row.sourceUrl,
    verifiedDate: row.verifiedDate,
    status: row.status,
    stale: row.stale,
  })),
  geometrySource: data.geometrySource,
  gpsTrack: data.gpsTrack,
};
const bytes = Buffer.from(stableStringify(payload), "utf8");
const ok = verify(null, bytes, createPublicKey(key.publicKeyPem), Buffer.from(record.provenance.signature, "base64"));
console.log(ok, createHash("sha256").update(bytes).digest("hex") === record.provenance.canonicalSha256);

For machines links here. The public key is only the PEM at /.well-known/provenance-key.json.

A valid signature means these bytes are what we published. It is an integrity check, not a currency check: it does not mean the figure is still current. A date older than the freshness window is marked stale on the record. Stale means the date is old. It does not mean the issuer changed the figure.

A wrong signed number

A valid signature means the payload matches what we published. It does not mean the number is right. A retraction replaces the figure and signs the new payload. The old signature then fails.

In the browser

This check loads the published key and the record, then verifies in your browser.