crypto: add PublicKey::to_namespace
Add a helper function for creating the `RefString`, `refs/namespaces/<public key>`, for a given `PublicKey`. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
parent
91efbd9630
commit
d73d485848
|
|
@ -361,6 +361,11 @@ impl PublicKey {
|
|||
|
||||
multibase::encode(multibase::Base::Base58Btc, buf)
|
||||
}
|
||||
|
||||
#[cfg(feature = "git-ref-format")]
|
||||
pub fn to_namespace(&self) -> git_ref_format::RefString {
|
||||
git_ref_format::refname!("refs/namespaces").join(git_ref_format::Component::from(self))
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for PublicKey {
|
||||
|
|
|
|||
Loading…
Reference in New Issue