Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add streaming API #2

Merged
merged 5 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ chacha20poly1305 = { version = "0.10", default-features = false, features = ["he
serde = { version = "1.0.160", default-features = false, features = ["derive"] }
rand_core = { version = "0.6.4", default-features = false }
delog = "0.1.6"
littlefs2 = "0.4.0"
serde-byte-array = "0.1.2"

[dev-dependencies]
trussed = { version = "0.1.0", default-features = false, features = ["serde-extensions", "virt"] }
Expand All @@ -24,6 +26,8 @@ trussed = { version = "0.1.0", default-features = false, features = ["serde-exte
default = []

wrap-key-to-file = ["chacha20poly1305"]
chunked = []
encrypted-chunked = ["chunked", "chacha20poly1305/stream"]

virt = ["std", "trussed/virt"]
std = []
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ check:
lint:
cargo clippy --all-features --all-targets -- --deny warnings
cargo fmt -- --check
RUSTDOCFLAGS='-Dwarnings' cargo doc --no-deps
RUSTDOCFLAGS='-Dwarnings' cargo doc --no-deps --all-features
reuse lint

.PHONY: test
Expand Down
19 changes: 9 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 or MIT

#![cfg_attr(not(any(test, feature = "std")), no_std)]
#![warn(
missing_debug_implementations,
// missing_docs,
non_ascii_idents,
trivial_casts,
unused,
unused_qualifications
)]
#![warn(non_ascii_idents, trivial_casts, unused, unused_qualifications)]
#![deny(unsafe_code)]

delog::generate_macros!();
Expand All @@ -22,6 +15,9 @@ pub mod virt;
#[cfg(feature = "wrap-key-to-file")]
pub mod wrap_key_to_file;

#[cfg(feature = "chunked")]
pub mod streaming;

#[derive(Clone, Debug, Default)]
#[non_exhaustive]
pub struct StagingBackend {}
Expand All @@ -32,9 +28,12 @@ impl StagingBackend {
}
}

#[derive(Default, Debug)]
#[derive(Default)]
#[non_exhaustive]
pub struct StagingContext {}
pub struct StagingContext {
#[cfg(feature = "chunked")]
chunked_io_state: Option<streaming::ChunkedIoState>,
}

impl Backend for StagingBackend {
type Context = StagingContext;
Expand Down
Loading