Skip to content

Add inspectAuthEntry and checkAuthEntryReadiness for decoding Soroban auth entries - #1529

Merged
Ryang-21 merged 6 commits into
mainfrom
inspect-auth-entries
Jul 20, 2026
Merged

Add inspectAuthEntry and checkAuthEntryReadiness for decoding Soroban auth entries#1529
Ryang-21 merged 6 commits into
mainfrom
inspect-auth-entries

Conversation

@Ryang-21

Copy link
Copy Markdown
Contributor

What

Adds a read-side decoding API for Soroban authorization entries in src/base/auth.ts, the complement to the existing authorizeEntry/authorizeInvocation write path:

  • inspectAuthEntry(entry) decodes a xdr.SorobanAuthorizationEntry into a typed AuthEntryInfo: the credential type (sourceAccount / address / addressV2 / addressWithDelegates), authorizing address, nonce, signatureExpirationLedger, the invocation tree, and a signers list covering the top-level credentials plus any CAP-71 delegates, depth-first. Each AuthEntrySigner reports 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 raw ScVal otherwise — 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.needsNonInvokerSigningBy is rewired onto the new decoder, which also fixes a latent inconsistency: an empty scvVec signature — the exact placeholder authorizeInvocation writes on unsigned entries — was treated as signed (only scvVoid counted 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

Copilot AI review requested due to automatic review settings July 15, 2026 21:33
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Jul 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/contract/assembled_transaction.ts Outdated
addrAuth !== null &&
(includeAlreadySigned ||
addrAuth.signature().switch().name === "scvVoid"),
info.address !== null && (includeAlreadySigned || !info.signed),
Comment thread src/base/auth.ts Outdated
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 `[]`.
Comment thread src/base/auth.ts Outdated
Comment thread src/base/auth.ts
return { ready: true, expired: false, unsignedBy: [] };
}

const expired = currentLedgerSeq >= (info.signatureExpirationLedger ?? 0);
@Ryang-21
Ryang-21 merged commit 3233637 into main Jul 20, 2026
12 checks passed
@Ryang-21
Ryang-21 deleted the inspect-auth-entries branch July 20, 2026 16:00
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Decode and inspect Soroban auth entries

3 participants