Skip to content

Commit

Permalink
Add support for listing configs
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Oct 9, 2024
1 parent 1c1edf4 commit f54745e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
11 changes: 8 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ version = "1.7.2"
memory-regions = { path = "components/memory-regions" }

# forked
admin-app = { git = "https://github.com/Nitrokey/admin-app.git", tag = "v0.1.0-nitrokey.13" }
admin-app = { git = "https://github.com/Nitrokey/admin-app.git", rev = "2bcefb3dda021a7e815016bf4f0719a84af13d3f" }
cbor-smol = { git = "https://github.com/Nitrokey/cbor-smol.git", tag = "v0.4.0-nitrokey.5" }
fido-authenticator = { git = "https://github.com/Nitrokey/fido-authenticator.git", tag = "v0.1.1-nitrokey.20" }
lpc55-hal = { git = "https://github.com/Nitrokey/lpc55-hal", tag = "v0.3.0-nitrokey.2" }
trussed = { git = "https://github.com/nitrokey/trussed.git", tag = "v0.1.0-nitrokey.21" }

# unreleased upstream changes
Expand Down
1 change: 1 addition & 0 deletions components/apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ bitflags = "2"
ctaphid-dispatch = "0.1"
embedded-hal = "0.2.7"
heapless = "0.7"
heapless-bytes = "0.3"
se05x = { version = "0.1.1", optional = true}
serde = { version = "1.0.180", default-features = false }
trussed = { version = "0.1", features = ["serde-extensions"] }
Expand Down
25 changes: 23 additions & 2 deletions components/apps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use littlefs2::path;

#[cfg(feature = "factory-reset")]
use admin_app::ResetConfigResult;
use admin_app::{ConfigField, FieldType};

#[macro_use]
extern crate delog;
Expand Down Expand Up @@ -82,6 +83,26 @@ impl admin_app::Config for Config {
}
}

fn list_available_fields(&self) -> &'static [ConfigField] {
&[
ConfigField {
name: "fido.disable_skip_up_timeout",
requires_touch_confirmation: false,
requires_reboot: false,
destructive: false,
ty: FieldType::Bool,
},
#[cfg(feature = "se050")]
ConfigField {
name: "opcard.use_se050_backend",
requires_touch_confirmation: true,
requires_reboot: true,
destructive: true,
ty: FieldType::Bool,
},
]
}

fn reset_client_id(
&self,
key: &str,
Expand Down Expand Up @@ -1104,7 +1125,7 @@ impl<R: Runner> App<R> for ProvisionerApp<R> {
#[cfg(test)]
mod tests {
use super::{Config, FidoConfig, OpcardConfig};
use cbor_smol::{cbor_serialize_bytes, Bytes};
use cbor_smol::cbor_serialize_bytes;

#[test]
fn test_config_size() {
Expand All @@ -1118,7 +1139,7 @@ mod tests {
},
fs_version: 1,
};
let data: Bytes<1024> = cbor_serialize_bytes(&config).unwrap();
let data: heapless_bytes::Bytes<1024> = cbor_serialize_bytes(&config).unwrap();
// littlefs2 is most efficient with files < 1/4 of the block size. The block sizes are 512
// bytes for LPC55 and 256 bytes for NRF52. As the block count is only problematic on the
// LPC55, this could be increased to 128 if necessary.
Expand Down

0 comments on commit f54745e

Please sign in to comment.