Authentication vs Authorization
It is easy to conflate these two concepts, but they serve different purposes in the SocketFi architecture:
Authentication gives your application a session. Authorization gives the wallet contract proof that the current operation was explicitly approved by the wallet’s owner.
Authorization Message Structure
Before a wallet operation executes, an authorization message is constructed and signed by the user’s passkey. The message binds together everything relevant to the operation:The Nonce System
The nonce is a sequential counter stored in the wallet’s on-chain state. It starts at0 when the wallet is created and increments by 1 after every successfully executed state-changing operation. Its purpose is to prevent replay attacks.
How nonces prevent replay attacks:
Expiration Windows
Every authorization message includes avalid_until ledger number. The wallet contract checks the current Stellar ledger sequence against this value before executing. Authorizations that exceed their window are rejected even if the signature is valid.
What Requires Authorization
Every operation that changes wallet state requires a valid authorization. Read-only operations do not.Asset Transfers
Sending any asset from the wallet to another address.
Contract Calls
Invoking any method on a Soroban smart contract through the wallet.
Policy Changes
Adding, removing, or modifying spending limits, contract allowlists, or other wallet policies.
Credential Updates
Rotating the passkey credential bound to the wallet (requires the current credential’s authorization).
Account recovery follows a separate authorization path — it does not require the current credential (which is lost), but instead requires identity verification through the recovery system. See Recovery for details.
Verification Pipeline
The wallet contract runs every authorization through this pipeline before execution:Authorization Failure Reasons
When an authorization check fails, the wallet returns a specific failure reason:Security Properties
The authorization system provides four concrete security guarantees:Ownership enforcement
Ownership enforcement
Only operations signed by the wallet’s bound passkey credential are authorized. The wallet contract verifies the signature against the stored public key on every operation — there is no administrative override.
Replay protection
Replay protection
The sequential nonce system ensures each authorization is consumed exactly once. An authorization signed for nonce 42 cannot be replayed once the wallet’s nonce has advanced to 43.
Time-bound validity
Time-bound validity
The
valid_until expiration window ensures that stale or intercepted authorizations cannot be submitted indefinitely. Authorization windows should be kept as short as practical for your use case.On-chain enforcement
On-chain enforcement
Authorization is enforced by the Soroban wallet contract itself, not by SocketFi’s off-chain infrastructure. There is no intermediary that can bypass or override the on-chain verification logic.