@solidus-network/sdk
The main SDK package. The createSdk factory returns a client with three namespaces: did, credentials, and auth.
import \{ createSdk \} from '@solidus-network/sdk'
const sdk = createSdk(\{
mode: 'testnet',
chain: \{
rpcUrl: 'https://rpc.solidus.network',
signerPrivateKey: '0xabc...def',
network: 'testnet',
\},
\})Chain Configuration
The chain option configures the connection to the Solidus Network.
interface ChainConfig \{
rpcUrl: string // JSON-RPC endpoint URL
signerPrivateKey: string // Hex-encoded Ed25519 private key for signing transactions
network: 'testnet' | 'mainnet'
signerAddress?: string // Optional — derived from signerPrivateKey if omitted
\}Transaction signing uses Ed25519 over BLAKE3(publicKey || nonce_le || json(payload)).
Address derivation computes BLAKE3(publicKey), takes the first 20 bytes, and base58-encodes the result.
did.create
Creates a new DID document on-chain.
sdk.did.create(params: \{ publicKey: Uint8Array \}): Promise<DIDDocument>Parameters
| Name | Type | Description |
|---|---|---|
publicKey | Uint8Array | Ed25519 public key (32 bytes) |
Returns a DIDDocument containing the new DID identifier, verification methods, and metadata.
Example
const publicKey = new Uint8Array(32) // your Ed25519 public key
const didDocument = await sdk.did.create(\{ publicKey \})
console.log(didDocument.id)
// "did:solidus:testnet:7Kf9xB2..."
console.log(didDocument.verificationMethod[0].type)
// "Ed25519VerificationKey2020"did.resolve
Resolves an existing DID to its document.
sdk.did.resolve(did: string): Promise<DIDDocument | null>Parameters
| Name | Type | Description |
|---|---|---|
did | string | The DID to resolve (e.g. did:solidus:testnet:7Kf9...) |
Returns the DIDDocument if found, or null if the DID does not exist or has been deactivated.
Example
const doc = await sdk.did.resolve('did:solidus:testnet:7Kf9xB2...')
if (doc) \{
console.log(doc.authentication)
// ["did:solidus:testnet:7Kf9xB2...#key-1"]
\} else \{
console.log('DID not found')
\}did.deactivate
Permanently deactivates a DID. After deactivation, did.resolve returns null and any credentials issued to this DID can no longer be verified.
sdk.did.deactivate(did: string): Promise<void>Parameters
| Name | Type | Description |
|---|---|---|
did | string | The DID to deactivate |
Example
await sdk.did.deactivate('did:solidus:testnet:7Kf9xB2...')
// DID is now permanently deactivatedcredentials.issue
Issues a new verifiable credential on-chain.
sdk.credentials.issue(params: IssueCredentialParams): Promise<VerifiableCredential>Parameters
| Name | Type | Required | Description |
|---|---|---|---|
subjectDid | string | Yes | DID of the credential subject |
issuerDid | string | Yes | DID of the issuer |
issuerPrivateKey | string | Yes | Hex-encoded Ed25519 private key of the issuer |
type | string[] | Yes | Credential types (e.g. ['VerifiableCredential', 'KYCCredential']) |
claims | Record<string, unknown> | Yes | Claims to include in credentialSubject |
expiresInDays | number | No | Days until expiration (omit for no expiry) |
network | string | No | Network override ('testnet' or 'mainnet') |
Returns a VerifiableCredential with a cryptographic proof attached.
Example
const credential = await sdk.credentials.issue(\{
subjectDid: 'did:solidus:testnet:subject123',
issuerDid: 'did:solidus:testnet:issuer456',
issuerPrivateKey: '0xabc...def',
type: ['VerifiableCredential', 'KYCCredential'],
claims: \{
level: 2,
country: 'DE',
documentType: 'passport',
verifiedAt: '2026-05-07T12:00:00Z',
\},
expiresInDays: 365,
\})
console.log(credential.id)
// "urn:uuid:a1b2c3d4-..."
console.log(credential.proof.type)
// "Ed25519Signature2020"credentials.verify
Verifies a credential’s signature, expiration, and revocation status.
sdk.credentials.verify(credential: VerifiableCredential): Promise<VerificationResult>Parameters
| Name | Type | Description |
|---|---|---|
credential | VerifiableCredential | The credential to verify |
Returns a VerificationResult with the overall validity and individual check results.
interface VerificationResult \{
valid: boolean
credentialId?: string
error?: string
checks: \{
signature: boolean // Ed25519 signature is valid
expiry: boolean // Credential has not expired
revocation: boolean // Credential has not been revoked
\}
\}Example
const result = await sdk.credentials.verify(credential)
if (result.valid) \{
console.log('Credential is valid')
console.log('Credential ID:', result.credentialId)
\} else \{
console.log('Verification failed:', result.error)
console.log('Signature OK:', result.checks.signature)
console.log('Not expired:', result.checks.expiry)
console.log('Not revoked:', result.checks.revocation)
\}credentials.revoke
Revokes a credential by its ID. Once revoked, credentials.verify will return checks.revocation: false.
sdk.credentials.revoke(credentialId: string): Promise<void>Parameters
| Name | Type | Description |
|---|---|---|
credentialId | string | The credential ID (e.g. urn:uuid:a1b2c3d4-...) |
Example
await sdk.credentials.revoke('urn:uuid:a1b2c3d4-...')
// Credential is now revoked on-chaincredentials.query
Queries all credentials issued to a given DID.
sdk.credentials.query(subjectDid: string): Promise<VerifiableCredential[]>Parameters
| Name | Type | Description |
|---|---|---|
subjectDid | string | The DID to query credentials for |
Returns an array of VerifiableCredential objects.
Example
const credentials = await sdk.credentials.query(
'did:solidus:testnet:subject123'
)
for (const cred of credentials) \{
console.log(cred.type, cred.issuanceDate)
\}
// ["VerifiableCredential", "KYCCredential"] "2026-05-07T12:00:00Z"auth.createChallenge
Creates a time-limited authentication challenge for a DID. The challenge must be signed and returned as a verifiable presentation within the TTL window.
sdk.auth.createChallenge(did: string): Promise<Challenge>Parameters
| Name | Type | Description |
|---|---|---|
did | string | The DID to challenge |
Returns a Challenge object with a 300-second (5-minute) TTL.
interface Challenge \{
id: string // UUID
did: string // The challenged DID
nonce: string // 32-byte random hex nonce
issuedAt: string // ISO 8601 timestamp
expiresAt: string // ISO 8601 timestamp (issuedAt + 300s)
\}Example
const challenge = await sdk.auth.createChallenge(
'did:solidus:testnet:user789'
)
console.log(challenge.nonce)
// "a4f2e8c1d3b5..."
console.log(challenge.expiresAt)
// "2026-05-07T12:05:00Z"auth.verifyPresentation
Verifies a signed verifiable presentation against a previously issued challenge.
sdk.auth.verifyPresentation(
challengeId: string,
presentation: VerifiablePresentation
): Promise<PresentationVerificationResult>Parameters
| Name | Type | Description |
|---|---|---|
challengeId | string | The challenge ID to verify against |
presentation | VerifiablePresentation | The signed presentation from the holder |
Verification checks (all must pass):
- notExpired — the challenge has not exceeded its 300-second TTL
- holderMatches — the presentation holder matches the challenged DID
- nonceMatches — the presentation proof challenge matches the issued nonce
- signatureValid — the Ed25519 signature over the presentation is valid
Example
const result = await sdk.auth.verifyPresentation(
challenge.id,
signedPresentation
)
if (result.valid) \{
console.log('Authenticated as:', result.did)
\} else \{
console.log('Auth failed:', result.error)
\}