summaryrefslogtreecommitdiffstats
path: root/rust/src/auth.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-08 16:01:13 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-08 16:01:13 -0800
commita2cbc5b4d88f3385ebed5b70e8cce19e00e81a8f (patch)
tree024d2f3a7a8a389f1fcf7ba8bbafd3dc192a2890 /rust/src/auth.rs
parent413968810ce470aded05e0d3519601ae6922c284 (diff)
downloadfatcat-a2cbc5b4d88f3385ebed5b70e8cce19e00e81a8f.tar.gz
fatcat-a2cbc5b4d88f3385ebed5b70e8cce19e00e81a8f.zip
rust fmt
Diffstat (limited to 'rust/src/auth.rs')
-rw-r--r--rust/src/auth.rs46
1 files changed, 25 insertions, 21 deletions
diff --git a/rust/src/auth.rs b/rust/src/auth.rs
index acee147e..d4e03ecf 100644
--- a/rust/src/auth.rs
+++ b/rust/src/auth.rs
@@ -243,20 +243,22 @@ impl AuthConfectionary {
Ok(m) => m,
Err(e) => {
// TODO: should be "chaining" here
- return Err(
- ErrorKind::InvalidCredentials(
- format!("macaroon deserialize error: {:?}", e)).into(),
- );
+ return Err(ErrorKind::InvalidCredentials(format!(
+ "macaroon deserialize error: {:?}",
+ e
+ ))
+ .into());
}
};
let mac = match mac.validate() {
Ok(m) => m,
Err(e) => {
// TODO: should be "chaining" here
- return Err(
- ErrorKind::InvalidCredentials(
- format!("macaroon validate error: {:?}", e)).into(),
- );
+ return Err(ErrorKind::InvalidCredentials(format!(
+ "macaroon validate error: {:?}",
+ e
+ ))
+ .into());
}
};
let mut verifier = Verifier::new();
@@ -270,10 +272,11 @@ impl AuthConfectionary {
let editor_id = match editor_id {
Some(id) => id,
None => {
- return Err(
- ErrorKind::InvalidCredentials("expected an editor_id caveat".to_string()).into(),
- );
- },
+ return Err(ErrorKind::InvalidCredentials(
+ "expected an editor_id caveat".to_string(),
+ )
+ .into());
+ }
};
verifier.satisfy_exact(&format!("editor_id = {}", editor_id.to_string()));
if let Some(endpoint) = endpoint {
@@ -294,10 +297,11 @@ impl AuthConfectionary {
let created = match created {
Some(c) => c,
None => {
- return Err(
- ErrorKind::InvalidCredentials("expected a 'created' (time >) caveat".to_string()).into(),
- );
- },
+ return Err(ErrorKind::InvalidCredentials(
+ "expected a 'created' (time >) caveat".to_string(),
+ )
+ .into());
+ }
};
verifier.satisfy_exact(&format!(
"time > {}",
@@ -327,9 +331,10 @@ impl AuthConfectionary {
let verify_key = match self.root_keys.get(mac.identifier()) {
Some(key) => key,
None => {
- return Err(ErrorKind::InvalidCredentials(
- format!("no valid auth signing key for identifier: {}", mac.identifier())
- )
+ return Err(ErrorKind::InvalidCredentials(format!(
+ "no valid auth signing key for identifier: {}",
+ mac.identifier()
+ ))
.into());
}
};
@@ -344,8 +349,7 @@ impl AuthConfectionary {
Err(e) => {
// TODO: chain
return Err(
- ErrorKind::InvalidCredentials(
- format!("token parsing failed: {:?}", e)).into(),
+ ErrorKind::InvalidCredentials(format!("token parsing failed: {:?}", e)).into(),
);
}
}