# atsh-here/ntat architecture

> Architecture diagram of the GitHub repository atsh-here/ntat, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atsh-here/ntat
- Repository: https://github.com/atsh-here/ntat

## Overview

NTAT is an academic Rust library implementing secret-bound, non-transferable anonymous-token issuance and redemption. A caller initializes public parameters; the client creates a proof-bearing query, the server verifies it and returns an issuance response, and the client verifies that response to obtain a token. Redemption proceeds in two rounds: the client sends a first proof, the server checks it and returns a challenge, and the client answers with a second proof for server verification. Proof helpers and protocol data types live in `src/util_dalek.rs`. The tree contains only the Dalek construction; README-mentioned alternatives are not represented here.

Main entry points: [`src/client_dalek.rs`](https://github.com/atsh-here/ntat/blob/main/src/client_dalek.rs) (Client operations), [`src/server_dalek.rs`](https://github.com/atsh-here/ntat/blob/main/src/server_dalek.rs) (Server operations), [`src/util_dalek.rs`](https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs) (Redemption proofs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_protocol["Token protocol"]
  node_params["Public parameters<br/>[util_dalek.rs]"]
  node_client["Client operations<br/>[client_dalek.rs]"]
  node_server["Server operations<br/>[server_dalek.rs]"]
  node_query["Query and proof<br/>[util_dalek.rs]"]
  node_response["Issuance response<br/>[util_dalek.rs]"]
  node_token["Issued token<br/>[util_dalek.rs]"]
  node_redemption["Redemption proofs<br/>[util_dalek.rs]"]
end

subgraph group_proofs["Proof primitives"]
  node_rep3["REP3 proof checks<br/>[util_dalek.rs]"]
  node_dleq["DLEQ proof checks<br/>[util_dalek.rs]"]
end

node_caller(("Library caller"))

node_caller -->|"initializes via"| node_params
node_caller -->|"invokes"| node_client
node_client -->|"proves query"| node_rep3
node_client -->|"creates"| node_query
node_query -->|"sends query"| node_server
node_server -->|"verifies query"| node_rep3
node_server -->|"proves issuance"| node_dleq
node_server -->|"creates"| node_response
node_response -->|"returns response"| node_client
node_client -->|"verifies issuance"| node_dleq
node_client -->|"finalizes token"| node_token
node_client -->|"creates first proof"| node_redemption
node_redemption -->|"sends first proof"| node_server
node_server -->|"returns challenge"| node_client
node_client -->|"creates second proof"| node_redemption
node_redemption -->|"sends second proof"| node_server

click node_params "https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs"
click node_client "https://github.com/atsh-here/ntat/blob/main/src/client_dalek.rs"
click node_server "https://github.com/atsh-here/ntat/blob/main/src/server_dalek.rs"
click node_query "https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs"
click node_response "https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs"
click node_token "https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs"
click node_redemption "https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs"
click node_rep3 "https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs"
click node_dleq "https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_params,node_client,node_server,node_query,node_response,node_token,node_redemption toneBlue
class node_rep3,node_dleq toneAmber
class node_caller toneIndigo
```

## Components

### Token protocol

- [Public parameters](https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs): `src/util_dalek.rs`
- [Client operations](https://github.com/atsh-here/ntat/blob/main/src/client_dalek.rs): `src/client_dalek.rs`
- [Server operations](https://github.com/atsh-here/ntat/blob/main/src/server_dalek.rs): `src/server_dalek.rs`
- [Query and proof](https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs): `src/util_dalek.rs`
- [Issuance response](https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs): `src/util_dalek.rs`
- [Issued token](https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs): `src/util_dalek.rs`
- [Redemption proofs](https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs): `src/util_dalek.rs`

### Proof primitives

- [REP3 proof checks](https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs): `src/util_dalek.rs`
- [DLEQ proof checks](https://github.com/atsh-here/ntat/blob/main/src/util_dalek.rs): `src/util_dalek.rs`

### Other components

- **Library caller**

## Connections

- Library caller → Public parameters: initializes via
- Library caller → Client operations: invokes
- Client operations → REP3 proof checks: proves query
- Client operations → Query and proof: creates
- Query and proof → Server operations: sends query
- Server operations → REP3 proof checks: verifies query
- Server operations → DLEQ proof checks: proves issuance
- Server operations → Issuance response: creates
- Issuance response → Client operations: returns response
- Client operations → DLEQ proof checks: verifies issuance
- Client operations → Issued token: finalizes token
- Client operations → Redemption proofs: creates first proof
- Redemption proofs → Server operations: sends first proof
- Server operations → Client operations: returns challenge
- Client operations → Redemption proofs: creates second proof
- Redemption proofs → Server operations: sends second proof
