Skip to content

Commit ae93090

Browse files
committed
Fixed Error type.
1 parent de2a7eb commit ae93090

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sskr"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
edition = "2021"
55
description = "Sharded Secret Key Reconstruction (SSKR) for Rust."
66
authors = ["Blockchain Commons"]
@@ -12,8 +12,8 @@ categories = ["cryptography"]
1212
documentation = "https://docs.rs/sskr"
1313

1414
[dependencies]
15-
bc-crypto = "0.1.1"
16-
bc-shamir = "0.1.1"
15+
bc-crypto = "0.1.2"
16+
bc-shamir = "0.1.2"
1717

1818
[dev-dependencies]
1919
hex-literal = "0.4.1"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Sharded Secret Key Reconstruction (SSKR) is a protocol for splitting a *secret*
1414

1515
```toml
1616
[dependencies]
17-
sskr = "0.1.1"
17+
sskr = "0.1.2"
1818
```
1919

2020
## Specification

src/error.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// Errors that can occur when using the SSKR library.
2-
#[derive(Debug, PartialEq, Eq, Clone)]
2+
#[derive(Debug)]
33
pub enum Error {
44
/// When combining shares, the provided shares contained a duplicate member index.
55
DuplicateMemberIndex,
@@ -46,22 +46,23 @@ pub enum Error {
4646

4747
impl std::fmt::Display for Error {
4848
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
49-
match *self {
50-
Error::DuplicateMemberIndex => write!(f, "Duplicate member index"),
51-
Error::GroupCountInvalid => write!(f, "Invalid group count"),
52-
Error::GroupThresholdInvalid => write!(f, "Invalid group threshold"),
53-
Error::MemberCountInvalid => write!(f, "Not enough shares"),
54-
Error::MemberThresholdInvalid => write!(f, "Invalid member threshold"),
55-
Error::NotEnoughGroups => write!(f, "Not enough groups"),
56-
Error::SecretLengthNotEven => write!(f, "Secret is not of even length"),
57-
Error::SecretTooLong => write!(f, "Secret is too long"),
58-
Error::SecretTooShort => write!(f, "Secret is too short"),
59-
Error::ShareLengthInvalid => write!(f, "Not enough serialized bytes"),
60-
Error::ShareReservedBitsInvalid => write!(f, "Invalid reserved bits"),
61-
Error::SharesEmpty => write!(f, "Empty share set"),
62-
Error::ShareSetInvalid => write!(f, "Invalid share set"),
63-
Error::ShamirError(ref e) => write!(f, "{}", e),
64-
}
49+
let s = match *self {
50+
Error::DuplicateMemberIndex => "Duplicate member index".to_string(),
51+
Error::GroupCountInvalid => "Invalid group count".to_string(),
52+
Error::GroupThresholdInvalid => "Invalid group threshold".to_string(),
53+
Error::MemberCountInvalid => "Not enough shares".to_string(),
54+
Error::MemberThresholdInvalid => "Invalid member threshold".to_string(),
55+
Error::NotEnoughGroups => "Not enough groups".to_string(),
56+
Error::SecretLengthNotEven => "Secret is not of even length".to_string(),
57+
Error::SecretTooLong => "Secret is too long".to_string(),
58+
Error::SecretTooShort => "Secret is too short".to_string(),
59+
Error::ShareLengthInvalid => "Not enough serialized bytes".to_string(),
60+
Error::ShareReservedBitsInvalid => "Invalid reserved bits".to_string(),
61+
Error::SharesEmpty => "Empty share set".to_string(),
62+
Error::ShareSetInvalid => "Invalid share set".to_string(),
63+
Error::ShamirError(ref e) => format!("{}", e),
64+
};
65+
f.write_str(&s)
6566
}
6667
}
6768

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![doc(html_root_url = "https://docs.rs/sskr/0.1.1")]
1+
#![doc(html_root_url = "https://docs.rs/sskr/0.1.2")]
22
#![warn(rust_2018_idioms)]
33

44
//! # Introduction
@@ -9,7 +9,7 @@
99
//!
1010
//! ```toml
1111
//! [dependencies]
12-
//! sskr = "0.1.1"
12+
//! sskr = "0.1.2"
1313
//! ```
1414
//!
1515
//! # Example

0 commit comments

Comments
 (0)