enostr

rust nostr lib that works on the web and natively
git clone git://jb55.com/enostr
Log | Files | Refs

pubkey.rs (404B)


      1 use serde_derive::{Deserialize, Serialize};
      2 
      3 #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone, Hash)]
      4 pub struct Pubkey(String);
      5 
      6 impl AsRef<str> for Pubkey {
      7     fn as_ref(&self) -> &str {
      8         &self.0
      9     }
     10 }
     11 
     12 impl From<String> for Pubkey {
     13     fn from(s: String) -> Self {
     14         Pubkey(s)
     15     }
     16 }
     17 
     18 impl From<Pubkey> for String {
     19     fn from(pk: Pubkey) -> Self {
     20         pk.0
     21     }
     22 }