account

package
v0.0.0-...-5fdeb2f Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressToPubkey

func AddressToPubkey(address string) ([]byte, error)

AddressToPubkey convert address to public key

func DecodePubkey

func DecodePubkey(readablePubKey string) []byte

DecodePubkey ...

func EncodePubkey

func EncodePubkey(pubkey []byte) string

EncodePubkey ...

func PubkeyToAddress

func PubkeyToAddress(pubkey []byte) string

PubkeyToAddress Convert PublicKey to Address

Types

type Account

type Account struct {
	Address     string                 `json:"address"`
	Referrer    string                 `json:"referrer"`
	Groups      map[string]*Group      `json:"groups"`
	Permissions map[string]*Permission `json:"permissions"`
}

Account type of a permission tree

func NewAccount

func NewAccount(address string) *Account

NewAccount a new empty account

func NewInitAccount

func NewInitAccount(address, ownerKey, activeKey string) *Account

NewInitAccount new account with owner and active

type AddressKeyPair

type AddressKeyPair struct {
	Algorithm crypto.Algorithm
	Address   string
	Pubkey    []byte
	Seckey    []byte
}

AddressKeyPair address with keypair

func NewAddress

func NewAddress(seckey []byte, algo crypto.Algorithm) (*AddressKeyPair, error)

NewAddress to create an address

type Group

type Group struct {
	Name  string  `json:"name"`
	Items []*Item `json:"items"`
}

Group group of permissions

type Item

type Item struct {
	ID         string `json:"id"` // key pair id
	Permission string `json:"permission"`
	IsKeyPair  bool   `json:"is_key_pair"`
	Weight     int    `json:"weight"`
}

Item identity of a permission owner

type KeyPair

type KeyPair struct {
	Algorithm crypto.Algorithm
	Pubkey    []byte
	Seckey    []byte
}

KeyPair account of the ios

func NewKeyPair

func NewKeyPair(seckey []byte, algo crypto.Algorithm) (*KeyPair, error)

NewKeyPair create an account

func (*KeyPair) ReadablePubkey

func (a *KeyPair) ReadablePubkey() string

ReadablePubkey ...

func (*KeyPair) Sign

func (a *KeyPair) Sign(info []byte) *crypto.Signature

Sign sign a tx

type Permission

type Permission struct {
	Name      string   `json:"name"`
	Groups    []string `json:"groups"`
	Items     []*Item  `json:"items"`
	Threshold int      `json:"threshold"`
}

Permission permission struct

Jump to

Keyboard shortcuts

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