Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
 - type Authorizer
 - type Server
 - func (s *Server) AuthorizePublicKey(ctx context.Context, req *accountpb.AuthorizePublicKeyRequest) (*accountpb.AuthorizePublicKeyResponse, error)
 - func (s *Server) GetPaymentDestination(ctx context.Context, req *accountpb.GetPaymentDestinationRequest) (*accountpb.GetPaymentDestinationResponse, error)
 - func (s *Server) GetUserFlags(ctx context.Context, req *accountpb.GetUserFlagsRequest) (*accountpb.GetUserFlagsResponse, error)
 - func (s *Server) Login(ctx context.Context, req *accountpb.LoginRequest) (*accountpb.LoginResponse, error)
 - func (s *Server) Register(ctx context.Context, req *accountpb.RegisterRequest) (*accountpb.RegisterResponse, error)
 - func (s *Server) RevokePublicKey(ctx context.Context, req *accountpb.RevokePublicKeyRequest) (*accountpb.RevokePublicKeyResponse, error)
 
- type Store
 
Constants ¶
This section is empty.
Variables ¶
      View Source
      
  
var ErrNotFound = errors.New("not found")
    Functions ¶
This section is empty.
Types ¶
type Authorizer ¶
type Authorizer struct {
	// contains filtered or unexported fields
}
    func NewAuthorizer ¶
func NewAuthorizer(log *zap.Logger, store Store, authn auth.Authenticator) *Authorizer
type Server ¶
type Server struct {
	accountpb.UnimplementedAccountServer
	// contains filtered or unexported fields
}
    func (*Server) AuthorizePublicKey ¶
func (s *Server) AuthorizePublicKey(ctx context.Context, req *accountpb.AuthorizePublicKeyRequest) (*accountpb.AuthorizePublicKeyResponse, error)
func (*Server) GetPaymentDestination ¶
func (s *Server) GetPaymentDestination(ctx context.Context, req *accountpb.GetPaymentDestinationRequest) (*accountpb.GetPaymentDestinationResponse, error)
func (*Server) GetUserFlags ¶
func (s *Server) GetUserFlags(ctx context.Context, req *accountpb.GetUserFlagsRequest) (*accountpb.GetUserFlagsResponse, error)
func (*Server) Login ¶
func (s *Server) Login(ctx context.Context, req *accountpb.LoginRequest) (*accountpb.LoginResponse, error)
func (*Server) Register ¶
func (s *Server) Register(ctx context.Context, req *accountpb.RegisterRequest) (*accountpb.RegisterResponse, error)
func (*Server) RevokePublicKey ¶
func (s *Server) RevokePublicKey(ctx context.Context, req *accountpb.RevokePublicKeyRequest) (*accountpb.RevokePublicKeyResponse, error)
type Store ¶
type Store interface {
	// Bind binds a public key to a UserId, or returns the previously bound UserId.
	Bind(ctx context.Context, userID *commonpb.UserId, pubKey *commonpb.PublicKey) (*commonpb.UserId, error)
	// GetUserId returns the UserId associated with a public key.
	//
	/// ErrNotFound is returned if no binding exists.
	GetUserId(ctx context.Context, pubKey *commonpb.PublicKey) (*commonpb.UserId, error)
	// GetPubKeys returns the set of public keys associated with an account.
	GetPubKeys(ctx context.Context, userID *commonpb.UserId) ([]*commonpb.PublicKey, error)
	// RemoveKey removes a key from the set of user keys.
	//
	// It is idempotent, and does not return an error if the user does not exist.
	RemoveKey(ctx context.Context, userID *commonpb.UserId, pubKey *commonpb.PublicKey) error
	// IsAuthorized returns whether or not a pubKey is authorized to perform actions on behalf of the user.
	IsAuthorized(ctx context.Context, userID *commonpb.UserId, pubKey *commonpb.PublicKey) (bool, error)
	// IsStaff returns whether or not a userID is a staff user
	IsStaff(ctx context.Context, userID *commonpb.UserId) (bool, error)
	// IsRegistered returns whether or not a userID is a registered account
	IsRegistered(ctx context.Context, userID *commonpb.UserId) (bool, error)
	// SetRegistrationFlag sets wether a userID is a registered account
	SetRegistrationFlag(ctx context.Context, userID *commonpb.UserId, isRegistered bool) error
	// ExtendAirdropEligibility extends airdrop eligibility for a user until the
	// specified time
	ExtendAirdropEligibility(ctx context.Context, userID *commonpb.UserId, until time.Time) error
	// GetAirdropEligibilityTimestamp gets the airdrop eligibility timestamp for a user
	GetAirdropEligibilityTimestamp(ctx context.Context, userID *commonpb.UserId) (time.Time, error)
}
     Click to show internal directories. 
   Click to hide internal directories.