-
Notifications
You must be signed in to change notification settings - Fork 79
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
refactor: selective disclosure api #380
Conversation
ack on the concept |
Nice! Looking forward to switching to this new API 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think this is a good approach 👍
d4a7179
to
676a6c4
Compare
676a6c4
to
5839d72
Compare
At last, this is ready for review. We'll want to wait until outstanding PRs in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good,
can we use the same formatting for method args everywhere in this PR as per https://github.com/tlsnotary/tlsn/blob/dev/CONTRIBUTING.md#function-arguments
/// * arg1
- The first argument.
(The first letter capitalized and a period at the end)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gw
Ok(()) | ||
} | ||
|
||
/// Commits to a JSON string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Commits to a JSON string. | |
/// Commits to an unquoted JSON string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 gw. Very nice API.
This PR redesigns our selective disclosure API, inverting control over the parsed data structures, passing them out to the user instead.
All previous data format structures have been ripped out in favor of re-exporting types from
spansy
, and then leveraging theToRangeSet
trait fromtlsn-utils
in thetlsn-core
API. Users who want to implement their own format types can if they wish, their types only need to implementToRangeSet
to integrate withtlsn-core
.It introduces two new traits,
HttpCommit
andJsonCommit
which a user can either implement themselves, or just use our default committer. Both traits provide blanket impls for all the methods, so a user can override something without having to reimplement everything.This API is by no means final. It will continue to evolve as we introduce new commitment types. There is also room for new abstractions for generating proofs similar to how we do commitments via the
*Commit
traits. For now I've kept that out of scope of this PR and users will have to use theSubstringsProofBuilder
API directly (which isn't too bad because at least now they can use typed data instead of manually specifying ranges).