Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ worker-sys = { path = "../worker-sys", version = "0.0.12" }
[dependencies.web-sys]
version = "0.3.63"
features = [
"Crypto",
"File",
"WorkerGlobalScope",
"ReadableStreamDefaultReader",
Expand Down
6 changes: 6 additions & 0 deletions worker/src/crypto.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use wasm_bindgen::JsCast;

pub fn crypto() -> web_sys::Crypto {
let global: web_sys::WorkerGlobalScope = js_sys::global().unchecked_into();
global.crypto().expect("failed to acquire Crypto")
}
2 changes: 2 additions & 0 deletions worker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub use crate::abort::*;
pub use crate::cache::{Cache, CacheDeletionOutcome, CacheKey};
pub use crate::context::Context;
pub use crate::cors::Cors;
pub use crate::crypto::*;
#[cfg(feature = "d1")]
pub use crate::d1::*;
pub use crate::date::{Date, DateInit};
Expand Down Expand Up @@ -55,6 +56,7 @@ mod cache;
mod cf;
mod context;
mod cors;
mod crypto;
// Require pub module for macro export
#[cfg(feature = "d1")]
pub mod d1;
Expand Down