Wire native Dosh auth runtime
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::auth::BootstrapResponse;
|
||||
use crate::crypto;
|
||||
use crate::native::{NativeAuthOk, NativeClientHello, NativeServerHello, NativeUserAuth};
|
||||
use anyhow::{Context, Result, bail};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -25,6 +26,10 @@ pub enum PacketKind {
|
||||
Ping = 11,
|
||||
Pong = 12,
|
||||
Detach = 13,
|
||||
NativeClientHello = 14,
|
||||
NativeServerHello = 15,
|
||||
NativeUserAuth = 16,
|
||||
NativeAuthOk = 17,
|
||||
}
|
||||
|
||||
impl TryFrom<u8> for PacketKind {
|
||||
@@ -45,6 +50,10 @@ impl TryFrom<u8> for PacketKind {
|
||||
11 => Self::Ping,
|
||||
12 => Self::Pong,
|
||||
13 => Self::Detach,
|
||||
14 => Self::NativeClientHello,
|
||||
15 => Self::NativeServerHello,
|
||||
16 => Self::NativeUserAuth,
|
||||
17 => Self::NativeAuthOk,
|
||||
_ => bail!("unknown packet kind {value}"),
|
||||
})
|
||||
}
|
||||
@@ -214,6 +223,26 @@ pub struct TicketAttachOkEnvelope {
|
||||
pub ciphertext: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct NativeClientHelloBody {
|
||||
pub hello: NativeClientHello,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct NativeServerHelloBody {
|
||||
pub hello: NativeServerHello,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct NativeUserAuthBody {
|
||||
pub auth: NativeUserAuth,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct NativeAuthOkBody {
|
||||
pub ok: NativeAuthOk,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AttachOk {
|
||||
pub client_id: [u8; 16],
|
||||
|
||||
Reference in New Issue
Block a user