1 use test_programs::p3::wasi::random;
2 
3 struct Component;
4 
5 test_programs::p3::export!(Component);
6 
7 impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
8     async fn run() -> Result<(), ()> {
9         let args = std::env::args().collect::<Vec<_>>();
10         let args = args.iter().map(|s| s.as_str()).collect::<Vec<_>>();
11         match &args[1..] {
12             ["random", n] => {
13                 random::random::get_random_bytes(n.parse().unwrap());
14             }
15             ["insecure", n] => {
16                 random::insecure::get_insecure_random_bytes(n.parse().unwrap());
17             }
18             other => {
19                 panic!("unexpected args: {other:?}");
20             }
21         }
22         Ok(())
23     }
24 }
25 
26 fn main() {}
27