Core SDK (@veridex/sdk)
The core SDK provides passkey-based wallet creation, multi-session key management, cross-chain transfers, spending limits, and ERC-8004 utilities.
Installation
npm install @veridex/sdkQuick Start
import { createSDK } from '@veridex/sdk';
const sdk = createSDK('base', { network: 'testnet' });
// Register a passkey (prompts biometric)
const credential = await sdk.passkey.register('alice', 'My Wallet');
// Create a bounded session
const session = await sdk.sessions.createSession({
permissions: ['transfer'],
chainScopes: [8453],
spendingLimit: { amount: 100_000_000n, token: 'USDC' },
duration: 3600,
label: 'web-app-session',
});Multi-Session Management
The SDK supports multiple concurrent sessions per identity. See the Multi-Session Guide for full details.
// Create multiple sessions
const webSession = await sdk.sessions.createSession({
label: 'web-app',
duration: 3600,
});
const agentSession = await sdk.sessions.createSession({
label: 'payment-agent',
spendingLimit: { amount: 50_000_000n, token: 'USDC' },
duration: 1800,
});
// List all active sessions
const sessions = await sdk.sessions.listSessions();
// Select a specific session
sdk.sessions.selectSession(agentSession.keyHash);
// Revoke a specific session without affecting others
await sdk.sessions.revokeSession(webSession.keyHash);Enterprise Factories
Convenience constructors for common deployment scenarios:
import {
createSDK,
createEnterpriseSDK,
createHubSDK,
createTestnetSDK,
createMainnetSDK,
createSessionSDK,
} from '@veridex/sdk';
// Enterprise — Multisig + recovery + cross-origin auth
const enterprise = createEnterpriseSDK('base', {
network: 'mainnet',
multisig: { threshold: 2, signers: [signer1, signer2, signer3] },
recovery: { guardians: [guardian1, guardian2], delay: 86400 },
});
// Hub — Shared passkey across multiple apps
const hub = createHubSDK('base', { network: 'testnet' });
// Session-scoped — For backend services
const session = createSessionSDK('base', {
network: 'testnet',
sessionKeyHash: existingKeyHash,
});MultisigManager
On-chain multisig with configurable thresholds:
const multisig = sdk.multisig;
// Propose a transaction
const proposal = await multisig.propose({
to: recipient,
value: amount,
data: '0x',
});
// Other signers approve
await multisig.approve(proposal.id);
// Execute when threshold is met
const receipt = await multisig.execute(proposal.id);RecoveryManager
Social recovery with guardian-based key rotation:
const recovery = sdk.recovery;
// Initiate recovery (requires guardian attestations)
const request = await recovery.initiateRecovery(newOwnerAddress);
// Guardians attest
await recovery.attestAsGuardian(request.id, guardianSigner);
// Execute after delay period
await recovery.executeRecovery(request.id);CrossOriginAuth
Shared passkey authentication across domains:
import { CrossOriginAuth } from '@veridex/sdk';
const crossOrigin = new CrossOriginAuth({
hubDomain: 'auth.veridex.io',
allowedOrigins: ['https://app1.example.com', 'https://app2.example.com'],
});
// Authenticate from any allowed origin
const credential = await crossOrigin.authenticate();InjectedWalletAdapter
Bridge existing browser wallets (MetaMask, etc.) into Veridex sessions:
import { InjectedWalletAdapter } from '@veridex/sdk';
const adapter = new InjectedWalletAdapter();
const session = await adapter.createSessionFromInjected({
permissions: ['transfer'],
spendingLimit: { amount: 100_000_000n, token: 'USDC' },
duration: 3600,
});Key APIs
| Method | Description |
|---|---|
sdk.passkey.register() | Register a new passkey credential |
sdk.passkey.authenticate() | Authenticate with existing passkey |
sdk.sessions.createSession() | Create a bounded session key |
sdk.sessions.listSessions() | List all valid sessions |
sdk.sessions.selectSession() | Set the active session |
sdk.sessions.revokeSession() | Revoke a specific session |
sdk.sessions.loadSession() | Load a session by key hash |
sdk.prepareTransfer() | Prepare a cross-chain transfer |
sdk.multisig.propose() | Propose multisig transaction |
sdk.multisig.approve() | Approve a multisig proposal |
sdk.recovery.initiateRecovery() | Start social recovery |
sdk.accounts.getAccountInfo() | Account metadata |
sdk.credentials.getAllStoredCredentials() | List stored credentials |
Related
- API Reference — Full method signatures and types
- React SDK — React hooks for wallet operations
- Multisig Wallet Guide — Multisig setup walkthrough
- Enterprise Manager Guide — Enterprise deployment
- Session Keys Guide — Deep dive into session key concepts
- Multi-Session Guide — Managing multiple concurrent sessions