DigiLocker
Use DigiLocker for MainSDK identity checks in India - partner access, main.yaml for the India market, claims-only results, testing and swapping.
DigiLocker is India's government digital document wallet, where people keep issued documents such as identity and education records. Behind verify, it runs verify.identity() for users in India, with the person's consent and only the claims you ask for. Pick it when a flow for Indian users needs a government-backed identity check.
Interfaces it serves
Pick DigiLocker in main.yaml for any of these. Your calls stay the same, and you can swap later.
verifyBuilding for 0.7Driver digilocker DigiLocker
identity, through the digital-ids driver
verify:
driver: digilockerSwap to another provider
Before you start
- Apply for partner access to DigiLocker as a requesting organisation. Access needs approval before you receive credentials.
- Register your redirect URL and keep the client credentials you are issued in your secrets manager.
Configure
verify:
driver: twilio-verify # phone and email checks
identity: { in: digilocker } # identity checks in India go through DigiLocker
require: { in: substantial } # digilocker reaches substantial, not high
drivers:
digilocker:
client-id: secret:DIGILOCKER_CLIENT_ID
client-secret: secret:DIGILOCKER_CLIENT_SECRET
redirect: https://app.example.com/digilocker/callback # the redirect URL you registeredYou can put the identity line in the India overlay, main.in.yaml, instead.
Use it
import { verify } from "mainsdk/verify";
export async function startAgeCheck(user: string) {
const started = await verify.identity({
level: "substantial",
market: "in",
claims: ["age_over_18"],
purpose: "Sell age-restricted items",
user,
consent: { policy: "privacy-2026-10" },
});
return started.url; // DigiLocker's consent screen; its redirect brings a code back
}
export async function finishAgeCheck(id: string, code: string) {
const done = await verify.identity.complete({ id, code });
return done.status === "approved" ? done.claims : null; // { age_over_18: true }
}The levels are basic, substantial and high. DigiLocker reaches substantial; asking for high in in fails with MAIN-VERIFY-0004, and mainsdk check reports it when verify.require says so.
Local development and testing
In tests, set verify.identity.in: local: the local fake approves with code: "approve" and keeps nothing but the asked claims.
What MainSDK adds on top
The verify and digital-ids specs set what the driver must do:
- Only the requested claims are stored, labelled, with a consent record.
mainsdk checkflags a request for more claims than the flow needs.
See Phone, email and identity checks.
Limits and notes
- India only: route it with
identity: { in: digilocker }. - Built as a
verifydriver (specverify);verifyownsverify.identity()and the DigiLocker driver stays indigital-ids. - DigiLocker returns a date of birth, not a claim: the driver derives
age_over_NNand drops the date, so your app never holds it. - Identity results are personal data; label the fields that store them in
db, in theinregion.
Swap to or from it
verify:
identity: { in: onfido } # was { in: digilocker }Results you keep live in your own db, so a swap carries little provider state.
FAQ
Do I get the person's documents? You get the claims you asked for, such as a verified name or age, not the documents themselves.
Can I use DigiLocker outside India? No. It serves people with Indian government records.
Next
Was this page helpful?