# Phase 12 Licensing Architecture

## Signed license format

The hotel receives a JSON document containing a `payload` object and an Ed25519 `signature`.

Example payload fields:

- `version`
- `license_id`
- `customer`
- `installation_id`
- `fingerprint`
- `domains`
- `hotel_codes`
- `issued_at`
- `not_before`
- `expires_at`
- `grace_days`
- `features`
- `limits`

The signature is calculated over deterministic canonical JSON. Associative object keys are sorted recursively before signing. Arrays preserve order.

## Supported feature codes

- `ordering`
- `room_service`
- `reservations`
- `kds`
- `billing`
- `integrations`
- `reports`
- `audit`
- `promotions`
- `*` for all features

## Supported deployment limits

- `hotels`
- `restaurants` (physical restaurants/cafes; room-service channel excluded)
- `rooms`
- `kds_devices`

A value of `0` or an omitted limit means unlimited.

## Installation fingerprint

The local fingerprint is derived from:

- generated installation UUID
- configured application domain
- server hostname
- configured database name

A normal hosting migration can therefore require a license reissue. This is intentional commercial binding. The vendor can reissue against the new activation request without changing customer data.

## Public/private key handling

Only the public key belongs in the customer application's `.env`. The private signing key must remain outside customer hosting and outside the customer application ZIP.

## Offline operation

License verification is fully local after installation and does not require Internet access. This preserves the platform's hotel-local/offline operating model.
