From 7c2eba0c806f5881153f937270e95dbc97d88244 Mon Sep 17 00:00:00 2001 From: Doug Anderson444 Date: Thu, 27 Jun 2024 14:50:01 -0300 Subject: [PATCH] add encrypted array option for API --- crates/seed-keeper-wit-ui/src/input.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/seed-keeper-wit-ui/src/input.rs b/crates/seed-keeper-wit-ui/src/input.rs index b72ec0e..04377fa 100644 --- a/crates/seed-keeper-wit-ui/src/input.rs +++ b/crates/seed-keeper-wit-ui/src/input.rs @@ -50,7 +50,7 @@ impl From<&wurbo_types::Content> for Input { match &v["encrypted"] { serde_json::Value::Array(encrypted) => { - println!("encrypted: {:?}", encrypted); + println!("encrypted array: {:?}", encrypted); Some( // encrypted into Vec encrypted @@ -59,6 +59,15 @@ impl From<&wurbo_types::Content> for Input { .collect::>(), ) } + // or it could be astring of numbers, likw 1,2,3,4,5... + serde_json::Value::String(encrypted) => { + println!("encrypted string: {:?}", encrypted); + let encrypted = encrypted + .split(',') + .map(|v| v.parse::().unwrap_or_default()) + .collect::>(); + Some(encrypted) + } _ => None, } }