Skip to content

Commit

Permalink
Support for COSE Receipts (MMRIVER) (#34)
Browse files Browse the repository at this point in the history
* receipt command and consistency proof updates

The receipt command produces COSE Receipts for
an confirmed event or log entry

These can be attached to scitt signed statements to make them
transparent statements.

* Update receipt.go

Co-authored-by: Henry <[email protected]>
Signed-off-by: robinbryce <[email protected]>

* Update receipt.go

Co-authored-by: Joe Gough <[email protected]>
Signed-off-by: robinbryce <[email protected]>

* take upstream fix for replication of legacy seals

* linter issue and remove ikwid hack

---------

Signed-off-by: robinbryce <[email protected]>
Co-authored-by: Robin Bryce <[email protected]>
Co-authored-by: Henry <[email protected]>
Co-authored-by: Joe Gough <[email protected]>
  • Loading branch information
4 people authored Nov 1, 2024
1 parent e21c5b7 commit 67a9795
Show file tree
Hide file tree
Showing 13 changed files with 245 additions and 101 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.verifiabledata
tmp
.vscode
.local
Expand All @@ -7,6 +8,6 @@ dist/
tests/systemtest/shunit/
tests/systemtest/res.xml
.task/
.env.secret
.env.secret*
.env.local
.envrc
1 change: 1 addition & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func AddCommands(app *cli.App, ikwid bool) *cli.App {
app.Commands = append(app.Commands, NewNodeCmd())
app.Commands = append(app.Commands, NewLogWatcherCmd())
app.Commands = append(app.Commands, NewReplicateLogsCmd())
app.Commands = append(app.Commands, NewReceiptCmd())

if ikwid {
app.Commands = append(app.Commands, NewMassifsCmd())
Expand Down
14 changes: 6 additions & 8 deletions ediag.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,21 @@ func NewEventDiagCmd() *cli.Command {
// Generate the proof for the mmrIndex and get the root. We use
// the mmrSize from the end of the blob in which the leaf entry
// was recorded. Any size > than the leaf index would work.
eventHasher.Reset()
mmrSize := cmd.massif.RangeCount()
proof, err := mmr.IndexProof(mmrSize, &cmd.massif, eventHasher, mmrIndex)
if err != nil {
return err
}
root, err := mmr.GetRoot(mmrSize, &cmd.massif, eventHasher)
proof, err := mmr.InclusionProof(&cmd.massif, mmrSize, mmrIndex)
if err != nil {
return err
}

eventHasher.Reset()
verified := mmr.VerifyInclusion(mmrSize, eventHasher, logNodeValue, mmrIndex, proof, root)
verified, err := mmr.VerifyInclusion(&cmd.massif, eventHasher, mmrSize, logNodeValue, mmrIndex, proof)
if verified {
fmt.Printf("OK|%d %d\n", mmrIndex, leafIndex)
continue
}
if err != nil {
fmt.Printf("XX|%d %d|%s\n", mmrIndex, leafIndex, err.Error())
continue
}
fmt.Printf("XX|%d %d\n", mmrIndex, leafIndex)
}

Expand Down
36 changes: 17 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module github.com/datatrails/veracity
go 1.22

require (
github.com/datatrails/go-datatrails-common v0.16.1
github.com/datatrails/go-datatrails-common v0.18.0
github.com/datatrails/go-datatrails-common-api-gen v0.4.6
github.com/datatrails/go-datatrails-logverification v0.1.7
github.com/datatrails/go-datatrails-merklelog/massifs v0.1.1
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2
github.com/datatrails/go-datatrails-logverification v0.2.0
github.com/datatrails/go-datatrails-merklelog/massifs v0.2.1
github.com/datatrails/go-datatrails-merklelog/mmr v0.1.1
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.1.0
github.com/datatrails/go-datatrails-simplehash v0.0.5
github.com/gosuri/uiprogress v0.0.1
Expand All @@ -16,8 +16,6 @@ require (
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
)

// replace github.com/datatrails/go-datatrails-merklelog/massifs => ../go-datatrails-merklelog/massifs

require (
github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect
github.com/gosuri/uilive v0.0.4 // indirect
Expand All @@ -29,13 +27,13 @@ require (
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.7.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.4.1
github.com/Azure/go-amqp v1.0.5 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.29 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.23 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.24 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.13 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
Expand All @@ -46,10 +44,10 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/fxamacker/cbor/v2 v2.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/google/uuid v1.6.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/ldclabs/cose/go v0.0.0-20221214142927-d22c1cfc2154 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 // indirect
Expand All @@ -65,13 +63,13 @@ require (
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect
google.golang.org/grpc v1.64.0 // indirect
google.golang.org/protobuf v1.34.1
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 67a9795

Please sign in to comment.