@@ -715,6 +715,7 @@ impl RootMetadataBuilder {
715715 RoleDefinition :: new ( self . snapshot_threshold , self . snapshot_key_ids ) ?,
716716 RoleDefinition :: new ( self . targets_threshold , self . targets_key_ids ) ?,
717717 RoleDefinition :: new ( self . timestamp_threshold , self . timestamp_key_ids ) ?,
718+ Default :: default ( ) ,
718719 )
719720 }
720721
@@ -763,6 +764,7 @@ pub struct RootMetadata {
763764 snapshot : RoleDefinition < SnapshotMetadata > ,
764765 targets : RoleDefinition < TargetsMetadata > ,
765766 timestamp : RoleDefinition < TimestampMetadata > ,
767+ additional_fields : HashMap < String , serde_json:: Value > ,
766768}
767769
768770impl RootMetadata {
@@ -776,6 +778,7 @@ impl RootMetadata {
776778 snapshot : RoleDefinition < SnapshotMetadata > ,
777779 targets : RoleDefinition < TargetsMetadata > ,
778780 timestamp : RoleDefinition < TimestampMetadata > ,
781+ additional_fields : HashMap < String , serde_json:: Value > ,
779782 ) -> Result < Self > {
780783 if version < 1 {
781784 return Err ( Error :: MetadataVersionMustBeGreaterThanZero (
@@ -792,6 +795,7 @@ impl RootMetadata {
792795 snapshot,
793796 targets,
794797 timestamp,
798+ additional_fields,
795799 } )
796800 }
797801
@@ -857,6 +861,11 @@ impl RootMetadata {
857861 pub fn timestamp ( & self ) -> & RoleDefinition < TimestampMetadata > {
858862 & self . timestamp
859863 }
864+
865+ /// An immutable reference to any additional fields on the metadata.
866+ pub fn additional_fields ( & self ) -> & HashMap < String , serde_json:: Value > {
867+ & self . additional_fields
868+ }
860869}
861870
862871impl Metadata for RootMetadata {
@@ -1122,7 +1131,12 @@ impl TimestampMetadataBuilder {
11221131
11231132 /// Construct a new `TimestampMetadata`.
11241133 pub fn build ( self ) -> Result < TimestampMetadata > {
1125- TimestampMetadata :: new ( self . version , self . expires , self . snapshot )
1134+ TimestampMetadata :: new (
1135+ self . version ,
1136+ self . expires ,
1137+ self . snapshot ,
1138+ Default :: default ( ) ,
1139+ )
11261140 }
11271141
11281142 /// Construct a new `SignedMetadata<D, TimestampMetadata>`.
@@ -1143,6 +1157,7 @@ pub struct TimestampMetadata {
11431157 version : u32 ,
11441158 expires : DateTime < Utc > ,
11451159 snapshot : MetadataDescription < SnapshotMetadata > ,
1160+ additional_fields : HashMap < String , serde_json:: Value > ,
11461161}
11471162
11481163impl TimestampMetadata {
@@ -1151,6 +1166,7 @@ impl TimestampMetadata {
11511166 version : u32 ,
11521167 expires : DateTime < Utc > ,
11531168 snapshot : MetadataDescription < SnapshotMetadata > ,
1169+ additional_fields : HashMap < String , serde_json:: Value > ,
11541170 ) -> Result < Self > {
11551171 if version < 1 {
11561172 return Err ( Error :: MetadataVersionMustBeGreaterThanZero (
@@ -1162,13 +1178,19 @@ impl TimestampMetadata {
11621178 version,
11631179 expires,
11641180 snapshot,
1181+ additional_fields,
11651182 } )
11661183 }
11671184
11681185 /// An immutable reference to the snapshot description.
11691186 pub fn snapshot ( & self ) -> & MetadataDescription < SnapshotMetadata > {
11701187 & self . snapshot
11711188 }
1189+
1190+ /// An immutable reference to any additional fields on the metadata.
1191+ pub fn additional_fields ( & self ) -> & HashMap < String , serde_json:: Value > {
1192+ & self . additional_fields
1193+ }
11721194}
11731195
11741196impl Metadata for TimestampMetadata {
@@ -1380,7 +1402,7 @@ impl SnapshotMetadataBuilder {
13801402
13811403 /// Construct a new `SnapshotMetadata`.
13821404 pub fn build ( self ) -> Result < SnapshotMetadata > {
1383- SnapshotMetadata :: new ( self . version , self . expires , self . meta )
1405+ SnapshotMetadata :: new ( self . version , self . expires , self . meta , Default :: default ( ) )
13841406 }
13851407
13861408 /// Construct a new `SignedMetadata<D, SnapshotMetadata>`.
@@ -1417,6 +1439,7 @@ pub struct SnapshotMetadata {
14171439 version : u32 ,
14181440 expires : DateTime < Utc > ,
14191441 meta : HashMap < MetadataPath , MetadataDescription < TargetsMetadata > > ,
1442+ additional_fields : HashMap < String , serde_json:: Value > ,
14201443}
14211444
14221445impl SnapshotMetadata {
@@ -1425,6 +1448,7 @@ impl SnapshotMetadata {
14251448 version : u32 ,
14261449 expires : DateTime < Utc > ,
14271450 meta : HashMap < MetadataPath , MetadataDescription < TargetsMetadata > > ,
1451+ additional_fields : HashMap < String , serde_json:: Value > ,
14281452 ) -> Result < Self > {
14291453 if version < 1 {
14301454 return Err ( Error :: MetadataVersionMustBeGreaterThanZero (
@@ -1436,13 +1460,19 @@ impl SnapshotMetadata {
14361460 version,
14371461 expires,
14381462 meta,
1463+ additional_fields,
14391464 } )
14401465 }
14411466
14421467 /// An immutable reference to the metadata paths and descriptions.
14431468 pub fn meta ( & self ) -> & HashMap < MetadataPath , MetadataDescription < TargetsMetadata > > {
14441469 & self . meta
14451470 }
1471+
1472+ /// An immutable reference to any additional fields on the metadata.
1473+ pub fn additional_fields ( & self ) -> & HashMap < String , serde_json:: Value > {
1474+ & self . additional_fields
1475+ }
14461476}
14471477
14481478impl Metadata for SnapshotMetadata {
0 commit comments