Skip to content

Commit 063d7ca

Browse files
author
Test User
committed
docs: update changelog for v0.1.1
1 parent 8ac59f0 commit 063d7ca

1 file changed

Lines changed: 89 additions & 40 deletions

File tree

README.md

Lines changed: 89 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,71 +3,117 @@
33
[![npm version](https://img.shields.io/npm/v/auths-verify.svg)](https://www.npmjs.com/package/auths-verify)
44
[![license](https://img.shields.io/npm/l/auths-verify.svg)](https://github.com/bordumb/auths-verify-widget/blob/main/LICENSE)
55

6-
A drop-in web component for decentralized commit verification — the decentralized equivalent of GitHub's green "Verified" badge. Powered by [Auths](https://github.com/bordumb/auths) cryptographic attestation verification via WASM.
6+
A drop-in web component that verifies [Auths](https://github.com/bordumb/auths) decentralized identities — the open-source equivalent of GitHub's green "Verified" badge. Point it at any repository that uses Auths, and it cryptographically verifies the identity chain in the browser via WASM.
77

8-
## Quick Start
8+
## Install
99

10-
### Auto-resolve from a repository (recommended)
10+
**CDN (no build step):**
1111

1212
```html
1313
<script type="module" src="https://unpkg.com/auths-verify/dist/auths-verify.mjs"></script>
14+
```
1415

15-
<auths-verify repo="https://github.com/user/repo"></auths-verify>
16+
**npm (for bundlers):**
17+
18+
```bash
19+
npm install auths-verify
1620
```
1721

18-
The widget fetches identity and attestation data from the forge's Git refs automatically, loads WASM, and verifies.
22+
```js
23+
import 'auths-verify';
24+
```
25+
26+
## Quick Start
1927

20-
### Manual data (advanced)
28+
Add the widget to any page and point it at a repository:
2129

2230
```html
23-
<auths-verify
24-
attestation='{"version":1,"rid":"...","issuer":"did:keri:...","subject":"did:key:z...","device_public_key":"...","identity_signature":"...","device_signature":"...","revoked":false}'
25-
public-key="aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"
26-
></auths-verify>
31+
<auths-verify repo="https://github.com/user/repo"></auths-verify>
2732
```
2833

34+
That's it. The widget will:
35+
36+
1. Call the GitHub API to read the repository's `refs/auths/` identity data
37+
2. Extract the public key from the identity's `did:key`
38+
3. Load the WASM verification engine
39+
4. Cryptographically verify the full attestation chain
40+
5. Display a badge showing the result (Verified, Invalid, Expired, etc.)
41+
42+
**Prerequisite:** The repository owner must have set up an Auths identity with [`auths init`](https://github.com/bordumb/auths). If the repo doesn't have Auths identity data, the widget will show an error.
43+
44+
**Supported forges:** GitHub and Gitea (including self-hosted). GitLab is not supported for auto-resolve because its API does not expose custom Git refs — use manual mode instead.
45+
2946
## Display Modes
3047

3148
### Badge (default)
3249

3350
Compact inline pill showing verification status.
3451

3552
```html
36-
<auths-verify attestation="..." public-key="..." mode="badge"></auths-verify>
53+
<auths-verify repo="https://github.com/user/repo"></auths-verify>
3754
```
3855

3956
### Detail
4057

4158
Badge with an expandable panel showing the full attestation chain. Click the badge to expand.
4259

4360
```html
44-
<auths-verify attestations="[...]" public-key="..." mode="detail"></auths-verify>
61+
<auths-verify repo="https://github.com/user/repo" mode="detail"></auths-verify>
4562
```
4663

4764
### Tooltip
4865

4966
Badge with a hover tooltip summarizing verification status.
5067

5168
```html
52-
<auths-verify attestation="..." public-key="..." mode="tooltip"></auths-verify>
69+
<auths-verify repo="https://github.com/user/repo" mode="tooltip"></auths-verify>
70+
```
71+
72+
### Sizes
73+
74+
```html
75+
<auths-verify repo="..." size="sm"></auths-verify>
76+
<auths-verify repo="..." size="md"></auths-verify> <!-- default -->
77+
<auths-verify repo="..." size="lg"></auths-verify>
5378
```
5479

5580
## Attributes
5681

5782
| Attribute | Type | Default | Description |
5883
|---|---|---|---|
59-
| `repo` | URL string | `""` | Repository URL — auto-resolves identity and attestations from forge |
60-
| `forge` | `github\|gitea\|gitlab` | auto | Override forge type auto-detection |
61-
| `identity` | DID string | `""` | Filter to a specific identity DID when repo has multiple |
62-
| `attestation` | JSON string | `""` | Single attestation to verify (manual mode) |
63-
| `attestations` | JSON array string | `""` | Chain of attestations to verify (manual mode) |
64-
| `public-key` | hex string | `""` | Root/issuer Ed25519 public key (manual mode) |
65-
| `mode` | `badge\|detail\|tooltip` | `badge` | Display mode |
66-
| `size` | `sm\|md\|lg` | `md` | Badge size |
67-
| `wasm-url` | string | `""` | Optional WASM URL override |
68-
| `auto-verify` | boolean | `true` | Verify on connect/attribute change |
69-
70-
When `repo` is set, the widget auto-resolves `attestations` and `public-key` from the forge before running WASM verification. GitHub and Gitea are supported. GitLab does not expose custom Git refs — use manual attributes for GitLab repos.
84+
| `repo` | URL string || Repository URL to verify (recommended) |
85+
| `forge` | `github` \| `gitea` \| `gitlab` | auto-detected | Override forge detection (useful for self-hosted Gitea) |
86+
| `identity` | DID string || Filter to a specific identity when a repo has multiple |
87+
| `mode` | `badge` \| `detail` \| `tooltip` | `badge` | Display mode |
88+
| `size` | `sm` \| `md` \| `lg` | `md` | Badge size |
89+
| `auto-verify` | boolean | `true` | Verify automatically on page load |
90+
| `wasm-url` | URL string || Override the WASM binary URL |
91+
92+
### Manual mode
93+
94+
If you already have the attestation data (e.g., from a CI pipeline, from a GitLab repo, or for offline verification), you can supply it directly instead of using `repo`:
95+
96+
```html
97+
<auths-verify
98+
attestation='{"version":1, ...}'
99+
public-key="aabbccdd..."
100+
></auths-verify>
101+
```
102+
103+
Or for a full chain:
104+
105+
```html
106+
<auths-verify
107+
attestations='[{"version":1, ...}, {"version":1, ...}]'
108+
public-key="aabbccdd..."
109+
></auths-verify>
110+
```
111+
112+
| Attribute | Type | Description |
113+
|---|---|---|
114+
| `attestation` | JSON string | Single attestation to verify |
115+
| `attestations` | JSON array string | Chain of attestations to verify |
116+
| `public-key` | hex string | Root/issuer Ed25519 public key (64 hex chars) |
71117

72118
## JavaScript API
73119

@@ -79,6 +125,9 @@ await el.verify();
79125

80126
// Get the last verification report
81127
const report = el.getReport();
128+
// report.status.type → 'Valid' | 'InvalidSignature' | 'Expired' | 'Revoked' | 'BrokenChain'
129+
// report.chain → [{ issuer, subject, valid, error? }, ...]
130+
// report.warnings → string[]
82131

83132
// Listen for events
84133
el.addEventListener('auths-verified', (e) => {
@@ -107,6 +156,20 @@ auths-verify {
107156

108157
Available properties: `--auths-{state}-bg`, `--auths-{state}-fg`, `--auths-{state}-border` for each state (`verified`, `invalid`, `expired`, `revoked`, `error`, `loading`, `idle`), plus `--auths-font-family`, `--auths-font-size`, `--auths-border-radius`, `--auths-detail-border-radius`.
109158

159+
## How It Works
160+
161+
When you set `repo="https://github.com/user/repo"`:
162+
163+
1. The widget parses the URL and detects the forge (GitHub, Gitea, or GitLab)
164+
2. It calls the forge's REST API to list Git refs under `refs/auths/`
165+
3. It reads `identity.json` from `refs/auths/identity` to get the controller DID
166+
4. It extracts the Ed25519 public key from the `did:key:z...` identifier (pure TypeScript, no WASM needed)
167+
5. It reads `attestation.json` from each device ref under `refs/auths/devices/nodes/`
168+
6. It loads the WASM verification engine and cryptographically verifies the attestation chain
169+
7. It renders the result as a badge
170+
171+
The resolver layer uses dynamic imports — if you only use manual `attestation`/`public-key` attributes, the resolver code is never loaded (zero bundle size impact).
172+
110173
## Development
111174

112175
### Prerequisites
@@ -154,28 +217,14 @@ Opens the examples directory with hot reload via Vite.
154217
### Production build
155218

156219
```bash
157-
# Build WASM first
158220
npm run build:wasm
159-
160-
# Build both full (inlined WASM) and slim (split WASM) bundles
161221
npm run build
162222
```
163223

164224
Outputs:
165-
- `dist/auths-verify.mjs` — single file with WASM base64-inlined (~100-200KB gzipped)
225+
- `dist/auths-verify.mjs` — single file with WASM base64-inlined
166226
- `dist/slim/auths-verify.mjs` — smaller JS, loads `.wasm` separately
167227

168-
### Visual testing
169-
170-
Open `tests/visual/index.html` in a browser to see all states and modes rendered side by side.
171-
172-
## Build Outputs
173-
174-
| File | Description |
175-
|---|---|
176-
| `dist/auths-verify.mjs` | CDN-ready single file (WASM inlined) |
177-
| `dist/slim/auths-verify.mjs` | Smaller JS bundle (loads WASM separately) |
178-
179228
## License
180229

181230
MIT

0 commit comments

Comments
 (0)