Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gotez v2 #495

Merged
merged 6 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading