Documentation
¶
Index ¶
- Variables
- func BuildJWTString(secretKey, userID string) (string, error)
- func Decrypt(secretKey string, data []byte) ([]byte, error)
- func Encrypt(secretKey string, data []byte) ([]byte, error)
- type Claims
- type Service
- func (s *Service) AuthUser(ctx context.Context, in model.UserCredentials) (string, error)
- func (s *Service) GetData(ctx context.Context, id string) (*pb.GetResponse, error)
- func (s *Service) GetUserData(ctx context.Context) (*pb.GetManyResponse, error)
- func (s *Service) GetUserID(tokenString, secretKey string) string
- func (s *Service) RegisterUser(ctx context.Context, in model.UserCredentials) (string, error)
- func (s *Service) SaveData(ctx context.Context, in *pb.SaveRequest) (string, error)
- func (s *Service) SaveMeta(ctx context.Context, metadata model.Save) (string, error)
- type StoreI
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidPassword = errors.New("invalid login and(or) password") ErrUnsupportedType = errors.New("unsupported type") )
Functions ¶
func BuildJWTString ¶
BuildJWTString generates a JWT token.
Types ¶
type Claims ¶
type Claims struct { jwt.RegisteredClaims UserID string }
Claims represents the claims for a JWT token.
type Service ¶
func (*Service) GetUserData ¶
GetUserData retrieves all user data. The method could be used for synchronize purposes.
func (*Service) RegisterUser ¶
RegisterUser encrypts password, saves user login and password into database.
type StoreI ¶
type StoreI interface { Register(ctx context.Context, in model.UserCredentials) (model.UserID, error) GetUser(ctx context.Context, login string) (*storage.UserEntity, error) Save(ctx context.Context, data model.Save) (string, error) Get(ctx context.Context, id string) (*storage.MetadataEntity, error) GetMany(ctx context.Context) ([]*storage.MetadataEntity, error) }
Click to show internal directories.
Click to hide internal directories.