common

package
v0.0.0-...-fee3720 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const KEYCHAINNAME = "LlamaKeysSet"

Variables

View Source
var BAlphabet = NewAlphabet("123456789ABCDEFGHIJKMNOPQRSTUVWYZabcdefghijkmnopqrstuvwxyz")

BTCAlphabet is the LLX base58 alphabet.

View Source
var HexContextsMap map[string]uint = make(map[string]uint)

Functions

func Decode

func Decode(str string) ([]byte, error)

Decode decodes the base58 encoded bytes.

func Encode

func Encode(bin []byte) string

Encode encodes the passed bytes into a base58 encoded string.

func EncodeBig

func EncodeBig(bigint *big.Int) string

func EncodeNewHex

func EncodeNewHex(toEncode []byte, ctx string) string

func EncodeUint64

func EncodeUint64(i uint64) string

EncodeUint64 encodes i as a hex string with LLx prefix.

func FastBase58Decoding

func FastBase58Decoding(str string) ([]byte, error)

FastBase58Decoding decodes the base58 encoded bytes.

func FastBase58DecodingAlphabet

func FastBase58DecodingAlphabet(str string, alphabet *Alphabet) ([]byte, error)

FastBase58DecodingAlphabet decodes the base58 encoded bytes using the given b58 alphabet.

func FastBase58Encoding

func FastBase58Encoding(bin []byte) string

FastBase58Encoding encodes the passed bytes into a base58 encoded string.

func FastBase58EncodingAlphabet

func FastBase58EncodingAlphabet(bin []byte, alphabet *Alphabet) string

FastBase58EncodingAlphabet encodes the passed bytes into a base58 encoded string with the passed alphabet.

func GenRandomBytes

func GenRandomBytes(size int) (blk []byte, err error)

func LoadWallet

func LoadWallet(address string, key string)

func StoreAddress

func StoreAddress(marshaled []byte)

func VerifyAddress

func VerifyAddress(a Address) bool

func VerifyPublicSignature

func VerifyPublicSignature(pub *ecdsa.PublicKey, hashed []byte, sig []byte) bool

Types

type Address

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

func UnserializeAddress

func UnserializeAddress(ab []byte) *Address

func (Address) GetPubX

func (a Address) GetPubX() []byte

func (Address) New

func (a Address) New() Address

func (Address) Serialize

func (a Address) Serialize() []byte

type Alphabet

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

func NewAlphabet

func NewAlphabet(s string) *Alphabet

NewAlphabet creates a new alphabet from the passed string.

It panics if the passed string is not 58 bytes long or isn't valid ASCII.

type Base58

type Base58 struct {
}

func (Base58) Decode

func (base58 Base58) Decode(b string) []byte

Decode decodes a modified base58 string to a byte slice.

func (Base58) Encode

func (base58 Base58) Encode(b []byte) string

Encode encodes a byte slice to a modified base58 string.

type DecodedHex

type DecodedHex struct {
	HexType string
	HexVal  string
	ByteVal []byte
	StrVal  string
	ToBytes []byte
}

func DecodeHex

func DecodeHex(h string) *DecodedHex

type DecodingError

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

func (DecodingError) Error

func (err DecodingError) Error() string

type FU

type FU struct {
	Encoder *gob.Encoder
	Decoder *gob.Decoder
	Buf     bytes.Buffer
	FileUtils
}

func (*FU) DecodeStruct

func (f *FU) DecodeStruct(i interface{}) interface{}

func (*FU) EncodeStruct

func (f *FU) EncodeStruct(s interface{}) ([]byte, error)

func (*FU) InitEncodeDecode

func (f *FU) InitEncodeDecode()

func (*FU) WriteEncodedStructToLocalFile

func (f *FU) WriteEncodedStructToLocalFile(i interface{}, filename string) bool

type FileUtils

