Smart Account Auth
Authentication utilities for Smart Account authorization entries.
Provides functions to sign authorization entries and build authentication payload hashes for Smart Account transactions. These utilities handle the complex XDR encoding and signature map construction required by the Soroban authorization protocol.
Key responsibilities:
Building Soroban authorization payload hashes for WebAuthn challenges
Signing authorization entries with Smart Account signers
Managing signature expiration and map entry ordering
Double XDR encoding of signature values
Example usage:
// Build payload hash for WebAuthn signing
val payloadHash = SmartAccountAuth.buildAuthPayloadHash(
entry = authEntry,
expirationLedger = currentLedger + 100u,
networkPassphrase = Network.TESTNET.networkPassphrase
)
// Compute the signature over the payload hash, then attach it to the entry
val signedEntry = SmartAccountAuth.signAuthEntry(
entry = authEntry,
signer = webAuthnSigner,
signature = webAuthnSignature,
expirationLedger = currentLedger + 100u
)Functions
Adds a raw key/value entry to the auth entry's signature map.
Computes the auth digest that binds context rule IDs to the signature payload.
Builds the authorization payload hash for signing.
Builds the authorization payload hash for source_account credentials.
Attaches a pre-computed signature to an authorization entry.