mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-05 20:30:57 +00:00
Add AsRef instances for PublicKey and SecretKey
This just makes it a little easier to migrate to this library from alternatives such as 'ring'.
This commit is contained in:
parent
12c5777b23
commit
a3cfc7e294
1 changed files with 12 additions and 0 deletions
|
|
@ -183,6 +183,12 @@ impl Drop for SecretKey {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<[u8]> for SecretKey {
|
||||||
|
fn as_ref(&self) -> &[u8] {
|
||||||
|
self.as_bytes()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SecretKey {
|
impl SecretKey {
|
||||||
/// Expand this `SecretKey` into an `ExpandedSecretKey`.
|
/// Expand this `SecretKey` into an `ExpandedSecretKey`.
|
||||||
pub fn expand<D>(&self) -> ExpandedSecretKey
|
pub fn expand<D>(&self) -> ExpandedSecretKey
|
||||||
|
|
@ -715,6 +721,12 @@ impl Debug for PublicKey {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<[u8]> for PublicKey {
|
||||||
|
fn as_ref(&self) -> &[u8] {
|
||||||
|
self.as_bytes()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PublicKey {
|
impl PublicKey {
|
||||||
/// Convert this public key to a byte array.
|
/// Convert this public key to a byte array.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue