Skip to content

solidusnetwork/sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solidus Network

Solidus SDK

License

TypeScript packages for building on the Solidus Network — a blockchain protocol for decentralized identity and verifiable credentials.

Published packages

Four production packages are published to npm under the @solidus-network scope (latest 0.3.0):

Package npm Description
@solidus-network/sdk npm Main SDK — DID resolution + rotation, credential issuance/verification, SD-JWT VC (incl. KB-JWT, status list, nested-path disclosure), on-chain queries
@solidus-network/auth npm DID-based authentication primitives — Ed25519 challenge, W3C VP verification
@solidus-network/types npm Shared TypeScript types — DIDs, Verifiable Credentials (Data Model 2.0), auth challenges
@solidus-network/bbs npm BBS+ selective-disclosure primitives — draft-irtf-cfrg-bbs-signatures, BLS12-381 SHA-256, byte-compatible with the on-chain implementation

Install

npm install \
  @solidus-network/sdk \
  @solidus-network/auth \
  @solidus-network/types \
  @solidus-network/bbs

Quick start

import { createSdk } from '@solidus-network/sdk'

const solidus = createSdk({
  mode: 'testnet',
  chain: {
    rpcUrl: 'https://rpc.solidus.network',
    network: 'testnet',
    signerPrivateKey: process.env.SOLIDUS_SIGNER_KEY!,
  },
})

// Resolve a DID — returns the W3C resolution metadata shape
const { didDocument, didDocumentMetadata } =
  await solidus.did.resolveWithMetadata('did:solidus:testnet:abc123')

// Issue a W3C VC 2.0 credential (as an authorised issuer)
const vc = await solidus.credentials.issue({
  subject: 'did:solidus:testnet:xyz789',
  type: ['VerifiableCredential', 'KYCVerified'],
  claims: { country: 'US', tier: 'standard' },
  validFrom: new Date().toISOString(),
})

SD-JWT VC (EUDI Wallet-aligned)

import { issueSdJwtVc, verifySdJwtVc, presentSdJwtVc } from '@solidus-network/sdk'

const sdJwt = await issueSdJwtVc({
  issuerPrivateKey,
  issuerDid: 'did:solidus:testnet:issuer1',
  vct: 'https://example.com/credentials/age',
  claims: { given_name: 'Ada', birth_date: '1990-01-01' },
  disclosable: ['birth_date'],
  holderJwk,
})

// Holder presents only the necessary claim, key-binding included
const presentation = await presentSdJwtVc({
  sdJwt, claimsToReveal: ['birth_date'],
  audience: 'https://verifier.example', nonce: 'abc',
  holderPrivateKey,
})

const result = await verifySdJwtVc({
  sdJwt: presentation,
  expectedAudience: 'https://verifier.example',
  expectedNonce: 'abc',
  issuerResolver: createChainBackedIssuerResolverFromRpc(),
})

BBS+ selective disclosure

import { signBbs, deriveProofBbs, verifyProofBbs } from '@solidus-network/bbs'

const signed = await signBbs({
  issuerSecretKey,
  messages: ['name=Ada', 'over18=true', 'birth_date=1990-01-01'],
})

// Holder discloses only "over18=true" — birth_date stays hidden
const proof = await deriveProofBbs({
  signature: signed,
  messages: signed.messages,
  reveal: [1], // index of "over18=true"
  nonce: 'verifier-nonce',
})

const ok = await verifyProofBbs({
  proof,
  revealedMessages: { 1: 'over18=true' },
  issuerPublicKey,
})

DID-based authentication

import { createChallenge, verifyPresentation } from '@solidus-network/auth'

const challenge = createChallenge('did:solidus:testnet:abc123', 300)
// Client signs the challenge nonce and returns a Verifiable Presentation
const result = await verifyPresentation({ presentation, challenge, getPublicKey })

Modes

  • stub — local Postgres-backed mock for development; no chain interaction.
  • testnet — talks to the Solidus testnet via JSON-RPC at rpc.solidus.network.
  • mainnet — reserved for the post-audit launch.

Documentation

Network

License

Apache-2.0 — see LICENSE (each published package ships its own copy).

About

Solidus SDK — TypeScript packages for decentralized identity (@solidus/auth, @solidus/sdk, @solidus/jwt)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors