JavaScript SDK
The Openfort SDK for JavaScript
Installation#
Prerequisites
In order to integrate Openfort, you project must:
- a Node v20 (Active LTS version) or higher.
- a minimum TypeScript version of 5
Installing the Openfort SDK#
Installing the Openfort SDK is simple. npm packages are available for the latest version of the SDK.
Note: If you experience complications, ensure you have the most recent release by running:
_10# Using npm_10rm -Rf node_modules_10npm cache clean --force_10npm i_10_10# Using yarn_10rm -Rf node_modules_10yarn cache clean_10yarn install
Initialization#
Each module of the Openfort SDK must be initialized with an instance of OpenfortSDKConfiguration
. This configuration is shared across modules and defines settings such as the current environment.
Initialize an instance of OpenfortSDKConfiguration
as follows:
_10const sdk = new Openfort({ baseConfiguration: { publishableKey: "pk_test_XXXXXXX"} });
Supported Functionality#
The SDK supports a wide range of methods, including user authentication, wallet management, transaction signing, and more.
Method | Functionality |
---|---|
Init | Initializes OpenfortSDK with various parameters |
LogInWithEmailPassword | Logs the user in using email and password |
SignUpWithEmailPassword | Signs up a new user with email and password |
LinkEmailPassword | Links an email and password to the user account |
UnlinkEmailPassword | Unlinks an email and password from the user account |
RequestResetPassword | Requests a password reset |
ResetPassword | Resets the user's password |
RequestEmailVerification | Requests an email verification |
VerifyEmail | Verifies the user's email |
InitOAuth | Initializes OAuth for the user |
AuthenticateWithOAuth | Authenticates the user with OAuth |
UnlinkOAuth | Unlinks OAuth from the user account |
PoolOAuth | Pools OAuth for the user account |
InitLinkOAuth | Initializes the link OAuth process |
AuthenticateWithThirdPartyProvider | Authenticates the user with a third-party provider |
InitSiwe | Initializes Sign-In with Ethereum (SIWE) |
AuthenticateWithSiwe | Authenticates the user with SIWE |
LinkWallet | Links a wallet to the user account |
UnlinkWallet | Unlinks a wallet from the user account |
StoreCredentials | Stores authentication credentials |
GetUser | Gets the user information |
Logout | Logs the user out and removes stored credentials |
GetAccessToken | Gets the currently saved access token |
ValidateAndRefreshToken | Validates and refreshes the access token |
SendSignatureTransactionIntentRequest | Sends a signature transaction intent request |
SignMessage | Signs a message |
SignTypedData | Signs typed data |
SendSignatureSessionRequest | Sends a transaction signed by a session |
GetEmbeddedState | Gets the embedded state |
GetEthereumProvider | Gets the Ethereum provider |
ConfigureEmbeddedSigner | Configures the embedded signer |