Installation
Install the required peer dependencies:Basic usage
Configuration
Your Magic publishable API key from the Magic Dashboard.
Type definition
Features
Passwordless authentication
Users authenticate using magic links sent to their email. No passwords or private key management required.Email-based login
Magic sends a secure link to the user’s email. Clicking the link completes authentication and derives the Algorand account.Persistent sessions
Magic sessions persist across browser sessions. Users remain logged in until they explicitly log out.Single account
Each email address is associated with a single Algorand account. The same email always derives the same account address.Methods
connect()
Initiates Magic authentication. Requires an email address. Parameters:email(required): User’s email address as a string
Promise<WalletAccount[]>
Example:
disconnect()
Logs out the user from Magic and clears the session. Returns:Promise<void>
signTransactions()
Signs transactions using Magic. The user must be logged in. Parameters:txnGroup: Transaction or array of transactions to signindexesToSign?: Optional array of indexes to sign
Promise<(Uint8Array | null)[]>
Session management
Magic manages sessions internally. WhenresumeSession() is called:
- Checks if user is logged in via
client.user.isLoggedIn() - If logged in, retrieves user info and account address
- If not logged in, disconnects the wallet
- Updates stored account if it has changed
User information
After connection, user metadata is available:Error handling
Platform support
- Web: Full support
- Mobile: Full support (mobile web)
- Desktop: Full support
Authentication flow
- User provides email address
- Magic sends magic link to email
- User clicks link in email
- Magic authenticates and derives Algorand account
- Account address is cached and returned
Network configuration
Magic’s Algorand extension requires an RPC URL in configuration, but it’s not used for transaction signing in use-wallet. The library handles all Algorand operations directly.Limitations
- Only email-based authentication is supported (no SMS or social login)
- Each email maps to a single Algorand account
- Requires active internet connection for authentication
- Magic link must be clicked from the same browser session
Security considerations
Magic manages private keys using threshold cryptography. The private key is split across Magic’s infrastructure and never exists in a single location.