mirror of
https://github.com/hanzoai/engine.git
synced 2026-11-20 23:45:50 +00:00
Add the security gate that makes the proprietary engine refuse to run unless
it is handed a valid, unexpired, correctly-scoped Hanzo-issued license token,
per SECURE-ENGINE-DISTRIBUTION-DESIGN.md.
- hanzo-engine/src/license.rs: offline Ed25519 verify core (ed25519-dalek).
Token = base64url(JSON claims) "." base64url(sig[64]); the sig is over the
encoded-payload bytes so verify never re-canonicalizes JSON. Claims:
{v, app_id, holder, iat, exp, features, nonce}. verify_license() returns
distinct errors (Malformed/BadSig/Expired/WrongApp/NotYetValid); load_and_verify()
reads HANZO_ENGINE_LICENSE_TOKEN (or *_FILE) and checks the embedded pubkey +
build's expected_app + now. Embedded HANZO_LICENSE_PUBKEY is a DEV key (marked
for KMS swap at release). expected_app fixed per build via cargo features
license-app-{hanzo,lux,zoo} (default "hanzo-dev").
- Gate (cargo feature license-enforce, OFF by default): top of run_server
(hanzo-cli serve.rs) hard-exits on failure; HanzoForServerBuilder::build()
(hanzo-server-core) returns Err so every embedder (node/CLI/pyo3-via-server)
is gated. Dev builds skip with a one-line note.
- hanzo-engine/examples/license_issuer.rs: mints signed per-app tokens; private
key from --signing-key-file / HANZO_LICENSE_SIGNING_KEY, never hardcoded.
- Unit tests (9): valid, tampered-sig, tampered-payload, expired, wrong-app,
malformed, future-dated, wrong-version, dev-key==embedded-pubkey.
cargo test -p hanzo-engine --no-default-features license -> 9/9 pass.
- DEV private seed lives only in gitignored license-dev-key/; the public key
artifacts + regeneration README are committed.
Co-authored-by: Hanzo Dev <[email protected]>
2 lines
191 B
Plaintext
2 lines
191 B
Plaintext
0x6e, 0x79, 0xb8, 0x50, 0x79, 0xfe, 0xbd, 0x9e, 0xfc, 0x35, 0xbf, 0x4d, 0x8e, 0x0a, 0x6e, 0x86, 0x27, 0x03, 0x1b, 0x87, 0x2f, 0xc6, 0xb7, 0x61, 0xe2, 0x8a, 0xf9, 0x8c, 0xed, 0xe4, 0x1e, 0xf7
|