Add inspectAuthEntry and checkAuthEntryReadiness for decoding Soroban auth entries - #1529
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds public APIs for inspecting Soroban authorization entries and evaluating submission readiness.
Changes:
- Adds typed auth-entry decoding and readiness checks.
- Reuses decoding in
AssembledTransaction. - Adds tests, generated reference documentation, and changelog entries.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/base/auth.ts |
Implements inspection and readiness APIs. |
src/base/index.ts |
Exports the new APIs and types. |
src/contract/assembled_transaction.ts |
Integrates auth inspection with signing detection. |
test/unit/base/auth.test.ts |
Tests credential variants, delegates, and readiness. |
test/unit/server/soroban/assembled_transaction.test.ts |
Tests empty-signature detection. |
docs/reference/core-soroban-primitives.md |
Documents the new public APIs. |
docs/reference/contracts-client.md |
Updates generated source references. |
CHANGELOG.md |
Records the additions and signing fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| addrAuth !== null && | ||
| (includeAlreadySigned || | ||
| addrAuth.signature().switch().name === "scvVoid"), | ||
| info.address !== null && (includeAlreadySigned || !info.signed), |
Comment on lines
+657
to
+660
| * the signature payload parsed as the SDK's standard ed25519 format (a vec | ||
| * of `{public_key, signature}` maps, see {@link authorizeEntry}), or `null` | ||
| * when the payload has some other, signer-defined shape (as custom accounts | ||
| * such as WebAuthn/passkey wallets use). An unsigned node parses as `[]`. |
| return { ready: true, expired: false, unsignedBy: [] }; | ||
| } | ||
|
|
||
| const expired = currentLedgerSeq >= (info.signatureExpirationLedger ?? 0); |
jeesunikim
approved these changes
Jul 16, 2026
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.
What
Adds a read-side decoding API for Soroban authorization entries in
src/base/auth.ts, the complement to the existingauthorizeEntry/authorizeInvocationwrite path:inspectAuthEntry(entry)decodes axdr.SorobanAuthorizationEntryinto a typedAuthEntryInfo: the credential type (sourceAccount/address/addressV2/addressWithDelegates), authorizing address, nonce,signatureExpirationLedger, the invocation tree, and asignerslist covering the top-level credentials plus any CAP-71 delegates, depth-first. EachAuthEntrySignerreports its address, whether a signature payload is present, the parsed{publicKey, signature}pairs when the payload uses the SDK's standard ed25519 vec-of-maps format, and the rawScValotherwise — so signer-defined payloads from custom accounts (e.g. WebAuthn/passkey wallets) remain accessible even though they can't be structurally parsed or verified client-side.checkAuthEntryReadiness(entry, currentLedgerSeq)answers "is this ready to submit?", returning{ ready, expired, unsignedBy }. Expiration is compared exclusively against a caller-supplied current ledger sequence rather than fetched internally, keeping the function a pure decode with no network dependency (and leaving the choice of a trusted ledger source to the caller). Source-account entries are always ready, since they're covered by the transaction envelope signature.AssembledTransaction.needsNonInvokerSigningByis rewired onto the new decoder, which also fixes a latent inconsistency: an emptyscvVecsignature — the exact placeholderauthorizeInvocationwrites on unsigned entries — was treated as signed (onlyscvVoidcounted as unsigned), so such entries were wrongly omitted from the needs-to-sign list. A regression test covers this, alongside new unit tests for both functions across all four credential variants, nested delegates, and non-standard signature payloads.Why
Smart-account authorization entries are opaque XDR today: an app receiving one (from simulation, or from a counterparty in a multi-party signing flow) can't tell which signers it requires, whether it's already signed, or when it expires without reaching into raw XDR union accessors. That's exactly what an agent operating under scoped, time-limited, revocable authority needs to reason about before submitting. The SDK already had all the pieces internally —
getAddressCredentials, delegate-node traversal, the ed25519 signature map format — but only on the write path or as private helpers; this exposes them as a small, typed, public read API.Closes #1468