From 58d3830c85f0cbc7c7b79a7d66dd0353a1b7428e Mon Sep 17 00:00:00 2001 From: Yolan Romailler Date: Mon, 14 Oct 2024 19:39:33 +0200 Subject: [PATCH 1/4] Updating to v1.3.0 --- .gitignore | 3 ++ README.md | 25 ++++++------ cmd/tle/commands/commands.go | 4 +- go.mod | 27 ++++++------- go.sum | 58 +++++++++++++++------------- tlock.go | 8 ++-- tlock_age.go | 75 ++++++++++++++++++++++++++++++++---- tlock_age_test.go | 4 +- tlock_test.go | 42 ++++++++++---------- 9 files changed, 157 insertions(+), 89 deletions(-) diff --git a/.gitignore b/.gitignore index b0dc685..e9546f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# binaries +cmd/age-plugin-tlock/age-plugin-tlock +cmd/tle/tle # Mac files .DS* diff --git a/README.md b/README.md index 1b9c1f0..cf9ea02 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Working endpoints to access it are, on mainnet: - https://drand.cloudflare.com/ (load-balanced across regions) On mainnet, the only chainhash supporting timelock encryption, with a 3s frequency and signatures on the G1 group is: -`dbd506d6ef76e5f386f41c651dcb808c5bcbd75471cc4eafa3f4df7ad4e4c493` +`52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971` This is a production-ready network with high-availability guarantees. It is considered fully secure by the drand team and ran by the same League of Entropy that has been running drand in production since 2019. @@ -99,8 +99,6 @@ NETWORK defaults to the drand mainnet endpoint https://api.drand.sh/. CHAIN defaults to the chainhash of quicknet: 52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971 -it used to be that of the fastnet network, but that one is being deprecated: -dbd506d6ef76e5f386f41c651dcb808c5bcbd75471cc4eafa3f4df7ad4e4c493 You can also use the drand test network: https://pl-us.testnet.drand.sh/ @@ -128,13 +126,13 @@ $ tle -n="https://pl-us.testnet.drand.sh/" -c="7672797f548f3f4748ac4bf3352fc6c6b If a round (`--round/-R`) number is known, it can be used instead of the duration. The data can be decrypted only when that round becomes available in the network. -Example using the fastnet mainnet network and a given round: +Example using an EU relay, the quicknet chainhash and a given round 123456: ```bash -$ tle -n="https://api.drand.sh/" -c="dbd506d6ef76e5f386f41c651dcb808c5bcbd75471cc4eafa3f4df7ad4e4c493" -r=123456 -o=encrypted_data data.txt +$ tle -n="https://api2.drand.sh/" -c="52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971" -r=123456 -o=encrypted_data data.txt ``` It is also possible to encrypt the data to a PEM encoded format using the armor (`--armor/-a`) flag, -and to rely on the default network and chain hash (which is the `fastnet` one on `api.drand.sh`): +and to rely on the default network and chain hash (which is the `quicknet` one on `api.drand.sh`): ```bash $ tle -a -D 20s -o=encrypted_data.PEM data.txt ``` @@ -142,8 +140,9 @@ $ tle -a -D 20s -o=encrypted_data.PEM data.txt #### Timelock Decryption For decryption, it's only necessary to specify the network if you're not using the default one. +Since v1.3.0, some auto-detection of chainhash and network is done upon decryption. -Using the default ("fastnet" network on mainnet) and printing on stdout: +Using the default values, and printing on stdout: ```bash $ tle -d encrypted_data ``` @@ -161,9 +160,9 @@ If decoding an armored source you don't need to specify `-a` again. ### Library Usage -These example show how to use the API to time lock encrypt and decrypt data. +These example show how to use the API to timelock encrypt and decrypt data. -#### Time Lock Encryption +#### Timelock Encryption ```go // Open an io.Reader to the data to be encrypted. @@ -174,9 +173,9 @@ if err != nil { } defer in.Close() -// Construct a network that can talk to a drand network. Example using the mainnet fastnet network. +// Construct a network that can talk to a drand network. Example using the mainnet quicknet network. // host: "https://api.drand.sh/" -// chainHash: "dbd506d6ef76e5f386f41c651dcb808c5bcbd75471cc4eafa3f4df7ad4e4c493" +// chainHash: "52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971" network,err := http.NewNetwork(host, chainHash) if err != nil { log.Fatalf("new network: %s", err) @@ -199,7 +198,7 @@ if err := tlock.New(network).Encrypt(&cipherData, in, roundNumber); err != nil { } ``` -#### Time Lock Decryption +#### Timelock Decryption ```go // Open an io.Reader to the data to be decrypted. @@ -212,7 +211,7 @@ defer in.Close() // Construct a network that can talk to a drand network. // host: "https://api.drand.sh/" -// chainHash: "dbd506d6ef76e5f386f41c651dcb808c5bcbd75471cc4eafa3f4df7ad4e4c493" +// chainHash: "52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971" network,err := http.NewNetwork(host, chainHash) if err != nil { log.Fatalf("new network: %s", err) diff --git a/cmd/tle/commands/commands.go b/cmd/tle/commands/commands.go index f134ba5..f64faf9 100644 --- a/cmd/tle/commands/commands.go +++ b/cmd/tle/commands/commands.go @@ -21,7 +21,7 @@ const ( // ============================================================================= -const usage = `tlock v1.2.0 -- github.com/drand/tlock +const usage = `tlock v1.3.0 -- github.com/drand/tlock Usage: tle [--encrypt] (-r round)... [--armor] [-o OUTPUT] [INPUT] @@ -46,8 +46,6 @@ NETWORK defaults to the drand mainnet endpoint https://api.drand.sh/. CHAIN defaults to the chainhash of quicknet: 52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971 -it used to be that of the fastnet network, but that one is being deprecated: -dbd506d6ef76e5f386f41c651dcb808c5bcbd75471cc4eafa3f4df7ad4e4c493 You can also use the drand test network: https://pl-us.testnet.drand.sh/ diff --git a/go.mod b/go.mod index ff19da1..1d30dfc 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module github.com/drand/tlock -go 1.22 +go 1.23 require ( - filippo.io/age v1.1.1 - github.com/drand/drand/v2 v2.0.2 - github.com/drand/go-clients v0.2.0 + filippo.io/age v1.2.0 + github.com/drand/drand/v2 v2.0.4 + github.com/drand/go-clients v0.2.1 github.com/drand/kyber v1.3.1 github.com/drand/kyber-bls12381 v0.3.1 github.com/stretchr/testify v1.9.0 @@ -14,10 +14,11 @@ require ( require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/klauspost/compress v1.17.11 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.dedis.ch/fixbuf v1.0.3 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240723171418-e6d459c13d2a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect ) require ( @@ -30,16 +31,16 @@ require ( github.com/kelseyhightower/envconfig v1.4.0 github.com/kilic/bls12-381 v0.1.0 // indirect github.com/nikkolasg/hexjson v0.1.0 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.4 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - 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/grpc v1.65.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + golang.org/x/crypto v0.28.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + google.golang.org/grpc v1.67.1 // indirect + google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/go.sum b/go.sum index bb748f7..73a7a95 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ -filippo.io/age v1.1.1 h1:pIpO7l151hCnQ4BdyBujnGP2YlUo0uj6sAVNHGBvXHg= -filippo.io/age v1.1.1/go.mod h1:l03SrzDUrBkdBx8+IILdnn2KZysqQdbEBUQ4p3sqEQE= +c2sp.org/CCTV/age v0.0.0-20240306222714-3ec4d716e805 h1:u2qwJeEvnypw+OCPUHmoZE3IqwfuN5kgDfo5MLzpNM0= +c2sp.org/CCTV/age v0.0.0-20240306222714-3ec4d716e805/go.mod h1:FomMrUJ2Lxt5jCLmZkG3FHa72zUprnhd3v/Z18Snm4w= +filippo.io/age v1.2.0 h1:vRDp7pUMaAJzXNIWJVAZnEf/Dyi4Vu4wI8S1LBzufhE= +filippo.io/age v1.2.0/go.mod h1:JL9ew2lTN+Pyft4RiNGguFfOpewKwSHm5ayKD/A4004= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/ardanlabs/darwin/v2 v2.0.0 h1:XCisQMgQ5EG+ZvSEcADEo+pyfIMKyWAGnn5o2TgriYE= @@ -20,10 +22,10 @@ github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJ github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/drand/drand/v2 v2.0.2 h1:F0cvopmZWZA8NLRnpXE2+qVR13aNQZeCElYlWswcigM= -github.com/drand/drand/v2 v2.0.2/go.mod h1:nWBj4w7TA3R8xCoyLzkmsESjTlg4QgNSFAiRR9qZXt8= -github.com/drand/go-clients v0.2.0 h1:2agHJkF2OOjd9Eij/YedQnDc9mW0rywV/9xUHbf2XoQ= -github.com/drand/go-clients v0.2.0/go.mod h1:4m2qC/O8lx2Aj6DEIrEZ4kUzAUV6BIjmiSouW6lpYfI= +github.com/drand/drand/v2 v2.0.4 h1:aHV+WAisUaIz/m/xyxRtKGz1WJ5K2Ta1L0csA/ICDRU= +github.com/drand/drand/v2 v2.0.4/go.mod h1:nWBj4w7TA3R8xCoyLzkmsESjTlg4QgNSFAiRR9qZXt8= +github.com/drand/go-clients v0.2.1 h1:A2MpNKKrkRue4W/RIWoERjWwImvSpX0im+CqES7oF/c= +github.com/drand/go-clients v0.2.1/go.mod h1:4m2qC/O8lx2Aj6DEIrEZ4kUzAUV6BIjmiSouW6lpYfI= github.com/drand/kyber v1.3.1 h1:E0p6M3II+loMVwTlAp5zu4+GGZFNiRfq02qZxzw2T+Y= github.com/drand/kyber v1.3.1/go.mod h1:f+mNHjiGT++CuueBrpeMhFNdKZAsy0tu03bKq9D5LPA= github.com/drand/kyber-bls12381 v0.3.1 h1:KWb8l/zYTP5yrvKTgvhOrk2eNPscbMiUOIeWBnmUxGo= @@ -61,10 +63,14 @@ github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dv github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4= github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= +github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= +github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= @@ -77,12 +83,12 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= +github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= @@ -119,23 +125,23 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= -google.golang.org/genproto/googleapis/api v0.0.0-20240723171418-e6d459c13d2a h1:YIa/rzVqMEokBkPtydCkx1VLmv3An1Uw7w1P1m6EhOY= -google.golang.org/genproto/googleapis/api v0.0.0-20240723171418-e6d459c13d2a/go.mod h1:AHT0dDg3SoMOgZGnZk29b5xTbPHMoEC8qthmBLJCpys= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240723171418-e6d459c13d2a h1:hqK4+jJZXCU4pW7jsAdGOVFIfLHQeV7LaizZKnZ84HI= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240723171418-e6d459c13d2a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/tlock.go b/tlock.go index 49965af..a56be55 100644 --- a/tlock.go +++ b/tlock.go @@ -1,5 +1,5 @@ // Package tlock provides an API for encrypting/decrypting data using -// drand time lock encryption. This allows data to be encrypted and only +// drand timelock encryption. This allows data to be encrypted and only // decrypted in the future. package tlock @@ -39,7 +39,7 @@ type Network interface { // ============================================================================= -// Tlock provides an API for time lock encryption and decryption. +// Tlock provides an API for timelock encryption and decryption. type Tlock struct { network Network trustChainhash bool @@ -64,7 +64,7 @@ func (t Tlock) Strict() Tlock { // Encrypt will encrypt the source and write that to the destination. The encrypted // data will not be decryptable until the specified round is reached by the network. func (t Tlock) Encrypt(dst io.Writer, src io.Reader, roundNumber uint64) (err error) { - w, err := age.Encrypt(dst, &tleRecipient{network: t.network, roundNumber: roundNumber}) + w, err := age.Encrypt(dst, &Recipient{network: t.network, roundNumber: roundNumber}) if err != nil { return fmt.Errorf("hybrid encrypt: %w", err) } @@ -94,7 +94,7 @@ func (t Tlock) Decrypt(dst io.Writer, src io.Reader) error { src = rr } - r, err := age.Decrypt(src, &tleIdentity{network: t.network, trustChainhash: t.trustChainhash}) + r, err := age.Decrypt(src, &Identity{network: t.network, trustChainhash: t.trustChainhash}) if err != nil { return fmt.Errorf("hybrid decrypt: %w", err) } diff --git a/tlock_age.go b/tlock_age.go index 3594c92..0a57d1c 100644 --- a/tlock_age.go +++ b/tlock_age.go @@ -1,10 +1,12 @@ package tlock import ( + "encoding/hex" "errors" "fmt" "os" "strconv" + "strings" "time" "filippo.io/age" @@ -13,17 +15,35 @@ import ( var ErrWrongChainhash = errors.New("invalid chainhash") -// tleRecipient implements the age Recipient interface. This is used to encrypt +// Recipient implements the age Recipient interface. This is used to encrypt // data with the age Encrypt API. -type tleRecipient struct { +type Recipient struct { network Network roundNumber uint64 } +func NewRecipient(network Network, roundNumber uint64) *Recipient { + return &Recipient{ + network: network, + roundNumber: roundNumber, + } +} + +func (t *Recipient) SetNetwork(network Network) { + t.network = network +} + +// SetRound allows you to set the round number towards which you'd like to timelock encrypt data +// the Wrap process will then fetch the public key and appropriate scheme from the Recipient's +// network and Wrap filekeys toward that round number using timelock encryption. +func (t *Recipient) SetRound(round uint64) { + t.roundNumber = round +} + // Wrap is called by the age Encrypt API and is provided the DEK generated by // age that is used for encrypting/decrypting data. Inside of Wrap we encrypt -// the DEK using time lock encryption. -func (t *tleRecipient) Wrap(fileKey []byte) ([]*age.Stanza, error) { +// the DEK using timelock encryption. +func (t *Recipient) Wrap(fileKey []byte) ([]*age.Stanza, error) { ciphertext, err := TimeLock(t.network.Scheme(), t.network.PublicKey(), t.roundNumber, fileKey) if err != nil { return nil, fmt.Errorf("encrypt dek: %w", err) @@ -43,20 +63,50 @@ func (t *tleRecipient) Wrap(fileKey []byte) ([]*age.Stanza, error) { return []*age.Stanza{&stanza}, nil } +func (t *Recipient) String() string { + sb := strings.Builder{} + + sb.WriteString(fmt.Sprintf("%d@", t.roundNumber)) + sb.WriteString(t.network.ChainHash()) + sb.WriteString("-" + t.network.Scheme().Name) + d, err := t.network.PublicKey().MarshalBinary() + if err != nil { + d = []byte("error") + } + sb.WriteString("-" + hex.EncodeToString(d)) + + return sb.String() +} + // ============================================================================= -// tleIdentity implements the age Identity interface. This is used to decrypt +// Identity implements the age Identity interface. This is used to decrypt // data with the age Decrypt API. -type tleIdentity struct { +type Identity struct { network Network trustChainhash bool } +func NewIdentity(network Network, trustChainhash bool) *Identity { + return &Identity{ + network: network, + trustChainhash: trustChainhash, + } +} + +func (t *Identity) SetNetwork(network Network) { + t.network = network +} + +func (t *Identity) SetTrust(trust bool) { + t.trustChainhash = trust +} + // Unwrap is called by the age Decrypt API and is provided the DEK that was time // lock encrypted by the Wrap function via the Stanza. Inside of Unwrap we decrypt // the DEK and provide back to age. If the ciphertext uses a chainhash different // from the one we are current using, we will try switching to it. -func (t *tleIdentity) Unwrap(stanzas []*age.Stanza) ([]byte, error) { +func (t *Identity) Unwrap(stanzas []*age.Stanza) ([]byte, error) { if len(stanzas) < 1 { return nil, errors.New("check stanzas length: should be at least one") } @@ -123,3 +173,14 @@ func (t *tleIdentity) Unwrap(stanzas []*age.Stanza) ([]byte, error) { return nil, fmt.Errorf("check stanza type: wrong type: %w", age.ErrIncorrectIdentity) } + +func (t *Identity) String() string { + sb := strings.Builder{} + + sb.WriteString(fmt.Sprintf("Trust:%v@", t.trustChainhash)) + sb.WriteString(t.network.ChainHash()) + sb.WriteString("-" + t.network.Scheme().Name) + sb.WriteString("-" + t.network.PublicKey().String()) + + return sb.String() +} diff --git a/tlock_age_test.go b/tlock_age_test.go index ac55559..18024ae 100644 --- a/tlock_age_test.go +++ b/tlock_age_test.go @@ -20,7 +20,7 @@ func Test_WrapUnwrap(t *testing.T) { t.Fatalf("network error %s", err) } - recipient := tleRecipient{ + recipient := Recipient{ roundNumber: network.RoundNumber(time.Now()), network: network, } @@ -36,7 +36,7 @@ func Test_WrapUnwrap(t *testing.T) { t.Fatalf("wrap error %s", err) } - identity := tleIdentity{ + identity := Identity{ network: network, } diff --git a/tlock_test.go b/tlock_test.go index 2136c56..bd5a7b2 100644 --- a/tlock_test.go +++ b/tlock_test.go @@ -31,13 +31,12 @@ const ( testnetUnchainedOnG2 = "7672797f548f3f4748ac4bf3352fc6c6b6468c9ad40ad456a397545c6e2df5bf" testnetQuicknetT = "cc9c398442737cbd141526600919edd69f1d6f9b4adb67e4d912fbc64341a9a5" mainnetHost = "http://api.drand.sh/" - mainnetFastnet = "dbd506d6ef76e5f386f41c651dcb808c5bcbd75471cc4eafa3f4df7ad4e4c493" mainnetQuicknet = "52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971" ) func TestEarlyDecryptionWithDuration(t *testing.T) { for host, hashes := range map[string][]string{testnetHost: {testnetUnchainedOnG2, testnetQuicknetT}, - mainnetHost: {mainnetFastnet, mainnetQuicknet}} { + mainnetHost: {mainnetQuicknet}} { for _, hash := range hashes { network, err := http.NewNetwork(host, hash) require.NoError(t, err) @@ -293,17 +292,17 @@ func TestCannotEncryptWithPointAtInfinity(t *testing.T) { func TestDecryptText(t *testing.T) { cipher := `-----BEGIN AGE ENCRYPTED FILE----- -YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHRsb2NrIDIgZGJkNTA2ZDZlZjc2ZTVm -Mzg2ZjQxYzY1MWRjYjgwOGM1YmNiZDc1NDcxY2M0ZWFmYTNmNGRmN2FkNGU0YzQ5 -MwpzRXAvVVpBQXlDSjE1QUxDaUFnQ1E2cEd1elJXS0kzMkpsQnBxUFAzcHVvdWRT -a2w0OXJ0NC9rMmd0UHlVMTRxCkN3MERjVUJVUlloT2UrRjZsSE9lTFgwMkZNMjk3 -UGpwNlBZL09WY3NoblhqMTVMbU9FeXV1MjlDcmJGQXU3SmgKcWxlbjFtaXBONWUz -eFpVQysxQWtjS1Z3SU9uRjJWaW8veUpkNEUyVHhQWQotLS0gN21xSHhranNqMEND -UG9qN2haU0FWdEpFK0pUZzUwWmVsVS9YRWdOaDRadwpeDBRfXZtLOC49GlI+Kozr -z6hgtLUPYvAimgekc+CeyJ8fb/0MVrpq/Ewnx1MpKig8nQ== +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHRsb2NrIDEyMDQwODgzIDUyZGI5YmE3 +MGUwY2MwZjZlYWY3ODAzZGQwNzQ0N2ExZjU0Nzc3MzVmZDNmNjYxNzkyYmE5NDYw +MGM4NGU5NzEKa1JjK01NSEUwS005b1V0SmNLTWZGb1JFVzBXN1JQbTNtdzZpVUJ1 +cGNXVkZkZDJQb1h6U0JrK25TM01BNnBKNwpHZDl3REhmVU5hTldXTWw2cGVia2Jh +OUVNZGJDWnBuQVNtOWFIb3hqUitwaGFVT2xoS1ppZGl5ZHBLSStPS2N0CmxvT2ZP +SW9KaGtndTVTRnJUOGVVQTJUOGk3aTBwQlBzTDlTWUJUZEJQb28KLS0tIEl6Q1Js +WSt1RXp0d21CbEg0cTFVZGNJaW9pS2l0M0c0bHVxNlNjT2w3UUUKDI4cDlPHPgjy +UnBmtsw6U2LlKh8iDf0E1PfwDenmKFfQaAGm0WLxdlzP8Q== -----END AGE ENCRYPTED FILE-----` t.Run("With valid network", func(tt *testing.T) { - network, err := http.NewNetwork(mainnetHost, mainnetFastnet) + network, err := http.NewNetwork(mainnetHost, mainnetQuicknet) require.NoError(tt, err) testReader := strings.NewReader(cipher) @@ -312,7 +311,7 @@ z6hgtLUPYvAimgekc+CeyJ8fb/0MVrpq/Ewnx1MpKig8nQ== err = tlock.New(network).Decrypt(&plainData, testReader) require.NoError(tt, err) - require.Equal(tt, "Hello drand World\n", plainData.String()) + require.Equal(tt, "hello world", plainData.String()) }) t.Run("With invalid network", func(tt *testing.T) { @@ -341,17 +340,18 @@ z6hgtLUPYvAimgekc+CeyJ8fb/0MVrpq/Ewnx1MpKig8nQ== func TestInteropWithJS(t *testing.T) { t.Run("on Mainnet with G1 sigs", func(t *testing.T) { cipher := `-----BEGIN AGE ENCRYPTED FILE----- -YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHRsb2NrIDEgZGJkNTA2ZDZlZjc2ZTVm -Mzg2ZjQxYzY1MWRjYjgwOGM1YmNiZDc1NDcxY2M0ZWFmYTNmNGRmN2FkNGU0YzQ5 -MwpvMTZVWGpocTM2Y0U0aExDY3B2SThMNEJhNzNLbXZ1T3dUR0x4L2QvMWdISTdk -cDBWbE9IeUhXYUxaalNEUUlSCkIxZHBJeG82RVVLekFMU1FtQ1VFbjhwZHNHMHRy -anlsZjJPTFZHelNYdFhwQXhPSEljbnY2SVp1ck1sZ3RybDIKTk1KOWhsSWZoOFEz -Z3MrWGNCc0F2NGY2L2k5dVJlZlFJeUhtU1AvMDZxdwotLS0gbEtQSXMzeVNZMmUw -RndkR1oyL0xFTkZILzl4Y3NBOU5EWXRGcDBObmZidwpiI9yHPl4yVTbeImtNOklv -Ds7/d2pdgkRooMJ58zoZd+AFXtAn2+7yGehvtkrWoSxgA8cf1aLuHFTAHho= +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHRsb2NrIDEyMDQxMTI1IDUyZGI5YmE3 +MGUwY2MwZjZlYWY3ODAzZGQwNzQ0N2ExZjU0Nzc3MzVmZDNmNjYxNzkyYmE5NDYw +MGM4NGU5NzEKbDNtWFdseFRIS0YxQi9HZGYyMzJ0cmkveDFWZk5zVDMwS002eExV +NXUwbFFqQVdNSFJmVHJYbnFJOWpHWWM4ZApETmVodVhaUm8zay9HVzVMVDNaN1M1 +d3JVN0lvQVNQUy9xY3JjODNIWEplY25wTXVJS1ZTM3Fyc0NvZzJiZW1OCjVJQmRD +VDU4UUZGeVJ5QzRlRUFZU092NWl0b3E2UWw1RDh6WEtVdmdTTFkKLS0tIEk5c0th +Mi9yeEF2ZDFlL1paTFlIV2VZYkVZVjlreDFidE1wWm1rMU51QkUKxCgEsEjSEixh +4nEBtpolrubLO6WwhfWuh5ZFewjuXbSyrJGreivurDm+7y5stuDO6xPVRpcU+eSQ +RLrz -----END AGE ENCRYPTED FILE-----` expected := "hello world and other things" - network, err := http.NewNetwork(mainnetHost, mainnetFastnet) + network, err := http.NewNetwork(mainnetHost, mainnetQuicknet) require.NoError(t, err) testReader := strings.NewReader(cipher) From 690e01eb59eabf0ad24c52c0333b001f03f101f8 Mon Sep 17 00:00:00 2001 From: Yolan Romailler Date: Mon, 14 Oct 2024 19:41:02 +0200 Subject: [PATCH 2/4] Adding the notion of fixed network --- networks/fixed/fixed.go | 84 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 networks/fixed/fixed.go diff --git a/networks/fixed/fixed.go b/networks/fixed/fixed.go new file mode 100644 index 0000000..7cb216a --- /dev/null +++ b/networks/fixed/fixed.go @@ -0,0 +1,84 @@ +// Package fixed implements the Network interface for the tlock package without actual networking. +package fixed + +import ( + "errors" + "time" + + chain "github.com/drand/drand/v2/common" + "github.com/drand/drand/v2/crypto" + + "github.com/drand/kyber" +) + +// Network represents the network support using the drand http client. +type Network struct { + chainHash string + publicKey kyber.Point + scheme *crypto.Scheme + period time.Duration + genesis int64 + fixedSig []byte +} + +// ErrNotUnchained represents an error when the informed chain belongs to a +// chained network. +var ErrNotUnchained = errors.New("not an unchained network") + +// NewNetwork constructs a network with static, fixed data +func NewNetwork(chainHash string, publicKey kyber.Point, sch *crypto.Scheme, period time.Duration, genesis int64, sig []byte) (*Network, error) { + switch sch.Name { + case crypto.ShortSigSchemeID: + case crypto.SigsOnG1ID: + case crypto.UnchainedSchemeID: + default: + return nil, ErrNotUnchained + } + + return &Network{ + chainHash: chainHash, + publicKey: publicKey, + scheme: sch, + period: period, + genesis: genesis, + fixedSig: sig, + }, nil +} + +// ChainHash returns the chain hash for this network. +func (n *Network) ChainHash() string { + return n.chainHash +} + +// Current returns the current round for that network at the given date. +func (n *Network) Current(date time.Time) uint64 { + return chain.CurrentRound(date.Unix(), n.period, n.genesis) +} + +// PublicKey returns the kyber point needed for encryption and decryption. +func (n *Network) PublicKey() kyber.Point { + return n.publicKey +} + +// Scheme returns the drand crypto Scheme used by the network. +func (n *Network) Scheme() crypto.Scheme { + return *n.scheme +} + +// Signature only returns a fixed signature if set with the fixed network +func (n *Network) Signature(_ uint64) ([]byte, error) { + return n.fixedSig, nil +} + +// RoundNumber will return the latest round of randomness that is available +func (n *Network) RoundNumber(t time.Time) uint64 { + // + 1 because round 1 happened at genesis time + // integer division makes sure it ticks only every period + return uint64(((t.Unix() - n.genesis) / int64(n.period.Seconds())) + 1) +} + +// SwitchChainHash allows to start using another chainhash on the same host network +func (n *Network) SwitchChainHash(c string) error { + n.chainHash = c + return nil +} From e635ca882b1c63b367682da825cfb898ea3bdd41 Mon Sep 17 00:00:00 2001 From: Yolan Romailler Date: Mon, 14 Oct 2024 19:44:37 +0200 Subject: [PATCH 3/4] Use fulltext Apache license --- LICENSE-APACHE | 202 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 199 insertions(+), 3 deletions(-) diff --git a/LICENSE-APACHE b/LICENSE-APACHE index 14478a3..261eeb9 100644 --- a/LICENSE-APACHE +++ b/LICENSE-APACHE @@ -1,5 +1,201 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -http://www.apache.org/licenses/LICENSE-2.0 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From de2776c7dc4843eee3e293cb037b8eed5b7902f2 Mon Sep 17 00:00:00 2001 From: Yolan Romailler Date: Tue, 15 Oct 2024 13:23:20 +0200 Subject: [PATCH 4/4] Updating GHA to Go 1.23 --- .github/workflows/go.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index bf3bd56..2d3ddc6 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' - name: Staticheck run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc3bc30..53ddd7f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' - run: go version - name: Run GoReleaser