Documentation
¶
Overview ¶
* MIT License (MIT) * Copyright (c) 2018 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
* MIT License (MIT) * Copyright (c) 2018 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
* MIT License (MIT) * Copyright (c) 2018 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
* MIT License (MIT) * Copyright (c) 2018 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
* MIT License (MIT) * Copyright (c) 2018 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
* MIT License (MIT) * Copyright (c) 2018 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
* MIT License (MIT) * Copyright (c) 2018 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
Index ¶
- Constants
- Variables
- func AllEventSubscribe(host string) (chan sseclient.Event, error)
- func EcdsaFromPem(pemEncoded string) *bitecdsa.PrivateKey
- func EcdsaKeyGen() (priv *bitecdsa.PrivateKey, err error)
- func EcdsaSign(prv *bitecdsa.PrivateKey, data string) string
- func EcdsaToPem(prv *bitecdsa.PrivateKey) (string, string)
- func EventSubscribe(host string, contract string) (chan sseclient.Event, error)
- func EventSubscribeContract(host string, contract string, event string) (chan sseclient.Event, error)
- func FindTransaction(host string, umid string) map[string]interface{}
- func GetActivityStream(host string, id string) map[string]interface{}
- func GetActivityStreamChanges(host string) map[string]interface{}
- func GetActivityStreamVolatile(host string, id string) map[string]interface{}
- func GetActivityStreams(host string, ids []string) map[string]interface{}
- func GetNodeReferences(url string) []string
- func GetUrl() string
- func RsaKeyGen() *rsa.PrivateKey
- func RsaPrivToPem(prvkey rsa.PrivateKey) string
- func RsaSign(r rsa.PrivateKey, data []byte) ([]byte, error)
- func RsaToPem(pubkey rsa.PublicKey) string
- func SearchActivityStreamGet(host string, query string) map[string]interface{}
- func SearchActivityStreamPost(host string, query map[string]interface{}) map[string]interface{}
- func SetActivityStreamVolatile(host string, id string, bdy interface{}) map[string]interface{}
- func SetUrl(connection Connection)
- func Subscribe(host string) (chan sseclient.Event, error)
- func SubscribeStream(host string, stream string) (chan sseclient.Event, error)
- type AlgorithmIdentifier
- type Connection
- type Encryption
- type PrivateKey
- type PublicKey
- type Response
- type StreamData
- type Streams
- type Summary
- type Transaction
- type TransactionReq
- type TxObject
Constants ¶
const ( RSA = iota EC )
Types of Encryption
Variables ¶
var ( RSAKey *rsa.PrivateKey ECKey *bitecdsa.PrivateKey KeyName string Stream string KeyType string )
var Encrptype = [...]string{
"rsa",
"secp256k1",
}
Encrptype stores types of Encryption available
Functions ¶
func EcdsaFromPem ¶
func EcdsaFromPem(pemEncoded string) *bitecdsa.PrivateKey
func EcdsaKeyGen ¶
func EcdsaKeyGen() (priv *bitecdsa.PrivateKey, err error)
Generate a pair of private and puiblic key using ecdsa. output: private key public can be extracted from private key using EcdsaToPem function provided below.
func EcdsaSign ¶
func EcdsaSign(prv *bitecdsa.PrivateKey, data string) string
Sign Wrapper exports signature as comptible activeledger string input: Private key, Transaction output: signature
func EcdsaToPem ¶
func EcdsaToPem(prv *bitecdsa.PrivateKey) (string, string)
Convert Private key object into PCKS1 PEM Private & Public input: Private key output: Pem formatted Public and private key
func EventSubscribe ¶
func EventSubscribeContract ¶
func FindTransaction ¶
FindTransaction finds the transaction using the umid in request
host:http://ip:port
func GetActivityStream ¶
GetActivityStream returns a single Activity stream passed in request. host:http://ip:port
func GetActivityStreamChanges ¶
GetActivityStreamChanges returns All Activity streams changes. host:http://ip:port
func GetActivityStreamVolatile ¶
GetActivityStreamVolatile returns the passed activity stream volatile . host:http://ip:port
func GetActivityStreams ¶
GetActivityStreams returns All Activity streams passed in request. host:http://ip:port
func GetNodeReferences ¶
Returns references of all the nodes. Used for Territoriality.
func RsaKeyGen ¶
func RsaKeyGen() *rsa.PrivateKey
Generate a pair of RSA private and public key. Output: Private key object. Public key can be extracted using publicKey:=key.PublicKey
func RsaPrivToPem ¶
func RsaPrivToPem(prvkey rsa.PrivateKey) string
func RsaSign ¶
func RsaSign(r rsa.PrivateKey, data []byte) ([]byte, error)
Sign a transaction using your private key. Data is hashed using SHA256 before signing. Input: Private Key,Transaction byte array Output: Signature byte Array
func RsaToPem ¶
Converting your public key into pem format. This is necessary when sending public key in a transaction. Input: Public Key Output: Pem formated public key
func SearchActivityStreamGet ¶
SearchActivityStreamGet searches the past query in Activeledger and returns the response host:http://ip:port
func SearchActivityStreamPost ¶
SearchActivityStreamPost runs the passed query on Activeledger and returns the resposne. host:http://ip:port
func SetActivityStreamVolatile ¶
SetActivityStreamVolatile sets the passed activity stream id volatiles. host:http://ip:port
Types ¶
type AlgorithmIdentifier ¶
type AlgorithmIdentifier struct { Algorithm asn1.ObjectIdentifier Parameters asn1.RawValue `asn1:"optional"` }
Algorithm Struct
type Connection ¶
Connection struct for creating connection opbject. Shceme: Protocol used for the network eg http or https Url: IP address of the network Port: port of the network
type Encryption ¶
type Encryption int
Encryption enum
func (Encryption) String ¶
func (encrp Encryption) String() string
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 Object to store activeledger response
func CreateAndSendTransaction ¶
func CreateAndSendTransaction(txReq TransactionReq) (Response, error)
CreateAndSendTransaction function creates and sends the transaction to acitveledger. Send the Response object back to user
func SendTransaction ¶
func SendTransaction(transaction Transaction, url string) (Response, error)
SendTransaction function sends complete transaction the activeledger network. input: transaction,url
type StreamData ¶
type Streams ¶
type Streams struct { New []StreamData `json:"new"` Updated []StreamData `json:"updated"` }
type Transaction ¶
type Transaction struct { Territoriality string `json:"$territoriality,omitempty"` TxObject TxObject `json:"$tx"` SelfSign bool `json:"$selfsign"` Signature map[string]interface{} `json:"$sigs"` }
Transaction elements
func CreateTransaction ¶
func CreateTransaction(txReq TransactionReq) *Transaction
CreateTransaction function create a transaction object and returns it to User. This function is for when user need to add multiple signature to the sigs object.
type TransactionReq ¶
type TransactionReq struct { TxObject TxObject Territoriality string SelfSign bool StreamID string KeyName string RsaKey *rsa.PrivateKey EcKey *bitecdsa.PrivateKey KeyType string }
Response Object to store activeledger response
type TxObject ¶
type TxObject struct { Namespace string `json:"$namespace"` Contract string `json:"$contract"` Entry string `json:"$entry,omitempty"` Input map[string]interface{} `json:"$i"` Output map[string]interface{} `json:"$o,omitempty"` ReadOnly map[string]interface{} `json:"$r,omitempty"` }
TxObject within a transaction