account

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: LGPL-3.0 Imports: 3 Imported by: 39

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIDByPubkey

func GetIDByPubkey(pubkey []byte) string

GetIDByPubkey ...

func GetPubkeyByID

func GetPubkeyByID(ID string) []byte

GetPubkeyByID ...

Types

type Account

type Account struct {
	ID                 string                 `json:"id"`
	Referrer           string                 `json:"referrer"`
	ReferrerUpdateTime int64                  `json:"referrer_update_time"`
	Groups             map[string]*Group      `json:"groups"`
	Permissions        map[string]*Permission `json:"permissions"`
}

Account type of a permission tree

func NewAccount

func NewAccount(id string) *Account

NewAccount a new empty account

func NewInitAccount added in v1.1.0

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

NewInitAccount new account with owner and active

type Group added in v1.1.0

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

Group group of permissions

type Item added in v1.1.0

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 added in v1.1.0

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

KeyPair account of the ios

func NewKeyPair added in v1.1.0

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

NewKeyPair create an account

func (*KeyPair) Sign added in v1.1.0

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

Sign sign a tx

type Permission added in v1.1.0

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