Skip to content

Commit

Permalink
add encrypted array option for API
Browse files Browse the repository at this point in the history
  • Loading branch information
DougAnderson444 committed Jun 27, 2024
1 parent 23ea99b commit 7c2eba0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion crates/seed-keeper-wit-ui/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>
encrypted
Expand All @@ -59,6 +59,15 @@ impl From<&wurbo_types::Content> for Input {
.collect::<Vec<u8>>(),
)
}
// 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::<u8>().unwrap_or_default())
.collect::<Vec<u8>>();
Some(encrypted)
}
_ => None,
}
}
Expand Down

0 comments on commit 7c2eba0

Please sign in to comment.