-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
- Loading branch information
Showing
17 changed files
with
97 additions
and
76 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
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
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
pub mod error; | ||
pub mod key; | ||
mod numalgos; | ||
pub mod peer_did; | ||
pub mod peer_did_resolver; |
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
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
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,13 @@ | ||
[package] | ||
name = "public_key" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
thiserror = "1.0.40" | ||
serde = { version = "1.0.164", features = ["derive"] } | ||
serde_json = "1.0.96" | ||
base64 = "0.21.2" | ||
bs58 = "0.5.0" | ||
multibase = "0.9.1" | ||
unsigned-varint = "0.7.1" |
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,34 @@ | ||
use thiserror::Error; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum PublicKeyError { | ||
#[error("Base 64 decoding error")] | ||
Base64DecodingError(#[from] base64::DecodeError), | ||
#[error("Multibase decoding error")] | ||
MultibaseDecodingError(#[from] multibase::Error), | ||
#[error("Varint decoding error")] | ||
VarintDecodingError(#[from] VarintDecodingError), | ||
#[error("Unsupported multicodec descriptor: {0}")] | ||
UnsupportedMulticodecDescriptor(u64), | ||
} | ||
|
||
#[derive(Debug, Error)] | ||
pub struct VarintDecodingError(unsigned_varint::decode::Error); | ||
|
||
impl std::fmt::Display for VarintDecodingError { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "Varint decoding error: {}", self.0) | ||
} | ||
} | ||
|
||
impl From<unsigned_varint::decode::Error> for VarintDecodingError { | ||
fn from(error: unsigned_varint::decode::Error) -> Self { | ||
Self(error) | ||
} | ||
} | ||
|
||
impl From<unsigned_varint::decode::Error> for PublicKeyError { | ||
fn from(error: unsigned_varint::decode::Error) -> Self { | ||
Self::VarintDecodingError(error.into()) | ||
} | ||
} |
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
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 @@ | ||
mod error; | ||
mod key; | ||
mod key_type; | ||
|
||
pub use error::PublicKeyError; | ||
pub use key::Key; | ||
pub use key_type::KeyType; |