account

package
v3.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: LGPL-3.0 Imports: 2 Imported by: 39

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePubkey

func DecodePubkey(readablePubKey string) []byte

DecodePubkey ...

func EncodePubkey

func EncodePubkey(pubkey []byte) string

EncodePubkey ...

Types

type Account

type Account struct {
	ID          string                 `json:"id"`
	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(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 {
	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) ReadablePubkey

func (a *KeyPair) ReadablePubkey() string

ReadablePubkey ...

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