Documentation Index
Fetch the complete documentation index at: https://docs.moca.network/llms.txt
Use this file to discover all available pages before exploring further.
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!
Local Setup & Prerequisites
Ensure your environment is ready and you have obtained the necessary credentials from the Partner Dashboard.
1.1 Prerequisites Checklist
| Item | Requirement | Source |
|---|
| Node.js | v18 or later | Development Environment |
| Package Manager | pnpm (recommended) or npm | Development Environment |
| Partner ID | Obtain PartnerID. Understand more on Partner ID here | Sandbox Developer Dashboard |
| Verification Program ID | Create Program. Learn how to create a program here | Sandbox Dashboard (Verifier Section) |
1.2 Local Development
-
Clone the Repository
git clone https://github.com/MocaNetwork/air-credential-verifier-template.git
cd air-credential-verifier-template
-
Install Dependencies
pnpm install
# or npm install
-
Configure Environment Variables
Copy the example file to start configuring your settings:
cp .env.example .env.local
-
Start the Development Server
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
- Log into the Sandbox Developer Dashboard.
- Retrieve your Partner ID from Account -> General Settings.
- Under the Verifier section, create a Verification Program appropriate for the credentials you wish to accept.
- 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.
-
Generate an ES256 Private Key:
openssl ecparam -name prime256v1 -genkey -noout | openssl pkcs8 -topk8 -nocrypt | tr -d '\n'
-
Copy the generated key (the content between
BEGIN and END lines) and set it securely as a server-side variable.
# .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
- Build the application:
pnpm build
# or npm run build
- 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:
- Go to the Sandbox Developer Dashboard (Account > Domains).
- 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:
3.4 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
| Variable | Description | Example Value |
|---|
NEXT_PUBLIC_PARTNER_ID | Your Partner ID. | partner_abc123 |
NEXT_PUBLIC_VERIFIER_PROGRAM_ID | The ID of your Verification Program. | verify_prog_987 |
NEXT_PUBLIC_ISSUER_URL | URL where users can go to get the credential. | https://my-issuer.com |
NEXT_PUBLIC_SITE_NAME | Site/application name for display. | Moca Access Portal |
NEXT_PUBLIC_RETURN_URL | Redirect URL after verification. | /dashboard |
NEXT_PUBLIC_BUILD_ENV | Build environment. | sandbox or production |
Server-side Environment Variables
| Variable | Description |
|---|
PARTNER_PRIVATE_KEY | Your private key (must be kept secret). |
SIGNING_ALGORITHM | Algorithm for signing the JWT (e.g., ES256). |
Additional Client-side Variables
| Variable | Description |
|---|
NEXT_PUBLIC_SITE_DESCRIPTION | Site description text. |