diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/identity.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/identity.rs b/src/identity.rs index 47ec956..5443b40 100644 --- a/src/identity.rs +++ b/src/identity.rs @@ -78,7 +78,16 @@ pub struct Keystore { } impl Keystore { - pub fn decrypt_and_id_p2p(&self, source: u8, dest: u8, mac: u16, data: &Bytes) -> Option<(Bytes, Identity, Contact)> { + pub fn decrypt_and_id_p2p(&self, source: u8, dest: u8, mac: u16, data: &Bytes) -> Option<(Bytes, Rc<String>, Rc<String>)> { + // Just brute-force all the secrets until one matches... + for identity in self.identities.iter() { + for secret in identity.1.secrets.iter() { + let result = secret.1.mac_then_decrypt(mac, data); + if let Some(result) = result { + return Some((result, identity.0.clone(), secret.0.clone())); + } + } + } None } |
