Skip to content

Commit 7a0fa43

Browse files
committed
remove author field
1 parent 90d0622 commit 7a0fa43

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

rust/signed_doc/src/lib.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ struct InnerCatalystSignedDocument {
2424
metadata: Metadata,
2525
/// Document Content
2626
content: Content,
27-
/// Document Author
28-
author: KidUri,
2927
/// Signatures
3028
signatures: Signatures,
3129
}
@@ -74,17 +72,13 @@ impl TryFrom<&[u8]> for CatalystSignedDocument {
7472
},
7573
Some,
7674
);
77-
let author = signatures.as_ref().and_then(|s| s.kids().first().cloned());
7875

7976
if cose_sign.payload.is_none() {
8077
errors.push(anyhow!("Document Content is missing"));
8178
}
82-
if author.is_none() {
83-
errors.push(anyhow!("Document Author is missing"));
84-
}
8579

86-
match (cose_sign.payload, author, metadata, signatures) {
87-
(Some(payload), Some(author), Some(metadata), Some(signatures)) => {
80+
match (cose_sign.payload, metadata, signatures) {
81+
(Some(payload), Some(metadata), Some(signatures)) => {
8882
let content = Content::new(
8983
payload,
9084
metadata.content_type(),
@@ -99,7 +93,6 @@ impl TryFrom<&[u8]> for CatalystSignedDocument {
9993
inner: InnerCatalystSignedDocument {
10094
metadata,
10195
content,
102-
author,
10396
signatures,
10497
}
10598
.into(),
@@ -137,9 +130,9 @@ impl CatalystSignedDocument {
137130
&self.inner.content
138131
}
139132

140-
/// Return a Document's author
133+
/// Return a Document's signatures
141134
#[must_use]
142-
pub fn author(&self) -> KidUri {
143-
self.inner.author.clone()
135+
pub fn signatures(&self) -> &Signatures {
136+
&self.inner.signatures
144137
}
145138
}

rust/signed_doc/src/signature/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ use coset::CoseSignature;
88
pub struct Signature {
99
/// Key ID
1010
kid: KidUri,
11-
/// COSE Signature
11+
/// COSE Signature
12+
#[allow(dead_code)]
1213
signature: CoseSignature,
1314
}
1415

@@ -20,12 +21,6 @@ impl Signatures {
2021
pub fn kids(&self) -> Vec<KidUri> {
2122
self.0.iter().map(|sig| sig.kid.clone()).collect()
2223
}
23-
24-
/// List of signatures.
25-
#[allow(dead_code)]
26-
pub fn signatures(&self) -> Vec<CoseSignature> {
27-
self.0.iter().map(|sig| sig.signature.clone()).collect()
28-
}
2924
}
3025

3126
impl TryFrom<&Vec<CoseSignature>> for Signatures {
@@ -48,6 +43,7 @@ impl TryFrom<&Vec<CoseSignature>> for Signatures {
4843
},
4944
}
5045
});
46+
5147
if errors.is_empty() {
5248
Err(errors.into())
5349
} else {

0 commit comments

Comments
 (0)