3.3 KiB
3.3 KiB
Backend Handoff Checklist: Membership Activation Flow
This checklist maps current web behavior to required backend implementation.
Current implementation target in this repo:
web/backend/secretapi
Required Endpoints
POST /secret/wallet/intentPOST /secret/wallet/verifyPOST /secret/membership/quotePOST /secret/membership/confirmGET /secret/membership/status
Web Behavior Dependency
The landing page currently executes these actions in order:
- Connect wallet (
eth_requestAccounts). - Get signature intent.
- Sign typed data (
eth_signTypedData_v4). - Verify signature.
- Request membership quote.
- Send wallet transaction (
eth_sendTransaction) using returned tx params. - Confirm membership by tx hash.
- Show acknowledged state and app download links.
If any endpoint is missing, flow fails closed and shows status error.
Response Requirements
Intent
Must return:
intent_iddesignation_codedisplay_tokennonceissued_atexpires_atchain_id
Verify
Must return:
status = signature_verifieddesignation_codedisplay_token
Membership Quote
Must return:
quote_idchain_idcurrencyamountoramount_atomic + decimalsdeadline- tx execution fields:
- either
txobject for wallet send - or
contract_address+calldata+value
- either
- ownership/payer context fields when applicable:
owner_walletpayer_walletsponsorship_mode
Membership Confirm
Must return:
status = membership_activedesignation_codedisplay_tokentx_hash
Membership Status
Must return:
status(active|none|suspended|revoked|unknown)- selector echo (
walletand/ordesignation_code)
Security Requirements
- Replay-safe intent nonce and quote nonce.
- Intent and quote TTL enforcement.
- Chain allowlist checks.
- Origin allowlist checks.
- Tx amount/currency/recipient exact-match checks.
- Idempotent confirm path for repeated tx_hash submissions.
- Distinct payer wallet requires deterministic ownership proof.
- Ownership proof message contract:
EDUT-PAYER-AUTH:{designation_code}:{owner_wallet}:{payer_wallet}:{chain_id}
- Company-first sponsor path allowed when:
sponsor_org_root_idis provided,- payer wallet is an
org_root_ownerprincipal for that org root, - payer entitlement status is active.
Data Persistence Requirements
Persist at minimum:
- designation code and auth token
- wallet and chain id
- intent fields and verification time
- quote fields and expiry
- membership tx hash and activation timestamp
- membership status resolution fields for wallet/designation lookups
Observability Requirements
- Correlation id per flow (
intent_idpreferred). - Structured logs for each transition.
- Metrics counters for:
- intent requests
- verify success/fail
- quote success/fail
- confirm success/fail
- membership status lookups success/fail
Done Criteria
- Web flow reaches acknowledged state on successful membership tx.
- Membership inactive wallets cannot complete flow.
- Confirm endpoint is idempotent and deterministic.
- API matches
docs/api/secret-system.openapi.yaml. - Distinct payer requests fail closed without ownership proof.