Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator - A struct for checking user signatures
func CreateAuthenticator ¶
func CreateAuthenticator(address common.Address) (*Authenticator, error)
CreateAuthenticator - Create `Authenticator` instance Arguments:
address - Address for the underlying asset
func (*Authenticator) Sign ¶
func (auth *Authenticator) Sign(msg []byte, privateKey string) (string, error)
Sign - Function to sign with private key Arguments:
msg - The message that should be sent privateKey - Private key for the user. Must be related to the public key
func (*Authenticator) ValidAddress ¶
func (auth *Authenticator) ValidAddress() bool
ValidAddress - Checks if an address is valid
func (*Authenticator) Verify ¶
func (auth *Authenticator) Verify(sigHex string, msg []byte) bool
Verify - Function to verify a signature Arguments:
sigHex - Signature to be verified msg - The message that should be sent
Notes:
Taken from https://gist.github.com/dcb9/385631846097e1f59e3cba3b1d42f3ed#file-eth_sign_verify-go
type KeyStore ¶
type KeyStore struct {
// contains filtered or unexported fields
}
KeyStore - Inherits the `api.KeyStore` interface
func CreateKeyStore ¶
CreateKeyStore - Create KeyStore instance
type Message ¶
type Message struct { Method string `json:"method"` RequestPath string `json:"requestPath"` Body string `json:"body"` Timestamp int64 `json:"timestamp"` }
Message - A struct for sending a signed message
type RateLimitManager ¶
type RateLimitManager struct {
// contains filtered or unexported fields
}
RateLimitManager - Customized limit for each IP address Parameters:
visitors (map) - Map from ip address string to limiter mu (Mutex) - for locking and unlocking
https://www.alexedwards.net/blog/how-to-rate-limit-http-requests
func CreateRateLimitManager ¶
func CreateRateLimitManager(maxPerSec int, burst int) (*RateLimitManager, error)
CreateRateLimitManager - Create a new rate manager Arguments:
maxPerSec (int) - Allowed rate from IP address burst (int) - Allowed maximum burst rate
func (*RateLimitManager) GetVisitor ¶
func (manager *RateLimitManager) GetVisitor(ip string) *rate.Limiter
GetVisitor - Retrieve and return the rate limiter for the current visitor if it already exists. Otherwise create a new rate limiter and add it to the visitors map, using the IP address as the key