diff options
Diffstat (limited to 'src/types/keys.rs')
-rw-r--r-- | src/types/keys.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/types/keys.rs b/src/types/keys.rs new file mode 100644 index 0000000..0b52d18 --- /dev/null +++ b/src/types/keys.rs @@ -0,0 +1,26 @@ +use std::time::Instant; + +/* This file holds types passed between components. + * Whenever a type cannot be held local to a single module. + */ + +#[derive(Debug, Clone, Copy)] +pub struct Key { + pub key: [u8; 32], + pub id: u32, +} + +#[cfg(test)] +impl PartialEq for Key { + fn eq(&self, other: &Self) -> bool { + self.id == other.id && self.key[..] == other.key[..] + } +} + +#[derive(Debug, Clone, Copy)] +pub struct KeyPair { + pub birth: Instant, // when was the key-pair created + pub confirmed: bool, // has the key-pair been confirmed? + pub send: Key, // key for outbound messages + pub recv: Key, // key for inbound messages +}
\ No newline at end of file |