Skip to content

Commit

Permalink
Extract extensions into crates
Browse files Browse the repository at this point in the history
Previously, this repository contained one crate with all extension
definitions and the backend implementation.  This is problematic if
semantic versioning is used as a breaking change in the backend or in a
single extension would also affect all users of any other extension.

This patch moves the extensions into separate crates that can be
versioned independently so that clients only have to depend on the
extension crates they really need.

Fixes: #3
  • Loading branch information
robin-nitrokey committed Mar 15, 2024
1 parent 1240154 commit 06bf42c
Show file tree
Hide file tree
Showing 19 changed files with 828 additions and 717 deletions.
45 changes: 34 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,53 @@
# Copyright (C) Nitrokey GmbH
# SPDX-License-Identifier: CC0-1.0

[package]
name = "trussed-staging"
version = "0.1.0"
[workspace]
members = ["extensions/chunked", "extensions/manage", "extensions/wrap-key-to-file"]

[workspace.package]
authors = ["Nitrokey GmbH <[email protected]>"]
edition = "2021"
repository = "https://github.com/trussed-dev/trussed-staging"
license = "Apache-2.0 OR MIT"

[workspace.dependencies]
serde = { version = "1.0.160", default-features = false, features = ["derive"] }
serde-byte-array = "0.1.2"
trussed = { version = "0.1.0", features = ["serde-extensions"] }

[package]
name = "trussed-staging"
version = "0.1.0"
description = "Work in progress trussed features"
authors.workspace = true
edition.workspace = true
repository.workspace = true
license.workspace = true

[dependencies]
trussed = { version = "0.1.0", features = ["serde-extensions"] }
serde.workspace = true
serde-byte-array.workspace = true
trussed.workspace = true

chacha20poly1305 = { version = "0.10", default-features = false, features = ["heapless", "reduced-round"], optional = true }
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"

trussed-chunked = { version = "0.1.0", optional = true }
trussed-manage = { version = "0.1.0", optional = true }
trussed-wrap-key-to-file = { version = "0.1.0", optional = true }

[dev-dependencies]
trussed = { version = "0.1.0", default-features = false, features = ["serde-extensions", "virt"] }
trussed = { workspace = true, features = ["virt"] }

[features]
default = ["manage"]

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

virt = ["std", "trussed/virt"]
std = []
Expand All @@ -44,3 +63,7 @@ log-error = []
[patch.crates-io]
trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "45ed62ba97d994aa6e05e2b61cea013ef131caa4" }
littlefs2 = { git = "https://github.com/trussed-dev/littlefs2.git", rev = "ebd27e49ca321089d01d8c9b169c4aeb58ceeeca" }

trussed-chunked = { path = "extensions/chunked" }
trussed-manage = { path = "extensions/manage" }
trussed-wrap-key-to-file = { path = "extensions/wrap-key-to-file" }
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@

.PHONY: check
check:
RUSTLFAGS='-Dwarnings' cargo check --all-features --all-targets
RUSTLFAGS='-Dwarnings' cargo check --all-features --all-targets --workspace
RUSTLFAGS='-Dwarnings' cargo check --no-default-features
RUSTLFAGS='-Dwarnings' cargo check --features encrypted-chunked
RUSTLFAGS='-Dwarnings' cargo check --features manage
RUSTLFAGS='-Dwarnings' cargo check --features wrap-key-to-file

.PHONY: lint
lint:
cargo clippy --all-features --all-targets -- --deny warnings
cargo fmt -- --check
RUSTDOCFLAGS='-Dwarnings' cargo doc --no-deps --all-features
cargo clippy --all-features --all-targets --workspace -- --deny warnings
cargo fmt --all -- --check
RUSTDOCFLAGS='-Dwarnings' cargo doc --no-deps --all-features --workspace
reuse lint

.PHONY: test
test:
cargo test --all-features
cargo test --all-features --workspace

.PHONY: ci
ci: check lint test
18 changes: 18 additions & 0 deletions extensions/chunked/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (C) Nitrokey GmbH
# SPDX-License-Identifier: CC0-1.0

[package]
name = "trussed-chunked"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
repository.workspace = true
license.workspace = true

[dependencies]
serde.workspace = true
serde-byte-array.workspace = true
trussed.workspace = true

[features]
encrypted-chunked = []
Loading

0 comments on commit 06bf42c

Please sign in to comment.