Make Plume compile on release (#365)

* Remove use of String for body parameters

Create SignedJson and implement FromData for it

* Make Travis test on release

* Remove warning when installing and fix coverage
This commit is contained in:
fdb-hiroshima
2018-12-22 18:27:21 +01:00
committed by GitHub
parent 718e23ac85
commit ab2998e214
9 changed files with 96 additions and 17 deletions
+11
View File
@@ -41,6 +41,10 @@ impl Digest {
}
}
pub fn verify_header(&self, other: &Digest) -> bool {
self.value()==other.value()
}
pub fn algorithm(&self) -> &str {
let pos = self
.0
@@ -69,6 +73,13 @@ impl Digest {
Err(())
}
}
pub fn from_body(body: &str) -> Self {
let mut hasher = Hasher::new(MessageDigest::sha256()).expect("Digest::digest: initialization error");
hasher.update(body.as_bytes()).expect("Digest::digest: content insertion error");
let res = base64::encode(&hasher.finish().expect("Digest::digest: finalizing error"));
Digest(format!("SHA-256={}", res))
}
}
pub fn headers() -> HeaderMap {