From 80c2b7e2091641da9faad9f4400fb7f2a2de34d1 Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Mon, 7 Aug 2023 20:29:30 +0100 Subject: [PATCH] Linting and dependency updates. --- .golangci.yml | 151 ++++++++++++++++++++++++++++++++++++++++++++++ encryptor.go | 1 + encryptor_test.go | 7 +++ go.mod | 44 +++++++------- go.sum | 97 ++++++++++++++--------------- path.go | 4 +- store.go | 8 ++- store_test.go | 8 +-- wallet.go | 61 ++++++++++++------- wallet_test.go | 6 +- 10 files changed, 281 insertions(+), 106 deletions(-) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..68e8871 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,151 @@ +# This file contains all available configuration options +# with their default values (in comments). +# +# This file is not a configuration example, +# it contains the exhaustive configuration with explanations of the options. + +# Options for analysis running. +run: + # The default concurrency value is the number of available CPU. + # concurrency: 4 + + # Timeout for analysis, e.g. 30s, 5m. + # Default: 1m + timeout: 10m + + # Exit code when at least one issue was found. + # Default: 1 + # issues-exit-code: 2 + + # Include test files or not. + # Default: true + tests: false + + # List of build tags, all linters use it. + # Default: []. + # build-tags: + # - mytag + + # Which dirs to skip: issues from them won't be reported. + # Can use regexp here: `generated.*`, regexp is applied on full path. + # Default value is empty list, + # but default dirs are skipped independently of this option's value (see skip-dirs-use-default). + # "/" will be replaced by current OS file path separator to properly work on Windows. + # skip-dirs: + # - autogenerated_by_my_lib + + # Enables skipping of directories: + # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ + # Default: true + # skip-dirs-use-default: false + + # Which files to skip: they will be analyzed, but issues from them won't be reported. + # Default value is empty list, + # but there is no need to include all autogenerated files, + # we confidently recognize autogenerated files. + # If it's not please let us know. + # "/" will be replaced by current OS file path separator to properly work on Windows. + skip-files: + - ".*_ssz\\.go$" + + # If set we pass it to "go list -mod={option}". From "go help modules": + # If invoked with -mod=readonly, the go command is disallowed from the implicit + # automatic updating of go.mod described above. Instead, it fails when any changes + # to go.mod are needed. This setting is most useful to check that go.mod does + # not need updates, such as in a continuous integration and testing system. + # If invoked with -mod=vendor, the go command assumes that the vendor + # directory holds the correct copies of dependencies and ignores + # the dependency descriptions in go.mod. + # + # Allowed values: readonly|vendor|mod + # By default, it isn't set. + modules-download-mode: readonly + + # Allow multiple parallel golangci-lint instances running. + # If false (default) - golangci-lint acquires file lock on start. + allow-parallel-runners: true + + # Define the Go version limit. + # Mainly related to generics support since go1.18. + # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.18 + go: '1.19' + + +# output configuration options +output: + # Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions + # + # Multiple can be specified by separating them by comma, output can be provided + # for each of them by separating format name and path by colon symbol. + # Output path can be either `stdout`, `stderr` or path to the file to write to. + # Example: "checkstyle:report.json,colored-line-number" + # + # Default: colored-line-number + # format: json + + # Print lines of code with issue. + # Default: true + # print-issued-lines: false + + # Print linter name in the end of issue text. + # Default: true + # print-linter-name: false + + # Make issues output unique by line. + # Default: true + # uniq-by-line: false + + # Add a prefix to the output file references. + # Default is no prefix. + # path-prefix: "" + + # Sort results by: filepath, line and column. + # sort-results: true + + +# All available settings of specific linters. +linters-settings: + lll: + line-length: 132 + + stylecheck: + checks: [ "all", "-ST1000" ] + + tagliatelle: + case: + # use-field-name: true + rules: + json: snake + yaml: snake + + nlreturn: + # Allow two-line blocks without requiring a newline + block-size: 3 + +linters: + # Enable all available linters. + # Default: false + enable-all: true + # Disable specific linter + # https://golangci-lint.run/usage/linters/#disabled-by-default + disable: + - deadcode + - depguard + - exhaustivestruct + - exhaustruct + - gochecknoglobals + - gochecknoinits + - goerr113 + - golint + - gomnd + - ifshort + - interfacer + - ireturn + - maligned + - nosnakecase + - scopelint + - structcheck + - varcheck + - varnamelen + - wrapcheck + - wsl diff --git a/encryptor.go b/encryptor.go index 995f9e3..f399aff 100644 --- a/encryptor.go +++ b/encryptor.go @@ -32,6 +32,7 @@ func UseEncryptor(e wtypes.Encryptor) error { return errors.New("no encryptor supplied") } encryptor = e + return nil } diff --git a/encryptor_test.go b/encryptor_test.go index 37fb21e..d11daf6 100644 --- a/encryptor_test.go +++ b/encryptor_test.go @@ -18,6 +18,7 @@ import ( "github.com/stretchr/testify/require" wallet "github.com/wealdtech/go-eth2-wallet" + keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4" unencrypted "github.com/wealdtech/go-eth2-wallet-encryptor-unencrypted" ) @@ -33,4 +34,10 @@ func TestEncryptor(t *testing.T) { // Confirm the encryptor has been set. require.Equal(t, "unencrypted", wallet.GetEncryptor()) + + // Attempt to set a different encryptor. + require.NoError(t, wallet.UseEncryptor(keystorev4.New())) + + // Confirm the encryptor has been set. + require.Equal(t, "keystore", wallet.GetEncryptor()) } diff --git a/go.mod b/go.mod index 0f0315a..593d08b 100644 --- a/go.mod +++ b/go.mod @@ -4,40 +4,40 @@ go 1.20 require ( github.com/google/uuid v1.3.0 - github.com/stretchr/testify v1.8.2 - github.com/wealdtech/go-ecodec v1.1.3 - github.com/wealdtech/go-eth2-types/v2 v2.8.1 - github.com/wealdtech/go-eth2-wallet-distributed v1.1.5 - github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.3.1 - github.com/wealdtech/go-eth2-wallet-encryptor-unencrypted v1.0.1 - github.com/wealdtech/go-eth2-wallet-hd/v2 v2.6.1 - github.com/wealdtech/go-eth2-wallet-nd/v2 v2.4.1 - github.com/wealdtech/go-eth2-wallet-store-filesystem v1.17.1 - github.com/wealdtech/go-eth2-wallet-store-s3 v1.11.3 - github.com/wealdtech/go-eth2-wallet-store-scratch v1.7.1 - github.com/wealdtech/go-eth2-wallet-types/v2 v2.10.1 + github.com/pkg/errors v0.9.1 + github.com/stretchr/testify v1.8.4 + github.com/wealdtech/go-ecodec v1.1.4 + github.com/wealdtech/go-eth2-types/v2 v2.8.2 + github.com/wealdtech/go-eth2-wallet-distributed v1.2.1 + github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.4.1 + github.com/wealdtech/go-eth2-wallet-encryptor-unencrypted v1.0.2 + github.com/wealdtech/go-eth2-wallet-hd/v2 v2.7.0 + github.com/wealdtech/go-eth2-wallet-nd/v2 v2.5.0 + github.com/wealdtech/go-eth2-wallet-store-filesystem v1.18.1 + github.com/wealdtech/go-eth2-wallet-store-s3 v1.12.0 + github.com/wealdtech/go-eth2-wallet-store-scratch v1.7.2 + github.com/wealdtech/go-eth2-wallet-types/v2 v2.11.0 gotest.tools v2.2.0+incompatible ) require ( - github.com/aws/aws-sdk-go v1.44.213 // indirect + github.com/aws/aws-sdk-go v1.44.312 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/ferranbt/fastssz v0.1.3 // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/herumi/bls-eth-go-binary v1.29.1 // indirect + github.com/herumi/bls-eth-go-binary v1.31.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/klauspost/cpuid/v2 v2.2.4 // indirect - github.com/minio/sha256-simd v1.0.0 // indirect + github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 // indirect github.com/wealdtech/go-bytesutil v1.2.1 // indirect - github.com/wealdtech/go-eth2-util v1.8.1 // indirect - github.com/wealdtech/go-indexer v1.0.1 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/wealdtech/go-eth2-util v1.8.2 // indirect + github.com/wealdtech/go-indexer v1.1.0 // indirect + golang.org/x/crypto v0.11.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/text v0.11.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index b6c0b7a..3537369 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/aws/aws-sdk-go v1.44.213 h1:WahquyWs7cQdz0vpDVWyWETEemgSoORx0PbWL9oz2WA= -github.com/aws/aws-sdk-go v1.44.213/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.312 h1:llrElfzeqG/YOLFFKjg1xNpZCFJ2xraIi3PqSuP+95k= +github.com/aws/aws-sdk-go v1.44.312/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -9,19 +9,16 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/herumi/bls-eth-go-binary v1.29.1 h1:XcNSHYTyNjEUVfWDCE2gtG5r95biTwd7MJUJF09LtSE= -github.com/herumi/bls-eth-go-binary v1.29.1/go.mod h1:luAnRm3OsMQeokhGzpYmc0ZKwawY7o87PUEP11Z7r7U= +github.com/herumi/bls-eth-go-binary v1.31.0 h1:9eeW3EA4epCb7FIHt2luENpAW69MvKGL5jieHlBiP+w= +github.com/herumi/bls-eth-go-binary v1.31.0/go.mod h1:luAnRm3OsMQeokhGzpYmc0ZKwawY7o87PUEP11Z7r7U= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= -github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= -github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= +github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= +github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -31,64 +28,59 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 h1:Xuk8ma/ibJ1fOy4Ee11vHhUFHQNpHhrBneOCNHVXS5w= github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0/go.mod h1:7AwjWCpdPhkSmNAgUv5C7EJ4AbmjEB3r047r3DXWu3Y= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/umbracle/gohashtree v0.0.2-alpha.0.20230207094856-5b775a815c10 h1:CQh33pStIp/E30b7TxDlXfM0145bn2e8boI30IxAhTg= github.com/wealdtech/go-bytesutil v1.2.1 h1:TjuRzcG5KaPwaR5JB7L/OgJqMQWvlrblA1n0GfcXFSY= github.com/wealdtech/go-bytesutil v1.2.1/go.mod h1:RhUDUGT1F4UP4ydqbYp2MWJbAel3M+mKd057Pad7oag= -github.com/wealdtech/go-ecodec v1.1.3 h1:ldQFJqzvega2IMsbjB6Yp4uZMsQTxvYnuM521ZGiglo= -github.com/wealdtech/go-ecodec v1.1.3/go.mod h1:+sSrfAZvFf1bqEBfPGB42VtHijcT27cUkw6J1gueJKg= -github.com/wealdtech/go-eth2-types/v2 v2.8.1 h1:y2N3xSIZ3tVqsnvj4AgPkh48U5sM612vhZwlK3k+3lM= -github.com/wealdtech/go-eth2-types/v2 v2.8.1/go.mod h1:3TJShI4oBzG8pCZsfe3NZAq8QAmXrC2rd45q7Vn/XB8= -github.com/wealdtech/go-eth2-util v1.8.1 h1:nb50hygsNoql94akg7GN6im/weg8ZZgJWHgiyrj8qiU= -github.com/wealdtech/go-eth2-util v1.8.1/go.mod h1:vv+8jVgYRXEGty/VLPNn1RYlbQNYmTht3VR6nfh0z4E= -github.com/wealdtech/go-eth2-wallet-distributed v1.1.5 h1:kUpESVq2dVGeI4GXUy/LfoP5fycl3LGYTUcta7VTIjE= -github.com/wealdtech/go-eth2-wallet-distributed v1.1.5/go.mod h1:zaATC9jRC3bn7jAmB2+MaCiyyJcavHGzSq5OCd7h/tM= -github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.3.1 h1:NlWiq9cUd69xFvhAdCRpz7CwfDjMuz8cEvPQ9yponT4= -github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.3.1/go.mod h1:luy/Y/I3gC3JxT0mQBKqysvzRN1DiFnwqUij8Yc2SP4= -github.com/wealdtech/go-eth2-wallet-encryptor-unencrypted v1.0.1 h1:x6bq8cVgRgfhwtSQSYo/9AqJ8qEeaS6af28cW0cVj5U= -github.com/wealdtech/go-eth2-wallet-encryptor-unencrypted v1.0.1/go.mod h1:49K88T/4LNQpB8ghVcjTKeRRi/bZHeYjN8Ef5S23yps= -github.com/wealdtech/go-eth2-wallet-hd/v2 v2.6.1 h1:pEVfJCHB5T02oVtOumpcwU9H4zC2vWsJEQl09moh+n0= -github.com/wealdtech/go-eth2-wallet-hd/v2 v2.6.1/go.mod h1:11BHG8gt2FqQC02MrT4KN2+EV1ZTsn9SmSVme1HWp7E= -github.com/wealdtech/go-eth2-wallet-nd/v2 v2.4.1 h1:LvgLIYaP+WqZ8xcrN4e0CAIGDtjKhzpBqAhjExQzqb4= -github.com/wealdtech/go-eth2-wallet-nd/v2 v2.4.1/go.mod h1:279Gj7DqpQBar9eoo82RcC6SgD0fiZs1Dc6SffsDZM0= -github.com/wealdtech/go-eth2-wallet-store-filesystem v1.17.1 h1:fe3wd7fKCy4d3TsdKGWsy5/uKoyKiz4GsYyck/BDO88= -github.com/wealdtech/go-eth2-wallet-store-filesystem v1.17.1/go.mod h1:mlB4RA5n1/3CnktH2iphuYoky7xn3DEugKvXrFqkBW4= -github.com/wealdtech/go-eth2-wallet-store-s3 v1.11.3 h1:HAUyuCcoxpmm5c1DVJ3P7vI9v12aI3u23O2qrw7vugE= -github.com/wealdtech/go-eth2-wallet-store-s3 v1.11.3/go.mod h1:OQyhned9FiLSC/5misLeAvc/BGhBDlksZGOe0PFq17o= -github.com/wealdtech/go-eth2-wallet-store-scratch v1.7.1 h1:0JRUCM6UgpsgTGGpd8Q6BDQXAyhRd359mumBf6pAdlc= -github.com/wealdtech/go-eth2-wallet-store-scratch v1.7.1/go.mod h1:NaGxeFPNnLqDAUtbs1smC5m60QSX4kQqPRh5myEvNiA= -github.com/wealdtech/go-eth2-wallet-types/v2 v2.10.1 h1:RRJhZ9M3S2Vh5k1SLwQmyA4NZ7E1HM4QnnHhiUySFdk= -github.com/wealdtech/go-eth2-wallet-types/v2 v2.10.1/go.mod h1:ErJ+f0bEVFn218QcwhY+Sy9UUa8XgfEjVeNauUJqOgE= -github.com/wealdtech/go-indexer v1.0.1 h1:kInFsg0ZYHXE5EPY0dhgyBu1nSfS126h4m2iKgvuBFQ= -github.com/wealdtech/go-indexer v1.0.1/go.mod h1:kqGWOcsn/5rFSIJF4hjwQnIUM/Aqa91RNrdWVNBhqCg= +github.com/wealdtech/go-ecodec v1.1.4 h1:iHx9/X3Szn1Q5RbZmk5l8A1TdUDXtAFb21gJH1JcO5A= +github.com/wealdtech/go-ecodec v1.1.4/go.mod h1:zEblpCFdl9xZlcNYoDL9o6U7YtzY+eWzOao13UVe4j0= +github.com/wealdtech/go-eth2-types/v2 v2.8.2 h1:b5aXlNBLKgjAg/Fft9VvGlqAUCQMP5LzYhlHRrr4yPg= +github.com/wealdtech/go-eth2-types/v2 v2.8.2/go.mod h1:IAz9Lz1NVTaHabQa+4zjk2QDKMv8LVYo0n46M9o/TXw= +github.com/wealdtech/go-eth2-util v1.8.2 h1:gq+JMrnadifyKadUr75wmfP7+usiqMu9t3VVoob5Dvo= +github.com/wealdtech/go-eth2-util v1.8.2/go.mod h1:/80GAK0K/3+PqUBZHvaOPd3b1sjHeimxQh1nrJzgaPk= +github.com/wealdtech/go-eth2-wallet-distributed v1.2.1 h1:+pbG9i9b5TrWd7GDRX8yq4FKA+D7k7aI6uySEvAZ+Kk= +github.com/wealdtech/go-eth2-wallet-distributed v1.2.1/go.mod h1:jYkDax2VhUNKIct6TVlgxAagvR56/eg7y7J+JFq+gDo= +github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.4.1 h1:9j7bpwjT9wmwBb54ZkBhTm1uNIlFFcCJXefd/YskZPw= +github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.4.1/go.mod h1:+tI1VD76E1WINI+Nstg7RVGpUolL5ql10nu2YztMO/4= +github.com/wealdtech/go-eth2-wallet-encryptor-unencrypted v1.0.2 h1:IMIyl70hbJlxOkgTcCK//3vKe5ylhGIk6oUlIlK9xp0= +github.com/wealdtech/go-eth2-wallet-encryptor-unencrypted v1.0.2/go.mod h1:T8nyAscWIWNcNa6EG/19PwH/OCt2Ly7Orn5okmiuSP4= +github.com/wealdtech/go-eth2-wallet-hd/v2 v2.7.0 h1:5g4emFacTf+sX6zx6SbZIZGR7Jx5Xr/Xdb7sXnEXlWk= +github.com/wealdtech/go-eth2-wallet-hd/v2 v2.7.0/go.mod h1:aWgnEi07w1L9wMBRB69sYvoEONppAUly6FDQRWQGqH8= +github.com/wealdtech/go-eth2-wallet-nd/v2 v2.5.0 h1:vphAFklkYMRJVo9f5rVWly7PECHrLS4yarjemBa7fRM= +github.com/wealdtech/go-eth2-wallet-nd/v2 v2.5.0/go.mod h1:kBZUZogqwvvxulEvXi5l6OjZyd7EBmCKxce5Q+lW7fs= +github.com/wealdtech/go-eth2-wallet-store-filesystem v1.18.1 h1:Ceq74WL57jdBQnrZJFJyGRBKOOFI5wwq9VoxeAbjoEk= +github.com/wealdtech/go-eth2-wallet-store-filesystem v1.18.1/go.mod h1:woTpldN8qThnmya/0yeD+a3u/3Zj42u6/ijgF9CGaz8= +github.com/wealdtech/go-eth2-wallet-store-s3 v1.12.0 h1:noknYCbHw2soPhwke1LvC99Kk/2CLN787KcgxdZ7OGo= +github.com/wealdtech/go-eth2-wallet-store-s3 v1.12.0/go.mod h1:1lSVxfQynUAd5u46rCeAI8wCl8S44lZsNYYXlxVAvwU= +github.com/wealdtech/go-eth2-wallet-store-scratch v1.7.2 h1:TwOt7bEHsVe6dKJb7XuUG7m06gaBGPCQlBk24Ql8Mws= +github.com/wealdtech/go-eth2-wallet-store-scratch v1.7.2/go.mod h1:rtIoB34tqL3kUOK+LsLTAHfynxLR8pGScy0lmQmpbKc= +github.com/wealdtech/go-eth2-wallet-types/v2 v2.11.0 h1:yX9+FfUXvPDvZ8Q5bhF+64AWrQwh4a3/HpfTx99DnZc= +github.com/wealdtech/go-eth2-wallet-types/v2 v2.11.0/go.mod h1:UVP9YFcnPiIzHqbmCMW3qrQ3TK5FOqr1fmKqNT9JGr8= +github.com/wealdtech/go-indexer v1.1.0 h1:vn4gY7nSYSLe0sXVauJgyHvK4NXiDrLKBYYYKWypahk= +github.com/wealdtech/go-indexer v1.1.0/go.mod h1:lEFTda1rul1EwWIX3QqXq/KW0tnEEhC41Lup06V7Tlo= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -96,18 +88,17 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= diff --git a/path.go b/path.go index 1966406..8995c2f 100644 --- a/path.go +++ b/path.go @@ -18,8 +18,9 @@ import ( "strings" ) -//revive:disable-next-line // WalletAndAccountNames breaks an account in to wallet and account names. +// +//nolint:revive func WalletAndAccountNames(account string) (string, string, error) { if len(account) == 0 { return "", "", errors.New("invalid account format") @@ -36,5 +37,6 @@ func WalletAndAccountNames(account string) (string, string, error) { // Trailing / return account[:index], "", nil } + return account[:index], account[index+1:], nil } diff --git a/store.go b/store.go index 673b5f9..dfb5ea3 100644 --- a/store.go +++ b/store.go @@ -1,4 +1,4 @@ -// Copyright © 2019 Weald Technology Trading +// Copyright © 2019 - 2023 Weald Technology Trading. // 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 @@ -19,13 +19,14 @@ import ( filesystem "github.com/wealdtech/go-eth2-wallet-store-filesystem" s3 "github.com/wealdtech/go-eth2-wallet-store-s3" + scratch "github.com/wealdtech/go-eth2-wallet-store-scratch" wtypes "github.com/wealdtech/go-eth2-wallet-types/v2" ) var store wtypes.Store func init() { - // default store is filesystem + // Default store is filesystem. store = filesystem.New() } @@ -40,6 +41,8 @@ func SetStore(name string, passphrase []byte) error { store, err = s3.New(s3.WithPassphrase(passphrase)) case "filesystem": store = filesystem.New(filesystem.WithPassphrase(passphrase)) + case "scratch": + store = scratch.New() default: err = fmt.Errorf("unknown wallet store %q", name) } @@ -56,6 +59,7 @@ func UseStore(s wtypes.Store) error { return errors.New("no store supplied") } store = s + return nil } diff --git a/store_test.go b/store_test.go index 66577e0..deb700a 100644 --- a/store_test.go +++ b/store_test.go @@ -1,4 +1,4 @@ -// Copyright © 2020 Weald Technology Trading +// Copyright © 2020 - 2023 Weald Technology Trading. // 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 @@ -34,10 +34,10 @@ func TestStore(t *testing.T) { // Confirm the store has been set. require.Equal(t, "scratch", wallet.GetStore()) - // Attempt to set different stores. + // Attempt to switch stores. require.NoError(t, wallet.SetStore("filesystem", nil)) require.Equal(t, "filesystem", wallet.GetStore()) - require.NoError(t, wallet.SetStore("s3", nil)) - require.Equal(t, "s3", wallet.GetStore()) + require.NoError(t, wallet.SetStore("scratch", nil)) + require.Equal(t, "scratch", wallet.GetStore()) require.EqualError(t, wallet.SetStore("unknown", nil), "unknown wallet store \"unknown\"") } diff --git a/wallet.go b/wallet.go index 4dadbb0..b505f61 100644 --- a/wallet.go +++ b/wallet.go @@ -1,4 +1,4 @@ -// Copyright 2019, 2020 Weald Technology Trading +// Copyright 2019 - 2023 Weald Technology Trading. // 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 @@ -16,11 +16,11 @@ package wallet import ( "context" "encoding/json" - "errors" "fmt" "time" "github.com/google/uuid" + "github.com/pkg/errors" "github.com/wealdtech/go-ecodec" distributed "github.com/wealdtech/go-eth2-wallet-distributed" hd "github.com/wealdtech/go-eth2-wallet-hd/v2" @@ -28,6 +28,12 @@ import ( wtypes "github.com/wealdtech/go-eth2-wallet-types/v2" ) +const ( + nonDeterministicWallet = "non-deterministic" + hierarchicalDeterministicWallet = "hierarchical deterministic" + distributedWallet = "distributed" +) + // walletOptions are the optons used when opening and creating wallets. type walletOptions struct { store wtypes.Store @@ -91,28 +97,29 @@ func ImportWallet(encryptedData []byte, passphrase []byte) (wtypes.Wallet, error data, err := ecodec.Decrypt(encryptedData, passphrase) if err != nil { - return nil, err + return nil, errors.Wrap(err, "failed to decrypt wallet") } ext := &walletExt{} err = json.Unmarshal(data, ext) if err != nil { - return nil, err + return nil, errors.Wrap(err, "failed to import wallet") } ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) defer cancel() var wallet wtypes.Wallet switch ext.Wallet.Type { - case "nd", "non-deterministic": + case "nd", nonDeterministicWallet: wallet, err = nd.Import(ctx, encryptedData, passphrase, store, encryptor) - case "hd", "hierarchical deterministic": + case "hd", hierarchicalDeterministicWallet: wallet, err = hd.Import(ctx, encryptedData, passphrase, store, encryptor) - case "distributed": + case distributedWallet: wallet, err = distributed.Import(ctx, encryptedData, passphrase, store, encryptor) default: return nil, fmt.Errorf("unsupported wallet type %q", ext.Wallet.Type) } + return wallet, err } @@ -139,6 +146,7 @@ func OpenWallet(name string, opts ...Option) (wtypes.Wallet, error) { if err != nil { return nil, err } + return walletFromBytes(data, options.store, options.encryptor) } @@ -157,30 +165,39 @@ func CreateWallet(name string, opts ...Option) (wtypes.Wallet, error) { o.apply(&options) } } - if options.store == nil { - return nil, errors.New("no store specified") - } - if options.encryptor == nil { - return nil, errors.New("no encryptor specified") - } - if (options.walletType == "hd" || options.walletType == "hierarchical deterministic") && options.seed == nil { - return nil, errors.New("no seed specified") + + if err := checkOptions(&options); err != nil { + return nil, err } ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) defer cancel() switch options.walletType { - case "nd", "non-deterministic": + case "nd", nonDeterministicWallet: return nd.CreateWallet(ctx, name, options.store, options.encryptor) - case "hd", "hierarchical deterministic": + case "hd", hierarchicalDeterministicWallet: return hd.CreateWallet(ctx, name, options.passphrase, options.store, options.encryptor, options.seed) - case "distributed": + case distributedWallet: return distributed.CreateWallet(ctx, name, options.store, options.encryptor) default: return nil, fmt.Errorf("unhandled wallet type %q", options.walletType) } } +func checkOptions(options *walletOptions) error { + if options.store == nil { + return errors.New("no store specified") + } + if options.encryptor == nil { + return errors.New("no encryptor specified") + } + if (options.walletType == "hd" || options.walletType == hierarchicalDeterministicWallet) && options.seed == nil { + return errors.New("no seed specified") + } + + return nil +} + type walletInfo struct { ID uuid.UUID `json:"uuid"` Name string `json:"name"` @@ -216,6 +233,7 @@ func Wallets(opts ...Option) <-chan wtypes.Wallet { } close(ch) }() + return ch } @@ -237,14 +255,15 @@ func walletFromBytes(data []byte, store wtypes.Store, encryptor wtypes.Encryptor defer cancel() var wallet wtypes.Wallet switch info.Type { - case "nd", "non-deterministic": + case "nd", nonDeterministicWallet: wallet, err = nd.DeserializeWallet(ctx, data, store, encryptor) - case "hd", "hierarchical deterministic": + case "hd", hierarchicalDeterministicWallet: wallet, err = hd.DeserializeWallet(ctx, data, store, encryptor) - case "distributed": + case distributedWallet: wallet, err = distributed.DeserializeWallet(ctx, data, store, encryptor) default: return nil, fmt.Errorf("unsupported wallet type %q", info.Type) } + return wallet, err } diff --git a/wallet_test.go b/wallet_test.go index b6feb62..d830800 100644 --- a/wallet_test.go +++ b/wallet_test.go @@ -276,18 +276,18 @@ func TestImportWallet(t *testing.T) { }{ { name: "Nil", - err: "encrypted data must be at least 81 bytes", + err: "failed to decrypt wallet: encrypted data must be at least 81 bytes", }, { name: "PassphraseMissing", data: _byte("0x0153eaead344082ae20d4d8b7f4c6666c54ac46480c3bc1fc817491d1cbc5af1cbc5bacd1a8dca7c64446bb94483efaa4c1af99f0271bf1ebe49ef50052020a07b8e000c2686702aa2e6a65fae5d51c84a0054018ecd4b170b76ccfa287e62c513f8110cd63373a13d73ab93a0abd41aaa784757f68cd669cb16588b99171b83a062b2a0a8a4886e0149a726ac9a8364f16643c3ff025d47e4ec5d1e1445e51cb5790aa32c8d2577b42ab8b89f3f93f3db402caa54cc51ec054d6338f9599cd0a5d7021d153758396f9d48d4d4d209f57222745666441a7619f8659504a1c27db0e5f5cdbfbbb9fc07544601b1a09fdc9d50b7c489bbfadbc09e2458c4e674dda1969dd700cf23181de8e603a7df915607166cefb30774ef20333dcea601979ad4f1f6f7d57aa2cac9996b60d2b980018883fa831d869beec2b0532b54530b143f3cda6b8d7962f47e5f2795ac35b78fe8a2eeacd399cad0d2c3bc6c7a1b799b99bc5bf0a5b149ab87d55c98a0a0fe6df2ba0c6931e26e014931b3e2067b2013a3d21c73b7a67bfd965de720f27fab4101cb56ddab57dc06e7e9118b4a450ae4b4401e13cdc92716c803470c6e2ae7f5120cd545d9c8d39a3b0e87d9a0262c1493abb26419a8ae03bd0b564fc6b217ce0fc63dd6557727d96cc51d67099cf3caf4f379af7219a81257dec743392322b57cca10c9a6defe807f8e6ce8147a64706056ec2bf43b97e6f30db98093e90ad9ce613592fd0e257cff1da6b2aa3341d57c8e979fbde3bbe1d9e933fbac5eef7dcb879cb6090ab4ebf59c86ca1bbe808378f672235ffd79a312c4fc22f14beb66d71247ea2218de9997afdc2844569db8de3366841f7d1d6c199b0a9633a763003008e9869963d90504d226e4585f8fe8e28f1f8e163278e3caf08d04167ab667c62a089367e0f945e77eb44b6f7d51f09cff840b1b49adc34905032797d56581c24bf9ee034a085eb2f1ed1e0b74ea213d1a448f32227991b6b349649315fb41604a857044c9f2f7657a502200c449744c4eb682cbbdcf93be3bc936dda438979c2fd9d5b910502a10bb9028411523e2942a765495e4f6f49b9702f329643fa475eb3bc76370f086e5312de705ef86d6e35ba012beaff3c68bcf1d6aa6c192e476d91db0a3f68e3b189662bab2463ecdc961bbad7680ae5ff4172b0536d443fe4a5e609aabf270a690b7ea3863fc82cab1e2480983ef84994a0599d80f85c927918f38425a55c2bd5ea9"), - err: "invalid key", + err: "failed to decrypt wallet: invalid key", }, { name: "PassphraseIncorrect", data: _byte("0x0153eaead344082ae20d4d8b7f4c6666c54ac46480c3bc1fc817491d1cbc5af1cbc5bacd1a8dca7c64446bb94483efaa4c1af99f0271bf1ebe49ef50052020a07b8e000c2686702aa2e6a65fae5d51c84a0054018ecd4b170b76ccfa287e62c513f8110cd63373a13d73ab93a0abd41aaa784757f68cd669cb16588b99171b83a062b2a0a8a4886e0149a726ac9a8364f16643c3ff025d47e4ec5d1e1445e51cb5790aa32c8d2577b42ab8b89f3f93f3db402caa54cc51ec054d6338f9599cd0a5d7021d153758396f9d48d4d4d209f57222745666441a7619f8659504a1c27db0e5f5cdbfbbb9fc07544601b1a09fdc9d50b7c489bbfadbc09e2458c4e674dda1969dd700cf23181de8e603a7df915607166cefb30774ef20333dcea601979ad4f1f6f7d57aa2cac9996b60d2b980018883fa831d869beec2b0532b54530b143f3cda6b8d7962f47e5f2795ac35b78fe8a2eeacd399cad0d2c3bc6c7a1b799b99bc5bf0a5b149ab87d55c98a0a0fe6df2ba0c6931e26e014931b3e2067b2013a3d21c73b7a67bfd965de720f27fab4101cb56ddab57dc06e7e9118b4a450ae4b4401e13cdc92716c803470c6e2ae7f5120cd545d9c8d39a3b0e87d9a0262c1493abb26419a8ae03bd0b564fc6b217ce0fc63dd6557727d96cc51d67099cf3caf4f379af7219a81257dec743392322b57cca10c9a6defe807f8e6ce8147a64706056ec2bf43b97e6f30db98093e90ad9ce613592fd0e257cff1da6b2aa3341d57c8e979fbde3bbe1d9e933fbac5eef7dcb879cb6090ab4ebf59c86ca1bbe808378f672235ffd79a312c4fc22f14beb66d71247ea2218de9997afdc2844569db8de3366841f7d1d6c199b0a9633a763003008e9869963d90504d226e4585f8fe8e28f1f8e163278e3caf08d04167ab667c62a089367e0f945e77eb44b6f7d51f09cff840b1b49adc34905032797d56581c24bf9ee034a085eb2f1ed1e0b74ea213d1a448f32227991b6b349649315fb41604a857044c9f2f7657a502200c449744c4eb682cbbdcf93be3bc936dda438979c2fd9d5b910502a10bb9028411523e2942a765495e4f6f49b9702f329643fa475eb3bc76370f086e5312de705ef86d6e35ba012beaff3c68bcf1d6aa6c192e476d91db0a3f68e3b189662bab2463ecdc961bbad7680ae5ff4172b0536d443fe4a5e609aabf270a690b7ea3863fc82cab1e2480983ef84994a0599d80f85c927918f38425a55c2bd5ea9"), passphrase: []byte("incorrect"), - err: "invalid key", + err: "failed to decrypt wallet: invalid key", }, { name: "NDGood",