Server SDK
Setup and use the Capsule Server SDK for secure server-side operations
Overview
The Capsule Server SDK enables secure server-side signing by importing client-side sessions, ideal for automated transaction signing and server-side wallet operations. The server SDK provides nearly identical functionality to client-side implementations, allowing seamless transition between environments.
You can also use the Server SDK with pre-generated wallets if your use case requires wallet creation to occur
server-side. To do this, follow the steps outlined in the Pre-generated Wallet Integration Guide and import the @usecapsule/server-sdk
package in your server-side environment instead of the relevant client side package.
Installation
Usage
When you need to perform signing operations server-side, you can export an active session from your client application and import it into a server-side Capsule instance. This creates a server-side replica of your client-side wallet that can perform the same operations.
Export Client Session
In your client application, export the active session to get a serialized string:
Initialize Server SDK
On your server, initialize the Capsule Server SDK:
Import Session
Import the serialized session to create a functional server-side client:
Perform Operations
Use the server-side instance just like a client-side one:
Implement secure session transfer between client and server. The server can only perform signing while the imported session remains valid.
Examples
Explore our example implementation of the Server SDK:
Best Practices
- Keep imported sessions secure and ephemeral
- Implement proper error handling for invalid sessions
- Monitor signing operations for security
- Regularly refresh sessions to maintain functionality
Was this page helpful?