VC API issuer service helper library (for Node.js / Typescript).
A VC-API Issuer service can host one or more issuer instances.
An instance is a per-usecase logical unit that configures several key properties:
- A set of cryptographic suites to be supported for this usecase (for example,
Ed25519Signature2020
suite). - An issuing DID and corresponding signing keys (that match the appropriate crypto suite above)
- A set of
@contexts
supported by this usecase (this can be loosely or strictly filtered by the credential type you intend to issue) - (For advanced VC API endpoints such as the Exchange endpoints) A set of business rules appropriate to your use case (rules for refreshing/re-issuing, rules for exchanging credentials, etc).
See also VC API issuing spec reference.
- Node.js 18+ is recommended.
To install via NPM:
npm install @digitalcredentials/issuer-core
To install locally (for development):
git clone https://github.com/digitalcredentials/issuer-core.git
cd issuer-core
npm install
You can use issuer-core
to help build a standalone VC-API issuer service.
For example:
import { IssuerInstance } from '@digitalcredentials/issuer-core'
import { securityLoader } from '@digitalcredentials/security-document-loader'
import { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020'
import fastify from 'fastify'
import * as didKey from '@digitalcredentials/did-method-key'
const documentLoader = securityLoader({ fetchRemoteContexts: true }).build()
// load secret key seed from config file, to generate issuer DID
const didKeyDriver = didKey.driver()
const {methodFor} = await didKeyDriver.generate({ seed })
const signingKeyPair = methodFor({ purpose: 'assertionMethod' })
const signingSuite = new Ed25519Signature2020({ key: signingKeyPair })
const issuerInstance = new IssuerInstance({ documentLoader, signingSuite })
const server = fastify(serverOptions)
server.post('/credentials/issue', async (req, res) => {
// parse the incoming body according to VC-API specs, validate via JSON Schema ...
const {credential, options} = parseBody(req)
const signedCredential = await issuerInstance.issueCredential({ credential, options })
// return it in the response etc
})
PRs accepted.
If editing the Readme, please conform to the standard-readme specification.
MIT License © 2023 Digital Credentials Consortium.