pub struct ServerHandshake { /* private fields */ }Expand description
Server (whisker run) side of the handshake, between the server proof and the client proof
The dev server passes the first text message it receives to
respond, sends the returned proof, and then sends
nothing else until finish accepts the client’s proof.
The dev runtime relies on that silence to bound how much it reads before
authentication.
§Example
use whisker_dev_protocol::{Error, ServerHandshake};
// A pre-handshake hello that carries the secret is not a challenge.
let legacy = r#"{"kind":"hello","aslr_reference":1,"token":"secret"}"#;
assert!(matches!(
ServerHandshake::respond("secret", legacy),
Err(Error::MalformedHandshake(_))
));Implementations§
Source§impl ServerHandshake
impl ServerHandshake
Sourcepub fn respond(secret: &str, challenge: &str) -> Result<(Self, String), Error>
pub fn respond(secret: &str, challenge: &str) -> Result<(Self, String), Error>
Check a client challenge and return the server proof text to send
Fails with Error::UnsupportedVersion for a challenge from another
protocol version and Error::MalformedHandshake for anything that
is not a challenge.
Auto Trait Implementations§
impl Forget for ServerHandshake
impl Freeze for ServerHandshake
impl Move for ServerHandshake
impl RefUnwindSafe for ServerHandshake
impl Send for ServerHandshake
impl Sync for ServerHandshake
impl Unpin for ServerHandshake
impl UnsafeUnpin for ServerHandshake
impl UnwindSafe for ServerHandshake
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