Security Model
Surf SDK inherits the same security architecture that governs the Surf platform directly. The principles are the same: user custody first, deterministic enforcement, and full on-chain transparency.
Self-Custodial Architecture
Every user's funds are held in their own dedicated smart contract vault.
Funds are never co-mingled with other users
Funds are never held in any Surf-controlled account
Each vault is deployed on-chain on the user's first deposit
Withdrawals are available at any time without protocol approval
The vault is the cryptographic boundary of control. Surf never has discretionary access to user funds.
Credential Management
appId
Public
Safe to include in frontend code, commit to version control
apiSecret
Private
Store in environment variables or a secrets manager. Never expose in frontend code or client-side bundles.
The apiSecret is shown only once at registration. If lost, contact the Surf team for a credential reset.
Session Handling
User authentication uses wallet signatures (SIWE-style). Sessions are managed with httpOnly, secure cookies with cross-origin support.
Your application never handles raw authentication tokens. The SDK manages the full session lifecycle.
Key Safety
The widget and SDK do not store or transmit wallet private keys. All transaction signing happens through the user's connected wallet provider.
Surf never has access to the user's private keys. Every transaction requires the user's explicit wallet signature.
Execution Control
All capital movements within a user's vault are governed by the Guardian Layer, Surf's deterministic on-chain enforcement system. This applies equally to vaults created through the SDK.
The Guardian Layer enforces:
Protocol allowlists
Exposure and concentration limits
Slippage bounds
Liquidity exit depth thresholds
Rate change triggers
Pre-execution simulation verification
Circuit breakers and emergency halts
For a detailed breakdown of these controls, see Guardian Layer Overview and Deterministic Rules and Invariants.
Infrastructure Security
Surf is built on zkCross Network's cross-chain execution infrastructure, which has been audited by Halborn. The audit covers the smart contract modules, access control systems and execution layer that Surf inherits.
For details on the audit scope and production validation, see Audits and Production Validation.
Last updated