The Sonr Connection Model
Unlike traditional Web3 wallets that require browser extensions, Sonr uses a combination of WebAuthn and Decentralized Identifiers (DIDs) to create a secure, passwordless connection experience.User-Centric
Users control their identity and grant permissions to applications, not the
other way around.
Passwordless
WebAuthn enables biometric and security key authentication, eliminating the
need for seed phrases.
Multi-Device
Users can securely access their Vault from any device with a modern web
browser.
Connecting in the Browser
For web applications, the Sonr SDK provides a simple way to initiate a wallet connection.1
1. Initialize the SDK
First, initialize the Sonr SDK in your application. For this example, we’ll use the CDN version.2
2. Request Authentication
Use thesonr.authenticate()
method to prompt the user to connect their wallet. This will trigger the browser’s WebAuthn flow.3
3. Handle the Session
Thesession
object returned from authenticate()
contains the user’s DID and a UCAN token with the requested permissions. You can use this session to interact with the user’s Vault.Backend Wallet Connections
For backend services, you can use the Sonr SDK to interact with user Vaults on behalf of your application.1
1. Service Registration
Your backend service must be registered on the Sonr network. This provides your service with its own DID and allows it to request permissions from users.2
2. Requesting Permissions
Your service can request permissions from users by generating a UCAN request. This is typically done through a user-facing application.3
3. Using Delegated Capabilities
Once a user has approved your request, you will receive a delegated UCAN token. You can use this token to perform actions on the user’s behalf.Managing Connections
Checking Connection Status
You can check the current connection status at any time:Disconnecting
To disconnect a wallet, simply clear the session from your application’s state:Security Considerations
- UCAN Scopes: Always request the minimum permissions necessary for your application to function.
- Token Storage: Securely store delegated UCAN tokens on your backend. Never expose them on the client-side.
- Revocation: Your application should handle UCAN revocations gracefully.