feat: implement confidential payment helpers for Pedersen commitment generation and reveal#430
Open
mayborn005 wants to merge 1 commit into
Open
Conversation
…tion and reveal Implements Issue Stellar-split#420 - Confidential payment helpers using Pedersen commitments: - generateCommitment(amount): Generates cryptographic Pedersen commitment - verifyCommitment(): Verifies commitment matches value and blinding factor - storeBlindingFactor(): Encrypts and stores blinding factor in IndexedDB - loadBlindingFactor(): Decrypts and retrieves stored blinding factor - buildRevealTransaction(): Builds reveal_payment contract call - Convenience functions: generateAndStoreCommitment, buildRevealTransactionFromStorage Features: - Uses secp256k1 curve via @noble/curves for elliptic curve operations - Session-based AES-256-GCM encryption for blinding factor storage - Supports IndexedDB with localStorage fallback - Tamper detection for modified values or blinding factors - 31 comprehensive tests covering roundtrip verification
Contributor
|
Please resolve you conflict and make sure there is no conflict |
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
Implements Issue #420 - Confidential payment helpers for Pedersen commitment generation and reveal.
New Functions:
generateCommitment(amount): Generates cryptographic Pedersen commitment (C = aH + vG)verifyCommitment(): Verifies commitment matches value and blinding factorstoreBlindingFactor(): Encrypts and stores blinding factor in IndexedDB/localStorageloadBlindingFactor(): Decrypts and retrieves stored blinding factordeleteBlindingFactor(): Removes stored blinding factorbuildRevealTransaction(): Builds reveal_payment contract callgenerateAndStoreCommitment(): Convenience function combining generation and storagebuildRevealTransactionFromStorage(): Convenience function for reveal flowFeatures:
@noble/curvesfor elliptic curve operationsNew Error Types:
CommitmentGenerationErrorBlindingFactorStorageErrorBlindingFactorNotFoundErrorBlindingFactorDecryptionErrorTest plan
Closes #420