mirror of
https://github.com/fiatjaf/nak.git
synced 2025-12-08 16:48:51 +00:00
fix bunker client key variable.
This commit is contained in:
@@ -56,8 +56,6 @@ func gatherKeyerFromArguments(ctx context.Context, c *cli.Command) (nostr.Keyer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func gatherSecretKeyOrBunkerFromArguments(ctx context.Context, c *cli.Command) (nostr.SecretKey, *nip46.BunkerClient, error) {
|
func gatherSecretKeyOrBunkerFromArguments(ctx context.Context, c *cli.Command) (nostr.SecretKey, *nip46.BunkerClient, error) {
|
||||||
var err error
|
|
||||||
|
|
||||||
sec := c.String("sec")
|
sec := c.String("sec")
|
||||||
if strings.HasPrefix(sec, "bunker://") {
|
if strings.HasPrefix(sec, "bunker://") {
|
||||||
// it's a bunker
|
// it's a bunker
|
||||||
@@ -66,7 +64,11 @@ func gatherSecretKeyOrBunkerFromArguments(ctx context.Context, c *cli.Command) (
|
|||||||
var clientKey nostr.SecretKey
|
var clientKey nostr.SecretKey
|
||||||
|
|
||||||
if clientKeyHex != "" {
|
if clientKeyHex != "" {
|
||||||
clientKey, err = nostr.SecretKeyFromHex(sec)
|
var err error
|
||||||
|
clientKey, err = nostr.SecretKeyFromHex(clientKeyHex)
|
||||||
|
if err != nil {
|
||||||
|
return nostr.SecretKey{}, nil, fmt.Errorf("bunker client key '%s' is invalid: %w", clientKeyHex, err)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
clientKey = nostr.Generate()
|
clientKey = nostr.Generate()
|
||||||
}
|
}
|
||||||
@@ -91,6 +93,7 @@ func gatherSecretKeyOrBunkerFromArguments(ctx context.Context, c *cli.Command) (
|
|||||||
if isPiped() {
|
if isPiped() {
|
||||||
return nostr.SecretKey{}, nil, fmt.Errorf("can't prompt for a secret key when processing data from a pipe, try again without --prompt-sec")
|
return nostr.SecretKey{}, nil, fmt.Errorf("can't prompt for a secret key when processing data from a pipe, try again without --prompt-sec")
|
||||||
}
|
}
|
||||||
|
var err error
|
||||||
sec, err = askPassword("type your secret key as ncryptsec, nsec or hex: ", nil)
|
sec, err = askPassword("type your secret key as ncryptsec, nsec or hex: ", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nostr.SecretKey{}, nil, fmt.Errorf("failed to get secret key: %w", err)
|
return nostr.SecretKey{}, nil, fmt.Errorf("failed to get secret key: %w", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user