Use fsx package and friends from pkglib

This commit is contained in:
Tom Wiesing 2023-04-08 17:51:17 +02:00
parent 1f8c55da7c
commit 0f6803f890
No known key found for this signature in database
35 changed files with 91 additions and 493 deletions

View file

@ -1,6 +1,7 @@
package auth
import (
"bytes"
"context"
"encoding/base64"
"fmt"
@ -14,7 +15,6 @@ import (
"github.com/pquerna/otp"
"github.com/pquerna/otp/totp"
"github.com/tkw1536/pkglib/password"
"github.com/tkw1536/pkglib/pools"
"github.com/tkw1536/pkglib/reflectx"
"golang.org/x/crypto/bcrypt"
)
@ -187,10 +187,9 @@ func TOTPLink(secret *otp.Key, width, height int) (string, error) {
}
// encode image as base64
buffer := pools.GetBuffer()
defer pools.ReleaseBuffer(buffer)
var buffer bytes.Buffer
if err := png.Encode(buffer, img); err != nil {
if err := png.Encode(&buffer, img); err != nil {
return "", err
}