index.md

HTML wrapper for HTML-only fetchers; content is shown verbatim.

Raw file

Links (extracted)

Clickable list for reviewers; avoids copy/paste line-wrap issues.
# if.api demo — SWHID resolver (receipt-backed)

**Audience:** external reviewers + operators  
**Reality gate:** demo of a transformation contract, not a deployed SWHID integration.

---

## Links (HTML-first)

if.trace receipt:
https://infrafabric.io/static/trace/gtwHpclpxuWVxvcRPDecFQ

Pack (HTML view):
https://infrafabric.io/static/pack/gtwHpclpxuWVxvcRPDecFQ

Pack (raw Markdown):
https://infrafabric.io/static/pack/gtwHpclpxuWVxvcRPDecFQ.md

Source bundle (tgz):
https://infrafabric.io/static/source/899c6a49b04ca01f1ea0264261bbf68a7246ea0c90b0fc5e0afefad56c87309b.tgz

---

## What this proves (black/white)

This demo proves:
- a known SWHID request can be transformed deterministically into a normalized resolution envelope
- the output is bound to if.trace receipts (hash checks; signatures only where present and verifiable)

This demo does not prove:
- live Software Heritage lookups, archival policies, or origin capture workflows
- any shipped if.bus runtime or message broker

---

## Demo artifacts

Source bundle sha256 (tgz):

    899c6a49b04ca01f1ea0264261bbf68a7246ea0c90b0fc5e0afefad56c87309b

Input JSON sha256:

    72b0982f8ac50316f26f0763ec81237cb667ca688cf44506a58134b5e657fa12

Normalized output JSON sha256:

    388fc95a9c168c125298f0bbd6b8508b0ad54a115b61374dcb875e044db67f48

---

## How to reproduce (no internal access)

```bash
curl -fsSL -o if-api-swhid-resolver-demo-source.tgz "https://infrafabric.io/static/source/899c6a49b04ca01f1ea0264261bbf68a7246ea0c90b0fc5e0afefad56c87309b.tgz"
sha256sum if-api-swhid-resolver-demo-source.tgz

tar -xzf if-api-swhid-resolver-demo-source.tgz
python3 resolve_swhid_demo.py swhid_input.json > resolved_event.json
sha256sum resolved_event.json
```

Expected `sha256sum` (source bundle):

    899c6a49b04ca01f1ea0264261bbf68a7246ea0c90b0fc5e0afefad56c87309b  if-api-swhid-resolver-demo-source.tgz

Expected `sha256sum` (normalized output):

    388fc95a9c168c125298f0bbd6b8508b0ad54a115b61374dcb875e044db67f48  resolved_event.json

---

## Output (normalized event envelope)

```json
{
  "event": "resolve",
  "input_sha256": "72b0982f8ac50316f26f0763ec81237cb667ca688cf44506a58134b5e657fa12",
  "integration": "swhid.resolver",
  "notes": {
    "integrity": "see if.trace receipt for output bytes",
    "live_lookup": false
  },
  "requested_at": "2026-01-07T00:00:00Z",
  "resolved_at": "2026-01-07T00:00:00Z",
  "results": [
    {
      "identifier": "swh:1:rev:0123456789abcdef0123456789abcdef01234567",
      "metadata": {
        "object_type": "rev",
        "origin": "synthetic"
      },
      "resolution_method": "synthetic-map",
      "scheme": "swhid",
      "status": "resolved",
      "target_url": "https://archive.softwareheritage.org/swh:1:rev:0123456789abcdef0123456789abcdef01234567/"
    },
    {
      "identifier": "swh:1:dir:89abcdef0123456789abcdef0123456789abcdef",
      "metadata": {
        "object_type": "dir",
        "origin": "synthetic"
      },
      "resolution_method": "synthetic-map",
      "scheme": "swhid",
      "status": "resolved",
      "target_url": "https://archive.softwareheritage.org/swh:1:dir:89abcdef0123456789abcdef0123456789abcdef/"
    }
  ],
  "schema_version": "demo.v1"
}
```