Documentation ¶
Index ¶
- func EqualAddresses(a, b common.Address) bool
- func ExtractWalletFromContext(ctx context.Context) (*common.Address, error)
- func NewWalletAuthenticator(c credentials.TransportCredentials, wallet common.Address) credentials.TransportCredentials
- type Addr
- type AuthOption
- type AuthRouter
- type Authorization
- type EthAuthInfo
- type Event
- type EventAuthorizationOption
- type WalletAuthenticator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EqualAddresses ¶
EqualAddresses compares the two given ETH addresses for equality.
func NewWalletAuthenticator ¶
func NewWalletAuthenticator(c credentials.TransportCredentials, wallet common.Address) credentials.TransportCredentials
Types ¶
type Addr ¶ added in v0.4.1
type Addr struct {
// contains filtered or unexported fields
}
func (Addr) MarshalText ¶ added in v0.4.1
func (*Addr) UnmarshalYAML ¶ added in v0.4.1
type AuthOption ¶
type AuthOption struct {
// contains filtered or unexported fields
}
func Allow ¶
func Allow(events ...string) AuthOption
Allow constructs an AuthOption that is used for further authorization attachment.
func (AuthOption) With ¶
func (o AuthOption) With(auth Authorization) EventAuthorizationOption
With attaches the given authorization to previously specified events.
type AuthRouter ¶
type AuthRouter struct {
// contains filtered or unexported fields
}
AuthRouter is an entry point of our gRPC authorization.
By default the router allows unregistered events, but this behavior can be changed using `DenyUnregistered` option.
func NewEventAuthorization ¶
func NewEventAuthorization(ctx context.Context, options ...EventAuthorizationOption) *AuthRouter
NewEventAuthorization constructs a new event authorization.
type Authorization ¶
func NewDenyAuthorization ¶
func NewDenyAuthorization() Authorization
NewDenyAuthorization constructs a new authorization, that will deny any incoming event.
func NewNilAuthorization ¶
func NewNilAuthorization() Authorization
NewNilAuthorization constructs a new authorization, that will allow any incoming event.
func NewTransportAuthorization ¶
func NewTransportAuthorization(ethAddr common.Address) Authorization
NewTransportAuthorization constructs an authorization that allows to call methods from the context which has required transport credentials. More precisely the caller context must have peer info with verified Ethereum address to compare with.
type EthAuthInfo ¶
type EthAuthInfo struct { TLS credentials.TLSInfo Wallet common.Address }
EthAuthInfo implements credentials.AuthInfo It provides access to a wallet of a connected user
func (EthAuthInfo) AuthType ¶
func (e EthAuthInfo) AuthType() string
AuthType implements credentials.AuthInfo interface
type EventAuthorizationOption ¶
type EventAuthorizationOption func(router *AuthRouter)
EventAuthorizationOption describes authorization option.
func WithEventPrefix ¶
func WithEventPrefix(prefix string) EventAuthorizationOption
WithEventPrefix is an option that specifies event prefix for configuration.
func WithFallback ¶
func WithFallback(auth Authorization) EventAuthorizationOption
WithFallback constructs an option to assign fallback authorization, that will act when an unregistered event comes.
func WithLog ¶
func WithLog(log *zap.Logger) EventAuthorizationOption
WithLog is an option that assigns the specified logger to be able to log some important events.
type WalletAuthenticator ¶
type WalletAuthenticator struct { credentials.TransportCredentials Wallet common.Address }
func (*WalletAuthenticator) ClientHandshake ¶
func (*WalletAuthenticator) ServerHandshake ¶
func (w *WalletAuthenticator) ServerHandshake(conn net.Conn) (net.Conn, credentials.AuthInfo, error)