github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/model/mfa_secret.go (about)

     1  // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package model
     5  
     6  import (
     7  	"encoding/json"
     8  	"io"
     9  )
    10  
    11  type MfaSecret struct {
    12  	Secret string `json:"secret"`
    13  	QRCode string `json:"qr_code"`
    14  }
    15  
    16  func (me *MfaSecret) ToJson() string {
    17  	b, _ := json.Marshal(me)
    18  	return string(b)
    19  }
    20  
    21  func MfaSecretFromJson(data io.Reader) *MfaSecret {
    22  	var me *MfaSecret
    23  	json.NewDecoder(data).Decode(&me)
    24  	return me
    25  }