account

package
v0.0.0-...-9c37315 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const (
	Ed25519AddrLen int    = 32
	PrefixLen      int    = 2
	PrefixStr      string = "tg"
	Version        int    = 1
	Version1Len    int    = 1
	VersionDescLen int    = 2
)

Variables

This section is empty.

Functions

func IsValidID

func IsValidID(id string) bool

Types

type AccountJson

type AccountJson struct {
	Acct *EthAccount          `json:"acct"`
	Cj   *keystore.CryptoJSON `json:"cj"`
}

func EthUnmarshal

func EthUnmarshal(data []byte) (*AccountJson, error)

type Address

type Address [Ed25519AddrLen]byte

func (Address) ID

func (a Address) ID() BeatleAddress

func (Address) PubKey

func (a Address) PubKey() ed25519.PublicKey

func (*Address) SetBytes

func (a *Address) SetBytes(buf []byte) error

func (*Address) SetPubKey

func (a *Address) SetPubKey(pk ed25519.PublicKey)

func (Address) String

func (a Address) String() string

type BTLAccount

type BTLAccount struct {
	PrivKey ed25519.PrivateKey `json:"-"`
	PubKey  ed25519.PublicKey  `json:"-"`
	ID      BeatleAddress      `json:"id"`
}

func NewAccount

func NewAccount() (acct *BTLAccount, err error)

func (*BTLAccount) Marshal

func (ba *BTLAccount) Marshal(auth string) ([]byte, error)

func (*BTLAccount) Unmarshal

func (ba *BTLAccount) Unmarshal(data []byte, auth string) error

type BeatleAddress

type BeatleAddress string

func PubKey2ID

func PubKey2ID(pk ed25519.PublicKey) BeatleAddress

func (BeatleAddress) Address

func (ba BeatleAddress) Address() (addr Address, prefix string, ver int, err error)

func (BeatleAddress) DerivePubKey

func (ba BeatleAddress) DerivePubKey() ed25519.PublicKey

func (BeatleAddress) IsValid

func (ba BeatleAddress) IsValid() bool

func (BeatleAddress) String

func (ba BeatleAddress) String() string

type CryptBTLJson

type CryptBTLJson struct {
	ID        BeatleAddress `json:"id"`
	CipherTxt string        `json:"cipher_txt"`
}

func BeatlesUnmarshal

func BeatlesUnmarshal(data []byte) (*CryptBTLJson, error)

type EthAccount

type EthAccount struct {
	PrivKey *ecdsa.PrivateKey `json:"-"`
	PubKey  *ecdsa.PublicKey  `json:"-"`
	EAddr   common.Address    `json:"-"`
	SAddr   string            `json:"s_addr"`
}

func NewEthAccount

func NewEthAccount() (acct *EthAccount, err error)

func (*EthAccount) ImportFromMetaMask

func (acct *EthAccount) ImportFromMetaMask(hexString string) (err error)

func (*EthAccount) Marshal

func (acct *EthAccount) Marshal(auth string) ([]byte, error)

func (*EthAccount) Unmarshal

func (acct *EthAccount) Unmarshal(data []byte, auth string) error

type TrxAccount

type TrxAccount struct {
}

Jump to

Keyboard shortcuts

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