feat(blahctl): add identity management commands

This commit is contained in:
oxalica 2024-09-17 21:43:40 -04:00
parent a9ca9b976c
commit 5252aa19ee
4 changed files with 146 additions and 16 deletions

View file

@ -1,4 +1,5 @@
use std::fmt;
use std::str::FromStr;
use std::time::SystemTime;
use bitflags_serde_shim::impl_serde_for_bitflags;
@ -92,6 +93,14 @@ pub struct UserKey {
#[serde(transparent)]
pub struct PubKey(#[serde(with = "hex::serde")] pub [u8; PUBLIC_KEY_LENGTH]);
impl FromStr for PubKey {
type Err = hex::FromHexError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
hex::FromHex::from_hex(s).map(Self)
}
}
impl fmt::Display for PubKey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut buf = [0u8; PUBLIC_KEY_LENGTH * 2];