├── .gitignore ├── LICENSE.md ├── Makefile ├── README.md ├── VERSION ├── _assets ├── ci │ ├── Jenkinsfile │ ├── Jenkinsfile.pr │ └── README.md └── docker │ ├── Dockerfile │ ├── Makefile │ └── README.md ├── _shell-commands-examples ├── 01-install.sh ├── 02-init.sh ├── 03-pair-unpair.sh ├── 04-get-status.sh ├── 05-generate-key.sh ├── 06-sign.sh ├── 07-sign-message.sh ├── 08-prepare-sign-pinless.sh ├── 09-sign-pinless.sh ├── 10-remove-key.sh ├── 11-cash-sign.sh ├── 12-full-test.sh ├── 13-export-key.sh ├── 14-generate-mnemonic.sh ├── 15-unblock-pin.sh └── 16-identify.sh ├── go.mod ├── go.sum ├── initializer.go ├── installer.go ├── main.go ├── ndef.go └── shell.go /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | *.cap 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | ### 1. Definitions 5 | 6 | **1.1. “Contributor”** 7 | means each individual or legal entity that creates, contributes to 8 | the creation of, or owns Covered Software. 9 | 10 | **1.2. “Contributor Version”** 11 | means the combination of the Contributions of others (if any) used 12 | by a Contributor and that particular Contributor's Contribution. 13 | 14 | **1.3. “Contribution”** 15 | means Covered Software of a particular Contributor. 16 | 17 | **1.4. “Covered Software”** 18 | means Source Code Form to which the initial Contributor has attached 19 | the notice in Exhibit A, the Executable Form of such Source Code 20 | Form, and Modifications of such Source Code Form, in each case 21 | including portions thereof. 22 | 23 | **1.5. “Incompatible With Secondary Licenses”** 24 | means 25 | 26 | * **(a)** that the initial Contributor has attached the notice described 27 | in Exhibit B to the Covered Software; or 28 | * **(b)** that the Covered Software was made available under the terms of 29 | version 1.1 or earlier of the License, but not also under the 30 | terms of a Secondary License. 31 | 32 | **1.6. “Executable Form”** 33 | means any form of the work other than Source Code Form. 34 | 35 | **1.7. “Larger Work”** 36 | means a work that combines Covered Software with other material, in 37 | a separate file or files, that is not Covered Software. 38 | 39 | **1.8. “License”** 40 | means this document. 41 | 42 | **1.9. “Licensable”** 43 | means having the right to grant, to the maximum extent possible, 44 | whether at the time of the initial grant or subsequently, any and 45 | all of the rights conveyed by this License. 46 | 47 | **1.10. “Modifications”** 48 | means any of the following: 49 | 50 | * **(a)** any file in Source Code Form that results from an addition to, 51 | deletion from, or modification of the contents of Covered 52 | Software; or 53 | * **(b)** any new file in Source Code Form that contains any Covered 54 | Software. 55 | 56 | **1.11. “Patent Claims” of a Contributor** 57 | means any patent claim(s), including without limitation, method, 58 | process, and apparatus claims, in any patent Licensable by such 59 | Contributor that would be infringed, but for the grant of the 60 | License, by the making, using, selling, offering for sale, having 61 | made, import, or transfer of either its Contributions or its 62 | Contributor Version. 63 | 64 | **1.12. “Secondary License”** 65 | means either the GNU General Public License, Version 2.0, the GNU 66 | Lesser General Public License, Version 2.1, the GNU Affero General 67 | Public License, Version 3.0, or any later versions of those 68 | licenses. 69 | 70 | **1.13. “Source Code Form”** 71 | means the form of the work preferred for making modifications. 72 | 73 | **1.14. “You” (or “Your”)** 74 | means an individual or a legal entity exercising rights under this 75 | License. For legal entities, “You” includes any entity that 76 | controls, is controlled by, or is under common control with You. For 77 | purposes of this definition, “control” means **(a)** the power, direct 78 | or indirect, to cause the direction or management of such entity, 79 | whether by contract or otherwise, or **(b)** ownership of more than 80 | fifty percent (50%) of the outstanding shares or beneficial 81 | ownership of such entity. 82 | 83 | 84 | ### 2. License Grants and Conditions 85 | 86 | #### 2.1. Grants 87 | 88 | Each Contributor hereby grants You a world-wide, royalty-free, 89 | non-exclusive license: 90 | 91 | * **(a)** under intellectual property rights (other than patent or trademark) 92 | Licensable by such Contributor to use, reproduce, make available, 93 | modify, display, perform, distribute, and otherwise exploit its 94 | Contributions, either on an unmodified basis, with Modifications, or 95 | as part of a Larger Work; and 96 | * **(b)** under Patent Claims of such Contributor to make, use, sell, offer 97 | for sale, have made, import, and otherwise transfer either its 98 | Contributions or its Contributor Version. 99 | 100 | #### 2.2. Effective Date 101 | 102 | The licenses granted in Section 2.1 with respect to any Contribution 103 | become effective for each Contribution on the date the Contributor first 104 | distributes such Contribution. 105 | 106 | #### 2.3. Limitations on Grant Scope 107 | 108 | The licenses granted in this Section 2 are the only rights granted under 109 | this License. No additional rights or licenses will be implied from the 110 | distribution or licensing of Covered Software under this License. 111 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 112 | Contributor: 113 | 114 | * **(a)** for any code that a Contributor has removed from Covered Software; 115 | or 116 | * **(b)** for infringements caused by: **(i)** Your and any other third party's 117 | modifications of Covered Software, or **(ii)** the combination of its 118 | Contributions with other software (except as part of its Contributor 119 | Version); or 120 | * **(c)** under Patent Claims infringed by Covered Software in the absence of 121 | its Contributions. 122 | 123 | This License does not grant any rights in the trademarks, service marks, 124 | or logos of any Contributor (except as may be necessary to comply with 125 | the notice requirements in Section 3.4). 126 | 127 | #### 2.4. Subsequent Licenses 128 | 129 | No Contributor makes additional grants as a result of Your choice to 130 | distribute the Covered Software under a subsequent version of this 131 | License (see Section 10.2) or under the terms of a Secondary License (if 132 | permitted under the terms of Section 3.3). 133 | 134 | #### 2.5. Representation 135 | 136 | Each Contributor represents that the Contributor believes its 137 | Contributions are its original creation(s) or it has sufficient rights 138 | to grant the rights to its Contributions conveyed by this License. 139 | 140 | #### 2.6. Fair Use 141 | 142 | This License is not intended to limit any rights You have under 143 | applicable copyright doctrines of fair use, fair dealing, or other 144 | equivalents. 145 | 146 | #### 2.7. Conditions 147 | 148 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 149 | in Section 2.1. 150 | 151 | 152 | ### 3. Responsibilities 153 | 154 | #### 3.1. Distribution of Source Form 155 | 156 | All distribution of Covered Software in Source Code Form, including any 157 | Modifications that You create or to which You contribute, must be under 158 | the terms of this License. You must inform recipients that the Source 159 | Code Form of the Covered Software is governed by the terms of this 160 | License, and how they can obtain a copy of this License. You may not 161 | attempt to alter or restrict the recipients' rights in the Source Code 162 | Form. 163 | 164 | #### 3.2. Distribution of Executable Form 165 | 166 | If You distribute Covered Software in Executable Form then: 167 | 168 | * **(a)** such Covered Software must also be made available in Source Code 169 | Form, as described in Section 3.1, and You must inform recipients of 170 | the Executable Form how they can obtain a copy of such Source Code 171 | Form by reasonable means in a timely manner, at a charge no more 172 | than the cost of distribution to the recipient; and 173 | 174 | * **(b)** You may distribute such Executable Form under the terms of this 175 | License, or sublicense it under different terms, provided that the 176 | license for the Executable Form does not attempt to limit or alter 177 | the recipients' rights in the Source Code Form under this License. 178 | 179 | #### 3.3. Distribution of a Larger Work 180 | 181 | You may create and distribute a Larger Work under terms of Your choice, 182 | provided that You also comply with the requirements of this License for 183 | the Covered Software. If the Larger Work is a combination of Covered 184 | Software with a work governed by one or more Secondary Licenses, and the 185 | Covered Software is not Incompatible With Secondary Licenses, this 186 | License permits You to additionally distribute such Covered Software 187 | under the terms of such Secondary License(s), so that the recipient of 188 | the Larger Work may, at their option, further distribute the Covered 189 | Software under the terms of either this License or such Secondary 190 | License(s). 191 | 192 | #### 3.4. Notices 193 | 194 | You may not remove or alter the substance of any license notices 195 | (including copyright notices, patent notices, disclaimers of warranty, 196 | or limitations of liability) contained within the Source Code Form of 197 | the Covered Software, except that You may alter any license notices to 198 | the extent required to remedy known factual inaccuracies. 199 | 200 | #### 3.5. Application of Additional Terms 201 | 202 | You may choose to offer, and to charge a fee for, warranty, support, 203 | indemnity or liability obligations to one or more recipients of Covered 204 | Software. However, You may do so only on Your own behalf, and not on 205 | behalf of any Contributor. You must make it absolutely clear that any 206 | such warranty, support, indemnity, or liability obligation is offered by 207 | You alone, and You hereby agree to indemnify every Contributor for any 208 | liability incurred by such Contributor as a result of warranty, support, 209 | indemnity or liability terms You offer. You may include additional 210 | disclaimers of warranty and limitations of liability specific to any 211 | jurisdiction. 212 | 213 | 214 | ### 4. Inability to Comply Due to Statute or Regulation 215 | 216 | If it is impossible for You to comply with any of the terms of this 217 | License with respect to some or all of the Covered Software due to 218 | statute, judicial order, or regulation then You must: **(a)** comply with 219 | the terms of this License to the maximum extent possible; and **(b)** 220 | describe the limitations and the code they affect. Such description must 221 | be placed in a text file included with all distributions of the Covered 222 | Software under this License. Except to the extent prohibited by statute 223 | or regulation, such description must be sufficiently detailed for a 224 | recipient of ordinary skill to be able to understand it. 225 | 226 | 227 | ### 5. Termination 228 | 229 | **5.1.** The rights granted under this License will terminate automatically 230 | if You fail to comply with any of its terms. However, if You become 231 | compliant, then the rights granted under this License from a particular 232 | Contributor are reinstated **(a)** provisionally, unless and until such 233 | Contributor explicitly and finally terminates Your grants, and **(b)** on an 234 | ongoing basis, if such Contributor fails to notify You of the 235 | non-compliance by some reasonable means prior to 60 days after You have 236 | come back into compliance. Moreover, Your grants from a particular 237 | Contributor are reinstated on an ongoing basis if such Contributor 238 | notifies You of the non-compliance by some reasonable means, this is the 239 | first time You have received notice of non-compliance with this License 240 | from such Contributor, and You become compliant prior to 30 days after 241 | Your receipt of the notice. 242 | 243 | **5.2.** If You initiate litigation against any entity by asserting a patent 244 | infringement claim (excluding declaratory judgment actions, 245 | counter-claims, and cross-claims) alleging that a Contributor Version 246 | directly or indirectly infringes any patent, then the rights granted to 247 | You by any and all Contributors for the Covered Software under Section 248 | 2.1 of this License shall terminate. 249 | 250 | **5.3.** In the event of termination under Sections 5.1 or 5.2 above, all 251 | end user license agreements (excluding distributors and resellers) which 252 | have been validly granted by You or Your distributors under this License 253 | prior to termination shall survive termination. 254 | 255 | 256 | ### 6. Disclaimer of Warranty 257 | 258 | > Covered Software is provided under this License on an “as is” 259 | > basis, without warranty of any kind, either expressed, implied, or 260 | > statutory, including, without limitation, warranties that the 261 | > Covered Software is free of defects, merchantable, fit for a 262 | > particular purpose or non-infringing. The entire risk as to the 263 | > quality and performance of the Covered Software is with You. 264 | > Should any Covered Software prove defective in any respect, You 265 | > (not any Contributor) assume the cost of any necessary servicing, 266 | > repair, or correction. This disclaimer of warranty constitutes an 267 | > essential part of this License. No use of any Covered Software is 268 | > authorized under this License except under this disclaimer. 269 | 270 | ### 7. Limitation of Liability 271 | 272 | > Under no circumstances and under no legal theory, whether tort 273 | > (including negligence), contract, or otherwise, shall any 274 | > Contributor, or anyone who distributes Covered Software as 275 | > permitted above, be liable to You for any direct, indirect, 276 | > special, incidental, or consequential damages of any character 277 | > including, without limitation, damages for lost profits, loss of 278 | > goodwill, work stoppage, computer failure or malfunction, or any 279 | > and all other commercial damages or losses, even if such party 280 | > shall have been informed of the possibility of such damages. This 281 | > limitation of liability shall not apply to liability for death or 282 | > personal injury resulting from such party's negligence to the 283 | > extent applicable law prohibits such limitation. Some 284 | > jurisdictions do not allow the exclusion or limitation of 285 | > incidental or consequential damages, so this exclusion and 286 | > limitation may not apply to You. 287 | 288 | 289 | ### 8. Litigation 290 | 291 | Any litigation relating to this License may be brought only in the 292 | courts of a jurisdiction where the defendant maintains its principal 293 | place of business and such litigation shall be governed by laws of that 294 | jurisdiction, without reference to its conflict-of-law provisions. 295 | Nothing in this Section shall prevent a party's ability to bring 296 | cross-claims or counter-claims. 297 | 298 | 299 | ### 9. Miscellaneous 300 | 301 | This License represents the complete agreement concerning the subject 302 | matter hereof. If any provision of this License is held to be 303 | unenforceable, such provision shall be reformed only to the extent 304 | necessary to make it enforceable. Any law or regulation which provides 305 | that the language of a contract shall be construed against the drafter 306 | shall not be used to construe this License against a Contributor. 307 | 308 | 309 | ### 10. Versions of the License 310 | 311 | #### 10.1. New Versions 312 | 313 | Mozilla Foundation is the license steward. Except as provided in Section 314 | 10.3, no one other than the license steward has the right to modify or 315 | publish new versions of this License. Each version will be given a 316 | distinguishing version number. 317 | 318 | #### 10.2. Effect of New Versions 319 | 320 | You may distribute the Covered Software under the terms of the version 321 | of the License under which You originally received the Covered Software, 322 | or under the terms of any subsequent version published by the license 323 | steward. 324 | 325 | #### 10.3. Modified Versions 326 | 327 | If you create software not governed by this License, and you want to 328 | create a new license for such software, you may create and use a 329 | modified version of this License if you rename the license and remove 330 | any references to the name of the license steward (except to note that 331 | such modified license differs from this License). 332 | 333 | #### 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses 334 | 335 | If You choose to distribute Source Code Form that is Incompatible With 336 | Secondary Licenses under the terms of this version of the License, the 337 | notice described in Exhibit B of this License must be attached. 338 | 339 | ## Exhibit A - Source Code Form License Notice 340 | 341 | This Source Code Form is subject to the terms of the Mozilla Public 342 | License, v. 2.0. If a copy of the MPL was not distributed with this 343 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 344 | 345 | If it is not possible or desirable to put the notice in a particular 346 | file, then You may include the notice in a location (such as a LICENSE 347 | file in a relevant directory) where a recipient would be likely to look 348 | for such a notice. 349 | 350 | You may add additional accurate notices of copyright ownership. 351 | 352 | ## Exhibit B - “Incompatible With Secondary Licenses” Notice 353 | 354 | This Source Code Form is "Incompatible With Secondary Licenses", as 355 | defined by the Mozilla Public License, v. 2.0. 356 | 357 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: test build 2 | 3 | # This can be changed by exporting an env variable 4 | XGO_TARGETS ?= linux/amd64,windows/amd64,darwin/amd64 5 | 6 | GOBIN = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))build/bin 7 | PROJECT_NAME=keycard-cli 8 | BIN_NAME=keycard 9 | 10 | VERSION = $(shell cat VERSION) 11 | 12 | export GITHUB_USER ?= status-im 13 | export GITHUB_REPO ?= $(PROJECT_NAME) 14 | 15 | export IMAGE_TAG ?= xgo-1.18.1 16 | export IMAGE_NAME ?= statusteam/keycard-cli-ci:$(IMAGE_TAG) 17 | 18 | export GO_PROJECT_PATH ?= github.com/$(GITHUB_USER)/$(GITHUB_REPO) 19 | 20 | deps: install-xgo install-github-release 21 | go version 22 | 23 | install-xgo: 24 | go install github.com/crazy-max/xgo@v0.23.0 25 | 26 | install-github-release: 27 | go install github.com/aktau/github-release@v0.10.0 28 | 29 | build: 30 | go build -o $(GOBIN)/$(BIN_NAME) -v -ldflags "-X main.version=$(VERSION)" . 31 | @echo "Compilation done." 32 | @echo "Run \"./build/bin/$(BIN_NAME)\" to view available commands." 33 | 34 | test: 35 | go test -v ./... 36 | 37 | docker-image: 38 | cd _assets/docker && $(MAKE) push 39 | 40 | build-platforms: 41 | xgo \ 42 | -ldflags="-X main.version=$(VERSION)" \ 43 | -out=$(BIN_NAME) \ 44 | -dest=$(GOBIN) \ 45 | -docker-image=$(IMAGE_NAME) \ 46 | -targets=$(XGO_TARGETS) . 47 | 48 | release: 49 | ifndef GITHUB_TOKEN 50 | $(error GITHUB_TOKEN is not set. Unable to release to GitHub.) 51 | endif 52 | # FIXME: this might remove a real release if not careful 53 | -github-release delete --tag $(VERSION) 54 | github-release release --tag $(VERSION) --draft 55 | cd $(GOBIN); \ 56 | for FILE in $$(ls); do \ 57 | github-release upload \ 58 | --tag $(VERSION) \ 59 | --file $${FILE} \ 60 | --name $${FILE} \ 61 | --replace; \ 62 | done 63 | 64 | clean: 65 | rm -f $(GOBIN)/* 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # keycard-cli 2 | 3 | `keycard` is a command line tool to manage [Status Keycards](https://github.com/status-im/status-keycard). 4 | 5 | * [Dependencies](#dependencies) 6 | * [Installation](#installation) 7 | * [Continuous Integration](#continuous-integration) 8 | * CLI Commands 9 | * [Card info](#card-info) 10 | * [Keycard applet installation](#keycard-applet-installation) 11 | * [Card initialization](#card-initialization) 12 | * [Deleting the applet](#deleting-the-applet) 13 | * [Keycard shell](#keycard-shell) 14 | 15 | ## Dependencies 16 | 17 | * An USB smart card reader (those with contacts are more reliable than NFC readers). 18 | * On linux you need to install and run the [pcsc daemon](https://linux.die.net/man/8/pcscd). 19 | 20 | ## Installation 21 | 22 | Download the binary for your platform from the [releases page](https://github.com/status-im/keycard-cli/releases) and rename the file to `keycard`, removing the platform specific suffix. 23 | 24 | ## Continuous Integration 25 | 26 | Jenkins builds provide: 27 | 28 | * [PR Builds](https://ci.status.im/job/status-keycard/job/prs/job/keycard-cli/) - Run only the `test` and `build` targets. 29 | * [Manual Builds](https://ci.status.im/job/status-keycard/job/keycard-cli/) - Create GitHub release draft with binaries for 3 platforms. 30 | 31 | Successful PR builds are mandatory. 32 | 33 | ## Usage 34 | 35 | ### Card info 36 | 37 | ```bash 38 | keycard info -l debug 39 | ``` 40 | 41 | The `info` command will print something like this: 42 | 43 | ``` 44 | Installed: true 45 | Initialized: false 46 | InstanceUID: 0x 47 | PublicKey: 0x112233... 48 | Version: 0x 49 | AvailableSlots: 0x 50 | KeyUID: 0x 51 | ``` 52 | ### Keycard applet installation 53 | 54 | The `install` command will install an applet to the card. 55 | You can download the status `cap` file from the [status-im/status-keycard releases page](https://github.com/status-im/status-keycard/releases). 56 | 57 | ```bash 58 | keycard install -l debug -a PATH_TO_CAP_FILE 59 | ``` 60 | 61 | In case the applet is already installed and you want to force a new installation you can pass the `-f` flag. 62 | 63 | 64 | ### Card initialization 65 | 66 | 67 | ```bash 68 | keycard init -l debug 69 | ``` 70 | 71 | The `init` command initializes the card and generates the secrets needed to pair the card to a device. 72 | 73 | ``` 74 | PIN 123456 75 | PUK 123456789012 76 | Pairing password: RandomPairingPassword 77 | ``` 78 | 79 | ### Deleting the applet 80 | 81 | :warning: **WARNING! This command will remove the applet and all the keys from the card.** :warning: 82 | 83 | ```bash 84 | keycard-cli delete -l debug 85 | ``` 86 | 87 | ### Keycard shell 88 | Check the `_shell-commands-examples` folder. 89 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.7.0 2 | -------------------------------------------------------------------------------- /_assets/ci/Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent { label 'linux' } 3 | 4 | options { 5 | /* manage how many builds we keep */ 6 | buildDiscarder(logRotator( 7 | numToKeepStr: '20', 8 | daysToKeepStr: '30', 9 | )) 10 | disableConcurrentBuilds() 11 | /* Go requires a certain directory structure */ 12 | checkoutToSubdirectory('src/github.com/status-im/keycard-cli') 13 | } 14 | 15 | environment { 16 | PROJECT = "${env.WORKSPACE}/src/github.com/status-im/keycard-cli" 17 | GOPATH = "${env.WORKSPACE}" 18 | PATH = "${env.PATH}:${env.GOPATH}/bin" 19 | } 20 | 21 | stages { 22 | stage('Prep') { 23 | steps { dir(PROJECT) { 24 | sh 'make deps' 25 | } } 26 | } 27 | 28 | stage('Test') { 29 | agent { 30 | docker { 31 | label 'linux' 32 | image 'statusteam/keycard-cli-ci:xgo-1.18.1' 33 | args '--entrypoint=""' /* allows jenkins use cat */ 34 | } 35 | } 36 | environment { 37 | GOPATH = "${env.WORKSPACE}" 38 | PATH = "${env.PATH}:${env.GOPATH}/bin" 39 | } 40 | options { 41 | checkoutToSubdirectory('src/github.com/status-im/keycard-cli') 42 | } 43 | steps { dir(PROJECT) { 44 | sh 'make test' 45 | } } 46 | } 47 | 48 | stage('Build') { 49 | steps { script { dir(PROJECT) { 50 | sh 'make build-platforms' 51 | } } } 52 | } 53 | 54 | stage('Archive') { 55 | steps { dir(PROJECT) { 56 | archiveArtifacts('build/bin/*') 57 | } } 58 | } 59 | 60 | stage('Release') { 61 | steps { dir(PROJECT) { 62 | withCredentials([usernamePassword( 63 | credentialsId: 'status-im-auto', 64 | usernameVariable: 'GITHUB_USER_NAME', 65 | passwordVariable: 'GITHUB_TOKEN' 66 | )]) { 67 | sh 'make release' 68 | } 69 | } } 70 | } 71 | } 72 | post { 73 | always { 74 | cleanWs() /* we can't use `make clean` because xgo creates root files */ 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /_assets/ci/Jenkinsfile.pr: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent { 3 | docker { 4 | label 'linux' 5 | image 'statusteam/keycard-cli-ci:xgo-1.18.1' 6 | args '--entrypoint=""' /* allows jenkins use cat */ 7 | } 8 | } 9 | 10 | options { 11 | /* manage how many builds we keep */ 12 | buildDiscarder(logRotator( 13 | numToKeepStr: '20', 14 | daysToKeepStr: '30', 15 | )) 16 | disableConcurrentBuilds() 17 | /* Go requires a certain directory structure */ 18 | checkoutToSubdirectory('src/github.com/status-im/keycard-cli') 19 | } 20 | 21 | environment { 22 | PROJECT = 'src/github.com/status-im/keycard-cli' 23 | GOPATH = "${env.WORKSPACE}" 24 | PATH = "${env.PATH}:${env.GOPATH}/bin" 25 | GOCACHE = '/tmp/gocache' 26 | } 27 | 28 | stages { 29 | stage('Prep') { 30 | steps { dir(env.PROJECT) { 31 | sh 'make deps' 32 | } } 33 | } 34 | 35 | stage('Test') { 36 | steps { dir(env.PROJECT) { 37 | sh 'make test' 38 | } } 39 | } 40 | 41 | stage('Build') { 42 | steps { script { dir(env.PROJECT) { 43 | sh 'make build' 44 | } } } 45 | } 46 | 47 | stage('Archive') { 48 | steps { dir(env.PROJECT) { 49 | archiveArtifacts('build/bin/*') 50 | } } 51 | } 52 | } 53 | post { 54 | always { 55 | dir(env.PROJECT) { 56 | sh 'make clean' 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /_assets/ci/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | These Jenkinsfiles are using for jobs under [`status-keycard`](https://ci.status.im/job/status-keycard/) folder. 4 | 5 | # Builds 6 | 7 | Available are: 8 | 9 | * [PR Builds](https://ci.status.im/job/status-keycard/job/prs/job/keycard-cli/) 10 | - Use separate [`Jenkinsfile.pr`](./Jenkinsfile.pr) 11 | - Run `make test` and `go build` 12 | - Create only one `keycard` binary artifact 13 | * [Manual Builds](https://ci.status.im/job/status-keycard/job/keycard-cli/) 14 | - Use separate [`Jenkinsfile`](./Jenkinsfile) 15 | - Build for 3 platforms using `xgo` 16 | - Create and replace GitHub release draft 17 | 18 | # Known Issues 19 | 20 | The manual builds remove the existing GitHub release and replease it with a new one. To avoid this update the [`VERSION`](/VERSION) file once you've created a reales you don't want removed. 21 | -------------------------------------------------------------------------------- /_assets/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG GO_VERSION=1.18.1 2 | FROM crazymax/xgo:$GO_VERSION 3 | 4 | ENV LANG=en_US.UTF-8 \ 5 | LC_ALL=en_US.UTF-8 \ 6 | LANGUAGE=en_US.UTF-8 7 | 8 | RUN apt-get update \ 9 | && apt-get install -y libpcsclite-dev locales \ 10 | && apt-get clean \ 11 | && locale-gen ${LANG} \ 12 | && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 13 | 14 | # Jenkins user needs a specific UID/GID to work 15 | RUN groupadd -g 1001 jenkins \ 16 | && useradd --create-home -u 1001 -g 1001 jenkins 17 | 18 | MAINTAINER Jakub Sokolowski "jakub@status.im" 19 | LABEL description="Image for building keycard-cli tool." 20 | -------------------------------------------------------------------------------- /_assets/docker/Makefile: -------------------------------------------------------------------------------- 1 | GIT_COMMIT = $(shell git rev-parse --short HEAD) 2 | GIT_ROOT = $(shell git rev-parse --show-toplevel) 3 | 4 | GO_VERSION ?= 1.18.1 5 | IMAGE_TAG ?= xgo-$(GO_VERSION) 6 | IMAGE_NAME ?= statusteam/keycard-cli-ci:$(IMAGE_TAG) 7 | 8 | build: 9 | docker build \ 10 | --build-arg "GO_VERSION=$(GO_VERSION)" \ 11 | --label "commit=$(GIT_COMMIT)" \ 12 | -t $(IMAGE_NAME) . 13 | 14 | push: build 15 | docker push $(IMAGE_NAME) 16 | 17 | clean: 18 | docker rmi -f $(IMAGE_NAME) 19 | -------------------------------------------------------------------------------- /_assets/docker/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | Image created by this `Dockerfile` is used by the CI builds for this repo. 4 | See [`_assets/ci`](/_assets/ci) for example usage. 5 | 6 | # Usage 7 | 8 | * `make build` - Creates the docker image 9 | * `make push` - Pushes the docker image 10 | * `make clean` - Removes the docker image 11 | -------------------------------------------------------------------------------- /_shell-commands-examples/01-install.sh: -------------------------------------------------------------------------------- 1 | # Install keycard applet 2 | 3 | # select sending custom apdu command 4 | # gp-send-apdu 00A4040000 5 | 6 | gp-select 7 | gp-open-secure-channel 8 | gp-delete D2760000850101 9 | gp-delete A00000080400010101 10 | gp-delete A00000080400010301 11 | gp-delete A0000008040001 12 | gp-load _assets/keycard_v3.0.2.cap A0000008040001 13 | # NDEF applet 14 | gp-install-for-install A0000008040001 A000000804000102 D2760000850101 0024d40f12616e64726f69642e636f6d3a706b67696d2e7374617475732e657468657265756d 15 | # Keycard applet 16 | gp-install-for-install A0000008040001 A000000804000101 A00000080400010101 17 | # Cash applet 18 | gp-install-for-install A0000008040001 A000000804000103 A00000080400010301 19 | -------------------------------------------------------------------------------- /_shell-commands-examples/02-init.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | # setting pin, puk, pairing password 3 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 4 | # or generate random secrets 5 | # keycard-set-secrets 6 | keycard-init 7 | -------------------------------------------------------------------------------- /_shell-commands-examples/03-pair-unpair.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 3 | keycard-pair 4 | keycard-open-secure-channel 5 | keycard-verify-pin {{ session_pin }} 6 | keycard-unpair {{ session_pairing_index }} 7 | -------------------------------------------------------------------------------- /_shell-commands-examples/04-get-status.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 3 | keycard-pair 4 | 5 | keycard-open-secure-channel 6 | keycard-get-status 7 | 8 | keycard-verify-pin {{ session_pin }} 9 | keycard-unpair {{ session_pairing_index }} 10 | -------------------------------------------------------------------------------- /_shell-commands-examples/05-generate-key.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 3 | keycard-pair 4 | 5 | keycard-open-secure-channel 6 | keycard-verify-pin {{ session_pin }} 7 | 8 | keycard-generate-key 9 | 10 | keycard-unpair {{ session_pairing_index }} 11 | -------------------------------------------------------------------------------- /_shell-commands-examples/06-sign.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 3 | keycard-pair 4 | 5 | keycard-open-secure-channel 6 | keycard-verify-pin {{ session_pin }} 7 | 8 | keycard-derive-key m/1/2/3 9 | keycard-sign 0000000000000000000000000000000000000000000000000000000000000000 10 | 11 | keycard-unpair {{ session_pairing_index }} 12 | -------------------------------------------------------------------------------- /_shell-commands-examples/07-sign-message.sh: -------------------------------------------------------------------------------- 1 | # select the keycard applet 2 | keycard-select 3 | # set the secrets we had from the initialization 4 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 5 | # pairing is usually done once per device 6 | keycard-pair 7 | keycard-open-secure-channel 8 | keycard-verify-pin {{ session_pin }} 9 | # sign a message 10 | keycard-sign-message hello 11 | # we unpair the current device so that we don't use one of the 5 available slots. 12 | keycard-unpair {{ session_pairing_index }} 13 | -------------------------------------------------------------------------------- /_shell-commands-examples/08-prepare-sign-pinless.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 3 | keycard-pair 4 | keycard-open-secure-channel 5 | 6 | keycard-verify-pin {{ session_pin }} 7 | keycard-set-pinless-path m/1/2/3 8 | 9 | keycard-unpair {{ session_pairing_index }} 10 | keycard-select 11 | -------------------------------------------------------------------------------- /_shell-commands-examples/09-sign-pinless.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | keycard-sign-message-pinless hello world 3 | -------------------------------------------------------------------------------- /_shell-commands-examples/10-remove-key.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 3 | keycard-pair 4 | 5 | keycard-open-secure-channel 6 | keycard-verify-pin {{ session_pin }} 7 | 8 | keycard-remove-key 9 | 10 | keycard-unpair {{ session_pairing_index }} 11 | -------------------------------------------------------------------------------- /_shell-commands-examples/11-cash-sign.sh: -------------------------------------------------------------------------------- 1 | cash-select 2 | cash-sign 0000000000000000000000000000000000000000000000000000000000000000 3 | -------------------------------------------------------------------------------- /_shell-commands-examples/12-full-test.sh: -------------------------------------------------------------------------------- 1 | # install 2 | gp-select 3 | gp-open-secure-channel 4 | gp-delete D2760000850101 5 | gp-delete A00000080400010101 6 | gp-delete A00000080400010301 7 | gp-delete A0000008040001 8 | gp-load _assets/keycard_v3.0.2.cap A0000008040001 9 | # NDEF applet 10 | gp-install-for-install A0000008040001 A000000804000102 D2760000850101 0024d40f12616e64726f69642e636f6d3a706b67696d2e7374617475732e657468657265756d 11 | # Keycard applet 12 | gp-install-for-install A0000008040001 A000000804000101 A00000080400010101 13 | # Cash applet 14 | gp-install-for-install A0000008040001 A000000804000103 A00000080400010301 15 | 16 | 17 | # init 18 | keycard-select 19 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 20 | keycard-init 21 | 22 | # generate key 23 | keycard-select 24 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 25 | keycard-pair 26 | keycard-open-secure-channel 27 | keycard-verify-pin {{ session_pin }} 28 | keycard-generate-key 29 | keycard-unpair {{ session_pairing_index }} 30 | 31 | 32 | # sign 33 | keycard-select 34 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 35 | keycard-pair 36 | 37 | keycard-open-secure-channel 38 | keycard-verify-pin {{ session_pin }} 39 | 40 | keycard-derive-key m/1/2/3 41 | keycard-sign 0000000000000000000000000000000000000000000000000000000000000000 42 | 43 | keycard-unpair {{ session_pairing_index }} 44 | -------------------------------------------------------------------------------- /_shell-commands-examples/13-export-key.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 3 | keycard-pair 4 | 5 | keycard-open-secure-channel 6 | keycard-verify-pin {{ session_pin }} 7 | 8 | keycard-export-key-private m/43'/60'/1581'/1'/0 9 | keycard-export-key-public m 10 | 11 | keycard-unpair {{ session_pairing_index }} 12 | -------------------------------------------------------------------------------- /_shell-commands-examples/14-generate-mnemonic.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | keycard-set-secrets 123456 123456789012 KeycardDefaultPairing 3 | keycard-pair 4 | 5 | keycard-open-secure-channel 6 | 7 | keycard-generate-mnemonic 4 8 | keycard-generate-mnemonic 5 9 | keycard-generate-mnemonic 8 10 | 11 | keycard-verify-pin {{ session_pin }} 12 | keycard-unpair {{ session_pairing_index }} 13 | -------------------------------------------------------------------------------- /_shell-commands-examples/15-unblock-pin.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | keycard-set-secrets 111111 123456789012 KeycardDefaultPairing 3 | keycard-pair 4 | 5 | keycard-open-secure-channel 6 | keycard-unblock-pin {{ session_puk }} {{ session_pin }} 7 | 8 | keycard-unpair {{ session_pairing_index }} 9 | -------------------------------------------------------------------------------- /_shell-commands-examples/16-identify.sh: -------------------------------------------------------------------------------- 1 | keycard-select 2 | keycard-identify -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/status-im/keycard-cli 2 | 3 | go 1.17 4 | 5 | require ( 6 | github.com/ebfe/scard v0.0.0-20190212122703-c3d1b1916a95 7 | github.com/ethereum/go-ethereum v1.10.26 8 | github.com/hsanjuan/go-ndef v0.0.1 9 | github.com/status-im/keycard-go v0.3.2 10 | ) 11 | 12 | require ( 13 | github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect 14 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect 15 | github.com/go-stack/stack v1.8.1 // indirect 16 | golang.org/x/crypto v0.1.0 // indirect 17 | golang.org/x/sys v0.2.0 // indirect 18 | golang.org/x/text v0.4.0 // indirect 19 | ) 20 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 3 | cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= 4 | cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= 5 | cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= 6 | cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= 7 | cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= 8 | cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= 9 | cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= 10 | cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= 11 | cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= 12 | cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= 13 | cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= 14 | cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= 15 | cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= 16 | cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= 17 | cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= 18 | cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= 19 | collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= 20 | dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= 21 | github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= 22 | github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= 23 | github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= 24 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 25 | github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= 26 | github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= 27 | github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= 28 | github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= 29 | github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= 30 | github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= 31 | github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= 32 | github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= 33 | github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= 34 | github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= 35 | github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= 36 | github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= 37 | github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= 38 | github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= 39 | github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= 40 | github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= 41 | github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= 42 | github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= 43 | github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= 44 | github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= 45 | github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= 46 | github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= 47 | github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= 48 | github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= 49 | github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= 50 | github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= 51 | github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= 52 | github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= 53 | github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= 54 | github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= 55 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 56 | github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= 57 | github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= 58 | github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 59 | github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= 60 | github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= 61 | github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= 62 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 63 | github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= 64 | github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= 65 | github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= 66 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 67 | github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 68 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 69 | github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= 70 | github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= 71 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 72 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 73 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 74 | github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= 75 | github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= 76 | github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= 77 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= 78 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= 79 | github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= 80 | github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= 81 | github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= 82 | github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= 83 | github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= 84 | github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= 85 | github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= 86 | github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= 87 | github.com/docker/docker v1.6.2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= 88 | github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= 89 | github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= 90 | github.com/ebfe/scard v0.0.0-20190212122703-c3d1b1916a95 h1:OM0MnUcXBysj7ZtXvThVWHMoahuKQ8FuwIdeSLcNdP4= 91 | github.com/ebfe/scard v0.0.0-20190212122703-c3d1b1916a95/go.mod h1:8hHvF8DlEq5kE3KWOsZQezdWq1OTOVxZArZMscS954E= 92 | github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= 93 | github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= 94 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 95 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 96 | github.com/ethereum/go-ethereum v1.10.26 h1:i/7d9RBBwiXCEuyduBQzJw/mKmnvzsN14jqBmytw72s= 97 | github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= 98 | github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= 99 | github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= 100 | github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= 101 | github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= 102 | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= 103 | github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= 104 | github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= 105 | github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= 106 | github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= 107 | github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= 108 | github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 109 | github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= 110 | github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= 111 | github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= 112 | github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= 113 | github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= 114 | github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= 115 | github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= 116 | github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= 117 | github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= 118 | github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= 119 | github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= 120 | github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= 121 | github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= 122 | github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= 123 | github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= 124 | github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= 125 | github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= 126 | github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 127 | github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= 128 | github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= 129 | github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= 130 | github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= 131 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 132 | github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 133 | github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 134 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 135 | github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 136 | github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= 137 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 138 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 139 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 140 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 141 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 142 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 143 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 144 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 145 | github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 146 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 147 | github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 148 | github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 149 | github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 150 | github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 151 | github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= 152 | github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 153 | github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 154 | github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= 155 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 156 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 157 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 158 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 159 | github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 160 | github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 161 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 162 | github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 163 | github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= 164 | github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= 165 | github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= 166 | github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= 167 | github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= 168 | github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 169 | github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= 170 | github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= 171 | github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= 172 | github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= 173 | github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 174 | github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= 175 | github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= 176 | github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 177 | github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 178 | github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= 179 | github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= 180 | github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= 181 | github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= 182 | github.com/hsanjuan/go-ndef v0.0.1 h1:un1E9jEVa0t8j33qT2JFfseOAI3MikbrkmMEn9Lx0Wk= 183 | github.com/hsanjuan/go-ndef v0.0.1/go.mod h1:LqYM55xXg5wubrxucAxkuK8nW+wjFCCZNyfsd9lPR+Q= 184 | github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= 185 | github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= 186 | github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= 187 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= 188 | github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= 189 | github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= 190 | github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= 191 | github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= 192 | github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= 193 | github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= 194 | github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= 195 | github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= 196 | github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= 197 | github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= 198 | github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= 199 | github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= 200 | github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= 201 | github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= 202 | github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= 203 | github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= 204 | github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= 205 | github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= 206 | github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= 207 | github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= 208 | github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= 209 | github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= 210 | github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= 211 | github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= 212 | github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= 213 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 214 | github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= 215 | github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= 216 | github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= 217 | github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= 218 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 219 | github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= 220 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 221 | github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 222 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 223 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 224 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 225 | github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= 226 | github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 227 | github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= 228 | github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= 229 | github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= 230 | github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= 231 | github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= 232 | github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= 233 | github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= 234 | github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= 235 | github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 236 | github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= 237 | github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= 238 | github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= 239 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 240 | github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= 241 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= 242 | github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= 243 | github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= 244 | github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= 245 | github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= 246 | github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= 247 | github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 248 | github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= 249 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 250 | github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 251 | github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= 252 | github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= 253 | github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= 254 | github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= 255 | github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= 256 | github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= 257 | github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= 258 | github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= 259 | github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= 260 | github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= 261 | github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= 262 | github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= 263 | github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= 264 | github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= 265 | github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= 266 | github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= 267 | github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= 268 | github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= 269 | github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= 270 | github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= 271 | github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= 272 | github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= 273 | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 274 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 275 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 276 | github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= 277 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 278 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 279 | github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= 280 | github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= 281 | github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= 282 | github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 283 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 284 | github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= 285 | github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= 286 | github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= 287 | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= 288 | github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= 289 | github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= 290 | github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= 291 | github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= 292 | github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 293 | github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= 294 | github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 295 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 296 | github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= 297 | github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= 298 | github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= 299 | github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= 300 | github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= 301 | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= 302 | github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= 303 | github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= 304 | github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= 305 | github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= 306 | github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= 307 | github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= 308 | github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= 309 | github.com/status-im/keycard-go v0.3.2 h1:YusIF/bHx6YZis8UTOJrpZFnTs4IkRBdmJXqdiXkpFE= 310 | github.com/status-im/keycard-go v0.3.2/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= 311 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 312 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 313 | github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 314 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 315 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 316 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 317 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 318 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 319 | github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= 320 | github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= 321 | github.com/supranational/blst v0.3.8-0.20220526154634-513d2456b344/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= 322 | github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= 323 | github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= 324 | github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= 325 | github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= 326 | github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= 327 | github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= 328 | github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= 329 | github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= 330 | github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= 331 | github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= 332 | github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= 333 | github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= 334 | github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= 335 | github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 336 | github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= 337 | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 338 | go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= 339 | go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= 340 | go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 341 | go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= 342 | go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= 343 | go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= 344 | golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 345 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 346 | golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 347 | golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 348 | golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 349 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 350 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 351 | golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 352 | golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= 353 | golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= 354 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 355 | golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= 356 | golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= 357 | golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 358 | golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 359 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 360 | golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 361 | golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 362 | golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= 363 | golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= 364 | golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= 365 | golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= 366 | golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= 367 | golang.org/x/exp v0.0.0-20220426173459-3bcf042a4bf5/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= 368 | golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= 369 | golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= 370 | golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= 371 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 372 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 373 | golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 374 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 375 | golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 376 | golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 377 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 378 | golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= 379 | golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= 380 | golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= 381 | golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= 382 | golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= 383 | golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= 384 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 385 | golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 386 | golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= 387 | golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= 388 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= 389 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 390 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 391 | golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 392 | golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 393 | golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 394 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 395 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 396 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 397 | golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 398 | golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 399 | golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 400 | golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 401 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 402 | golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 403 | golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 404 | golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= 405 | golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 406 | golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 407 | golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 408 | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 409 | golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 410 | golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 411 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 412 | golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 413 | golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 414 | golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 415 | golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 416 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 417 | golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= 418 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 419 | golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 420 | golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 421 | golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 422 | golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 423 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 424 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 425 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 426 | golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 427 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 428 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 429 | golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 430 | golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 431 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 432 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 433 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 434 | golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 435 | golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 436 | golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 437 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 438 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 439 | golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 440 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 441 | golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 442 | golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 443 | golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 444 | golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 445 | golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 446 | golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 447 | golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 448 | golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 449 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 450 | golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 451 | golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 452 | golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 453 | golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 454 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 455 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 456 | golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 457 | golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 458 | golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 459 | golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 460 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 461 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 462 | golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 463 | golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 464 | golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 465 | golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 466 | golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 467 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 468 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 469 | golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 470 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 471 | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 472 | golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 473 | golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= 474 | golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 475 | golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= 476 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 477 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 478 | golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 479 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 480 | golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 481 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 482 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 483 | golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 484 | golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 485 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 486 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 487 | golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= 488 | golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 489 | golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 490 | golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 491 | golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 492 | golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 493 | golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 494 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 495 | golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 496 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 497 | golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 498 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 499 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 500 | golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 501 | golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 502 | golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 503 | golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 504 | golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 505 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 506 | golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 507 | golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 508 | golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 509 | golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 510 | golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 511 | golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 512 | golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 513 | golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 514 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 515 | golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 516 | golang.org/x/tools v0.0.0-20191126055441-b0650ceb63d9/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 517 | golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 518 | golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 519 | golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 520 | golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= 521 | golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= 522 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= 523 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 524 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 525 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 526 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 527 | golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= 528 | gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= 529 | gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= 530 | gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= 531 | gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= 532 | gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= 533 | gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= 534 | google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= 535 | google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= 536 | google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= 537 | google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= 538 | google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= 539 | google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= 540 | google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= 541 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 542 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 543 | google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 544 | google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= 545 | google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 546 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 547 | google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 548 | google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 549 | google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 550 | google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 551 | google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 552 | google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 553 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 554 | google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= 555 | google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 556 | google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 557 | google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 558 | google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 559 | google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 560 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 561 | google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= 562 | google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= 563 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 564 | google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 565 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 566 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 567 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 568 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 569 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 570 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 571 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= 572 | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 573 | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 574 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 575 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 576 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 577 | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 578 | gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= 579 | gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= 580 | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= 581 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 582 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 583 | gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 584 | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 585 | gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 586 | gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 587 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 588 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 589 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 590 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 591 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 592 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 593 | honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 594 | honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 595 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 596 | honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= 597 | honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= 598 | rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= 599 | rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= 600 | -------------------------------------------------------------------------------- /initializer.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "errors" 5 | 6 | keycard "github.com/status-im/keycard-go" 7 | "github.com/status-im/keycard-go/apdu" 8 | "github.com/status-im/keycard-go/globalplatform" 9 | "github.com/status-im/keycard-go/io" 10 | "github.com/status-im/keycard-go/types" 11 | ) 12 | 13 | var ( 14 | errAppletNotInstalled = errors.New("applet not installed") 15 | errCardNotInitialized = errors.New("card not initialized") 16 | errCardAlreadyInitialized = errors.New("card already initialized") 17 | 18 | ErrNotInitialized = errors.New("card not initialized") 19 | ErrNotInstalled = errors.New("applet not initialized") 20 | ErrCashNotInstalled = errors.New("cash applet not initialized") 21 | ) 22 | 23 | // Initializer defines a struct with methods to install applets and initialize a card. 24 | type Initializer struct { 25 | c types.Channel 26 | } 27 | 28 | // NewInitializer returns a new Initializer that communicates to Transmitter t. 29 | func NewInitializer(t io.Transmitter) *Initializer { 30 | return &Initializer{ 31 | c: io.NewNormalChannel(t), 32 | } 33 | } 34 | 35 | func (i *Initializer) Init() (*keycard.Secrets, error) { 36 | logger.Info("initialization started") 37 | cmdSet := keycard.NewCommandSet(i.c) 38 | 39 | secrets, err := keycard.GenerateSecrets() 40 | if err != nil { 41 | return nil, err 42 | } 43 | 44 | logger.Info("select keycard applet") 45 | err = cmdSet.Select() 46 | if err != nil { 47 | logger.Error("select failed", "error", err) 48 | return nil, err 49 | } 50 | 51 | if !cmdSet.ApplicationInfo.Installed { 52 | logger.Error("initialization failed", "error", errAppletNotInstalled) 53 | return nil, errAppletNotInstalled 54 | } 55 | 56 | if cmdSet.ApplicationInfo.Initialized { 57 | logger.Error("initialization failed", "error", errCardAlreadyInitialized) 58 | return nil, errCardAlreadyInitialized 59 | } 60 | 61 | logger.Info("initializing") 62 | err = cmdSet.Init(secrets) 63 | if err != nil { 64 | return nil, err 65 | } 66 | 67 | return secrets, nil 68 | } 69 | 70 | // Info returns a types.ApplicationInfo struct with info about the card. 71 | func (i *Initializer) Info() (*types.ApplicationInfo, *types.CashApplicationInfo, error) { 72 | logger.Info("info started") 73 | cmdSet := keycard.NewCommandSet(i.c) 74 | 75 | logger.Info("select keycard applet") 76 | err := cmdSet.Select() 77 | if err != nil { 78 | if e, ok := err.(*apdu.ErrBadResponse); ok && e.Sw == globalplatform.SwFileNotFound { 79 | err = nil 80 | } else { 81 | logger.Error("select failed", "error", err) 82 | } 83 | } 84 | 85 | logger.Info("select cash applet") 86 | cashCmdSet := keycard.NewCashCommandSet(i.c) 87 | err = cashCmdSet.Select() 88 | if err != nil { 89 | if e, ok := err.(*apdu.ErrBadResponse); ok && e.Sw == globalplatform.SwFileNotFound { 90 | err = nil 91 | } else { 92 | logger.Error("select failed", "error", err) 93 | } 94 | } 95 | 96 | return cmdSet.ApplicationInfo, cashCmdSet.CashApplicationInfo, err 97 | } 98 | -------------------------------------------------------------------------------- /installer.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "os" 7 | "time" 8 | 9 | "github.com/ethereum/go-ethereum/crypto" 10 | keycard "github.com/status-im/keycard-go" 11 | "github.com/status-im/keycard-go/apdu" 12 | "github.com/status-im/keycard-go/globalplatform" 13 | "github.com/status-im/keycard-go/identifiers" 14 | keycardio "github.com/status-im/keycard-go/io" 15 | "github.com/status-im/keycard-go/types" 16 | ) 17 | 18 | var ( 19 | ErrAppletAlreadyInstalled = errors.New("keycard applet already installed") 20 | ) 21 | 22 | // Installer defines a struct with methods to install applets in a card. 23 | type Installer struct { 24 | c types.Channel 25 | } 26 | 27 | // NewInstaller returns a new Installer that communicates to Transmitter t. 28 | func NewInstaller(t keycardio.Transmitter) *Installer { 29 | return &Installer{ 30 | c: keycardio.NewNormalChannel(t), 31 | } 32 | } 33 | 34 | // Install installs the applet from the specified capFile. 35 | func (i *Installer) Install(capFile *os.File, overwriteApplet bool, installKeycard bool, installCash bool, installNDEF bool, ndefRecordTemplate string) error { 36 | logger.Info("installation started") 37 | startTime := time.Now() 38 | cmdSet := globalplatform.NewCommandSet(i.c) 39 | 40 | logger.Info("check if keycard is already installed") 41 | if err := i.checkAppletAlreadyInstalled(cmdSet, overwriteApplet); err != nil { 42 | logger.Error("check if keycard is already installed failed", "error", err) 43 | return err 44 | } 45 | 46 | logger.Info("select ISD") 47 | err := cmdSet.Select() 48 | if err != nil { 49 | logger.Error("select failed", "error", err) 50 | return err 51 | } 52 | 53 | logger.Info("opening secure channel") 54 | if err = cmdSet.OpenSecureChannel(); err != nil { 55 | logger.Error("open secure channel failed", "error", err) 56 | return err 57 | } 58 | 59 | logger.Info("delete old version (if present)") 60 | if err = cmdSet.DeleteKeycardInstancesAndPackage(); err != nil { 61 | logger.Error("delete keycard instances and package failed", "error", err) 62 | return err 63 | } 64 | 65 | logger.Info("loading package") 66 | callback := func(index, total int) { 67 | logger.Debug(fmt.Sprintf("loading %d/%d", index+1, total)) 68 | } 69 | if err = cmdSet.LoadKeycardPackage(capFile, callback); err != nil { 70 | logger.Error("load failed", "error", err) 71 | return err 72 | } 73 | 74 | if installKeycard { 75 | logger.Info("installing Keycard applet") 76 | if err = cmdSet.InstallKeycardApplet(); err != nil { 77 | logger.Error("installing Keycard applet failed", "error", err) 78 | return err 79 | } 80 | } 81 | 82 | if installCash { 83 | logger.Info("installing Cash applet") 84 | if err = cmdSet.InstallCashApplet(); err != nil { 85 | logger.Error("installing Cash applet failed", "error", err) 86 | return err 87 | } 88 | } 89 | 90 | if installNDEF { 91 | var ( 92 | ndefURL string 93 | ndefRecord []byte 94 | ) 95 | 96 | if ndefRecordTemplate != "" { 97 | ndefURL, ndefRecord, err = i.buildNDEFRecordWithCashAppletData(ndefRecordTemplate) 98 | if err != nil { 99 | return err 100 | } 101 | } 102 | 103 | logger.Info("setting NDEF url", "url", ndefURL) 104 | logger.Info("re-select ISD") 105 | err = cmdSet.Select() 106 | if err != nil { 107 | logger.Error("re-select failed", "error", err) 108 | return err 109 | } 110 | 111 | logger.Info("re-opening secure channel") 112 | if err = cmdSet.OpenSecureChannel(); err != nil { 113 | logger.Error("open secure channel failed", "error", err) 114 | return err 115 | } 116 | 117 | logger.Info("installing NDEF applet") 118 | if err = cmdSet.InstallNDEFApplet(ndefRecord); err != nil { 119 | logger.Error("installing NDEF applet failed", "error", err) 120 | return err 121 | } 122 | } 123 | 124 | elapsed := time.Now().Sub(startTime) 125 | logger.Info(fmt.Sprintf("installation completed in %f seconds", elapsed.Seconds())) 126 | return err 127 | } 128 | 129 | // Delete deletes the applet from the card. 130 | func (i *Installer) Delete() error { 131 | cmdSet := globalplatform.NewCommandSet(i.c) 132 | 133 | logger.Info("select ISD") 134 | err := cmdSet.Select() 135 | if err != nil { 136 | logger.Error("select failed", "error", err) 137 | return err 138 | } 139 | 140 | logger.Info("opening secure channel") 141 | if err = cmdSet.OpenSecureChannel(); err != nil { 142 | logger.Error("open secure channel failed", "error", err) 143 | return err 144 | } 145 | 146 | logger.Info("delete old version") 147 | if err = cmdSet.DeleteKeycardInstancesAndPackage(); err != nil { 148 | logger.Error("delete keycard instances and package failed", "error", err) 149 | return err 150 | } 151 | 152 | return nil 153 | } 154 | 155 | func (i *Installer) buildNDEFRecordWithCashAppletData(ndefRecordTemplate string) (string, []byte, error) { 156 | cashCmdSet := keycard.NewCashCommandSet(i.c) 157 | logger.Info("selecting cash applet") 158 | err := cashCmdSet.Select() 159 | if err != nil { 160 | logger.Error("error selecting cash applet", "error", err) 161 | return "", nil, err 162 | } 163 | 164 | info := cashCmdSet.CashApplicationInfo 165 | logger.Info("parsing cash applet public key", "public key", fmt.Sprintf("0x%x", info.PublicKey)) 166 | ecdsaPubKey, err := crypto.UnmarshalPubkey(info.PublicKey) 167 | if err != nil { 168 | logger.Error("error parsing cash applet public key", "error", err) 169 | return "", nil, err 170 | } 171 | 172 | address := crypto.PubkeyToAddress(*ecdsaPubKey) 173 | logger.Info("deriving cash applet address", "address", address.String()) 174 | vars := map[string]string{ 175 | "cashAddress": address.String(), 176 | } 177 | 178 | return buildNdefDataWithURL(ndefRecordTemplate, vars) 179 | } 180 | 181 | func (i *Installer) checkAppletAlreadyInstalled(cmdSet *globalplatform.CommandSet, overwriteApplet bool) error { 182 | keycardInstanceAID, err := identifiers.KeycardInstanceAID(identifiers.KeycardDefaultInstanceIndex) 183 | if err != nil { 184 | return err 185 | } 186 | 187 | err = cmdSet.SelectAID(keycardInstanceAID) 188 | switch e := err.(type) { 189 | case *apdu.ErrBadResponse: 190 | // keycard applet not found, so not installed yet. 191 | if e.Sw == globalplatform.SwFileNotFound { 192 | return nil 193 | } 194 | return err 195 | case nil: // selected successfully, so it's already installed 196 | if overwriteApplet { 197 | return nil 198 | } 199 | return ErrAppletAlreadyInstalled 200 | default: 201 | return err 202 | } 203 | } 204 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "encoding/hex" 6 | "errors" 7 | "flag" 8 | "fmt" 9 | stdlog "log" 10 | "os" 11 | "strconv" 12 | "strings" 13 | 14 | "github.com/ebfe/scard" 15 | "github.com/ethereum/go-ethereum/crypto" 16 | "github.com/ethereum/go-ethereum/log" 17 | ) 18 | 19 | var version string 20 | 21 | type commandFunc func(*scard.Card) error 22 | 23 | var ( 24 | logger = log.New("package", "keycard-cli") 25 | 26 | commands map[string]commandFunc 27 | command string 28 | 29 | flagCapFile = flag.String("a", "", "applet cap file path") 30 | flagKeycardApplet = flag.Bool("keycard-applet", true, "install keycard applet") 31 | flagCashApplet = flag.Bool("cash-applet", true, "install cash applet") 32 | flagNDEFApplet = flag.Bool("ndef-applet", true, "install NDEF applet") 33 | flagOverwrite = flag.Bool("f", false, "force applet installation if already installed") 34 | flagLogLevel = flag.String("l", "", `Log level, one of: "error", "warn", "info", "debug", and "trace"`) 35 | flagNDEFTemplate = flag.String("ndef", "", "Specify a URL to use in the NDEF record. Use the {{.cashAddress}} variable to get the cash address: http://example.com/{{.cashAddress}}.") 36 | ) 37 | 38 | func initLogger() { 39 | if *flagLogLevel == "" { 40 | *flagLogLevel = "info" 41 | } 42 | 43 | level, err := log.LvlFromString(strings.ToLower(*flagLogLevel)) 44 | if err != nil { 45 | stdlog.Fatal(err) 46 | } 47 | 48 | handler := log.StreamHandler(os.Stderr, log.TerminalFormat(true)) 49 | filteredHandler := log.LvlFilterHandler(level, handler) 50 | log.Root().SetHandler(filteredHandler) 51 | } 52 | 53 | func init() { 54 | commands = map[string]commandFunc{ 55 | "version": commandVersion, 56 | "install": commandInstall, 57 | "info": commandInfo, 58 | "delete": commandDelete, 59 | "init": commandInit, 60 | "shell": commandShell, 61 | } 62 | 63 | if len(os.Args) < 2 { 64 | usage() 65 | } 66 | 67 | command = os.Args[1] 68 | if len(os.Args) > 2 { 69 | flag.CommandLine.Parse(os.Args[2:]) 70 | } 71 | 72 | initLogger() 73 | } 74 | 75 | func usage() { 76 | fmt.Printf("\nUsage:\n keycard COMMAND [FLAGS]\n\nAvailable commands:\n") 77 | for name := range commands { 78 | fmt.Printf(" %s\n", name) 79 | } 80 | fmt.Print("\nFlags:\n\n") 81 | flag.PrintDefaults() 82 | os.Exit(1) 83 | } 84 | 85 | func fail(msg string, ctx ...interface{}) { 86 | logger.Error(msg, ctx...) 87 | os.Exit(1) 88 | } 89 | 90 | func waitForCard(ctx *scard.Context, readers []string) (int, error) { 91 | rs := make([]scard.ReaderState, len(readers)) 92 | 93 | for i := range rs { 94 | rs[i].Reader = readers[i] 95 | rs[i].CurrentState = scard.StateUnaware 96 | } 97 | 98 | for { 99 | for i := range rs { 100 | if rs[i].EventState&scard.StatePresent != 0 { 101 | return i, nil 102 | } 103 | 104 | rs[i].CurrentState = rs[i].EventState 105 | } 106 | 107 | err := ctx.GetStatusChange(rs, -1) 108 | if err != nil { 109 | return -1, err 110 | } 111 | } 112 | } 113 | 114 | func main() { 115 | if command == "version" { 116 | commandVersion(nil) 117 | return 118 | } 119 | 120 | ctx, err := scard.EstablishContext() 121 | if err != nil { 122 | fail("error establishing card context", "error", err) 123 | } 124 | defer func() { 125 | if err := ctx.Release(); err != nil { 126 | logger.Error("error releasing context", "error", err) 127 | } 128 | }() 129 | 130 | readers, err := ctx.ListReaders() 131 | if err != nil { 132 | fail("error getting readers", "error", err) 133 | } 134 | 135 | logger.Info("waiting for a card") 136 | if len(readers) == 0 { 137 | fail("no smartcard reader found") 138 | } 139 | 140 | index, err := waitForCard(ctx, readers) 141 | if err != nil { 142 | fail("error waiting for card", "error", err) 143 | } 144 | 145 | logger.Info("card found", "index", index) 146 | reader := readers[index] 147 | 148 | logger.Debug("using reader", "name", reader) 149 | logger.Debug("connecting to card", "reader", reader) 150 | card, err := ctx.Connect(reader, scard.ShareShared, scard.ProtocolAny) 151 | if err != nil { 152 | fail("error connecting to card", "error", err) 153 | } 154 | defer func() { 155 | if err := card.Disconnect(scard.ResetCard); err != nil { 156 | logger.Error("error disconnecting card", "error", err) 157 | } 158 | }() 159 | 160 | status, err := card.Status() 161 | if err != nil { 162 | fail("error getting card status", "error", err) 163 | } 164 | 165 | switch status.ActiveProtocol { 166 | case scard.ProtocolT0: 167 | logger.Debug("card protocol", "T", "0") 168 | case scard.ProtocolT1: 169 | logger.Debug("card protocol", "T", "1") 170 | default: 171 | logger.Debug("card protocol", "T", "unknown") 172 | } 173 | 174 | if f, ok := commands[command]; ok { 175 | err = f(card) 176 | if err != nil { 177 | logger.Error("error executing command", "command", command, "error", err) 178 | os.Exit(1) 179 | } 180 | os.Exit(0) 181 | } 182 | 183 | fail("unknown command", "command", command) 184 | usage() 185 | } 186 | 187 | func ask(description string) string { 188 | r := bufio.NewReader(os.Stdin) 189 | fmt.Printf("%s: ", description) 190 | text, err := r.ReadString('\n') 191 | if err != nil { 192 | stdlog.Fatal(err) 193 | } 194 | 195 | return strings.TrimSpace(text) 196 | } 197 | 198 | func askHex(description string) []byte { 199 | s := ask(description) 200 | if s[:2] == "0x" { 201 | s = s[2:] 202 | } 203 | 204 | data, err := hex.DecodeString(s) 205 | if err != nil { 206 | stdlog.Fatal(err) 207 | } 208 | 209 | return data 210 | } 211 | 212 | func askInt(description string) int { 213 | s := ask(description) 214 | i, err := strconv.ParseInt(s, 10, 8) 215 | if err != nil { 216 | stdlog.Fatal(err) 217 | } 218 | 219 | return int(i) 220 | } 221 | 222 | func commandVersion(card *scard.Card) error { 223 | fmt.Printf("version %+v\n", version) 224 | return nil 225 | } 226 | 227 | func commandInstall(card *scard.Card) error { 228 | if *flagCapFile == "" { 229 | logger.Error("you must specify a cap file path with the -a flag\n") 230 | usage() 231 | } 232 | 233 | f, err := os.Open(*flagCapFile) 234 | if err != nil { 235 | fail("error opening cap file", "error", err) 236 | } 237 | defer f.Close() 238 | 239 | i := NewInstaller(card) 240 | return i.Install(f, *flagOverwrite, *flagKeycardApplet, *flagCashApplet, *flagNDEFApplet, *flagNDEFTemplate) 241 | } 242 | 243 | func commandInfo(card *scard.Card) error { 244 | i := NewInitializer(card) 245 | info, cashInfo, err := i.Info() 246 | if err != nil { 247 | return err 248 | } 249 | 250 | var keyInitialized bool 251 | if len(info.KeyUID) > 0 { 252 | keyInitialized = true 253 | } 254 | 255 | fmt.Printf("Keycard Applet:\n") 256 | fmt.Printf(" Installed: %+v\n", info.Installed) 257 | fmt.Printf(" Initialized: %+v\n", info.Initialized) 258 | fmt.Printf(" Key Initialized: %+v\n", keyInitialized) 259 | fmt.Printf(" InstanceUID: 0x%x\n", info.InstanceUID) 260 | fmt.Printf(" SecureChannelPublicKey: 0x%x\n", info.SecureChannelPublicKey) 261 | fmt.Printf(" Version: 0x%x\n", info.Version) 262 | fmt.Printf(" AvailableSlots: 0x%x\n", info.AvailableSlots) 263 | fmt.Printf(" KeyUID: 0x%x\n", info.KeyUID) 264 | fmt.Printf(" Capabilities:\n") 265 | fmt.Printf(" Secure channel:%v\n", info.HasSecureChannelCapability()) 266 | fmt.Printf(" Key management:%v\n", info.HasKeyManagementCapability()) 267 | fmt.Printf(" Credentials Management:%v\n", info.HasCredentialsManagementCapability()) 268 | fmt.Printf(" NDEF:%v\n", info.HasNDEFCapability()) 269 | fmt.Printf("Cash Applet:\n") 270 | 271 | if len(cashInfo.PublicKey) == 0 { 272 | fmt.Printf(" Installed: %+v\n", false) 273 | return nil 274 | } 275 | 276 | ecdsaPubKey, err := crypto.UnmarshalPubkey(cashInfo.PublicKey) 277 | if err != nil { 278 | return err 279 | } 280 | 281 | cashAddress := crypto.PubkeyToAddress(*ecdsaPubKey) 282 | 283 | fmt.Printf(" Installed: %+v\n", cashInfo.Installed) 284 | fmt.Printf(" PublicKey: 0x%x\n", cashInfo.PublicKey) 285 | fmt.Printf(" Address: 0x%x\n", cashAddress) 286 | fmt.Printf(" Public Data: 0x%x\n", cashInfo.PublicData) 287 | fmt.Printf(" Version: 0x%x\n", cashInfo.Version) 288 | 289 | return nil 290 | } 291 | 292 | func commandDelete(card *scard.Card) error { 293 | i := NewInstaller(card) 294 | err := i.Delete() 295 | if err != nil { 296 | return err 297 | } 298 | 299 | fmt.Printf("applet deleted\n") 300 | 301 | return nil 302 | } 303 | 304 | func commandInit(card *scard.Card) error { 305 | i := NewInitializer(card) 306 | secrets, err := i.Init() 307 | if err != nil { 308 | return err 309 | } 310 | 311 | fmt.Printf("PIN %s\n", secrets.Pin()) 312 | fmt.Printf("PUK %s\n", secrets.Puk()) 313 | fmt.Printf("Pairing password: %s\n", secrets.PairingPass()) 314 | 315 | return nil 316 | } 317 | 318 | func commandShell(card *scard.Card) error { 319 | fi, _ := os.Stdin.Stat() 320 | if (fi.Mode() & os.ModeCharDevice) == 0 { 321 | s := NewShell(card) 322 | return s.Run() 323 | } else { 324 | return errors.New("non interactive shell. you must pipe commands") 325 | } 326 | } 327 | -------------------------------------------------------------------------------- /ndef.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "encoding/binary" 6 | "html/template" 7 | 8 | "github.com/hsanjuan/go-ndef" 9 | ) 10 | 11 | func buildURL(urlTemplate string, vars interface{}) (string, error) { 12 | tpl, err := template.New("").Parse(urlTemplate) 13 | if err != nil { 14 | return "", err 15 | } 16 | 17 | urlBuf := bytes.NewBufferString("") 18 | err = tpl.Execute(urlBuf, vars) 19 | if err != nil { 20 | return "", err 21 | } 22 | 23 | return urlBuf.String(), nil 24 | } 25 | 26 | func buildNdefDataWithURL(urlTemplate string, vars interface{}) (string, []byte, error) { 27 | url, err := buildURL(urlTemplate, vars) 28 | if err != nil { 29 | return "", nil, err 30 | } 31 | 32 | msg := ndef.NewMessageFromRecords(ndef.NewURIRecord(url)) 33 | msgBuf, err := msg.Marshal() 34 | if err != nil { 35 | return "", nil, err 36 | } 37 | 38 | buf := make([]byte, len(msgBuf)+2) 39 | binary.BigEndian.PutUint16(buf[0:], uint16(len(msgBuf))) 40 | copy(buf[2:], msgBuf) 41 | 42 | return url, buf, nil 43 | } 44 | -------------------------------------------------------------------------------- /shell.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "bytes" 6 | "encoding/hex" 7 | "errors" 8 | "fmt" 9 | "html/template" 10 | "io" 11 | "log" 12 | "os" 13 | "regexp" 14 | "strconv" 15 | "strings" 16 | 17 | "github.com/ethereum/go-ethereum/crypto" 18 | keycard "github.com/status-im/keycard-go" 19 | "github.com/status-im/keycard-go/apdu" 20 | "github.com/status-im/keycard-go/globalplatform" 21 | keycardio "github.com/status-im/keycard-go/io" 22 | "github.com/status-im/keycard-go/types" 23 | ) 24 | 25 | type shellCommand = func(args ...string) error 26 | 27 | type TemplateFuncs struct { 28 | s *Shell 29 | } 30 | 31 | func (t *TemplateFuncs) FuncMap() template.FuncMap { 32 | return template.FuncMap{ 33 | "env": t.Env, 34 | "session_pairing_key": t.SessionPairingKey, 35 | "session_pairing_index": t.SessionPairingIndex, 36 | "session_pin": t.SessionPIN, 37 | "session_puk": t.SessionPUK, 38 | "session_pairing_password": t.SessionPairingPassword, 39 | } 40 | } 41 | 42 | func (t *TemplateFuncs) Env(name string) (string, error) { 43 | value := os.Getenv(name) 44 | if value == "" { 45 | return "", fmt.Errorf("env variable is empty: %s", name) 46 | } 47 | 48 | return value, nil 49 | } 50 | 51 | func (t *TemplateFuncs) SessionPairingKey() (string, error) { 52 | if t.s.kCmdSet.PairingInfo == nil { 53 | return "", errors.New("pairing key not known") 54 | } 55 | 56 | return fmt.Sprintf("%x", t.s.kCmdSet.PairingInfo.Key), nil 57 | } 58 | 59 | func (t *TemplateFuncs) SessionPairingIndex() (string, error) { 60 | if t.s.kCmdSet.PairingInfo == nil { 61 | return "", errors.New("pairing index not known") 62 | } 63 | 64 | return fmt.Sprintf("%d", t.s.kCmdSet.PairingInfo.Index), nil 65 | } 66 | 67 | func (t *TemplateFuncs) SessionPIN() (string, error) { 68 | if t.s.Secrets == nil { 69 | return "", errors.New("pin is not set") 70 | } 71 | 72 | return t.s.Secrets.Pin(), nil 73 | } 74 | 75 | func (t *TemplateFuncs) SessionPUK() (string, error) { 76 | if t.s.Secrets == nil { 77 | return "", errors.New("puk is not set") 78 | } 79 | 80 | return t.s.Secrets.Puk(), nil 81 | } 82 | 83 | func (t *TemplateFuncs) SessionPairingPassword() (string, error) { 84 | if t.s.Secrets == nil { 85 | return "", errors.New("pairing password is not set") 86 | } 87 | 88 | return t.s.Secrets.PairingPass(), nil 89 | } 90 | 91 | type Shell struct { 92 | t keycardio.Transmitter 93 | c types.Channel 94 | Secrets *keycard.Secrets 95 | gpCmdSet *globalplatform.CommandSet 96 | kCmdSet *keycard.CommandSet 97 | cashCmdSet *keycard.CashCommandSet 98 | commands map[string]shellCommand 99 | out *bytes.Buffer 100 | tplFuncMap template.FuncMap 101 | } 102 | 103 | func NewShell(t keycardio.Transmitter) *Shell { 104 | c := keycardio.NewNormalChannel(t) 105 | 106 | s := &Shell{ 107 | t: t, 108 | c: c, 109 | kCmdSet: keycard.NewCommandSet(c), 110 | cashCmdSet: keycard.NewCashCommandSet(c), 111 | gpCmdSet: globalplatform.NewCommandSet(c), 112 | out: new(bytes.Buffer), 113 | } 114 | 115 | tplFuncs := &TemplateFuncs{s} 116 | s.tplFuncMap = tplFuncs.FuncMap() 117 | 118 | s.commands = map[string]shellCommand{ 119 | "echo": s.commandEcho, 120 | "gp-send-apdu": s.commandGPSendAPDU, 121 | "gp-select": s.commandGPSelect, 122 | "gp-open-secure-channel": s.commandGPOpenSecureChannel, 123 | "gp-delete": s.commandGPDelete, 124 | "gp-load": s.commandGPLoad, 125 | "gp-install-for-install": s.commandGPInstallForInstall, 126 | "gp-get-status": s.commandGPGetStatus, 127 | "keycard-init": s.commandKeycardInit, 128 | "keycard-select": s.commandKeycardSelect, 129 | "keycard-pair": s.commandKeycardPair, 130 | "keycard-unpair": s.commandKeycardUnpair, 131 | "keycard-open-secure-channel": s.commandKeycardOpenSecureChannel, 132 | "keycard-get-status": s.commandKeycardGetStatus, 133 | "keycard-set-secrets": s.commandKeycardSetSecrets, 134 | "keycard-set-pairing": s.commandKeycardSetPairing, 135 | "keycard-verify-pin": s.commandKeycardVerifyPIN, 136 | "keycard-change-pin": s.commandKeycardChangePIN, 137 | "keycard-change-puk": s.commandKeycardChangePUK, 138 | "keycard-unblock-pin": s.commandKeycardUnblockPin, 139 | "keycard-change-pairing-secret": s.commandKeycardChangePairingSecret, 140 | "keycard-generate-key": s.commandKeycardGenerateKey, 141 | "keycard-remove-key": s.commandKeycardRemoveKey, 142 | "keycard-derive-key": s.commandKeycardDeriveKey, 143 | "keycard-export-key-private": s.commandKeycardExportKeyPrivate, 144 | "keycard-export-key-public": s.commandKeycardExportKeyPublic, 145 | "keycard-sign": s.commandKeycardSign, 146 | "keycard-sign-with-path": s.commandKeycardSignWithPath, 147 | "keycard-sign-message": s.commandKeycardSignMessage, 148 | "keycard-sign-pinless": s.commandKeycardSignPinless, 149 | "keycard-sign-message-pinless": s.commandKeycardSignMessagePinless, 150 | "keycard-set-pinless-path": s.commandKeycardSetPinlessPath, 151 | "keycard-load-seed": s.commandKeycardLoadSeed, 152 | "keycard-generate-mnemonic": s.commandKeycardGenerateMnemonic, 153 | "keycard-identify": s.commandKeycardIdentify, 154 | "cash-select": s.commandCashSelect, 155 | "cash-sign": s.commandCashSign, 156 | } 157 | 158 | return s 159 | } 160 | 161 | func (s *Shell) write(str string) { 162 | s.out.WriteString(str) 163 | } 164 | 165 | func (s *Shell) flushOut() { 166 | io.Copy(os.Stdout, s.out) 167 | } 168 | 169 | func (s *Shell) Run() error { 170 | reader := bufio.NewReader(os.Stdin) 171 | defer s.flushOut() 172 | 173 | for { 174 | line, err := reader.ReadString('\n') 175 | if err != nil && err != io.EOF { 176 | break 177 | } 178 | 179 | err = s.evalLine(line) 180 | if err != nil { 181 | return err 182 | } 183 | } 184 | 185 | return nil 186 | } 187 | 188 | func (s *Shell) commandEcho(args ...string) error { 189 | fmt.Printf("> %s\n", strings.Join(args, " ")) 190 | return nil 191 | } 192 | 193 | func (s *Shell) commandGPSendAPDU(args ...string) error { 194 | if err := s.requireArgs(args, 1); err != nil { 195 | return err 196 | } 197 | 198 | rawCmd, err := hex.DecodeString(args[0]) 199 | if err != nil { 200 | return err 201 | } 202 | 203 | cmd, err := apdu.ParseCommand(rawCmd) 204 | if err != nil { 205 | logger.Error("error parsing command", "error", err) 206 | return err 207 | } 208 | 209 | var channel types.Channel 210 | 211 | if sc := s.gpCmdSet.SecureChannel(); sc != nil { 212 | channel = sc 213 | } else { 214 | channel = s.gpCmdSet.Channel() 215 | } 216 | 217 | logger.Info(fmt.Sprintf("send apdu %x", rawCmd)) 218 | resp, err := channel.Send(cmd) 219 | if err != nil { 220 | logger.Error("send apdu failed", "error", err) 221 | return err 222 | } 223 | 224 | if resp.Sw != apdu.SwOK { 225 | logger.Error("unexpected response", "sw", fmt.Sprintf("%x", resp.Sw)) 226 | return apdu.NewErrBadResponse(resp.Sw, "unexpected response") 227 | } 228 | 229 | return nil 230 | } 231 | 232 | func (s *Shell) commandGPSelect(args ...string) error { 233 | if err := s.requireArgs(args, 0, 1); err != nil { 234 | return err 235 | } 236 | 237 | if len(args) == 0 { 238 | logger.Info("select ISD") 239 | return s.gpCmdSet.Select() 240 | } 241 | 242 | aid, err := hex.DecodeString(args[0]) 243 | if err != nil { 244 | return err 245 | } 246 | 247 | logger.Info(fmt.Sprintf("select AID %x", aid)) 248 | return s.gpCmdSet.SelectAID(aid) 249 | } 250 | 251 | func (s *Shell) commandGPOpenSecureChannel(args ...string) error { 252 | if err := s.requireArgs(args, 0); err != nil { 253 | return err 254 | } 255 | 256 | logger.Info("open secure channel") 257 | return s.gpCmdSet.OpenSecureChannel() 258 | } 259 | 260 | func (s *Shell) commandGPDelete(args ...string) error { 261 | if err := s.requireArgs(args, 1); err != nil { 262 | return err 263 | } 264 | 265 | aid, err := hex.DecodeString(args[0]) 266 | if err != nil { 267 | return err 268 | } 269 | 270 | logger.Info(fmt.Sprintf("delete %x", aid)) 271 | 272 | return s.gpCmdSet.DeleteObject(aid) 273 | } 274 | 275 | func (s *Shell) commandGPLoad(args ...string) error { 276 | if err := s.requireArgs(args, 2); err != nil { 277 | return err 278 | } 279 | 280 | f, err := os.Open(args[0]) 281 | if err != nil { 282 | return err 283 | } 284 | defer f.Close() 285 | 286 | pkgAID, err := hex.DecodeString(args[1]) 287 | if err != nil { 288 | return err 289 | } 290 | 291 | logger.Info("load package") 292 | callback := func(index, total int) { 293 | logger.Debug(fmt.Sprintf("loading %d/%d", index+1, total)) 294 | } 295 | if err = s.gpCmdSet.LoadPackage(f, pkgAID, callback); err != nil { 296 | logger.Error("load failed", "error", err) 297 | return err 298 | } 299 | 300 | return nil 301 | } 302 | 303 | func (s *Shell) commandGPInstallForInstall(args ...string) error { 304 | if err := s.requireArgs(args, 3, 4); err != nil { 305 | return err 306 | } 307 | 308 | pkgAID, err := hex.DecodeString(args[0]) 309 | if err != nil { 310 | return err 311 | } 312 | 313 | appletAID, err := hex.DecodeString(args[1]) 314 | if err != nil { 315 | return err 316 | } 317 | 318 | instanceAID, err := hex.DecodeString(args[2]) 319 | if err != nil { 320 | return err 321 | } 322 | 323 | var params []byte 324 | 325 | if len(args) == 4 { 326 | params, err = hex.DecodeString(args[3]) 327 | if err != nil { 328 | return err 329 | } 330 | } 331 | 332 | logger.Info("install for install", "pkg", fmt.Sprintf("%x", pkgAID), "applet", fmt.Sprintf("%x", appletAID), "instance", fmt.Sprintf("%x", instanceAID), "params", fmt.Sprintf("%x", params)) 333 | 334 | return s.gpCmdSet.InstallForInstall(pkgAID, appletAID, instanceAID, params) 335 | } 336 | 337 | func (s *Shell) commandGPGetStatus(args ...string) error { 338 | if err := s.requireArgs(args, 0); err != nil { 339 | return err 340 | } 341 | 342 | logger.Info("get status") 343 | cardStatus, err := s.gpCmdSet.GetStatus() 344 | if err != nil { 345 | logger.Error("get status failed", "error", err) 346 | return err 347 | } 348 | 349 | s.write(fmt.Sprintf("CARD STATUS: %s\n\n", cardStatus.LifeCycle())) 350 | 351 | return nil 352 | } 353 | 354 | func (s *Shell) commandKeycardInit(args ...string) error { 355 | if err := s.requireArgs(args, 0); err != nil { 356 | return err 357 | } 358 | 359 | if s.kCmdSet.ApplicationInfo == nil { 360 | return errors.New("keycard applet not selected") 361 | } 362 | 363 | if !s.kCmdSet.ApplicationInfo.Installed { 364 | return errAppletNotInstalled 365 | } 366 | 367 | if s.kCmdSet.ApplicationInfo.Initialized { 368 | return errCardAlreadyInitialized 369 | } 370 | 371 | if s.Secrets == nil { 372 | secrets, err := keycard.GenerateSecrets() 373 | if err != nil { 374 | logger.Error("secrets generation failed", "error", err) 375 | return err 376 | } 377 | 378 | s.Secrets = secrets 379 | } 380 | 381 | logger.Info("initializing") 382 | err := s.kCmdSet.Init(s.Secrets) 383 | if err != nil { 384 | logger.Error("initialization failed", "error", err) 385 | return err 386 | } 387 | 388 | s.write(fmt.Sprintf("PIN: %s\n", s.Secrets.Pin())) 389 | s.write(fmt.Sprintf("PUK: %s\n", s.Secrets.Puk())) 390 | s.write(fmt.Sprintf("PAIRING PASSWORD: %s\n\n", s.Secrets.PairingPass())) 391 | 392 | return nil 393 | } 394 | 395 | func (s *Shell) commandKeycardSetSecrets(args ...string) error { 396 | if err := s.requireArgs(args, 3); err != nil { 397 | return err 398 | } 399 | 400 | s.Secrets = keycard.NewSecrets(args[0], args[1], args[2]) 401 | 402 | return nil 403 | } 404 | 405 | func (s *Shell) commandKeycardSelect(args ...string) error { 406 | if err := s.requireArgs(args, 0); err != nil { 407 | return err 408 | } 409 | 410 | logger.Info("select keycard") 411 | err := s.kCmdSet.Select() 412 | info := s.kCmdSet.ApplicationInfo 413 | 414 | var keyInitialized bool 415 | if len(info.KeyUID) > 0 { 416 | keyInitialized = true 417 | } 418 | 419 | s.write(fmt.Sprintf("Installed: %+v\n", info.Installed)) 420 | s.write(fmt.Sprintf("Initialized: %+v\n", info.Initialized)) 421 | s.write(fmt.Sprintf("Key Initialized: %+v\n", keyInitialized)) 422 | s.write(fmt.Sprintf("InstanceUID: %x\n", info.InstanceUID)) 423 | s.write(fmt.Sprintf("SecureChannelPublicKey: %x\n", info.SecureChannelPublicKey)) 424 | s.write(fmt.Sprintf("Version: %x\n", info.Version)) 425 | s.write(fmt.Sprintf("AvailableSlots: %x\n", info.AvailableSlots)) 426 | s.write(fmt.Sprintf("KeyUID: %x\n", info.KeyUID)) 427 | s.write(fmt.Sprintf("Capabilities:\n")) 428 | s.write(fmt.Sprintf(" Secure channel:%v\n", info.HasSecureChannelCapability())) 429 | s.write(fmt.Sprintf(" Key management:%v\n", info.HasKeyManagementCapability())) 430 | s.write(fmt.Sprintf(" Credentials Management:%v\n", info.HasCredentialsManagementCapability())) 431 | s.write(fmt.Sprintf(" NDEF:%v\n\n", info.HasNDEFCapability())) 432 | 433 | if e, ok := err.(*apdu.ErrBadResponse); ok && e.Sw == globalplatform.SwFileNotFound { 434 | logger.Error("select keycard failed", "error", err) 435 | return ErrNotInstalled 436 | } 437 | 438 | return err 439 | } 440 | 441 | func (s *Shell) commandKeycardPair(args ...string) error { 442 | if err := s.requireArgs(args, 0); err != nil { 443 | return err 444 | } 445 | 446 | if s.Secrets == nil { 447 | return errors.New("cannot pair without setting secrets") 448 | } 449 | 450 | logger.Info("pair") 451 | err := s.kCmdSet.Pair(s.Secrets.PairingPass()) 452 | if err != nil { 453 | logger.Error("pair failed", "error", err) 454 | return err 455 | } 456 | 457 | s.write(fmt.Sprintf("PAIRING KEY: %x\n", s.kCmdSet.PairingInfo.Key)) 458 | s.write(fmt.Sprintf("PAIRING INDEX: %v\n\n", s.kCmdSet.PairingInfo.Index)) 459 | 460 | return nil 461 | } 462 | 463 | func (s *Shell) commandKeycardUnpair(args ...string) error { 464 | if err := s.requireArgs(args, 1); err != nil { 465 | return err 466 | } 467 | 468 | indexInt, err := strconv.ParseInt(args[0], 10, 8) 469 | if err != nil { 470 | return err 471 | } 472 | 473 | index := uint8(indexInt) 474 | 475 | if s.Secrets == nil { 476 | return errors.New("cannot unpair without setting secrets") 477 | } 478 | 479 | logger.Info(fmt.Sprintf("unpair index %d", index)) 480 | err = s.kCmdSet.Unpair(index) 481 | if err != nil { 482 | logger.Error("unpair failed", "error", err) 483 | return err 484 | } 485 | 486 | s.write("UNPAIRED\n\n") 487 | 488 | return nil 489 | } 490 | 491 | func (s *Shell) commandKeycardSetPairing(args ...string) error { 492 | if err := s.requireArgs(args, 2); err != nil { 493 | return err 494 | } 495 | 496 | key, err := s.parseHex(args[0]) 497 | if err != nil { 498 | return err 499 | } 500 | 501 | index, err := strconv.ParseInt(args[1], 10, 8) 502 | if err != nil { 503 | return err 504 | } 505 | 506 | s.kCmdSet.SetPairingInfo(key, int(index)) 507 | 508 | return nil 509 | } 510 | 511 | func (s *Shell) commandKeycardOpenSecureChannel(args ...string) error { 512 | if err := s.requireArgs(args, 0); err != nil { 513 | return err 514 | } 515 | 516 | if s.kCmdSet.PairingInfo == nil { 517 | return errors.New("cannot open secure channel without setting pairing info") 518 | } 519 | 520 | logger.Info("open keycard secure channel") 521 | if err := s.kCmdSet.OpenSecureChannel(); err != nil { 522 | logger.Error("open keycard secure channel failed", "error", err) 523 | return err 524 | } 525 | 526 | return nil 527 | } 528 | 529 | func (s *Shell) commandKeycardGetStatus(args ...string) error { 530 | if err := s.requireArgs(args, 0); err != nil { 531 | return err 532 | } 533 | 534 | logger.Info("get status application") 535 | appStatus, err := s.kCmdSet.GetStatusApplication() 536 | if err != nil { 537 | logger.Error("get status application failed", "error", err) 538 | return err 539 | } 540 | 541 | logger.Info("get status key path") 542 | keyStatus, err := s.kCmdSet.GetStatusKeyPath() 543 | if err != nil { 544 | logger.Error("get status key path failed", "error", err) 545 | return err 546 | } 547 | 548 | s.write(fmt.Sprintf("STATUS - PIN RETRY COUNT: %d\n", appStatus.PinRetryCount)) 549 | s.write(fmt.Sprintf("STATUS - PUK RETRY COUNT: %d\n", appStatus.PUKRetryCount)) 550 | s.write(fmt.Sprintf("STATUS - KEY INITIALIZED: %v\n", appStatus.KeyInitialized)) 551 | s.write(fmt.Sprintf("STATUS - KEY PATH: %v\n\n", keyStatus.Path)) 552 | 553 | return nil 554 | } 555 | 556 | func (s *Shell) commandKeycardVerifyPIN(args ...string) error { 557 | if err := s.requireArgs(args, 1); err != nil { 558 | return err 559 | } 560 | 561 | logger.Info("verify PIN") 562 | if err := s.kCmdSet.VerifyPIN(args[0]); err != nil { 563 | logger.Error("verify PIN failed", "error", err) 564 | return err 565 | } 566 | 567 | return nil 568 | } 569 | 570 | func (s *Shell) commandKeycardChangePIN(args ...string) error { 571 | if err := s.requireArgs(args, 1); err != nil { 572 | return err 573 | } 574 | 575 | logger.Info("change PIN") 576 | if err := s.kCmdSet.ChangePIN(args[0]); err != nil { 577 | logger.Error("change PIN failed", "error", err) 578 | return err 579 | } 580 | 581 | return nil 582 | } 583 | 584 | func (s *Shell) commandKeycardChangePUK(args ...string) error { 585 | if err := s.requireArgs(args, 1); err != nil { 586 | return err 587 | } 588 | 589 | logger.Info("change PUK") 590 | if err := s.kCmdSet.ChangePUK(args[0]); err != nil { 591 | logger.Error("change PUK failed", "error", err) 592 | return err 593 | } 594 | 595 | return nil 596 | } 597 | 598 | func (s *Shell) commandKeycardUnblockPin(args ...string) error { 599 | if err := s.requireArgs(args, 2); err != nil { 600 | return err 601 | } 602 | 603 | logger.Info("unblock PIN") 604 | if err := s.kCmdSet.UnblockPIN(args[0], args[1]); err != nil { 605 | logger.Error("unblock PIN failed", "error", err) 606 | return err 607 | } 608 | 609 | return nil 610 | } 611 | 612 | func (s *Shell) commandKeycardChangePairingSecret(args ...string) error { 613 | if err := s.requireArgs(args, 1); err != nil { 614 | return err 615 | } 616 | 617 | logger.Info("change pairing secret") 618 | if err := s.kCmdSet.ChangePairingSecret(args[0]); err != nil { 619 | logger.Error("change pairing secret failed", "error", err) 620 | return err 621 | } 622 | 623 | return nil 624 | } 625 | 626 | func (s *Shell) commandKeycardGenerateKey(args ...string) error { 627 | if err := s.requireArgs(args, 0); err != nil { 628 | return err 629 | } 630 | 631 | logger.Info("get status before generating key") 632 | appStatus, err := s.kCmdSet.GetStatusApplication() 633 | if err != nil { 634 | logger.Error("get status failed", "error", err) 635 | return err 636 | } 637 | 638 | if appStatus.KeyInitialized { 639 | err = errors.New("key already generated. you must delete it before creating a new one") 640 | logger.Error("generate key failed", "error", err) 641 | return err 642 | } 643 | 644 | logger.Info("generate key") 645 | keyUID, err := s.kCmdSet.GenerateKey() 646 | if err != nil { 647 | return err 648 | } 649 | 650 | s.write(fmt.Sprintf("KEY UID %x\n\n", keyUID)) 651 | 652 | return nil 653 | } 654 | 655 | func (s *Shell) commandKeycardRemoveKey(args ...string) error { 656 | if err := s.requireArgs(args, 0); err != nil { 657 | return err 658 | } 659 | 660 | logger.Info("remove key") 661 | err := s.kCmdSet.RemoveKey() 662 | if err != nil { 663 | return err 664 | } 665 | 666 | s.write(fmt.Sprintf("KEY REMOVED \n\n")) 667 | 668 | return nil 669 | } 670 | 671 | func (s *Shell) commandKeycardDeriveKey(args ...string) error { 672 | if err := s.requireArgs(args, 1); err != nil { 673 | return err 674 | } 675 | 676 | logger.Info(fmt.Sprintf("derive key %s", args[0])) 677 | if err := s.kCmdSet.DeriveKey(args[0]); err != nil { 678 | logger.Error("derive key failed", "error", err) 679 | return err 680 | } 681 | 682 | return nil 683 | } 684 | 685 | func (s *Shell) commandKeycardExportKeyPrivate(args ...string) error { 686 | if err := s.requireArgs(args, 1); err != nil { 687 | return err 688 | } 689 | 690 | logger.Info(fmt.Sprintf("export key %s", args[0])) 691 | privKey, pubKey, err := s.kCmdSet.ExportKey(true, false, false, args[0]) 692 | if err != nil { 693 | logger.Error("export key failed", "error", err) 694 | return err 695 | } 696 | 697 | s.write(fmt.Sprintf("EXPORTED PRIVATE KEY\n%x\n", privKey)) 698 | s.write(fmt.Sprintf("EXPORTED PUBLIC KEY\n%x\n\n", pubKey)) 699 | 700 | return nil 701 | } 702 | 703 | func (s *Shell) commandKeycardExportKeyPublic(args ...string) error { 704 | if err := s.requireArgs(args, 1); err != nil { 705 | return err 706 | } 707 | 708 | logger.Info(fmt.Sprintf("export key %s", args[0])) 709 | privKey, pubKey, err := s.kCmdSet.ExportKey(true, false, true, args[0]) 710 | if err != nil { 711 | logger.Error("export key failed", "error", err) 712 | return err 713 | } 714 | 715 | s.write(fmt.Sprintf("EXPORTED PRIVATE KEY\n%x\n", privKey)) 716 | s.write(fmt.Sprintf("EXPORTED PUBLIC KEY\n%x\n\n", pubKey)) 717 | 718 | return nil 719 | } 720 | 721 | func (s *Shell) commandKeycardSign(args ...string) error { 722 | if err := s.requireArgs(args, 1); err != nil { 723 | return err 724 | } 725 | 726 | data, err := s.parseHex(args[0]) 727 | if err != nil { 728 | logger.Error("failed parsing hex data", "error", err) 729 | return err 730 | } 731 | 732 | logger.Info("sign") 733 | sig, err := s.kCmdSet.Sign(data) 734 | if err != nil { 735 | logger.Error("sign failed", "error", err) 736 | return err 737 | } 738 | 739 | s.writeSignatureInfo(sig) 740 | 741 | return nil 742 | } 743 | 744 | func (s *Shell) commandKeycardSignWithPath(args ...string) error { 745 | if err := s.requireArgs(args, 2); err != nil { 746 | return err 747 | } 748 | 749 | data, err := s.parseHex(args[0]) 750 | if err != nil { 751 | logger.Error("failed parsing hex data", "error", err) 752 | return err 753 | } 754 | 755 | logger.Info("sign with path") 756 | sig, err := s.kCmdSet.SignWithPath(data, args[1]) 757 | if err != nil { 758 | logger.Error("sign with path failed", "error", err) 759 | return err 760 | } 761 | 762 | s.writeSignatureInfo(sig) 763 | 764 | return nil 765 | } 766 | 767 | func (s *Shell) commandKeycardSignMessage(args ...string) error { 768 | if len(args) < 1 { 769 | return errors.New("keycard-sign-message require at least 1 parameter") 770 | } 771 | 772 | originalMessage := strings.Join(args, " ") 773 | hash := hashEthereumMessage(originalMessage) 774 | 775 | logger.Info("sign message") 776 | sig, err := s.kCmdSet.Sign(hash) 777 | if err != nil { 778 | logger.Error("sign message failed", "error", err) 779 | return err 780 | } 781 | 782 | s.writeSignatureInfo(sig) 783 | 784 | return nil 785 | } 786 | 787 | func (s *Shell) commandKeycardSignPinless(args ...string) error { 788 | if err := s.requireArgs(args, 1); err != nil { 789 | return err 790 | } 791 | 792 | data, err := s.parseHex(args[0]) 793 | if err != nil { 794 | logger.Error("failed parsing hex data", "error", err) 795 | return err 796 | } 797 | 798 | logger.Info("sign pinless") 799 | sig, err := s.kCmdSet.SignPinless(data) 800 | if err != nil { 801 | logger.Error("sign pinless failed", "error", err) 802 | return err 803 | } 804 | 805 | s.writeSignatureInfo(sig) 806 | 807 | return nil 808 | } 809 | 810 | func (s *Shell) commandKeycardSignMessagePinless(args ...string) error { 811 | if len(args) < 1 { 812 | return errors.New("keycard-sign-message-pinless require at least 1 parameter") 813 | } 814 | 815 | originalMessage := strings.Join(args, " ") 816 | hash := hashEthereumMessage(originalMessage) 817 | 818 | logger.Info("sign message pinless") 819 | sig, err := s.kCmdSet.SignPinless(hash) 820 | if err != nil { 821 | logger.Error("sign message pinless failed", "error", err) 822 | return err 823 | } 824 | 825 | s.writeSignatureInfo(sig) 826 | 827 | return nil 828 | } 829 | 830 | func (s *Shell) commandKeycardSetPinlessPath(args ...string) error { 831 | if err := s.requireArgs(args, 1); err != nil { 832 | return err 833 | } 834 | 835 | logger.Info(fmt.Sprintf("set pinless path %s", args[0])) 836 | if err := s.kCmdSet.SetPinlessPath(args[0]); err != nil { 837 | logger.Error("set pinless path failed", "error", err) 838 | return err 839 | } 840 | 841 | return nil 842 | } 843 | 844 | func (s *Shell) commandKeycardGenerateMnemonic(args ...string) error { 845 | if err := s.requireArgs(args, 1); err != nil { 846 | return err 847 | } 848 | 849 | checksumSize, err := strconv.ParseInt(args[0], 10, 8) 850 | if err != nil { 851 | logger.Error("failed parsing checksum size", "error", err) 852 | return err 853 | } 854 | 855 | logger.Info("generate mnemonic", "checksumSize", checksumSize) 856 | indexes, err := s.kCmdSet.GenerateMnemonic(int(checksumSize)) 857 | if err != nil { 858 | logger.Error("generate mnemonic failed", "error", err) 859 | return err 860 | } 861 | 862 | s.write(fmt.Sprintf("MNEMONIC INDEXES %v\n\n", indexes)) 863 | 864 | return nil 865 | } 866 | 867 | func (s *Shell) commandKeycardLoadSeed(args ...string) error { 868 | if err := s.requireArgs(args, 1); err != nil { 869 | return err 870 | } 871 | 872 | seed, err := s.parseHex(args[0]) 873 | if err != nil { 874 | logger.Error("failed parsing seed data", "error", err) 875 | return err 876 | } 877 | 878 | logger.Info("loading seed", "seed", fmt.Sprintf("%x", seed)) 879 | keyID, err := s.kCmdSet.LoadSeed(seed) 880 | if err != nil { 881 | logger.Error("load seed failed", "error", err) 882 | return err 883 | } 884 | 885 | logger.Info(fmt.Sprintf("key ID %x", keyID)) 886 | 887 | return nil 888 | } 889 | 890 | func (s *Shell) commandKeycardIdentify(args ...string) error { 891 | pubkey, err := s.kCmdSet.Identify() 892 | 893 | if err != nil { 894 | logger.Error("failed card identification", "error", err) 895 | return err 896 | } 897 | 898 | logger.Info(fmt.Sprintf("identification public key: %x", pubkey)) 899 | 900 | var compareKey []byte 901 | if len(args) == 1 { 902 | compareKey, err = s.parseHex(args[0]) 903 | 904 | if err != nil { 905 | logger.Error("failed parsing public key", "error", err) 906 | return err 907 | } 908 | } else { 909 | compareKey = pubkey 910 | } 911 | 912 | if !bytes.Equal(compareKey, pubkey) { 913 | logger.Error("the recovered key does not match the expected value", "error", err) 914 | return errors.New("genuinity check failed") 915 | } 916 | 917 | return nil 918 | } 919 | 920 | func (s *Shell) commandCashSelect(args ...string) error { 921 | if err := s.requireArgs(args, 0); err != nil { 922 | return err 923 | } 924 | 925 | logger.Info("select cash") 926 | err := s.cashCmdSet.Select() 927 | info := s.cashCmdSet.CashApplicationInfo 928 | 929 | s.write(fmt.Sprintf("Installed: %v\n", info.Installed)) 930 | s.write(fmt.Sprintf("PublicKey: %x\n", info.PublicKey)) 931 | s.write(fmt.Sprintf("PublicData: %x\n", info.PublicData)) 932 | s.write(fmt.Sprintf("Version: %x\n\n", info.Version)) 933 | 934 | if e, ok := err.(*apdu.ErrBadResponse); ok && e.Sw == globalplatform.SwFileNotFound { 935 | logger.Error("select cash failed", "error", err) 936 | return ErrCashNotInstalled 937 | } 938 | 939 | return err 940 | } 941 | 942 | func (s *Shell) commandCashSign(args ...string) error { 943 | if err := s.requireArgs(args, 1); err != nil { 944 | return err 945 | } 946 | 947 | data, err := s.parseHex(args[0]) 948 | if err != nil { 949 | logger.Error("failed parsing hex data", "error", err) 950 | return err 951 | } 952 | 953 | logger.Info("sign") 954 | sig, err := s.cashCmdSet.Sign(data) 955 | if err != nil { 956 | logger.Error("sign failed", "error", err) 957 | return err 958 | } 959 | 960 | s.writeSignatureInfo(sig) 961 | 962 | return nil 963 | } 964 | 965 | func (s *Shell) requireArgs(args []string, possibleArgsN ...int) error { 966 | for _, n := range possibleArgsN { 967 | if len(args) == n { 968 | return nil 969 | } 970 | } 971 | 972 | ns := make([]string, len(possibleArgsN)) 973 | for i, n := range possibleArgsN { 974 | ns[i] = fmt.Sprintf("%d", n) 975 | } 976 | 977 | return fmt.Errorf("wrong number of argument. got: %d, expected: %v", len(args), strings.Join(ns, " | ")) 978 | } 979 | 980 | func (s *Shell) evalLine(rawLine string) error { 981 | line := strings.TrimSpace(rawLine) 982 | 983 | if len(line) == 0 || strings.HasPrefix(line, "#") { 984 | return nil 985 | } 986 | 987 | line, err := s.evalTemplate(line) 988 | if err != nil { 989 | return err 990 | } 991 | 992 | reg := regexp.MustCompile("\\s+") 993 | parts := reg.Split(line, -1) 994 | if cmd, ok := s.commands[parts[0]]; ok { 995 | return cmd(parts[1:]...) 996 | } 997 | 998 | return fmt.Errorf("command not found: %s", parts[0]) 999 | } 1000 | 1001 | func (s *Shell) parseHex(str string) ([]byte, error) { 1002 | if str[:2] == "0x" { 1003 | str = str[2:] 1004 | } 1005 | 1006 | return hex.DecodeString(str) 1007 | } 1008 | 1009 | func (s *Shell) evalTemplate(text string) (string, error) { 1010 | tpl, err := template.New("").Funcs(s.tplFuncMap).Parse(text) 1011 | if err != nil { 1012 | return "", err 1013 | } 1014 | 1015 | buf := bytes.NewBufferString("") 1016 | err = tpl.Execute(buf, nil) 1017 | if err != nil { 1018 | return "", err 1019 | } 1020 | 1021 | return buf.String(), nil 1022 | } 1023 | 1024 | func (s *Shell) writeSignatureInfo(sig *types.Signature) { 1025 | ethSig := append(sig.R(), sig.S()...) 1026 | ethSig = append(ethSig, []byte{sig.V() + 27}...) 1027 | ecdsaPubKey, err := crypto.UnmarshalPubkey(sig.PubKey()) 1028 | if err != nil { 1029 | log.Fatal(err) 1030 | } 1031 | 1032 | address := crypto.PubkeyToAddress(*ecdsaPubKey) 1033 | 1034 | s.write(fmt.Sprintf("SIGNATURE R: %x\n", sig.R())) 1035 | s.write(fmt.Sprintf("SIGNATURE S: %x\n", sig.S())) 1036 | s.write(fmt.Sprintf("SIGNATURE V: %x\n", sig.V())) 1037 | s.write(fmt.Sprintf("ETH SIGNATURE: 0x%x\n", ethSig)) 1038 | s.write(fmt.Sprintf("PUBLIC KEY: 0x%x\n", sig.PubKey())) 1039 | s.write(fmt.Sprintf("ADDRESS: %s\n\n", address.String())) 1040 | } 1041 | 1042 | func hashEthereumMessage(message string) []byte { 1043 | data := []byte(message) 1044 | if strings.HasPrefix(message, "0x") { 1045 | if value, err := hex.DecodeString(message[2:]); err == nil { 1046 | data = value 1047 | } 1048 | } 1049 | 1050 | wrappedMessage := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), data) 1051 | return crypto.Keccak256([]byte(wrappedMessage)) 1052 | } 1053 | --------------------------------------------------------------------------------