Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update Nonce size limits #4

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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