# MiTour canonical JSON and commandHash v1

`commandHash` is the lowercase SHA-256 hex digest of the UTF-8 bytes of the complete
`MiTourAICommandEnvelopeV1` after strict validation and typed normalization. The hash is
not a hash of `preview` alone and the envelope does not contain a circular `commandHash` field.

Canonical JSON v1 has no insignificant whitespace, preserves array order, sorts object keys
lexicographically by UTF-16 code units, and uses ECMAScript `JSON.stringify` string escaping.
JSON numeric values are restricted to base-10 integers in `[-9007199254740991, 9007199254740991]`.
Decimal money, exchange rates and coordinates are canonical decimal strings. UUIDs are
lowercase canonical strings. Dates are `YYYY-MM-DD`; date-times are UTC RFC 3339 ending in `Z`.

`baseSet` is unique and sorted by the canonical JSON of each complete identity before the
envelope is accepted. Implementations must reject unsupported values rather than silently
coercing them. The generated TypeScript and `.mjs` consumer implement the same algorithm;
`canonicalization-vectors-v1.json` is the cross-runtime golden source.