Struct relay_auth::SecretKey
source · pub struct SecretKey { /* private fields */ }
Expand description
Represents the secret key of an Relay.
Secret keys are based on ed25519 but this should be considered an implementation detail for now. We only ever represent public keys on the wire as opaque ascii encoded strings of arbitrary format or length.
Implementations§
source§impl SecretKey
impl SecretKey
sourcepub fn sign(&self, data: &[u8]) -> String
pub fn sign(&self, data: &[u8]) -> String
Signs some data with the secret key and returns the signature.
This is will sign with the default header.
sourcepub fn sign_with_header(&self, data: &[u8], header: &SignatureHeader) -> String
pub fn sign_with_header(&self, data: &[u8], header: &SignatureHeader) -> String
Signs some data with the secret key and a specific header and then returns the signature.
The default behavior is to attach the timestamp in the header to the signature so that old signatures on verification can be rejected.
sourcepub fn pack<S: Serialize>(&self, data: S) -> (Vec<u8>, String)
pub fn pack<S: Serialize>(&self, data: S) -> (Vec<u8>, String)
Packs some serializable data into JSON and signs it with the default header.
sourcepub fn pack_with_header<S: Serialize>(
&self,
data: S,
header: &SignatureHeader,
) -> (Vec<u8>, String)
pub fn pack_with_header<S: Serialize>( &self, data: S, header: &SignatureHeader, ) -> (Vec<u8>, String)
Packs some serializable data into JSON and signs it with the specified header.
Trait Implementations§
source§impl<'de> Deserialize<'de> for SecretKey
impl<'de> Deserialize<'de> for SecretKey
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
impl Eq for SecretKey
Auto Trait Implementations§
impl Freeze for SecretKey
impl RefUnwindSafe for SecretKey
impl Send for SecretKey
impl Sync for SecretKey
impl Unpin for SecretKey
impl UnwindSafe for SecretKey
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)