Skip to content

Commit

Permalink
fix: overly-restrictive wasm cfg for keystore (#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI authored Dec 2, 2024
1 parent b4d90ac commit 093d5ec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion starknet-signers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ coins-bip32 = { version = "0.11.1", optional = true }
coins-ledger = { version = "0.12.0", default-features = false, optional = true }
semver = { version = "1.0.23", optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dependencies]
eth-keystore = { version = "0.5.0", default-features = false }

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down
6 changes: 3 additions & 3 deletions starknet-signers/src/key_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct VerifyingKey {
}

/// Errors using an encrypted JSON keystore.
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
#[derive(Debug, thiserror::Error)]
pub enum KeystoreError {
/// The file path is invalid.
Expand Down Expand Up @@ -59,7 +59,7 @@ impl SigningKey {
}

/// Loads the private key from a Web3 Secret Storage Definition keystore.
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
pub fn from_keystore<P>(path: P, password: &str) -> Result<Self, KeystoreError>
where
P: AsRef<std::path::Path>,
Expand All @@ -70,7 +70,7 @@ impl SigningKey {
}

/// Encrypts and saves the private key to a Web3 Secret Storage Definition JSON file.
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
pub fn save_as_keystore<P>(&self, path: P, password: &str) -> Result<(), KeystoreError>
where
P: AsRef<std::path::Path>,
Expand Down
2 changes: 1 addition & 1 deletion starknet-signers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
mod key_pair;
pub use key_pair::{SigningKey, VerifyingKey};

#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
pub use key_pair::KeystoreError;

mod signer;
Expand Down

0 comments on commit 093d5ec

Please sign in to comment.