mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-14 23:40:33 +08:00
radicle: Did improvements
Add conversion from Did to PublicKey through a From implementation. Add FromStr implementation. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
@@ -46,12 +46,26 @@ impl From<crypto::PublicKey> for Did {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Did> for crypto::PublicKey {
|
||||
fn from(Did(key): Did) -> Self {
|
||||
key
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Did> for String {
|
||||
fn from(other: Did) -> Self {
|
||||
other.encode()
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Did {
|
||||
type Err = DidError;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
Self::decode(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<String> for Did {
|
||||
type Error = DidError;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user