services

package
v0.0.0-...-45a0741 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSignature

func CheckSignature(message, pubkeyHex, signatureHex, timestamp string, debug bool) error

CheckSignature checks that provided message was signed with the given key

func ParsePubKey

func ParsePubKey(pubkeyHex string) (*btcec.PublicKey, error)

/ NEEW

Types

type Client

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

Client is a blockchain http client

func NewClient

func NewClient(url, user, password string, l logger) Client

NewClient create new blockchain http client object

func (*Client) ValidateAddress

func (c *Client) ValidateAddress(address string) (ValidateAddressInfo, error)

ValidateAddress returns information about given address from the blockchain

type UsersService

type UsersService struct {
	NetParams     chaincfg.Params
	BCClient      Client
	UsersStore    stores.UsersStore
	SessionsStore stores.SessionsStore
	SettingsStore stores.SettingsStore
	ProgressStore stores.ProgressStore
}

UsersService

func (*UsersService) CreateSession

func (s *UsersService) CreateSession(user models.User) (string, error)

CreateSession create new session for a give user

func (*UsersService) CreateUserWithPassword

func (s *UsersService) CreateUserWithPassword(username, password string) (*models.User, error)

CreateUserWithPassword create a user with a provided ligin/password pair

func (*UsersService) CreateUserWithSignature

func (s *UsersService) CreateUserWithSignature(message, pubkeyHex, signatureHex, timestamp string, debug bool) (*models.User, error)

CreateUserWithSignature creates a user with provided pubkey and signature TODO: replace pubkey with address

type ValidateAddressInfo

type ValidateAddressInfo struct {
	IsValid   bool   `json:"isvalid"`
	Beaconed  byte   `json:"isbeaconed"`  // why isbeaconed is a number in meritd???
	Confirmed byte   `json:"isconfirmed"` // why isconfirmed is a number in meritd???
	Address   string `json:"address"`
	PublicKey string `json:"pubkey"`
	Alias     string `json:"alias"`
}

Result of `validateaddress` call

Jump to

Keyboard shortcuts

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