Example setup
Request signature helper
Prepare the exact request-signing primitive used by the rest of the examples.
pip install httpx pynacl base58 solders import base58, hashlib, httpx, json, os, timefrom nacl.signing import SigningKey FRONT_DOOR = "https://agent.nukez.xyz"_sk = SigningKey(bytes(json.load(open("/path/to/keypair.json"))[:32]))PUBKEY = base58.b58encode(_sk.verify_key.encode()).decode() def canon_body(body: dict | None) -> bytes: if body is None: return b"" return json.dumps(body, separators=(",", ":"), sort_keys=True).encode() def signed_headers(method: str, path: str, body: dict | None = None) -> dict: nonce = os.urandom(32).hex() timestamp = str(int(time.time())) digest = hashlib.sha256(canon_body(body)).hexdigest() msg = "\n".join([ "nukez-request:v1", f"method={method}", f"path={path}", f"identity={PUBKEY}", f"nonce={nonce}", f"timestamp={timestamp}", f"body_sha256={digest}", ]) sig = base58.b58encode(_sk.sign(msg.encode()).signature).decode() return { "X-Nukez-Identity": PUBKEY, "X-Nukez-Nonce": nonce, "X-Nukez-Timestamp": timestamp, "X-Nukez-Signature": sig, }
Code notes
The canonical notebook starts with a thin direct client: httpx for transport, PyNaCl/base58 for request signing, and solders for the optional local Solana transfer helper. Every private endpoint uses the same signed_headers helper.
Unsigned endpoints include /health, /v1/card, /.well-known/*, /v1/service/request, /v1/provision/challenge, and /v1/provision/verify.
