From fe4cdad9abef301e0e171c182ee3a408c581756a Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Wed, 30 Nov 2022 14:28:26 -0800 Subject: [PATCH 1/3] Updates to crypto, and change lib main.go to nkeys.go Signed-off-by: Derek Collison --- go.mod | 4 ++-- go.sum | 11 ++--------- main.go => nkeys.go | 0 main_test.go => nkeys_test.go | 0 4 files changed, 4 insertions(+), 11 deletions(-) rename main.go => nkeys.go (100%) rename main_test.go => nkeys_test.go (100%) diff --git a/go.mod b/go.mod index 856321f..59175d0 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/nats-io/nkeys -go 1.16 +go 1.19 -require golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 +require golang.org/x/crypto v0.3.0 diff --git a/go.sum b/go.sum index bf6f3dc..f747132 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,2 @@ -golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM= -golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= diff --git a/main.go b/nkeys.go similarity index 100% rename from main.go rename to nkeys.go diff --git a/main_test.go b/nkeys_test.go similarity index 100% rename from main_test.go rename to nkeys_test.go From f2ecfe3de76c6e98a3f93594339df7aeeb26a325 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Wed, 30 Nov 2022 14:33:05 -0800 Subject: [PATCH 2/3] Update Travis Signed-off-by: Derek Collison --- .travis.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index c13448e..b30fdee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,35 +1,36 @@ language: go -sudo: false - arch: - amd64 - ppc64le go: -- 1.16.x -- 1.15.x +- 1.19.x +- 1.18.x + +git: + depth: false install: - go get -t ./... -- go get github.com/mattn/goveralls -- go get -u honnef.co/go/tools/cmd/staticcheck -- go get -u github.com/client9/misspell/cmd/misspell +- go install github.com/mattn/goveralls@latest +- go install honnef.co/go/tools/cmd/staticcheck@latest +- go install github.com/client9/misspell/cmd/misspell@latest before_script: - $(exit $(go fmt ./... | wc -l)) - go vet ./... - misspell -error -locale US . +- misspell -error -locale US ./nk - staticcheck ./... script: -- go test -v -- go test -v --race +- go test -v -vet=off --race --failfast - go test -v -covermode=count -coverprofile=coverage.out - $HOME/gopath/bin/goveralls -coverprofile coverage.out -service travis-ci -#deploy: -#- provider: script -# skip_cleanup: true -# script: curl -sL http://git.io/goreleaser | bash -# on: -# tags: true -# condition: $TRAVIS_OS_NAME = linux +deploy: +- provider: script + skip_cleanup: true + script: curl -sL http://git.io/goreleaser | bash + on: + tags: true + condition: $TRAVIS_OS_NAME = linux From 31a07798bc6045ab2310bd424ed46fce2b6dc1dc Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Wed, 30 Nov 2022 14:57:01 -0800 Subject: [PATCH 3/3] Remove ioutil usage Signed-off-by: Derek Collison --- nk/main.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/nk/main.go b/nk/main.go index b9f19b3..2d6ed35 100644 --- a/nk/main.go +++ b/nk/main.go @@ -1,4 +1,4 @@ -// Copyright 2018-2019 The NATS Authors +// Copyright 2018-2022 The NATS Authors // 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 @@ -21,7 +21,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "os" "runtime" @@ -130,7 +129,7 @@ func sign(fname, keyFile string) { log.Fatal(err) } - content, err := ioutil.ReadFile(fname) + content, err := os.ReadFile(fname) if err != nil { log.Fatal(err) } @@ -153,7 +152,7 @@ func verify(fname, keyFile, pubFile, sigFile string) { var kp nkeys.KeyPair if keyFile != "" { var seed []byte - seed, err = ioutil.ReadFile(keyFile) + seed, err = os.ReadFile(keyFile) if err != nil { log.Fatal(err) } @@ -161,7 +160,7 @@ func verify(fname, keyFile, pubFile, sigFile string) { } else { // Public Key var public []byte - public, err = ioutil.ReadFile(pubFile) + public, err = os.ReadFile(pubFile) if err != nil { log.Fatal(err) } @@ -171,12 +170,12 @@ func verify(fname, keyFile, pubFile, sigFile string) { log.Fatal(err) } - content, err := ioutil.ReadFile(fname) + content, err := os.ReadFile(fname) if err != nil { log.Fatal(err) } - sigEnc, err := ioutil.ReadFile(sigFile) + sigEnc, err := os.ReadFile(sigFile) if err != nil { log.Fatal(err) } @@ -288,7 +287,7 @@ func createVanityKey(keyType, vanity, entropy string, max int) nkeys.KeyPair { func readKeyFile(filename string) []byte { var key []byte - contents, err := ioutil.ReadFile(filename) + contents, err := os.ReadFile(filename) if err != nil { log.Fatal(err) }