#![doc = include_str!("../README.md")]
#![no_std]
extern crate alloc;
mod keystate;
mod macros;
#[doc(inline)]
pub use keystate::{NodeState, PersistState};
use macros::{
_create_x25519_base_key_type, create_x25519_keypair_types, create_x25519_private_key_type,
create_x25519_public_key_type,
};
#[derive(Debug, Copy, Clone, PartialEq, Eq, thiserror::Error)]
pub enum ParseError {
#[error("key string was formatted incorrectly")]
InvalidFormat,
#[error("key was the wrong length")]
WrongLength,
#[error("parsed prefix did not match the key type")]
BadPrefix,
}
create_x25519_public_key_type!(
ChallengePublicKey,
"chalpub"
);
create_x25519_public_key_type!(
DerpServerPublicKey,
"derp"
);
create_x25519_keypair_types!(
DiscoPublicKey,
"discokey",
DiscoPrivateKey,
"privkey",
DiscoKeyPair
);
create_x25519_keypair_types!(
MachinePublicKey,
"mkey",
MachinePrivateKey,
"privkey",
MachineKeyPair
);
create_x25519_keypair_types!(
NetworkLockPublicKey,
"nlpub",
NetworkLockPrivateKey,
"nlpriv",
NetworkLockKeyPair
);
create_x25519_keypair_types!(
NodePublicKey,
"nodekey",
NodePrivateKey,
"privkey",
NodeKeyPair
);