pub struct PublicKey(/* private fields */);Expand description
Bytes that are intended/thought to correspond to a point on the Edwards25519 curve (but not on its twist).
This is more compact than VerifyingKey in memory, and easier to handle,
but it is not guaranteed to be a valid point on the curve, so cannot be used
for actual cryptographic operations such as signature verification or
Diffie-Hellman key exchange.
Implementations§
Source§impl PublicKey
impl PublicKey
pub const fn from_bytes(bytes: [u8; 32]) -> PublicKey
pub fn into_inner(self) -> [u8; 32]
Source§impl PublicKey
impl PublicKey
Sourcepub fn to_human(&self) -> String
pub fn to_human(&self) -> String
Encode public key in human-readable format.
MULTIBASE(base58-btc, MULTICODEC(public-key-type, raw-public-key-bytes))
Sourcepub fn to_namespace(&self) -> RefString
pub fn to_namespace(&self) -> RefString
Encode the public key to a Git reference string:
refs/namespaces/<public-key>
and <public-key> is encoded in human-readable format
(PublicKey::to_human).
Sourcepub fn to_component(&self) -> Component<'_>
pub fn to_component(&self) -> Component<'_>
Encode the public key a Git reference component, which is equivalent to
the human-readable format (PublicKey::to_human).
Sourcepub fn from_namespaced(
refstr: &Namespaced<'_>,
) -> Result<PublicKey, PublicKeyError>
pub fn from_namespaced( refstr: &Namespaced<'_>, ) -> Result<PublicKey, PublicKeyError>
Decode a PublicKey from a namespaced Git reference, expected to be
in the format:
refs/namespaces/<public-key>/…
The <public-key> is decoded from the human-readable format
(PublicKey::to_human).
Trait Implementations§
Source§impl BindableWithIndex for &PublicKey
Available on crate features alloc and multibase and sqlite only.
impl BindableWithIndex for &PublicKey
alloc and multibase and sqlite only.impl Copy for PublicKey
Source§impl<'de> Deserialize<'de> for PublicKey
impl<'de> Deserialize<'de> for PublicKey
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PublicKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PublicKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl EcPk for PublicKey
Available on crate features alloc and cyphernet only.
impl EcPk for PublicKey
alloc and cyphernet only.const COMPRESSED_LEN: usize = dalek::ed::PUBLIC_KEY_LENGTH
const CURVE_NAME: &'static str = "Edwards25519"
type Compressed = PublicKey
fn base_point() -> PublicKey
fn to_pk_compressed(&self) -> <PublicKey as EcPk>::Compressed
fn from_pk_compressed( pk: <PublicKey as EcPk>::Compressed, ) -> Result<PublicKey, EcPkInvalid>
fn from_pk_compressed_slice(pk: &[u8]) -> Result<PublicKey, EcPkInvalid>
impl Eq for PublicKey
Source§impl From<Ed25519PublicKey> for PublicKey
Available on crate feature ssh only.
impl From<Ed25519PublicKey> for PublicKey
ssh only.Source§fn from(key: Ed25519PublicKey) -> PublicKey
fn from(key: Ed25519PublicKey) -> PublicKey
Source§impl FromIterator<PublicKey> for Namespaces
impl FromIterator<PublicKey> for Namespaces
Source§impl MultiDisplay<Encoding> for PublicKey
Available on crate features alloc and cyphernet and multibase only.
impl MultiDisplay<Encoding> for PublicKey
alloc and cyphernet and multibase only.Source§impl Ord for PublicKey
impl Ord for PublicKey
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for PublicKey
impl PartialOrd for PublicKey
Source§impl Serialize for PublicKey
impl Serialize for PublicKey
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for PublicKey
Source§impl TryFrom<&PublicKey> for VerifyingKey
impl TryFrom<&PublicKey> for VerifyingKey
Source§impl TryFrom<&Value> for PublicKey
Available on crate features alloc and multibase and sqlite only.
impl TryFrom<&Value> for PublicKey
alloc and multibase and sqlite only.Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnsafeUnpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.