A websocket implementation for zig
0

Configure Feed

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

Using std.io instead of std.crypto when creating random

Using `std.io` For ensuring zig 0.16 standard

authored by

Choiman1559 and committed by
GitHub
(Apr 25, 2026, 4:57 AM UTC) 21b242df 3be6210f

+3 -3
+3 -3
src/client/client.zig
··· 155 155 // we might as well use it! 156 156 const buf = self._reader.static; 157 157 const key = blk: { 158 - const bin_key = generateKey(); 158 + const bin_key = generateKey(self.io); 159 159 var encoded_key: [24]u8 = undefined; 160 160 break :blk std.base64.standard.Encoder.encode(&encoded_key, &bin_key); 161 161 }; ··· 577 577 } 578 578 }; 579 579 580 - fn generateKey() [16]u8 { 580 + fn generateKey(io: Io) [16]u8 { 581 581 if (comptime @import("builtin").is_test) { 582 582 return [16]u8{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; 583 583 } 584 584 var key: [16]u8 = undefined; 585 - std.crypto.random.bytes(&key); 585 + io.random(&key); 586 586 return key; 587 587 } 588 588