mirror of
https://github.com/mii443/RustySecrets.git
synced 2025-08-22 16:25:32 +00:00
Remove ShareIdentifierTooBig
error and validation
Since id is a `u8` it will never be greater than 255.
This commit is contained in:
committed by
Romain Ruetschi
parent
b03433af09
commit
ed867ba938
@ -59,11 +59,6 @@ error_chain! {
|
|||||||
display("The shares are incompatible with each other.")
|
display("The shares are incompatible with each other.")
|
||||||
}
|
}
|
||||||
|
|
||||||
ShareIdentifierTooBig(id: u8, n: u8) {
|
|
||||||
description("Share identifier too big")
|
|
||||||
display("Found share identifier ({}) bigger than the maximum number of shares ({}).", id, n)
|
|
||||||
}
|
|
||||||
|
|
||||||
MissingShares(provided: usize, required: usize) {
|
MissingShares(provided: usize, required: usize) {
|
||||||
description("The number of shares provided is insufficient to recover the secret.")
|
description("The number of shares provided is insufficient to recover the secret.")
|
||||||
display("{} shares are required to recover the secret, found only {}.", required, provided)
|
display("{} shares are required to recover the secret, found only {}.", required, provided)
|
||||||
|
@ -37,10 +37,6 @@ pub(crate) fn validate_shares<S: IsShare>(shares: Vec<S>) -> Result<(u8, Vec<S>)
|
|||||||
for share in shares {
|
for share in shares {
|
||||||
let (id, threshold) = (share.get_id(), share.get_threshold());
|
let (id, threshold) = (share.get_id(), share.get_threshold());
|
||||||
|
|
||||||
if id > MAX_SHARES {
|
|
||||||
bail!(ErrorKind::ShareIdentifierTooBig(id, MAX_SHARES))
|
|
||||||
}
|
|
||||||
|
|
||||||
if id < 1 {
|
if id < 1 {
|
||||||
bail!(ErrorKind::ShareParsingInvalidShareId(id))
|
bail!(ErrorKind::ShareParsingInvalidShareId(id))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user