1
0
Fork 0
mirror of https://github.com/Luzifer/vault-totp.git synced 2024-12-24 06:41:20 +00:00
vault-totp/vendor/github.com/boombuler/barcode/qr/automatic.go

24 lines
573 B
Go
Raw Normal View History

2017-01-03 12:31:39 +00:00
package qr
import (
"fmt"
"github.com/boombuler/barcode/utils"
)
func encodeAuto(content string, ecl ErrorCorrectionLevel) (*utils.BitList, *versionInfo, error) {
bits, vi, _ := Numeric.getEncoder()(content, ecl)
if bits != nil && vi != nil {
return bits, vi, nil
}
bits, vi, _ = AlphaNumeric.getEncoder()(content, ecl)
if bits != nil && vi != nil {
return bits, vi, nil
}
bits, vi, _ = Unicode.getEncoder()(content, ecl)
if bits != nil && vi != nil {
return bits, vi, nil
}
return nil, nil, fmt.Errorf("No encoding found to encode \"%s\"", content)
}