account

package
v3.11.5 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 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 NewAccountFromKeys added in v3.7.0

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

NewAccountFromKeys new account with owner and active key

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 keypair of the iost account

func NewKeyPair

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

NewKeyPair create a keypair

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