Website: 📝 karai.io Browse: 💻 Karai Pointer Explorer Read: 🔗 Official Karai Blog
Note: Karai aims to always compile and run on Linux targetting the AMD64 CPU architecture. Other operating systems and architectures may compile and run this software but should do so expecting some inconsistencies.
Import
import (
karai "https://github.com/karai/libkarai-go"
)Methods
func karai.JoinChannel(addressport, pubKey, signedKey string)JoinChannel() Takes a ktx address with port, boolean for new or returning, and a set of keys. Outputs a websocket and CA cert. Initiates the connection process to a Karai Transaction Channel
ktxis a string that looks like12.23.34.45:4200orzeus.karai.io:4200isNewis a bool to signify if you are new or returningkeyCollectionis a set of keys
- sends
JOIN <pubKey>toktx - receives coord signature
- sends
PUBKsocket command to get coord public key - receives coord pubkey
- validates coord signature with pubkey
- sends client signed key
- receives client pubkey and cert
type ED25519Keys struct {
publicKey string
privateKey string
signedKey string
selfCert string
}func GenerateKeys() *ED25519KeysGenerateKeys() Fills the ED25519Keys struct with client keys and key signature: publicKey, privateKey, signedKey.
publicKeyis a string ed25519 public key that looks like68b58665c7abf891c2d9b6aaed466d039cedf6c6a701a287165b0d0787235547privateKeyis a string ed25519 private key that looks likec6a7d9078723554701b6edf6165b0da28768b58665caaed466d039c7abf891c2signedKeyis a string ed25519 pubkey signature that looks like490b411f00924fe850d074cc030ccce78a4140bd70d23b2ef3531221e9ac13928f124be7bf493bb5c309239e00b0c90e450ecb495ff6e72e5b16771457911e01
func karai.Sign(myKeys *ED25519Keys, msg string) stringTakes a key set and a message parameter to sign an arbitrary string. Returns a signature of the message signed with the key set.
func karai.SignKey(myKeys *ED25519Keys, publicKey string) stringTakes a key set and an ed25519 public key string parameter to sign a key. Returns a signature of the key signed with the key set.
func karai.VerifySignature(publicKey string, msg string, signature string) boolTakes a public key, a message, and a signature. This will return true if it verifies correctly.
func karai.VerifySignedKey(publicKey string, publicSigningKey string, signature string) boolTakes a public key, a public signing key, and a signature. This will return true if it verifies correctly.
func karai.Send(message string, conn *websocket.Conn) errorTakes a message, and a socket and return an error if it fails.
