Documentation ¶
Index ¶
- Variables
- func DeriveChildKey(parentKey *bip32.Key, path string) (*bip32.Key, error)
- func Hash160(buf []byte) []byte
- type ExtKeyData
- type Formatter
- type InnerKeyData
- func NewInnerKeyData(bz []byte, base58 string, compressed bool) *InnerKeyData
- func NewInnerKeyDataFromBIP32(key *bip32.Key) (prvKey, pubKey *InnerKeyData)
- func NewInnerKeyDataFromBTCECPrv(key *btcec.PrivateKey) (prvKey, pubKey *InnerKeyData)
- func NewInnerKeyDataFromBTCECPub(key *btcec.PublicKey) (pubKey *InnerKeyData)
- type SomeKey
Constants ¶
This section is empty.
Variables ¶
View Source
var CmdDecode = &cobra.Command{ Use: "decode [xprv..|xpub..]", Short: "Decode an xprv/xpub extended key", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { hrp, err := cmd.PersistentFlags().GetString("hrp") if err != nil { return err } formatter, err := formatize(strings.TrimSpace(cmd.Flag("format").Value.String())) if err != nil { return err } extkey := strings.TrimSpace(args[0]) return decode(hrp, extkey, os.Stdout, formatter) }, }
View Source
var CmdEncode = &cobra.Command{ Use: "encode", Short: "Output an xprv/xpub from a mnemonic, passphrase, hd-path, and hrp", RunE: func(cmd *cobra.Command, args []string) error { format, err := formatize(cmd.Flag("format").Value.String()) if err != nil { return err } pHrp := strings.TrimSpace(cmd.Flag("hrp").Value.String()) if pHrp == "" { return fmt.Errorf("hrp is required") } hdPaths, err := cmd.PersistentFlags().GetStringArray("hd-path") if err != nil { return err } seedB64 := strings.TrimSpace(cmd.Flag("seed").Value.String()) return encode(hdPaths, format, os.Stdout, pHrp, seedB64) }, }
View Source
var CmdGenerate = &cobra.Command{ Use: "gen", RunE: func(cmd *cobra.Command, args []string) error { hrp := strings.TrimSpace(cmd.Flag("hrp").Value.String()) if hrp == "" { return fmt.Errorf("--hrp is required") } hdPaths, err := cmd.PersistentFlags().GetStringArray("hd-path") if err != nil { return err } if len(hdPaths) == 0 { return fmt.Errorf("--hd-path is required") } var seed string if cmd.Flag("seed") != nil { seed = strings.TrimSpace(cmd.Flag("seed").Value.String()) } formatter, err := formatize(strings.TrimSpace(cmd.Flag("format").Value.String())) if err != nil { return err } return generate(hrp, seed, hdPaths, formatter, os.Stdout) }, }
View Source
var CmdRoot = &cobra.Command{
Use: "extkey",
}
Functions ¶
Types ¶
type ExtKeyData ¶
type ExtKeyData struct { Address string `json:"address" yaml:"address"` Path string `json:"path,omitempty" yaml:"path,omitempty"` PrivateKey *InnerKeyData `json:"privateKey" yaml:"privateKey"` PublicKey *InnerKeyData `json:"publicKey" yaml:"publicKey"` Depth byte `json:"depth" yaml:"depth"` DepthLoc string `json:"depthLoc" yaml:"depthLoc"` Chaincode string `json:"chaincode" yaml:"chaincode"` Fingerprint string `json:"fingerprint" yaml:"fingerprint"` }
func NewExtKeyData ¶
func NewExtKeyData(key *bip32.Key, hrp, path string) *ExtKeyData
type InnerKeyData ¶
type InnerKeyData struct { Base58 string `json:"base58" yaml:"base58"` Base64 string `json:"base64" yaml:"base64"` Bytes string `json:"bytes" yaml:"bytes,flow"` BigInt string `json:"bigInt" yaml:"bigInt"` Proto string `json:"proto" yaml:"proto"` ProtoJSON string `json:"protoJson" yaml:"protoJson"` }
func NewInnerKeyData ¶
func NewInnerKeyData(bz []byte, base58 string, compressed bool) *InnerKeyData
func NewInnerKeyDataFromBIP32 ¶
func NewInnerKeyDataFromBIP32(key *bip32.Key) (prvKey, pubKey *InnerKeyData)
func NewInnerKeyDataFromBTCECPrv ¶
func NewInnerKeyDataFromBTCECPrv(key *btcec.PrivateKey) (prvKey, pubKey *InnerKeyData)
func NewInnerKeyDataFromBTCECPub ¶
func NewInnerKeyDataFromBTCECPub(key *btcec.PublicKey) (pubKey *InnerKeyData)
type SomeKey ¶
type SomeKey struct { Seed string `json:"seed,omitempty" yaml:"seed,omitempty"` Mnemonic string `json:"mnemonic,omitempty" yaml:"mnemonic,omitempty"` Hrp string `json:"hrp,omitempty" yaml:"hrp,omitempty"` RootKey *ExtKeyData `json:"rootKey,omitempty" yaml:"rootKey,omitempty"` ChildKeys []*ExtKeyData `json:"childKey,omitempty" yaml:"childKey,omitempty"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.