Documentation ¶
Index ¶
- Constants
- Variables
- func CreateNewAddress(network byte, key string) (string, error)
- func Decrypt(key, data []byte) ([]byte, error)
- func DeriveKey(password, salt []byte) ([]byte, []byte, error)
- func GenerateEd25519(id string, seed []byte) ed25519.PrivateKey
- func NewDHKeys() (dh.Key, dh.Key)
- func NewKeyPair(id string) (ed25519.PrivateKey, ed25519.PublicKey)
- func WriteKeyForAccountID(accountID string, data []byte, priv []byte)
- type ACL
- type ACLManager
- func (A ACLManager) AddItemsToGroup(gName string, gItems ...*GroupItem) error
- func (A ACLManager) AddPermission(name string, gId string, r ResourceID, pt PermissionType) error
- func (A ACLManager) Create() (*ACLManager, error)
- func (A ACLManager) CreateNewGroup(name string) *Group
- func (A ACLManager) Guard() error
- func (A ACLManager) NewACLManager() *ACLManager
- type Account
- func (a *Account) Bytes() []byte
- func (a *Account) Dump()
- func (a *Account) GetAddress() string
- func (a Account) New(args map[string]any) *Account
- func (a Account) NewFromKeys(id, ownerKey, activeKey string) *Account
- func (a *Account) String() string
- func (a *Account) VerifyAddress(addr string) error
- type Address
- type AddressFileFormat
- type AddressRepository
- type DecryptedAddressFormat
- type Group
- type GroupItem
- type IAccount
- type IAddress
- type Keys
- type LoadedKeys
- type Permission
- type PermissionType
- type ResourceID
Constants ¶
View Source
const AddressPrefix = "QBX"
Variables ¶
View Source
var Groups map[string]*Group
Functions ¶
func GenerateEd25519 ¶
func GenerateEd25519(id string, seed []byte) ed25519.PrivateKey
func NewKeyPair ¶
func NewKeyPair(id string) (ed25519.PrivateKey, ed25519.PublicKey)
func WriteKeyForAccountID ¶
Types ¶
type ACL ¶
type ACL interface { Guard() error Create() (*ACLManager, error) CreateNewGroup(name string) *Group AddItemsToGroup(gId string, gItem ...*GroupItem) error AddPermission(name string, gId string, r ResourceID, pt PermissionType) error }
type ACLManager ¶
type ACLManager struct { IsInitialized bool AclContext context.Context // contains filtered or unexported fields }
ACLManager implements ACL interface
func (ACLManager) AddItemsToGroup ¶
func (A ACLManager) AddItemsToGroup(gName string, gItems ...*GroupItem) error
func (ACLManager) AddPermission ¶
func (A ACLManager) AddPermission(name string, gId string, r ResourceID, pt PermissionType) error
func (ACLManager) Create ¶
func (A ACLManager) Create() (*ACLManager, error)
func (ACLManager) CreateNewGroup ¶
func (A ACLManager) CreateNewGroup(name string) *Group
func (ACLManager) Guard ¶
func (A ACLManager) Guard() error
func (ACLManager) NewACLManager ¶
func (A ACLManager) NewACLManager() *ACLManager
type Account ¶
type Account struct { ID string Nickname string Groups map[string]*Group ACL map[string]*Permission }
func NewAccountFromKeys ¶
func (*Account) GetAddress ¶
func (Account) NewFromKeys ¶
func (*Account) VerifyAddress ¶
type AddressFileFormat ¶
type AddressRepository ¶
func (*AddressRepository) Add ¶
func (ar *AddressRepository) Add(addr Address)
func (*AddressRepository) Disable ¶
func (ar *AddressRepository) Disable(addr Address)
func (*AddressRepository) Has ¶
func (ar *AddressRepository) Has(addr Address) bool
func (AddressRepository) New ¶
func (ar AddressRepository) New() *AddressRepository
type DecryptedAddressFormat ¶
type DecryptedAddressFormat struct { Network byte PrivKey []byte PubKey []byte Signature []byte Suite string }
func GetAddressFromStorage ¶
func GetAddressFromStorage(pub string, key string) (*DecryptedAddressFormat, error)
type GroupItem ¶
type GroupItem struct { ID string //keypair id Permission string PermissionID PermissionType Resource ResourceID IsKeyPair bool Weight int }
type IAccount ¶
type IAccount interface { New(args map[string]any) *Account NewFromKeys(id, ownerKey, activeKey string) *Account }
func NewAccountManager ¶
func NewAccountManager() IAccount
type Keys ¶
func (Keys) GetLoadedKeys ¶
func (k Keys) GetLoadedKeys(accID string) *LoadedKeys
type LoadedKeys ¶
type LoadedKeys struct { Priv ed25519.PrivateKey Pub ed25519.PublicKey PubKeySign []byte }
type Permission ¶
type PermissionType ¶
type PermissionType uint32
const ( PT_NONE PermissionType = iota PT_READ PT_DELETE PT_UPDATE PT_WRITE PT_SYSTEM_UPGRADE PT_VALIDATE PT_VERIFY PT_LEAD PT_MINTER PT_BURNER PT_ADMIN PT_SUPERADMIN PT_BAN )
type ResourceID ¶
type ResourceID uint32
const ( // R_NONE ... R_NONE ResourceID = iota R_PROXY R_FILE R_URL R_CONTRACT R_SYSTEM R_FULLCHAIN R_BLOCK )
Click to show internal directories.
Click to hide internal directories.