Skip to content

Commit e95c39a

Browse files
fix: Restore support for claim_generator_hints. (#915)
* Remove redundant LogItems. Add claim URI or Ingredient URI when possible * More error reporting enhancements * Add OCSP revocations status * Comment fix * Update test image and go back to old test * Update c2patool version * Restore fix for claim_generator_hints
1 parent 2395bd2 commit e95c39a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

sdk/src/claim.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ impl fmt::Debug for ClaimAssertion {
206206
// Claim field names
207207
const CLAIM_GENERATOR_F: &str = "claim_generator";
208208
const CLAIM_GENERATOR_INFO_F: &str = "claim_generator_info";
209+
const CLAIM_GENERATOR_HINTS_F: &str = "claim_generator_hints";
209210
const SIGNATURE_F: &str = "signature";
210211
const ASSERTIONS_F: &str = "assertions";
211212
const DC_FORMAT_F: &str = "dc:format";
@@ -495,6 +496,7 @@ impl Claim {
495496
if claim_version == 1 {
496497
/* Claim V1 fields
497498
"claim_generator": tstr,
499+
"claim_generator_hints",
498500
"claim_generator_info": [1* generator-info-map],
499501
"signature": jumbf-uri-type,
500502
"assertions": [1* $hashed-uri-map],
@@ -507,8 +509,9 @@ impl Claim {
507509
? "metadata": $assertion-metadata-map,
508510
*/
509511

510-
static V1_FIELDS: [&str; 11] = [
512+
static V1_FIELDS: [&str; 12] = [
511513
CLAIM_GENERATOR_F,
514+
CLAIM_GENERATOR_HINTS_F,
512515
CLAIM_GENERATOR_INFO_F,
513516
SIGNATURE_F,
514517
ASSERTIONS_F,
@@ -535,9 +538,6 @@ impl Claim {
535538

536539
let claim_generator: String =
537540
map_cbor_to_type(CLAIM_GENERATOR_F, &claim_value).ok_or(Error::ClaimDecoding)?;
538-
let claim_generator_info: Vec<ClaimGeneratorInfo> =
539-
map_cbor_to_type(CLAIM_GENERATOR_INFO_F, &claim_value).unwrap_or_default();
540-
541541
let signature: String =
542542
map_cbor_to_type(SIGNATURE_F, &claim_value).ok_or(Error::ClaimDecoding)?;
543543
let assertions: Vec<HashedUri> =
@@ -548,6 +548,10 @@ impl Claim {
548548
map_cbor_to_type(INSTANCE_ID_F, &claim_value).ok_or(Error::ClaimDecoding)?;
549549

550550
// optional V1 fields
551+
let claim_generator_info: Option<Vec<ClaimGeneratorInfo>> =
552+
map_cbor_to_type(CLAIM_GENERATOR_INFO_F, &claim_value);
553+
let claim_generator_hints: Option<HashMap<String, Value>> =
554+
map_cbor_to_type(CLAIM_GENERATOR_HINTS_F, &claim_value);
551555
let title: Option<String> = map_cbor_to_type(DC_TITLE_F, &claim_value);
552556
let redacted_assertions: Option<Vec<String>> =
553557
map_cbor_to_type(REDACTED_ASSERTIONS_F, &claim_value);
@@ -568,15 +572,15 @@ impl Claim {
568572
assertion_store: Vec::new(),
569573
vc_store: Vec::new(),
570574
claim_generator: Some(claim_generator),
571-
claim_generator_info: Some(claim_generator_info),
575+
claim_generator_info,
572576
signature,
573577
assertions,
574578
original_bytes: Some(data.to_owned()),
575579
original_box_order: None,
576580
redacted_assertions,
577581
alg,
578582
alg_soft,
579-
claim_generator_hints: None,
583+
claim_generator_hints,
580584
metadata,
581585
data_boxes: Vec::new(),
582586
claim_version,

0 commit comments

Comments
 (0)