Documentation ¶
Index ¶
- Variables
- func ValidateAccount(fl validator.FieldLevel) bool
- func ValidateEnum(fl validator.FieldLevel) bool
- func ValidateHash(fl validator.FieldLevel) bool
- func ValidatePassword(fl validator.FieldLevel) bool
- type BlockService
- type Enum
- type EthKeystoreService
- type FileBlockService
- type FileTransactionService
- func (a *FileTransactionService) AddPendingTx(tx models.Transaction) error
- func (a *FileTransactionService) GetPendingTxs() map[models.TransactionId]models.Transaction
- func (a *FileTransactionService) RemovePendingTx(id models.TransactionId)
- func (a *FileTransactionService) RemovePendingTxs(ids []models.TransactionId)
- type JwtService
- type KeystoreService
- type Name
- type PasswordService
- type SigningConf
- type TransactionService
- type UserFromDB
- type UserService
- type ValidatorService
- type VerifyingConf
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidHash = errors.New("invalid format") ErrIncompatibleVersion = errors.New("incompatible version of argon2") )
inspired from: https://gist.github.com/alexedwards/34277fae0f48abe36822b375f0f6a621
var ( ErrMarshalTx = errors.New("marshal error") ErrTxAlreadyInPool = errors.New("transaction is already in pool") )
var ALLOWED_ALGORITHMS = []string{"HS256"}
Functions ¶
func ValidateAccount ¶
func ValidateAccount(fl validator.FieldLevel) bool
func ValidateEnum ¶
func ValidateEnum(fl validator.FieldLevel) bool
func ValidateHash ¶
func ValidateHash(fl validator.FieldLevel) bool
func ValidatePassword ¶
func ValidatePassword(fl validator.FieldLevel) bool
Types ¶
type BlockService ¶
type EthKeystoreService ¶
type EthKeystoreService struct {
// contains filtered or unexported fields
}
func NewEthKeystore ¶
func NewEthKeystore(keystoreDataDirPath string) (*EthKeystoreService, error)
func (*EthKeystoreService) NewKeystoreAccount ¶
func (k *EthKeystoreService) NewKeystoreAccount(password string) (common.Address, error)
type FileBlockService ¶
type FileBlockService struct {
// contains filtered or unexported fields
}
func NewFileBlockService ¶
func (*FileBlockService) GetNextBlocksFromHash ¶
func (*FileBlockService) Mine ¶
func (a *FileBlockService) Mine(ctx context.Context, pb models.PendingBlock) (*models.Block, error)
Mine mines a pending block meaning that it'll try to find a valid nonce so it can create a block in the blockchain
func (*FileBlockService) ThisNodeMiningAddress ¶
func (a *FileBlockService) ThisNodeMiningAddress() models.Account
type FileTransactionService ¶
type FileTransactionService struct {
// contains filtered or unexported fields
}
func NewFileTransactionService ¶
func NewFileTransactionService() *FileTransactionService
NewFileTransactionService default constructor
func (*FileTransactionService) AddPendingTx ¶
func (a *FileTransactionService) AddPendingTx(tx models.Transaction) error
AddPendingTx adds a transaction to the pool
func (*FileTransactionService) GetPendingTxs ¶
func (a *FileTransactionService) GetPendingTxs() map[models.TransactionId]models.Transaction
GetPendingTxs get pending transactions
func (*FileTransactionService) RemovePendingTx ¶
func (a *FileTransactionService) RemovePendingTx(id models.TransactionId)
RemovePendingTx remove transaction from pool
func (*FileTransactionService) RemovePendingTxs ¶
func (a *FileTransactionService) RemovePendingTxs(ids []models.TransactionId)
RemovePendingTxs remove transactions from pool
type JwtService ¶
type JwtService struct {
// contains filtered or unexported fields
}
func NewJwtService ¶
func NewJwtService(verifyingConf VerifyingConf, signingConf SigningConf) (*JwtService, error)
func (*JwtService) PrivateKeyId ¶
func (j *JwtService) PrivateKeyId() string
func (*JwtService) PrivateKeyPath ¶
func (j *JwtService) PrivateKeyPath() string
func (*JwtService) SignToken ¶
func (j *JwtService) SignToken(content interface{}) (string, error)
SignToken Sign token with private key passed at the initialisation of the service including the payload passed as content parameter
func (*JwtService) VerifyToken ¶
func (j *JwtService) VerifyToken(signedToken string) (jwt.Token, error)
VerifyToken check if token is valid according to public key info expsed by jwks
type KeystoreService ¶
fine to leave eth object as we are not planning on implementing another keystore only for test/muck purposes
type PasswordService ¶
type PasswordService struct {
// contains filtered or unexported fields
}
func NewDefaultPasswordService ¶
func NewDefaultPasswordService() PasswordService
func NewPasswordService ¶
func (PasswordService) ComparePasswordAndHash ¶
func (c PasswordService) ComparePasswordAndHash(password, encodedHash string) (match bool, err error)
func (PasswordService) GenerateHash ¶
func (c PasswordService) GenerateHash(password string) (hash string, err error)
type SigningConf ¶
type SigningConf struct {
// contains filtered or unexported fields
}
func NewSigningConf ¶
type TransactionService ¶
type TransactionService interface { AddPendingTx(models.Transaction) error GetPendingTxs() map[models.TransactionId]models.Transaction RemovePendingTx(models.TransactionId) RemovePendingTxs([]models.TransactionId) }
type UserFromDB ¶
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(userDatabasePath string) (*UserService, error)
NewUserService initiate the user service
type ValidatorService ¶
type ValidatorService struct{}
func (ValidatorService) AddValidators ¶
func (v ValidatorService) AddValidators()
type VerifyingConf ¶
type VerifyingConf struct {
// contains filtered or unexported fields
}
func NewVerifyingConf ¶
func NewVerifyingConf(jwksUrl string, jkmsRefreshCacheIntervalInMin int, jkmsRefreshCacheRateLimitInMin int, jkmsRefreshCacheTimeoutInSec int) VerifyingConf