Skip to main content

hatchery_node/
m4a_accounts.rs

1//! Per-session m4a accounts assigned by the node at spawn (owner model: session = nick = one key
2//! = one role). When `HATCHERY_M4A_AGENT_BIN` and `HATCHERY_M4A_ACCOUNTS_ROOT` are set, every PTY
3//! spawn gets its own account: the node runs `m4a-agent account provision` (registry and vaults
4//! stay under the node's accounts root, outside the session sandbox), reads the fresh capability
5//! from a one-shot 0600 file it removes at once, and injects ONLY `M4A_NICK` and
6//! `M4A_SESSION_CAP` into that session's child environment. The capability is never logged.
7
8use std::ffi::OsString;
9use std::path::{Path, PathBuf};
10use std::process::Command;
11
12use gate4agent_catalog::EnvMutation;
13
14/// g4a provider id -> the provider name `m4a-agent` accepts. g4a's built-in catalog is
15/// `claude`, `codex`, `grok`, `kimi`; anything else (custom agents) gets no account.
16pub fn m4a_provider(g4a_agent_id: &str) -> Option<&'static str> {
17    match g4a_agent_id {
18        "claude" => Some("claude-code"),
19        "codex" => Some("codex"),
20        "grok" => Some("grok"),
21        "kimi" => Some("kimi-code"),
22        _ => None,
23    }
24}
25
26pub const AGENT_BIN_ENV: &str = "HATCHERY_M4A_AGENT_BIN";
27/// Messenger product base URL; with it (and an enrolled node) the node registers its sessions'
28/// accounts on the messenger itself, signed with the node key.
29pub const PRODUCT_URL_ENV: &str = "HATCHERY_M4A_PRODUCT_URL";
30/// The product's audience name the node signs for (default `m4a-product`).
31pub const PRODUCT_AUDIENCE_ENV: &str = "HATCHERY_M4A_PRODUCT_AUDIENCE";
32
33static NODE_SIGNER: std::sync::OnceLock<(String, std::sync::Arc<hatchery_enroll::NodeIdentity>)> = std::sync::OnceLock::new();
34
35/// Installs this node's identity (enrolled, trusted) as the signer of account registrations.
36/// An unenrolled node never has one, so it registers nothing.
37pub fn set_node_signer(node_id: String, identity: std::sync::Arc<hatchery_enroll::NodeIdentity>) {
38    let _ = NODE_SIGNER.set((node_id, identity));
39}
40
41/// Exact bytes the messenger product verifies (`m4a-node-account-v1`).
42pub fn node_account_message(audience: &str, node_id: &str, nick: Option<&str>, ts_ms: i64, nonce: &str) -> Vec<u8> {
43    format!("m4a-node-account-v1\n{audience}\n{node_id}\n{}\n{ts_ms}\n{nonce}\n", nick.unwrap_or("")).into_bytes()
44}
45pub const ACCOUNTS_ROOT_ENV: &str = "HATCHERY_M4A_ACCOUNTS_ROOT";
46
47#[derive(Debug, Clone)]
48pub struct M4aSessionAccounts {
49    bin: PathBuf,
50    base: PathBuf,
51}
52
53/// One session's account as handed to its child: nick and capability only.
54pub struct SessionAccount {
55    pub nick: String,
56    /// The provider session key the account is bound to (also given to the session as
57    /// `M4A_SESSION_ID`, so its own inbox commands address the right account).
58    pub session_id: String,
59    /// The account's own store root (`M4A_STORE_ROOT`), when m4a-agent reported it.
60    pub store_root: Option<String>,
61    /// Messenger product URL the session's client uses (`M4A_PRODUCT_URL`), from the node env.
62    pub product_url: Option<String>,
63    cap: String,
64}
65
66impl Drop for SessionAccount {
67    fn drop(&mut self) {
68        // Best effort wipe of the capability copy held by the node.
69        let bytes = unsafe { self.cap.as_bytes_mut() };
70        bytes.iter_mut().for_each(|b| *b = 0);
71    }
72}
73
74impl std::fmt::Debug for SessionAccount {
75    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
76        f.debug_struct("SessionAccount").field("nick", &self.nick).finish_non_exhaustive()
77    }
78}
79
80impl SessionAccount {
81    /// The only variables the session gets from the node for m4a.
82    /// The one-time `/m4a/attach` reply (the capability travels only in this body).
83    pub fn attach_reply(&self) -> serde_json::Value {
84        serde_json::json!({"nick": self.nick, "session_id": self.session_id, "cap": self.cap, "store_root": self.store_root, "product_url": self.product_url})
85    }
86
87    pub fn env_mutations(&self) -> Vec<EnvMutation> {
88        vec![
89            EnvMutation { key: OsString::from("M4A_NICK"), value: Some(OsString::from(&self.nick)) },
90            EnvMutation { key: OsString::from("M4A_SESSION_CAP"), value: Some(OsString::from(&self.cap)) },
91            EnvMutation { key: OsString::from("M4A_SESSION_ID"), value: Some(OsString::from(&self.session_id)) },
92            EnvMutation { key: OsString::from("M4A_BOT_NAME"), value: Some(OsString::from(&self.nick)) },
93        ]
94        .into_iter()
95        .chain(self.store_root.iter().map(|r| EnvMutation { key: OsString::from("M4A_STORE_ROOT"), value: Some(OsString::from(r)) }))
96        .chain(self.product_url.iter().map(|u| EnvMutation { key: OsString::from("M4A_PRODUCT_URL"), value: Some(OsString::from(u)) }))
97        .collect()
98    }
99}
100
101impl M4aSessionAccounts {
102    /// Fallback identity channel: `<root>/sessions/<nick>.session` (owner-only), the same three
103    /// keys as [`SessionAccount::env_mutations`], for a provider whose tools run in a process
104    /// that did not inherit the session environment (`m4a-agent --session-file <path> ...`).
105    pub fn session_file_path(&self, nick: &str) -> Option<PathBuf> {
106        let ok = !nick.is_empty() && nick.bytes().all(|b| b.is_ascii_alphanumeric() || b == b'-' || b == b'_');
107        ok.then(|| self.base.join("sessions").join(format!("{nick}.session")))
108    }
109
110    pub fn write_session_file(&self, account: &SessionAccount) -> Result<PathBuf, String> {
111        let path = self.session_file_path(&account.nick).ok_or("invalid nick")?;
112        let dir = path.parent().ok_or("no dir")?;
113        std::fs::create_dir_all(dir).map_err(|e| format!("sessions dir: {}", e.kind()))?;
114        let mut body = String::new();
115        for m in account.env_mutations() {
116            if let Some(v) = m.value {
117                body.push_str(&format!("{}={}\n", m.key.to_string_lossy(), v.to_string_lossy()));
118            }
119        }
120        let mut opts = std::fs::OpenOptions::new();
121        opts.write(true).create(true).truncate(true);
122        #[cfg(unix)]
123        {
124            use std::os::unix::fs::OpenOptionsExt;
125            opts.mode(0o600);
126        }
127        use std::io::Write;
128        opts.open(&path)
129            .and_then(|mut f| f.write_all(body.as_bytes()))
130            .map_err(|e| format!("session file: {}", e.kind()))?;
131        body.zeroize_best_effort();
132        Ok(path)
133    }
134
135    /// Provider flags that give one spawned session its own m4a MCP server (`m4a-agent
136    /// --session-file <file> mcp`), without touching any user config. Empty for providers with
137    /// no verified per-session MCP flag (grok TUI, kimi PTY): those use attach (`/m4a/attach`).
138    pub fn mcp_launch_args(&self, g4a_provider: &str, nick: &str) -> Result<Vec<OsString>, String> {
139        let session_file = self.session_file_path(nick).ok_or("invalid nick")?;
140        let bin = self.bin.to_string_lossy().into_owned();
141        let sf = session_file.to_string_lossy().into_owned();
142        let provider = g4a_provider.to_owned();
143        match g4a_provider {
144            "claude" => {
145                let config = serde_json::json!({"mcpServers": {"m4a": {
146                    "type": "stdio",
147                    "command": bin,
148                    "args": ["--session-file", sf, "mcp", "--provider", provider],
149                }}});
150                let path = self.base.join("sessions").join(format!("{nick}.mcp.json"));
151                std::fs::create_dir_all(self.base.join("sessions")).map_err(|e| format!("sessions dir: {}", e.kind()))?;
152                std::fs::write(&path, config.to_string()).map_err(|e| format!("mcp config: {}", e.kind()))?;
153                Ok(vec![OsString::from("--mcp-config"), path.into_os_string()])
154            }
155            "codex" => {
156                // TOML literal strings: no escapes, no double quotes. On Windows codex runs through
157                // a `cmd /C <codex.cmd>` wrapper: an argument with whitespace gets quoted, and more
158                // than two quotes make cmd strip the wrapper's own quotes (spawn fails). So the
159                // values must be whitespace-free; a binary in a spaced directory is named by its
160                // file name (found on PATH), otherwise the session falls back to attach.
161                let bin = codex_safe_command(&self.bin).ok_or("m4a-agent path has whitespace and is not on PATH")?;
162                if !codex_safe_value(&sf) {
163                    return Err("session file path is not safe for codex -c".into());
164                }
165                Ok(vec![
166                    OsString::from("-c"),
167                    OsString::from(format!("mcp_servers.m4a.command='{bin}'")),
168                    OsString::from("-c"),
169                    OsString::from(format!("mcp_servers.m4a.args=['--session-file','{sf}','mcp','--provider','codex']")),
170                ])
171            }
172            _ => Ok(Vec::new()),
173        }
174    }
175
176    /// Registers the account on the messenger with this node's key, then the account's own client
177    /// enrolls its own key (`m4a-agent account node-enroll`). The invite never reaches the node.
178    fn node_enroll(&self, account: &SessionAccount) -> Result<(), String> {
179        let url = account.product_url.as_deref().ok_or("no messenger product url (HATCHERY_M4A_PRODUCT_URL)")?;
180        let store_root = account.store_root.as_deref().ok_or("m4a-agent reported no store root")?;
181        let (node_id, identity) = NODE_SIGNER.get().ok_or("this node is not enrolled: it registers no accounts")?;
182        let audience = std::env::var(PRODUCT_AUDIENCE_ENV).ok().filter(|a| !a.is_empty()).unwrap_or_else(|| "m4a-product".into());
183        let ts_ms = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_millis() as i64).unwrap_or(0);
184        let mut raw = [0u8; 16];
185        getrandom(&mut raw)?;
186        let nonce: String = raw.iter().map(|b| format!("{b:02x}")).collect();
187        let signature = identity.sign_bytes(&node_account_message(&audience, node_id, Some(&account.nick), ts_ms, &nonce));
188        let out = Command::new(&self.bin)
189            .args(["account", "node-enroll", "--node-id", node_id, "--ts", &ts_ms.to_string(), "--nonce", &nonce, "--signature", &signature, "--nick", &account.nick])
190            .env("M4A_PRODUCT_URL", url)
191            .env("M4A_SESSION_ID", &account.session_id)
192            .env("M4A_STORE_ROOT", store_root)
193            .env("M4A_BOT_NAME", &account.nick)
194            .env("M4A_ACCOUNTS_ROOT", &self.base)
195            .env_remove("M4A_SESSION_CAP")
196            .env_remove("M4A_PRODUCT_INVITE")
197            .output()
198            .map_err(|e| format!("m4a-agent: {}", e.kind()))?;
199        if !out.status.success() {
200            let why = String::from_utf8_lossy(&out.stderr).lines().last().unwrap_or("").chars().take(200).collect::<String>();
201            return Err(format!("node-enroll failed: {why}"));
202        }
203        tracing::info!(nick = %account.nick, node_id = %node_id, "m4a account registered on the messenger by this node");
204        Ok(())
205    }
206
207    pub fn remove_session_file(&self, nick: &str) {
208        if let Some(path) = self.session_file_path(nick) {
209            let _ = std::fs::remove_file(path);
210        }
211        let _ = std::fs::remove_file(self.base.join("sessions").join(format!("{nick}.mcp.json")));
212    }
213
214    pub fn new(bin: impl Into<PathBuf>, base: impl Into<PathBuf>) -> Self {
215        Self { bin: bin.into(), base: base.into() }
216    }
217
218    /// The node's letter-wake token (`<root>/.node-wake-token`, 0600), created on first use.
219    pub fn wake_token(&self) -> Result<String, String> {
220        let path = self.base.join(".node-wake-token");
221        if let Ok(t) = std::fs::read_to_string(&path) {
222            if t.trim().len() >= 32 {
223                return Ok(t.trim().to_owned());
224            }
225        }
226        std::fs::create_dir_all(&self.base).map_err(|e| format!("accounts root: {}", e.kind()))?;
227        let mut raw = [0u8; 24];
228        getrandom(&mut raw)?;
229        let token: String = raw.iter().map(|b| format!("{b:02x}")).collect();
230        let mut opts = std::fs::OpenOptions::new();
231        opts.write(true).create(true).truncate(true);
232        #[cfg(unix)]
233        {
234            use std::os::unix::fs::OpenOptionsExt;
235            opts.mode(0o600);
236        }
237        use std::io::Write;
238        opts.open(&path).and_then(|mut f| f.write_all(token.as_bytes())).map_err(|e| format!("wake token: {}", e.kind()))?;
239        Ok(token)
240    }
241
242    pub fn from_env() -> Option<Self> {
243        let get = |k: &str| std::env::var_os(k).filter(|v| !v.is_empty()).map(PathBuf::from);
244        Some(Self::new(get(AGENT_BIN_ENV)?, get(ACCOUNTS_ROOT_ENV)?))
245    }
246
247    pub fn base(&self) -> &Path {
248        &self.base
249    }
250
251    /// The account of `(provider, session_key)`, created if missing, with a fresh capability
252    /// (a respawn of the same session invalidates the previous process's key).
253    pub fn provision(&self, provider: &str, session_key: &str) -> Result<SessionAccount, String> {
254        std::fs::create_dir_all(&self.base).map_err(|e| format!("accounts root: {}", e.kind()))?;
255        let mut rand = [0u8; 12];
256        getrandom(&mut rand)?;
257        let tag: String = rand.iter().map(|b| format!("{b:02x}")).collect();
258        let cap_file = self.base.join(format!(".spawn-{tag}.cap"));
259        let out = Command::new(&self.bin)
260            .args(["account", "provision", "--provider", provider, "--session", session_key, "--rotate", "--cap-out"])
261            .arg(&cap_file)
262            .env("M4A_ACCOUNTS_ROOT", &self.base)
263            .env_remove("M4A_SESSION_CAP")
264            .env_remove("M4A_PRODUCT_INVITE")
265            .output()
266            .map_err(|e| format!("m4a-agent: {}", e.kind()))?;
267        let cap = std::fs::read_to_string(&cap_file);
268        let _ = std::fs::remove_file(&cap_file);
269        if !out.status.success() {
270            return Err(format!("m4a-agent account provision failed ({})", out.status.code().unwrap_or(-1)));
271        }
272        let v: serde_json::Value = serde_json::from_slice(&out.stdout).map_err(|_| "m4a-agent answer is not json".to_string())?;
273        let nick = v["nick"].as_str().ok_or("m4a-agent answer has no nick")?.to_string();
274        let cap = cap.map_err(|_| "no capability issued".to_string())?;
275        if cap.trim().is_empty() || cap.contains('\n') {
276            return Err("capability is malformed".into());
277        }
278        // mail4agent's own session env (`Provisioned::session_env`): the login session id is the
279        // account ref and the account has its own store root.
280        let session_id = v["account_ref"].as_str().filter(|r| !r.is_empty()).unwrap_or(session_key).to_owned();
281        let store_root = v["store_root"].as_str().filter(|r| !r.is_empty()).map(str::to_owned);
282        let product_url = std::env::var(PRODUCT_URL_ENV).ok().filter(|u| !u.is_empty());
283        let account = SessionAccount { nick, session_id, store_root, product_url, cap };
284        if !v["enrolled"].as_bool().unwrap_or(false) {
285            if let Err(error) = self.node_enroll(&account) {
286                tracing::warn!(nick = %account.nick, %error, "m4a account not registered on the messenger (stays local)");
287            }
288        }
289        Ok(account)
290    }
291}
292
293fn getrandom(buf: &mut [u8]) -> Result<(), String> {
294    use std::io::Read;
295    std::fs::File::open("/dev/urandom")
296        .and_then(|mut f| f.read_exact(buf))
297        .or_else(|_| {
298            // Non-unix fallback: time + address entropy is enough for a unique temp name.
299            let t = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_nanos()).unwrap_or(0);
300            for (i, b) in buf.iter_mut().enumerate() {
301                *b = (t >> ((i % 16) * 8)) as u8 ^ (i as u8);
302            }
303            Ok::<(), std::io::Error>(())
304        })
305        .map_err(|e| e.to_string())
306}
307
308#[cfg(all(test, unix))]
309mod tests {
310    use super::*;
311
312    fn fake_agent(dir: &Path) -> PathBuf {
313        // Stands in for m4a-agent: one nick per --session, the cap written to --cap-out.
314        let p = dir.join("fake-m4a-agent");
315        std::fs::write(
316            &p,
317            "#!/bin/sh\nwhile [ $# -gt 0 ]; do case \"$1\" in --session) s=$2; shift;; --cap-out) o=$2; shift;; esac; shift; done\n\
318             umask 077; printf 'cap-%s-%s' \"$s\" \"$$\" > \"$o\"; printf '{\"nick\":\"codex-%s\",\"account_ref\":\"ref-%s\",\"store_root\":\"/s/%s\",\"enrolled\":true,\"cap_issued\":true}\\n' \"$s\" \"$s\" \"$s\"\n",
319        )
320        .unwrap();
321        use std::os::unix::fs::PermissionsExt;
322        std::fs::set_permissions(&p, std::fs::Permissions::from_mode(0o755)).unwrap();
323        p
324    }
325
326    #[test]
327    fn each_spawn_gets_its_own_account_and_its_own_session_env() {
328        let dir = std::env::temp_dir().join(format!("hatch-m4a-{}", std::process::id()));
329        let _ = std::fs::remove_dir_all(&dir);
330        std::fs::create_dir_all(&dir).unwrap();
331        let acc = M4aSessionAccounts::new(fake_agent(&dir), dir.join("accounts"));
332        let a = acc.provision("codex", "inc-1").unwrap();
333        let b = acc.provision("codex", "inc-2").unwrap();
334        assert_ne!(a.nick, b.nick);
335        let env = a.env_mutations();
336        let keys: Vec<_> = env.iter().map(|m| m.key.to_string_lossy().into_owned()).collect();
337        assert_eq!(&keys[..5], ["M4A_NICK", "M4A_SESSION_CAP", "M4A_SESSION_ID", "M4A_BOT_NAME", "M4A_STORE_ROOT"]);
338        assert_eq!(env[2].value.as_deref(), Some(std::ffi::OsStr::new("ref-inc-1")));
339        assert_eq!(env[4].value.as_deref(), Some(std::ffi::OsStr::new("/s/inc-1")));
340        assert_ne!(env[1].value, b.env_mutations()[1].value);
341        // The one-shot cap file is gone and the cap is not in Debug output.
342        let left: Vec<_> = std::fs::read_dir(acc.base()).unwrap().filter_map(Result::ok).filter(|e| e.file_name().to_string_lossy().ends_with(".cap")).collect();
343        assert!(left.is_empty());
344        assert!(!format!("{a:?}").contains("cap-"));
345    }
346
347    #[test]
348    fn every_builtin_g4a_provider_maps_to_an_m4a_provider() {
349        for spec in gate4agent_catalog::builtin_specs() {
350            let id = spec.id.as_str().to_string();
351            assert!(m4a_provider(&id).is_some(), "g4a provider {id} has no m4a mapping");
352        }
353        assert_eq!(m4a_provider("custom"), None);
354    }
355
356    #[cfg(unix)]
357    #[test]
358    fn wake_token_is_private_stable_and_long() {
359        use std::os::unix::fs::PermissionsExt;
360        let dir = std::env::temp_dir().join(format!("node-wake-token-{}", std::process::id()));
361        let a = M4aSessionAccounts::new("/bin/false", &dir);
362        let t1 = a.wake_token().unwrap();
363        assert_eq!(t1.len(), 48);
364        assert_eq!(a.wake_token().unwrap(), t1);
365        let mode = std::fs::metadata(dir.join(".node-wake-token")).unwrap().permissions().mode() & 0o777;
366        assert_eq!(mode, 0o600);
367        let _ = std::fs::remove_dir_all(&dir);
368    }
369
370    #[test]
371    fn a_failing_agent_injects_nothing() {
372        let acc = M4aSessionAccounts::new("/nonexistent/m4a-agent", std::env::temp_dir().join("hatch-m4a-none"));
373        assert!(acc.provision("codex", "x").is_err());
374    }
375}
376
377fn codex_safe_value(v: &str) -> bool {
378    !v.is_empty() && !v.chars().any(|c| c.is_whitespace() || matches!(c, '\'' | '"' | '%' | '!' | '^' | '&' | '|' | '<' | '>' | '(' | ')'))
379}
380
381/// The `command` value for codex: the full path when it is safe, else the bare file name when
382/// the PATH lookup resolves to this same binary.
383fn codex_safe_command(bin: &Path) -> Option<String> {
384    let full = bin.to_string_lossy().into_owned();
385    if codex_safe_value(&full) {
386        return Some(full);
387    }
388    let name = bin.file_name()?.to_string_lossy().into_owned();
389    if !codex_safe_value(&name) {
390        return None;
391    }
392    let path = std::env::var_os("PATH")?;
393    let dir = bin.parent()?;
394    std::env::split_paths(&path)
395        .any(|p| p == dir)
396        .then(|| name.strip_suffix(".exe").map(str::to_owned).unwrap_or(name))
397}
398
399trait ZeroizeBestEffort {
400    fn zeroize_best_effort(&mut self);
401}
402
403impl ZeroizeBestEffort for String {
404    fn zeroize_best_effort(&mut self) {
405        // SAFETY: zero bytes keep the buffer valid UTF-8.
406        unsafe { self.as_bytes_mut() }.iter_mut().for_each(|b| *b = 0);
407    }
408}
409
410#[cfg(test)]
411mod session_file_tests {
412    use super::*;
413
414    #[test]
415    fn mcp_args_are_session_scoped_and_carry_no_capability() {
416        let root = std::env::temp_dir().join(format!("m4a-mcp-args-{}", std::process::id()));
417        let a = M4aSessionAccounts::new("m4a-agent", &root);
418        let c = a.mcp_launch_args("claude", "claude-1").unwrap();
419        assert_eq!(c[0], OsString::from("--mcp-config"));
420        let cfg = std::fs::read_to_string(&c[1]).unwrap();
421        assert!(cfg.contains("--session-file") && cfg.contains("claude-1.session"));
422        let x = a.mcp_launch_args("codex", "codex-1").unwrap();
423        assert_eq!(x.len(), 4);
424        assert!(x.iter().all(|v| !v.to_string_lossy().contains('"')));
425        assert!(a.mcp_launch_args("grok", "grok-1").unwrap().is_empty());
426        a.remove_session_file("claude-1");
427        assert!(!std::path::Path::new(&c[1]).exists());
428        let _ = std::fs::remove_dir_all(root);
429    }
430
431    #[test]
432    fn codex_values_never_carry_whitespace_or_quotes() {
433        assert!(codex_safe_value("/opt/m4a/bin/m4a-agent"));
434        assert!(!codex_safe_value("/home/a b/m4a-agent"));
435        assert!(!codex_safe_value("x'y"));
436        assert_eq!(codex_safe_command(Path::new("/opt/m4a/m4a-agent")).as_deref(), Some("/opt/m4a/m4a-agent"));
437        assert_eq!(codex_safe_command(Path::new("/no such dir/m4a-agent")), None);
438    }
439
440    #[test]
441    fn session_file_path_refuses_path_like_nicks() {
442        let a = M4aSessionAccounts::new("bin", std::env::temp_dir().join("m4a-sf-test"));
443        assert!(a.session_file_path("grok-1").unwrap().ends_with("sessions/grok-1.session"));
444        assert!(a.session_file_path("../x").is_none());
445        assert!(a.session_file_path("").is_none());
446    }
447}
448
449#[cfg(test)]
450mod node_account_message_tests {
451    #[test]
452    fn signed_bytes_follow_the_product_contract() {
453        let m = super::node_account_message("aud", "node-1", Some("nick-a"), 7, "n0");
454        assert_eq!(m, b"m4a-node-account-v1\naud\nnode-1\nnick-a\n7\nn0\n".to_vec());
455        assert_eq!(super::node_account_message("aud", "node-1", None, 7, "n0"), b"m4a-node-account-v1\naud\nnode-1\n\n7\nn0\n".to_vec());
456    }
457}