feat: implement attestation, XDR encoding, consensus, and wallet throttling - #539
Merged
Conversation
- closes Sorokit#508: Add account attestation and credential management with issueAttestation, verifyAttestation, revokeAttestation, and getAccountAttestations. Deterministic HMAC-SHA256 signing, expiry and revocation checks, duplicate prevention, and private attribute safety. Exported from account/index.ts and src/index.ts. - closes Sorokit#505: Add transaction XDR encoding optimization with DEFLATE compression, delta-based encoding, and auto strategy selection. Transparent fallback for small payloads and compression failures. Exported from transaction/index.ts and src/index.ts. - closes Sorokit#507: Add threshold-based multi-party transaction consensus with createConsensusTransaction, approve/reject, summary tracking, and finalization guard. Prevents duplicate votes and impossible thresholds. Exported from transaction/index.ts and src/index.ts. - closes Sorokit#506: Add wallet connection throttling and abuse detection with per-origin rate limiting, auth failure tracking, allowlist/ blocklist support, structured error responses, and expiring blocks. Exported from wallet/index.ts and src/index.ts. All 112 tests pass (39 throttling, 24 attestation, 26 consensus, 23 XDR encoding).
|
@observerr411 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Resolves four issues in a single PR.
closes #508 — Account attestation & credential management
AccountAttestationandCredentialMetadatamodel in the account moduleissueAttestation(subject, credential)with issuer validation and deterministic HMAC-SHA256 payload signingverifyAttestation(attestation)for signature, subject, and expiration verificationrevokeAttestationwith revocation registry; revoked credentials fail verification even with valid signaturesgetAccountAttestations(account, filters)— query by issuer, type, credential ID, or validity (checks registry for post-storage revocations)SorokitErrorresponses for expired, malformed, revoked, or untrusted attestationssrc/account/index.tsandsrc/index.tscloses #505 — Transaction XDR encoding for bandwidth efficiency
EncodingMetadataidentifies the strategy required for decoding (none/deflate/delta)minCompressionSize,maxCompressionOverhead,compressionLevel,enableDeltaEncodingsrc/transaction/index.tsandsrc/index.tscloses #507 — Threshold-based multi-party transaction consensus
createConsensusTransaction(threshold, participants)validates threshold ≤ participant count and no duplicate IDsproposal → review → approved / rejected → finalizedfinalizeConsensusTransactionis blocked until threshold is met and no rejections existsrc/transaction/index.tsandsrc/index.tscloses #506 — Wallet connection throttling & abuse detection
retryAfterMsdetectAbuse(origin)scores confidence across patterns: rapid attempts, repeated failures, auth failures, high failure rateenabled: falsesrc/wallet/index.tsandsrc/index.tsTest results