Core SDK
Framework-agnostic SDK for authentication, transactions, and wallet management.
The @embarkai/core package is the foundation of the EmbarkAI stack. It provides low-level modules for authentication, bundler interaction, MPC key management, server-side wallets, and blockchain utilities — all without any framework dependency. Use it directly in Node.js backends, serverless functions, CLI tools, or as the engine behind @embarkai/ui-kit.
Modules
| Module | Description |
|---|---|
| Auth | JWT-based authentication, session management, and token validation |
| Server Wallets | Create and manage MPC wallets from your backend with ServerWalletManager |
| Bundler | Build, send, and track ERC-4337 UserOperations |
| Contract Encoding | ABI encoding helpers for smart contract calls |
| Vault | Keyshare backup and restore via ShareVault (password-encrypted cloud storage) |
Additional internal modules:
- clients — Low-level API clients for TSS service, server wallet operations, and account management.
- mpc — DKLS23 Threshold Signature Scheme primitives (DKG, signing rounds).
- utils — Shared utilities for hex encoding, address formatting, and chain helpers.
- config — Built-in chain configurations for all supported networks.
Installation
npm install @embarkai/coreFor server-side wallet operations, you also need the TSS WASM module:
npm install dkls23-wasmWhen to Use
| Scenario | Package |
|---|---|
| React frontend with UI components | @embarkai/ui-kit (includes core internally) |
| Node.js backend, server wallets | @embarkai/core |
| AI agent / MCP server | @embarkai/mcp (includes core internally) |
| CLI tool or script | @embarkai/core |
| Custom frontend (non-React) | @embarkai/core |
Quick Example
Server Wallet (Node.js)
import {
createServerWalletManager,
MemoryKeyshareStorage,
} from '@embarkai/core'
const manager = createServerWalletManager({
apiKey: process.env.EMBARK_API_KEY!,
chainId: 994873017, // Lumia Mainnet
storage: new MemoryKeyshareStorage(), // Use secure storage in production!
})
// Create a wallet
const wallet = await manager.createWallet('treasury_main')
console.log('Smart Account:', wallet.smartAccountAddress)
// Send a transaction
const userOpHash = await wallet.sendUserOperation(
'0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
'1000000000000000000', // 1 LUMIA
)
// Wait for receipt
const receipt = await wallet.waitForUserOperationReceipt(userOpHash)
console.log('TX Hash:', receipt.transactionHash)Chain Configuration
import { getChainConfig, isChainSupported } from '@embarkai/core'
const config = getChainConfig(994873017) // Lumia Mainnet
console.log(config?.name) // 'Lumia Prism Mainnet'
console.log(config?.rpcUrls[0]) // 'https://mainnet-rpc.lumia.org'
console.log(config?.bundlerUrl) // 'https://api.lumiapassport.com/rundler-prism'Architecture
@embarkai/core
├── auth/ -- JWT authentication and session tokens
├── bundler/ -- ERC-4337 UserOperation builder and sender
├── clients/ -- ServerWalletManager, ServerWalletClient
├── config/ -- Chain configs (Lumia, Sepolia, BSC, Arbitrum, Base)
├── mpc/ -- DKLS23 TSS protocol helpers
├── utils/ -- Encoding, formatting, address utilities
└── vault/ -- Keyshare backup/restore with password encryptionNext Steps
- Set up Server Wallets for backend wallet management.
- Explore the Bundler for sending UserOperations.
- Review supported chains for network configuration.
Last updated on