Gunnar

mikronova/tyr

README.md

# tyr

**Our own eID — locked down, mega small, binary, fast from embedded up.**

`tyr` (Old Norse **Týr**, god of law and *oaths* — the one who bound the wolf Fenrir with his own
hand as the pledge) is Nordisk's *own* electronic-identity protocol. Where [`frida`](../frida) buys
EU interoperability with heavyweight envelopes (JOSE/COSE, SD-JWT, mdoc), `tyr` makes the opposite
trade: a tight **binary** wire protocol for constrained hardware and very high throughput.

> Lesson behind it: an XML-era identity protocol, re-done as a binary protocol, cost **~100× less**
> CPU/space. `tyr` starts binary.

## Goals

- **Compact binary wire format** — no XML/JSON; fixed/TLV framing, versioned, minimal allocations.
- **Embedded-friendly** — a `no_std`-capable core codec; runs on constrained devices.
- **Fast + scalable** — cheap to parse, cheap to serve; scales from a microcontroller to a fleet.
- **Locked down** — small attack surface, modern crypto only, hardware-bound keys.
- **auth + sign** — deliberately minimal capability set (no issuance/wallet sprawl).

## Holders

- **Device key** — hardware-backed key in a mobile / embedded secure element.
- **Card reader** — smartcard over **PKCS#11**.

## Who uses it

Vetra's **`heimdal`** integrates `tyr` as a provider (`heimdal-tyr`) behind its `IdentityProvider`
trait, alongside Freja, BankID, and `frida`.

## Persistence & deployment — no relational database, ever

Same `Store` trait as `frida` (lives in `edda`, following `nornir-warehouse-trait`); never an RDBMS.

- **Single server (the common case for `tyr`)** — embedded **redb / rocksdb**; often *the whole
  deployment* on constrained hardware.
- **Multi-server** — scaled via **Kubernetes**; an **append-only event log with per-event ACK** is
  the source of truth, with **skade** (Iceberg lakehouse) as the sink for large transactional /
  audit volume.
- **Networking** — **WireGuard** node-to-node (natural via **Cilium transparent WireGuard**).
  Cilium guarantees the *network* (connectivity, policy, encryption), not application **ACK** —
  delivery/ACK is the event log's job.

## Repo layout (planned)

```
spec/                the binary wire format + crypto suite (the product)
crates/
  tyr-proto/           no_std wire codec (frames, TLV, versioning)
  tyr-crypto/          signature/attestation suite (Ed25519 / ECDSA)
  tyr-server/          high-speed server
  tyr-client/          client (used by heimdal-tyr)
  tyr-embedded/        constrained-device profile
```

Crypto / credential primitives shared with **`frida`** are expected to live in **`edda/`** rather
than being duplicated.

## Status

**Design.** No protocol code yet — see [`docs/PROTOCOL.md`](docs/PROTOCOL.md).

## License

**0BSD** (Zero-Clause BSD) — maximally permissive, no attribution required. See [`LICENSE`](LICENSE).