@solana/keychain-para
v1.2.0
Published
Para MPC signer for Solana transactions
Maintainers
Readme
@solana/keychain-para
Para MPC signer for Solana transactions using Para's REST API.
Installation
pnpm add @solana/keychain-paraPrerequisites
- A Para account with API access
- A Para secret API key (server-side only, starts with
sk_) - A Solana wallet created via the Para REST API or dashboard
Usage
Create and Initialize
import { createParaSigner } from '@solana/keychain-para';
// Create and initialize the signer (fetches public key from Para API)
const signer = await createParaSigner({
apiKey: 'your-para-secret-key',
walletId: 'your-para-wallet-id',
});
console.log('Signer address:', signer.address);Sign Messages
import { createSignableMessage } from '@solana/signers';
const message = createSignableMessage('Hello, Para!');
const [signatures] = await signer.signMessages([message]);Sign Transactions
// Sign transactions using Para's API
const [signatures] = await signer.signTransactions([transaction]);Check Availability
const available = await signer.isAvailable();
console.log('Para wallet available:', available);With Rate Limiting
If you're signing multiple transactions/messages concurrently and want to avoid rate limits:
const signer = await createParaSigner({
apiKey: 'your-para-secret-key',
walletId: 'your-para-wallet-id',
requestDelayMs: 100, // 100ms delay between concurrent requests
});Configuration
ParaSignerConfig
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| apiKey | string | Yes | Your Para secret API key (starts with sk_) |
| walletId | string | Yes | The Para wallet UUID to use for signing |
| apiBaseUrl | string | No | Custom API base URL (default: https://api.getpara.com) |
| requestDelayMs | number | No | Delay in ms between concurrent signing requests (default: 0) |
How It Works
- Initialization: Fetches the wallet's public key from Para's REST API during creation
- Signing: Sends raw bytes (hex-encoded) to Para's
/v1/wallets/:walletId/sign-rawendpoint - Response: Decodes the hex-encoded Ed25519 signature from Para's response
Para uses MPC (Multi-Party Computation) for key management — private keys are never assembled in a single location.
Error Handling
The signer will throw errors with specific codes from @solana/keychain-core:
CONFIG_ERROR- Invalid configuration (missing apiKey or walletId)HTTP_ERROR- Network request failedREMOTE_API_ERROR- Para API returned an errorPARSING_ERROR- Failed to parse Para response
import { SignerErrorCode } from '@solana/keychain-core';
try {
await signer.signMessages([message]);
} catch (error) {
if (error.code === SignerErrorCode.REMOTE_API_ERROR) {
console.error('Para API error:', error.message);
}
}Security Notes
- Store your secret key securely (use environment variables)
- Never expose your secret key in client-side code — it starts with
sk_for a reason - This signer is intended for server-side use or secure environments
- Para handles key management via MPC — your private keys never leave Para's infrastructure
Resources
License
MIT
