-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: split modules into crates (#13)
* refactor: add projects crates * fix: keychain backup and restore * fix: restore deserialization issue * refactor: remove broken examples * refactor: run clippy * chore: rm ds_store * chore: fix gitignore * refactor: run rustfmt
- Loading branch information
1 parent
5d1eec0
commit 6c14588
Showing
67 changed files
with
1,302 additions
and
3,525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
target | ||
.DS_Store | ||
.vscode | ||
.idea |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[package] | ||
name = "walleth-identity" | ||
version = "0.0.0" | ||
authors = ["mikesposito"] | ||
readme="README.md" | ||
edition = "2021" | ||
repository = "https://github.com/mikesposito/walleth/crates/walleth-identity" | ||
keywords = [ | ||
"ethereum", | ||
"wallet", | ||
"library", | ||
"crypto", | ||
"signing", | ||
] | ||
|
||
[dependencies.utils] | ||
package = "walleth-utils" | ||
path = "../utils" | ||
|
||
[dependencies.secp256k1] | ||
version = "~0.27.0" | ||
|
||
[dependencies.serde] | ||
version = "~1.0.188" | ||
features = ["derive"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/keychain/account/errors.rs → crates/identity/src/account/errors.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pub mod account; | ||
pub mod signer; | ||
pub mod traits; | ||
|
||
pub use account::{Account, AccountError}; | ||
pub use signer::{Signer, SignerError}; | ||
pub use traits::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#[derive(Debug)] | ||
pub enum SignerError { | ||
GenericError, | ||
InvalidPrivateKey, | ||
InvalidSignature, | ||
} | ||
|
||
impl std::fmt::Display for SignerError { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
Self::InvalidPrivateKey => write!(f, "Invalid private key"), | ||
Self::InvalidSignature => write!(f, "Invalid signature"), | ||
Self::GenericError => write!(f, "Secp256k1 error"), | ||
} | ||
} | ||
} | ||
|
||
impl std::error::Error for SignerError {} | ||
|
||
impl From<secp256k1::Error> for SignerError { | ||
fn from(error: secp256k1::Error) -> Self { | ||
match error { | ||
secp256k1::Error::InvalidSecretKey => Self::InvalidPrivateKey, | ||
secp256k1::Error::InvalidSignature => Self::InvalidSignature, | ||
_ => Self::GenericError, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ pub mod signable; | |
pub use signable::*; | ||
|
||
pub mod errors; | ||
pub use errors::SignerError; | ||
pub use errors::*; |
2 changes: 1 addition & 1 deletion
2
src/keychain/signer/signable.rs → crates/identity/src/signer/signable.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.