aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-11-08 03:41:01 +0100
committerTeddy Wing2018-11-08 03:41:01 +0100
commit1912ea61386cd0d4f407b2881ee93e037570a36b (patch)
treed74e963f68c0cf531fd07359407ac19497e455b9
parent031e8c979c474e7c23c1d111dd07ad2c23f2faaf (diff)
downloaddome-key-web-1912ea61386cd0d4f407b2881ee93e037570a36b.tar.bz2
paddle: Require that input `Iterator`s also be `PartialOrd`
In order to properly verify the signature, dictionary entries must be serialized in sorted order. Seems simpler to put the onus on the caller to ensure the entries can be sorted rather than having to deal with that myself.
-rw-r--r--license-generator/paddle/src/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/license-generator/paddle/src/lib.rs b/license-generator/paddle/src/lib.rs
index 5aef6fe..3ebc3f2 100644
--- a/license-generator/paddle/src/lib.rs
+++ b/license-generator/paddle/src/lib.rs
@@ -8,7 +8,7 @@ use openssl::sign::Verifier;
// https://paddle.com/docs/reference-verifying-webhooks/
fn verify_signature<'a, I>(pem: &[u8], signature: &str, params: I) -> bool
-where I: IntoIterator<Item = (&'a str, &'a str)> {
+where I: IntoIterator<Item = (&'a str, &'a str)> + PartialOrd {
let rsa = Rsa::public_key_from_pem(pem).unwrap();
let pkey = PKey::from_rsa(rsa).unwrap();
let mut verifier = Verifier::new(MessageDigest::sha1(), &pkey).unwrap();
@@ -20,7 +20,7 @@ where I: IntoIterator<Item = (&'a str, &'a str)> {
}
fn php_serialize<'a, I>(pairs: I) -> String
-where I: IntoIterator<Item = (&'a str, &'a str)> {
+where I: IntoIterator<Item = (&'a str, &'a str)> + PartialOrd {
let mut serialized = String::with_capacity(500);
let mut len = 0;