Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Overview Unity

The Openfort Unity SDK is a Unity library client for Openfort that allows you to add secure authentication, non-custodial embedded wallets, and powerful UX infrastructure into your game.

Get started

Check out these popular guides to get started.

Templates

Check out these popular samples to get started.

SDK Reference

The Unity SDK provides the following main components:

OpenfortSDK Class

The OpenfortSDK class is the main entry point for interacting with the SDK.

MethodDescription
Init(publishableKey, ...)Initialize the SDK singleton
OnAuthEventEvent for authentication state changes

Authentication Methods

MethodDescription
SignUpGuest()Sign up as guest user
LogInWithEmailPassword()Log in with email and password
SignUpWithEmailPassword()Sign up with email and password
RequestEmailOtp()Request OTP to email
LogInWithEmailOtp()Log in with email OTP
VerifyEmailOtp()Verify email using OTP
RequestPhoneOtp()Request OTP to phone
LogInWithPhoneOtp()Log in with phone OTP
LinkPhoneOtp()Link phone number with OTP
AddEmail()Add email to account
InitOAuth()Initialize OAuth flow
InitLinkOAuth()Initialize OAuth linking
UnlinkOAuth()Unlink OAuth provider
InitSiwe()Initialize SIWE authentication
LoginWithSiwe()Log in with SIWE
InitLinkSiwe()Initialize SIWE linking
LinkWithSiwe()Link wallet with SIWE
UnlinkWallet()Unlink wallet from account
LogInWithIdToken()Log in with external ID token
RequestResetPassword()Request password reset
ResetPassword()Reset password with token
RequestEmailVerification()Request email verification
VerifyEmail()Verify email with token

Session Management

MethodDescription
GetUser()Get current user info
Logout()Log out and remove credentials
GetAccessToken()Get saved access token
ValidateAndRefreshToken()Validate and refresh token
StoreCredentials()Store authentication credentials

Embedded Wallet Methods

MethodDescription
GetEmbeddedState()Get embedded wallet state
GetEthereumProvider()Get Ethereum provider interface
CreateEmbeddedWallet()Create new embedded wallet
RecoverEmbeddedWallet()Recover embedded wallet
GetEmbeddedWallet()Get current embedded wallet
ListWallets()List all wallets
ConfigureEmbeddedWallet()Configure embedded wallet

Transaction/Signing Methods

MethodDescription
SendSignatureTransactionIntentRequest()Sign and send transaction intent
SignMessage()Sign a message (EIP-191)
SignTypedData()Sign typed data (EIP-712)

Enums

EnumValues
EmbeddedStateNONE, UNAUTHENTICATED, EMBEDDED_SIGNER_NOT_CONFIGURED, CREATING_ACCOUNT, READY
OAuthProviderGOOGLE, TWITTER, APPLE, FACEBOOK, DISCORD, EPIC_GAMES, LINE
ChainTypeEVM, SVM
AccountTypeEOA, SMART_ACCOUNT, DELEGATED_ACCOUNT
RecoveryMethodPASSWORD, AUTOMATIC, PASSKEY

Error Handling

TypeDescription
OpenfortExceptionBase exception class for SDK errors
OpenfortErrorTypeError type enum (INITIALIZATION_ERROR, AUTHENTICATION_ERROR, etc.)

For detailed usage examples, see the individual method documentation pages.

Copyright © 2023-present Alamas Labs, Inc