api.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. // Copyright 2018 The go-ethereum Authors
  2. // This file is part of go-ethereum.
  3. //
  4. // go-ethereum is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // go-ethereum is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
  16. package core
  17. import (
  18. "context"
  19. "encoding/json"
  20. "errors"
  21. "fmt"
  22. "math/big"
  23. "os"
  24. "reflect"
  25. "strings"
  26. "github.com/ethereum/go-ethereum/accounts"
  27. "github.com/ethereum/go-ethereum/accounts/keystore"
  28. "github.com/ethereum/go-ethereum/accounts/scwallet"
  29. "github.com/ethereum/go-ethereum/accounts/usbwallet"
  30. "github.com/ethereum/go-ethereum/common"
  31. "github.com/ethereum/go-ethereum/common/hexutil"
  32. "github.com/ethereum/go-ethereum/internal/ethapi"
  33. "github.com/ethereum/go-ethereum/log"
  34. "github.com/ethereum/go-ethereum/rlp"
  35. "github.com/ethereum/go-ethereum/signer/storage"
  36. )
  37. const (
  38. // numberOfAccountsToDerive For hardware wallets, the number of accounts to derive
  39. numberOfAccountsToDerive = 10
  40. // ExternalAPIVersion -- see extapi_changelog.md
  41. ExternalAPIVersion = "6.0.0"
  42. // InternalAPIVersion -- see intapi_changelog.md
  43. InternalAPIVersion = "6.0.0"
  44. )
  45. // ExternalAPI defines the external API through which signing requests are made.
  46. type ExternalAPI interface {
  47. // List available accounts
  48. List(ctx context.Context) ([]common.Address, error)
  49. // New request to create a new account
  50. New(ctx context.Context) (common.Address, error)
  51. // SignTransaction request to sign the specified transaction
  52. SignTransaction(ctx context.Context, args SendTxArgs, methodSelector *string) (*ethapi.SignTransactionResult, error)
  53. // SignData - request to sign the given data (plus prefix)
  54. SignData(ctx context.Context, contentType string, addr common.MixedcaseAddress, data interface{}) (hexutil.Bytes, error)
  55. // SignTypedData - request to sign the given structured data (plus prefix)
  56. SignTypedData(ctx context.Context, addr common.MixedcaseAddress, data TypedData) (hexutil.Bytes, error)
  57. // EcRecover - recover public key from given message and signature
  58. EcRecover(ctx context.Context, data hexutil.Bytes, sig hexutil.Bytes) (common.Address, error)
  59. // Version info about the APIs
  60. Version(ctx context.Context) (string, error)
  61. }
  62. // UIClientAPI specifies what method a UI needs to implement to be able to be used as a
  63. // UI for the signer
  64. type UIClientAPI interface {
  65. // ApproveTx prompt the user for confirmation to request to sign Transaction
  66. ApproveTx(request *SignTxRequest) (SignTxResponse, error)
  67. // ApproveSignData prompt the user for confirmation to request to sign data
  68. ApproveSignData(request *SignDataRequest) (SignDataResponse, error)
  69. // ApproveListing prompt the user for confirmation to list accounts
  70. // the list of accounts to list can be modified by the UI
  71. ApproveListing(request *ListRequest) (ListResponse, error)
  72. // ApproveNewAccount prompt the user for confirmation to create new Account, and reveal to caller
  73. ApproveNewAccount(request *NewAccountRequest) (NewAccountResponse, error)
  74. // ShowError displays error message to user
  75. ShowError(message string)
  76. // ShowInfo displays info message to user
  77. ShowInfo(message string)
  78. // OnApprovedTx notifies the UI about a transaction having been successfully signed.
  79. // This method can be used by a UI to keep track of e.g. how much has been sent to a particular recipient.
  80. OnApprovedTx(tx ethapi.SignTransactionResult)
  81. // OnSignerStartup is invoked when the signer boots, and tells the UI info about external API location and version
  82. // information
  83. OnSignerStartup(info StartupInfo)
  84. // OnInputRequired is invoked when clef requires user input, for example master password or
  85. // pin-code for unlocking hardware wallets
  86. OnInputRequired(info UserInputRequest) (UserInputResponse, error)
  87. // RegisterUIServer tells the UI to use the given UIServerAPI for ui->clef communication
  88. RegisterUIServer(api *UIServerAPI)
  89. }
  90. // Validator defines the methods required to validate a transaction against some
  91. // sanity defaults as well as any underlying 4byte method database.
  92. //
  93. // Use fourbyte.Database as an implementation. It is separated out of this package
  94. // to allow pieces of the signer package to be used without having to load the
  95. // 7MB embedded 4byte dump.
  96. type Validator interface {
  97. // ValidateTransaction does a number of checks on the supplied transaction, and
  98. // returns either a list of warnings, or an error (indicating that the transaction
  99. // should be immediately rejected).
  100. ValidateTransaction(selector *string, tx *SendTxArgs) (*ValidationMessages, error)
  101. }
  102. // SignerAPI defines the actual implementation of ExternalAPI
  103. type SignerAPI struct {
  104. chainID *big.Int
  105. am *accounts.Manager
  106. UI UIClientAPI
  107. validator Validator
  108. rejectMode bool
  109. credentials storage.Storage
  110. }
  111. // Metadata about a request
  112. type Metadata struct {
  113. Remote string `json:"remote"`
  114. Local string `json:"local"`
  115. Scheme string `json:"scheme"`
  116. UserAgent string `json:"User-Agent"`
  117. Origin string `json:"Origin"`
  118. }
  119. func StartClefAccountManager(ksLocation string, nousb, lightKDF bool, scpath string) *accounts.Manager {
  120. var (
  121. backends []accounts.Backend
  122. n, p = keystore.StandardScryptN, keystore.StandardScryptP
  123. )
  124. if lightKDF {
  125. n, p = keystore.LightScryptN, keystore.LightScryptP
  126. }
  127. // support password based accounts
  128. if len(ksLocation) > 0 {
  129. backends = append(backends, keystore.NewKeyStore(ksLocation, n, p))
  130. }
  131. if !nousb {
  132. // Start a USB hub for Ledger hardware wallets
  133. if ledgerhub, err := usbwallet.NewLedgerHub(); err != nil {
  134. log.Warn(fmt.Sprintf("Failed to start Ledger hub, disabling: %v", err))
  135. } else {
  136. backends = append(backends, ledgerhub)
  137. log.Debug("Ledger support enabled")
  138. }
  139. // Start a USB hub for Trezor hardware wallets (HID version)
  140. if trezorhub, err := usbwallet.NewTrezorHubWithHID(); err != nil {
  141. log.Warn(fmt.Sprintf("Failed to start HID Trezor hub, disabling: %v", err))
  142. } else {
  143. backends = append(backends, trezorhub)
  144. log.Debug("Trezor support enabled via HID")
  145. }
  146. // Start a USB hub for Trezor hardware wallets (WebUSB version)
  147. if trezorhub, err := usbwallet.NewTrezorHubWithWebUSB(); err != nil {
  148. log.Warn(fmt.Sprintf("Failed to start WebUSB Trezor hub, disabling: %v", err))
  149. } else {
  150. backends = append(backends, trezorhub)
  151. log.Debug("Trezor support enabled via WebUSB")
  152. }
  153. }
  154. // Start a smart card hub
  155. if len(scpath) > 0 {
  156. // Sanity check that the smartcard path is valid
  157. fi, err := os.Stat(scpath)
  158. if err != nil {
  159. log.Info("Smartcard socket file missing, disabling", "err", err)
  160. } else {
  161. if fi.Mode()&os.ModeType != os.ModeSocket {
  162. log.Error("Invalid smartcard socket file type", "path", scpath, "type", fi.Mode().String())
  163. } else {
  164. if schub, err := scwallet.NewHub(scpath, scwallet.Scheme, ksLocation); err != nil {
  165. log.Warn(fmt.Sprintf("Failed to start smart card hub, disabling: %v", err))
  166. } else {
  167. backends = append(backends, schub)
  168. }
  169. }
  170. }
  171. }
  172. // Clef doesn't allow insecure http account unlock.
  173. return accounts.NewManager(&accounts.Config{InsecureUnlockAllowed: false}, backends...)
  174. }
  175. // MetadataFromContext extracts Metadata from a given context.Context
  176. func MetadataFromContext(ctx context.Context) Metadata {
  177. m := Metadata{"NA", "NA", "NA", "", ""} // batman
  178. if v := ctx.Value("remote"); v != nil {
  179. m.Remote = v.(string)
  180. }
  181. if v := ctx.Value("scheme"); v != nil {
  182. m.Scheme = v.(string)
  183. }
  184. if v := ctx.Value("local"); v != nil {
  185. m.Local = v.(string)
  186. }
  187. if v := ctx.Value("Origin"); v != nil {
  188. m.Origin = v.(string)
  189. }
  190. if v := ctx.Value("User-Agent"); v != nil {
  191. m.UserAgent = v.(string)
  192. }
  193. return m
  194. }
  195. // String implements Stringer interface
  196. func (m Metadata) String() string {
  197. s, err := json.Marshal(m)
  198. if err == nil {
  199. return string(s)
  200. }
  201. return err.Error()
  202. }
  203. // types for the requests/response types between signer and UI
  204. type (
  205. // SignTxRequest contains info about a Transaction to sign
  206. SignTxRequest struct {
  207. Transaction SendTxArgs `json:"transaction"`
  208. Callinfo []ValidationInfo `json:"call_info"`
  209. Meta Metadata `json:"meta"`
  210. }
  211. // SignTxResponse result from SignTxRequest
  212. SignTxResponse struct {
  213. //The UI may make changes to the TX
  214. Transaction SendTxArgs `json:"transaction"`
  215. Approved bool `json:"approved"`
  216. }
  217. SignDataRequest struct {
  218. ContentType string `json:"content_type"`
  219. Address common.MixedcaseAddress `json:"address"`
  220. Rawdata []byte `json:"raw_data"`
  221. Message []*NameValueType `json:"message"`
  222. Hash hexutil.Bytes `json:"hash"`
  223. Meta Metadata `json:"meta"`
  224. }
  225. SignDataResponse struct {
  226. Approved bool `json:"approved"`
  227. }
  228. NewAccountRequest struct {
  229. Meta Metadata `json:"meta"`
  230. }
  231. NewAccountResponse struct {
  232. Approved bool `json:"approved"`
  233. }
  234. ListRequest struct {
  235. Accounts []accounts.Account `json:"accounts"`
  236. Meta Metadata `json:"meta"`
  237. }
  238. ListResponse struct {
  239. Accounts []accounts.Account `json:"accounts"`
  240. }
  241. Message struct {
  242. Text string `json:"text"`
  243. }
  244. StartupInfo struct {
  245. Info map[string]interface{} `json:"info"`
  246. }
  247. UserInputRequest struct {
  248. Title string `json:"title"`
  249. Prompt string `json:"prompt"`
  250. IsPassword bool `json:"isPassword"`
  251. }
  252. UserInputResponse struct {
  253. Text string `json:"text"`
  254. }
  255. )
  256. var ErrRequestDenied = errors.New("Request denied")
  257. // NewSignerAPI creates a new API that can be used for Account management.
  258. // ksLocation specifies the directory where to store the password protected private
  259. // key that is generated when a new Account is created.
  260. // noUSB disables USB support that is required to support hardware devices such as
  261. // ledger and trezor.
  262. func NewSignerAPI(am *accounts.Manager, chainID int64, noUSB bool, ui UIClientAPI, validator Validator, advancedMode bool, credentials storage.Storage) *SignerAPI {
  263. if advancedMode {
  264. log.Info("Clef is in advanced mode: will warn instead of reject")
  265. }
  266. signer := &SignerAPI{big.NewInt(chainID), am, ui, validator, !advancedMode, credentials}
  267. if !noUSB {
  268. signer.startUSBListener()
  269. }
  270. return signer
  271. }
  272. func (api *SignerAPI) openTrezor(url accounts.URL) {
  273. resp, err := api.UI.OnInputRequired(UserInputRequest{
  274. Prompt: "Pin required to open Trezor wallet\n" +
  275. "Look at the device for number positions\n\n" +
  276. "7 | 8 | 9\n" +
  277. "--+---+--\n" +
  278. "4 | 5 | 6\n" +
  279. "--+---+--\n" +
  280. "1 | 2 | 3\n\n",
  281. IsPassword: true,
  282. Title: "Trezor unlock",
  283. })
  284. if err != nil {
  285. log.Warn("failed getting trezor pin", "err", err)
  286. return
  287. }
  288. // We're using the URL instead of the pointer to the
  289. // Wallet -- perhaps it is not actually present anymore
  290. w, err := api.am.Wallet(url.String())
  291. if err != nil {
  292. log.Warn("wallet unavailable", "url", url)
  293. return
  294. }
  295. err = w.Open(resp.Text)
  296. if err != nil {
  297. log.Warn("failed to open wallet", "wallet", url, "err", err)
  298. return
  299. }
  300. }
  301. // startUSBListener starts a listener for USB events, for hardware wallet interaction
  302. func (api *SignerAPI) startUSBListener() {
  303. events := make(chan accounts.WalletEvent, 16)
  304. am := api.am
  305. am.Subscribe(events)
  306. go func() {
  307. // Open any wallets already attached
  308. for _, wallet := range am.Wallets() {
  309. if err := wallet.Open(""); err != nil {
  310. log.Warn("Failed to open wallet", "url", wallet.URL(), "err", err)
  311. if err == usbwallet.ErrTrezorPINNeeded {
  312. go api.openTrezor(wallet.URL())
  313. }
  314. }
  315. }
  316. // Listen for wallet event till termination
  317. for event := range events {
  318. switch event.Kind {
  319. case accounts.WalletArrived:
  320. if err := event.Wallet.Open(""); err != nil {
  321. log.Warn("New wallet appeared, failed to open", "url", event.Wallet.URL(), "err", err)
  322. if err == usbwallet.ErrTrezorPINNeeded {
  323. go api.openTrezor(event.Wallet.URL())
  324. }
  325. }
  326. case accounts.WalletOpened:
  327. status, _ := event.Wallet.Status()
  328. log.Info("New wallet appeared", "url", event.Wallet.URL(), "status", status)
  329. // Derive first N accounts, hardcoded for now
  330. var nextPath = make(accounts.DerivationPath, len(accounts.DefaultBaseDerivationPath))
  331. copy(nextPath[:], accounts.DefaultBaseDerivationPath[:])
  332. for i := 0; i < numberOfAccountsToDerive; i++ {
  333. acc, err := event.Wallet.Derive(nextPath, true)
  334. if err != nil {
  335. log.Warn("account derivation failed", "error", err)
  336. } else {
  337. log.Info("derived account", "address", acc.Address)
  338. }
  339. nextPath[len(nextPath)-1]++
  340. }
  341. case accounts.WalletDropped:
  342. log.Info("Old wallet dropped", "url", event.Wallet.URL())
  343. event.Wallet.Close()
  344. }
  345. }
  346. }()
  347. }
  348. // List returns the set of wallet this signer manages. Each wallet can contain
  349. // multiple accounts.
  350. func (api *SignerAPI) List(ctx context.Context) ([]common.Address, error) {
  351. var accs []accounts.Account
  352. for _, wallet := range api.am.Wallets() {
  353. accs = append(accs, wallet.Accounts()...)
  354. }
  355. result, err := api.UI.ApproveListing(&ListRequest{Accounts: accs, Meta: MetadataFromContext(ctx)})
  356. if err != nil {
  357. return nil, err
  358. }
  359. if result.Accounts == nil {
  360. return nil, ErrRequestDenied
  361. }
  362. addresses := make([]common.Address, 0)
  363. for _, acc := range result.Accounts {
  364. addresses = append(addresses, acc.Address)
  365. }
  366. return addresses, nil
  367. }
  368. // New creates a new password protected Account. The private key is protected with
  369. // the given password. Users are responsible to backup the private key that is stored
  370. // in the keystore location thas was specified when this API was created.
  371. func (api *SignerAPI) New(ctx context.Context) (common.Address, error) {
  372. be := api.am.Backends(keystore.KeyStoreType)
  373. if len(be) == 0 {
  374. return common.Address{}, errors.New("password based accounts not supported")
  375. }
  376. if resp, err := api.UI.ApproveNewAccount(&NewAccountRequest{MetadataFromContext(ctx)}); err != nil {
  377. return common.Address{}, err
  378. } else if !resp.Approved {
  379. return common.Address{}, ErrRequestDenied
  380. }
  381. // Three retries to get a valid password
  382. for i := 0; i < 3; i++ {
  383. resp, err := api.UI.OnInputRequired(UserInputRequest{
  384. "New account password",
  385. fmt.Sprintf("Please enter a password for the new account to be created (attempt %d of 3)", i),
  386. true})
  387. if err != nil {
  388. log.Warn("error obtaining password", "attempt", i, "error", err)
  389. continue
  390. }
  391. if pwErr := ValidatePasswordFormat(resp.Text); pwErr != nil {
  392. api.UI.ShowError(fmt.Sprintf("Account creation attempt #%d failed due to password requirements: %v", (i + 1), pwErr))
  393. } else {
  394. // No error
  395. acc, err := be[0].(*keystore.KeyStore).NewAccount(resp.Text)
  396. log.Info("Your new key was generated", "address", acc.Address)
  397. log.Warn("Please backup your key file!", "path", acc.URL.Path)
  398. log.Warn("Please remember your password!")
  399. return acc.Address, err
  400. }
  401. }
  402. // Otherwise fail, with generic error message
  403. return common.Address{}, errors.New("account creation failed")
  404. }
  405. // logDiff logs the difference between the incoming (original) transaction and the one returned from the signer.
  406. // it also returns 'true' if the transaction was modified, to make it possible to configure the signer not to allow
  407. // UI-modifications to requests
  408. func logDiff(original *SignTxRequest, new *SignTxResponse) bool {
  409. modified := false
  410. if f0, f1 := original.Transaction.From, new.Transaction.From; !reflect.DeepEqual(f0, f1) {
  411. log.Info("Sender-account changed by UI", "was", f0, "is", f1)
  412. modified = true
  413. }
  414. if t0, t1 := original.Transaction.To, new.Transaction.To; !reflect.DeepEqual(t0, t1) {
  415. log.Info("Recipient-account changed by UI", "was", t0, "is", t1)
  416. modified = true
  417. }
  418. if g0, g1 := original.Transaction.Gas, new.Transaction.Gas; g0 != g1 {
  419. modified = true
  420. log.Info("Gas changed by UI", "was", g0, "is", g1)
  421. }
  422. if g0, g1 := big.Int(original.Transaction.GasPrice), big.Int(new.Transaction.GasPrice); g0.Cmp(&g1) != 0 {
  423. modified = true
  424. log.Info("GasPrice changed by UI", "was", g0, "is", g1)
  425. }
  426. if v0, v1 := big.Int(original.Transaction.Value), big.Int(new.Transaction.Value); v0.Cmp(&v1) != 0 {
  427. modified = true
  428. log.Info("Value changed by UI", "was", v0, "is", v1)
  429. }
  430. if d0, d1 := original.Transaction.Data, new.Transaction.Data; d0 != d1 {
  431. d0s := ""
  432. d1s := ""
  433. if d0 != nil {
  434. d0s = hexutil.Encode(*d0)
  435. }
  436. if d1 != nil {
  437. d1s = hexutil.Encode(*d1)
  438. }
  439. if d1s != d0s {
  440. modified = true
  441. log.Info("Data changed by UI", "was", d0s, "is", d1s)
  442. }
  443. }
  444. if n0, n1 := original.Transaction.Nonce, new.Transaction.Nonce; n0 != n1 {
  445. modified = true
  446. log.Info("Nonce changed by UI", "was", n0, "is", n1)
  447. }
  448. return modified
  449. }
  450. func (api *SignerAPI) lookupPassword(address common.Address) string {
  451. return api.credentials.Get(strings.ToLower(address.String()))
  452. }
  453. func (api *SignerAPI) lookupOrQueryPassword(address common.Address, title, prompt string) (string, error) {
  454. if pw := api.lookupPassword(address); pw != "" {
  455. return pw, nil
  456. } else {
  457. pwResp, err := api.UI.OnInputRequired(UserInputRequest{title, prompt, true})
  458. if err != nil {
  459. log.Warn("error obtaining password", "error", err)
  460. // We'll not forward the error here, in case the error contains info about the response from the UI,
  461. // which could leak the password if it was malformed json or something
  462. return "", errors.New("internal error")
  463. }
  464. return pwResp.Text, nil
  465. }
  466. }
  467. // SignTransaction signs the given Transaction and returns it both as json and rlp-encoded form
  468. func (api *SignerAPI) SignTransaction(ctx context.Context, args SendTxArgs, methodSelector *string) (*ethapi.SignTransactionResult, error) {
  469. var (
  470. err error
  471. result SignTxResponse
  472. )
  473. msgs, err := api.validator.ValidateTransaction(methodSelector, &args)
  474. if err != nil {
  475. return nil, err
  476. }
  477. // If we are in 'rejectMode', then reject rather than show the user warnings
  478. if api.rejectMode {
  479. if err := msgs.getWarnings(); err != nil {
  480. return nil, err
  481. }
  482. }
  483. req := SignTxRequest{
  484. Transaction: args,
  485. Meta: MetadataFromContext(ctx),
  486. Callinfo: msgs.Messages,
  487. }
  488. // Process approval
  489. result, err = api.UI.ApproveTx(&req)
  490. if err != nil {
  491. return nil, err
  492. }
  493. if !result.Approved {
  494. return nil, ErrRequestDenied
  495. }
  496. // Log changes made by the UI to the signing-request
  497. logDiff(&req, &result)
  498. var (
  499. acc accounts.Account
  500. wallet accounts.Wallet
  501. )
  502. acc = accounts.Account{Address: result.Transaction.From.Address()}
  503. wallet, err = api.am.Find(acc)
  504. if err != nil {
  505. return nil, err
  506. }
  507. // Convert fields into a real transaction
  508. var unsignedTx = result.Transaction.toTransaction()
  509. // Get the password for the transaction
  510. pw, err := api.lookupOrQueryPassword(acc.Address, "Account password",
  511. fmt.Sprintf("Please enter the password for account %s", acc.Address.String()))
  512. if err != nil {
  513. return nil, err
  514. }
  515. // The one to sign is the one that was returned from the UI
  516. signedTx, err := wallet.SignTxWithPassphrase(acc, pw, unsignedTx, api.chainID)
  517. if err != nil {
  518. api.UI.ShowError(err.Error())
  519. return nil, err
  520. }
  521. rlpdata, err := rlp.EncodeToBytes(signedTx)
  522. response := ethapi.SignTransactionResult{Raw: rlpdata, Tx: signedTx}
  523. // Finally, send the signed tx to the UI
  524. api.UI.OnApprovedTx(response)
  525. // ...and to the external caller
  526. return &response, nil
  527. }
  528. // Returns the external api version. This method does not require user acceptance. Available methods are
  529. // available via enumeration anyway, and this info does not contain user-specific data
  530. func (api *SignerAPI) Version(ctx context.Context) (string, error) {
  531. return ExternalAPIVersion, nil
  532. }