libkarai

package module
v0.0.0-...-d105733 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2020 License: MIT Imports: 9 Imported by: 0

README

libkarai

Discord GitHub issues GitHub stars Build GitHub GitHub issues by-label Go Report Card

Website: 📝 karai.io Browse: 💻 Karai Pointer Explorer Read: 🔗 Official Karai Blog

Usage

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

  • ktx is a string that looks like 12.23.34.45:4200 or zeus.karai.io:4200
  • isNew is a bool to signify if you are new or returning
  • keyCollection is a set of keys
  1. sends JOIN <pubKey> to ktx
  2. receives coord signature
  3. sends PUBK socket command to get coord public key
  4. receives coord pubkey
  5. validates coord signature with pubkey
  6. sends client signed key
  7. receives client pubkey and cert
type ED25519Keys struct {
	publicKey  string
	privateKey string
	signedKey  string
	selfCert   string
}
func GenerateKeys() *ED25519Keys

GenerateKeys() Fills the ED25519Keys struct with client keys and key signature: publicKey, privateKey, signedKey.

  • publicKey is a string ed25519 public key that looks like 68b58665c7abf891c2d9b6aaed466d039cedf6c6a701a287165b0d0787235547
  • privateKey is a string ed25519 private key that looks like c6a7d9078723554701b6edf6165b0da28768b58665caaed466d039c7abf891c2
  • signedKey is a string ed25519 pubkey signature that looks like 490b411f00924fe850d074cc030ccce78a4140bd70d23b2ef3531221e9ac13928f124be7bf493bb5c309239e00b0c90e450ecb495ff6e72e5b16771457911e01
func karai.Sign(myKeys *ED25519Keys, msg string) string

Takes 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) string

Takes 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) bool

Takes 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) bool

Takes 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) error

Takes a message, and a socket and return an error if it fails.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinChannel

func JoinChannel(ktx, pubKey, signedKey, ktxCertFileName string, keyCollection *ED25519Keys) *websocket.Conn

JoinChannel Takes a ktx address with port, boolean for new or returning, and keys. Outputs a websocket and CA cert

func OSCheck

func OSCheck()

OSCheck Check for the OS

func Send

func Send(msg string, conn *websocket.Conn) error

Send Takes a data string and a websocket connection

func Sign

func Sign(keyCollection *ED25519Keys, msg string) string

Sign Takes keys and a message to sign

func SignKey

func SignKey(keyCollection *ED25519Keys, publicKey string) string

SignKey Takes 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 VerifySignature

func VerifySignature(publicKey string, msg, signature string) bool

VerifySignature Takes a public key, a message, and a signature. This will return true if it verifies correctly.

func VerifySignedKey

func VerifySignedKey(publicKey string, publicSigningKey string, signature string) bool

VerifySignedKey Takes a public key, a public signing key, and a signature. This will return true if it verifies correctly.

func Version

func Version() string

Version Prints the semver of libkarai-go as string

Types

type ED25519Keys

type ED25519Keys struct {
	// contains filtered or unexported fields
}

ED25519Keys This is a struct for holding keys and a signature.

func GenerateKeys

func GenerateKeys() *ED25519Keys

GenerateKeys Generates ed25519 keyset as strings

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL