Overview JavaScript
The Openfort JavaScript SDK is a JavaScript library client for Openfort that allows you to add secure authentication, non-custodial embedded wallets, and powerful UX infrastructure into your game.
Features
| Feature | Status |
|---|---|
| Sign in with email | ✅ |
| Sign in with OAuth | ✅ |
| Sign in with guest mode | ✅ |
| Sign in with Third-Party Auth | ✅ |
| Embedded wallet creation | ✅ |
| Embedded wallet recovery | ✅ |
| Embedded wallet signatures & transactions | ✅ |
| Native smart wallets | ✅ |
| Gas sponsorship | ✅ |
| Session keys | ✅ |
SDK Exports
The JavaScript SDK exports the following:
| Export | Description |
|---|---|
Openfort | Main SDK class |
openfortEvents | Global event emitter for subscribing to SDK events |
AuthApi | Authentication API namespace |
EmbeddedWalletApi | Embedded wallet API namespace |
UserApi | User management API namespace |
ProxyApi | Transaction proxy API namespace |
OpenfortError | Base error class |
AuthenticationError | Authentication-related errors |
AuthorizationError | Authorization-related errors |
ConfigurationError | SDK configuration errors |
OAuthError | OAuth provider errors |
OTPError | OTP verification errors |
RecoveryError | Wallet recovery errors |
RequestError | Network request errors |
SessionError | Session management errors |
SignerError | Signer/wallet errors |
UserError | User management errors |
OPENFORT_ERROR_CODES | Error code constants |
OPENFORT_AUTH_ERROR_CODES | Auth-specific error codes |
IStorage | Custom storage interface |
cryptoDigest | Crypto utility function |
RecoveryMethod | Recovery method enum (AUTOMATIC, PASSWORD, PASSKEY) |
AccountTypeEnum | Account type enum (SMART_ACCOUNT, EOA) |
ChainTypeEnum | Chain type enum (EVM, SVM) |
OAuthProvider | OAuth provider enum |
ThirdPartyOAuthProvider | Third-party auth provider enum |
OpenfortEvents | Event type constants |
For detailed error handling, see the Error Handling guide.
Get started
Check out these popular guides to get started.
Setting up the SDK
Project configuration
Setting up a project
Smart Wallets
Advanced wallet features
Using smart wallets
Embedded Wallet
Wallet creation & recovery
Create an embedded wallet
Templates
Check out these popular samples to get started.