account

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPublicKeyIsEmpty thrown when public key is empty
	ErrPublicKeyIsEmpty = errors.New("public key is empty")

	// ErrInvalidPublicKey thrown when public key is invalid
	ErrInvalidPublicKey = errors.New("invalid public key")

	// ErrInvalidAddress thrown when address is invalid or not registered
	ErrInvalidAddress = errors.New("invalid address")

	// ErrPubKeyNotRegistered thrown when public key is not registered
	ErrPubKeyNotRegistered = errors.New("public key is not registered")
)

Functions

This section is empty.

Types

type Account

type Account interface {
	// RegisterAccount registers an account public key
	Register(ctx context.Context, pubKey string) error

	// GetPublicKey returns the base58 public key for the given address
	GetPublicKey(ctx context.Context, address string) (string, error)
}

Account defines an interface API for registerening account addresses and their public keys

type Service

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

Service is impementation of the Account interface

func NewService

func NewService(db immudb.ImmuClient, logger *zap.SugaredLogger) *Service

NewService creates a new account service

func (Service) GetPublicKey

func (s Service) GetPublicKey(ctx context.Context, address string) (string, error)

GetPublicKey implements method of the Account interface, it takes blockchain address and returns the base58 encoded public key

func (Service) Register

func (s Service) Register(ctx context.Context, pubKeyB58 string) error

Register implemnts method of the Account interface, it takes a base58 public key and registers it

Jump to

Keyboard shortcuts

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