Skip to content

Commit

Permalink
fix: remove TOTP field for phone enroll response (#1717)
Browse files Browse the repository at this point in the history
## What kind of change does this PR introduce?

Make TOTPObject a pointer so that it is not returned in the case of an
`EnrollResponse` for phone
  • Loading branch information
J0 authored Aug 9, 2024
1 parent b9bc769 commit 4b04327
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/api/mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ type TOTPObject struct {
}

type EnrollFactorResponse struct {
ID uuid.UUID `json:"id"`
Type string `json:"type"`
FriendlyName string `json:"friendly_name"`
TOTP TOTPObject `json:"totp,omitempty"`
Phone string `json:"phone,omitempty"`
ID uuid.UUID `json:"id"`
Type string `json:"type"`
FriendlyName string `json:"friendly_name"`
TOTP *TOTPObject `json:"totp,omitempty"`
Phone string `json:"phone,omitempty"`
}

type ChallengeFactorParams struct {
Expand Down Expand Up @@ -246,7 +246,7 @@ func (a *API) enrollTOTPFactor(w http.ResponseWriter, r *http.Request, params *E
ID: factor.ID,
Type: models.TOTP,
FriendlyName: factor.FriendlyName,
TOTP: TOTPObject{
TOTP: &TOTPObject{
// See: https://css-tricks.com/probably-dont-base64-svg/
QRCode: buf.String(),
Secret: key.Secret(),
Expand Down

0 comments on commit 4b04327

Please sign in to comment.