mirror of
https://github.com/photoprism/photoprism.git
synced 2025-10-05 16:57:17 +08:00
34 lines
899 B
Go
34 lines
899 B
Go
package entity
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
|
|
"github.com/photoprism/photoprism/pkg/media"
|
|
)
|
|
|
|
// MarshalJSON returns the JSON encoding.
|
|
func (m *Passcode) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(&struct {
|
|
UID string `json:"UID"`
|
|
Type string `json:"Type"`
|
|
Secret string `json:"Secret"`
|
|
QRCode string `json:"QRCode"`
|
|
RecoveryCode string `json:"RecoveryCode"`
|
|
CreatedAt time.Time `json:"CreatedAt"`
|
|
UpdatedAt time.Time `json:"UpdatedAt"`
|
|
VerifiedAt *time.Time `json:"VerifiedAt"`
|
|
ActivatedAt *time.Time `json:"ActivatedAt"`
|
|
}{
|
|
UID: m.UID,
|
|
Type: m.KeyType,
|
|
Secret: m.Secret(),
|
|
QRCode: media.Base64(m.Png(350)),
|
|
RecoveryCode: m.RecoveryCode,
|
|
CreatedAt: m.CreatedAt,
|
|
UpdatedAt: m.UpdatedAt,
|
|
VerifiedAt: m.VerifiedAt,
|
|
ActivatedAt: m.ActivatedAt,
|
|
})
|
|
}
|