Skip to content

Commit

Permalink
Gotez v2 (#495)
Browse files Browse the repository at this point in the history
* deps versions bump

* gotez updated to v2.0

* rebuild go.sum

* more renamed ops

* integration test updated
  • Loading branch information
e-asphyx authored Jan 26, 2024
1 parent 19a3a06 commit e38fcbf
Show file tree
Hide file tree
Showing 51 changed files with 215 additions and 1,289 deletions.
8 changes: 4 additions & 4 deletions cmd/approve-list-svc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/pem"
"errors"
"fmt"
"io/ioutil"
"net"
"os"

"github.com/ecadlabs/signatory/pkg/crypt"
"github.com/ecadlabs/gotez/v2/crypt"
"github.com/ecadlabs/signatory/pkg/cryptoutils"
yaml "gopkg.in/yaml.v3"
)
Expand Down Expand Up @@ -51,7 +51,7 @@ func (conf *Config) GetPrivateKey() (crypt.PrivateKey, error) {
return nil, nil
}
var err error
if keyData, err = ioutil.ReadFile(conf.PrivateKeyFile); err != nil {
if keyData, err = os.ReadFile(conf.PrivateKeyFile); err != nil {
return nil, err
}
}
Expand All @@ -64,7 +64,7 @@ func (conf *Config) GetPrivateKey() (crypt.PrivateKey, error) {
}

func ReadConfig(file string) (*Config, error) {
yamlFile, err := ioutil.ReadFile(file)
yamlFile, err := os.ReadFile(file)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/approve-list-svc/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net"
"net/http"

"github.com/ecadlabs/signatory/pkg/crypt"
"github.com/ecadlabs/gotez/v2/crypt"
"github.com/ecadlabs/signatory/pkg/signatory"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/approve-list-svc/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"net/http/httptest"
"testing"

"github.com/ecadlabs/gotez/v2/crypt"
"github.com/ecadlabs/signatory/cmd/approve-list-svc/server"
"github.com/ecadlabs/signatory/pkg/auth"
"github.com/ecadlabs/signatory/pkg/config"
"github.com/ecadlabs/signatory/pkg/crypt"
"github.com/ecadlabs/signatory/pkg/hashmap"
"github.com/ecadlabs/signatory/pkg/signatory"
"github.com/ecadlabs/signatory/pkg/vault"
Expand Down
22 changes: 7 additions & 15 deletions cmd/commands/list_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"sort"
"text/template"

"github.com/ecadlabs/gotez/encoding"
"github.com/ecadlabs/gotez/protocol"
"github.com/ecadlabs/signatory/pkg/signatory/request"
"github.com/ecadlabs/gotez/v2/encoding"
"github.com/ecadlabs/gotez/v2/protocol"
"github.com/ecadlabs/gotez/v2/protocol/latest"
"github.com/spf13/cobra"
)

Expand All @@ -33,13 +33,9 @@ func NewListRequests(c *Context) *cobra.Command {
Use: "list-requests",
Short: "Print possible request types",
RunE: func(cmd *cobra.Command, args []string) error {
kindsMap := make(map[string]struct{})
encoding.ForEachInEnum(func(tag uint8, req request.SignRequest) {
kindsMap[req.RequestKind()] = struct{}{}
})
var kinds []string
for k := range kindsMap {
kinds = append(kinds, k)
for _, k := range encoding.ListVariants[protocol.SignRequest]() {
kinds = append(kinds, k.SignRequestKind())
}
sort.Strings(kinds)
return listReqTpl.Execute(os.Stdout, kinds)
Expand All @@ -54,13 +50,9 @@ func NewListOps(c *Context) *cobra.Command {
Use: "list-ops",
Short: "Print possible operation types inside the `generic` request",
RunE: func(cmd *cobra.Command, args []string) error {
opsMap := make(map[string]struct{})
encoding.ForEachInEnum(func(tag uint8, req protocol.OperationContents) {
opsMap[req.OperationKind()] = struct{}{}
})
var ops []string
for k := range opsMap {
ops = append(ops, k)
for _, k := range encoding.ListVariants[latest.OperationContents]() {
ops = append(ops, k.OperationKind())
}
sort.Strings(ops)
return listOpsTpl.Execute(os.Stdout, ops)
Expand Down
4 changes: 2 additions & 2 deletions cmd/signatory-tools/authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"encoding/hex"
"fmt"

"github.com/ecadlabs/gotez/b58"
"github.com/ecadlabs/signatory/pkg/crypt"
"github.com/ecadlabs/gotez/v2/b58"
"github.com/ecadlabs/gotez/v2/crypt"
"github.com/ecadlabs/signatory/pkg/signatory"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/signatory-tools/genkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/decred/dcrd/dcrec/secp256k1/v4"
"github.com/ecadlabs/goblst/minpk"
"github.com/ecadlabs/signatory/pkg/crypt"
"github.com/ecadlabs/gotez/v2/crypt"
"github.com/spf13/cobra"
)

Expand Down
14 changes: 8 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/certusone/yubihsm-go v0.3.0
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
github.com/ecadlabs/goblst v1.0.0
github.com/ecadlabs/gotez v1.0.0
github.com/ecadlabs/gotez/v2 v2.0.1
github.com/go-playground/validator/v10 v10.16.0
github.com/google/tink/go v1.7.0
github.com/google/uuid v1.4.0
Expand All @@ -20,7 +20,7 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.16.0
golang.org/x/crypto v0.18.0
golang.org/x/exp v0.0.0-20231127185646-65229373498e
golang.org/x/oauth2 v0.15.0
google.golang.org/api v0.152.0
Expand All @@ -33,6 +33,7 @@ require (
cloud.google.com/go/iam v1.1.5 // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/ecadlabs/pretty v0.0.0-20230412124801-f948fc689a04 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/google/s2a-go v0.1.7 // indirect
Expand All @@ -51,6 +52,7 @@ require (
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/time v0.5.0 // indirect
Expand All @@ -70,22 +72,22 @@ require (
github.com/golang-jwt/jwt/v5 v5.2.0
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)

// replace github.com/ecadlabs/gotez/v2 => ../gotez
Loading

0 comments on commit e38fcbf

Please sign in to comment.