Skip to content

feat: split cose and jwt into independent default-on features#57

Merged
thomas-fossati merged 3 commits into
veraison:mainfrom
inclavare-containers:feature-guard
Jul 14, 2026
Merged

feat: split cose and jwt into independent default-on features#57
thomas-fossati merged 3 commits into
veraison:mainfrom
inclavare-containers:feature-guard

Conversation

@imlk0

@imlk0 imlk0 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Re-open #56

@Xynnn007 Xynnn007 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks and LGTM again @imlk0 :P

@thomas-fossati thomas-fossati left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Again) thanks very much @imlk0, LGTM!

Here are a few non-blocking comments in case you want to take a look now or in the future:

  1. It would be nice if the CI checked the individual features alongside the default. I believe this can be done with a matrix job.
  2. The docs.rs metadata could be adjusted to reflect the feature split.
  3. AFAICS, "hex" is only used in "ear/cose.rs" and could be made optional.
  4. (Purely cosmetic): There is a redundant "Signed-off-by" in the commit.

imlk0 added 2 commits July 14, 2026 17:36
Make cose-rust, openssl, and jsonwebtoken optional behind two
independent default-on features:

  cose = [dep:cose-rust, dep:openssl, dep:jsonwebtoken]
  jwt  = [dep:jsonwebtoken]

cose no longer implies the jwt feature -- it depends on the
jsonwebtoken *crate* (used by from_cose_jwk to parse JWK keys), not the
jwt feature's API surface. This lets JWT-only builds drop cose+openssl
and COSE-only builds drop the jwt feature's code, with the two features
genuinely orthogonal.

The jsonwebtoken import in ear.rs is now gated on any(cose, jwt) so the
shared JWK types are available to the cose path without forcing the jwt
feature on. JWT-only doctests are wrapped in cfg(feature = "jwt")
blocks so the feature matrix (cose-only / jwt-only / default) all pass
cargo test cleanly.

Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
Assisted-by: Claude <noreply@anthropic.com>
Run build+test across default, cose-only, jwt-only, no-default-features,
and all-features so the cose/jwt feature split is exercised on every
change. fmt and clippy move to a dedicated lint job (default features)
to avoid running them once per matrix entry.

Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
Assisted-by: Claude <noreply@anthropic.com>
Comment thread Cargo.toml Outdated
Add [package.metadata.docs.rs] listing the cose and jwt features
explicitly, so the gated API surfaces get documented on docs.rs (which
otherwise builds with default features only). Listing features
explicitly rather than all-features = true keeps docs.rs stable if
experimental or mutually exclusive features are added later.

Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
Assisted-by: Claude <noreply@anthropic.com>
@imlk0

imlk0 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

hi @thomas-fossati, thanks for the quick response! I've pushed the updates, and CI looks good.

@thomas-fossati
thomas-fossati merged commit c3a1073 into veraison:main Jul 14, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants