#[non_exhaustive]pub struct SecretRequest {
pub connection_uuid: String,
pub connection_id: String,
pub connection_type: String,
pub connection_path: OwnedObjectPath,
pub setting: SecretSetting,
pub hints: Vec<String>,
pub flags: SecretAgentFlags,
pub responder: SecretResponder,
}Expand description
A request from NetworkManager for connection secrets.
When NetworkManager needs credentials it does not have (e.g. a Wi-Fi
password was forgotten, a VPN token expired), it calls the registered
secret agent’s GetSecrets method. This struct is the parsed, high-level
representation of that call.
Respond using the responder field. If the responder is
dropped without a response method being called, the agent auto-replies with
NoSecrets and logs a warning.
§Example
use futures::StreamExt;
use nmrs::agent::{SecretAgent, SecretAgentFlags, SecretSetting};
let (handle, mut requests) = SecretAgent::builder().register().await?;
while let Some(req) = requests.next().await {
println!("secrets requested for {}", req.connection_id);
if let SecretSetting::WifiPsk { ref ssid } = req.setting {
req.responder.wifi_psk("hunter2").await?;
}
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.connection_uuid: StringUUID of the connection needing secrets.
connection_id: StringHuman-readable name of the connection (e.g. "MyWiFi").
connection_type: StringConnection type string (e.g. "802-11-wireless", "vpn").
connection_path: OwnedObjectPathD-Bus object path of the connection settings object.
setting: SecretSettingWhich setting section needs secrets.
hints: Vec<String>Optional hints from NetworkManager about which secrets are needed.
flags: SecretAgentFlagsFlags describing the context of the request.
responder: SecretResponderThe responder used to reply with secrets or cancel.