atproto pds in zig pds.zat.dev
pds atproto
25

Configure Feed

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

Avoid persisted oauth token collisions

zzstoatzz (May 21, 2026, 12:34 PM -0500) 73c6e750 306d3ce4

+7 -2
+7 -2
src/auth/dev.zig
··· 79 79 pub fn createDevJwt(allocator: std.mem.Allocator, comptime kind: []const u8, account: Account) ![]const u8 { 80 80 const header = "{\"alg\":\"HS256\",\"typ\":\"JWT\"}"; 81 81 const jti = @atomicRmw(usize, &jwt_counter, .Add, 1, .monotonic); 82 + var ts: std.posix.timespec = undefined; 83 + const timestamp = switch (std.posix.errno(std.posix.system.clock_gettime(.REALTIME, &ts))) { 84 + .SUCCESS => ts, 85 + else => std.posix.timespec{ .sec = 0, .nsec = 0 }, 86 + }; 82 87 const payload = try std.fmt.allocPrint( 83 88 allocator, 84 - "{{\"sub\":\"{s}\",\"scope\":\"com.atproto.{s}\",\"iat\":0,\"exp\":4102444800,\"jti\":\"zds-{d}\"}}", 85 - .{ account.did, kind, jti }, 89 + "{{\"sub\":\"{s}\",\"scope\":\"com.atproto.{s}\",\"iat\":0,\"exp\":4102444800,\"jti\":\"zds-{d}-{d}-{d}\"}}", 90 + .{ account.did, kind, timestamp.sec, timestamp.nsec, jti }, 86 91 ); 87 92 defer allocator.free(payload); 88 93