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 authored and robin-nitrokey committed Oct 17, 2024
1 parent 4f5a858 commit 2c4be6a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ 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", tag = "v0.1.0-nitrokey.15" }
fido-authenticator = { git = "https://github.com/Nitrokey/fido-authenticator.git", tag = "v0.1.1-nitrokey.20" }
trussed = { git = "https://github.com/nitrokey/trussed.git", tag = "v0.1.0-nitrokey.21" }

# unreleased upstream changes
apdu-dispatch = { git = "https://github.com/Nitrokey/apdu-dispatch.git", tag = "v0.1.2-nitrokey.3" }
cbor-smol = { git = "https://github.com/trussed-dev/cbor-smol.git", rev = "4a368461e06e3ca52d79638b9ab8f34b038491fc" }
ctaphid-dispatch = { git = "https://github.com/Nitrokey/ctaphid-dispatch.git", tag = "v0.1.1-nitrokey.3" }
littlefs2 = { git = "https://github.com/trussed-dev/littlefs2.git", rev = "960e57d9fc0d209308c8e15dc26252bbe1ff6ba8" }
littlefs2-sys = { git = "https://github.com/trussed-dev/littlefs2-sys.git", rev = "39626c0dbc2f6c38b74889a5bf9d5a200614f121" }
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 2c4be6a

Please sign in to comment.