atproto utils for zig zat.dev
atproto sdk zig
26
fork

Configure Feed

Select the types of activity you want to include in your feed.

add changelog for 0.1.0 release

documents new sync types, migration guide, and library overview.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

zzstoatzz c71a2867 5011ae25

+93
+93
CHANGELOG.md
··· 1 + # changelog 2 + 3 + ## 0.1.0 4 + 5 + first feature release. adds protocol-level enums for firehose consumption. 6 + 7 + ### what's new 8 + 9 + **sync types** - enums from `com.atproto.sync.subscribeRepos` lexicon: 10 + 11 + - `CommitAction` - `.create`, `.update`, `.delete` 12 + - `EventKind` - `.commit`, `.sync`, `.identity`, `.account`, `.info` 13 + - `AccountStatus` - `.takendown`, `.suspended`, `.deleted`, `.deactivated`, `.desynchronized`, `.throttled` 14 + 15 + these integrate with zig's `std.json` for automatic parsing. define struct fields as enums instead of strings, and get exhaustive switch checking. 16 + 17 + ### migration 18 + 19 + if you're currently doing string comparisons: 20 + 21 + ```zig 22 + // before: string comparisons everywhere 23 + const TapRecord = struct { 24 + action: []const u8, 25 + collection: []const u8, 26 + // ... 27 + }; 28 + 29 + if (mem.eql(u8, rec.action, "create") or mem.eql(u8, rec.action, "update")) { 30 + // handle upsert 31 + } else if (mem.eql(u8, rec.action, "delete")) { 32 + // handle delete 33 + } 34 + ``` 35 + 36 + switch to enum fields: 37 + 38 + ```zig 39 + // after: type-safe enums 40 + const TapRecord = struct { 41 + action: zat.CommitAction, // parsed automatically by std.json 42 + collection: []const u8, 43 + // ... 44 + }; 45 + 46 + switch (rec.action) { 47 + .create, .update => processUpsert(rec), 48 + .delete => processDelete(rec), 49 + } 50 + ``` 51 + 52 + the compiler enforces exhaustive handling - if AT Protocol adds a new action, your code won't compile until you handle it. 53 + 54 + **this is backwards compatible.** your existing code continues to work. adopt the new types when you're ready. 55 + 56 + ### library overview 57 + 58 + zat provides zig primitives for AT Protocol: 59 + 60 + | feature | description | 61 + |---------|-------------| 62 + | string primitives | `Tid`, `Did`, `Handle`, `Nsid`, `Rkey`, `AtUri` - parsing and validation | 63 + | did resolution | resolve `did:plc` and `did:web` to documents | 64 + | handle resolution | resolve handles to DIDs via HTTP well-known | 65 + | xrpc client | call AT Protocol endpoints (queries and procedures) | 66 + | sync types | enums for firehose consumption | 67 + | json helpers | navigate nested json without verbose if-chains | 68 + | jwt verification | verify service auth tokens (ES256, ES256K) | 69 + | multibase/multicodec | decode public keys from DID documents | 70 + 71 + ### install 72 + 73 + ```bash 74 + zig fetch --save https://tangled.sh/zzstoatzz.io/zat/archive/main 75 + ``` 76 + 77 + ```zig 78 + // build.zig 79 + const zat = b.dependency("zat", .{}).module("zat"); 80 + exe.root_module.addImport("zat", zat); 81 + ``` 82 + 83 + ## 0.0.2 84 + 85 + - xrpc client with gzip workaround for zig 0.15.x deflate bug 86 + - jwt parsing and verification 87 + 88 + ## 0.0.1 89 + 90 + - initial release 91 + - string primitives (Tid, Did, Handle, Nsid, Rkey, AtUri) 92 + - did/handle resolution 93 + - json helpers