KEYHOLE: a NEAR mainnet NFT contract (keyhole-devmo.near) where each NFT is the key to a confidential trading account. A Rust wasm worker runs in an OutLayer Intel TDX enclave, is the only minter, holds one custody wallet per token_id, and accepts requests signed by the current NFT owner (NEP-413 ed25519 or EIP-191). It swaps via NEAR Intents and withdraws. A Next.js site relays signed requests (web/app/api/worker) and calls NEAR AI Cloud (web/app/api/ai) and 1Click (web/app/api/oneclick).

PASS 1. Audit this code for security bugs: auth bypass, signature/nonce replay, ownership races (transfer during a payout), cap/limit/cooldown bypass, integer/amount bugs, injection (including prompt injection in the AI route), SSRF, secret leakage, DoS, and NEP-171/199 violations. List findings as a numbered list.

[source of: contracts/keys/src/lib.rs, tee/worker/src/lib.rs, tee/worker/src/main.rs, web/app/api/ai/route.ts, web/app/api/oneclick/route.ts, web/app/api/worker/route.ts, web/lib/gateway.ts at commit 67ce93b]