generated from fluffy-bunny/fluffycore-grpc-starterkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
password-hasher.go
30 lines (28 loc) · 1012 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
30
package identity
import (
"context"
)
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"`
}
IsAcceptablePasswordRequest struct {
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(request *IsAcceptablePasswordRequest) error
// HashPassword hashes the password
HashPassword(ctx context.Context, request *HashPasswordRequest) (*HashPasswordResponse, error)
// VerifyPassword verifies the password
VerifyPassword(ctx context.Context, request *VerifyPasswordRequest) error
}
)