Documentation
¶
Index ¶
- Variables
- func VerifyUsingPem(sig []byte, checksum []byte, pubPem string, keyType KeyType) (bool, error)
- type Connection
- type DataWrapper
- type Key
- func (k Key) GetEllipticKey() *ecdsa.PrivateKey
- func (k Key) GetPrivatePEM() string
- func (k Key) GetPublicPEM() string
- func (k Key) GetRSAKey() *rsa.PrivateKey
- func (k Key) GetType() KeyType
- func (k Key) Sign(data []byte) (Signature []byte, Hash []byte, SignError error)
- func (k Key) Verify(signature []byte, checksum []byte) (bool, error)
- type KeyHandler
- type KeyType
- type Neighbour
- type Neighbourhood
- type Node
- func (n *Node) FindTransaction(umid string) (StreamResponse, error)
- func (n *Node) GetChanges() (StreamResponse, error)
- func (n *Node) GetData(streamId string) (StreamResponse, error)
- func (n *Node) GetList(streamIds []string) (StreamResponse, error)
- func (n *Node) GetVolatile(streamId string) (StreamResponse, error)
- func (n *Node) SetVolatile(streamId string, volatileData interface{}) (StreamResponse, error)
- type NodeHandler
- type Nodes
- type Protocol
- type Response
- type StreamData
- type StreamID
- type StreamIDWrapper
- type StreamResponse
- type Streams
- type Summary
- type Transaction
- func (t Transaction) GetTransaction() Transaction
- func (t *Transaction) SetInput(id StreamID, d map[string]interface{})
- func (t *Transaction) SetOutput(id StreamID, d map[string]interface{})
- func (t *Transaction) SetReadonly(id StreamID, d map[string]interface{})
- func (t *Transaction) Sign(key KeyHandler, id StreamID) error
- type TransactionHandler
- type TransactionOpts
- type TxBody
Constants ¶
This section is empty.
Variables ¶
var ( ErrActiveledgerResp error = errors.New("activeledger returned errors, see response.summary.errors") ErrJSON alerror.ALSDKError = *alerror.NewAlError("there was an error converting the transaction into a json string") ErrSend alerror.ALSDKError = *alerror.NewAlError("sending the request to the activeledger node failed") )
var ( ErrNotImplemented = errors.New("not implemented") ErrUnknownKey = errors.New("unknown key type") )
var (
ErrMarshalFail alerror.ALSDKError = *alerror.NewAlError("error marshaling stream")
)
var (
ErrNoStreamID error = errors.New("stream id not given")
)
Functions ¶
Types ¶
type Connection ¶
func NewConnection ¶
func NewConnection(protocol Protocol, url string, port string) Connection
NewConnection - Create a new connection
type DataWrapper ¶
type DataWrapper map[string]interface{}
type Key ¶
type Key struct {
RSA key.RSAHandler
Elliptic key.EllipticHandler
// contains filtered or unexported fields
}
func (Key) GetEllipticKey ¶
func (k Key) GetEllipticKey() *ecdsa.PrivateKey
func (Key) GetPrivatePEM ¶
func (Key) GetPublicPEM ¶
func (Key) GetRSAKey ¶
func (k Key) GetRSAKey() *rsa.PrivateKey
type KeyHandler ¶
type KeyHandler interface {
Sign(Data []byte) (Signature []byte, Hash []byte, SignError error)
Verify(Signature []byte, Checksum []byte) (Ok bool, VerifError error)
GetType() KeyType
GetRSAKey() (Key *rsa.PrivateKey)
GetEllipticKey() (Key *ecdsa.PrivateKey)
GetPrivatePEM() (KeyPublicPem string)
GetPublicPEM() (KeyPrivatePem string)
}
type Neighbourhood ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) FindTransaction ¶
func (n *Node) FindTransaction(umid string) (StreamResponse, error)
FindTransaction - Find a transaction using its UMID
func (*Node) GetChanges ¶
func (n *Node) GetChanges() (StreamResponse, error)
GetChanges - Returns the latest activity stream changes
func (*Node) GetData ¶
func (n *Node) GetData(streamId string) (StreamResponse, error)
GetData - Returns the stream data of the speicifed stream
func (*Node) GetList ¶
func (n *Node) GetList(streamIds []string) (StreamResponse, error)
GetList - Returns an array of stream data from the specified streams
func (*Node) GetVolatile ¶
func (n *Node) GetVolatile(streamId string) (StreamResponse, error)
GetVolatile - Returns the volatile data of the specified stream
func (*Node) SetVolatile ¶
func (n *Node) SetVolatile(streamId string, volatileData interface{}) (StreamResponse, error)
SetVolatile - Sets the volatile data of a specified stream
type NodeHandler ¶
type NodeHandler interface {
GetList(StreamIDs []string) (StreamResponse, error)
GetData(StreamID string) (StreamResponse, error)
GetVolatile(StreamID string) (StreamResponse, error)
SetVolatile(StreamID string, VolatileData interface{}) (StreamResponse, error)
GetChanges() (StreamResponse, error)
FindTransaction(UMID string) (StreamResponse, error)
}
func ConnectNode ¶
func ConnectNode(c Connection) NodeHandler
type Nodes ¶
type Nodes []string
func GetNodeReferences ¶
func GetNodeReferences(connection Connection) (Nodes, error)
type Response ¶
type Response struct {
UMID string `json:"$umid"`
Summary Summary `json:"$summary"`
Response []interface{} `json:"$responses"`
Territoriality string `json:"$territoriality"`
Streams Streams `json:"$streams"`
}
Response - Holds the response data from Activeledger
func Send ¶
func Send(tx Transaction, c Connection) (Response, error)
type StreamData ¶
StreamData - Stream data structure in Streams
type StreamIDWrapper ¶
type StreamIDWrapper map[StreamID]interface{}
type StreamResponse ¶
type StreamResponse map[string]interface{}
type Streams ¶
type Streams struct {
New []StreamData `json:"new"`
Updated []StreamData `json:"updated"`
}
Streams - Streams structure in Response
type Summary ¶
type Summary struct {
Total int `json:"total"`
Vote int `json:"vote"`
Commit int `json:"commit"`
Errors []string `json:"errors"`
}
Summary - Summary structure in Response
type Transaction ¶
type Transaction struct {
Territoriality string `json:"$territoriality,omitempty"`
Transaction TxBody `json:"$tx"`
SelfSign bool `json:"$selfsign"`
Signature StreamIDWrapper `json:"$sigs"`
}
func (Transaction) GetTransaction ¶
func (t Transaction) GetTransaction() Transaction
func (*Transaction) SetInput ¶
func (t *Transaction) SetInput(id StreamID, d map[string]interface{})
SetInput - Set the input data of the transaction
func (*Transaction) SetOutput ¶
func (t *Transaction) SetOutput(id StreamID, d map[string]interface{})
SetOutput - Set the output data of the transaction
func (*Transaction) SetReadonly ¶
func (t *Transaction) SetReadonly(id StreamID, d map[string]interface{})
SetReadonly - Set the readonly data of a transaction
func (*Transaction) Sign ¶
func (t *Transaction) Sign(key KeyHandler, id StreamID) error
Sign - Sign a transaction
type TransactionHandler ¶
type TransactionHandler interface {
Sign(Key KeyHandler, ID StreamID) error
SetInput(ID StreamID, Input map[string]interface{})
SetOutput(ID StreamID, Output map[string]interface{})
SetReadonly(ID StreamID, ReadOnly map[string]interface{})
GetTransaction() Transaction
}
func BuildTransaction ¶
func BuildTransaction(o TransactionOpts) (Tx TransactionHandler, Hash []byte, TXError error)
BuildTransaction - Pass all required data and create a transaction from it
type TransactionOpts ¶
type TransactionOpts struct {
StreamID StreamID
OutputStreamID StreamID
ReadOnlyStreamID StreamID
Key KeyHandler
Namespace string
Contract string
Entry string
SelfSign bool
Territoriality string
Input DataWrapper
Output DataWrapper
ReadOnly DataWrapper
}
type TxBody ¶
type TxBody struct {
Namespace string `json:"$namespace"`
Contract string `json:"$contract"`
Entry string `json:"$entry,omitempty"`
Input StreamIDWrapper `json:"$i"`
Output StreamIDWrapper `json:"$o,omitempty"`
ReadOnly StreamIDWrapper `json:"$t,omitempty"`
}