Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rust/signed-doc): Add signing and verification logic to Catalyst Signed Docs #185

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

saibatizoku
Copy link
Contributor

Description

Thanks for contributing to the project!
Please fill out this template to help us review your changes.

Related Issue(s)

Closes #162

Description of Changes

Provide a clear and concise description of what the pull request changes.

Breaking Changes

Describe any breaking changes and the impact.

Screenshots

If applicable, add screenshots to help explain your changes.

Related Pull Requests

If applicable, list any related pull requests.

e.g., #123, #456

Please confirm the following checks

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream module

@saibatizoku saibatizoku added the enhancement New feature or request label Jan 28, 2025
@saibatizoku saibatizoku self-assigned this Jan 28, 2025
@saibatizoku saibatizoku force-pushed the feat/doc-signing-logic branch from a612907 to 70440b5 Compare January 28, 2025 01:16
Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 272/272}$ | ${\color{red}Fail: 0/272}$ |

Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 272/272}$ | ${\color{red}Fail: 0/272}$ |

@saibatizoku saibatizoku changed the title feat(rust/signed-doc): Add signing and verification logic to Catalyst Sigen feat(rust/signed-doc): Add signing and verification logic to Catalyst Signed Docs Jan 28, 2025
Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 273/273}$ | ${\color{red}Fail: 0/273}$ |

Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 273/273}$ | ${\color{red}Fail: 0/273}$ |

Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 273/273}$ | ${\color{red}Fail: 0/273}$ |

Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 273/273}$ | ${\color{red}Fail: 0/273}$ |

Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 273/273}$ | ${\color{red}Fail: 0/273}$ |

Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 273/273}$ | ${\color{red}Fail: 0/273}$ |

pub struct Builder {
/// Document Metadata
metadata: Option<Metadata>,
pub(crate) metadata: Option<Metadata>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need these fields to be pub(crate). I think they should private even for this crate

/// Returns a signed document `Builder` pre-loaded with the current signed document's
/// data.
#[must_use]
pub fn as_signed_doc_builder(&self) -> Builder {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn as_signed_doc_builder(&self) -> Builder {
pub fn into_builder(self) -> Builder {

#[must_use]
pub fn as_signed_doc_builder(&self) -> Builder {
Builder {
metadata: Some(self.inner.metadata.clone()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems it would be better to make all Builder fields private and just call with_metadata, with_signatures etc.

where P: Fn(&KidUri) -> VerifyingKey {
let error_report = ProblemReport::new("Catalyst Signed Document Verification");

if !self.doc_type().is_valid() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've updated a UuidV4 and UuidV7 decoding logic, so now we can assume that they always valid.
So such validation is not necessary at this place, because it is already done during decoding

@saibatizoku saibatizoku marked this pull request as ready for review January 31, 2025 03:21
Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 273/273}$ | ${\color{red}Fail: 0/273}$ |

Mr-Leshiy
Mr-Leshiy previously approved these changes Jan 31, 2025
Copy link
Contributor

@Mr-Leshiy Mr-Leshiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

github-actions bot commented Feb 2, 2025

Test Report | ${\color{lightgreen}Pass: 274/274}$ | ${\color{red}Fail: 0/274}$ |

Copy link
Contributor

github-actions bot commented Feb 2, 2025

Test Report | ${\color{lightgreen}Pass: 275/275}$ | ${\color{red}Fail: 0/275}$ |

@saibatizoku saibatizoku force-pushed the feat/doc-signing-logic branch from b82ec2a to a2af6f1 Compare February 3, 2025 00:03
Copy link
Contributor

github-actions bot commented Feb 3, 2025

Test Report | ${\color{lightgreen}Pass: 275/275}$ | ${\color{red}Fail: 0/275}$ |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: New
Development

Successfully merging this pull request may close these issues.

CatalystSignedDocument signing logic
2 participants