aliasgo

package module
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 14 Imported by: 13

README

aliasgo

This is a Go implementation of an Alias blockchain using the BC data structures.

Build

go build

Documentation

Index

Constants

View Source
const (
	ALIAS = "Alias"

	ALIAS_THRESHOLD = bcgo.THRESHOLD_G

	MAX_ALIAS_LENGTH = 100
	MIN_ALIAS_LENGTH = 1

	ERROR_ALIAS_ALREADY_REGISTERED = "Alias Already Registered: %s"
	ERROR_ALIAS_INVALID            = "Alias Invalid: %s"
	ERROR_ALIAS_NOT_FOUND          = "Could Not Find Alias For Public Key"
	ERROR_ALIAS_NOT_PUBLIC         = "Cannot Register Private Alias"
	ERROR_ALIAS_TOO_LONG           = "Alias Too Long: %d Maximum: %d"
	ERROR_ALIAS_TOO_SHORT          = "Alias Too Short: %d Minimum: %d"
	ERROR_PUBLIC_KEY_NOT_FOUND     = "Could Not Find Public Key For Alias: %s"
)

Variables

This section is empty.

Functions

func AllPublicKeys added in v1.1.6

func AllPublicKeys(channel *bcgo.Channel, cache bcgo.Cache, network bcgo.Network) (map[string]*rsa.PublicKey, error)

func CreateAliasRecord

func CreateAliasRecord(alias string, publicKey []byte, publicKeyFormat cryptogo.PublicKeyFormat, signature []byte, signatureAlgorithm cryptogo.SignatureAlgorithm) (*bcgo.Record, error)

func CreateSignedAliasRecord

func CreateSignedAliasRecord(alias string, privateKey *rsa.PrivateKey) (*bcgo.Record, error)

func GetPublicKey

func GetPublicKey(channel *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, alias string) (*rsa.PublicKey, error)

func GetPublicKeys

func GetPublicKeys(channel *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, addresses []string) map[string]*rsa.PublicKey

func IterateAliases

func IterateAliases(channel *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, callback func(*bcgo.BlockEntry, *Alias) error) error

func OpenAliasChannel

func OpenAliasChannel() *bcgo.Channel

func Register

func Register(node *bcgo.Node, listener bcgo.MiningListener) error

func RegisterAlias

func RegisterAlias(host, alias string, key *rsa.PrivateKey) error

func UniqueAlias

func UniqueAlias(channel *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, alias string) error

func ValidateAlias

func ValidateAlias(alias string) error

Validates alias is the correct length and all characters are in the set [a-zA-Z0-9.-_]

Types

type Alias

type Alias struct {
	Alias                string                   `protobuf:"bytes,1,opt,name=alias,proto3" json:"alias,omitempty"`
	PublicKey            []byte                   `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	PublicFormat         cryptogo.PublicKeyFormat `` /* 126-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                 `json:"-"`
	XXX_unrecognized     []byte                   `json:"-"`
	XXX_sizecache        int32                    `json:"-"`
}

func GetAlias

func GetAlias(channel *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, publicKey *rsa.PublicKey) (*Alias, error)

func GetRecord

func GetRecord(channel *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, alias string) (*bcgo.Record, *Alias, error)

func (*Alias) Descriptor

func (*Alias) Descriptor() ([]byte, []int)

func (*Alias) GetAlias

func (m *Alias) GetAlias() string

func (*Alias) GetPublicFormat

func (m *Alias) GetPublicFormat() cryptogo.PublicKeyFormat

func (*Alias) GetPublicKey

func (m *Alias) GetPublicKey() []byte

func (*Alias) ProtoMessage

func (*Alias) ProtoMessage()

func (*Alias) Reset

func (m *Alias) Reset()

func (*Alias) String

func (m *Alias) String() string

func (*Alias) XXX_DiscardUnknown

func (m *Alias) XXX_DiscardUnknown()

func (*Alias) XXX_Marshal

func (m *Alias) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Alias) XXX_Merge

func (m *Alias) XXX_Merge(src proto.Message)

func (*Alias) XXX_Size

func (m *Alias) XXX_Size() int

func (*Alias) XXX_Unmarshal

func (m *Alias) XXX_Unmarshal(b []byte) error

type AliasValidator

type AliasValidator struct {
}

func (*AliasValidator) Validate

func (a *AliasValidator) Validate(channel *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, hash []byte, block *bcgo.Block) error

Jump to

Keyboard shortcuts

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