-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev/jgough/9491 consistency demo (#10)
* Consistency demo re: AB#9491 --------- Signed-off-by: Joe Gough <[email protected]> Co-authored-by: jgough <[email protected]> Co-authored-by: robinbryce <[email protected]>
- Loading branch information
1 parent
3e6e5b8
commit 988bb6f
Showing
10 changed files
with
530 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package main | ||
|
||
const ( | ||
publicTenantID = "tenant/6ea5cd00-c711-3649-6914-7b125928bbb4" | ||
|
||
container = "merklelogs" | ||
url = "https://app.datatrails.ai/verifiabledata" | ||
|
||
// newStateMMRIndex is the new state of the log at the time of the demo | ||
// | ||
// it is based off of this public event: | ||
// https://app.datatrails.ai/archivist/publicassets/fe022486-3272-4d44-aab5-765a37c17b85/events/3e7a16dd-01d6-44f5-870d-abb9c56d154b | ||
newStateMMRIndex = uint64(830) | ||
) | ||
|
||
var ( | ||
|
||
// sampleSignedStateCbor is the sample signed state for the massif that contains the | ||
// event for the breast cancer diagnosing AI model sample | ||
// found here: https://app.datatrails.ai/archivist/publicassets/3ea5aca3-da02-4bae-b6d0-85a5ab586ed6/events/9a192afe-9253-44d7-8585-c48f237f2134 | ||
sampleSignedStateCbor = []byte{ | ||
210, 132, 89, 1, 67, 162, 1, 56, 34, 13, 163, 1, 120, 48, 104, 116, | ||
116, 112, 115, 58, 47, 47, 106, 105, 116, 97, 118, 105, 100, 56, 53, 51, | ||
99, 99, 57, 53, 50, 49, 53, 97, 57, 97, 56, 48, 56, 46, 118, 97, 117, 108, | ||
116, 46, 97, 122, 117, 114, 101, 46, 110, 101, 116, 47, 2, 120, 82, 118, | ||
49, 47, 109, 109, 114, 115, 47, 116, 101, 110, 97, 110, 116, 47, 54, 101, | ||
97, 53, 99, 100, 48, 48, 45, 99, 55, 49, 49, 45, 51, 54, 52, 57, 45, 54, | ||
57, 49, 52, 45, 55, 98, 49, 50, 53, 57, 50, 56, 98, 98, 98, 52, 47, 48, 47, | ||
109, 97, 115, 115, 105, 102, 115, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, | ||
48, 48, 48, 48, 48, 48, 46, 108, 111, 103, 8, 161, 1, 166, 1, 98, 69, 67, 2, | ||
120, 58, 101, 102, 57, 57, 48, 98, 58, 109, 101, 114, 107, 108, 101, 45, 108, | ||
111, 103, 45, 115, 105, 103, 110, 105, 110, 103, 47, 49, 52, 51, 52, 54, 97, | ||
97, 102, 101, 52, 102, 48, 52, 102, 97, 51, 98, 51, 99, 57, 51, 56, 56, 49, | ||
48, 50, 102, 52, 48, 50, 99, 98, 3, 56, 34, 32, 101, 80, 45, 51, 56, 52, 33, | ||
88, 48, 3, 206, 181, 90, 34, 69, 187, 3, 171, 186, 248, 2, 30, 106, 6, 8, 74, | ||
13, 203, 138, 241, 65, 79, 147, 49, 93, 19, 32, 129, 68, 243, 139, 0, 231, 93, | ||
58, 188, 167, 171, 148, 165, 71, 137, 129, 4, 211, 140, 33, 34, 88, 48, 156, 60, | ||
32, 38, 135, 51, 32, 3, 46, 176, 144, 50, 155, 185, 116, 255, 133, 140, 122, 213, | ||
106, 149, 209, 172, 103, 229, 131, 151, 3, 160, 76, 26, 243, 224, 33, 64, 141, 0, 1, | ||
123, 147, 250, 119, 54, 176, 75, 96, 114, 160, 88, 62, 165, 1, 25, 3, 92, 2, 88, 32, | ||
37, 72, 213, 167, 56, 138, 249, 32, 187, 223, 154, 122, 229, 202, 109, 160, 132, 148, | ||
13, 42, 206, 145, 135, 106, 109, 117, 211, 33, 251, 41, 36, 162, 3, 27, 0, 0, 1, 143, | ||
227, 150, 231, 31, 4, 27, 143, 227, 150, 230, 163, 7, 176, 0, 6, 1, 88, 96, 109, 100, | ||
152, 178, 43, 207, 99, 125, 131, 192, 248, 96, 17, 205, 170, 81, 174, 155, 146, 76, | ||
179, 16, 221, 220, 156, 133, 21, 158, 166, 142, 218, 186, 96, 65, 12, 35, 35, 30, 31, | ||
90, 10, 176, 86, 254, 133, 200, 196, 33, 173, 13, 41, 22, 20, 251, 253, 139, 173, 215, | ||
220, 241, 176, 174, 67, 222, 140, 24, 180, 94, 192, 144, 96, 54, 10, 153, 102, 240, 203, | ||
121, 204, 198, 53, 212, 113, 194, 179, 190, 23, 196, 201, 228, 77, 25, 81, 217, 21, 124, | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/datatrails/go-datatrails-common/cose" | ||
"github.com/datatrails/go-datatrails-logverification/logverification" | ||
"github.com/datatrails/go-datatrails-merklelog/massifs" | ||
) | ||
|
||
/** | ||
* Existing log state is an existing log state based on the breast cancer diagnosing AI model sample | ||
* found here: https://app.datatrails.ai/archivist/publicassets/3ea5aca3-da02-4bae-b6d0-85a5ab586ed6/events/9a192afe-9253-44d7-8585-c48f237f2134 | ||
* | ||
* The existing log state will take the root of the massif the event is found in, in this case the mmrIndex of 511 of the public tenant. | ||
*/ | ||
|
||
// ExistingSignedState gets the existing signed state for the log at the massif where | ||
// | ||
// the event for the breast cancer diagnosing AI model sample is found. | ||
// The event can be found here: https://app.datatrails.ai/archivist/publicassets/3ea5aca3-da02-4bae-b6d0-85a5ab586ed6/events/9a192afe-9253-44d7-8585-c48f237f2134 | ||
// | ||
// Then verifies the existing signed state signature against using the known veriication key. | ||
func ExistingSignedState() (*massifs.MMRState, error) { | ||
signedState, err := cose.NewCoseSign1MessageFromCBOR(sampleSignedStateCbor) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
verificationKey, err := VerificationKeyFromFile() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
err = signedState.VerifyWithPublicKey(verificationKey, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
codec, err := massifs.NewRootSignerCodec() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return logverification.LogState(signedState, codec) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.