> ## 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.

# Quickstart: Credential Verifier Template

> Fork, configure, and deploy the AIR Credential Verifier template — a ready-to-use verifier app for checking AIR Credentials with zero-knowledge proofs.

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](https://img.shields.io/github/stars/MocaNetwork/air-credential-issuance-template?style=social)](https://github.com/MocaNetwork/air-credential-verifier-template)

## 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](/airkit/airkit-dashboard#_1-general-settings)                          | [Sandbox Developer Dashboard](https://developers.sandbox.air3.com/dashboard)                            |
| **Verification Program ID** | Create Program. Learn how to create a program [here](/airkit/quickstart/verify-credentials#step-6-setup-verification-program) | [Sandbox Dashboard (Verifier Section)](https://developers.sandbox.air3.com/dashboard/verifier/programs) |

### 1.2 Local Development

1. **Clone the Repository**

   ```bash theme={null}
   git clone https://github.com/MocaNetwork/air-credential-verifier-template.git
   cd air-credential-verifier-template
   ```

2. **Install Dependencies**

   ```bash theme={null}
   pnpm install
   # or npm install
   ```

3. **Configure Environment Variables**
   Copy the example file to start configuring your settings:

   ```bash theme={null}
   cp .env.example .env.local
   ```

4. **Start the Development Server**

   ```bash theme={null}
   pnpm dev
   # or npm run dev
   ```

   Your verifier app is now running at [http://localhost:3000](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](https://developers.sandbox.air3.com/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 theme={null}
   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 theme={null}
   # .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 theme={null}
   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](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/MocaNetwork/air-credential-verifier-example\&env=NEXT_PUBLIC_PARTNER_ID,NEXT_PUBLIC_VERIFIER_PROGRAM_ID,NEXT_PUBLIC_ISSUER_URL,NEXT_PUBLIC_SITE_NAME,NEXT_PUBLIC_SITE_DESCRIPTION,NEXT_PUBLIC_BUILD_ENV,NEXT_PUBLIC_THEME,PARTNER_PRIVATE_KEY,SIGNING_ALGORITHM\&envDescription=Configure%20your%20AIR%20Kit%20credentials%20and%20application%20settings\&envLink=https://github.com/MocaNetwork/air-credential-verifier-example/blob/main/README.md)

### 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](https://ui.shadcn.com/docs/theming).
* **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. |
