SDK Overview
The Solidus SDK is a set of TypeScript packages for interacting with the Solidus Network. Create DIDs, issue and verify credentials, and authenticate users — all from a few function calls.
Packages
Installation
npm install @solidus-network/sdk @solidus-network/auth @solidus-network/typesOr with other package managers:
pnpm add @solidus-network/sdk @solidus-network/auth @solidus-network/typesyarn add @solidus-network/sdk @solidus-network/auth @solidus-network/typesSDK Modes
The SDK supports three operating modes, controlled by the mode option when creating the client.
| Mode | Backend | Use case |
|---|---|---|
stub | Local Postgres database | Local development and testing — no network calls |
testnet | JSON-RPC to rpc.solidus.network | Integration testing against the live testnet |
mainnet | JSON-RPC to mainnet (reserved) | Production — not yet available |
Quick Start
import \{ createSdk \} from '@solidus-network/sdk'
// 1. Create the SDK client in testnet mode
const sdk = createSdk(\{
mode: 'testnet',
chain: \{
rpcUrl: 'https://rpc.solidus.network',
signerPrivateKey: process.env.SIGNER_PRIVATE_KEY,
network: 'testnet',
\},
\})
// 2. Generate a key pair and create a DID
const keyPair = crypto.getRandomValues(new Uint8Array(32))
const did = await sdk.did.create(\{ publicKey: keyPair \})
console.log(did.id) // "did:solidus:testnet:7Kf9..."
// 3. Issue a credential
const credential = await sdk.credentials.issue(\{
subjectDid: did.id,
issuerDid: 'did:solidus:testnet:issuer123',
issuerPrivateKey: process.env.ISSUER_PRIVATE_KEY,
type: ['VerifiableCredential', 'KYCCredential'],
claims: \{
level: 1,
country: 'US',
verifiedAt: new Date().toISOString(),
\},
expiresInDays: 365,
\})
// 4. Verify the credential
const result = await sdk.credentials.verify(credential)
console.log(result.valid) // true
console.log(result.checks.signature) // true
console.log(result.checks.expiry) // true
console.log(result.checks.revocation) // trueNext Steps
- @solidus-network/sdk Reference — Full API reference for the main SDK
- @solidus-network/auth Reference — Challenge-response authentication protocol
- @solidus-network/types Reference — Complete TypeScript type definitions
Last updated on