Skip to main content
This recipe shows how to issue a verifiable KYC credential the moment your identity provider confirms a user, using Direct Issuance script-based direct issuance. The user never needs to be in an active session.

What you’ll build

  1. A webhook handler that fires when your KYC provider confirms a user.
  2. A Partner JWT signed with the issue scope; the user’s email is sent separately to initialize-user.
  3. A call to initialize-user to resolve the recipient’s DID and public key.
  4. Issuance: build the VC, sign it with issuer keys, encrypt it to the holder, and store it in DStorage.

Prerequisites

  • Direct Issuance enabled for your partner account
  • A published issuance program with a schema that includes KYC fields (e.g. kycVerified, kycLevel, verifiedAt)
  • Partner JWT signing configured (RS256 or ES256)
  • Issuer signing keys available to your backend

Step 1: Handle the KYC webhook

When your KYC provider (Sumsub, Onfido, Jumio, etc.) sends a verification-complete callback, extract the user email and verification result.

Step 2: Sign a Partner JWT

Generate a short-lived JWT with scope: "issue". The JWT does not carry an email claim — the recipient is identified in the initialize-user call below.
The recipient’s email (passed to initialize-user) is the routing key that determines which AIR Account the credential lands in. Resolve it from the triggering event, and never reuse a partner, service, admin, or static email across recipients — every credential issued against that email lands in the same account.

Step 3: Resolve the user and issue

Resolve the recipient’s AIR Account with initialize-user, then build, sign, encrypt, and store the credential. buildVc, signVc, and encryptToHolder are issuer-controlled helpers backed by your signing keys.
Issuance typically completes in ~1–4 seconds. Record the returned storagePath as your issuance result; the credential is immediately available for the holder to present at any verifier.

Next steps