Debian Codegraph @

.cargo/vendor/wasip2/wit/deps/random/random.wit

raw
1 package wasi:[email protected];
2 /// WASI Random is a random data API.
3 ///
4 /// It is intended to be portable at least between Unix-family platforms and
5 /// Windows.
6 @since(version = 0.2.0)
7 interface random {
8 /// Return `len` cryptographically-secure random or pseudo-random bytes.
9 ///
10 /// This function must produce data at least as cryptographically secure and
11 /// fast as an adequately seeded cryptographically-secure pseudo-random
12 /// number generator (CSPRNG). It must not block, from the perspective of
13 /// the calling program, under any circumstances, including on the first
14 /// request and on requests for numbers of bytes. The returned data must
15 /// always be unpredictable.
16 ///
17 /// This function must always return fresh data. Deterministic environments
18 /// must omit this function, rather than implementing it with deterministic
19 /// data.
20 @since(version = 0.2.0)
21 get-random-bytes: func(len: u64) -> list<u8>;
22
23 /// Return a cryptographically-secure random or pseudo-random `u64` value.
24 ///
25 /// This function returns the same type of data as `get-random-bytes`,
26 /// represented as a `u64`.
27 @since(version = 0.2.0)
28 get-random-u64: func() -> u64;
29 }