summaryrefslogtreecommitdiffstats
path: root/model/mfa_secret.go
blob: 23a903c892d21928f2fc845125d82667e5d53d6f (plain)
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
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

package model

import (
	"encoding/json"
	"io"
)

type MfaSecret struct {
	Secret string `json:"secret"`
	QRCode string `json:"qr_code"`
}

func (me *MfaSecret) ToJson() string {
	b, _ := json.Marshal(me)
	return string(b)
}

func MfaSecretFromJson(data io.Reader) *MfaSecret {
	var me *MfaSecret
	json.NewDecoder(data).Decode(&me)
	return me
}