Skip to content

Commit b99ffbe

Browse files
authoredDec 26, 2023
v0.0.6. Update API docs. (#15)
Signed-off-by: Sergey Minaev <sergey.minaev@dsr-corporation.com>
1 parent ec02259 commit b99ffbe

File tree

4 files changed

+15
-22
lines changed

4 files changed

+15
-22
lines changed
 

‎Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sd-jwt-rs"
3-
version = "0.0.4"
3+
version = "0.0.5"
44
edition = "2021"
55
license = "Apache-2.0 OR MIT"
66
description = "Rust reference implementation of the IETF SD-JWT specification (v6)."

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ cargo test
4040
```
4141

4242
### Interoperability testing tool
43-
Coming soon (planned for v0.0.5)
43+
Coming soon (planned for v0.0.6)
4444

4545
## External Dependencies
4646

‎src/issuer.rs

+12-19
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,24 @@ pub struct SDJWTIssuer {
3636
pub serialized_sd_jwt: String,
3737
}
3838

39+
/// SDJWTClaimsStrategy is used to determine which claims can be selectively disclosed later by the holder.
3940
pub enum SDJWTClaimsStrategy<'a> {
40-
// Full disclosure
41+
/// No claims can be selectively disclosed. Full disclosure.
4142
No,
42-
// Top-level selective disclosure, nested objects as full disclosure
43+
/// Top-level claims can be selectively disclosed, nested objects are fully disclosed.
4344
Flat,
44-
// Full recursive selective disclosure
45+
/// All claims can be selectively disclosed (recursively including nested objects).
4546
Full,
46-
//TODO gather JSONPaths to point the claims to be SD
47+
/// Claims can be selectively disclosed based on the provided JSONPaths. Other claims are fully disclosed.
48+
/// # Examples
49+
/// ```
50+
/// use sd_jwt_rs::issuer::SDJWTClaimsStrategy;
51+
///
52+
/// let strategy = SDJWTClaimsStrategy::Partial(vec!["$.address", "$.address.street_address"]);
53+
/// ```
4754
Partial(Vec<&'a str>),
4855
}
4956

50-
/// SDJWTClaimsStrategy is used to determine which claims can be selectively disclosed later by the holder.
51-
///
52-
/// The following strategies are supported:
53-
/// * No: No claims can be selectively disclosed.
54-
/// * Flat: Top-level claims can be selectively disclosed, nested objects are fully disclosed.
55-
/// * Full: All claims can be selectively disclosed.
56-
/// * Partial: Claims can be selectively disclosed based on the provided JSONPaths.
57-
///
58-
/// # Examples
59-
/// ```
60-
/// use sd_jwt_rs::issuer::SDJWTClaimsStrategy;
61-
///
62-
/// let strategy = SDJWTClaimsStrategy::Partial(vec!["$.address", "$.address.street_address"]);
63-
/// ```
6457
impl<'a> SDJWTClaimsStrategy<'a> {
6558
fn finalize_input(&mut self) -> Result<()> {
6659
match self {
@@ -156,7 +149,7 @@ impl SDJWTIssuer {
156149
///
157150
/// # Arguments
158151
/// * `user_claims` - The claims to be included in the SD-JWT.
159-
/// * `sd_strategy` - The strategy to be used to determine which claims to be selectively disclosed. See SDJWTClaimsStrategy for more details.
152+
/// * `sd_strategy` - The strategy to be used to determine which claims to be selectively disclosed. See [SDJWTClaimsStrategy] for more details.
160153
/// * `holder_key` - The key used to sign the SD-JWT. If not provided, no key binding is added to the SD-JWT.
161154
/// * `add_decoy_claims` - If true, decoy claims are added to the SD-JWT.
162155
/// * `serialization_format` - The serialization format to be used for the SD-JWT. Only "compact" and "json" formats are supported.

‎src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use error::Result;
55
use serde::{Deserialize, Serialize};
66
use serde_json::{Map, Value};
77
use std::collections::HashMap;
8-
pub use {holder::SDJWTHolder, issuer::SDJWTIssuer, verifier::SDJWTVerifier};
8+
pub use {holder::SDJWTHolder, issuer::SDJWTIssuer, issuer::SDJWTClaimsStrategy, verifier::SDJWTVerifier};
99

1010
mod disclosure;
1111
pub mod error;

0 commit comments

Comments
 (0)
Please sign in to comment.