Skip to content

Commit

Permalink
Merge pull request #241 from getAlby/argon2
Browse files Browse the repository at this point in the history
Argon2 key derivation
  • Loading branch information
rolznz authored Feb 1, 2024
2 parents d121ac3 + 88b121d commit 5049517
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 2 additions & 5 deletions aesgcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"encoding/hex"
"strings"

"golang.org/x/crypto/scrypt"
"golang.org/x/crypto/argon2"
)

func DeriveKey(password string, salt []byte) ([]byte, []byte, error) {
Expand All @@ -18,10 +18,7 @@ func DeriveKey(password string, salt []byte) ([]byte, []byte, error) {
}
}

key, err := scrypt.Key([]byte(password), salt, 131072, 8, 1, 32)
if err != nil {
return nil, nil, err
}
key := argon2.Key([]byte(password), salt, 3, 32*1024, 1, 32)

return key, salt, nil
}
Expand Down
4 changes: 4 additions & 0 deletions breez.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ func (bs *BreezService) LookupInvoice(ctx context.Context, senderPubkey string,
func (bs *BreezService) ListTransactions(ctx context.Context, senderPubkey string, from, until, limit, offset uint64, unpaid bool, invoiceType string) (transactions []Nip47Transaction, err error) {

request := breez_sdk.ListPaymentsRequest{}
if limit == 0 {
// make sure a sensible limit is passed
limit = 100
}
if limit > 0 {
limit32 := uint32(limit)
request.Limit = &limit32
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type AppConfig struct {
LNDMacaroonFile string `envconfig:"LND_MACAROON_FILE"`
Workdir string `envconfig:"WORK_DIR" default:".data"`
Port string `envconfig:"PORT" default:"8080"`
DatabaseUri string `envconfig:"DATABASE_URI" default:"nostr-wallet-connect.db"`
DatabaseUri string `envconfig:"DATABASE_URI" default:".data/nwc.db"`
CookieSecret string `envconfig:"COOKIE_SECRET"`
}

Expand Down

0 comments on commit 5049517

Please sign in to comment.