summaryrefslogtreecommitdiff
path: root/vendor/github.com/boombuler/barcode/qr/automatic.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-04-07 16:14:41 +0200
committerLibravatar GitHub <noreply@github.com>2025-04-07 16:14:41 +0200
commit365b5753419238bb96bc3f9b744d380ff20cbafc (patch)
tree6b8e8b605c4cddeb6e3bc0f574ffbc856657e56c /vendor/github.com/boombuler/barcode/qr/automatic.go
parent[bugfix] Don't assume `"manuallyApprovesFollowers": true` if not set (#3978) (diff)
downloadgotosocial-365b5753419238bb96bc3f9b744d380ff20cbafc.tar.xz
[feature] add TOTP two-factor authentication (2FA) (#3960)
* [feature] add TOTP two-factor authentication (2FA) * use byteutil.S2B to avoid allocations when comparing + generating password hashes * don't bother with string conversion for consts * use io.ReadFull * use MustGenerateSecret for backup codes * rename util functions
Diffstat (limited to 'vendor/github.com/boombuler/barcode/qr/automatic.go')
-rw-r--r--vendor/github.com/boombuler/barcode/qr/automatic.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/github.com/boombuler/barcode/qr/automatic.go b/vendor/github.com/boombuler/barcode/qr/automatic.go
new file mode 100644
index 000000000..e7c56013f
--- /dev/null
+++ b/vendor/github.com/boombuler/barcode/qr/automatic.go
@@ -0,0 +1,23 @@
+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)
+}