Documentation ¶
Index ¶
- Constants
- Variables
- func NewGuardianKeyGenerator(args ArgGuardianKeyGenerator) (*guardianKeyGenerator, error)
- func NewHttpClientWrapper(httpClient HttpClient) (*httpClientWrapper, error)
- type ArgGuardianKeyGenerator
- type BucketIDProvider
- type CryptoComponentsHolderFactory
- type DBType
- type GuardedTxBuilder
- type GuardianInfo
- func (*GuardianInfo) Descriptor() ([]byte, []int)
- func (this *GuardianInfo) Equal(that interface{}) bool
- func (m *GuardianInfo) GetOTPData() OTPInfo
- func (m *GuardianInfo) GetPrivateKey() []byte
- func (m *GuardianInfo) GetPublicKey() []byte
- func (m *GuardianInfo) GetState() GuardianState
- func (this *GuardianInfo) GoString() string
- func (m *GuardianInfo) Marshal() (dAtA []byte, err error)
- func (m *GuardianInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *GuardianInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GuardianInfo) ProtoMessage()
- func (m *GuardianInfo) Reset()
- func (m *GuardianInfo) Size() (n int)
- func (this *GuardianInfo) String() string
- func (m *GuardianInfo) Unmarshal(dAtA []byte) error
- func (m *GuardianInfo) XXX_DiscardUnknown()
- func (m *GuardianInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GuardianInfo) XXX_Merge(src proto.Message)
- func (m *GuardianInfo) XXX_Size() int
- func (m *GuardianInfo) XXX_Unmarshal(b []byte) error
- type GuardianState
- type HttpClient
- type HttpClientWrapper
- type IndexHandler
- type KeyGenerator
- type KeysGenerator
- type Marshaller
- type NativeAuthWhitelistHandler
- type OTPInfo
- func (*OTPInfo) Descriptor() ([]byte, []int)
- func (this *OTPInfo) Equal(that interface{}) bool
- func (m *OTPInfo) GetLastTOTPChangeTimestamp() int64
- func (m *OTPInfo) GetOTP() []byte
- func (this *OTPInfo) GoString() string
- func (m *OTPInfo) Marshal() (dAtA []byte, err error)
- func (m *OTPInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *OTPInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*OTPInfo) ProtoMessage()
- func (m *OTPInfo) Reset()
- func (m *OTPInfo) Size() (n int)
- func (this *OTPInfo) String() string
- func (m *OTPInfo) Unmarshal(dAtA []byte) error
- func (m *OTPInfo) XXX_DiscardUnknown()
- func (m *OTPInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *OTPInfo) XXX_Merge(src proto.Message)
- func (m *OTPInfo) XXX_Size() int
- func (m *OTPInfo) XXX_Unmarshal(b []byte) error
- type OnChainGuardianState
- type PubkeyConverter
- type RedisConnType
- type ServiceResolver
- type StatusMetricsHandler
- type StorageWithIndex
- type Storer
- type TcsConfig
- type UserInfo
- func (*UserInfo) Descriptor() ([]byte, []int)
- func (this *UserInfo) Equal(that interface{}) bool
- func (m *UserInfo) GetFirstGuardian() GuardianInfo
- func (m *UserInfo) GetIndex() uint32
- func (m *UserInfo) GetSecondGuardian() GuardianInfo
- func (this *UserInfo) GoString() string
- func (m *UserInfo) Marshal() (dAtA []byte, err error)
- func (m *UserInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *UserInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*UserInfo) ProtoMessage()
- func (m *UserInfo) Reset()
- func (m *UserInfo) Size() (n int)
- func (this *UserInfo) String() string
- func (m *UserInfo) Unmarshal(dAtA []byte) error
- func (m *UserInfo) XXX_DiscardUnknown()
- func (m *UserInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UserInfo) XXX_Merge(src proto.Message)
- func (m *UserInfo) XXX_Size() int
- func (m *UserInfo) XXX_Unmarshal(b []byte) error
Constants ¶
const NoExpiryValue = -1
NoExpiryValue is the returned value for a persistent key expiry time
const WebServerOffString = "off"
WebServerOffString represents the constant used to switch off the web server
Variables ¶
var ( ErrInvalidLengthUserInfo = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowUserInfo = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupUserInfo = fmt.Errorf("proto: unexpected end of group") )
var ErrEmptyData = errors.New("empty data")
ErrEmptyData signals that empty data was received
var ErrInvalidBucketHandlers = errors.New("invalid bucket handlers")
ErrInvalidBucketHandlers signals than an invalid bucket handlers was provided
var ErrInvalidBucketID = errors.New("invalid bucket id")
ErrInvalidBucketID signals that an invalid bucket id was provided
var ErrInvalidNumberOfBuckets = errors.New("invalid number of buckets")
ErrInvalidNumberOfBuckets signals that an invalid number of buckets was provided
var ErrInvalidPubkeyConverterType = errors.New("invalid pubkey converter type")
ErrInvalidPubkeyConverterType signals that the provided pubkey converter type is invalid
var ErrInvalidRedisConnType = errors.New("invalid redis connection type")
ErrInvalidRedisConnType signals that an invalid redis connection type has been provided
var ErrInvalidValue = errors.New("invalid value")
ErrInvalidValue signals that an invalid value was provided
var ErrNilBucket = errors.New("nil bucket")
ErrNilBucket signals that a nil bucket has been provided
var ErrNilBucketHandler = errors.New("nil bucket handler")
ErrNilBucketHandler signals that a nil bucket handler was provided
var ErrNilBucketIDProvider = errors.New("nil bucket id provider")
ErrNilBucketIDProvider signals that a nil bucket id provider was provided
var ErrNilFacadeHandler = errors.New("nil facade handler")
ErrNilFacadeHandler signals that a nil facade handler has been provided
var ErrNilHttpClient = errors.New("nil http client")
ErrNilHttpClient signals that a nil http client has been provided
var ErrNilKeyGenerator = errors.New("nil key generator")
ErrNilKeyGenerator signals that a nil key generator was provided
var ErrNilMetricsHandler = errors.New("nil metrics handler")
ErrNilMetricsHandler signals that a nil metrics handler has been provided
var ErrNilMongoDBClient = errors.New("nil mongodb client")
ErrNilMongoDBClient signals that a nil mongodb client has been provided
var ErrTooManyFailedAttempts = errors.New("too many failed attempts")
ErrTooManyFailedAttempts signals that too many failed attempts were made
var GuardianState_name = map[int32]string{
0: "NotUsable",
1: "Usable",
}
var GuardianState_value = map[string]int32{
"NotUsable": 0,
"Usable": 1,
}
Functions ¶
func NewGuardianKeyGenerator ¶
func NewGuardianKeyGenerator(args ArgGuardianKeyGenerator) (*guardianKeyGenerator, error)
NewGuardianKeyGenerator returns a new instance of guardian key generator
func NewHttpClientWrapper ¶
func NewHttpClientWrapper(httpClient HttpClient) (*httpClientWrapper, error)
NewHttpClientWrapper returns a new instance of httpClientWrapper
Types ¶
type ArgGuardianKeyGenerator ¶
type ArgGuardianKeyGenerator struct { Mnemonic data.Mnemonic KeyGen crypto.KeyGenerator }
ArgGuardianKeyGenerator is the DTO used to create a new instance of guardian key generator
type BucketIDProvider ¶
type BucketIDProvider interface { GetBucketForAddress(address []byte) uint32 IsInterfaceNil() bool }
BucketIDProvider defines the methods for a component able to extract a bucket id from an address
type CryptoComponentsHolderFactory ¶
type CryptoComponentsHolderFactory struct {
// contains filtered or unexported fields
}
CryptoComponentsHolderFactory is the implementation of the CryptoComponentsHolderFactory interface
func NewCryptoComponentsHolderFactory ¶
func NewCryptoComponentsHolderFactory(keyGen crypto.KeyGenerator) (*CryptoComponentsHolderFactory, error)
NewCryptoComponentsHolderFactory creates a new instance of CryptoComponentsHolderFactory
func (*CryptoComponentsHolderFactory) Create ¶
func (f *CryptoComponentsHolderFactory) Create(skBytes []byte) (core.CryptoComponentsHolder, error)
Create creates a new instance of CryptoComponentsHolder
func (*CryptoComponentsHolderFactory) IsInterfaceNil ¶
func (f *CryptoComponentsHolderFactory) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
type DBType ¶
type DBType string
DBType represents the type of DB
const LevelDB DBType = "levelDB"
LevelDB is the local levelDB
const MongoDB DBType = "mongoDB"
MongoDB is the mongo db identifier
type GuardedTxBuilder ¶
type GuardedTxBuilder interface { ApplyGuardianSignature(cryptoHolderGuardian core.CryptoComponentsHolder, tx *transaction.FrontendTransaction) error IsInterfaceNil() bool }
GuardedTxBuilder defines the component able to build and sign a guarded transaction
type GuardianInfo ¶
type GuardianInfo struct { PublicKey []byte `protobuf:"bytes,1,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` PrivateKey []byte `protobuf:"bytes,2,opt,name=PrivateKey,proto3" json:"PrivateKey,omitempty"` State GuardianState `protobuf:"varint,3,opt,name=State,proto3,enum=proto.GuardianState" json:"State,omitempty"` OTPData OTPInfo `protobuf:"bytes,4,opt,name=OTPData,proto3" json:"OTPData"` }
GuardianInfo holds details about a guardian
func (*GuardianInfo) Descriptor ¶
func (*GuardianInfo) Descriptor() ([]byte, []int)
func (*GuardianInfo) Equal ¶
func (this *GuardianInfo) Equal(that interface{}) bool
func (*GuardianInfo) GetOTPData ¶
func (m *GuardianInfo) GetOTPData() OTPInfo
func (*GuardianInfo) GetPrivateKey ¶
func (m *GuardianInfo) GetPrivateKey() []byte
func (*GuardianInfo) GetPublicKey ¶
func (m *GuardianInfo) GetPublicKey() []byte
func (*GuardianInfo) GetState ¶
func (m *GuardianInfo) GetState() GuardianState
func (*GuardianInfo) GoString ¶
func (this *GuardianInfo) GoString() string
func (*GuardianInfo) Marshal ¶
func (m *GuardianInfo) Marshal() (dAtA []byte, err error)
func (*GuardianInfo) MarshalToSizedBuffer ¶
func (m *GuardianInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GuardianInfo) ProtoMessage ¶
func (*GuardianInfo) ProtoMessage()
func (*GuardianInfo) Reset ¶
func (m *GuardianInfo) Reset()
func (*GuardianInfo) Size ¶
func (m *GuardianInfo) Size() (n int)
func (*GuardianInfo) String ¶
func (this *GuardianInfo) String() string
func (*GuardianInfo) Unmarshal ¶
func (m *GuardianInfo) Unmarshal(dAtA []byte) error
func (*GuardianInfo) XXX_DiscardUnknown ¶
func (m *GuardianInfo) XXX_DiscardUnknown()
func (*GuardianInfo) XXX_Marshal ¶
func (m *GuardianInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GuardianInfo) XXX_Merge ¶
func (m *GuardianInfo) XXX_Merge(src proto.Message)
func (*GuardianInfo) XXX_Size ¶
func (m *GuardianInfo) XXX_Size() int
func (*GuardianInfo) XXX_Unmarshal ¶
func (m *GuardianInfo) XXX_Unmarshal(b []byte) error
type GuardianState ¶
type GuardianState int32
GuardianState represents the state of the guardian
const ( // NotUsable represents a guardian recently generated but not verified NotUsable GuardianState = 0 // Usable represents a verified guardian Usable GuardianState = 1 )
func (GuardianState) EnumDescriptor ¶
func (GuardianState) EnumDescriptor() ([]byte, []int)
func (GuardianState) String ¶
func (x GuardianState) String() string
type HttpClient ¶
type HttpClient interface { GetHTTP(ctx context.Context, endpoint string) ([]byte, int, error) IsInterfaceNil() bool }
HttpClient defines the behavior of http client able to make http requests
type HttpClientWrapper ¶
type HttpClientWrapper interface { GetAccount(ctx context.Context, address string) (*data.Account, error) GetGuardianData(ctx context.Context, address string) (*api.GuardianData, error) IsInterfaceNil() bool }
HttpClientWrapper defines the behavior of wrapper over HttpClient
type IndexHandler ¶
type IndexHandler interface { Put(key, data []byte) error Get(key []byte) ([]byte, error) Has(key []byte) error Close() error AllocateBucketIndex() (uint32, error) GetLastIndex() (uint32, error) IsInterfaceNil() bool }
IndexHandler defines the methods for a component which handles indexes
type KeyGenerator ¶
type KeyGenerator interface { PrivateKeyFromByteArray(b []byte) (crypto.PrivateKey, error) IsInterfaceNil() bool }
KeyGenerator defines the methods for a component able to create a crypto.PrivateKey from a byte array
type KeysGenerator ¶
type KeysGenerator interface { GenerateManagedKey() (crypto.PrivateKey, error) GenerateKeys(index uint32) ([]crypto.PrivateKey, error) IsInterfaceNil() bool }
KeysGenerator defines the methods for a component able to generate unique HD keys
type Marshaller ¶
type Marshaller interface { Marshal(obj interface{}) ([]byte, error) Unmarshal(obj interface{}, buff []byte) error IsInterfaceNil() bool }
Marshaller defines the 2 basic operations: serialize (marshal) and deserialize (unmarshal)
type NativeAuthWhitelistHandler ¶
type NativeAuthWhitelistHandler interface { IsWhitelisted(route string) bool IsInterfaceNil() bool }
NativeAuthWhitelistHandler defines the behavior of a component that handles whitelisted routes
type OTPInfo ¶
type OTPInfo struct { OTP []byte `protobuf:"bytes,1,opt,name=OTP,proto3" json:"OTP,omitempty"` LastTOTPChangeTimestamp int64 `protobuf:"varint,2,opt,name=LastTOTPChangeTimestamp,proto3" json:"LastTOTPChangeTimestamp,omitempty"` }
OTPInfo holds the encrypted otp along with its last update timestamp
func (*OTPInfo) Descriptor ¶
func (*OTPInfo) GetLastTOTPChangeTimestamp ¶
func (*OTPInfo) MarshalToSizedBuffer ¶
func (*OTPInfo) ProtoMessage ¶
func (*OTPInfo) ProtoMessage()
func (*OTPInfo) XXX_DiscardUnknown ¶
func (m *OTPInfo) XXX_DiscardUnknown()
func (*OTPInfo) XXX_Marshal ¶
func (*OTPInfo) XXX_Unmarshal ¶
type OnChainGuardianState ¶
type OnChainGuardianState uint32
OnChainGuardianState represents the on chain state of the guardian
const ( // ActiveGuardian represents an active guardian on chain ActiveGuardian OnChainGuardianState = iota // PendingGuardian represents a pending guardian on chain PendingGuardian // MissingGuardian represents a guardian missing from chain MissingGuardian )
type PubkeyConverter ¶
type PubkeyConverter interface { Len() int Decode(humanReadable string) ([]byte, error) Encode(pkBytes []byte) (string, error) SilentEncode(pkBytes []byte, log chainCore.Logger) string EncodeSlice(pkBytesSlice [][]byte) ([]string, error) IsInterfaceNil() bool }
PubkeyConverter can convert public key bytes from a human-readable form
type RedisConnType ¶
type RedisConnType string
RedisConnType defines the redis connection type
const ( // RedisInstanceConnType specifies a redis connection to a single instance RedisInstanceConnType RedisConnType = "instance" // RedisSentinelConnType specifies a redis connection to a setup with sentinel RedisSentinelConnType RedisConnType = "sentinel" )
type ServiceResolver ¶
type ServiceResolver interface { RegisterUser(userAddress core.AddressHandler, request requests.RegistrationPayload) (*requests.OTP, string, error) VerifyCode(userAddress core.AddressHandler, userIp string, request requests.VerificationPayload) (*requests.OTPCodeVerifyData, error) SignMessage(userIp string, request requests.SignMessage) ([]byte, *requests.OTPCodeVerifyData, error) SetSecurityModeNoExpire(userIp string, request requests.SecurityModeNoExpire) (*requests.OTPCodeVerifyData, error) UnsetSecurityModeNoExpire(userIp string, request requests.SecurityModeNoExpire) (*requests.OTPCodeVerifyData, error) SignTransaction(userIp string, request requests.SignTransaction) ([]byte, *requests.OTPCodeVerifyData, error) SignMultipleTransactions(userIp string, request requests.SignMultipleTransactions) ([][]byte, *requests.OTPCodeVerifyData, error) RegisteredUsers() (uint32, error) TcsConfig() *TcsConfig IsInterfaceNil() bool }
ServiceResolver defines the methods available for a service
type StatusMetricsHandler ¶
type StatusMetricsHandler interface { AddRequestData(path string, duration time.Duration, status int) GetAll() map[string]*requests.EndpointMetricsResponse GetMetricsForPrometheus() string IsInterfaceNil() bool }
StatusMetricsHandler defines the behavior of a component that handles status metrics
type StorageWithIndex ¶
type StorageWithIndex interface { AllocateIndex(address []byte) (uint32, error) Put(key, data []byte) error Get(key []byte) ([]byte, error) Has(key []byte) error Close() error Count() (uint32, error) IsInterfaceNil() bool }
StorageWithIndex defines the methods for a component that holds multiple BucketIndexHandler
type Storer ¶
type Storer interface { Put(key, data []byte) error Get(key []byte) ([]byte, error) Has(key []byte) error SearchFirst(key []byte) ([]byte, error) Remove(key []byte) error ClearCache() Close() error IsInterfaceNil() bool }
Storer provides storage services in a two layered storage construct, where the first layer is represented by a cache and second layer by a persistent storage (DB-like)
type UserInfo ¶
type UserInfo struct { Index uint32 `protobuf:"varint,1,opt,name=Index,proto3" json:"Index,omitempty"` FirstGuardian GuardianInfo `protobuf:"bytes,2,opt,name=FirstGuardian,proto3" json:"FirstGuardian"` SecondGuardian GuardianInfo `protobuf:"bytes,3,opt,name=SecondGuardian,proto3" json:"SecondGuardian"` }
UserInfo holds info about both user's guardians and its unique index
func (*UserInfo) Descriptor ¶
func (*UserInfo) GetFirstGuardian ¶
func (m *UserInfo) GetFirstGuardian() GuardianInfo
func (*UserInfo) GetSecondGuardian ¶
func (m *UserInfo) GetSecondGuardian() GuardianInfo
func (*UserInfo) MarshalToSizedBuffer ¶
func (*UserInfo) ProtoMessage ¶
func (*UserInfo) ProtoMessage()
func (*UserInfo) XXX_DiscardUnknown ¶
func (m *UserInfo) XXX_DiscardUnknown()