Skip to content

Commit

Permalink
async init
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Nov 24, 2024
1 parent 759683e commit 60c59ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wnfsutils"
version = "1.1.8"
version = "1.1.9"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -24,7 +24,7 @@ sha3 = "0.10"
futures = "0.3"
rsa = "0.9"
rand_chacha = "0.3"
base64 = "0.13.0"
base64 = "0.22.1"
tempfile = "3.2"
getrandom = { version = "0.2", features = ["js"] }
wasm-bindgen-futures = "0.4.7"
Expand Down
15 changes: 2 additions & 13 deletions src/private_forest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,22 +704,11 @@ impl<'a> PrivateDirectoryHelper<'a> {

// Implement synced version of the library for using in android jni.
impl<'a> PrivateDirectoryHelper<'a> {
pub fn synced_init(
pub async fn init_async(
store: &mut FFIFriendlyBlockStore<'a>,
wnfs_key: Vec<u8>,
) -> Result<(PrivateDirectoryHelper<'a>, AccessKey, Cid), String> {
#[cfg(target_arch = "wasm32")]
let runtime = tokio::runtime::Builder::new_current_thread()
.build()
.expect("Unable to create a runtime");

#[cfg(not(target_arch = "wasm32"))]
let runtime = tokio::runtime::Builder::new_current_thread()
.enable_time()
.build()
.expect("Unable to create a runtime");

runtime.block_on(PrivateDirectoryHelper::init(store, wnfs_key))
PrivateDirectoryHelper::init(store, wnfs_key).await
}

pub fn synced_load_with_wnfs_key(
Expand Down

0 comments on commit 60c59ba

Please sign in to comment.