aliasgo

package module
Version: v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 16 Imported by: 12

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
)

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, publicKeyFormat cryptogo.PublicKeyFormat, publicKey []byte, signatureAlgorithm cryptogo.SignatureAlgorithm, signature []byte) (*bcgo.Record, error)

func CreateSignedAliasRecord

func CreateSignedAliasRecord(account bcgo.Account) (*bcgo.Record, error)

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 PublicKeyForAlias added in v1.2.0

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

func PublicKeysForAliases added in v1.2.0

func PublicKeysForAliases(channel bcgo.Channel, cache bcgo.Cache, network bcgo.Network, aliases []string) (access []bcgo.Identity)

func Register

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

func RegisterAlias

func RegisterAlias(host string, account bcgo.Account) 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 AliasForKey added in v1.2.0

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

func Record added in v1.2.0

func Record(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

type ErrAliasAlreadyRegistered added in v1.2.1

type ErrAliasAlreadyRegistered struct {
	Alias string
}

ErrAliasAlreadyRegistered is returned if the alias being registered is already taken.

func (ErrAliasAlreadyRegistered) Error added in v1.2.1

type ErrAliasInvalid added in v1.2.1

type ErrAliasInvalid struct {
	Alias string
}

ErrAliasInvalid is returned when the alias includes unsupported characters.

func (ErrAliasInvalid) Error added in v1.2.1

func (e ErrAliasInvalid) Error() string

type ErrAliasNotFound added in v1.2.1

type ErrAliasNotFound struct {
}

ErrAliasNotFound is returned if the alias cannot be found.

func (ErrAliasNotFound) Error added in v1.2.1

func (e ErrAliasNotFound) Error() string

type ErrAliasNotPublic added in v1.2.1

type ErrAliasNotPublic struct {
}

ErrAliasNotPublic is returned when registering an encrypted alias.

func (ErrAliasNotPublic) Error added in v1.2.1

func (e ErrAliasNotPublic) Error() string

type ErrAliasTooLong added in v1.2.1

type ErrAliasTooLong struct {
	Size, Max int
}

ErrAliasTooLong is returned when the alias is too long.

func (ErrAliasTooLong) Error added in v1.2.1

func (e ErrAliasTooLong) Error() string

type ErrAliasTooShort added in v1.2.1

type ErrAliasTooShort struct {
	Size, Min int
}

ErrAliasTooShort is returned when the alias is too short.

func (ErrAliasTooShort) Error added in v1.2.1

func (e ErrAliasTooShort) Error() string

type ErrPublicKeyNotFound added in v1.2.1

type ErrPublicKeyNotFound struct {
	Alias string
}

ErrPublicKeyNotFound is return if the public key cannot be found.

func (ErrPublicKeyNotFound) Error added in v1.2.1

func (e ErrPublicKeyNotFound) Error() string

Jump to

Keyboard shortcuts

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