generated from fluffy-bunny/fluffycore-grpc-starterkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
password-hasher.go
29 lines (26 loc) · 1017 Bytes
/
password-hasher.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package identity
import (
"context"
proto_oidc_models "github.com/fluffy-bunny/fluffycore-rage-identity/proto/oidc/models"
)
type (
HashPasswordRequest struct {
Password string `json:"password" validate:"required"`
}
HashPasswordResponse struct {
Password string `json:"password"`
HashedPassword string `json:"hashedPassword"`
}
VerifyPasswordRequest struct {
HashedPassword string `json:"hashedPassword" validate:"required"`
Password string `json:"password" validate:"required"`
}
IPasswordHasher interface {
// IsAcceptablePassword checks if the password is acceptable. i.e. not the same as the username, and meets the minimum requirements
IsAcceptablePassword(user *proto_oidc_models.RageUser, password string) error
// HashPassword hashes the password
HashPassword(ctx context.Context, request *HashPasswordRequest) (*HashPasswordResponse, error)
// VerifyPassword verifies the password
VerifyPassword(ctx context.Context, request *VerifyPasswordRequest) error
}
)