17 lines
272 B
Go
Raw Normal View History

package lib
2023-09-09 22:52:50 +02:00
2023-09-09 22:52:51 +02:00
import (
"encoding/base64"
"github.com/skip2/go-qrcode"
)
func ToQR(s string) (string, error) {
png, err := qrcode.Encode(s, qrcode.Medium, 256)
if err != nil {
return "", err
}
qr := base64.StdEncoding.EncodeToString([]byte(png))
return qr, nil
}