-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Background:
AEAMCP protocol must also support such usecase:
Theory of Operation:
- Each request gota be signed by yo Solana wallet (Phantom, Solflare, whateva).
- Server peeps the signature, recovers the publicKey and checks our registry on-chain (PDA/SPL token or custom Anchor program).
- If wallet got that access entry on-chain, server say “come on in” (200 OK). Otherwise it say “hit the bricks” (403).
Goals:
- Stateless access control: no cookies, no sessions, straight wallet-based.
- Decentralized registry: all perms stored on Solana chain, so we keep it transparent and tamper-proof.
- Support borrow/lend: wallets can transfer or rent access rights to others on-chain.
- Easy dev integration: simple middleware, few lines in Express/Koa.
Plan & Phases:
-
Design & Spec
• Define canonical payload shape:{ path, ts, nonce }.
• Pick registry model: PDA per wallet+resource or SPL token mint per resource.
• Draw sequence diagrams for the sign→verify→check flow. -
On-Chain Registry
• Build Anchor program (or reuse SPL logic) togrant,revoke,transferaccess entries.
• Write tests (Anchor Mocha) and deploy to Devnet/Testnet. -
Server Middleware
•signatureAuthmiddleware to verify sig via web3.js/nacl.
•checkOnChainAccess()service to query PDA/SPL via RPC.
• Cache results in Redis with short TTL. -
Protect Routes
• Wrap protected endpoints (/api/secret,/api/data/*) with middleware.
• Add integration tests simulating valid/invalid wallets. -
Frontend Support
• Integrate Solana Wallet Adapter.
• BuildmakePayload()+signPayload()utils.
• Provide example fetch wrapper that attaches headers. -
Docs & Samples
• README section with setup, env vars, code snippets.
• Demo script or Postman collection. -
Security & Hardening
• Nonce+timestamp replay protection.
• Rate-limit signature endpoints.
• Fallback RPC endpoints and retry logic.
High-Level Design Diagram:
flowchart LR
subgraph Client
A[Wallet Adapter]-->B[Signer]
B-->C[Request Builder]
end
C-- HTTP -->D[Server Middleware]
D-->E[Signature Verifier]
E-->F[On-chain Checker]
F-- RPC -->G[Solana Program/PDA]
D-->H[Route Handlers]
H-->I[Business Logic]