-
Notifications
You must be signed in to change notification settings - Fork 17
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
CT static API support #73
CT static API support #73
Conversation
c0989b7
to
46930b4
Compare
1e70afd
to
7ef226c
Compare
ct_only.go
Outdated
type Storage interface { | ||
// Add should duably assign an index to the provided Entry, and return it. | ||
// | ||
// Implementations MUST call the AssignIndex() method on the entry before marshaling and persisting it. |
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.
What is AssignIndex
referring to?
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.
Good spot, that was a function from an earlier incarnation which went away.
I've updated the comments to remove the reference.
entry.go
Outdated
} | ||
|
||
// indexFunc will be called when an index is assigned to the entry. |
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.
I think this function MUST NOT modify the assigned index?
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.
Added a comment to that effect.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #73 +/- ##
==========================================
- Coverage 35.80% 33.33% -2.48%
==========================================
Files 16 18 +2
Lines 1363 1440 +77
==========================================
- Hits 488 480 -8
- Misses 801 888 +87
+ Partials 74 72 -2 ☔ View full report in Codecov by Sentry. |
a805415
to
dd4b26e
Compare
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package tessera |
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.
tessera.Storage
is somewhat independent from CT, but is defined inside ct_only.go. It seems a bit odd. Would it make sense to define NewCertificateTransparencySequencedWriter and convertCTEntry in their own package?
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.
That interface is there currently just because there's not a corresponding tessera.NewSequencedWriter
yet.
Ideally the CT stuff would be in its own package, but to prevent other new use-cases from using these patterns it needs be in here to do "private" stuff internal to Entry
when setting those marshaling funcs.
ct_only.go
Outdated
type Storage interface { | ||
// Add should duably assign an index to the provided Entry, and return it. | ||
// | ||
// Implementations MUST call MarshalBundleData method on the entry before marshaling and persisting it. |
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.
This now reads a bit funny because we must call the marshaling function before marshaling it? Maybe just remove the second marshaling?
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.
d'oh, fixed - ta.
272b47e
to
d1fc00d
Compare
Summarizing our conversation here for the record. The logic makes sense to me, so I'll approve this PR. We could improve naming though to make it easier to read the code: |
|
This PR enables Tessera to support a CT Static API personality.
There's broadly two things which are necessary to be able to support that personality:
EntryBundle
is different and incompatibletlog-tiles specifies a
length/value
scheme, whereas CT Static API specifies justvalue
and relies on the fact thatvalue
in this case is self-describing.The SCT returned to the submitter contains the sequence number of the entry in the log in the
CtExtensions
field of the SCT struct. What's not obvious from the spec is that this must also be part of the Merkle leaf (otherwise compatibility with RFC6962 would be broken).This means that we don't actually know the
LeafData
or itsMerkleLeafHash
until we've sequenced it.Beyond enabling a CT Static API personality to be built, other large goals for this PR are:
Toward #41