Repository navigation
fix(contacts): keep federation-required memos and validate account ids - #1863
Merged
greatest0fallt1me merged 2 commits intoOct 24, 2026
Merged
greatest0fallt1me merged 2 commits into
greatest0fallt1me merged 2 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closed
3 tasks
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.
Closes #1686
Summary
Resolves the money-loss issue where contacts saved via Stellar federation addresses had their
memo_typeandmemodiscarded, and returnedaccount_idvalues were trusted without checksum verification.Money-Loss Scenario
Exchanges and custodial services rely on federation memos (e.g., account memo IDs) to route incoming payments and deposits to specific user balances. When a user saved a contact by federation address (e.g.
user*exchange.com), StreamPay previously discarded the federationmemo_typeandmemo, while allowing users to type a private note into a free-text memo field. Creating payment streams to such contacts without the required on-chain memo causes the exchange to receive funds with no destination metadata, leading to permanent loss or stuck customer funds.What Was Done
app/utils/federation.ts):account_idusing full StrKey base32 decoding and CRC-16 XMODEM checksum checks (isValidStellarPublicKey).memo_typeagainst allowed values (text,id,hash).memoformat for each type (utf-8 length <= 28 for text, uint64 string for id, 32-byte hex or base64 for hash).stellar_addressmatches query (case-insensitive).FederationError("...", "INVALID_RESPONSE")on failure.app/contacts/page.tsx):ContactwithrequiredMemo?: { type: "text" | "id" | "hash"; value: string }, distinct from the user's privatememonote.getContactPaymentTarget(contact)helper returning{ address, memo? }."Required by <federationAddress>"badge (aria-readonly="true"). The user cannot edit or clear it.localStorage."Invalid Stellar address".Test Results