fix: random-hex-32 bulk read with EOF check

ober

7aab9499fd3c850afbad6b17ee75656b6a385f94

diff --git a/src/jcode/ui/relay.ss b/src/jcode/ui/relay.ss
index a78d1ac..f408c47 100644
--- a/src/jcode/ui/relay.ss
+++ b/src/jcode/ui/relay.ss
@@ -110,12 +110,11 @@
 
 (def (random-hex-32)
   (let* ((bv (make-bytevector 32 0)))
-    (call-with-input-file "/dev/urandom"
+    (call-with-port (open-file-input-port "/dev/urandom")
       (lambda (port)
-        (let loop ((i 0))
-          (when (< i 32)
-            (bytevector-u8-set! bv i (get-u8 port))
-            (loop (+ i 1))))))
+        (let ((got (get-bytevector-n! port bv 0 32)))
+          (unless (and (number? got) (= got 32))
+            (error 'random-hex-32 "short read from /dev/urandom" got)))))
     (let loop ((i 0) (out '()))
       (cond
         ((>= i 32) (apply string-append (reverse out)))