GRAMStack is a read-only, consent-first layer that lets programmes read a person’s data from India’s public registries, with that person’s approval. I built it as a side project with friends at TheFlywheel, and it is open source. The full design, specs and SDK guides are in the docs.

What it helps with

Take a credit programme for women in self-help groups. To decide on a loan it wants to know whether someone is an active SHG member and what her savings look like. That data already exists in a registry like LokOS. Getting it today usually means one of three things: a custom integration between two government agencies that takes months, the person carrying paper or screenshots, or the app scraping a portal.

GRAMStack replaces that with one protocol:

  1. The app asks for exactly the fields it needs, for a stated purpose.
  2. The person signs in, proves the record is theirs, and approves or rejects the request.
  3. The app gets the data once, and every release leaves evidence that can be checked later.

It is deliberately narrow. It never writes to a registry and never keeps copies of registry data. It has no central citizen accounts and doesn’t match identities across registries. It doesn’t make decisions like loan eligibility either: the registries stay the source of truth, and GRAMStack only coordinates access to them.

The auth design

The core idea is that logging in proves very little on its own. The docs cover authentication and authorization in full. GRAMStack splits “can this app see this data” into separate questions, and a different part of the system answers each one.

Who is the app? Apps authenticate with OAuth client credentials through Ory Hydra. The gateway works out who the caller is from token introspection, never from anything in the request body. When data is actually fetched, the call has to come over mTLS with the app’s registered certificate, and the grant is bound to that certificate. A leaked grant is useless to anyone else.

Who is the person? People sign in through an external identity provider. The demo uses MOSIP eSignet. GRAMStack doesn’t create citizen accounts or store passwords, and Aadhaar isn’t its identifier. Each app sees only an opaque, app-specific subject, so two apps can’t link the same person through GRAMStack.

Is this record theirs? Signing in doesn’t make someone the owner of a record. Each registry’s adapter checks that the person is who the record belongs to, using a method the registry itself approves. The gateway only ever gets back an opaque handle, never the data.

Did they agree? The person approves or rejects an exact notice, and the approval becomes a signed consent record. This is covered in detail below.

What can the app actually do? The app gets a short-lived, signed grant, valid for at most five minutes and usable once. It is scoped to one registry, one resource, the exact approved fields and one purpose. Single use is enforced in Postgres: if two requests race to use the same consent, exactly one gets through. If a withdrawal and a retrieval race, whichever commits first wins.

On top of that, each registry signs its own access policy offline. The gateway only holds the registry’s public key, so it can’t widen what a registry has allowed.

Consent in GRAMStack is a record of one specific decision, not a checkbox. (Consent design, consent spec.)

The notice is exact. Before deciding, the person sees who is asking, which registry the data comes from, the exact fields, the purpose, that the access is single-use, how long the app may keep the data and how to withdraw. The notice is stored word for word, and its hash is part of everything that follows. What the person approved can’t be changed later.

The decision is bound to the person and the request. The person has to tick a confirmation box and submit. The decision is tied to the request’s hash, the notice’s hash and the signed-in person, taken from the server-side session and never from the browser. Approving or rejecting is all or nothing. If an app wants fewer fields, it cancels and starts a new request with a fresh notice; nothing carries over.

Approval isn’t usable until it’s signed. An approval is first recorded, then a background worker signs it into a consent artefact (ES256). Only then does the consent become active. If signing fails, the approval exists but nothing can use it.

It can be used once. An active consent can be redeemed exactly once. The redemption is reserved in a single Postgres transaction under a row lock, so two concurrent attempts can’t both get through. A failure after that point never makes the consent usable again.

It can be withdrawn. The person can withdraw until the data has been fetched. Withdrawal and redemption lock the same row, so whichever commits first wins. Withdrawal stops future use but can’t recall data already released, and the docs say so plainly. An app cancelling its own request is recorded separately from a person withdrawing.

It leaves a trail the person can see. The person can download a receipt for each decision, view their consent history after signing in again (that history is kept per registry), and raise access, correction or grievance requests about a past disclosure. (Post-disclosure profile.)

How sharing across registries works

GRAMStack gives every registry the same contract, so an app and a registry each integrate once instead of building a custom integration for every pair. (Architecture.)

One request, one registry. Each request names exactly one registry, one resource and the exact fields. If an app needs data from two registries, say SHG membership from one and land records from another, it makes two requests and the person gives two separate consents. GRAMStack deliberately never matches a person’s identities across registries and never joins their data. That is a design choice, not a missing feature.

Registries join through adapters. A registry is connected by an adapter, a small service built with the adapter SDK. The adapter declares the resource and fields it serves, verifies that a person owns a record using the registry’s own method, and reads the record when there is a valid grant. The gateway has no registry-specific code. An operator approves each adapter once, which freezes its address, identity, resources and public keys. If an adapter later advertises new keys or resources, that never extends what it is allowed to do.

Registries set their own rules. Each registry signs an access policy offline. The policy says which app may read which resource, which fields, for what purpose and for how long. It must require human consent and allow one disclosure per consent. The gateway checks every grant against the registry’s current signed policy.

The adapter checks independently. When an app retrieves data, the adapter verifies the grant itself, reserves the single use with the gateway, reads the source once and returns only the approved fields. It signs evidence of the release and has the gateway take custody of that evidence before any data goes out. (State and evidence.)

The evidence can be checked later. The gateway anchors a hash of each piece of evidence on a DeDi node and checks the inclusion proof. The registry, the app and the person can later show what was shared and under which consent. The public log holds none of the data.

Everything is a versioned spec. The API, the adapter contract, consent, grants, evidence and the request lifecycle are published as OpenAPI and JSON Schema, and a conformance package checks an adapter against them. Apps use the same calls whichever registry they’re reading from, through SDKs in Go, Python and JavaScript.

Where it stands

There’s an end-to-end demo for the credit example, with a walkthrough. It uses real Hydra, the official eSignet with mock identities, a fictional LokOS source and a real DeDi node. The capabilities list says plainly what is real, what is simulated and what isn’t supported. GRAMStack isn’t integrated with the real LokOS and has no government credentials.