commit 357ca2840e355b48c98bc8cc4fd4cbec25dcf845
parent 11352691609e31dd99dce6ac604ad09824d11935
Author: Sean Enck <sean@ttypty.com>
Date: Sun, 2 Oct 2022 12:07:04 -0400
support putting the otp value into a kdbx file format
Diffstat:
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
@@ -90,7 +90,7 @@ lb totp -clip token
## git integration
-To manage the `.lb` files in a git repository and see _actual_ text diffs add this to a `.gitconfig`
+To manage the `.kdbx` file in a git repository and see _actual_ text diffs add this to a `.gitconfig`
```
[diff "lb"]
textconv = lb hash
diff --git a/internal/backend/actions.go b/internal/backend/actions.go
@@ -3,12 +3,12 @@ package backend
import (
"errors"
+ "fmt"
"os"
"path/filepath"
"strings"
"github.com/enckse/lockbox/internal/inputs"
- otp "github.com/pquerna/otp/totp"
"github.com/tobischo/gokeepasslib/v3"
"github.com/tobischo/gokeepasslib/v3/wrappers"
)
@@ -190,11 +190,8 @@ func (t *Transaction) Move(src QueryEntity, dst string) error {
field = notesKey
}
if NewSuffix(dTitle) == NewSuffix(inputs.TOTPToken()) {
- token, err := otp.Generate(otp.GenerateOpts{Issuer: titleKey, AccountName: dTitle})
- if err != nil {
- return err
- }
- e.Values = append(e.Values, protectedValue("otp", token.URL()))
+ url := fmt.Sprintf("otpauth://totp/totp:none?secret=%s&period=30&digits=6&issuer=lb", src.Value)
+ e.Values = append(e.Values, protectedValue("otp", url))
}
e.Values = append(e.Values, protectedValue(field, src.Value))