testscommon

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMongoDBClientMock added in v1.0.14

func NewMongoDBClientMock(numCollections uint32) *mongoDBClientMock

NewMongoDBClientMock -

func NewShardedStorageWithIndexMock

func NewShardedStorageWithIndexMock() *shardedStorageWithIndexMock

NewShardedStorageWithIndexMock -

Types

type BucketIDProviderStub

type BucketIDProviderStub struct {
	GetBucketForAddressCalled func(address []byte) uint32
}

func (*BucketIDProviderStub) GetBucketForAddress

func (stub *BucketIDProviderStub) GetBucketForAddress(address []byte) uint32

GetBucketForAddress -

func (*BucketIDProviderStub) IsInterfaceNil

func (stub *BucketIDProviderStub) IsInterfaceNil() bool

IsInterfaceNil -

type BucketIndexHandlerStub

type BucketIndexHandlerStub struct {
	PutCalled                 func(key, data []byte) error
	GetCalled                 func(key []byte) ([]byte, error)
	HasCalled                 func(key []byte) error
	CloseCalled               func() error
	AllocateBucketIndexCalled func() (uint32, error)
	GetLastIndexCalled        func() (uint32, error)
}

BucketIndexHandlerStub -

func (*BucketIndexHandlerStub) AllocateBucketIndex

func (stub *BucketIndexHandlerStub) AllocateBucketIndex() (uint32, error)

AllocateBucketIndex -

func (*BucketIndexHandlerStub) Close

func (stub *BucketIndexHandlerStub) Close() error

Close -

func (*BucketIndexHandlerStub) Get

func (stub *BucketIndexHandlerStub) Get(key []byte) ([]byte, error)

Get -

func (*BucketIndexHandlerStub) GetLastIndex

func (stub *BucketIndexHandlerStub) GetLastIndex() (uint32, error)

GetLastIndex -

func (*BucketIndexHandlerStub) Has

func (stub *BucketIndexHandlerStub) Has(key []byte) error

Has -

func (*BucketIndexHandlerStub) IsInterfaceNil

func (stub *BucketIndexHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*BucketIndexHandlerStub) Put

func (stub *BucketIndexHandlerStub) Put(key, data []byte) error

Put -

type CryptoComponentsHolderFactoryStub

type CryptoComponentsHolderFactoryStub struct {
	CreateCalled func(privateKeyBytes []byte) (core.CryptoComponentsHolder, error)
}

CryptoComponentsHolderFactoryStub -

func (*CryptoComponentsHolderFactoryStub) Create

func (stub *CryptoComponentsHolderFactoryStub) Create(privateKeyBytes []byte) (core.CryptoComponentsHolder, error)

Create -

func (*CryptoComponentsHolderFactoryStub) IsInterfaceNil

func (stub *CryptoComponentsHolderFactoryStub) IsInterfaceNil() bool

IsInterfaceNil -

type CryptoComponentsHolderStub added in v1.0.15

type CryptoComponentsHolderStub struct {
	GetPublicKeyCalled      func() crypto.PublicKey
	GetPrivateKeyCalled     func() crypto.PrivateKey
	GetBech32Called         func() string
	GetAddressHandlerCalled func() core.AddressHandler
}

CryptoComponentsHolderStub -

func (*CryptoComponentsHolderStub) GetAddressHandler added in v1.0.15

func (c *CryptoComponentsHolderStub) GetAddressHandler() core.AddressHandler

GetAddressHandler -

func (*CryptoComponentsHolderStub) GetBech32 added in v1.0.15

func (c *CryptoComponentsHolderStub) GetBech32() string

GetBech32 -

func (*CryptoComponentsHolderStub) GetPrivateKey added in v1.0.15

func (c *CryptoComponentsHolderStub) GetPrivateKey() crypto.PrivateKey

GetPrivateKey -

func (*CryptoComponentsHolderStub) GetPublicKey added in v1.0.15

func (c *CryptoComponentsHolderStub) GetPublicKey() crypto.PublicKey

GetPublicKey -

func (*CryptoComponentsHolderStub) IsInterfaceNil added in v1.0.15

func (c *CryptoComponentsHolderStub) IsInterfaceNil() bool

IsInterfaceNil -

type EncryptorStub

type EncryptorStub struct {
	EncryptDataCalled func(data []byte) ([]byte, error)
	DecryptDataCalled func(data []byte) ([]byte, error)
}

EncryptorStub is a stub implementation of Encryptor

func (*EncryptorStub) DecryptData

func (es *EncryptorStub) DecryptData(data []byte) ([]byte, error)

