From 4368b7cd6ab81e6f98e167dfd86d0574d0eade7b Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Wed, 21 Jan 2026 19:05:36 -0800 Subject: XML!!! --- tools/auth/auth.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/auth/auth.go b/tools/auth/auth.go index 3c4f063..9b80389 100644 --- a/tools/auth/auth.go +++ b/tools/auth/auth.go @@ -2,13 +2,13 @@ package main import ( "encoding/base32" + "encoding/base64" + "encoding/xml" "flag" "fmt" "os" "github.com/skip2/go-qrcode" - "roseh.moe/pkg/ccl" - "roseh.moe/pkg/roseh.moe/internal/config" ) func run() error { @@ -20,14 +20,20 @@ func run() error { if err != nil { return err } - var config config.SecretsConfig - if err := ccl.Unmarshal(fileBytes, &config); err != nil { + var config struct { + AuthKey string `xml:",attr"` + } + if err := xml.Unmarshal(fileBytes, &config); err != nil { return err } - if len(config.AuthKey) == 0 { + if config.AuthKey == "" { return fmt.Errorf("%s: missing AuthKey", args[0]) } - qrCode, err := qrcode.New(fmt.Sprintf("otpauth://totp/roseh.moe:rose?secret=%s&issuer=roseh.moe", base32.StdEncoding.WithPadding(base32.NoPadding).EncodeToString(config.AuthKey)), qrcode.Medium) + authKey, err := base64.StdEncoding.DecodeString(config.AuthKey) + if err != nil { + return err + } + qrCode, err := qrcode.New(fmt.Sprintf("otpauth://totp/roseh.moe:rose?secret=%s&issuer=roseh.moe", base32.StdEncoding.WithPadding(base32.NoPadding).EncodeToString(authKey)), qrcode.Medium) if err != nil { return err } -- cgit v1.3.1