datex_core/crypto/
random.rs

1use crate::stdlib::usize;
2
3use crate::runtime::global_context::get_global_context;
4
5pub fn random_bytes_slice<const SIZE: usize>() -> [u8; SIZE] {
6    let crypto = get_global_context().crypto;
7    let crypto = crypto.lock().unwrap();
8    crypto.random_bytes(SIZE).try_into().unwrap()
9}
10pub fn random_bytes(size: usize) -> Vec<u8> {
11    let crypto = get_global_context().crypto;
12    let crypto = crypto.lock().unwrap();
13    crypto.random_bytes(size)
14}