You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
683 B

package main
import (
"fmt"
"io/ioutil"
"github.com/Baozisoftware/qrcode-terminal-go"
"encoding/json"
b64 "encoding/base64"
)
type certificates struct {
Cert string `json:"c"`
Macaroon string `json:"m"`
}
func main() {
loadedConfig, _ := loadConfig()
certBytes, err := ioutil.ReadFile(loadedConfig.TLSCertPath)
if err != nil {
fmt.Print(err)
}
macBytes, err := ioutil.ReadFile(loadedConfig.AdminMacPath)
if err != nil {
fmt.Print(err)
}
sEnc := b64.StdEncoding.EncodeToString([]byte(macBytes))
cert := &certificates{
Cert: string(certBytes),
Macaroon: sEnc}
certB, _ := json.Marshal(cert)
obj := qrcodeTerminal.New()
obj.Get(string(certB)).Print()
}