Skip to content

Commit

Permalink
Update the multirepo example metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslav Dimitrov <[email protected]>
  • Loading branch information
rdimitrov committed Jan 25, 2024
1 parent 19d3aa2 commit dd861e9
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 46 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode
dist/
.idea/
30 changes: 15 additions & 15 deletions examples/multirepo/client/root.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
{
"signatures": [
{
"keyid": "858d7da5d484f24900fa9cf411f81e19001653a507fa6530c41fbe0a83359ec2",
"sig": "48178709d5b4296e19f7d9409c6fc2ba8a8a0568333b15cc8252b34541a3239a08b37adc721afc1394482b96e3ba3617e6ba4cd7ce048904472bdf161820c60c"
"keyid": "492e4e5660058c39cae70b380750e4f8ea86d0fc2047c795af9bbbe73cedd138",
"sig": "b434f25bd61a5cb7c53883b3d91c53b94e9312cd17e19f2b1e1089d73772fad542c0a91ef109404fe4cfabbd2d4cf3b0f7eaaca4fd012555014f75a23d49460a"
}
],
"signed": {
"_type": "root",
"consistent_snapshot": true,
"expires": "2024-08-30T17:08:16.58221527Z",
"expires": "2033-11-28T19:51:01.794266Z",
"keys": {
"27739df49cff443d8495054774a5d6e86ff2a92a5fdde619e0919caf6171e173": {
"492e4e5660058c39cae70b380750e4f8ea86d0fc2047c795af9bbbe73cedd138": {
"keytype": "ed25519",
"keyval": {
"public": "6b8860bc2395b3dfaa2e938753788ebc1a6d078d8b6c7c6ea5b6ec164fdfce1a"
"public": "3b70174991642fd8cfd4b1a4d834843f785db02ad98372b24eb54d06750dd732"
},
"scheme": "ed25519"
},
"4f345ceb09a215ed9167a6611afcc0fd6d9a0c4a747ef39d3998ad0730d5a48c": {
"8dcef43f9966d6b5c88cb10f7b5258361532de2151c65378bb8a21c281658696": {
"keytype": "ed25519",
"keyval": {
"public": "8b1e343aa4a58aedf7d45d4f100e2d478025ad7134ac728cf8e5d5c49ab1efda"
"public": "2f70d3d75e50f50cf9af3adcc20754ba2d17601801f36d61cacb9f73a7f798f9"
},
"scheme": "ed25519"
},
"858d7da5d484f24900fa9cf411f81e19001653a507fa6530c41fbe0a83359ec2": {
"a606e603cc4974a8fa894928cb165ce38a3f9948c245414bc71ef681caae9dc5": {
"keytype": "ed25519",
"keyval": {
"public": "93a8b2eeaae60f591211d2c8e20b04ff5897db56e59d1c4118b6aff89c2b4c5b"
"public": "3c3769ac5f74c8f2f84748586344ab8bbda9f0096859d5f37450dec1f5675434"
},
"scheme": "ed25519"
},
"8b310111e8ac39e006a8a12904f3219212bcfb0b9dbf9c2cf7c0f49d4d3edd35": {
"e92842caf93e6e50a64ec0a467dee5bbd06669a6474895b3d5133c69de33545b": {
"keytype": "ed25519",
"keyval": {
"public": "9dd181035fa996f1d1551689e2d86cefa21dad7cf2365d92ef4e743d90be52d1"
"public": "6b1daebaa9b926bb38c33fd7d4edc14e2e96f8795b2ffe6ed49adee6a1251b20"
},
"scheme": "ed25519"
}
},
"roles": {
"root": {
"keyids": [
"858d7da5d484f24900fa9cf411f81e19001653a507fa6530c41fbe0a83359ec2"
"492e4e5660058c39cae70b380750e4f8ea86d0fc2047c795af9bbbe73cedd138"
],
"threshold": 1
},
"snapshot": {
"keyids": [
"27739df49cff443d8495054774a5d6e86ff2a92a5fdde619e0919caf6171e173"
"8dcef43f9966d6b5c88cb10f7b5258361532de2151c65378bb8a21c281658696"
],
"threshold": 1
},
"targets": {
"keyids": [
"8b310111e8ac39e006a8a12904f3219212bcfb0b9dbf9c2cf7c0f49d4d3edd35"
"a606e603cc4974a8fa894928cb165ce38a3f9948c245414bc71ef681caae9dc5"
],
"threshold": 1
},
"timestamp": {
"keyids": [
"4f345ceb09a215ed9167a6611afcc0fd6d9a0c4a747ef39d3998ad0730d5a48c"
"e92842caf93e6e50a64ec0a467dee5bbd06669a6474895b3d5133c69de33545b"
],
"threshold": 1
}
Expand Down
14 changes: 7 additions & 7 deletions examples/multirepo/repository/generate_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func main() {
keys := map[string]ed25519.PrivateKey{}

// Create Targets metadata
targets := metadata.Targets(helperExpireIn(60))
targets := metadata.Targets(helperExpireIn(10))
roles.SetTargets("targets", targets)

// Add each target to Targets metadata
Expand All @@ -51,15 +51,15 @@ func main() {
}

// Create Snapshot metadata
snapshot := metadata.Snapshot(helperExpireIn(365))
snapshot := metadata.Snapshot(helperExpireIn(10))
roles.SetSnapshot(snapshot)

// Create Timestamp metadata
timestamp := metadata.Timestamp(helperExpireIn(365))
timestamp := metadata.Timestamp(helperExpireIn(10))
roles.SetTimestamp(timestamp)

// Create Root metadata
root := metadata.Root(helperExpireIn(365))
root := metadata.Root(helperExpireIn(10))
roles.SetRoot(root)

// For this example, we generate one private key of type 'ed25519' for each top-level role
Expand Down Expand Up @@ -162,9 +162,9 @@ func main() {
fmt.Println("Done! Metadata files location:", cwd)
}

// helperExpireIn returns time offset by days
func helperExpireIn(days int) time.Time {
return time.Now().AddDate(0, 0, days).UTC()
// helperExpireIn returns time offset by years (for the sake of the example)
func helperExpireIn(years int) time.Time {
return time.Now().AddDate(years, 0, 0).UTC()
}

// helperGetPathForTarget returns local and target paths for target
Expand Down
30 changes: 15 additions & 15 deletions examples/multirepo/repository/metadata/1.root.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
{
"signatures": [
{
"keyid": "858d7da5d484f24900fa9cf411f81e19001653a507fa6530c41fbe0a83359ec2",
"sig": "48178709d5b4296e19f7d9409c6fc2ba8a8a0568333b15cc8252b34541a3239a08b37adc721afc1394482b96e3ba3617e6ba4cd7ce048904472bdf161820c60c"
"keyid": "492e4e5660058c39cae70b380750e4f8ea86d0fc2047c795af9bbbe73cedd138",
"sig": "b434f25bd61a5cb7c53883b3d91c53b94e9312cd17e19f2b1e1089d73772fad542c0a91ef109404fe4cfabbd2d4cf3b0f7eaaca4fd012555014f75a23d49460a"
}
],
"signed": {
"_type": "root",
"consistent_snapshot": true,
"expires": "2024-08-30T17:08:16.58221527Z",
"expires": "2033-11-28T19:51:01.794266Z",
"keys": {
"27739df49cff443d8495054774a5d6e86ff2a92a5fdde619e0919caf6171e173": {
"492e4e5660058c39cae70b380750e4f8ea86d0fc2047c795af9bbbe73cedd138": {
"keytype": "ed25519",
"keyval": {
"public": "6b8860bc2395b3dfaa2e938753788ebc1a6d078d8b6c7c6ea5b6ec164fdfce1a"
"public": "3b70174991642fd8cfd4b1a4d834843f785db02ad98372b24eb54d06750dd732"
},
"scheme": "ed25519"
},
"4f345ceb09a215ed9167a6611afcc0fd6d9a0c4a747ef39d3998ad0730d5a48c": {
"8dcef43f9966d6b5c88cb10f7b5258361532de2151c65378bb8a21c281658696": {
"keytype": "ed25519",
"keyval": {
"public": "8b1e343aa4a58aedf7d45d4f100e2d478025ad7134ac728cf8e5d5c49ab1efda"
"public": "2f70d3d75e50f50cf9af3adcc20754ba2d17601801f36d61cacb9f73a7f798f9"
},
"scheme": "ed25519"
},
"858d7da5d484f24900fa9cf411f81e19001653a507fa6530c41fbe0a83359ec2": {
"a606e603cc4974a8fa894928cb165ce38a3f9948c245414bc71ef681caae9dc5": {
"keytype": "ed25519",
"keyval": {
"public": "93a8b2eeaae60f591211d2c8e20b04ff5897db56e59d1c4118b6aff89c2b4c5b"
"public": "3c3769ac5f74c8f2f84748586344ab8bbda9f0096859d5f37450dec1f5675434"
},
"scheme": "ed25519"
},
"8b310111e8ac39e006a8a12904f3219212bcfb0b9dbf9c2cf7c0f49d4d3edd35": {
"e92842caf93e6e50a64ec0a467dee5bbd06669a6474895b3d5133c69de33545b": {
"keytype": "ed25519",
"keyval": {
"public": "9dd181035fa996f1d1551689e2d86cefa21dad7cf2365d92ef4e743d90be52d1"
"public": "6b1daebaa9b926bb38c33fd7d4edc14e2e96f8795b2ffe6ed49adee6a1251b20"
},
"scheme": "ed25519"
}
},
"roles": {
"root": {
"keyids": [
"858d7da5d484f24900fa9cf411f81e19001653a507fa6530c41fbe0a83359ec2"
"492e4e5660058c39cae70b380750e4f8ea86d0fc2047c795af9bbbe73cedd138"
],
"threshold": 1
},
"snapshot": {
"keyids": [
"27739df49cff443d8495054774a5d6e86ff2a92a5fdde619e0919caf6171e173"
"8dcef43f9966d6b5c88cb10f7b5258361532de2151c65378bb8a21c281658696"
],
"threshold": 1
},
"targets": {
"keyids": [
"8b310111e8ac39e006a8a12904f3219212bcfb0b9dbf9c2cf7c0f49d4d3edd35"
"a606e603cc4974a8fa894928cb165ce38a3f9948c245414bc71ef681caae9dc5"
],
"threshold": 1
},
"timestamp": {
"keyids": [
"4f345ceb09a215ed9167a6611afcc0fd6d9a0c4a747ef39d3998ad0730d5a48c"
"e92842caf93e6e50a64ec0a467dee5bbd06669a6474895b3d5133c69de33545b"
],
"threshold": 1
}
Expand Down
6 changes: 3 additions & 3 deletions examples/multirepo/repository/metadata/1.snapshot.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"signatures": [
{
"keyid": "27739df49cff443d8495054774a5d6e86ff2a92a5fdde619e0919caf6171e173",
"sig": "c05a17a6a3e077470ade6e30d97df1f8d8e1c0831712515f62728b64ae563db8c2de9c904649a230ce74ed92a634f6b621d5f2a737f0de29bb9061ce6b303100"
"keyid": "8dcef43f9966d6b5c88cb10f7b5258361532de2151c65378bb8a21c281658696",
"sig": "e0f197531eec1a8aeea48014f4459206d59546c1a6a3ab5ea18910b229b51fe6475822fae0005fd8ff611944ca6e8b5c3b286a572d1812e561d55fdeafad9704"
}
],
"signed": {
"_type": "snapshot",
"expires": "2024-08-30T17:08:16.582209049Z",
"expires": "2033-11-28T19:51:01.794264Z",
"meta": {
"targets.json": {
"version": 1
Expand Down
6 changes: 3 additions & 3 deletions examples/multirepo/repository/metadata/1.targets.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"signatures": [
{
"keyid": "8b310111e8ac39e006a8a12904f3219212bcfb0b9dbf9c2cf7c0f49d4d3edd35",
"sig": "e20685a0fc000d1bec6ae1625132f74f78992400ef9724517051c631e83cd73dc2c7f86016d11b43693b1e6ded59d7274099c700420525480ad16ee89f749e09"
"keyid": "a606e603cc4974a8fa894928cb165ce38a3f9948c245414bc71ef681caae9dc5",
"sig": "4c2ad791fe1b2d23b4a7292120b493c61795cb23519b2f23b9c17a25a1078b7cdf72f052fe4ddc583e45ef6ab6ca809f35c192bdf60649ba371bc063a62cbd05"
}
],
"signed": {
"_type": "targets",
"expires": "2023-10-30T18:08:16.571163566Z",
"expires": "2033-11-28T19:51:01.793233Z",
"spec_version": "1.0.31",
"targets": {
"map.json": {
Expand Down
6 changes: 3 additions & 3 deletions examples/multirepo/repository/metadata/timestamp.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"signatures": [
{
"keyid": "4f345ceb09a215ed9167a6611afcc0fd6d9a0c4a747ef39d3998ad0730d5a48c",
"sig": "7dd2d9fd319e24c21d93e97e63545089400f8622257d6088d49df007b9de88a2f67109d32559d51d27add09abd8e73099c345d56397a8cfaec76847d3a25a100"
"keyid": "e92842caf93e6e50a64ec0a467dee5bbd06669a6474895b3d5133c69de33545b",
"sig": "41670fd3ca12b41a5f3109e6537646586099108c693c913d75570a47ff72e8910b32858a80be6f2ba058c0993af84de4f26a7b5a93b3322e0cf8d10e37352609"
}
],
"signed": {
"_type": "timestamp",
"expires": "2024-08-30T17:08:16.582213737Z",
"expires": "2033-11-28T19:51:01.794266Z",
"meta": {
"snapshot.json": {
"version": 1
Expand Down

0 comments on commit dd861e9

Please sign in to comment.