Documentation
¶
Overview ¶
Copyright 2017-2018 OneLedger
Identities management for any of the associated chains ¶
Copyright 2017 - 2018 OneLedger ¶
Group Mechanics ¶
Copyright 2017-2018 OneLedger ¶
Current state of a given user, assembled from persistence ¶
Copyright 2017 - 2018 OneLedger ¶
Key Management ¶
Copyright 2017 - 2018 OneLedger ¶
Group Mechanics
Index ¶
- func Armour(privateKey PrivateKey, passphrase string, salt []byte) ([]byte, error)
- func GenerateKeys(secret []byte) (PublicKey, PrivateKey)
- func Matches(account Account, name string, chain data.ChainType) bool
- func ParseAccountType(typeName string) data.ChainType
- type Account
- type AccountBase
- type AccountBitcoin
- func (account *AccountBitcoin) AccountKey() AccountKey
- func (account *AccountBitcoin) AsString() string
- func (account *AccountBitcoin) Chain() data.ChainType
- func (account *AccountBitcoin) Export() AccountExport
- func (account *AccountBitcoin) Name() string
- func (account *AccountBitcoin) PrivateKey() PrivateKey
- func (account *AccountBitcoin) PublicKey() PublicKey
- type AccountEthereum
- func (account *AccountEthereum) AccountKey() AccountKey
- func (account *AccountEthereum) AsString() string
- func (account *AccountEthereum) Chain() data.ChainType
- func (account *AccountEthereum) Export() AccountExport
- func (account *AccountEthereum) Name() string
- func (account *AccountEthereum) PrivateKey() PrivateKey
- func (account *AccountEthereum) PublicKey() PublicKey
- type AccountExport
- type AccountKey
- type AccountOneLedger
- func (account *AccountOneLedger) AccountKey() AccountKey
- func (account *AccountOneLedger) AsString() string
- func (account *AccountOneLedger) Chain() data.ChainType
- func (account *AccountOneLedger) Export() AccountExport
- func (account *AccountOneLedger) Name() string
- func (account *AccountOneLedger) PrivateKey() PrivateKey
- func (account *AccountOneLedger) PublicKey() PublicKey
- type Accounts
- func (acc *Accounts) Add(account Account)
- func (acc *Accounts) Delete(account Account)
- func (acc *Accounts) Dump()
- func (acc *Accounts) Exists(newType data.ChainType, name string) bool
- func (acc *Accounts) Find(account Account) (Account, err.Code)
- func (acc *Accounts) FindAll() []Account
- func (acc *Accounts) FindIdentity(identity Identity) (Account, err.Code)
- func (acc *Accounts) FindKey(key AccountKey) (Account, err.Code)
- func (acc *Accounts) FindName(name string) (Account, err.Code)
- func (acc *Accounts) FindNameOnChain(name string, chain data.ChainType) (Account, err.Code)
- type DataPrivledge
- type Group
- type Identities
- type Identity
- type IdentityExport
- type KeyAlgorithm
- type PrivateKey
- type PublicKey
- type RolePrivledge
- type Signature
- type Wallet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Armour ¶
func Armour(privateKey PrivateKey, passphrase string, salt []byte) ([]byte, error)
salt := cytpo.CRandBytes(16)
func GenerateKeys ¶
func GenerateKeys(secret []byte) (PublicKey, PrivateKey)
Types ¶
type Account ¶
type Account interface {
Name() string
Chain() data.ChainType
AccountKey() AccountKey
PublicKey() PublicKey
PrivateKey() PrivateKey
Export() AccountExport
AsString() string
}
Polymorphism
func NewAccount ¶
Create a new account for a given chain
type AccountBase ¶
type AccountBase struct {
Type data.ChainType
Key AccountKey
Name string
PublicKey PublicKey
PrivateKey PrivateKey
}
type AccountBitcoin ¶
type AccountBitcoin struct {
AccountBase
}
Information we need for a Bitcoin account
func (*AccountBitcoin) AccountKey ¶
func (account *AccountBitcoin) AccountKey() AccountKey
func (*AccountBitcoin) AsString ¶
func (account *AccountBitcoin) AsString() string
func (*AccountBitcoin) Chain ¶
func (account *AccountBitcoin) Chain() data.ChainType
func (*AccountBitcoin) Export ¶
func (account *AccountBitcoin) Export() AccountExport
func (*AccountBitcoin) Name ¶
func (account *AccountBitcoin) Name() string
func (*AccountBitcoin) PrivateKey ¶
func (account *AccountBitcoin) PrivateKey() PrivateKey
func (*AccountBitcoin) PublicKey ¶
func (account *AccountBitcoin) PublicKey() PublicKey
type AccountEthereum ¶
type AccountEthereum struct {
AccountBase
}
Information we need for an Ethereum account
func (*AccountEthereum) AccountKey ¶
func (account *AccountEthereum) AccountKey() AccountKey
func (*AccountEthereum) AsString ¶
func (account *AccountEthereum) AsString() string
func (*AccountEthereum) Chain ¶
func (account *AccountEthereum) Chain() data.ChainType
func (*AccountEthereum) Export ¶
func (account *AccountEthereum) Export() AccountExport
func (*AccountEthereum) Name ¶
func (account *AccountEthereum) Name() string
func (*AccountEthereum) PrivateKey ¶
func (account *AccountEthereum) PrivateKey() PrivateKey
func (*AccountEthereum) PublicKey ¶
func (account *AccountEthereum) PublicKey() PublicKey
type AccountExport ¶
type AccountExport struct {
Type string
AccountKey string
Name string
// Balance must come from utxo database, fill when needed
Balance string
NodeName string
}
AccountExport struct holds important account info in a
type AccountKey ¶
type AccountKey = wdata.Bytes // OneLedger address, like Tendermint the hash of the associated PubKey
Aliases to hide some of the basic underlying types.
func NewAccountKey ¶
func NewAccountKey(key PublicKey) AccountKey
Hash the public key to get a unqiue hash that can act as a key
type AccountOneLedger ¶
type AccountOneLedger struct {
AccountBase
}
Information we need about our own fullnode identities
func (*AccountOneLedger) AccountKey ¶
func (account *AccountOneLedger) AccountKey() AccountKey
func (*AccountOneLedger) AsString ¶
func (account *AccountOneLedger) AsString() string
func (*AccountOneLedger) Chain ¶
func (account *AccountOneLedger) Chain() data.ChainType
func (*AccountOneLedger) Export ¶
func (account *AccountOneLedger) Export() AccountExport
func (*AccountOneLedger) Name ¶
func (account *AccountOneLedger) Name() string
func (*AccountOneLedger) PrivateKey ¶
func (account *AccountOneLedger) PrivateKey() PrivateKey
func (*AccountOneLedger) PublicKey ¶
func (account *AccountOneLedger) PublicKey() PublicKey
type Accounts ¶
type Accounts struct {
// contains filtered or unexported fields
}
The persistent collection of all accounts known by this node
func NewAccounts ¶
func (*Accounts) FindIdentity ¶
type DataPrivledge ¶
type DataPrivledge struct {
Name string
}
The ability to use a specific peice of data
type Group ¶
type Group struct {
Name string
Roles []RolePrivledge
Data []DataPrivledge
Identities []*Identity
Groups []*Group
}
A Group of users or groups.
type Identities ¶
type Identities struct {
// contains filtered or unexported fields
}
The persistent collection of all accounts known by this node
func NewIdentities ¶
func NewIdentities(name string) *Identities
Initialize or reconnect to the database
func (*Identities) Add ¶
func (ids *Identities) Add(identity *Identity)
func (*Identities) Close ¶
func (ids *Identities) Close()
func (*Identities) Delete ¶
func (ids *Identities) Delete()
func (*Identities) Dump ¶
func (ids *Identities) Dump()
func (*Identities) Exists ¶
func (ids *Identities) Exists(name string) bool
func (*Identities) FindAll ¶
func (ids *Identities) FindAll() []*Identity
type Identity ¶
type Identity struct {
Name string // A unique name for the identity
NodeName string // The origin of this account
ContactInfo string
AccountKey AccountKey // A key
External bool
Chain map[data.ChainType]AccountKey // TODO: Should be more than one account per chain
Nodes map[string]data.ChainNode
}
A user of a OneLedger node, but not necessarily the chain itself.
func NewIdentity ¶
func (*Identity) Export ¶
func (id *Identity) Export() IdentityExport
Export returns an easily printable struct
func (*Identity) IsExternal ¶
func (*Identity) Key ¶
func (id *Identity) Key() data.DatabaseKey
type IdentityExport ¶
type PrivateKey ¶
func Generate ¶
func Generate(secret []byte, algorithm KeyAlgorithm) (PrivateKey, error)
type RolePrivledge ¶
type RolePrivledge struct {
Name string
}
The ability to execute a specific peice of code