Skip to content

Quickstart: Credential Verifier Template

This guide provides the steps necessary to set up, configure, and deploy the AIR Credential Verifier template, allowing your application to instantly verify credentials using AIR Kit.

🌟 Support the Project

If you find this template useful, please consider starring the repository on GitHub!

Star on GitHub

Local Setup & Prerequisites

Ensure your environment is ready and you have obtained the necessary credentials from the Partner Dashboard.

1.1 Prerequisites Checklist

ItemRequirementSource
Node.jsv18 or laterDevelopment Environment
Package Managerpnpm (recommended) or npmDevelopment Environment
Partner IDObtain PartnerID. Understand more on Partner ID hereSandbox Developer Dashboard
Verification Program IDCreate Program. Learn how to create a program hereSandbox Dashboard (Verifier Section)

1.2 Local Development

  1. Clone the Repository

    bash
    git clone https://github.com/MocaNetwork/air-credential-verifier-template.git
    cd air-credential-verifier-template
  2. Install Dependencies

    bash
    pnpm install
    # or npm install
  3. Configure Environment Variables Copy the example file to start configuring your settings:

    bash
    cp .env.example .env.local
  4. Start the Development Server

    bash
    pnpm dev
    # or npm run dev

    Your verifier app is now running at http://localhost:3000.

Customizing the Verifier Template

This section covers setting up your verification program and the essential JWT signing key.

2.1 Set Verification Details

  1. Log into the Sandbox Developer Dashboard.
  2. Retrieve your Partner ID from Account -> General Settings.
  3. Under the Verifier section, create a Verification Program appropriate for the credentials you wish to accept.
  4. Update the following variables in your .env.local:
    • NEXT_PUBLIC_PARTNER_ID
    • NEXT_PUBLIC_VERIFIER_PROGRAM_ID

2.2 Set up Partner Signing Key

A private key is necessary for JWT signing during the verification process.

  1. Generate an ES256 Private Key:

    bash
    openssl ecparam -name prime256v1 -genkey -noout | openssl pkcs8 -topk8 -nocrypt | tr -d '\n'
  2. Copy the generated key (the content between BEGIN and END lines) and set it securely as a server-side variable.

    bash
    # .env.local (Server-side)
    PARTNER_PRIVATE_KEY="MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg..."

    ⚠️ Security Note: This key must be kept secret and never committed to source control.

Deployment & Finalization

The verifier template is designed for a simple development, testing, and deployment cycle.

3.1 Production Build and Deployment

  1. Build the application:
    bash
    pnpm build
    # or npm run build
  2. Deploy the output to your hosting service.

3.2 Whitelist Your Domain (Critical Step)

To ensure secure communication between your deployed verifier application and the AIR Kit services:

  1. Go to the Sandbox Developer Dashboard (Account > Domains).
  2. Add your deployed application URL (e.g., https://my-verifier-app.com) to the allowed domains list.

3.3 Deploying to Vercel

Click the button below to deploy directly to Vercel:

Deploy with Vercel

3.3 Customizing the UX

  • UI/Theming: This project uses Shadcn UI. Customize the look by setting the NEXT_PUBLIC_THEME and referring to the Shadcn UI Theming Guide.
  • Redirects: Control the post-verification experience by setting these optional variables:
    • NEXT_PUBLIC_RETURN_SITE_NAME: Display name of your app for users returning after verification.
    • NEXT_PUBLIC_RETURN_URL: The URL where users are redirected after successful verification.

Configuration Reference

Client-side Environment Variables

VariableDescriptionExample Value
NEXT_PUBLIC_PARTNER_IDYour Partner ID.partner_abc123
NEXT_PUBLIC_VERIFIER_PROGRAM_IDThe ID of your Verification Program.verify_prog_987
NEXT_PUBLIC_ISSUER_URLURL where users can go to get the credential.https://my-issuer.com
NEXT_PUBLIC_SITE_NAMESite/application name for display.Moca Access Portal
NEXT_PUBLIC_RETURN_URLRedirect URL after verification./dashboard
NEXT_PUBLIC_BUILD_ENVBuild environment.sandbox or production

Server-side Environment Variables

VariableDescription
PARTNER_PRIVATE_KEYYour private key (must be kept secret).
SIGNING_ALGORITHMAlgorithm for signing the JWT (e.g., ES256).
NEXT_PUBLIC_SITE_DESCRIPTIONSite description text.