Package memba_quest_attestation_v1 is the on-chain quest/XP attestation realm for Memba (audit Q-05, Track A — "Model B" offline-signed voucher).
WHY: Memba quest XP lives in a centralized backend DB; the chain holds no verifiable record. This realm makes a quest completion + its XP an independently verifiable on-chain fact, WITHOUT giving the backend a hot key that can write arbitrary state.
HOW (Model B — offline voucher):
- The backend holds an OFFLINE ed25519 signing key; it NEVER broadcasts.
- For a server-verified completion it issues a voucher (address, questId, xp, nonce) + ed25519 signature over the canonical message addr "|" questId "|" itoa(xp) "|" nonce (UTF-8 bytes)
- The USER broadcasts RecordCompletion(...) with the voucher (they pay gas).
- This realm verifies the signature against the configured signer pubkey, rejects reused nonces (replay), bounds xp, and records the completion + cumulative attested XP.
TRUST MODEL: the signature is the authority, NOT the caller — anyone may broadcast a valid voucher (it can only record the backend-attested fact). The only privileged action is rotating the signer pubkey (owner multisig).
The canonical message format is a CONTRACT with the backend signer — it MUST stay byte-identical on both sides. See canonicalMsg.