1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
# changelog
## 0.7.0-beta.1
Promotes the alpha.13 code to beta. Changes across the 0.7.0 alphas:
- **feat**: `zat.space` adds permissioned Spaces URIs, delegation tokens,
credentials, HTTP signatures, HPKE-derived MAC secrets, commit and record
MACs, LtHash, and STAR archives. Space URIs and archive metadata now use
`at:space/{spaceDid}/{spaceType}/{skey}`. Commit MACs use
`atproto-space-commit` and commit JSON writes unpadded `$bytes`.
- **feat**: typed OAuth scopes parse, construct, and canonically format repo,
blob, RPC, account, identity, include, and marker values. Permission matching
is allocation-free. Strict percent decoding preserves literal `+` and decodes
each escape once.
- **feat**: server-side DPoP and private-key JWT assertion verification, public
EC JWK and compact JWT helpers, and inter-service JWT creation and verification.
JWT parsing fixes cleanup on short signatures, and OAuth signing helpers
escape JSON claim values.
- **feat**: PLC operation encoding and signing, private multikeys, DID service
lookup, and DNS-backed lexicon authority resolution. Handle resolution rejects
reserved TLDs and `did:web` rejects malformed percent escapes.
- **feat**: firehose identity, account, info, sync, and error frame encoders,
configurable CAR commit import limits, atproto JSON/CBOR conversion and blob
discovery, prehashed CID construction, and millisecond datetime helpers.
- **breaking**: STAR uses the published pair and end markers. Earlier STAR-lite
archives require regeneration. Ordered STAR writes and MST prefix matching
are faster, and commit verification handles a delete followed by a recreate
at the same path.
- **breaking**: deadlined HTTP requests require concurrency-capable Zig `Io`.
Zat no longer requests libc linkage. zttp 0.4.1 improves connection shutdown,
credential handling across redirects, header forwarding, and idle socket
cleanup. websocket 0.3.1 replaces zlib with pure Zig permessage-deflate.
## 0.7.0-alpha.13
- **breaking**: `zat.space.SpaceUri` parses and formats space references as
`at:space/{spaceDid}/{spaceType}/{skey}` and appends the author DID, collection,
and record key for record URIs. STAR readers require the new space reference
in archive metadata.
- **feat**: `zat.oauth.permissions` parses, constructs and canonically formats
individual OAuth scope tokens. Validated repo, blob, RPC, account and identity
permissions match concrete operations without allocating. Include references
and OAuth markers are typed scope values.
## 0.7.0-alpha.12
- **fix**: `HttpTransport` (zttp 0.4.1) destroys idle pooled connections the
peer has closed before each request. A long-lived transport talking to
origins that reap idle connections used to hold them in CLOSE_WAIT.
## 0.7.0-alpha.11
- **fix**: `HttpTransport` sends every `extra_headers` entry. It is zttp's
`Client`, and zttp 0.4.0 removes the eight-header limit and
`error.TooManyHeaders`, which PDS proxies hit when forwarding Bluesky
client headers.
## 0.7.0-alpha.10
- **fix**: strict percent decoding rejects signed, non-hex and truncated escapes
in `did:web` authorities. `zat.percent.decodeAlloc` and allocation-free
`decodedEql` share the same decoder for downstream scope values, preserving
literal `+` and single decoding. Extracted from Brooke's ZDS RPC audience fix
([PR #33](https://tangled.org/zat.dev/zds/pulls/33/latest)).
## 0.7.0-alpha.9
- **feat**: `loadCommitFromCARWithOptions` takes `car.ReadOptions`, so a whole
repo CAR (an account import, a full `getRepo`) can be loaded past
`loadCommitFromCAR`'s firehose-frame defaults of 2 MB and 10,000 blocks.
## 0.7.0-alpha.8
- **fix**: `space.archive.commitJson` writes the commit's `data` as unpadded
`$bytes`, as the reference and zat's CBOR-to-JSON conversion do.
## 0.7.0-alpha.7
- **fix**: `space.mac` tags commit MACs `atproto-space-commit`, the name the
2026-11-12 spaces release settled on. `atproto-space-repo` was a draft name,
and a request under it is now ignored like any other tag.
## 0.7.0-alpha.6
- **fix**: `HandleResolver.resolve` fails a handle under a reserved TLD with
`error.DisallowedTld` before any lookup, as the handle spec requires.
- **feat**: `DidDocument.serviceEndpoint(id)` finds a service written as
`#fragment` or `did#fragment`, as documents list it either way.
- **feat**: lexicon authority resolution. `Nsid.authorityDomain` gives the
reversed authority domain (`app.bsky.feed.post` -> `feed.bsky.app`), and
`HandleResolver.resolveLexiconAuthority` resolves an NSID to the DID that
publishes its lexicons from the `did=` TXT record at `_lexicon.<domain>`,
over the same DoH path as handle resolution. No other name is tried, as the
lexicon spec requires.
- **feat**: `Handle.hasDisallowedTld` flags handles under the handle spec's
disallowed TLDs (`Handle.disallowed_tlds`: `.alt`, `.arpa`, `.example`,
`.internal`, `.invalid`, `.local`, `.localhost`, `.onion`), ignoring case.
`Handle.parse` still accepts them, as the spec requires of syntax
validation; registration and resolution are where to check.
`Handle.topLevelDomain` returns the final segment.
- **feat**: `Datetime.toStringMillis` renders the millisecond form
(`2026-10-01T00:00:00.000Z`) that JavaScript's `toISOString` and the
reference PDS emit, and `Datetime.fromSeconds` / `Datetime.fromMillis` build
an instant from unix time, returning null outside years 0000-9999 instead of
clamping or overflowing. Instants before 1970 render as dates before 1970.
- **feat**: `zat.plc`, did:plc operations. `plc.Operation` builds a
`plc_operation` and encodes it as DAG-CBOR (unsigned or signed) and as JSON
in the reference field order; `Operation.sign` signs it with a rotation key
and returns the signature, signed DAG-CBOR and JSON. For operations held as
JSON (updates, `plc_tombstone`, legacy `create`), `signJson`, `verifyJson`,
`cidForJson` and `didForJson`; `cidForCbor` and `didForCbor` work on encoded
bytes. Tests reproduce every CID, signature and the DID of real
plc.directory audit logs, one starting from a legacy `create`.
- **feat**: private-key multikeys. `zat.multicodec.parsePrivateMultikey` /
`formatPrivateMultikey` (and the byte-level `parsePrivateKey` /
`encodePrivateKey`) read and write `secp256k1-priv` (0x1301) and `p256-priv`
(0x1306) keys in the base58btc form indigo and `@atproto/crypto` export;
`Keypair.fromPrivateMultikey` and `Keypair.privateMultikey` convert to and
from a `Keypair`.
- **feat**: `zat.oauth.percentEncode` (to a writer) and
`zat.oauth.percentEncodeAlloc` expose the RFC 3986 unreserved-set
percent-encoder the OAuth helpers already used, so callers building query
strings and path segments stop carrying their own copy.
- **fix**: `cbor.fromJson` accepts `$bytes` with `=` padding as well as
without, as the atproto data model allows, and still rejects `=` anywhere
but the padding that completes the final group.
- **feat**: `cbor.toJson(writer, value)` and `cbor.toJsonAlloc(allocator,
value)` write atproto JSON, the inverse of `fromJson`: `$bytes` as unpadded
standard base64, as the reference PDS writes it, and `$link` for CIDs.
- **feat**: `Cid.fromSha256Digest(allocator, codec, &digest)` builds a raw or
dag-cbor CIDv1 from a SHA-256 digest already computed, such as a blob's
hashed while it streamed to storage.
- **feat**: `firehose.encodeIdentityEvent`, `encodeAccountEvent` and
`encodeInfoEvent` encode the other `subscribeRepos` frames beside
`encodeCommitEvent`. They reject an invalid DID, a `status` on an active
account, and an `#info` without the `name` the lexicon requires.
- **feat**: `firehose.encodeSyncEvent(allocator, .{ .seq, .commit, .time })`
encodes a `#sync` frame from the signed commit block: `did` and `rev` come
from the commit, and `blocks` is a CAR whose first root is the commit CID,
as the lexicon requires.
- **feat**: `firehose.encodeErrorFrame(allocator, error_name, message)`
encodes a stream error frame: an `{op: -1}` header with no `t`, then
`{error, message?}`, such as `FutureCursor` or `ConsumerTooSlow`.
- **feat**: `cbor.collectBlobRefs(allocator, value, &list)` appends the `ref`
CID of every `{$type: "blob"}` map in a record, at any depth. The legacy
`{cid, mimeType}` blob form has no `$type` and is not found.
- **feat**: `jwt.decode` and `jwt.decodeLeaky` split a compact JWS into its
header and payload as JSON objects, the signing input and the signature, for
verifiers that check their own claims (DPoP proofs, client assertions,
HS256 session tokens). They accept what the reference SDKs accept: parts
decode like Node's `Buffer.from(part, "base64url")`
(`jwt.base64UrlDecodeLenient`), and a repeated member takes its last value
as with `JSON.parse`. `Decoded.claimNumericDate` reads a numeric claim the
way a JavaScript comparison does. `Jwt.parse` is unchanged.
- **feat**: `jwk` parses public EC JWKs (P-256 and secp256k1) into a
`jwk.PublicKey` usable with `jwt.verifyJose`, reading coordinates as
leniently as Node's JWK import but rejecting points off the curve and keys
carrying `d`; `jwk.selectFromJwks` picks a client's key by `kid` and `alg`;
`jwk.thumbprint` computes the RFC 7638 thumbprint of a JWK as given, as
jose does, and `PublicKey.thumbprint` that of a parsed key.
`Keypair.publicJwk` returns a keypair's public half as a `jwk.PublicKey`.
- **feat**: `oauth.verifyDpopProof` verifies a DPoP proof (RFC 9449) on the
server: typ `dpop+jwt`, a public header `jwk` whose JOSE signature verifies,
`htm` and `htu` (compared through `oauth.normalizeHtu`), the `iat` window,
`ath` for a given access token, accepted nonces and the bound `jkt`. It
returns the thumbprint of the `jwk` as sent and the `jti`; replay tracking
and nonce issuance stay with the server.
- **feat**: `oauth.verifyClientAssertion` verifies a `private_key_jwt` client
assertion (RFC 7523) against the client's JWKS: `iss` = `sub` = client,
`aud`, `exp` or a fresh `iat`, a `jti` for the caller's replay store, and
the JOSE signature of the key `kid` and `alg` select. `typ`, `require_kid`
and `max_lifetime` cover client attestations; `oauth.parseClientAssertion`
checks everything but the signature, for a server that fetches the JWKS of
the client the assertion names.
- **feat**: `service_auth.create` mints an inter-service auth JWT with every
claim JSON-encoded: `iss`, `aud`, optional `lxm` and `sub`, and `iat`, `exp`
(60 s by default) and a random `jti` unless given.
- **feat**: `service_auth.verify` verifies an inter-service auth JWT the way
the reference `verifyJwt` does: forbidden `typ`s, `exp`, accepted
audiences, exact `lxm` (no `*`), `iss` as a DID with an optional single
`#fragment`, and a JOSE signature under the issuer's key from a
caller-supplied resolver, asked once more with `force_refresh` when the
first key fails. It returns the issuer DID, `aud`, `lxm` and `jti`.
`service_auth.issuerDid` strips the fragment.
- **fix**: `Jwt.parse` no longer frees a short signature twice, and no longer
leaks the parsed claims, when it rejects the signature part. A token whose
signature decodes to other than 64 bytes hit the double free.
- **fix**: `oauth.createDpopProof` and `oauth.createClientAssertion` JSON-encode
`htm`, `htu`, `nonce`, `ath`, the client ID and the audience; a quote or
backslash in one of them produced invalid JSON before.
## 0.7.0-alpha.5
- **feat**: `zat.space`, the permissioned-spaces primitives of the
`permissioned-data` branch's `@atproto/space`: space URIs, delegation tokens
and space credentials, credential-use HTTP signatures found by their tag,
the HPKE-exported MAC secret, commit and record MACs requested with
`Accept-Signature`, LtHash, and repo and space meta STAR archives. ZDS kept
its own copies until now.
## 0.7.0-alpha.4
- **deps**: websocket is pinned to `v0.3.1`, whose
[pmdeflate](https://github.com/zzstoatzz/pmdeflate) `v0.1.1` decodes
permessage-deflate about 1.7x faster than `v0.1.0` on relay frames. zat's
stream clients do not negotiate compression, so their behavior is unchanged;
code that enables websocket.zig's compression alongside zat gets the faster
decoder.
## 0.7.0-alpha.3
- **breaking**: zat no longer links libc. Linux, Windows and wasi builds make
no libc calls and Linux binaries are static; macOS and the BSDs link their
system libc through Zig's std as before. A consumer that made its own libc
calls through zat's linkage, or that runs websocket.zig's server on Linux,
sets `link_libc` on its own module.
- **deps**: zttp and websocket are back on tagged releases, zttp `v0.3.0` and
websocket `v0.3.0`. websocket compresses with
[pmdeflate](https://github.com/zzstoatzz/pmdeflate) `v0.1.0`, pure Zig, in
place of zlib, so the dependency tree no longer builds C.
- **fix**: the repo stress test and `publish-docs` read their environment
through Zig's std instead of libc `getenv`.
## 0.7.0-alpha.2
- **breaking**: the pinned zttp no longer sends a deadlined request through
an `Io` that cannot run concurrent tasks; it fails with
`error.ConcurrencyUnavailable` where 0.2.0 warned and sent the request
without its deadline. Give HTTP, XRPC, identity and stream clients a
concurrency-capable `Io`, such as `init.io` from `std.process.Init`, not
`std.Options.debug_io`.
- **perf**: `star.Writer` with `ordered_keys` finds the shared prefix with the
previous key once, decides the order from the next byte, and copies only the
bytes after it. Ordered writes of a 100k-record repository archive go from
about 30M to 49-50M records/s.
- **perf**: `mst.commonPrefixLen` compares eight bytes at a time; MST node
serialization calls it for every entry.
- **deps**: zttp and websocket are pinned to unreleased commits, zttp `a5509d3`
and websocket `a1b85b8`. The same websocket commit is already pinned by
jetstream, stream, labelz, zds, httpz and prefect-server; prefect-server also
pins the zttp commit. zttp: bounded TLS retirement and explicit client
shutdown, connection retirement that keeps pool reuse and eviction, deadline
watchers woken as soon as a request completes, and credentials stripped when a
redirect crosses origins. websocket: bounded client shutdown, network
cancellation preserved through readers and writers, a handshake header split
across reads, and server shutdown ordering. Both return to tagged releases
before 0.7.0.
## 0.7.0-alpha.1
- **breaking**: STAR follows the published spec (dasl.ing, 2026-11-03).
`star.Writer` writes a `0x01` control byte before each pair and
`finish()` writes a `0x00` end byte; `star.Reader` requires both and
rejects bytes after the end (`error.BytesAfterEnd`) and unknown control
bytes (`error.InvalidControlByte`). STAR-lite and earlier zat archives no
longer parse. Length varints may be up to 9 bytes again.
- **fix**: a truncated archive fails at the framing (`error.EndOfStream`)
before any profile reads its pairs.
- **fix**: `verifyCommitDiff` undoes a commit's operations in reverse message
order instead of sorting them by path, so a commit that deletes and
recreates the same record verifies instead of failing with
`error.DuplicatePath`. `mst.normalizeOps` keeps its behavior for other
callers.
- **test**: interop fixtures from cobalt a0b7ece (19 valid, 37 invalid);
the 300-record MST fixture is rewritten to the new framing.
- **docs**: [devlog 017](https://zat.dev/devlog/017).
## 0.6.4
- **fix**: `encodeCommitEvent` always writes `since` (null on a repo's first
commit), `rebase` and `tooBig`, which `com.atproto.sync.subscribeRepos#commit`
requires. Strict consumers such as hydrant rejected commits that left them
out.
## 0.6.3
Labeler streams. The library is 0.6.3-alpha.2 unchanged.
- **feat**: `LabelClient` follows a labeler's `com.atproto.label.subscribeLabels`
stream; `Label` encodes, signs and verifies `com.atproto.label.defs#label`;
`DidDocument.labelerKey` and `labelerEndpoint` find a labeler's key and
service. Verified against Bluesky's moderation labeler, a labelz round trip,
and Typeahead's production consumer.
- **fix**: the package ships `scripts/check_imports.zig`, which `build.zig`
imports; 0.6.3-alpha.1 could not be built as a dependency.
## 0.6.3-alpha.2
- **fix**: ship `scripts/check_imports.zig` in the package. `build.zig` imports
it, so 0.6.3-alpha.1 could not be built as a dependency; the check now skips
directories a dependency's copy does not include.
## 0.6.3-alpha.1
- **feat**: `LabelClient` reads a labeler's `com.atproto.label.subscribeLabels`
stream with the firehose client's reconnect, backoff, idle watchdog and
cursor-after-accept behaviour.
- **feat**: `Label` decodes and encodes `com.atproto.label.defs#label` as
DAG-CBOR, signs as a labeler and verifies against a `did:key`; `labels`
decodes and encodes `#labels`, `#info` and error frames.
- **feat**: `DidDocument.labelerKey` (`#atproto_label`) and
`DidDocument.labelerEndpoint` (`#atproto_labeler`).
- **refactor**: `FirehoseClient` is `SubscriptionClient(RepoStream)`; its API
is unchanged.
- **docs**: `examples/07_follow_a_labeler.zig` follows Bluesky's moderation
labeler and verifies each label's signature.
## 0.6.2
- **fix**: reuse the canonical `Datetime` import during module discovery.
The stale lowercase path broke 0.6.1 builds on case-sensitive filesystems.
- **fix**: stop docs publishing immediately when its build fails.
## 0.6.1
- **refactor**: store `Tid` in 64 bits while preserving timestamp and clock ID
wire encoding; `Tid.str()` now returns `[13]u8` instead of a borrowed slice.
- **refactor**: simplify datetime parsing and calendar arithmetic;
`Datetime.toString()` now returns `[27]u8` instead of taking a caller buffer.
- **feat**: add `car.writeEphemeral` and `car.writeEphemeralAlloc` for writing
multiple block slices without concatenating them. `car.write` now takes
`*std.Io.Writer`.
- **refactor**: encode complete base32 chunks with packed vector operations.
## 0.6.0
First stable release of the Zig 0.17 line. The library is 0.6.0-alpha.7
unchanged; this release moves the two network dependencies off prereleases.
- **refactor**: adopt zttp 0.2.0 and websocket 0.2.0, both identical in code
to the alpha.5 builds zat already shipped with.
- The 0.6.0 prereleases added, in order: the Zig 0.17 requirement (alpha.1),
STAR v1 reading (alpha.1) and writing (alpha.7), the websocket
permessage-deflate setup fix (alpha.3), `Mst.deleteReturn` atomicity and
`error.Canceled` propagation (alpha.4), TLS validation time refresh
(alpha.5), and distrust of the compromised eMudhra keys (alpha.6).
0.5.x stays on Zig 0.16.
## 0.6.0-alpha.7
- **feat**: `star.Writer` frames STAR v1 archives: canonical metadata header,
`writePair` or `beginPair` + `writeValue` for streamed values, `finish` to
flush, and `ordered_keys` to enforce strict bytewise key order. It rejects
metadata `star.Reader` would reject.
- **fix**: STAR length prefixes are capped at 6 varint bytes, following the
spec at eb0c078. Readers previously accepted up to 9.
- **test**: the STAR reader and writer run bryan newbold's interop fixtures
from cobalt/star: 13 valid archives round-trip byte for byte, 31 invalid
archives are rejected.
## 0.6.0-alpha.6
- **fix**: adopt zttp 0.2.0-alpha.5 and websocket 0.2.0-alpha.5, which
distrust the compromised eMudhra roots and intermediates by SPKI digest.
`zig build trust-probe` checks that a compromised handle and DID are
rejected while `atproto.com` still resolves.
## 0.6.0-alpha.5
- **fix**: adopt zttp 0.2.0-alpha.3 on Zig 0.17. Long-lived HTTP
transports refresh TLS validation time before new connections, so a
certificate rotation cannot be rejected using a timestamp from process startup.
Explicitly resolved HTTPS connections initialize trust before connecting.
- Also picks up zttp 0.2.0-alpha.2: deadline watchers use `io.concurrent`,
response-head cancellation propagates, buffered streaming bytes are delivered
promptly, and idempotent requests replay pooled connections reset by the peer.
## 0.6.0-alpha.4
- **fix**: `Mst.deleteReturn` leaves the tree unchanged when it fails. Deleting
the root's only entry removed it before loading the node that becomes the new
root, so a partial tree, or a block reader that failed, returned
`error.PartialTree` with the entry already gone and a different `rootCid`.
- **fix**: `JetstreamClient.subscribe` returns `error.Canceled` instead of
treating it as a dropped connection and reconnecting, which left the
canceller waiting forever.
- **fix**: `HandleResolver` passes `error.Canceled` and `error.OutOfMemory`
through instead of renaming them to resolution failures, and no longer falls
back to DNS on them.
## 0.6.0-alpha.3
- **fix**: adopt websocket 0.2.0-alpha.3. Its server created pooled
permessage-deflate state without the connection manager's lock, so
connections set up at the same moment could share one compressor: corrupted
frames, then a crash. Affects any server built on websocket.zig through zat.
## 0.6.0-alpha.2
- **fix**: builds on the zig 0.17.0 release. Adopts websocket 0.2.0-alpha.2;
websocket 0.2.0-alpha.1 does not compile on 0.17.0 because `net_read` now
returns `net.Stream.ReadResult`.
- **chore**: CI and docs publishing install zig 0.17.0.
## 0.6.0-alpha.1
- **breaking**: requires zig 0.17. Built and tested against
`0.17.0-dev.2384+ac77c23af`; 0.16 users stay on 0.5.x.
- **feat**: STAR v1 archives. `star.zig` reads a STAR-lite stream with bounded
working memory, reconstructs the MST, and verifies the root; commit
authentication is a separate step. See `example-verify-star`.
- **refactor**: adopt zttp 0.2.0-alpha.1 and websocket 0.2.0-alpha.1 (zig 0.17).
- **fix**: the build-time guard for test files missing from `root.zig` declares
the files and directories it reads, so zig 0.17's cached configure step
re-runs it when `src/` changes.
## 0.5.2
- **fix**: adopt zttp 0.1.2, preserving signed `RateLimit-Reset` timestamps.
The re-exported `RateLimitHeaders.reset` field is now `?i64`.
- **fix**: compare retry reset timestamps with signed arithmetic before
converting positive delays to milliseconds.
## 0.5.1
- **fix**: adopt zttp 0.1.1 for legacy HTTP-date support in `Retry-After`
and rejection of invalid calendar dates.
- **fix**: resolve the user’s PDS in the renamed search-your-follows example.
- **fix**: retry dependency downloads in CI and documentation publishing.
- **docs**: archive design records outside the site navigation and simplify the search example.
## 0.5.0
- **change**: the HTTP transport now comes from [zttp](https://tangled.org/zat.dev/zttp).
`zat.HttpTransport` is `zttp.Client`; the transport's own tests moved with it. what
changed for callers:
- `FetchOptions.redirect_behavior` (a std type) is `on_redirect: .follow | .surface | .refuse`.
- `capture_response_headers` and `OAuthHeaders` are gone; name the headers you want in
`capture_headers` and read them with `result.headers.get(name)`.
- a payload without `content_type` is `error.MissingContentType`. zat's xrpc layer sets
`application/json` itself; the transport no longer assumes it.
- `HttpTransport.init` identifies as zttp. applications should name themselves with
`initWithUserAgent`, which zat's own clients now do.
- and everything zttp hardened since the split: `authorization` never follows a redirect
to another origin, a trailing-window rate guard, per-request deadlines, streamed
response caps, CR/LF validation of urls and headers, http-date `Retry-After`, and
`open`/`stream` for bodies that belong on disk.
## 0.4.5
- **fix**: the default `User-Agent` reads its version from `build.zig.zon` instead of a string
literal. the literal was written for 0.3.30 and never followed later bumps, so every
release since has introduced itself as 0.3.30 to the PDSes it called. `build.zig` now
exposes the zon version through a `build_options` module that consumers inherit with the
`zat` module.
- **fix**: `HttpTransport.fetch` returns `error.TooManyHeaders` when `accept` plus
`extra_headers` exceed its 8-slot buffer. it used to keep the first eight and drop the rest
without a word, which would have surfaced as an unrelated auth failure.
- **test**: the did:plc integration test runs on `testing.allocator` directly and its
duplicate leak-repro twin is gone.
## 0.4.4
- **fix**: zat compiles for 32-bit targets without native 64-bit atomics (ARMv6, e.g. a
Raspberry Pi 1 running zds). the three `std.atomic.Value(u64)` counters — the jetstream and
firehose `frames_this_connection` idle detectors and the xrpc `StreamProgress.bytes` stall
detector — only ever ask "did this change since last tick", so they are `usize` now. the
`cbor.Value`/`MapEntry` size asserts pin 64-bit layouts only, and `Cid.digest()` rejects a
varint digest length that does not fit `usize` instead of failing to coerce.
- **ci**: compile the test module for `arm-linux-musleabihf` (`arm1176jzf_s`) on every push so
32-bit support cannot regress silently; `skip_foreign_checks` keeps the run step from trying
to execute the foreign binary.
- **docs**: tidy stray root docs, refresh the downstream list.
- **test**: cover pruning an empty node stranded as a left child.
## 0.4.3
- **fix**: `Mst.collectBlocks` now emits the block for an empty node instead of
skipping it. `collectNodeBlocks` bails on `isUnloadedStub`, and after `nodeCid`
serializes a node it clears `dirty` and caches the encoding without emitting —
so a genuinely empty node ends up not-dirty, cid-set, no left, no entries, which
is byte-for-byte the shape of an unloaded stub. Skipping a stub is right (its
block is already stored); skipping an empty node strands it, because nothing else
ever writes one. Content addressing separates the two: only an empty node hashes
to the empty-node cid. Ordinary nodes were never at risk — they reach the emit
path and reuse the cached encoding, which is what that cache is for. Empty nodes
are the one shape that cannot, and the same stub/empty ambiguity `0.3.19` guarded
in the delete path was still open here. Found in production: two repos on
pds.zat.dev carried an empty subtree node minted by a pre-`0.3.19` writer, its
block was never stored, and the first tree walk that reached it returned
`PartialTree` — every `createRecord` 500, `getRepo` 404, for any collection. The
fix is self-healing: `nodeCid` returns a stub's cid without loading it, so a write
that does not descend into the stranded branch still commits, and the collect pass
puts the missing block back. New coverage: the collect-closure invariant (every
node cid a collected block points at is itself collected) and the production
repair path (store missing the block, lazy load, write, assert it returns). See
`docs/incident-2026-08-18-empty-mst-node.md` in zds.
## 0.4.2
- `zat.cbor` accepts finite 64-bit floats, matching the reference
implementation (atmos cbor): decode takes additional-info 27 (rejecting
NaN/Infinity/float16/float32 exactly as atmos does), `Value` gains a
`.float` variant (deliberately last — the hot dispatch keeps its tag
order), and encode writes the canonical 9-byte form. non-finite floats
are asserted unreachable in encode rather than widening the hot-path
error set: no producing path (fromJson, decode) can construct one.
benchmarked flat vs 0.4.1 on atproto-bench (decode/decode+verify/CID/
MST). the old "DAG-CBOR forbids floats in AT Protocol" comment was
wrong about the CBOR layer — the lex data model discourages floats,
but they occur in the wild and atmos accepts them.
- `zat.cbor.fromJson`: ATProto JSON -> CBOR data-model conversion (the
atmos `cbor.FromJSON` port): `{"$bytes"}`/`{"$link"}` single-key
sentinels, whole numbers within ±2^53 become integers, other numbers
stay floats. needed by zat.dev/jetstream to canonicalize live records
to DAG-CBOR (upstream jetstream client parity).
## 0.4.1
- bump vendored websocket.zig to v0.1.12: `Client.handshake_failure` exposes
non-101 upgrade rejections (status + bounded body), which the
zat.dev/jetstream v2 live client needs for the typed pre-upgrade error
contract (400 CursorTooOld / UnknownZstdDictionary / InvalidRequest).
no zat API changes.
## 0.4.0
The protocol/service split. `network.bsky.jetstream.*` is a Bluesky service
API, not atproto — the same line Bluesky drew splitting `@bsky/sdk` out of
`@atproto/api` at the Jetstream v2 launch (2026-08-13). zat is now the
protocol side of that line.
- **BREAKING**: `zat.ArchiveBackfill` (released through 0.3.30) moved to
[zat.dev/jetstream](https://tangled.org/zat.dev/jetstream), the zig
jetstream service SDK, along with the streamplace example, the archive
smoke script, and the vendored decode-only libzstd (zat links no zstd at
all now). Archive consumers: depend on the `jetstream` package; it
delivers the same `zat.JetstreamEvent`s through the same handler.
- `zat.JetstreamClient` (the v1 `/subscribe` wire) remains here, functional
and deprecated-in-home, until its consumers migrate; the subscribeEvents
v2 client lands in the jetstream repo.
- **feat**: `zat.Datetime` — the atproto datetime profile as a first-class
syntax type next to Tid/Did/Nsid/Rkey: `parse` (offsets normalized to
UTC, arbitrary fractional digits truncated at microseconds, the spec's
year-zero floor enforced on the normalized instant) and `toString`
(canonical `YYYY-MM-DDTHH:MM:SS.ffffffZ`). The atproto interop datetime
fixtures now drive this parser directly. Civil math is Hinnant's
days_from_civil/civil_from_days — signed and exact over 0000..9999,
unlike std.time.epoch. Deliberate divergences from general RFC 3339
parsers (reject leap-second `:60`, reject `-00:00`, upper-case T/Z only)
are the atproto spec's, cross-checked against rust's jiff and chrono and
documented in the type. Replaces four hand-rolled formatters in stream
and the SDK example's 45-line parser.
## 0.3.30
Every phase of an HTTP fetch is now bounded. The 2026-08-13 zlay authority
stall showed that StallGuard only guards the response body: a peer that
accepts a connection and never answers held callers in receiveHead
indefinitely, and a wedged connect rode the kernel's ~2min SYN timeout.
- **feat**: `HttpTransport.head_deadline_ns` (default 10s, 0 disables)
bounds connect, TLS, request send, and the wait for the response head,
surfacing `error.ResponseHeadTimeout`. StallGuard remains the trickle
guard for unbounded-size bodies. Mirrors indigo's identity client, which
deadlines every phase.
- **fix**: `default_user_agent` names the released version again (was
frozen at 0.3.22).
`zat.ArchiveBackfill` works against post-proposal-0015 jetstream archives —
including Bluesky's token-gated hosted instances (Jetstream v2 launched
officially 2026-08-13 as Bluesky Protocol Services) — and can bound a plan
to a time window instead of draining the world.
- **feat**: `Options.api_key` sends `Authorization: Bearer <key>` on
planSnapshot/listSegments/getSegment/getBlock (mirrors the Go client's
`WithAPIKey`); `fetchSeqBounds` takes the same optional key. The live
tail never needs one, matching upstream's "live stays open" contract.
- **fix**: the plan endpoint is `network.bsky.jetstream.planSnapshot` —
upstream renamed it from `planBackfill` (bluesky-social/jetstream PR #330)
and removed the old name, so every `ArchiveBackfill.run` against a current
archive failed with `PlanFailed` until this rename.
- **feat**: `Options.after_seq` / `Options.before_seq` bound the plan
(exclusive lower / inclusive upper, upstream's semantics). New
`fetchSeqBounds(io, allocator, host, start_us, end_us)` maps a
witnessed-time window to those bounds via `listSegments` metadata; its
`covered=false` result is the honest signal that a window predates the
archive's live capture. Measured against stream.waow.tech: a two-hour
recent window plans ~25 blocks where the unbounded plan reads the whole
collection's scatter.
- **feat**: `run` logs one progress line per 256 decoded blocks — a bounded
but large plan (a session inside the merged bootstrap region) must not
look like a hang.
- **fix**: `zig build` compiles again: the `cbor-bench` target imported
`cbor.zig` as a file, whose `../crypto/multibase.zig` import escapes the
bench module's path since 0acbedf; it now imports the `zat` module.
- example 07 (streamplace chat) replays historical sessions from the
archive instead of relying on Jetstream cursor retention, then finishes
the unsealed tail over the live socket, deduping the seam by rkey.
## 0.3.29
Idle-connection failover works on both streaming clients: a connection that
stays open but delivers nothing is now a fault the consumer can bound.
- **feat**: `FirehoseClient` gains `idle_timeout_ms`, mirroring
`JetstreamClient`'s option. A relay that holds the socket open but goes
silent — TCP-healthy, stream stalled — is detected and failed over instead
of waited out. Observed live 2026-08-11: bsky.network went quiet for ~2.5
minutes before closing the connection itself; consumers ate the whole gap.
Off by default (reconnect policy belongs to the consumer; a filtered
jetstream consumer may be legitimately quiet). jcalabro/atmos has no
equivalent — this is a deliberate, opt-in divergence.
- **fix**: the idle-timeout mechanism no longer uses `SO_RCVTIMEO`, which
panics under `std.Io.Threaded` in debug builds (the EAGAIN from a receive
timeout on a blocking socket is treated as a programmer bug). Both clients
now run the blocking read loop as a concurrent task with a watchdog that
compares a frame counter across quiet windows and cancels the read when a
full window passes with no frames. Fires between 1x and 2x the timeout.
`JetstreamClient.idle_timeout_ms` / `replay_idle_timeout_ms` were affected;
verified live against a silent local server (fires, control blocks
forever), the live firehose (13,322 events in 30s, zero false fires), and a
DID-filtered truly-quiet jetstream subscription (fires on schedule).
## 0.3.28
OAuth requests can be pinned to validated addresses, DPoP nonces are optional,
and identity resolution rejects the full special-purpose address space.
- **feat**: OAuth requests accept an optional `resolved_connection`, carrying
the `HttpTransport.ResolvedConnection` already produced during identity
resolution through PAR, token exchange, refresh, and arbitrary DPoP requests.
Connecting to the addresses that were validated, rather than re-resolving the
host, closes a DNS-rebinding window between the safety check and the request.
`discoverAuthorizationServerResolved` and
`fetchAuthorizationServerMetadataResolved` take the pin explicitly; the
existing `discoverAuthorizationServer` and `fetchAuthorizationServerMetadata`
are unchanged wrappers that pass `null`.
- **fix**: a DPoP nonce is no longer required. Previously any server that never
issued a `DPoP-Nonce` header failed with `MissingDpopNonce`; the nonce is now
retained until replaced and only demanded when the server actually issues a
`use_dpop_nonce` challenge.
- **fix**: identity resolution rejects the IETF special-purpose ranges it
previously allowed — CGNAT `100.64.0.0/10` (including the cloud-metadata
address `100.100.100.200`), `192.0.0.0/24`, TEST-NET, benchmarking,
`192.88.99.0/24`, multicast, and reserved space. IPv6 now requires globally
routed unicast, carving out `2001::/23`, `2001:db8::/32`, and `2002::/16`;
IPv4-mapped addresses inherit the full IPv4 policy.
## 0.3.27
Reconnect backoff resets after a connection that was established.
- **fix**: `FirehoseClient.subscribe` and `JetstreamClient.subscribe` reset the
reconnect backoff once a connection has been established, not only when the
host rotates. A single-host consumer could never satisfy the host-switch
condition, so its delay doubled 1→2→4…→60s and stayed at the ceiling for the
life of the process, however healthy each connection had been. Against a
relay that closed every ~113s this left a consumer's tail down 33% of the
time. Measured live with forced disconnects: gaps held at ~1.38s across seven
reconnects, versus 1.4/2.4/4.4/8.4/16.4/32.6s before. Matches the reset point
in jcalabro/atmos (`streaming/client.go`); keying it on delivered events
instead would leave an idle-but-healthy filtered consumer compounding its
backoff.
## 0.3.26
Strict CID parsing and formatting, following atmos's hardened profile.
- **feat**: `Cid.fromBytes`/`Cid.fromString` — strict validation against the
atproto-blessed profile: CIDv1 only, dag-cbor/raw codec, SHA-256 with a
32-byte digest, canonical (minimal) varints, no trailing bytes. `fromBytes`
borrows and does not allocate. `Cid.toString` formats `b`+base32lower in a
single allocation. Re-exported as `zat.Cid`.
- **fix**: `Cid.create` rejects hash codes it does not compute — previously it
wrote the given code into the header over an unconditional SHA-256 digest.
- **fix**: `mst.parseCidString` now validates via the strict parser instead of
accepting any base32-decodable bytes.
- **feat**: `readUvarintMinimal` — rejects overlong varint encodings, capped
at 9 bytes per the multiformats spec.
- **perf**: `multibase.base32lower` encodes 5-byte chunks at a time (~2.6×
faster CID toString; 31.6 ns/op vs atmos 49.6 ns/op).
## 0.3.25
The archive backfill release: consume a jetstream archive's full-history API
(stream.waow.tech and compatible instances) through the same handler the live
client uses.
- **feat**: `zat.ArchiveBackfill` — planBackfill → getBlock/getSegment → zstd
decompress → jss v1 columnar decode → `JetstreamEvent`s through the existing
`onEvent` handler; a consumer's live-tail code replays history unmodified.
Delivery is at-least-once, in plan order. Includes bounded per-fetch retries
(5xx/429/transport errors), `start_after`/`Result.position` resume so a
transient failure never discards a multi-GB run, opt-in whole-segment
checksum verification (xxh3 self-checksum cross-checked against the plan),
`max_blocks` for bounded exploratory runs, and opt-in `concurrency` — an
ordered FIFO fetch window measured 7.2x faster than serial on WAN block
fetches, with delivery order unchanged. `replaySegment` decodes a sealed
jss segment already in memory. The module doc records the measured scope
boundary: block-granular reads are ~1,300x amplified for sparse scattered
collections; those belong to a collection directory + listRecords.
- **feat**: vendored libzstd v1.5.7, decode-only subset (same pin as stream;
10 C files, pinned by url+hash, no system library, cross-compiles with
`-Dtarget`). Zig std's zstd decompressor measured ~20x slower than libzstd
on real jss blocks (457ms → 19ms for a 58-block segment — ahead of the Go
reference implementation at 37ms; atproto-bench `bench-jss` lane) and its
checksum verification is unimplemented, so frame content checksums went
unchecked. Every jss block's content checksum is now verified during
decompression.
- **feat**: `JetstreamClient` primary failback — after a connection that
delivered events drops, the next attempt starts at `hosts[0]` instead of
sticking to the fallback rotation until process restart.
- **feat**: `JetstreamClient.idle_timeout_ms` — fail over from a host that
holds the socket open but goes silent, which TCP keepalive never fires on.
## 0.3.24
CI and examples housekeeping: docs deployment hardening (Wisp retries,
credential fixes, PDS-recovery retry), a Streamplace chat history replay
example and its session-replay fix, and tolerating undeclared fields in DoH
safety-check responses.
## 0.3.23
Three transport failures found in stream's whole-network backfill, all of them
the same shape: `HttpTransport` accepted whatever the origin did and had no
opinion about time.
- **fix**: gzip responses now decode. `streamResponseBody` called `readerDecompressing` with a **zero-length** decompress buffer, which cannot hold a flate window, so any compressed body failed — and a `.accept_encoding = "identity"` override sat above it attributing that to a "zig stdlib issue". The buffer is now sized from the negotiated encoding (`ContentEncoding.minBufferCapacity`, still 0 bytes for `identity`, so the uncompressed path allocates nothing) and the override is gone. PDSes honour gzip at roughly 2.5x on repo listings; every consumer was paying full price for bytes it could have compressed.
- **feat**: `HttpTransport.stall` aborts a transfer that stops making progress — `idle_ns` for a peer that goes silent, `min_bytes_per_s` after `grace_ns` for one that trickles. Both default on. A wall-clock check placed after a read cannot fire, because a peer that simply stops sending leaves that read blocked in the kernel indefinitely; the body read therefore runs as an `io.async` task whose byte counter the caller watches, canceling when progress dies. Measured in stream: 1.3% of repo fetches took 10-41s and consumed ~94% of all worker-seconds, at rates around 35 KB/s — workers that looked busy while moving almost nothing.
- **fix**: a connection the origin closed before answering is replayed on a fresh one (`dead_connection_attempts`, default 3) instead of surfacing. Zig's connection pool evicts by count, never by age, so a pooled connection idle long enough for the origin to reap it gets reused and fails on first read. Replay is gated on the request provably not having taken effect — idempotent method, no payload. Go's `net/http` treats this same case (`errServerClosedIdle`) as retryable. Downstream this appeared as `listRepos` failing every ~3.5 hours, exactly the interval between calls.
- **fix**: `response.bodyErr().?` no longer panics. It is null when a read is canceled rather than failing on its own; it now falls back to `error.ReadFailed`.
Still absent, and deliberately so until something downstream demands them: dial and TLS-handshake deadlines, a response-header deadline, and a per-host connection cap.
## 0.3.22
- **fix**: `cbor.encodeAlloc` and `car.writeAlloc` translate the allocating writer's `WriteFailed` back into `OutOfMemory`. Both write into `std.Io.Writer.Allocating`, whose only failure mode *is* allocation, but `std.Io.Writer` reports it as `WriteFailed` — so exhaustion reached callers wearing the name of a data problem. Same class as 0.3.21, one layer down: found when stream's allocation-failure sweep walked past the CAR header fix and landed here. The remaining `Allocating` users in oauth/xrpc/streaming share the shape but not the consequence, and are untouched.
## 0.3.21
- **fix**: CAR header parsing no longer reports allocation failure as `InvalidHeader`. Both `readWithOptions` and `streamBlocks` wrapped `cbor.decodeAll` in a bare `catch return error.InvalidHeader`, collapsing `OutOfMemory` into a structural verdict about the file. Consumers treat a malformed CAR as a permanent property of the source and retire it, so under memory pressure a perfectly good repository was discarded and its PDS blamed. Found downstream in stream, where the same class of bug in `prepareRepo` retired repositories permanently at whole-network scale; an allocation-failure sweep over `read` now pins the classification.
## 0.3.20
- **fix**: fetch websocket.zig from tangled.org (`v0.1.11`) instead of the GitHub mirror. The `73429df` crash fix shipped in 0.3.18 had been pushed only to GitHub, so the dependency URL pointed off-forge and dragged GitHub into every consumer's module graph. `v0.1.11` tags that same commit on tangled.org — identical content hash, no code change.
## 0.3.19
- **fix**: `Mst` delete now prunes subtree nodes it empties. `deleteFromNode` recursed into a child and marked the parent dirty but never dropped the child when the delete emptied it; MST nodes are content-addressed, so the emptied node serialized as a real block and changed every ancestor CID. The tree therefore no longer equalled the tree that never contained the key — the equality commit-proof inversion depends on. `verifyCommitDiff` consequently returned `PrevDataMismatch` for valid second commits from a real PDS; any repo with two records whose keys differ in height hits it, since the lower key lives alone in a subtree. We only trimmed at the root; the TS reference and atmos both prune here (atmos cites indigo's `removeChild`/`IsEmpty` invariant). Found downstream in zlay via the atmoq relay-conformance corpus, where the `sync11/commit2-valid` control was being dropped. Post-delete roots now match atmos byte-for-byte over 25,000 deletes in atproto-bench; costs ~3% on a pure-delete microbenchmark. New coverage: a pure-MST prune test, a golden `@atproto/repo` partial-proof fixture through `verifyCommitDiff`, plus canonicality and lazy-stub guards ported from atmos. See `devlog/archive/mst-inversion-prevdata.md`.
## 0.3.18
- **fix**: bump websocket.zig to `73429df` — the client set socket timeouts through `std.posix.setsockopt`, which maps `BADF`/`NOTSOCK`/`INVAL` to `unreachable` ("always a race condition"). those are reachable on a *connection* socket: an upstream that resets around the handshake aborted the whole process from inside `FirehoseClient.connectAndRead`, and `unreachable` cannot be caught by the reconnect loop. found downstream in stream, where a full test suite aborted roughly one run in seven; clean across 27 runs after. client-side counterpart of the same fix websocket.zig already applied server-side.
## 0.3.17
- **fix**: align websocket.zig at 0.1.10, preserving a single Zig 0.16 module graph for consumers that use the new stable, port-free peer-IP API directly.
## 0.3.16
- **feat**: optional `shouldStop` handler hook on `FirehoseClient.subscribe` — checked before every frame and around every reconnect; returning true makes subscribe return cleanly instead of reconnecting forever (bounded consumers: bootstrap capture, tests, graceful shutdown). comptime-gated like `onError`/`onRawFrame`; existing handlers unchanged.
- **fix**: CAR block verification now covers the full CID (atmos parity): CIDv0 must be exactly the 34-byte sha2-256 multihash, CIDv1 must declare version 1 with the digest ending the CID exactly, and identity-hash digests are compared against content (previously accepted unchecked). valid CARs are unaffected; only forged or malformed CIDs are newly rejected.
## 0.3.15
- **feat**: optional `onRawFrame` handler hook on `FirehoseClient` — delivers raw frames for callers that decode on their own threads; reconnect cursor tracked via new `firehose.peekSeq` (cheap, no CAR hydration).
## 0.3.14
- **fix**: bump websocket.zig 0.1.8 → 0.1.9 (fixes a segfault in the server's Io accept loop with allocator-taking clientMessage handlers).
## 0.3.13
- **feat**: `FirehoseClient` host entries accept full `ws(s)://` URLs (scheme carries tls, port in the URL, path ignored), matching ecosystem norms (atmos `streaming.Options.URL`, jetstream `--relay-url`). Bare hostnames remain implicit wss, so existing callers are unchanged. New `firehose.Endpoint.parse` exposed. Enables non-TLS local upstreams like the jetstream simulator (`ws://localhost:7777`).
## 0.3.12
- **fix**: CBOR decode accepts RFC 8949 bytewise map key order alongside RFC 7049 length-first. The production firehose (indigo/cbor-gen) emits length-first, but current DAG-CBOR spec encoders (e.g. bluesky's jetstream simulator) emit bytewise; decode now accepts either while still rejecting duplicates and orders satisfying neither. Canonical-form enforcement is unchanged on the encode/verify side.
## 0.3.11
- **refactor**: remove `verifyRepo` and `VerifyResult` from the public API. Nothing called it — no downstream consumer, and even atproto-bench assembles the resolve/fetch/verify pipeline from the primitives. Real consumers verify with `verifyCommitCar` (zds `importRepo`) and `verifyCommitDiff` (firehose diffs), which are unchanged. The `fetchRepo` helper and the verifyRepo-only `VerifyError` members (`InvalidIdentifier`, `SigningKeyNotFound`, `PdsEndpointNotFound`, `FetchFailed`) go with it.
- **docs**: deepen the five example recipes — zig 0.16 `std.process.Init` entry point, `orelse return error.X` at fetched-doc boundaries, and verify-don't-trust framing throughout; README "what's here" now showcases commit verification grounded in the real zds call site; refresh roadmap and benchmark numbers (atproto-bench@20636e1); add `llms.txt`.
- **site**: accessibility pass (skip link, SPA route announcements, focus management, AA contrast), sticky desktop sidebar with heading toc, syntax highlighting, sidebar restyle.
- **repo**: `.agents/skills/` is the canonical skills directory; `.claude/skills` is a symlink to it.
## 0.3.10
- **feat**: `zat.signCommit(allocator, params, keypair)` builds and signs a canonical AT Protocol repo commit (`did`/`version:3`/`data`/`rev`/`prev`), returning the signed block bytes and its CID. This is the produce-side mirror of `verifyCommitCar`; a round-trip test signs a real MST-backed commit and verifies it back through the verifier. Downstream PDS-shaped consumers no longer need to hand-roll the commit CBOR.
- **fix**: harden AT URI parsing in `internal/syntax/at_uri.zig`.
- **fix**: adopt recent Atmos-inspired hardening in DID resolution, handle resolution, and XRPC retry behavior.
- **refactor**: rename `internal/repo/repo_verifier.zig` to `internal/repo/repo.zig` now that the file holds both the produce (`signCommit`) and verify sides. Public export names are unchanged.
- **test**: wire the full Bluesky syntax interop corpus into the suite.
- **bench**: add `zig build commit-sign-bench` for the PDS commit-sign hot path.
- **docs**: add devlog 014 on post-shaped files.
## 0.3.9
- **fix**: harden MST node decoding by rejecting duplicate or non-canonical node and entry keys, trailing bytes, oversized entry arrays, and oversized prefix lengths.
- **fix**: full `verifyRepo` now rejects incomplete `com.atproto.sync.getRepo` CARs whose MST references missing node or record blocks, including boundary-truncated CARs that otherwise parse cleanly.
- **feat**: `verifyCommitCar` adds `require_complete_repo` for callers that need full-repo completeness checks without changing the permissive default for firehose and diff CARs.
- **feat**: `zat.mst.collectReachableBlocks` collects all MST and record blocks reachable from a block-backed MST root for full repo export and audit paths.
- **docs**: move the ZDS perspective note into the docs archive.
## 0.3.8
- **feat**: firehose `#commit` events now have structural validation for repo DID, rev/since TIDs, commit CIDs, op paths, and create/update/delete CID nullability. The new `zat.firehose.encodeCommitEvent` helper builds validated commit event frames from typed params so producers can pass `since_rev` explicitly instead of hand-assembling raw CBOR.
- **fix**: firehose encoding now preserves op CIDs when records are not decoded locally, carries `prevData: null` explicitly, and round-trips the `rebase` flag.
- **refactor**: trim low-level public surface by hiding `repo_verifier`, OAuth implementation submodules, and the raw firehose frame encoder while preserving the curated top-level verifier, OAuth, and firehose codec APIs used by downstream consumers.
- **fix**: pin websocket to the canonical Tangled `websocket.zig` `v0.1.8` release, aligning Zat with the first-party websocket/httpz dependency graph used by ZDS and zlay.
- **docs**: add `ZDS_PERSPECTIVE.md` and release/zen agent notes documenting the ZDS-driven boundary work and verification loop.
## 0.3.7
- **feat**: expand `zat.oauth` from low-level PKCE/DPoP/client-assertion helpers into a framework-neutral ATProto OAuth client toolkit. New helpers cover client metadata JSON, authorization-server discovery, authorization URL construction, PAR, code exchange, refresh-token exchange, DPoP nonce retry, and DPoP-authenticated resource requests while leaving cookies, redirects, sessions, and storage policy to applications.
- **fix**: enforce ATProto OAuth profile requirements for metadata discovery, scopes, DPoP nonces, and DPoP `htu` normalization, with focused tests for the new correctness surface.
- **feat**: `HttpTransport.FetchResult` can capture OAuth-relevant response headers (`Content-Type`, `DPoP-Nonce`, `WWW-Authenticate`) and has a `deinit` helper so OAuth clients can stay on the shared transport path instead of dropping to raw `std.http.Client`.
- **fix**: `HandleResolver` DNS-over-HTTPS resolution no longer fails for handles in DNSSEC zones. Cloudflare appends a `Comment` field to DoH JSON for those zones (e.g. `dholms.at`), which the strict parse rejected with `error.InvalidDnsResponse`; the parse now ignores unknown fields. Added a network-free regression test using a real Cloudflare DNSSEC body.
- **perf**: MST `collectBlocks` caches node encodings across passes and keeps the `(cid, encoded)` cache consistent in `nodeCid`, avoiding redundant DAG-CBOR re-serialization when gathering commit blocks.
## 0.3.6
- **feat**: firehose `#commit` events now expose the raw `blocks` CAR bytes, `prevData`, operation `prev` CIDs, and a `toMstOperations()` helper so consumers can call `verifyCommitDiff`/`verifyCommitCar` without re-decoding raw frames. Added `#sync` event decoding and a named `LoadedCommitCar` return type for `loadCommitFromCAR`.
- **bench**: added `zig build firehose-decode-bench -- <atproto-bench firehose-frames.bin>` for measuring `FirehoseClient.decodeFrame` directly against the atproto-bench fixture corpus.
## 0.3.5
- **perf**: align MST hot paths with Atmos while preserving AT Protocol root parity. The tree now uses nullable child pointers with CID-only lazy stubs, direct DAG-CBOR node serialization, cached clean-node CIDs, chunked key comparison, borrowed-key insertion for benchmark/import paths, and Atmos-style ordered-tree lookup that loads only selected lazy child nodes. The atproto-bench apples-to-apples MST run now has Zat ahead of Atmos on both insert+root and lookup while producing the same root bytes.
- **feat**: `Mst.collectBlocks` and `Mst.walk` add the missing middle layer for consumers that need commit-CAR MST blocks or ordered repo traversal without reaching through `Node` internals. This is additive public API; existing callers should not break.
- **test**: ZDS main now consumes the new MST middle layer in record writes and repo import, pinned to Zat commit `485f1d485a9b8e7b703e8627a6b6a8c3e3c36a0e`, and is deployed as `atcr.io/zat.dev/zds:latest` from merged ZDS commit `8d1a8182dace`.
- **docs**: devlog 012 captures the Atmos comparison, the MST representation changes, the lookup diagnosis, and the ZDS adoption proof. Ran `zig zen` during release prep; the relevant guidance here is "Communicate intent precisely", "Edge cases matter", "Avoid local maximums", and "Together we serve the users."
## 0.3.4
- **fix**: bump websocket.zig to v0.1.4 — best-effort `setsockopt` on connection sockets. when a peer resets or another thread closes a socket mid-flight, the RCVTIMEO/SNDTIMEO/TCP_NODELAY calls hit `EBADF`/`ENOTSOCK`, which `std.posix.setsockopt` maps to `unreachable` ("always a race condition"), panicking the worker thread (SIGSEGV); the prior `catch` could not swallow it. also folds in v0.1.2 (defer `InvalidConnection`/`InvalidUpgrade` past the handshake body-completeness check) and v0.1.3 (close socket in nonblocking `cleanupConn`, fixing an FD leak).
## 0.3.3
- **feat**: `jwt.verifyJose(alg, message, signature, public_key)` — lenient ES256/ES256K verification for JOSE/JWT contexts (OAuth client assertions, DPoP), accepting high-S signatures per RFC 7515.
- **fix**: `Jwt.verify` now verifies leniently (accepts high-S). a JWT is a JOSE token, where the atproto low-S requirement does not apply and WebCrypto-based signers routinely emit high-S signatures; the previous strict verification rejected valid service-auth and OAuth tokens. matches the reference SDKs (`@atproto/crypto` `allowMalleableSig`, atmos `HashAndVerifyLenient`). strict low-S enforcement is unchanged for content-addressed signatures — `verifyCommitCar`, `verifyCommitDiff`, and `verifyDidKeySignature` still reject high-S via `verifyP256` / `verifySecp256k1`.
- **docs**: README "used by" section listing downstream consumers.
## 0.3.2
- **feat**: bump websocket.zig to v0.1.1 — streaming `Handshake.parse` onto `std.http.HeadParser` plus RFC 7230 strictness, fixing the recurring class of TCP-fragmentation parser bugs. two new error variants (`WhitespaceBeforeColon`, `AmbiguousBodyLength`) surface as 400 responses.
## 0.3.1
- **feat**: `XrpcClient.queryChecked` and `XrpcClient.procedureChecked` return a checked union of successful `Response` or structured `XrpcError`, preserving AT Protocol `error` / `message` envelopes for non-2xx responses.
- **feat**: `XrpcClient.RetryPolicy` adds status-driven retries for transient transport errors plus HTTP 429/5xx responses, with `retry-after` and rate-limit header support.
- **feat**: `HttpTransport.fetch` captures `ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset`, and `retry-after` headers on responses.
- **fix**: DID and handle resolution now reject unsafe network targets by default, including private, loopback, link-local, multicast, documentation, and unspecified IP ranges.
- **fix**: identity resolution validates DNS and redirect targets before issuing HTTP requests, reducing SSRF exposure when resolving untrusted AT Protocol identifiers.
## 0.3.0
- **breaking**: zig 0.16 — all networking APIs take `io: std.Io` as first parameter
- **breaking**: streaming clients use `subscribe(handler)` pattern instead of `connect()` + `next()` loop
- **breaking**: websocket.zig bumped — Io-native server accept loop, client write lock, TLS stream support
- **fix**: `DidResolver.resolve` and `HttpTransport.fetch` propagate the underlying `std.http.Client.fetch` error instead of collapsing every transport-layer failure (DNS, connect, TLS) to `error.DidResolutionFailed` / `error.RequestFailed` — callers can distinguish failure modes via `@errorName(err)`. soft-breaking: the inferred error set widens
- **feat**: `Io.Timestamp` replaces libc `gettimeofday` in JWT/OAuth
- **feat**: `io.sleep()` replaces libc `nanosleep` in reconnect backoff (cancellation-aware)
- **feat**: `car.streamBlocks` + `BlockIterator` — pull-style, zero-allocation CAR iteration for large repos (sync.getRepo). shares parser helpers with `read`/`readWithOptions`; yields slices into the input buffer and exposes `offset()` so callers can build their own CID → byte-offset index. strictly additive, no existing consumers affected. pass `max_size = data.len` for sync.getRepo responses — the 2 MB default targets firehose frames.
- **docs**: [devlog 008](devlog/008-the-io-migration.md) — the 0.16 migration
## 0.2.18
- **feat**: export `HttpTransport` from root module — consumers can now use `zat.HttpTransport` for direct HTTP access without going through `XrpcClient`
## 0.2.17
- **feat**: `Keypair.jwk()`, `Keypair.jwkThumbprint()`, `Keypair.uncompressedPublicKey()` — JWK export and RFC 7638 thumbprints for both P-256 and secp256k1
- **feat**: `oauth` module — stateless PKCE, DPoP proofs, client assertions, form encoding, and related helpers for AT Protocol OAuth flows (based on OAuth 2.1)
- **feat**: `jwt.base64UrlEncode`, `jwt.base64UrlDecode` now public
- **test**: interop tests for did:key derivation and data model fixtures
## 0.2.16
- **fix**: bump websocket.zig to `395d0f4` — reads full HTTP body on TCP split writes (fixes empty body when headers and body arrive in separate TCP segments)
## 0.2.15
- **feat**: `parseDidKey`, `verifyDidKeySignature` — parse `did:key` strings back to key type + raw bytes, verify signatures by `did:key` with automatic curve dispatch
- **feat**: `Keypair` struct — unified abstraction over secp256k1/P-256 for sign, publicKey, did:key formatting
- **feat**: optional `onConnect` callback on `JetstreamClient` — exposes which host the client connected to
## 0.2.14
- **fix**: memory leak in `HttpTransport.fetch()` — `toArrayList()` transferred buffer ownership without freeing; use `written()` instead to keep ownership with the deferred `deinit()`
## 0.2.13
- **docs**: devlog 007 — up and to the right (corrections to 006, sync 1.1 verification, lightrail collection index)
## 0.2.12
- **feat**: configurable `keep_alive` on `HttpTransport` and `DidResolver.initWithOptions` — allows disabling HTTP connection reuse for memory leak investigation
## 0.2.11
- **fix**: enable TCP keepalive on websocket connections — detect dead peers in ~20s instead of blocking forever
## 0.2.10
- **deps**: bump websocket.zig to fork commit `9e6d732` — TCP split guard for HTTP body reads behind reverse proxies
## 0.2.9
- **fix**: SPA fallback routing for standard.site deep links — `_redirects`, `<base href="/">`, devlog short-name aliases
- **fix**: add glibc to nixery deps for wisp-cli patchelf in CI
- **docs**: devlog 006 — building a relay in zig (zlay architecture, deployment war stories, backfill)
- **fix**: publish-docs.zig missing devlog entries 004-006
## 0.2.8
- **feat**: sync 1.1 — `ChildRef` union, `loadFromBlocks`, `putReturn`/`deleteReturn`, `verifyCommitDiff`
- **feat**: `loadCommitFromCAR` returns unsigned commit bytes
## 0.2.7
- **feat**: `Value.getUint()` — extract unsigned integers as `?u64` from CBOR maps. `getInt()` truncates values > `i64` max; upstream AT Protocol firehose seq numbers now exceed this limit.
## 0.2.6
- **feat**: specialized MST decoder — `decodeMstNode()` parses known MST CBOR schema directly, zero-copy byte slicing, avoids generic `Value` union construction
- **feat**: in-walk MST structure verification — `walkAndVerifyMst` checks key heights during traversal instead of full tree rebuild. MST step: 218ms → 39ms (5.5x), compute total: 300ms → 123ms (2.4x)
- **docs**: devlog 005 — updated benchmark numbers and chart
## 0.2.5
- **feat**: O(1) block lookup in CAR parser — `StringHashMap` index built during `read()`/`readWithOptions()`, `findBlock()` uses index instead of linear scan
- **fix**: `verifyRepo` bypasses default 2 MB / 10k block limits so large repos (e.g. pfrazee.com at 70 MB / 243k blocks) actually work
- **docs**: devlog 005 — clarify Rust ecosystem (rsky, jacquard, hand-rolled RustCrypto)
## 0.2.4
- **feat**: configurable CAR size limits — `max_size` and `max_blocks` options in `readWithOptions` for large repo verification
- **feat**: export `jwt` module (not just `Jwt` type) for direct access to `verifySecp256k1`/`verifyP256`
- **docs**: devlog 005 — three-way trust chain verification (zig vs Go vs Rust)
- **docs**: README rewrite — added CBOR, CAR, MST, firehose, jetstream, signing, repo verification
## 0.2.3
- **docs**: devlog 004 — the sig-verify saga (k256 5×52-bit field, Fermat scalar inversion, three-way bench with rsky)
- changelog backfill for 0.2.1 and 0.2.2
## 0.2.2
- **feat**: CAR parser enforces size limits — 2MB max on blocks field, max block count. matches indigo's limits for production parity.
## 0.2.1
- **feat**: CID hash verification in CAR parser — `car.read()` SHA-256 hashes each block and compares against the CID digest. proves block content wasn't corrupted or tampered with. `readWithOptions(.{ .verify_block_hashes = false })` to skip for trusted local data.
- **fix**: remove pfrazee.com from default test suite (network-dependent)
## 0.2.0
- **feat**: end-to-end repo verification — `verifyRepo(allocator, identifier)` exercises the full AT Protocol trust chain: handle → DID → DID document → signing key → fetch repo CAR → verify commit signature → walk MST → rebuild tree → CID match
- **refactor**: organize `src/internal/` into domain subdirectories following the [TypeScript SDK](https://github.com/bluesky-social/atproto/tree/main/packages): `syntax/`, `crypto/`, `identity/`, `repo/`, `xrpc/`, `streaming/`, `testing/`
## 0.1.9
- **feat**: merkle search tree (MST) — `mst.Mst` with `put`, `get`, `delete`, `rootCid`
- **feat**: ECDSA signing — `signSecp256k1`, `signP256` with low-S normalization (RFC 6979)
- **feat**: `did:key` construction — `multicodec.formatDidKey`, `multicodec.encodePublicKey`
- **feat**: multibase encoding — base58btc encode, base32lower encode/decode
- interop tests: MST common prefix (13 vectors), commit proofs (6 fixtures)
## 0.1.8
- **fix**: NSID parser rejects TLD starting with digit (e.g. `1.0.0.127.record`)
- **fix**: AT-URI parser validates authority (DID/handle), collection (NSID), and rkey components; rejects `#`, `?`, spaces
- **fix**: reject high-S ECDSA signatures — atproto requires low-S normalization (BIP-62 style)
- `verifySecp256k1` and `verifyP256` are now `pub`
- atproto interop test suite: syntax validation (6 types), crypto signature verification (6 vectors), MST key heights (9 vectors)
## 0.1.7
- slim `Cid` struct from 56 to 16 bytes — store only raw bytes, parse version/codec/digest lazily on demand
- `Value` union shrinks from 64 to 24 bytes, `MapEntry` from 80 to 40 bytes
- zero-cost CID decode — tag 42 handler stores a byte slice reference instead of parsing varint fields
- inline map key reading in CBOR decoder — skips full `decodeAt` + union construction per key
- comptime size assertions for `Value` and `MapEntry`
- **breaking**: `Cid` fields (`version`, `codec`, `hash_fn`, `digest`) are now accessor methods returning optionals — e.g. `cid.version` → `cid.version().?`
- `parseCid` simplified to a trivial raw-bytes wrapper
## 0.1.6
- round-robin host rotation for jetstream and firehose clients
- `Options.host` → `Options.hosts` with sensible defaults (bsky + community relays)
- backoff resets on host switch, jetstream rewinds cursor by 10s
- default jetstream hosts: 4 official bsky, waow.tech, fire.hose.cam, 6 firehose.stream regions
- default firehose hosts: bsky.network + 3 firehose.network regions
## 0.1.5
- align firehose event types with AT Protocol sync spec
## 0.1.4
- firehose support: DAG-CBOR codec, CAR codec, CID creation, firehose client
- encode and decode `com.atproto.sync.subscribeRepos` binary frames
## 0.1.3
- jetstream WebSocket client with typed events, reconnection, and cursor tracking
- `extractAt` ignores unknown JSON fields by default
- HTTP I/O isolated behind `HttpTransport` for 0.16 prep
- websocket dependency pinned to specific commit
## 0.1.2
- `extractAt` logs diagnostic info on parse failures (enable with `.zat` debug scope)
## 0.1.1
- xrpc client sets `Content-Type: application/json` for POST requests
- docs published as `site.standard.document` records on tag releases
## 0.1.0
sync types for firehose consumption:
- `CommitAction` - `.create`, `.update`, `.delete`
- `EventKind` - `.commit`, `.sync`, `.identity`, `.account`, `.info`
- `AccountStatus` - `.takendown`, `.suspended`, `.deleted`, `.deactivated`, `.desynchronized`, `.throttled`
these integrate with `std.json` for automatic parsing.
## 0.0.2
- xrpc client with gzip workaround for zig 0.15.x deflate bug
- jwt parsing and verification
## 0.0.1
- string primitives (Tid, Did, Handle, Nsid, Rkey, AtUri)
- did/handle resolution
- json helpers