pub struct Ed25519PublicKey(/* private fields */);Expand description
An ed25519 public key.
§BCS
The BCS serialized form for this type is defined by the following ABNF:
ed25519-public-key = 32OCTECTImplementations§
Source§impl Ed25519PublicKey
impl Ed25519PublicKey
Sourcepub fn derive_address(&self) -> Address
Available on crate feature hash only.
pub fn derive_address(&self) -> Address
hash only.Derive an Address from this Public Key
An Address can be derived from an Ed25519PublicKey by hashing the
bytes of the public key with no prefix flag.
hash(32-byte ed25519 public key)
use iota_sdk_types::{Address, Ed25519PublicKey, hash::Hasher};
let public_key_bytes = [0; 32];
let mut hasher = Hasher::new();
hasher.update(public_key_bytes);
let address = Address::new(hasher.finalize().into_inner());
println!("Address: {}", address);
let public_key = Ed25519PublicKey::new(public_key_bytes);
assert_eq!(address, public_key.derive_address());Source§impl Ed25519PublicKey
impl Ed25519PublicKey
Trait Implementations§
Source§impl Arbitrary for Ed25519PublicKey
impl Arbitrary for Ed25519PublicKey
Source§type Parameters = ()
type Parameters = ()
The type of parameters that
arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default.Source§type Strategy = BoxedStrategy<Ed25519PublicKey>
type Strategy = BoxedStrategy<Ed25519PublicKey>
The type of
Strategy used to generate values of type Self.Source§fn arbitrary_with(args: <Self as Arbitrary>::Parameters) -> Self::Strategy
fn arbitrary_with(args: <Self as Arbitrary>::Parameters) -> Self::Strategy
Source§impl AsRef<[u8]> for Ed25519PublicKey
impl AsRef<[u8]> for Ed25519PublicKey
Source§impl Clone for Ed25519PublicKey
impl Clone for Ed25519PublicKey
Source§fn clone(&self) -> Ed25519PublicKey
fn clone(&self) -> Ed25519PublicKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Ed25519PublicKey
impl Debug for Ed25519PublicKey
Source§impl<'de> Deserialize<'de> for Ed25519PublicKey
impl<'de> Deserialize<'de> for Ed25519PublicKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Ed25519PublicKey
impl Display for Ed25519PublicKey
Source§impl From<Ed25519PublicKey> for [u8; 32]
impl From<Ed25519PublicKey> for [u8; 32]
Source§fn from(public_key: Ed25519PublicKey) -> Self
fn from(public_key: Ed25519PublicKey) -> Self
Converts to this type from the input type.
Source§impl FromStr for Ed25519PublicKey
impl FromStr for Ed25519PublicKey
Source§impl Hash for Ed25519PublicKey
impl Hash for Ed25519PublicKey
Source§impl JsonSchema for Ed25519PublicKey
impl JsonSchema for Ed25519PublicKey
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreSource§impl Ord for Ed25519PublicKey
impl Ord for Ed25519PublicKey
Source§fn cmp(&self, other: &Ed25519PublicKey) -> Ordering
fn cmp(&self, other: &Ed25519PublicKey) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Ed25519PublicKey
impl PartialEq for Ed25519PublicKey
Source§impl PartialOrd for Ed25519PublicKey
impl PartialOrd for Ed25519PublicKey
Source§impl PublicKeyExt for Ed25519PublicKey
impl PublicKeyExt for Ed25519PublicKey
Source§fn from_bytes<T: AsRef<[u8]>>(bytes: T) -> Result<Self, Self::FromBytesErr>
fn from_bytes<T: AsRef<[u8]>>(bytes: T) -> Result<Self, Self::FromBytesErr>
Tries to create an Ed25519PublicKey from bytes.
Source§fn scheme(&self) -> SignatureScheme
fn scheme(&self) -> SignatureScheme
Returns the signature scheme for this public key.
type FromBytesErr = TryFromSliceError
Source§impl Serialize for Ed25519PublicKey
impl Serialize for Ed25519PublicKey
impl Copy for Ed25519PublicKey
impl Eq for Ed25519PublicKey
impl StructuralPartialEq for Ed25519PublicKey
Auto Trait Implementations§
impl Freeze for Ed25519PublicKey
impl RefUnwindSafe for Ed25519PublicKey
impl Send for Ed25519PublicKey
impl Sync for Ed25519PublicKey
impl Unpin for Ed25519PublicKey
impl UnwindSafe for Ed25519PublicKey
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Upper case
letters are used (e.g. F9B4CA)