| /* | |
| * Licensed to the Apache Software Foundation (ASF) under one | |
| * or more contributor license agreements. See the NOTICE file | |
| * distributed with this work for additional information | |
| * regarding copyright ownership. The ASF licenses this file | |
| * to you under the Apache License, Version 2.0 (the | |
| * "License"); you may not use this file except in compliance | |
| * with the License. You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, | |
| * software distributed under the License is distributed on an | |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| * KIND, either express or implied. See the License for the | |
| * specific language governing permissions and limitations | |
| * under the License. | |
| */ | |
| //! Trusted local control of the product-owned peer transport. | |
| use super::{Host, PeerId, Result, access::now}; | |
| pub use maka_config::access::PairingInviteState; | |
| pub use maka_config::remote_access::{ | |
| RelayAuthUpdate, RemoteAccessConfig, RemoteAccessUpdate, RemoteRelayUpdate, RemoteTransport, | |
| }; | |
| use serde::{Deserialize, Serialize}; | |
| use std::sync::{Mutex, OnceLock}; | |
| use tokio::sync::{mpsc, oneshot}; | |
| use tokio_util::sync::CancellationToken; | |
| pub fn normalize_relay_url(url: String) -> Option<String> { | |
| maka_remote_pairing::RelayEndpoint { | |
| url, | |
| quic_port: None, | |
| cert_sha256: None, | |
| } | |
| .validate() | |
| .ok() | |
| .map(|endpoint| endpoint.url.to_string()) | |
| } | |
| #[derive(Clone, Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase")] | |
| pub enum ServerTrust { | |
| System, | |
| CaDer(Vec<u8>), | |
| LeafSha256([u8; 32]), | |
| } | |
| #[derive(Clone, Debug, Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase", deny_unknown_fields)] | |
| pub struct CompanionDeviceJoin { | |
| pub peer_id: maka_remote_pairing::directory::ServerPeerId, | |
| pub display_name: String, | |
| pub proof: String, | |
| } | |
| #[derive(Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase", deny_unknown_fields)] | |
| pub struct JoinServer { | |
| pub server_url: String, | |
| pub invite: String, | |
| pub name: Option<String>, | |
| pub trust: ServerTrust, | |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] | |
| pub no_mirror: bool, | |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] | |
| pub no_config_sync: bool, | |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] | |
| pub allow_insecure_http: bool, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub companion_device: Option<CompanionDeviceJoin>, | |
| } | |
| #[derive(Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase")] | |
| pub struct JoinedServer { | |
| pub root_id: maka_remote_pairing::directory::RegisteredRootId, | |
| pub peer_id: maka_remote_pairing::directory::ServerPeerId, | |
| pub server_url: String, | |
| pub relay_urls: Vec<maka_remote_pairing::RelayEndpoint>, | |
| pub mirror_enabled: bool, | |
| pub config_sync_enabled: bool, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub device_token: Option<String>, | |
| } | |
| #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase")] | |
| pub struct ExternalServerStatus { | |
| pub server_url: String, | |
| pub mirror_enabled: bool, | |
| pub config_sync_enabled: bool, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub cert_sha256: Option<String>, | |
| } | |
| #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] | |
| #[serde(rename_all = "lowercase")] | |
| pub enum BuiltinServerInviteRole { | |
| Host, | |
| Device, | |
| Any, | |
| } | |
| #[derive(Clone, Debug, Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase", deny_unknown_fields)] | |
| pub struct BuiltinServerInviteRequest { | |
| pub role: BuiltinServerInviteRole, | |
| #[serde(default)] | |
| pub label: Option<String>, | |
| #[serde(default = "default_invite_ttl_secs")] | |
| pub ttl_secs: u64, | |
| #[serde(default = "default_invite_max_uses")] | |
| pub max_uses: u32, | |
| #[serde(default)] | |
| pub control: bool, | |
| /// Optional server instance fence: if set, the Host refuses to mint an invite when | |
| /// the running Built-in Server has switched to a different instance_id. | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub expected_instance_id: Option<String>, | |
| } | |
| fn default_invite_ttl_secs() -> u64 { | |
| 3600 | |
| } | |
| fn default_invite_max_uses() -> u32 { | |
| 1 | |
| } | |
| #[derive(Clone, Debug, Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase")] | |
| pub struct BuiltinServerInvite { | |
| pub instance_id: String, | |
| pub server_url: String, | |
| pub local_api_url: Option<String>, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub local_web_url: Option<String>, | |
| #[serde(default)] | |
| pub allow_insecure_http: bool, | |
| pub token: String, | |
| pub cert_sha256: Option<String>, | |
| pub role: BuiltinServerInviteRole, | |
| pub control: bool, | |
| pub expires_at_ms: u64, | |
| pub max_uses: u32, | |
| pub invite_uri: String, | |
| pub cli_command: Option<String>, | |
| } | |
| fn default_true() -> bool { | |
| true | |
| } | |
| #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase")] | |
| pub enum BuiltinServerBindMode { | |
| /// Kept as enum default so legacy persisted configs missing `bindMode` stay loopback-only; | |
| /// new installs created via `BuiltinServerConfig::default()` bind `Network` (0.0.0.0). | |
| #[default] | |
| LocalOnly, | |
| Network, | |
| Custom, | |
| } | |
| #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase", deny_unknown_fields)] | |
| pub struct BuiltinServerConfig { | |
| pub enabled: bool, | |
| pub api_port: u16, | |
| pub relay_port: u16, | |
| #[serde(default)] | |
| pub bind_mode: BuiltinServerBindMode, | |
| #[serde(default)] | |
| pub bind_ip: Option<String>, | |
| #[serde(default)] | |
| pub advertise_host: Option<String>, | |
| #[serde(default)] | |
| pub allow_insecure_http: bool, | |
| #[serde(default)] | |
| pub quic_port: Option<u16>, | |
| #[serde(default)] | |
| pub tls_cert_path: Option<String>, | |
| #[serde(default)] | |
| pub tls_key_path: Option<String>, | |
| #[serde(default)] | |
| pub tls_sans: Vec<String>, | |
| #[serde(default = "default_true")] | |
| pub web_enabled: bool, | |
| #[serde(default)] | |
| pub web_origins: Vec<String>, | |
| #[serde(default)] | |
| pub relay_auth_token: Option<String>, | |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] | |
| pub relay_auth_token_clear: bool, | |
| #[serde(default)] | |
| pub notify_webhook: Option<String>, | |
| #[serde(default)] | |
| pub state_dir: Option<String>, | |
| #[serde(default = "default_true")] | |
| pub mirror_enabled: bool, | |
| } | |
| impl Default for BuiltinServerConfig { | |
| fn default() -> Self { | |
| Self { | |
| enabled: false, | |
| api_port: 3341, | |
| relay_port: 3340, | |
| bind_mode: BuiltinServerBindMode::Network, | |
| bind_ip: None, | |
| advertise_host: None, | |
| allow_insecure_http: false, | |
| quic_port: None, | |
| tls_cert_path: None, | |
| tls_key_path: None, | |
| tls_sans: Vec::new(), | |
| web_enabled: true, | |
| web_origins: Vec::new(), | |
| relay_auth_token: None, | |
| relay_auth_token_clear: false, | |
| notify_webhook: None, | |
| state_dir: None, | |
| mirror_enabled: true, | |
| } | |
| } | |
| } | |
| #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase")] | |
| pub enum BuiltinServerState { | |
| #[default] | |
| Stopped, | |
| Running, | |
| Error, | |
| } | |
| #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase")] | |
| pub enum BuiltinServerBlockedReason { | |
| ExternalServer, | |
| InvalidMembership, | |
| CliOverride, | |
| } | |
| #[derive(Clone, Debug, Default, Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase")] | |
| pub struct BuiltinServerStatus { | |
| pub config: BuiltinServerConfig, | |
| #[serde(default)] | |
| pub has_relay_auth_token: bool, | |
| pub state: BuiltinServerState, | |
| pub web_url: Option<String>, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub local_web_url: Option<String>, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub local_api_url: Option<String>, | |
| pub server_url: Option<String>, | |
| pub cert_sha256: Option<String>, | |
| pub admin_token: Option<String>, | |
| pub error: Option<String>, | |
| pub blocked_reason: Option<BuiltinServerBlockedReason>, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub instance_id: Option<String>, | |
| } | |
| impl BuiltinServerStatus { | |
| /// Strip plaintext relay auth token before exposing status over IPC while preserving | |
| /// whether a token is configured. | |
| pub fn redacted(mut self) -> Self { | |
| self.has_relay_auth_token |= self.config.relay_auth_token.is_some(); | |
| self.config.relay_auth_token = None; | |
| self.config.relay_auth_token_clear = false; | |
| self | |
| } | |
| } | |
| pub enum RemoteAccessCommand { | |
| Update { | |
| update: RemoteAccessUpdate, | |
| reply: oneshot::Sender<Result<RemoteAccessConfig>>, | |
| }, | |
| Join { | |
| request: JoinServer, | |
| reply: oneshot::Sender<Result<JoinedServer>>, | |
| }, | |
| LeaveServer { | |
| reply: oneshot::Sender<Result<()>>, | |
| }, | |
| UpdateBuiltinServer { | |
| config: BuiltinServerConfig, | |
| reply: oneshot::Sender<Result<BuiltinServerStatus>>, | |
| }, | |
| BuiltinServerInvite { | |
| request: BuiltinServerInviteRequest, | |
| reply: oneshot::Sender<Result<BuiltinServerInvite>>, | |
| }, | |
| } | |
| #[derive(Default)] | |
| pub(super) struct Runtime { | |
| apply: OnceLock<mpsc::Sender<RemoteAccessCommand>>, | |
| state: Mutex<RuntimeState>, | |
| } | |
| #[derive(Default)] | |
| struct RuntimeState { | |
| phase: TransportPhase, | |
| cli_override: bool, | |
| sas_generation: u64, | |
| sas: Option<SasNotice>, | |
| builtin_server: BuiltinServerStatus, | |
| external_server: Option<ExternalServerStatus>, | |
| } | |
| #[derive(Default)] | |
| enum TransportPhase { | |
| #[default] | |
| Disabled, | |
| Starting, | |
| Failed(String), | |
| } | |
| pub struct HandshakeObservation { | |
| peer: PeerId, | |
| sas: String, | |
| at: std::time::SystemTime, | |
| generation: u64, | |
| } | |
| impl RuntimeState { | |
| fn clear_peer_sas(&mut self, peer: &PeerId) { | |
| // Fence already queued observations without keeping per-peer tombstones. | |
| self.sas_generation += 1; | |
| if self | |
| .sas | |
| .as_ref() | |
| .is_some_and(|notice| notice.peer_id == peer.as_str()) | |
| { | |
| self.sas = None; | |
| } | |
| } | |
| fn publish_sas(&mut self, generation: u64, notice: SasNotice) { | |
| if self.sas_generation == generation { | |
| self.sas = Some(notice); | |
| } | |
| } | |
| } | |
| #[derive(Clone, Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase")] | |
| pub struct SasNotice { | |
| pub peer_id: String, | |
| pub sas: String, | |
| pub at: u64, | |
| } | |
| #[derive(Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase")] | |
| pub enum ConnectionStatus { | |
| Disabled, | |
| Starting, | |
| Connected, | |
| Error, | |
| } | |
| #[derive(Serialize, Deserialize)] | |
| #[serde(rename_all = "camelCase")] | |
| pub struct RemoteAccessStatus { | |
| pub config: RemoteAccessConfig, | |
| pub status: ConnectionStatus, | |
| pub peer_id: String, | |
| pub connected_relays: Vec<String>, | |
| pub sas: Option<SasNotice>, | |
| pub invite_state: Option<PairingInviteState>, | |
| pub error: Option<String>, | |
| pub cli_override: bool, | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub external_server: Option<ExternalServerStatus>, | |
| } | |
| impl Host { | |
| pub fn remote_access_commands(&self) -> Result<mpsc::Receiver<RemoteAccessCommand>> { | |
| let (send, receive) = mpsc::channel(1); | |
| self.remote_access | |
| .apply | |
| .set(send) | |
| .map_err(|_| "remote access transport control already installed")?; | |
| Ok(receive) | |
| } | |
| pub async fn remote_transport_config(&self) -> Result<RemoteTransport> { | |
| self.access | |
| .remote_transport() | |
| .await | |
| .map_err(|error| error.to_string()) | |
| } | |
| pub async fn save_remote_access( | |
| &self, | |
| update: RemoteAccessUpdate, | |
| ) -> Result<RemoteAccessConfig> { | |
| self.access | |
| .update_remote_access(update, now()?) | |
| .await | |
| .map_err(|error| error.to_string()) | |
| } | |
| pub fn remote_access_reset(&self, online: bool, cli_override: bool) { | |
| let mut state = self.remote_access.state.lock().unwrap(); | |
| state.phase = if online { | |
| TransportPhase::Starting | |
| } else { | |
| TransportPhase::Disabled | |
| }; | |
| state.cli_override = cli_override; | |
| state.sas_generation += 1; | |
| state.sas = None; | |
| } | |
| pub fn remote_access_error(&self, error: String) { | |
| let mut state = self.remote_access.state.lock().unwrap(); | |
| state.phase = TransportPhase::Failed(error); | |
| state.sas_generation += 1; | |
| state.sas = None; | |
| } | |
| pub fn set_builtin_server_status(&self, status: BuiltinServerStatus) { | |
| self.remote_access.state.lock().unwrap().builtin_server = status.redacted(); | |
| } | |
| pub fn set_external_server_status(&self, status: Option<ExternalServerStatus>) { | |
| self.remote_access.state.lock().unwrap().external_server = status; | |
| } | |
| pub fn builtin_server_status(&self) -> BuiltinServerStatus { | |
| self.remote_access | |
| .state | |
| .lock() | |
| .unwrap() | |
| .builtin_server | |
| .clone() | |
| } | |
| pub(super) fn clear_peer_sas(&self, peer: &PeerId) { | |
| self.remote_access | |
| .state | |
| .lock() | |
| .unwrap() | |
| .clear_peer_sas(peer); | |
| } | |
| pub fn peer_handshake_observation(&self, peer: PeerId, sas: String) -> HandshakeObservation { | |
| HandshakeObservation { | |
| peer, | |
| sas, | |
| at: std::time::SystemTime::now(), | |
| generation: self.remote_access.state.lock().unwrap().sas_generation, | |
| } | |
| } | |
| pub async fn observe_peer_handshakes( | |
| &self, | |
| mut observations: mpsc::Receiver<HandshakeObservation>, | |
| stop: CancellationToken, | |
| ) -> Result<()> { | |
| // Keep advisory writes off the connection used for authentication and control. | |
| if stop.is_cancelled() { | |
| return Ok(()); | |
| } | |
| // Opening owns a SQLite writer: wait for it before honoring cancellation. | |
| let store = maka_config::ConfigurationStore::for_root(self.root.clone()) | |
| .await | |
| .map_err(|error| error.to_string())?; | |
| loop { | |
| let observation = tokio::select! { | |
| biased; | |
| () = stop.cancelled() => break, | |
| next = observations.recv() => match next { | |
| Some(next) => next, | |
| None => break, | |
| }, | |
| }; | |
| tokio::select! { | |
| biased; | |
| () = stop.cancelled() => break, | |
| result = self.observe_peer_handshake(&store, observation) => { | |
| if let Err(error) = result { | |
| tracing::warn!(%error, "could not record peer handshake"); | |
| } | |
| } | |
| } | |
| } | |
| store.close().await.map_err(|error| error.to_string()) | |
| } | |
| async fn observe_peer_handshake( | |
| &self, | |
| store: &maka_config::ConfigurationStore, | |
| HandshakeObservation { | |
| peer, | |
| sas, | |
| at, | |
| generation, | |
| }: HandshakeObservation, | |
| ) -> Result<()> { | |
| let at = time::OffsetDateTime::from(at); | |
| let timestamp = at | |
| .format(&time::format_description::well_known::Rfc3339) | |
| .map_err(|error| error.to_string())?; | |
| let at = u64::try_from(at.unix_timestamp_nanos() / 1_000_000) | |
| .map_err(|_| "clock precedes Unix epoch")?; | |
| let peer_id = peer.as_str().to_owned(); | |
| if !store | |
| .record_host_peer_activity(peer, self.device_grant.clone(), timestamp) | |
| .await | |
| .map_err(|error| error.to_string())? | |
| { | |
| self.remote_access | |
| .state | |
| .lock() | |
| .unwrap() | |
| .publish_sas(generation, SasNotice { peer_id, sas, at }); | |
| } | |
| Ok(()) | |
| } | |
| pub(super) async fn request_remote_access_update( | |
| &self, | |
| update: RemoteAccessUpdate, | |
| ) -> Result<RemoteAccessConfig> { | |
| let apply = self | |
| .remote_access | |
| .apply | |
| .get() | |
| .ok_or("this Host does not accept remote access updates")?; | |
| let (reply, receive) = oneshot::channel(); | |
| apply | |
| .send(RemoteAccessCommand::Update { update, reply }) | |
| .await | |
| .map_err(|_| "remote access transport is stopping")?; | |
| receive | |
| .await | |
| .map_err(|_| "remote access transport stopped before applying settings")? | |
| } | |
| pub(super) async fn request_server_join(&self, request: JoinServer) -> Result<JoinedServer> { | |
| let apply = self | |
| .remote_access | |
| .apply | |
| .get() | |
| .ok_or("this Host does not accept Maka Server enrollment")?; | |
| let (reply, receive) = oneshot::channel(); | |
| apply | |
| .send(RemoteAccessCommand::Join { request, reply }) | |
| .await | |
| .map_err(|_| "remote access transport is stopping")?; | |
| receive | |
| .await | |
| .map_err(|_| "remote access transport stopped before completing enrollment")? | |
| } | |
| pub(super) async fn request_server_leave(&self) -> Result<()> { | |
| let apply = self | |
| .remote_access | |
| .apply | |
| .get() | |
| .ok_or("this Host does not accept Maka Server changes")?; | |
| let (reply, receive) = oneshot::channel(); | |
| apply | |
| .send(RemoteAccessCommand::LeaveServer { reply }) | |
| .await | |
| .map_err(|_| "remote access transport is stopping")?; | |
| receive | |
| .await | |
| .map_err(|_| "remote access transport stopped before leaving Maka Server")? | |
| } | |
| pub(super) async fn request_builtin_server_update( | |
| &self, | |
| config: BuiltinServerConfig, | |
| ) -> Result<BuiltinServerStatus> { | |
| let apply = self | |
| .remote_access | |
| .apply | |
| .get() | |
| .ok_or("this Host does not support a built-in Maka Server")?; | |
| let (reply, receive) = oneshot::channel(); | |
| apply | |
| .send(RemoteAccessCommand::UpdateBuiltinServer { config, reply }) | |
| .await | |
| .map_err(|_| "remote access transport is stopping")?; | |
| receive | |
| .await | |
| .map_err(|_| "remote access transport stopped before updating built-in server")? | |
| } | |
| pub(super) async fn request_builtin_server_invite( | |
| &self, | |
| request: BuiltinServerInviteRequest, | |
| ) -> Result<BuiltinServerInvite> { | |
| let apply = self | |
| .remote_access | |
| .apply | |
| .get() | |
| .ok_or("this Host does not support a built-in Maka Server")?; | |
| let (reply, receive) = oneshot::channel(); | |
| apply | |
| .send(RemoteAccessCommand::BuiltinServerInvite { request, reply }) | |
| .await | |
| .map_err(|_| "remote access transport is stopping")?; | |
| receive | |
| .await | |
| .map_err(|_| "remote access transport stopped before creating built-in server invite")? | |
| } | |
| pub(super) async fn remote_access_status( | |
| &self, | |
| invite_id: Option<String>, | |
| ) -> Result<RemoteAccessStatus> { | |
| let config = self | |
| .access | |
| .remote_access_config() | |
| .await | |
| .map_err(|error| error.to_string())?; | |
| let connected_relays: Vec<_> = self | |
| .native_relays() | |
| .into_iter() | |
| .map(|relay| relay.url) | |
| .collect(); | |
| let now = now()?; | |
| let invite_state = match invite_id { | |
| Some(invite_id) => { | |
| let grant = self.access_grant.lock().unwrap().clone(); | |
| Some( | |
| self.access | |
| .host_peer_pairing_invite_state(invite_id, grant, now) | |
| .await | |
| .map_err(|error| error.to_string())?, | |
| ) | |
| } | |
| None => None, | |
| }; | |
| let state = self.remote_access.state.lock().unwrap(); | |
| let (status, error) = match &state.phase { | |
| TransportPhase::Disabled => (ConnectionStatus::Disabled, None), | |
| TransportPhase::Starting if !connected_relays.is_empty() => { | |
| (ConnectionStatus::Connected, None) | |
| } | |
| TransportPhase::Starting => (ConnectionStatus::Starting, None), | |
| TransportPhase::Failed(error) => (ConnectionStatus::Error, Some(error.clone())), | |
| }; | |
| Ok(RemoteAccessStatus { | |
| config, | |
| status, | |
| peer_id: self.device_identity().public_key().to_string(), | |
| connected_relays, | |
| invite_state, | |
| sas: state | |
| .sas | |
| .as_ref() | |
| .filter(|notice| now.saturating_sub(notice.at) < 120_000) | |
| .cloned(), | |
| error, | |
| cli_override: state.cli_override, | |
| external_server: state.external_server.clone(), | |
| }) | |
| } | |
| } | |
| #[cfg(test)] | |
| mod tests { | |
| use super::*; | |
| #[test] | |
| fn clearing_a_peer_fences_queued_sas_without_clearing_another_peer() { | |
| let mut state = RuntimeState::default(); | |
| let notice = |peer_id: &str| SasNotice { | |
| peer_id: peer_id.into(), | |
| sas: "123456".into(), | |
| at: 1, | |
| }; | |
| let old_generation = state.sas_generation; | |
| state.publish_sas(old_generation, notice("other")); | |
| let peer = PeerId::new("phone".into()).unwrap(); | |
| state.clear_peer_sas(&peer); | |
| state.publish_sas(old_generation, notice("phone")); | |
| assert_eq!(state.sas.as_ref().unwrap().peer_id, "other"); | |
| let generation = state.sas_generation; | |
| state.publish_sas(generation, notice("phone")); | |
| state.clear_peer_sas(&peer); | |
| state.publish_sas(generation, notice("phone")); | |
| assert!(state.sas.is_none()); | |
| } | |
| } |