mirror of
https://github.com/H0llyW00dzZ/fiber2fa.git
synced 2025-02-06 10:24:03 +00:00
Improve [Storage] Info 2FA Manager (#93)
- [+] refactor(storage.go): make several Info struct fields optional in JSON serialization - [+] The `omitempty` JSON tag option is added to the `ContextKey`, `CookieValue`, `ExpirationTime`, `Identifier`, and `QRCodeData` fields of the `Info` struct. This allows omitting these fields from the JSON representation when their values are empty or zero.
This commit is contained in:
parent
a9ebae96de
commit
82159c8725
10
storage.go
10
storage.go
@ -28,13 +28,13 @@ type InfoManager interface {
|
||||
|
||||
// Info represents the 2FA information stored for a user.
|
||||
type Info struct {
|
||||
ContextKey string `json:"contextkey"`
|
||||
ContextKey string `json:"contextkey,omitempty"`
|
||||
Secret string `json:"secret"`
|
||||
CookieValue string `json:"cookie"`
|
||||
ExpirationTime time.Time `json:"expiration"`
|
||||
CookieValue string `json:"cookie,omitempty"`
|
||||
ExpirationTime time.Time `json:"expiration,omitempty"`
|
||||
Registered bool `json:"registered"`
|
||||
Identifier string `json:"identifier"`
|
||||
QRCodeData []byte `json:"qrcodedata"`
|
||||
Identifier string `json:"identifier,omitempty"`
|
||||
QRCodeData []byte `json:"qrcodedata,omitempty"`
|
||||
}
|
||||
|
||||
// NewInfo creates a new empty Info struct based on the provided Config.
|
||||
|
Loading…
x
Reference in New Issue
Block a user