API Token Fixes (#218)

* split api secret into owner_api secret and node api secrets

* update for master, drop requirement for authentication for foreign api when run on same port as owner api

* rustfmt

* re-trigger build
This commit is contained in:
Yeastplume
2019-09-12 13:18:15 +01:00
committed by GitHub
parent 78e30aa779
commit 26ad378686
7 changed files with 440 additions and 388 deletions
+8 -9
View File
@@ -296,7 +296,8 @@ where
Some(i) => to_key_u64(OUTPUT_PREFIX, &mut id.to_bytes().to_vec(), *i),
None => to_key(OUTPUT_PREFIX, &mut id.to_bytes().to_vec()),
};
option_to_not_found(self.db.get_ser(&key), &format!("Key Id: {}", id)).map_err(|e| e.into())
option_to_not_found(self.db.get_ser(&key), || format!("Key Id: {}", id))
.map_err(|e| e.into())
}
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = OutputData> + 'a> {
@@ -326,10 +327,9 @@ where
let (blind_xor_key, nonce_xor_key) =
private_ctx_xor_keys(&self.keychain(keychain_mask)?, slate_id)?;
let mut ctx: Context = option_to_not_found(
self.db.get_ser(&ctx_key),
&format!("Slate id: {:x?}", slate_id.to_vec()),
)?;
let mut ctx: Context = option_to_not_found(self.db.get_ser(&ctx_key), || {
format!("Slate id: {:x?}", slate_id.to_vec())
})?;
for i in 0..SECRET_KEY_SIZE {
ctx.sec_key.0[i] = ctx.sec_key.0[i] ^ blind_xor_key[i];
@@ -485,10 +485,9 @@ where
Some(i) => to_key_u64(OUTPUT_PREFIX, &mut id.to_bytes().to_vec(), *i),
None => to_key(OUTPUT_PREFIX, &mut id.to_bytes().to_vec()),
};
option_to_not_found(
self.db.borrow().as_ref().unwrap().get_ser(&key),
&format!("Key ID: {}", id),
)
option_to_not_found(self.db.borrow().as_ref().unwrap().get_ser(&key), || {
format!("Key ID: {}", id)
})
.map_err(|e| e.into())
}