DecryptData decrypts the provided data

func (*EncryptorStub) EncryptData

func (es *EncryptorStub) EncryptData(data []byte) ([]byte, error)

EncryptData encrypts the provided data

func (*EncryptorStub) IsInterfaceNil

func (es *EncryptorStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type GuardedTxBuilderStub

type GuardedTxBuilderStub struct {
	ApplyGuardianSignatureCalled func(cryptoHolderGuardian core.CryptoComponentsHolder, tx *transaction.FrontendTransaction) error
}

GuardedTxBuilderStub -

func (*GuardedTxBuilderStub) ApplyGuardianSignature

func (stub *GuardedTxBuilderStub) ApplyGuardianSignature(cryptoHolderGuardian core.CryptoComponentsHolder, tx *transaction.FrontendTransaction) error

ApplyGuardianSignature -

func (*GuardedTxBuilderStub) IsInterfaceNil

func (stub *GuardedTxBuilderStub) IsInterfaceNil() bool

IsInterfaceNil -

type HttpClientWrapperStub

type HttpClientWrapperStub struct {
	GetAccountCalled      func(ctx context.Context, address string) (*data.Account, error)
	GetGuardianDataCalled func(ctx context.Context, address string) (*api.GuardianData, error)
}

HttpClientWrapperStub -

func (*HttpClientWrapperStub) GetAccount

func (stub *HttpClientWrapperStub) GetAccount(ctx context.Context, address string) (*data.Account, error)

GetAccount -

func (*HttpClientWrapperStub) GetGuardianData

func (stub *HttpClientWrapperStub) GetGuardianData(ctx context.Context, address string) (*api.GuardianData, error)

GetGuardianData -

func (*HttpClientWrapperStub) IsInterfaceNil

func (stub *HttpClientWrapperStub) IsInterfaceNil() bool

IsInterfaceNil -

type KeysGeneratorStub

type KeysGeneratorStub struct {
	GenerateManagedKeyCalled func() (crypto.PrivateKey, error)
	GenerateKeysCalled       func(index uint32) ([]crypto.PrivateKey, error)
}

KeysGeneratorStub -

func (*KeysGeneratorStub) GenerateKeys

func (stub *KeysGeneratorStub) GenerateKeys(index uint32) ([]crypto.PrivateKey, error)

GenerateKeys -

func (*KeysGeneratorStub) GenerateManagedKey

func (stub *KeysGeneratorStub) GenerateManagedKey() (crypto.PrivateKey, error)

GenerateManagedKey -

func (*KeysGeneratorStub) IsInterfaceNil

func (stub *KeysGeneratorStub) IsInterfaceNil() bool

IsInterfaceNil -

type MarshallerStub

type MarshallerStub struct {
	MarshalCalled   func(obj interface{}) ([]byte, error)
	UnmarshalCalled func(obj interface{}, buff []byte) error
}

MarshallerStub -

func (*MarshallerStub) IsInterfaceNil

func (stub *MarshallerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*MarshallerStub) Marshal

func (stub *MarshallerStub) Marshal(obj interface{}) ([]byte, error)

Marshal -

func (*MarshallerStub) Unmarshal

func (stub *MarshallerStub) Unmarshal(obj interface{}, buff []byte) error

Unmarshal -

type MiddlewareStub

type MiddlewareStub struct {
	UserAddress string
}

func (*MiddlewareStub) IsInterfaceNil

func (stub *MiddlewareStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*MiddlewareStub) MiddlewareHandlerFunc

func (stub *MiddlewareStub) MiddlewareHandlerFunc() gin.HandlerFunc

MiddlewareHandlerFunc -

type MongoDBClientStub

type MongoDBClientStub struct {
	PutCalled                  func(coll mongodb.CollectionID, key []byte, data []byte) error
	GetCalled                  func(coll mongodb.CollectionID, key []byte) ([]byte, error)
	HasCalled                  func(coll mongodb.CollectionID, key []byte) error
	RemoveCalled               func(coll mongodb.CollectionID, key []byte) error
	GetIndexCalled             func(collID mongodb.CollectionID, key []byte) (uint32, error)
	IncrementIndexCalled       func(collID mongodb.CollectionID, key []byte) (uint32, error)
	PutIndexIfNotExistsCalled  func(collID mongodb.CollectionID, key []byte, index uint32) error
	GetAllCollectionsIDsCalled func() []mongodb.CollectionID
	CloseCalled                func() error
}

MongoDBClientStub implemented mongodb client wraper interface

func (*MongoDBClientStub) Close

func (m *MongoDBClientStub) Close() error

Close -

func (*MongoDBClientStub) Get

func (m *MongoDBClientStub) Get(coll mongodb.CollectionID, key []byte) ([]byte, error)

Get -

func (*MongoDBClientStub) GetAllCollectionsIDs

func (m *MongoDBClientStub) GetAllCollectionsIDs() []mongodb.CollectionID

GetAllCollectionsIDs -

func (*MongoDBClientStub) GetIndex

func (m *MongoDBClientStub) GetIndex(coll mongodb.CollectionID, key []byte) (uint32, error)

GetIndex -

func (*MongoDBClientStub) Has

func (m *MongoDBClientStub) Has(coll mongodb.CollectionID, key []byte) error

Has -

func (*MongoDBClientStub) IncrementIndex

func (m *MongoDBClientStub) IncrementIndex(coll mongodb.CollectionID, key []byte) (uint32, error)

IncrementIndex -

func (*MongoDBClientStub) IsInterfaceNil

func (m *MongoDBClientStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*MongoDBClientStub) Put

func (m *MongoDBClientStub) Put(coll mongodb.CollectionID, key []byte, data []byte) error

Put -

func (*MongoDBClientStub) PutIndexIfNotExists

func (m *MongoDBClientStub) PutIndexIfNotExists(collID mongodb.CollectionID, key []byte, index uint32) error

PutIndexIfNotExists -

func (*MongoDBClientStub) Remove

func (m *MongoDBClientStub) Remove(coll mongodb.CollectionID, key []byte) error

Remove -

type OTPProviderStub

type OTPProviderStub struct {
	GenerateTOTPCalled  func(account string, hash crypto.Hash) (handlers.OTP, error)
	TOTPFromBytesCalled func(encryptedMessage []byte) (handlers.OTP, error)
}

OTPProviderStub -

func (*OTPProviderStub) GenerateTOTP

func (stub *OTPProviderStub) GenerateTOTP(account string, hash crypto.Hash) (handlers.OTP, error)

GenerateTOTP -

func (*OTPProviderStub) IsInterfaceNil

func (stub *OTPProviderStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*OTPProviderStub) TOTPFromBytes

func (stub *OTPProviderStub) TOTPFromBytes(encryptedMessage []byte) (handlers.OTP, error)

TOTPFromBytes -

type RateLimiterMock

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

RateLimiterMock -

func NewRateLimiterMock

func NewRateLimiterMock(maxFailures int, periodLimit int) *RateLimiterMock

NewRateLimiterMock -

func (*RateLimiterMock) CheckAllowedAndIncreaseTrials

func (r *RateLimiterMock) CheckAllowedAndIncreaseTrials(key string, _ redis.Mode) (*redis.RateLimiterResult, error)

CheckAllowedAndIncreaseTrials -

func (*RateLimiterMock) DecrementSecurityFailedTrials added in v1.0.14

func (r *RateLimiterMock) DecrementSecurityFailedTrials(key string) error

DecrementSecurityFailedTrials -

func (*RateLimiterMock) ExtendSecurityMode added in v1.0.16

func (r *RateLimiterMock) ExtendSecurityMode(_ string) error

ExtendSecurityMode -

func (*RateLimiterMock) IsInterfaceNil

func (r *RateLimiterMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*RateLimiterMock) Period

func (r *RateLimiterMock) Period(_ redis.Mode) time.Duration

Period -

func (*RateLimiterMock) Rate

func (r *RateLimiterMock) Rate(_ redis.Mode) int

Rate -

func (*RateLimiterMock) Reset

func (r *RateLimiterMock) Reset(key string) error

Reset -

func (*RateLimiterMock) SetSecurityModeNoExpire added in v1.0.16

func (r *RateLimiterMock) SetSecurityModeNoExpire(key string) error

SetSecurityModeNoExpire -

func (*RateLimiterMock) UnsetSecurityModeNoExpire added in v1.0.16

func (r *RateLimiterMock) UnsetSecurityModeNoExpire(key string) error

UnsetSecurityModeNoExpire -

type RateLimiterStub

type RateLimiterStub struct {
	CheckAllowedAndIncreaseTrialsCalled func(key string, mode redis.Mode) (*redis.RateLimiterResult, error)
	DecrementSecurityFailuresCalled     func(key string) error
	ResetCalled                         func(key string) error
	PeriodCalled                        func(mode redis.Mode) time.Duration
	RateCalled                          func(mode redis.Mode) int
	SetSecurityModeNoExpireCalled       func(key string) error
	UnsetSecurityModeNoExpireCalled     func(key string) error
	ExtendSecurityModeCalled            func(key string) error
}

RateLimiterStub -

func (*RateLimiterStub) CheckAllowedAndIncreaseTrials

func (r *RateLimiterStub) CheckAllowedAndIncreaseTrials(key string, mode redis.Mode) (*redis.RateLimiterResult, error)

CheckAllowedAndIncreaseTrials -

func (*RateLimiterStub) DecrementSecurityFailedTrials added in v1.0.14

func (r *RateLimiterStub) DecrementSecurityFailedTrials(key string) error

DecrementSecurityFailedTrials -

func (*RateLimiterStub) ExtendSecurityMode added in v1.0.16

func (r *RateLimiterStub) ExtendSecurityMode(key string) error

ExtendSecurityMode -

func (*RateLimiterStub) IsInterfaceNil

func (r *RateLimiterStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*RateLimiterStub) Period

func (r *RateLimiterStub) Period(mode redis.Mode) time.Duration

Period -

func (*RateLimiterStub) Rate

func (r *RateLimiterStub) Rate(mode redis.Mode) int

Rate -

func (*RateLimiterStub) Reset

func (r *RateLimiterStub) Reset(key string) error

Reset -

func (*RateLimiterStub) SetSecurityModeNoExpire added in v1.0.16

func (r *RateLimiterStub) SetSecurityModeNoExpire(key string) error

SetSecurityModeNoExpire -

func (*RateLimiterStub) UnsetSecurityModeNoExpire added in v1.0.16

func (r *RateLimiterStub) UnsetSecurityModeNoExpire(key string) error

UnsetSecurityModeNoExpire -

type RedisClientStub

type RedisClientStub struct {
	IncrementCalled              func(ctx context.Context, key string) (int64, error)
	DecrementCalled              func(ctx context.Context, key string) (int64, error)
	SetExpireCalled              func(ctx context.Context, key string, ttl time.Duration) (bool, error)
	SetExpireIfNotExistsCalled   func(ctx context.Context, key string, ttl time.Duration) (bool, error)
	SetPersistCalled             func(ctx context.Context, key string) (bool, error)
	SetGreaterExpireTTLCalled    func(ctx context.Context, key string, ttl time.Duration) (bool, error)
	ResetCounterAndKeepTTLCalled func(ctx context.Context, key string) error
	ExpireTimeCalled             func(ctx context.Context, key string) (time.Duration, error)
	IsConnectedCalled            func(ctx context.Context) bool
}

RedisClientStub -

func (*RedisClientStub) Decrement added in v1.0.14

func (r *RedisClientStub) Decrement(ctx context.Context, key string) (int64, error)

Decrement -

func (*RedisClientStub) ExpireTime

func (r *RedisClientStub) ExpireTime(ctx context.Context, key string) (time.Duration, error)

ExpireTime -

func (*RedisClientStub) Increment

func (r *RedisClientStub) Increment(ctx context.Context, key string) (int64, error)

Increment -

func (*RedisClientStub) IsConnected

func (r *RedisClientStub) IsConnected(ctx context.Context) bool

IsConnected -

func (*RedisClientStub) IsInterfaceNil

func (r *RedisClientStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*RedisClientStub) ResetCounterAndKeepTTL

func (r *RedisClientStub) ResetCounterAndKeepTTL(ctx context.Context, key string) error

ResetCounterAndKeepTTL -

func (*RedisClientStub) SetExpire

func (r *RedisClientStub) SetExpire(ctx context.Context, key string, ttl time.Duration) (bool, error)

SetExpire -

func (*RedisClientStub) SetExpireIfNotExists

func (r *RedisClientStub) SetExpireIfNotExists(ctx context.Context, key string, ttl time.Duration) (bool, error)

SetExpireIfNotExists -

func (*RedisClientStub) SetGreaterExpireTTL added in v1.0.16

func (r *RedisClientStub) SetGreaterExpireTTL(ctx context.Context, key string, ttl time.Duration) (bool, error)

SetGreaterExpireTTL -

func (*RedisClientStub) SetPersist added in v1.0.16

func (r *RedisClientStub) SetPersist(ctx context.Context, key string) (bool, error)

SetPersist -

type SecureOtpHandlerStub added in v1.0.14

type SecureOtpHandlerStub struct {
	IsVerificationAllowedAndIncreaseTrialsCalled func(account string, ip string) (*requests.OTPCodeVerifyData, error)
	ResetCalled                                  func(account string, ip string)
	DecrementSecurityModeFailedTrialsCalled      func(account string) error
	SetSecurityModeNoExpireCalled                func(key string) error
	UnsetSecurityModeNoExpireCalled              func(key string) error
	FreezeBackoffTimeCalled                      func() uint64
	FreezeMaxFailuresCalled                      func() uint64
	SecurityModeBackOffTimeCalled                func() uint64
	SecurityModeMaxFailuresCalled                func() uint64
	ExtendSecurityModeCalled                     func(account string) error
}

SecureOtpHandlerStub is a stub implementation of the SecureOtpHandler interface

func (*SecureOtpHandlerStub) DecrementSecurityModeFailedTrials added in v1.0.14

func (stub *SecureOtpHandlerStub) DecrementSecurityModeFailedTrials(account string) error

DecrementSecurityModeFailedTrials decrements the security mode failed trials

func (*SecureOtpHandlerStub) ExtendSecurityMode added in v1.0.16

func (stub *SecureOtpHandlerStub) ExtendSecurityMode(account string) error

ExtendSecurityMode -

func (*SecureOtpHandlerStub) FreezeBackOffTime added in v1.0.14

func (stub *SecureOtpHandlerStub) FreezeBackOffTime() uint64

FreezeBackOffTime returns the configured back off time

func (*SecureOtpHandlerStub) FreezeMaxFailures added in v1.0.14

func (stub *SecureOtpHandlerStub) FreezeMaxFailures() uint64

FreezeMaxFailures -

func (*SecureOtpHandlerStub) IsInterfaceNil added in v1.0.14

func (stub *SecureOtpHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SecureOtpHandlerStub) IsVerificationAllowedAndIncreaseTrials added in v1.0.14

func (stub *SecureOtpHandlerStub) IsVerificationAllowedAndIncreaseTrials(account string, ip string) (*requests.OTPCodeVerifyData, error)

IsVerificationAllowedAndIncreaseTrials returns true if the verification is allowed for the given account and ip

func (*SecureOtpHandlerStub) Reset added in v1.0.14

func (stub *SecureOtpHandlerStub) Reset(account string, ip string)

Reset removes the account and ip from local cache

func (*SecureOtpHandlerStub) SecurityModeBackOffTime added in v1.0.14

func (stub *SecureOtpHandlerStub) SecurityModeBackOffTime() uint64

SecurityModeBackOffTime -

func (*SecureOtpHandlerStub) SecurityModeMaxFailures added in v1.0.14

func (stub *SecureOtpHandlerStub) SecurityModeMaxFailures() uint64

SecurityModeMaxFailures -

func (*SecureOtpHandlerStub) SetSecurityModeNoExpire added in v1.0.16

func (stub *SecureOtpHandlerStub) SetSecurityModeNoExpire(key string) error

SetSecurityModeNoExpire -

func (*SecureOtpHandlerStub) UnsetSecurityModeNoExpire added in v1.0.16

func (stub *SecureOtpHandlerStub) UnsetSecurityModeNoExpire(key string) error

UnsetSecurityModeNoExpire -

type ServiceResolverStub

type ServiceResolverStub struct {
	GetGuardianAddressCalled        func(userAddress core.AddressHandler) (string, error)
	RegisterUserCalled              func(userAddress core.AddressHandler, request requests.RegistrationPayload) (*requests.OTP, string, error)
	VerifyCodeCalled                func(userAddress core.AddressHandler, userIp string, request requests.VerificationPayload) (*requests.OTPCodeVerifyData, error)
	SetSecurityModeNoExpireCalled   func(userIp string, request requests.SecurityModeNoExpire) (*requests.OTPCodeVerifyData, error)
	UnsetSecurityModeNoExpireCalled func(userIp string, request requests.SecurityModeNoExpire) (*requests.OTPCodeVerifyData, error)
	SignMessageCalled               func(userIp string, request requests.SignMessage) ([]byte, *requests.OTPCodeVerifyData, error)
	SignTransactionCalled           func(userIp string, request requests.SignTransaction) ([]byte, *requests.OTPCodeVerifyData, error)
	SignMultipleTransactionsCalled  func(userIp string, request requests.SignMultipleTransactions) ([][]byte, *requests.OTPCodeVerifyData, error)
	RegisteredUsersCalled           func() (uint32, error)
	TcsConfigCalled                 func() *tcsCore.TcsConfig
}

ServiceResolverStub -

func (*ServiceResolverStub) IsInterfaceNil

func (stub *ServiceResolverStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*ServiceResolverStub) RegisterUser

func (stub *ServiceResolverStub) RegisterUser(userAddress core.AddressHandler, request requests.RegistrationPayload) (*requests.OTP, string, error)

RegisterUser -

func (*ServiceResolverStub) RegisteredUsers

func (stub *ServiceResolverStub) RegisteredUsers() (uint32, error)

RegisteredUsers -

func (*ServiceResolverStub) SetSecurityModeNoExpire added in v1.0.16

func (stub *ServiceResolverStub) SetSecurityModeNoExpire(userIp string, request requests.SecurityModeNoExpire) (*requests.OTPCodeVerifyData, error)

SetSecurityModeNoExpire -

func (*ServiceResolverStub) SignMessage added in v1.0.15

func (stub *ServiceResolverStub) SignMessage(userIp string, request requests.SignMessage) ([]byte, *requests.OTPCodeVerifyData, error)

SignMessage -

func (*ServiceResolverStub) SignMultipleTransactions

func (stub *ServiceResolverStub) SignMultipleTransactions(userIp string, request requests.SignMultipleTransactions) ([][]byte, *requests.OTPCodeVerifyData, error)

SignMultipleTransactions -

func (*ServiceResolverStub) SignTransaction

func (stub *ServiceResolverStub) SignTransaction(userIp string, request requests.SignTransaction) ([]byte, *requests.OTPCodeVerifyData, error)

SignTransaction -

func (*ServiceResolverStub) TcsConfig

func (stub *ServiceResolverStub) TcsConfig() *tcsCore.TcsConfig

TcsConfig returns the current configuration of the TCS

func (*ServiceResolverStub) UnsetSecurityModeNoExpire added in v1.0.16

func (stub *ServiceResolverStub) UnsetSecurityModeNoExpire(userIp string, request requests.SecurityModeNoExpire) (*requests.OTPCodeVerifyData, error)

UnsetSecurityModeNoExpire -

func (*ServiceResolverStub) VerifyCode

func (stub *ServiceResolverStub) VerifyCode(userAddress core.AddressHandler, userIp string, request requests.VerificationPayload) (*requests.OTPCodeVerifyData, error)

VerifyCode -

type ShardedStorageWithIndexStub

type ShardedStorageWithIndexStub struct {
	AllocateIndexCalled       func(address []byte) (uint32, error)
	PutCalled                 func(key, data []byte) error
	GetCalled                 func(key []byte) ([]byte, error)
	HasCalled                 func(key []byte) error
	CloseCalled               func() error
	AllocateBucketIndexCalled func(address []byte) (uint32, error)
	CountCalled               func() (uint32, error)
}

ShardedStorageWithIndexStub -

func (*ShardedStorageWithIndexStub) AllocateBucketIndex

func (stub *ShardedStorageWithIndexStub) AllocateBucketIndex(address []byte) (uint32, error)

AllocateBucketIndex -

func (*ShardedStorageWithIndexStub) AllocateIndex

func (stub *ShardedStorageWithIndexStub) AllocateIndex(address []byte) (uint32, error)

AllocateIndex -

func (*ShardedStorageWithIndexStub) Close

func (stub *ShardedStorageWithIndexStub) Close() error

Close -

func (*ShardedStorageWithIndexStub) Count

func (stub *ShardedStorageWithIndexStub) Count() (uint32, error)

Count -

func (*ShardedStorageWithIndexStub) Get

func (stub *ShardedStorageWithIndexStub) Get(key []byte) ([]byte, error)

Get -

func (*ShardedStorageWithIndexStub) Has

func (stub *ShardedStorageWithIndexStub) Has(key []byte) error

Has -

func (*ShardedStorageWithIndexStub) IsInterfaceNil

func (stub *ShardedStorageWithIndexStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*ShardedStorageWithIndexStub) Put

func (stub *ShardedStorageWithIndexStub) Put(key, data []byte) error

Put -

type SignerStub added in v1.0.15

type SignerStub struct {
	SignMessageCalled     func(msg []byte, privateKey crypto.PrivateKey) ([]byte, error)
	VerifyMessageCalled   func(msg []byte, publicKey crypto.PublicKey, sig []byte) error
	SignTransactionCalled func(tx *transaction.FrontendTransaction, privateKey crypto.PrivateKey) ([]byte, error)
	SignByteSliceCalled   func(msg []byte, privateKey crypto.PrivateKey) ([]byte, error)
	VerifyByteSliceCalled func(msg []byte, publicKey crypto.PublicKey, sig []byte) error
}

SignerStub -

func (*SignerStub) IsInterfaceNil added in v1.0.15

func (s *SignerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*SignerStub) SignByteSlice added in v1.0.15

func (s *SignerStub) SignByteSlice(msg []byte, privateKey crypto.PrivateKey) ([]byte, error)

SignByteSlice -

func (*SignerStub) SignMessage added in v1.0.15

func (s *SignerStub) SignMessage(msg []byte, privateKey crypto.PrivateKey) ([]byte, error)

SignMessage -

func (*SignerStub) SignTransaction added in v1.0.15

func (s *SignerStub) SignTransaction(tx *transaction.FrontendTransaction, privateKey crypto.PrivateKey) ([]byte, error)

SignTransaction -

func (*SignerStub) VerifyByteSlice added in v1.0.15

func (s *SignerStub) VerifyByteSlice(msg []byte, publicKey crypto.PublicKey, sig []byte) error

VerifyByteSlice -

func (*SignerStub) VerifyMessage added in v1.0.15

func (s *SignerStub) VerifyMessage(msg []byte, publicKey crypto.PublicKey, sig []byte) error

VerifyMessage -

type StatusMetricsStub

type StatusMetricsStub struct {
	AddRequestDataCalled          func(path string, duration time.Duration, status int)
	GetAllCalled                  func() map[string]*requests.EndpointMetricsResponse
	GetMetricsForPrometheusCalled func() string
}

StatusMetricsStub -

func (*StatusMetricsStub) AddRequestData

func (s *StatusMetricsStub) AddRequestData(path string, duration time.Duration, status int)

AddRequestData -

func (*StatusMetricsStub) GetAll

GetAll -

func (*StatusMetricsStub) GetMetricsForPrometheus

func (s *StatusMetricsStub) GetMetricsForPrometheus() string

GetMetricsForPrometheus -

func (*StatusMetricsStub) IsInterfaceNil

func (s *StatusMetricsStub) IsInterfaceNil() bool

IsInterfaceNil -

type StorerMock

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

StorerMock -

func NewStorerMock

func NewStorerMock() *StorerMock

NewStorerMock -

func (*StorerMock) ClearCache

func (sm *StorerMock) ClearCache()

ClearCache -

func (*StorerMock) Close

func (sm *StorerMock) Close() error

Close -

func (*StorerMock) DestroyUnit

func (sm *StorerMock) DestroyUnit() error

DestroyUnit -

func (*StorerMock) Get

func (sm *StorerMock) Get(key []byte) ([]byte, error)

Get -

func (*StorerMock) GetBulkFromEpoch

func (sm *StorerMock) GetBulkFromEpoch(_ [][]byte, _ uint32) ([]data.KeyValuePair, error)

GetBulkFromEpoch -

func (*StorerMock) GetFromEpoch

func (sm *StorerMock) GetFromEpoch(key []byte, _ uint32) ([]byte, error)

GetFromEpoch -

func (*StorerMock) GetOldestEpoch

func (sm *StorerMock) GetOldestEpoch() (uint32, error)

GetOldestEpoch -

func (*StorerMock) Has

func (sm *StorerMock) Has(key []byte) error

Has -

func (*StorerMock) IsInterfaceNil

func (sm *StorerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*StorerMock) Put

func (sm *StorerMock) Put(key, data []byte) error

Put -

func (*StorerMock) PutInEpoch

func (sm *StorerMock) PutInEpoch(key, data []byte, _ uint32) error

PutInEpoch -

func (*StorerMock) Remove

func (sm *StorerMock) Remove(key []byte) error

Remove -

func (*StorerMock) RemoveFromCurrentEpoch

func (sm *StorerMock) RemoveFromCurrentEpoch(key []byte) error

RemoveFromCurrentEpoch -

func (*StorerMock) SearchFirst

func (sm *StorerMock) SearchFirst(_ []byte) ([]byte, error)

SearchFirst -

type StorerStub

type StorerStub struct {
	PutCalled                    func(key, data []byte) error
	PutInEpochCalled             func(key, data []byte, epoch uint32) error
	GetCalled                    func(key []byte) ([]byte, error)
	HasCalled                    func(key []byte) error
	SearchFirstCalled            func(key []byte) ([]byte, error)
	RemoveFromCurrentEpochCalled func(key []byte) error
	RemoveCalled                 func(key []byte) error
	ClearCacheCalled             func()
	DestroyUnitCalled            func() error
	GetFromEpochCalled           func(key []byte, epoch uint32) ([]byte, error)
	GetBulkFromEpochCalled       func(keys [][]byte, epoch uint32) ([]data.KeyValuePair, error)
	GetOldestEpochCalled         func() (uint32, error)
	RangeKeysCalled              func(handler func(key []byte, val []byte) bool)
	CloseCalled                  func() error
}

StorerStub -

func (*StorerStub) ClearCache

func (ss *StorerStub) ClearCache()

ClearCache -

func (*StorerStub) Close

func (ss *StorerStub) Close() error

Close -

func (*StorerStub) DestroyUnit

func (ss *StorerStub) DestroyUnit() error

DestroyUnit -

func (*StorerStub) Get

func (ss *StorerStub) Get(key []byte) ([]byte, error)

Get -

func (*StorerStub) GetBulkFromEpoch

func (ss *StorerStub) GetBulkFromEpoch(keys [][]byte, epoch uint32) ([]data.KeyValuePair, error)

GetBulkFromEpoch -

func (*StorerStub) GetFromEpoch

func (ss *StorerStub) GetFromEpoch(key []byte, epoch uint32) ([]byte, error)

GetFromEpoch -

func (*StorerStub) GetOldestEpoch

func (ss *StorerStub) GetOldestEpoch() (uint32, error)

GetOldestEpoch -

func (*StorerStub) Has

func (ss *StorerStub) Has(key []byte) error

Has -

func (*StorerStub) IsInterfaceNil

func (ss *StorerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*StorerStub) Put

func (ss *StorerStub) Put(key, data []byte) error

Put -

func (*StorerStub) PutInEpoch

func (ss *StorerStub) PutInEpoch(key, data []byte, epoch uint32) error

PutInEpoch -

func (*StorerStub) Remove

func (ss *StorerStub) Remove(key []byte) error

Remove -

func (*StorerStub) RemoveFromCurrentEpoch

func (ss *StorerStub) RemoveFromCurrentEpoch(key []byte) error

RemoveFromCurrentEpoch -

func (*StorerStub) SearchFirst

func (ss *StorerStub) SearchFirst(key []byte) ([]byte, error)

SearchFirst -

type TOTPHandlerStub

type TOTPHandlerStub struct {
	CreateTOTPCalled    func(account string) (handlers.OTP, error)
	TOTPFromBytesCalled func(encryptedMessage []byte) (handlers.OTP, error)
}

TOTPHandlerStub -

func (*TOTPHandlerStub) CreateTOTP

func (stub *TOTPHandlerStub) CreateTOTP(account string) (handlers.OTP, error)

CreateTOTP -

func (*TOTPHandlerStub) IsInterfaceNil

func (stub *TOTPHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*TOTPHandlerStub) TOTPFromBytes

func (stub *TOTPHandlerStub) TOTPFromBytes(encryptedMessage []byte) (handlers.OTP, error)

TOTPFromBytes -

type TotpStub

type TotpStub struct {
	ValidateCalled func(userCode string) error
	OTPCalled      func() (string, error)
	QRCalled       func() ([]byte, error)
	ToBytesCalled  func() ([]byte, error)
	UrlCalled      func() (string, error)
}

TotpStub -

func (*TotpStub) OTP

func (stub *TotpStub) OTP() (string, error)

OTP -

func (*TotpStub) QR

func (stub *TotpStub) QR() ([]byte, error)

QR -

func (*TotpStub) ToBytes

func (stub *TotpStub) ToBytes() ([]byte, error)

ToBytes -

func (*TotpStub) Url

func (stub *TotpStub) Url() (string, error)

Url -

func (*TotpStub) Validate

func (stub *TotpStub) Validate(userCode string) error

Validate -

type UserEncryptorStub

type UserEncryptorStub struct {
	EncryptUserInfoCalled func(userInfo *core.UserInfo) (*core.UserInfo, error)
	DecryptUserInfoCalled func(userInfo *core.UserInfo) (*core.UserInfo, error)
}

UserEncryptorStub is a stub implementation of UserEncryptor

func (*UserEncryptorStub) DecryptUserInfo

func (ues *UserEncryptorStub) DecryptUserInfo(userInfo *core.UserInfo) (*core.UserInfo, error)

DecryptUserInfo decrypts the provided user info

func (*UserEncryptorStub) EncryptUserInfo

func (ues *UserEncryptorStub) EncryptUserInfo(userInfo *core.UserInfo) (*core.UserInfo, error)

EncryptUserInfo encrypts the provided user info

func (*UserEncryptorStub) IsInterfaceNil

func (ues *UserEncryptorStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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