keys

package
v0.20.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:              "keys",
	Short:            "Utilities to manage keys",
	TraverseChildren: true,
}
View Source
var DecodeCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "decode <public key>",
		Short:   "Decode a public account key hex string",
		Args:    cobra.ExactArgs(1),
		Example: "flow keys decode 4a22246...31bce1e71a7b6d11",
	},
	Flags: &decodeFlags,
	Run: func(
		cmd *cobra.Command,
		args []string,
		globalFlags command.GlobalFlags,
		services *services.Services,
	) (command.Result, error) {
		accountKey, err := services.Keys.Decode(
			args[0],
		)
		if err != nil {
			return nil, err
		}

		pubKey := accountKey.PublicKey
		return &KeyResult{publicKey: pubKey, accountKey: accountKey}, err
	},
}
View Source
var GenerateCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "generate",
		Short:   "Generate a new key-pair",
		Example: "flow keys generate",
	},
	Flags: &generateFlags,
	Run: func(
		cmd *cobra.Command,
		args []string,
		globalFlags command.GlobalFlags,
		services *services.Services,
	) (command.Result, error) {
		if generateFlags.Algo != "" {
			fmt.Println("⚠️ DEPRECATION WARNING: flag no longer supported, use '--sig-algo' instead.")
			generateFlags.KeySigAlgo = generateFlags.Algo
		}

		privateKey, err := services.Keys.Generate(generateFlags.Seed, generateFlags.KeySigAlgo)
		if err != nil {
			return nil, err
		}

		pubKey := privateKey.PublicKey()
		return &KeyResult{privateKey: privateKey, publicKey: pubKey}, nil
	},
}

Functions

This section is empty.

Types

type KeyResult

type KeyResult struct {
	// contains filtered or unexported fields
}

KeyResult represent result from all account commands

func (*KeyResult) JSON

func (k *KeyResult) JSON() interface{}

JSON convert result to JSON

func (*KeyResult) Oneliner

func (k *KeyResult) Oneliner() string

Oneliner show result as one liner grep friendly

func (*KeyResult) String

func (k *KeyResult) String() string

String convert result to string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL