|
10 | 10 |
|
11 | 11 | use rand_core::{Error, ErrorKind};
|
12 | 12 | use super::OsRngImpl;
|
| 13 | +use super::__wbg_shims::*; |
13 | 14 |
|
14 | 15 | use wasm_bindgen::prelude::*;
|
15 | 16 |
|
16 |
| -#[wasm_bindgen] |
17 |
| -extern "C" { |
18 |
| - pub type Function; |
19 |
| - #[wasm_bindgen(constructor)] |
20 |
| - pub fn new(s: &str) -> Function; |
21 |
| - #[wasm_bindgen(method)] |
22 |
| - pub fn call(this: &Function, self_: &JsValue) -> JsValue; |
23 |
| - |
24 |
| - pub type This; |
25 |
| - #[wasm_bindgen(method, getter, structural, js_name = self)] |
26 |
| - pub fn self_(me: &This) -> JsValue; |
27 |
| - #[wasm_bindgen(method, getter, structural)] |
28 |
| - pub fn crypto(me: &This) -> JsValue; |
29 |
| - |
30 |
| - #[derive(Clone, Debug)] |
31 |
| - pub type BrowserCrypto; |
32 |
| - |
33 |
| - // TODO: these `structural` annotations here ideally wouldn't be here to |
34 |
| - // avoid a JS shim, but for now with feature detection they're |
35 |
| - // unavoidable. |
36 |
| - #[wasm_bindgen(method, js_name = getRandomValues, structural, getter)] |
37 |
| - pub fn get_random_values_fn(me: &BrowserCrypto) -> JsValue; |
38 |
| - #[wasm_bindgen(method, js_name = getRandomValues, structural)] |
39 |
| - pub fn get_random_values(me: &BrowserCrypto, buf: &mut [u8]); |
40 |
| - |
41 |
| - #[wasm_bindgen(js_name = require)] |
42 |
| - pub fn node_require(s: &str) -> NodeCrypto; |
43 |
| - |
44 |
| - #[derive(Clone, Debug)] |
45 |
| - pub type NodeCrypto; |
46 |
| - |
47 |
| - #[wasm_bindgen(method, js_name = randomFillSync, structural)] |
48 |
| - pub fn random_fill_sync(me: &NodeCrypto, buf: &mut [u8]); |
49 |
| -} |
50 | 17 |
|
51 | 18 | #[derive(Clone, Debug)]
|
52 | 19 | pub enum OsRng {
|
|
0 commit comments