Credential Issuance Server Setup
Install Express
This example demonstrates how to use Express to set up the VC issuance service. Follow these instructions to install Express.
Install Credentials Package​
You'll also need to install @web5/credentials
to create and issue credentials:
npm install @web5/credentials@1.1.1
Create a DID​
Additionally, to issue credentials, you need a Decentralized Identifier (DID) which will serve as your Issuer's identity.
If you don't already have one, you'll need to create a DID with an IDV (Identity Verification) service endpoint:
If you have an existing DID you'll need to update that DID Document with an IDV service endpoint:
Create API Service​
-
Ensure you have a file, such as
main.js
, to act as your API's entry point, which was created during the Express setup. -
Within the file, import the following:
import { api } from './api.js';
- To start your Express API service, add the following:
const config = {
port: 3000, // this can be any port you want to listen on
};
const server = api.listen(config.port, () => {
log.info(`Server listening on port ${config.port}`);
});
- Next, create an
api.js
file. This file will define the core API routes and logic for issuing credentials:
import express from 'express';
import { VerifiableCredential, Jwt } from '@web5/credentials';
const app = express();
app.use(express.json());
app.get('/example-route', async (req, res) => {
// implement the API route here
});
// Export the app so it can be imported in your <code>main.js</code> file
export { app as api };
Next Steps​
Now that you have your server environment set up, depending on your use case, you can proceed with one of the following guides:
Was this page helpful?
Connect with us on Discord
Submit feedback: Open a GitHub issue
Edit this page: GitHub Repo
Contribute: Contributing Guide