-
Notifications
You must be signed in to change notification settings - Fork 0
Claude/vault payload update endpoint 011 c uxi es5 ruw3t l4bb1 awsm #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Remove legacy venue parsing code from vault types as per multi-venue spec. This includes: - Legacy wireData fields (LegacyWallet, LegacyPrivateKey, etc.) - legacyVenue and legacyVenueWithID structs - decodeLegacyVenues() function - Legacy parsing logic in decodeVenues() The vault now only supports the modern multi-venue payload format. Co-authored-by: Claude <[email protected]>
Add new endpoint to allow users to update the encrypted vault payload after initial setup. This enables adding, editing, and removing venue credentials without requiring a full vault re-initialization. Changes: - Add PUT /vault/payload to OpenAPI spec - Implement UpdateVaultPayload handler with server-side validation - Require both encrypted and decrypted payloads for validation - Validate vault must be unsealed and session must be active - Validate decrypted payload structure and venue configuration - Use existing UpsertVaultPayload storage method (atomic transaction) - Sync venue metadata to storage after successful update The endpoint validates: - Session authentication and vault unsealed state - Encrypted payload structure (version, ciphertext, nonce) - Decrypted payload contents using vault.Data.Validate() - At least one primary venue exists - No duplicate venue IDs - Valid wallet addresses (40 hex chars) - Valid private keys (64 hex chars) After update, the vault remains unsealed but new configuration is not active until seal/re-unseal cycle. Co-authored-by: Claude <[email protected]>
The generated UpdateVaultPayload200JSONResponse has Message as *string, but the handler was passing a string literal. Fixed to use a pointer. Also add comprehensive test coverage for UpdateVaultPayload endpoint covering all scenarios from the spec: - Success case with valid payload - Missing/invalid session (401) - Vault sealed (403) - No primary venue (400) - Multiple primary venues (400) - Duplicate venue IDs (400) - Invalid wallet address (400) - Invalid private key (400) - Database errors (500) Co-authored-by: Claude <[email protected]>
Fix test failures: - Use VenueId field instead of ID in VenueRecord - Pass vault.StateSealed to NewController (signature changed) Co-authored-by: Claude <[email protected]>
Fix all UpdateVaultPayload tests to properly inject HTTP request into context. The requireSession() function needs the HTTP request in the context to work properly, even in debug mode. Changes: - Add net/http and net/http/httptest imports - Create httptest.NewRequest for each test - Add request to context using httpRequestContextKey - Pass context with request to handler Co-authored-by: Claude <[email protected]>
Co-authored-by: Your Name <[email protected]>
…hanging-functionality test: fix vault payload update tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| d.THREECOMMASAPIKEY = payload.ThreeCommasAPIKey | ||
| d.THREECOMMASPRIVATEKEY = payload.ThreeCommasPrivate | ||
| d.Venues = venues | ||
| return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve legacy vault payload decoding
The new Data.UnmarshalJSON now only parses venues and no longer calls the legacy conversion logic for HYPERLIQUID_* fields. Any existing ciphertext bundles saved before the multi‑venue schema (which store a single venue in those legacy keys) will now decode with an empty venue list. When the controller later unseals the vault, ensurePrimaryVenuePresent will fail because no primary venue exists, preventing users from logging in after upgrading. Unless all deployments have migrated their stored payloads, this silently drops backwards compatibility and will seal the vault permanently for affected users.
Useful? React with 👍 / 👎.
f7a18ea
into
codex/investigate-multi-wallet-support-for-hyperliquid
No description provided.