Skip to content

v0.0.5 #15

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

Merged
merged 1 commit into from
Dec 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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sd-jwt-rs"
version = "0.0.4"
version = "0.0.5"
edition = "2021"
license = "Apache-2.0 OR MIT"
description = "Rust reference implementation of the IETF SD-JWT specification (v6)."
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cargo test
```

### Interoperability testing tool
Coming soon (planned for v0.0.5)
Coming soon (planned for v0.0.6)

## External Dependencies

Expand Down
31 changes: 12 additions & 19 deletions src/issuer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,24 @@ pub struct SDJWTIssuer {
pub serialized_sd_jwt: String,
}

/// SDJWTClaimsStrategy is used to determine which claims can be selectively disclosed later by the holder.
pub enum SDJWTClaimsStrategy<'a> {
// Full disclosure
/// No claims can be selectively disclosed. Full disclosure.
No,
// Top-level selective disclosure, nested objects as full disclosure
/// Top-level claims can be selectively disclosed, nested objects are fully disclosed.
Flat,
// Full recursive selective disclosure
/// All claims can be selectively disclosed (recursively including nested objects).
Full,
//TODO gather JSONPaths to point the claims to be SD
/// Claims can be selectively disclosed based on the provided JSONPaths. Other claims are fully disclosed.
/// # Examples
/// ```
/// use sd_jwt_rs::issuer::SDJWTClaimsStrategy;
///
/// let strategy = SDJWTClaimsStrategy::Partial(vec!["$.address", "$.address.street_address"]);
/// ```
Partial(Vec<&'a str>),
}

/// SDJWTClaimsStrategy is used to determine which claims can be selectively disclosed later by the holder.
///
/// The following strategies are supported:
/// * No: No claims can be selectively disclosed.
/// * Flat: Top-level claims can be selectively disclosed, nested objects are fully disclosed.
/// * Full: All claims can be selectively disclosed.
/// * Partial: Claims can be selectively disclosed based on the provided JSONPaths.
///
/// # Examples
/// ```
/// use sd_jwt_rs::issuer::SDJWTClaimsStrategy;
///
/// let strategy = SDJWTClaimsStrategy::Partial(vec!["$.address", "$.address.street_address"]);
/// ```
impl<'a> SDJWTClaimsStrategy<'a> {
fn finalize_input(&mut self) -> Result<()> {
match self {
Expand Down Expand Up @@ -156,7 +149,7 @@ impl SDJWTIssuer {
///
/// # Arguments
/// * `user_claims` - The claims to be included in the SD-JWT.
/// * `sd_strategy` - The strategy to be used to determine which claims to be selectively disclosed. See SDJWTClaimsStrategy for more details.
/// * `sd_strategy` - The strategy to be used to determine which claims to be selectively disclosed. See [SDJWTClaimsStrategy] for more details.
/// * `holder_key` - The key used to sign the SD-JWT. If not provided, no key binding is added to the SD-JWT.
/// * `add_decoy_claims` - If true, decoy claims are added to the SD-JWT.
/// * `serialization_format` - The serialization format to be used for the SD-JWT. Only "compact" and "json" formats are supported.
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use error::Result;
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
use std::collections::HashMap;
pub use {holder::SDJWTHolder, issuer::SDJWTIssuer, verifier::SDJWTVerifier};
pub use {holder::SDJWTHolder, issuer::SDJWTIssuer, issuer::SDJWTClaimsStrategy, verifier::SDJWTVerifier};

mod disclosure;
pub mod error;
Expand Down