Documentation ¶
Index ¶
Constants ¶
View Source
const ChallengeCollectionName = "challenges"
View Source
const CtxClaimsKey = "claims"
View Source
const UserCollectionName = "users"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Challenge ¶
type Challenge struct { Id primitive.Id `bson:"_id,omitempty" json:"id"` CreatedAt time.Time `bson:"createdAt" json:"-"` UpdatedAt time.Time `bson:"updatedAt" json:"-"` IdentityType IdentityType `bson:"identityType" json:"identityType"` OTP string `bson:"otp" json:"-"` FailedVerificationCount int `bson:"failedVerificationCount" json:"-"` // Phone Phone Phone `bson:"phone,omitempty" json:"phone"` // Email EmailId string `bson:"emailId,omitempty" json:"emailId"` }
type ChallengeRepo ¶
type ChallengeRepo interface { repository.Creator repository.Deleter repository.Finder repository.Incrementer repository.Setter }
func NewMongoChallengeRepo ¶
func NewMongoChallengeRepo(client *mongo.Client) (ChallengeRepo, error)
type Claims ¶
type IdentityList ¶
type IdentityList []Identity
type IdentityType ¶
type IdentityType string
const ( EMAIL IdentityType = "EMAIL" PHONE IdentityType = "PHONE" )
type LoginReq ¶
type LoginReq struct { IdentityType IdentityType `json:"identityType"` EmailId string `json:"emailId"` Phone Phone `json:"phone"` Password string `json:"password"` }
type Svc ¶
type Svc interface { VerifySeedUser(ctx context.Context) error Invite(ctx context.Context, req InviteReq) (User, error) Challenge(ctx context.Context, challenge Challenge) (Challenge, error) Verify(ctx context.Context, req VerifyReq) (Session, error) UpdatePassword(ctx context.Context, userId primitive.Id, req UpdatePasswordReq) (bool, error) Login(ctx context.Context, req LoginReq) (Session, error) FindMe(ctx context.Context) (User, error) FindUser(ctx context.Context, id primitive.Id) (User, error) }
func NewService ¶
func NewService(userRepo UserRepo, challengeRepo ChallengeRepo, notificationService notification.Svc) Svc
type UpdatePasswordReq ¶
type UpdatePasswordReq struct { IdentityType IdentityType `json:"identityType"` Password string `json:"password"` }
type User ¶
type User struct { Id primitive.Id `bson:"_id,omitempty" json:"id"` Role Role `bson:"role" json:"role"` Name string `bson:"name" json:"name"` Version int `bson:"version" json:"version"` FailedAuthAttempts int `bson:"failedAuthAttempts" json:"-"` Identities IdentityList `bson:"identities" json:"identities"` Password string `bson:"password" json:"-"` }
type UserList ¶
type UserList struct { Users []User `json:"users"` Page repository.Page `json:"page"` }
type UserRepo ¶
type UserRepo interface { repository.Counter repository.Creator repository.Finder repository.Incrementer repository.Patcher repository.Setter }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.