This repo documents the current public auth patterns used by the Sail API examples. It is intentionally high level and avoids claims that depend on older implementation details.
The example repo covers two current auth styles:
- Direct auth for smart account wallets via the two-step
/authenticateflow - Custom SIWE auth for signer-driven integrations via
/auth/initiateand/auth/complete
Both flows rely on wallet signatures. Private keys remain client-side.
Direct auth works in two requests:
- Request a unique payload from
/authenticate - Sign that payload
- Submit
walletAddress,signature, andpayloadback to/authenticate
This means the example repo should not describe direct auth as a single fixed-message signature flow.
Custom SIWE works in two requests:
- Request a SIWE session from
/auth/initiate - Sign the returned SIWE message
- Submit
sessionId,signature,walletAddress, and optionalidentityModeto/auth/complete
identityMode behaves like this:
byWallet: default and recommended for new integrationsbyUser: legacy recovery only for previously issued legacy identities
Successful authentication can return:
token: Sail JWT for authenticated API requestsaccountToken: account-service token for SIWE/account-service flowswalletAddress: issued smart account or account-service wallet, depending on flow
Which fields are present depends on the flow you use.
- Do not assume every endpoint removes
walletAddressfrom request bodies. Some current endpoints still require explicit wallet inputs. - Do not assume every auth flow derives identity from the same backend field. Direct auth and custom SIWE have different request shapes and different downstream behavior.
- For custom SIWE,
byWalletand legacybyUserrepresent different identity-binding modes and should be documented as such.
The metrics endpoints are configurable page-backed surfaces:
/metrics/balance/metrics/earnings/metrics/history/metrics/portfolio/metrics/user-metrics/metrics/yield
They return a wrapper shaped like:
{
"message": "Metrics endpoint executed successfully",
"result": {}
}The exact result payload depends on the configured tool or graph.
- Keep private keys out of source control
- Use HTTPS in production
- Validate responses before acting on them
- Treat
byUseras legacy recovery only - Prefer
byWalletfor new SIWE integrations