Skip to content

Invalid QR Code when secret_key is already existing #103

Open
@GeorgeMonroyo

Description

@GeorgeMonroyo

When we provide a secret_key, example coming from a database and generate the OTP, using the code below, the URL generated is encoded version of the secret key and thus validate will fail because the secret key stored in the authenticator is encoded value of the secret key

key, err := totp.Generate(totp.GenerateOpts{
Issuer: "Issuer",
AccountName: username,
Secret: []byte(user.SecretKey),
})

var buf bytes.Buffer
img, err := key.Image(200, 200)
if err != nil {
panic(err)
}
png.Encode(&buf, img)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions