Support interactive customer transfers for enrolled devices
Rust development slice / linux (push) Failing after 8s
Rust development slice / linux (push) Failing after 8s
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
pub const CAPABILITY: &str = "device.customer_transfer/1";
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Offer {
|
||||
pub transfer_id: Uuid,
|
||||
pub source_tenant_id: Uuid,
|
||||
pub source_agent_id: Uuid,
|
||||
pub target_tenant_id: Uuid,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Binding {
|
||||
pub offer: Offer,
|
||||
pub asset_id: Uuid,
|
||||
pub agent_id: Uuid,
|
||||
pub certificate_sha256: String,
|
||||
}
|
||||
|
||||
impl Binding {
|
||||
pub fn signing_bytes(&self) -> Result<Vec<u8>, serde_json::Error> {
|
||||
let mut bytes = b"rust-discovery:customer-transfer:1\0".to_vec();
|
||||
bytes.extend(serde_json::to_vec(self)?);
|
||||
Ok(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Receipt {
|
||||
pub binding: Binding,
|
||||
pub signature_hex: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct CertificateRequest {
|
||||
pub csr_pem: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct CertificateResponse {
|
||||
pub certificate_pem: String,
|
||||
pub receipt: Receipt,
|
||||
}
|
||||
@@ -3,6 +3,7 @@ pub mod agent_update;
|
||||
pub mod agent_update_provisioning;
|
||||
pub mod apt_transaction;
|
||||
pub mod checkpoint_repair;
|
||||
pub mod customer_transfer;
|
||||
pub mod inventory_document;
|
||||
pub mod jobs;
|
||||
pub mod reconciliation;
|
||||
|
||||
Reference in New Issue
Block a user