mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-07-07 06:35:34 +00:00
feat(blahctl): add identity management commands
This commit is contained in:
parent
a9ca9b976c
commit
5252aa19ee
4 changed files with 146 additions and 16 deletions
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue