Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "kms", Short: "Save a KMS key to the config file", Example: "flow keys save kms --name test --address 8c5303eaa26202d6 --sigalgo ECDSA_secp256k1 --hashalgo SHA2_256 --index 0 --context 'KMS_RESOURCE_ID'", Run: func(cmd *cobra.Command, args []string) { projectConf := cli.LoadConfig() _, accountExists := projectConf.Accounts[conf.Name] if accountExists && !conf.Overwrite { cli.Exitf(1, "%s already exists in the config, and overwrite is false", conf.Name) } keyContext, err := cli.KeyContextFromKMSResourceID(conf.KeyContext) if err != nil { cli.Exitf(1, "key context could not be parsed %s", conf.KeyContext) } account := &cli.Account{ KeyType: cli.KeyTypeKMS, Address: flow.HexToAddress(conf.Address), SigAlgo: crypto.StringToSignatureAlgorithm(conf.SigAlgo), HashAlgo: crypto.StringToHashAlgorithm(conf.HashAlgo), KeyIndex: conf.KeyIndex, KeyContext: keyContext, } err = account.LoadSigner() if err != nil { cli.Exitf(1, "provide key context could not be loaded as a valid signer %s", conf.KeyContext) } projectConf.Accounts[conf.Name] = account err = cli.SaveConfig(projectConf) if err != nil { cli.Exitf(1, "could not save config file %s", cli.ConfigPath) } }, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Name string `flag:"name" info:"name of the key"` Address string `flag:"address" info:"flow address of the account"` SigAlgo string `flag:"sigalgo" info:"signature algorithm for the key"` HashAlgo string `flag:"hashalgo" info:"hash algorithm for the key"` KeyIndex int `flag:"index" info:"index of the key on the account"` KeyContext string `` /* 134-byte string literal not displayed */ Overwrite bool `flag:"overwrite" info:"bool indicating if we should overwrite an existing config with the same name in the config file"` }
Click to show internal directories.
Click to hide internal directories.