account

package
v0.0.0-...-376a440 Latest Latest
Warning

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

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

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

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

NewInitAccount new account with owner and active

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