--prompt-sec for getting a secret key from a prompt.

This commit is contained in:
fiatjaf
2023-11-08 14:26:25 -03:00
parent 200e4e61f7
commit d95b6f50ff
5 changed files with 60 additions and 19 deletions

View File

@@ -1,9 +1,7 @@
package main
import (
"encoding/hex"
"fmt"
"strings"
"github.com/nbd-wtf/go-nostr/nip19"
"github.com/urfave/cli/v2"
@@ -232,17 +230,3 @@ var encode = &cli.Command{
},
},
}
func validate32BytesHex(target string) error {
if _, err := hex.DecodeString(target); err != nil {
return fmt.Errorf("target '%s' is not valid hex: %s", target, err)
}
if len(target) != 64 {
return fmt.Errorf("expected '%s' to be 64 characters (32 bytes), got %d", target, len(target))
}
if strings.ToLower(target) != target {
return fmt.Errorf("expected target to be all lowercase hex. try again with '%s'", strings.ToLower(target))
}
return nil
}