1 # Host entropy 2 # ============ 3 # 4 # The package's only host binding for randomness: entropy/native.c natively and 5 # entropy/webcrypto.js in JavaScript. generation.bend reads source words from 6 # it; trace_context.bend never does. 7 8 import Base 9 10 # One word from the host's cryptographic source: WebCrypto in JavaScript and 11 # the operating system's generator natively. Fail code 1 means unavailable and 12 # code 2 means source-failure in JavaScript; natively the code is the host 13 # errno with its strerror text. The pure codec never calls it implicitly. 14 def read_u32() -> IO(Result<&1, &1, U32 & String, U32>): 15 import "./entropy/native.c" 16 import "./entropy/webcrypto.js"