atproto utils for zig zat.dev
atproto sdk zig

docs: collapsible sections in readme, add MIT license

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

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

Changed files
+48 -16
+21
LICENSE
···
··· 1 + MIT License 2 + 3 + Copyright (c) 2025 nate nowack 4 + 5 + Permission is hereby granted, free of charge, to any person obtaining a copy 6 + of this software and associated documentation files (the "Software"), to deal 7 + in the Software without restriction, including without limitation the rights 8 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 + copies of the Software, and to permit persons to whom the Software is 10 + furnished to do so, subject to the following conditions: 11 + 12 + The above copyright notice and this permission notice shall be included in all 13 + copies or substantial portions of the Software. 14 + 15 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 + SOFTWARE.
+27 -16
README.md
··· 5 ## install 6 7 ```bash 8 - zig fetch --save https://tangled.org/zzstoatzz.io/zat/archive/main 9 ``` 10 11 then in `build.zig`: ··· 17 18 ## what's here 19 20 - ### string primitives 21 - 22 - parsing and validation for atproto string identifiers: 23 24 - **Tid** - timestamp identifiers (base32-sortable) 25 - **Did** - decentralized identifiers ··· 38 } 39 ``` 40 41 - ### did resolution 42 43 - resolve `did:plc` and `did:web` identifiers to their documents: 44 45 ```zig 46 var resolver = zat.DidResolver.init(allocator); ··· 55 const key = doc.signingKey(); // verification method 56 ``` 57 58 - ### handle resolution 59 60 - resolve handles to DIDs via HTTP well-known: 61 62 ```zig 63 var resolver = zat.HandleResolver.init(allocator); ··· 69 // did = "did:plc:z72i7hdynmk6r22z27h6tvur" 70 ``` 71 72 - ### xrpc client 73 74 - call AT Protocol endpoints: 75 76 ```zig 77 var client = zat.XrpcClient.init(allocator, "https://bsky.social"); ··· 88 } 89 ``` 90 91 - ### json helpers 92 93 - navigate nested json without verbose if-chains: 94 95 ```zig 96 // runtime paths for one-offs: ··· 108 const post = try zat.json.extractAt(FeedPost, allocator, value, .{"post"}); 109 ``` 110 111 - ### jwt verification 112 113 - verify service auth tokens: 114 115 ```zig 116 var jwt = try zat.Jwt.parse(allocator, token_string); ··· 126 127 supports ES256 (P-256) and ES256K (secp256k1) signing algorithms. 128 129 - ### multibase decoding 130 131 - decode public keys from DID documents: 132 133 ```zig 134 const key_bytes = try zat.multibase.decode(allocator, "zQ3sh..."); ··· 139 // parsed.raw: 33-byte compressed public key 140 ``` 141 142 ## specs 143 144 validation follows [atproto.com/specs](https://atproto.com/specs/atp).
··· 5 ## install 6 7 ```bash 8 + zig fetch --save https://tangled.sh/zzstoatzz.io/zat/archive/main 9 ``` 10 11 then in `build.zig`: ··· 17 18 ## what's here 19 20 + <details> 21 + <summary><strong>string primitives</strong> - parsing and validation for atproto identifiers</summary> 22 23 - **Tid** - timestamp identifiers (base32-sortable) 24 - **Did** - decentralized identifiers ··· 37 } 38 ``` 39 40 + </details> 41 42 + <details> 43 + <summary><strong>did resolution</strong> - resolve did:plc and did:web to documents</summary> 44 45 ```zig 46 var resolver = zat.DidResolver.init(allocator); ··· 55 const key = doc.signingKey(); // verification method 56 ``` 57 58 + </details> 59 60 + <details> 61 + <summary><strong>handle resolution</strong> - resolve handles to DIDs via HTTP well-known</summary> 62 63 ```zig 64 var resolver = zat.HandleResolver.init(allocator); ··· 70 // did = "did:plc:z72i7hdynmk6r22z27h6tvur" 71 ``` 72 73 + </details> 74 75 + <details> 76 + <summary><strong>xrpc client</strong> - call AT Protocol endpoints</summary> 77 78 ```zig 79 var client = zat.XrpcClient.init(allocator, "https://bsky.social"); ··· 90 } 91 ``` 92 93 + </details> 94 95 + <details> 96 + <summary><strong>json helpers</strong> - navigate nested json without verbose if-chains</summary> 97 98 ```zig 99 // runtime paths for one-offs: ··· 111 const post = try zat.json.extractAt(FeedPost, allocator, value, .{"post"}); 112 ``` 113 114 + </details> 115 116 + <details> 117 + <summary><strong>jwt verification</strong> - verify service auth tokens</summary> 118 119 ```zig 120 var jwt = try zat.Jwt.parse(allocator, token_string); ··· 130 131 supports ES256 (P-256) and ES256K (secp256k1) signing algorithms. 132 133 + </details> 134 135 + <details> 136 + <summary><strong>multibase decoding</strong> - decode public keys from DID documents</summary> 137 138 ```zig 139 const key_bytes = try zat.multibase.decode(allocator, "zQ3sh..."); ··· 144 // parsed.raw: 33-byte compressed public key 145 ``` 146 147 + </details> 148 + 149 ## specs 150 151 validation follows [atproto.com/specs](https://atproto.com/specs/atp). 152 + 153 + ## license 154 + 155 + MIT