@@ -93,6 +93,7 @@ pub type UnsignedCorimMap<'a> = CorimMap<'a>;
9393/// A type choice representing either a signed or unsigned CoRIM manifest
9494#[ repr( C ) ]
9595#[ derive( Debug , Serialize , Deserialize , From , TryFrom ) ]
96+ #[ serde( untagged) ]
9697pub enum ConciseRimTypeChoice < ' a > {
9798 /// An unprotected CoRIM with CBOR tag 501
9899 TaggedUnsignedCorimMap ( TaggedUnsignedCorimMap < ' a > ) ,
@@ -122,24 +123,29 @@ generate_tagged!(
122123#[ derive(
123124 Debug , Serialize , Deserialize , From , Constructor , PartialEq , Eq , PartialOrd , Ord , Clone ,
124125) ]
126+ #[ repr( C ) ]
125127pub struct CorimMap < ' a > {
126128 /// Unique identifier for the CoRIM
129+ #[ serde( rename = "0" ) ]
127130 pub id : CorimIdTypeChoice < ' a > ,
128131 /// Collection of tags contained in this CoRIM
132+ #[ serde( rename = "1" ) ]
129133 pub tags : OneOrMany < ConciseTagTypeChoice < ' a > > ,
130134 /// Optional references to other CoRIMs this one depends on
131135 #[ serde( skip_serializing_if = "Option::is_none" ) ]
132- #[ serde( rename = "dependent-rims " ) ]
136+ #[ serde( rename = "2 " ) ]
133137 pub dependent_rims : Option < Vec < CorimLocatorMap < ' a > > > ,
134138 /// Optional profile information
135139 #[ serde( skip_serializing_if = "Option::is_none" ) ]
140+ #[ serde( rename = "3" ) ]
136141 pub profile : Option < ProfileTypeChoice < ' a > > ,
137142 /// Optional validity period for the CoRIM
138143 #[ serde( skip_serializing_if = "Option::is_none" ) ]
139- #[ serde( rename = "rim-validity " ) ]
144+ #[ serde( rename = "4 " ) ]
140145 pub rim_validity : Option < ValidityMap > ,
141146 /// Optional list of entities associated with this CoRIM
142147 #[ serde( skip_serializing_if = "Option::is_none" ) ]
148+ #[ serde( rename = "5" ) ]
143149 pub entities : Option < OneOrMany < CorimEntityMap < ' a > > > ,
144150 /// Optional extensible attributes
145151 #[ serde( flatten) ]
@@ -150,6 +156,8 @@ pub struct CorimMap<'a> {
150156/// Represents either a string or UUID identifier for a CoRIM
151157#[ repr( C ) ]
152158#[ derive( Debug , Serialize , Deserialize , From , TryFrom , PartialEq , Eq , PartialOrd , Ord , Clone ) ]
159+ #[ serde( untagged) ]
160+
153161pub enum CorimIdTypeChoice < ' a > {
154162 /// Text string identifier
155163 Tstr ( Tstr < ' a > ) ,
@@ -166,6 +174,7 @@ impl<'a> From<&'a str> for CorimIdTypeChoice<'a> {
166174/// Types of tags that can be included in a CoRIM
167175#[ repr( C ) ]
168176#[ derive( Debug , Serialize , Deserialize , From , TryFrom , PartialEq , Eq , PartialOrd , Ord , Clone ) ]
177+ #[ serde( untagged) ]
169178pub enum ConciseTagTypeChoice < ' a > {
170179 /// A Concise Software Identity (CoSWID) tag
171180 Swid ( TaggedConciseSwidTag < ' a > ) ,
@@ -245,15 +254,18 @@ impl<'a> From<ConciseTlTag<'a>> for ConciseTagTypeChoice<'a> {
245254) ]
246255pub struct CorimLocatorMap < ' a > {
247256 /// URI(s) where the dependent CoRIM can be found
257+ #[ serde( rename = "0" ) ]
248258 pub href : OneOrMany < Uri < ' a > > ,
249259 /// Optional cryptographic thumbprint for verification
250260 #[ serde( skip_serializing_if = "Option::is_none" ) ]
261+ #[ serde( rename = "1" ) ]
251262 pub thumbprint : Option < Digest < ' a > > ,
252263}
253264
254265/// Profile identifier that can be either a URI or OID
255266#[ repr( C ) ]
256267#[ derive( Debug , Serialize , Deserialize , From , TryFrom , PartialEq , Eq , PartialOrd , Ord , Clone ) ]
268+ #[ serde( untagged) ]
257269pub enum ProfileTypeChoice < ' a > {
258270 /// URI-based profile identifier
259271 Uri ( Uri < ' a > ) ,
@@ -268,10 +280,10 @@ pub enum ProfileTypeChoice<'a> {
268280) ]
269281pub struct ValidityMap {
270282 /// Optional start time of the validity period
271- #[ serde( rename = "not-before " ) ]
283+ #[ serde( rename = "0 " ) ]
272284 pub not_before : Option < Time > ,
273285 /// Required end time of the validity period
274- #[ serde( rename = "not-after " ) ]
286+ #[ serde( rename = "1 " ) ]
275287 pub not_after : Time ,
276288}
277289
@@ -282,20 +294,25 @@ pub struct ValidityMap {
282294) ]
283295pub struct CorimEntityMap < ' a > {
284296 /// Name of the entity
285- #[ serde( rename = "entity-name " ) ]
297+ #[ serde( rename = "0 " ) ]
286298 pub entity_name : Text < ' a > ,
287299 /// Optional registration identifier for the entity
288- #[ serde( rename = "reg-id" ) ]
300+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
301+ #[ serde( rename = "1" ) ]
289302 pub reg_id : Option < Uri < ' a > > ,
290303 /// Role of the entity in relation to the CoRIM
304+ #[ serde( rename = "2" ) ]
291305 pub role : CorimRoleTypeChoice ,
292306 /// Optional extensible attributes
307+ #[ serde( flatten) ]
308+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
293309 pub extension : Option < ExtensionMap < ' a > > ,
294310}
295311
296312/// Roles that entities can have in relation to a CoRIM manifest
297313#[ derive( Debug , Serialize , Deserialize , From , TryFrom , PartialEq , Eq , PartialOrd , Ord , Clone ) ]
298314#[ repr( u8 ) ]
315+ #[ serde( untagged) ]
299316pub enum CorimRoleTypeChoice {
300317 /// Entity that created the manifest content
301318 ManifestCreator = 1 ,
@@ -334,19 +351,20 @@ pub struct COSESign1Corim<'a> {
334351#[ repr( C ) ]
335352pub struct ProtectedCorimHeaderMap < ' a > {
336353 /// Algorithm identifier for the signature
354+ #[ serde( rename = "1" ) ]
337355 pub alg : Int ,
338356 /// Content type indicator (should be "application/rim+cbor")
339- #[ serde( rename = "content-type " ) ]
357+ #[ serde( rename = "3 " ) ]
340358 pub content_type : Text < ' a > ,
341359 /// Key identifier for the signing key
360+ #[ serde( rename = "4" ) ]
342361 pub kid : Bytes ,
343362 /// CoRIM-specific metadata
344- #[ serde( rename = "corim-meta " ) ]
363+ #[ serde( rename = "8 " ) ]
345364 pub corim_meta : CorimMetaMap < ' a > ,
346365 /// Optional COSE header parameters
347366 #[ serde( skip_serializing_if = "Option::is_none" ) ]
348367 #[ serde( flatten) ]
349- #[ serde( rename = "cose-map" ) ]
350368 pub cose_map : Option < CoseMap < ' a > > ,
351369}
352370
@@ -357,9 +375,11 @@ pub struct ProtectedCorimHeaderMap<'a> {
357375#[ repr( C ) ]
358376pub struct CorimMetaMap < ' a > {
359377 /// Information about the signer
378+ #[ serde( rename = "0" ) ]
360379 pub signer : CorimSignerMap < ' a > ,
361380 /// Optional validity period for the signature
362- #[ serde( rename = "signature-validity" ) ]
381+ #[ serde( rename = "1" ) ]
382+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
363383 pub signature_validity : Option < ValidityMap > ,
364384}
365385
@@ -370,12 +390,14 @@ pub struct CorimMetaMap<'a> {
370390#[ repr( C ) ]
371391pub struct CorimSignerMap < ' a > {
372392 /// Name of the signing entity
373- #[ serde( rename = "signer-name " ) ]
393+ #[ serde( rename = "0 " ) ]
374394 pub signer_name : EntityNameTypeChoice < ' a > ,
375395 /// Optional URI identifying the signer
376- #[ serde( rename = "signer-uri " ) ]
396+ #[ serde( rename = "1 " ) ]
377397 pub signer_uri : Option < Uri < ' a > > ,
378398 /// Optional COSE-specific extensions
399+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
400+ #[ serde( flatten) ]
379401 pub extension : Option < CoseMap < ' a > > ,
380402}
381403
0 commit comments