pub struct PrivateKey {
pub scalar: Scalar,
}
Expand description
A private key, a valid curve25519 scalar.
Fields
scalar: Scalar
The actual curve25519 scalar.
Implementations
sourceimpl PrivateKey
impl PrivateKey
sourcepub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl<'_> Write for &mut [u8]impl<'_> Read for &[u8]
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl<'_> Write for &mut [u8]impl<'_> Read for &[u8]
Serialize the private key as bytes.
sourcepub fn from_slice(data: &[u8]) -> Result<PrivateKey, Error>
pub fn from_slice(data: &[u8]) -> Result<PrivateKey, Error>
Deserialize a private key from a slice.
sourcepub fn from_scalar(scalar: Scalar) -> PrivateKey
pub fn from_scalar(scalar: Scalar) -> PrivateKey
Create a secret key from a raw curve25519 scalar.
Trait Implementations
sourceimpl<'a, 'b> Add<&'b PrivateKey> for &'a PrivateKey
impl<'a, 'b> Add<&'b PrivateKey> for &'a PrivateKey
type Output = PrivateKey
type Output = PrivateKey
The resulting type after applying the +
operator.
sourcefn add(self, other: &'b PrivateKey) -> Self::Output
fn add(self, other: &'b PrivateKey) -> Self::Output
Performs the +
operation. Read more
sourceimpl<'b> Add<&'b PrivateKey> for PrivateKey
impl<'b> Add<&'b PrivateKey> for PrivateKey
type Output = PrivateKey
type Output = PrivateKey
The resulting type after applying the +
operator.
sourcefn add(self, other: &'b PrivateKey) -> Self::Output
fn add(self, other: &'b PrivateKey) -> Self::Output
Performs the +
operation. Read more
sourceimpl<'a> Add<PrivateKey> for &'a PrivateKey
impl<'a> Add<PrivateKey> for &'a PrivateKey
type Output = PrivateKey
type Output = PrivateKey
The resulting type after applying the +
operator.
sourcefn add(self, other: PrivateKey) -> Self::Output
fn add(self, other: PrivateKey) -> Self::Output
Performs the +
operation. Read more
sourceimpl Add<PrivateKey> for PrivateKey
impl Add<PrivateKey> for PrivateKey
type Output = PrivateKey
type Output = PrivateKey
The resulting type after applying the +
operator.
sourcefn add(self, other: PrivateKey) -> Self::Output
fn add(self, other: PrivateKey) -> Self::Output
Performs the +
operation. Read more
sourceimpl Clone for PrivateKey
impl Clone for PrivateKey
sourcefn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PrivateKey
impl Debug for PrivateKey
sourceimpl Decodable for PrivateKey
impl Decodable for PrivateKey
sourcefn consensus_decode<D: Read>(d: &mut D) -> Result<PrivateKey, Error>
fn consensus_decode<D: Read>(d: &mut D) -> Result<PrivateKey, Error>
Decode an object with a well-defined format.
sourceimpl Display for PrivateKey
impl Display for PrivateKey
sourceimpl Encodable for PrivateKey
impl Encodable for PrivateKey
sourceimpl FromStr for PrivateKey
impl FromStr for PrivateKey
sourceimpl Hash for PrivateKey
impl Hash for PrivateKey
sourceimpl Index<RangeFull> for PrivateKey
impl Index<RangeFull> for PrivateKey
sourceimpl<'b> Mul<&'b PrivateKey> for PublicKey
impl<'b> Mul<&'b PrivateKey> for PublicKey
sourceimpl<'b> Mul<&'b PublicKey> for PrivateKey
impl<'b> Mul<&'b PublicKey> for PrivateKey
sourceimpl<'a, 'b> Mul<&'b PublicKey> for &'a PrivateKey
impl<'a, 'b> Mul<&'b PublicKey> for &'a PrivateKey
sourceimpl Mul<PrivateKey> for PrivateKey
impl Mul<PrivateKey> for PrivateKey
type Output = PrivateKey
type Output = PrivateKey
The resulting type after applying the *
operator.
sourcefn mul(self, other: PrivateKey) -> Self::Output
fn mul(self, other: PrivateKey) -> Self::Output
Performs the *
operation. Read more
sourceimpl Mul<u8> for PrivateKey
impl Mul<u8> for PrivateKey
sourceimpl PartialEq<PrivateKey> for PrivateKey
impl PartialEq<PrivateKey> for PrivateKey
sourcefn eq(&self, other: &PrivateKey) -> bool
fn eq(&self, other: &PrivateKey) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PrivateKey) -> bool
fn ne(&self, other: &PrivateKey) -> bool
This method tests for !=
.
sourceimpl TryFrom<&[u8]> for PrivateKey
impl TryFrom<&[u8]> for PrivateKey
impl Copy for PrivateKey
impl Eq for PrivateKey
impl StructuralEq for PrivateKey
impl StructuralPartialEq for PrivateKey
Auto Trait Implementations
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnwindSafe for PrivateKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more