decode

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "decode <public key>",
	Short: "Decode a public account key hex string",
	Args:  cobra.ExactArgs(1),
	Run: func(cmd *cobra.Command, args []string) {

		publicKey := args[0]

		publicKeyBytes, err := hex.DecodeString(publicKey)
		if err != nil {
			cli.Exitf(1, "Failed to decode public key: %v", err)
		}

		accountKey, err := flowsdk.DecodeAccountKey(publicKeyBytes)
		if err != nil {
			cli.Exitf(1, "Failed to decode private key bytes: %v", err)
		}

		fmt.Printf("  Public key: %x\n", accountKey.PublicKey.Encode())
		fmt.Printf("  Signature algorithm: %s\n", accountKey.SigAlgo)
		fmt.Printf("  Hash algorithm: %s\n", accountKey.HashAlgo)
		fmt.Printf("  Weight: %d\n", accountKey.Weight)
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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