Skip to content

Credential issuing/verifying backend for cheqd Wallet identity features

License

Notifications You must be signed in to change notification settings

verida/credential-service

 
 

Repository files navigation

Credential Service

GitHub release (latest by date) GitHub Release Date GitHub license

GitHub release (latest by date including pre-releases) GitHub commits since latest release (by date) GitHub contributors

GitHub Workflow Status GitHub Workflow Status GitHub repo size

ℹ️ Overview

The purpose of this service is to issue and verify credentials. This service by itself does not take care of storing the credentials. If you'd like to store credentials, you would have to pair this service with secret-box-service. This service is also dependent on auth0-service

📖 Endpoints

Issue a credential

  • Endpoint POST /api/credentials/issue
  • Accepts: application/json
  • Request Body: JSON object with following fields
    • claim - Claim received from the Auth0 Service
    • provider - Auth0 login provider (eg: Twitter, Discord, Github, etc)
    • subjectId - ID of the holder of the credential
  • Success Response Code: 200
  • Error Response Code - 400

Verify a Credential

  • Endpoint POST /api/credentials/verify
  • Accepts: application/json
  • Request Body: JSON object with following fields:
    • credential - A verifiable credential
  • Success Response Code - 200
  • Error Response Codes:
    • 400: Bad request body
    • 405: Wrong content type

Health Check

  • Endpoint: /api/credentials (This endpoint only returns a "PONG" as response with status code 200)

🧑‍💻🛠 Developer Guide

Setup

Dependencies can be installed using NPM or any other node package manager.

npm install
npm run build

Configuration

The application expects the following environment variables to be defined for the app to function:

  1. ISSUER_ID_PRIVATE_KEY_HEX: Hex-encoded private key to be used by the identity credential issuer
  2. ISSUER_ID_PUBLIC_KEY_HEX: Hex-encoded public key to be used by the identity credential issuer
  3. ISSUER_ID_KID: Key ID to match a specific key inside a JWK
  4. ISSUER_ID_METHOD: did:cheqd method along with network namespace (e.g., did:cheqd:mainnet: or did:cheqd:testnet:)
  5. ISSUER_ID_METHOD_SPECIFIC_ID: Unique identifier portion of a did:cheqd DID, e.g., zAXwwqZzhCZA1L77ZBa8fhVNjL9MQCHX
  6. ISSUER_ID: Fully-qualified DID for the issuer, e.g., did:cheqd:mainnet:zAXwwqZzhCZA1L77ZBa8fhVNjL9MQCHX
  7. COSMOS_PAYER_MNEMONIC: Mnemonic for the issuer's Cosmos account. This currently doesn't require any balances at the moment, but it required for the library to function.
  8. NETWORK_RPC_URL: RPC URL for a node on cheqd network, e.g., rpc.cheqd.net
  9. AUTH0_SERVICE_ENDPOINT: Auth0 service endpoint, is an instance of Auth0 Service

Run

Once configured, the app can be run using NPM:

npm start

Or, to build and run in Docker, use the Dockerfile provided.

docker build -t credential-service .

🐞 Bug reports & 🤔 feature requests

If you notice anything not behaving how you expected, or would like to make a suggestion / request for a new feature, please create a new issue and let us know.

💬 Community

The cheqd Community Slack is our primary chat channel for the open-source community, software developers, and node operators.

Please reach out to us there for discussions, help, and feedback on the project.

🙋 Find us elsewhere

Telegram Discord Twitter LinkedIn Slack Medium YouTube

About

Credential issuing/verifying backend for cheqd Wallet identity features

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 89.1%
  • Dockerfile 10.2%
  • JavaScript 0.7%