tatami 0.1.1

A library for creating satellites and interacting with Tatami protocols.
Documentation
#![feature(trivial_bounds)]

mod errors;

pub use errors::{ShojiError, TatamiError};

#[cfg(feature = "libp2p")]
pub use libp2p::{identity::Keypair, Multiaddr, PeerId};

cfg_if::cfg_if! {
	if #[cfg(feature = "satellite")] {
		mod satellite;
		mod shoji;
		mod swarm;

		pub use shoji::Shoji;
		pub use satellite::{PeerMessage, Satellite, SatelliteConfig, TatamiEvent};
	} else {
	}
}

/// The Tatami Spec that this crate implements
pub const TATAMI_SPEC_MAJOR: &str = "0";
pub const TATAMI_SPEC_VERSION: &str = "0.1.0";

#[cfg(feature = "libp2p")]
/// Simply generates a random keypair. This can be used for creating a key
/// for the first time.
pub fn random_key() -> Keypair {
	Keypair::generate_ed25519()
}

#[cfg(test)]
mod tests {
	use crate::{TATAMI_SPEC_MAJOR, TATAMI_SPEC_VERSION};

	#[test]
	fn spec_major_version_compat() {
		assert!(TATAMI_SPEC_VERSION.starts_with(TATAMI_SPEC_MAJOR));
	}
}