Struct relay_auth::RegisterRequest
source · pub struct RegisterRequest { /* private fields */ }
Expand description
Represents a request for registration with the upstream.
This is created if the Relay signs in for the first time. The server needs to respond to this request with a unique token that is then used to sign the response.
Implementations§
source§impl RegisterRequest
impl RegisterRequest
sourcepub fn new(relay_id: &RelayId, public_key: &PublicKey) -> RegisterRequest
pub fn new(relay_id: &RelayId, public_key: &PublicKey) -> RegisterRequest
Creates a new request to register an Relay upstream.
sourcepub fn bootstrap_unpack(
data: &[u8],
signature: &str,
max_age: Option<Duration>
) -> Result<RegisterRequest, UnpackError>
pub fn bootstrap_unpack( data: &[u8], signature: &str, max_age: Option<Duration> ) -> Result<RegisterRequest, UnpackError>
Unpacks a signed register request for bootstrapping.
This unpacks the embedded public key first, then verifies if the self signature was made by that public key. If all is well then the data is returned.
sourcepub fn public_key(&self) -> &PublicKey
pub fn public_key(&self) -> &PublicKey
Returns the new public key of registering Relay.
sourcepub fn into_challenge(self, secret: &[u8]) -> RegisterChallenge
pub fn into_challenge(self, secret: &[u8]) -> RegisterChallenge
Creates a register challenge for this request.
Trait Implementations§
source§impl Debug for RegisterRequest
impl Debug for RegisterRequest
source§impl<'de> Deserialize<'de> for RegisterRequest
impl<'de> Deserialize<'de> for RegisterRequest
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
Auto Trait Implementations§
impl Freeze for RegisterRequest
impl RefUnwindSafe for RegisterRequest
impl Send for RegisterRequest
impl Sync for RegisterRequest
impl Unpin for RegisterRequest
impl UnwindSafe for RegisterRequest
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