feat(stellar): add Stellar account fields and Privy user linking flow#53
Open
libby-coder wants to merge 1 commit into
Open
feat(stellar): add Stellar account fields and Privy user linking flow#53libby-coder wants to merge 1 commit into
libby-coder wants to merge 1 commit into
Conversation
- Fix duplicate stellarPublicKey field in models/User.ts by removing the first definition (which lacked unique/index) and keeping a single correct field with unique, sparse, trim, and index options set - Add stellarAccountType, stellarLinkedAt, and stellarLastSyncedAt fields to the User schema; all four Stellar fields are optional so existing users are unaffected - Update POST /api/auth/stellar/link to set stellarLinkedAt on first link without overwriting it on subsequent re-links - Extend route tests to assert stellarLinkedAt is set on first link and preserved on re-link - Add docs/auth-stellar.md documenting how Privy auth and Stellar account linking fit together, including the security properties of each layer Closes Chainmove#27
Collaborator
|
@libby-coder great work sir, can you fix the lint error |
Author
The typecheck CI failure is not caused by changes in this PR. The four files I modified are: models/User.ts Every error reported by tsc --noEmit is in unrelated files (app/dashboard/admin/loans/page.tsx, components/ui/chart.tsx, components/providers.tsx, components/dashboard/advanced-analytics.tsx, etc.) that this PR does not touch. These errors exist on main and pre-date this branch — verifiable with git diff main...HEAD --name-only. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stellarPublicKeyfield inmodels/User.ts— the schema had two definitions of the same field (one withunique: true, one withindex: true). Merged into a single correct definition withunique,sparse,trim, andindexall set.stellarPublicKey,stellarAccountType,stellarLinkedAt,stellarLastSyncedAt. All fields default gracefully so existing users are unaffected with no migration needed.stellarLinkedAton first link inPOST /api/auth/stellar/link— the timestamp is recorded when a key is first attached and is never overwritten on subsequent re-links.stellarLinkedAtis set on first link and is preserved (not reset) on re-link.docs/auth-stellar.md— documents how Privy auth and Stellar account linking fit together, the security properties of each layer (public-key-only storage, StrKey checksum validation, unique index + 409 race protection), relevant environment variables, and contributor setup instructions.Files changed
models/User.tsstellarPublicKey; keep single definition withunique,sparse,trim,indexapp/api/auth/stellar/link/route.tsstellarLinkedAton first link onlyapp/api/auth/stellar/link/route.test.tsstellarLinkedAtfirst-link and re-link preservationdocs/auth-stellar.mdAcceptance criteria checklist
stellarLinkedAtis recorded on first linkCloses #27