Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "init", Short: "Initialize a new account profile", Run: func(cmd *cobra.Command, args []string) { if !cli.ConfigExists() || conf.Reset { var pconf *cli.Config serviceKeySigAlgo := crypto.StringToSignatureAlgorithm(conf.ServiceKeySigAlgo) serviceKeyHashAlgo := crypto.StringToHashAlgorithm(conf.ServiceKeyHashAlgo) if len(conf.ServicePrivateKey) > 0 { serviceKey := cli.MustDecodePrivateKeyHex(serviceKeySigAlgo, conf.ServicePrivateKey) pconf = InitProjectWithServiceKey(serviceKey, serviceKeyHashAlgo) } else { pconf = InitProject(serviceKeySigAlgo, serviceKeyHashAlgo) } serviceAcct := pconf.ServiceAccount() fmt.Printf("⚙️ Flow client initialized with service account:\n\n") fmt.Printf("👤 Address: 0x%x\n", serviceAcct.Address.Bytes()) fmt.Printf("ℹ️ Start the emulator with this service account by running: flow emulator start\n") } else { fmt.Printf("⚠️ Flow configuration file already exists! Begin by running: flow emulator start\n") } }, }
Functions ¶
func InitProject ¶
func InitProject(sigAlgo crypto.SignatureAlgorithm, hashAlgo crypto.HashAlgorithm) *cli.Config
InitProject generates a new service key and saves project config.
func InitProjectWithServiceKey ¶
func InitProjectWithServiceKey(privateKey crypto.PrivateKey, hashAlgo crypto.HashAlgorithm) *cli.Config
InitProjectWithServiceKey creates and saves a new project config using the specified service key.
Types ¶
type Config ¶
type Config struct { ServicePrivateKey string `flag:"service-priv-key" info:"Service account private key"` ServiceKeySigAlgo string `default:"ECDSA_P256" flag:"service-sig-algo" info:"Service account key signature algorithm"` ServiceKeyHashAlgo string `default:"SHA3_256" flag:"service-hash-algo" info:"Service account key hash algorithm"` Reset bool `default:"false" flag:"reset" info:"Reset flow.json config file"` }
Click to show internal directories.
Click to hide internal directories.