type FileUtils interface {
	EncodeStruct(s interface{}) ([]byte, error)
	WriteEncodedStructToLocalFile(i interface{}, filename string) bool
	LoadStructFromFile(filename string) interface{}
	DecodeStruct(i interface{}) interface{}
	LoadJsonFile(filename string) []byte
	WriteJsonFile(filename string, data []byte)
	WriteNewReceiptToDisk(filename string, data []byte)
}

type Hashing

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

func (Hashing) HashBlock

func (h Hashing) HashBlock(b *big.Int) []byte

type HexOperator

type HexOperator struct {
	HexTools
}

func GetEncoderDecoder

func GetEncoderDecoder() *HexOperator

func (HexOperator) DecodeHex

func (h HexOperator) DecodeHex(hexStr string) *DecodedHex

func (*HexOperator) DecodeToBytes

func (h *HexOperator) DecodeToBytes()

func (*HexOperator) DecodeToString

func (h *HexOperator) DecodeToString()

func (*HexOperator) Encode

func (h *HexOperator) Encode()

func (HexOperator) EncodeHex

func (h HexOperator) EncodeHex(toHash []byte, context string) string

func (*HexOperator) EncodeWithPrefix

func (h *HexOperator) EncodeWithPrefix()

func (*HexOperator) EncodeWithSuffix

func (h *HexOperator) EncodeWithSuffix()

func (HexOperator) GetContext

func (h HexOperator) GetContext(context string) (uint, error)

func (*HexOperator) ValidateHex

func (h *HexOperator) ValidateHex()

type HexTools

type HexTools interface {
	Encode()
	EncodeWithPrefix()
	EncodeWithSuffix()
	DecodeToString()
	DecodeToBytes()
	ValidateHex()
}

type HexWithPrefix

type HexWithPrefix struct {
	Hexlified
	// contains filtered or unexported fields
}

type HexWithSuffix

type HexWithSuffix struct {
	Hexlified
	// contains filtered or unexported fields
}

type Hexlified

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

type LLamaKeys

type LLamaKeys struct {
	Keychain keychain.Keychain
}
var LK *LLamaKeys

func (*LLamaKeys) AddKey

func (L *LLamaKeys) AddKey(serviceName string, keyName string, keyLabel string, keyPass []byte, keyGroup string)

func (*LLamaKeys) GetAllAccountsForService

func (L *LLamaKeys) GetAllAccountsForService(serviceName string) ([]string, error)

type RawAddress

type RawAddress struct {
	ECDSAPriv  *ecdsa.PrivateKey
	Pub        ecdsa.PublicKey
	Sig        []byte
	LlxAddress string
}

func (*RawAddress) GetPublic

func (r *RawAddress) GetPublic() crypto.PublicKey

func (*RawAddress) SignASN

func (r *RawAddress) SignASN(data []byte) []byte

func (*RawAddress) ToString

func (r *RawAddress) ToString() string

type SecureKeys

type SecureKeys struct {

	//packed private key
	PSK []byte
	//packed public key
	PPK []byte
	DK1 []byte
	DK2 []byte
	// contains filtered or unexported fields
}

func (*SecureKeys) Create

func (s *SecureKeys) Create() *SecureKeys

func (SecureKeys) Decrypt

func (s SecureKeys) Decrypt(sm SecureMessage) []byte

func (SecureKeys) Encrypt

func (s SecureKeys) Encrypt(msg []byte) ([]byte, error)

func (SecureKeys) SecureSign

func (s SecureKeys) SecureSign(msg []byte) []byte

func (SecureKeys) SecureVerify

func (s SecureKeys) SecureVerify(msg []byte, pub []byte, sig []byte) (bool, error)

func (SecureKeys) SendSS

func (s SecureKeys) SendSS(msg []byte) *SecureMessage

SendSS will send the public key from A to B to ack a shared secret

func (SecureKeys) VerifySS

func (s SecureKeys) VerifySS(msg []byte) []byte

VerifySS check the msg from A and gets the shared secret from it

type SecureMessage

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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