Skip to content

Commit

Permalink
Merge pull request #4 from chendave/noncesize
Browse files Browse the repository at this point in the history
update Nonce size limits
  • Loading branch information
yogeshbdeshpande authored Oct 19, 2023
2 parents 6bbf358 + 15b9f35 commit fc49755
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ impl TryFrom<&str> for OneNonce {
type Error = Error;

fn try_from(v: &str) -> Result<Self, Error> {
if v.len() >= 10 && v.len() <= 74 {
if v.len() >= 8 && v.len() <= 88 {
Ok(OneNonce::String(v.to_string()))
} else {
Err(Error::ParseError(
"nonce must be between 10 and 74 characters".to_string(),
"nonce must be between 8 and 88 characters".to_string(),
))
}
}
Expand Down Expand Up @@ -318,16 +318,16 @@ mod test {
let e = Nonce::try_from("foo").unwrap_err();
assert_eq!(
e.to_string(),
"parse error: nonce must be between 10 and 74 characters"
"parse error: nonce must be between 8 and 88 characters"
);

let e = Nonce::try_from(
"a very long nonce value that goes on, and on and on, seemingly without end...",
"this is a very long nonce value that goes on, and on and on and on, seemingly without end...",
)
.unwrap_err();
assert_eq!(
e.to_string(),
"parse error: nonce must be between 10 and 74 characters"
"parse error: nonce must be between 8 and 88 characters"
);
}

Expand Down Expand Up @@ -368,7 +368,7 @@ mod test {
let e = Nonce::try_from(["test value one", "foo"].as_slice()).unwrap_err();
assert_eq!(
e.to_string(),
"parse error: item 1: nonce must be between 10 and 74 characters"
"parse error: item 1: nonce must be between 8 and 88 characters"
);
}

Expand Down

0 comments on commit fc49755

Please sign in to comment.