mirror of
https://github.com/fiatjaf/nak.git
synced 2024-11-22 00:09:08 -05:00
use log() function instead of fmt.Fprintf(os.Stderr) in some places.
This commit is contained in:
parent
3215726417
commit
43fe41df5d
|
@ -222,7 +222,7 @@ var bunker = &cli.Command{
|
|||
select {
|
||||
case <-ctx.Done():
|
||||
case <-time.After(time.Minute * 5):
|
||||
fmt.Fprintf(os.Stderr, "\n")
|
||||
log("\n")
|
||||
printBunkerInfo()
|
||||
}
|
||||
}()
|
||||
|
|
|
@ -68,7 +68,7 @@ func gatherSecretKeyOrBunkerFromArguments(ctx context.Context, c *cli.Command) (
|
|||
clientKey = nostr.GeneratePrivateKey()
|
||||
}
|
||||
bunker, err := nip46.ConnectBunker(ctx, clientKey, bunkerURL, nil, func(s string) {
|
||||
fmt.Fprintf(color.Error, color.CyanString("[nip46]: open the following URL: %s"), s)
|
||||
log(color.CyanString("[nip46]: open the following URL: %s"), s)
|
||||
})
|
||||
return "", bunker, err
|
||||
}
|
||||
|
|
5
key.go
5
key.go
|
@ -5,7 +5,6 @@ import (
|
|||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
|
@ -188,7 +187,7 @@ However, if the intent is to check if two existing Nostr pubkeys match a given c
|
|||
for i, prefix := range []byte{0x02, 0x03} {
|
||||
pubk, err := btcec.ParsePubKey(append([]byte{prefix}, keyb...))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error parsing key %s: %s", keyhex, err)
|
||||
log("error parsing key %s: %s", keyhex, err)
|
||||
continue
|
||||
}
|
||||
group[i] = pubk
|
||||
|
@ -229,7 +228,7 @@ However, if the intent is to check if two existing Nostr pubkeys match a given c
|
|||
|
||||
agg, _, _, err := musig2.AggregateKeys(combining, true)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error aggregating: %s", err)
|
||||
log("error aggregating: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
@ -135,8 +134,8 @@ func performMusig(
|
|||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "the following code should be saved secretly until the next step an included with --musig-nonce-secret:\n")
|
||||
fmt.Fprintf(os.Stderr, "%s\n\n", base64.StdEncoding.EncodeToString(nonce.SecNonce[:]))
|
||||
log("the following code should be saved secretly until the next step an included with --musig-nonce-secret:\n")
|
||||
log("%s\n\n", base64.StdEncoding.EncodeToString(nonce.SecNonce[:]))
|
||||
|
||||
knownNonces = append(knownNonces, nonce.PubNonce)
|
||||
printPublicCommandForNextPeer(evt, numSigners, knownSigners, knownNonces, nil, false)
|
||||
|
@ -149,7 +148,7 @@ func performMusig(
|
|||
} else {
|
||||
evt.PubKey = hex.EncodeToString(comb.SerializeCompressed()[1:])
|
||||
evt.ID = evt.GetID()
|
||||
fmt.Fprintf(os.Stderr, "combined key: %x\n\n", comb.SerializeCompressed())
|
||||
log("combined key: %x\n\n", comb.SerializeCompressed())
|
||||
}
|
||||
|
||||
// we have all the signers, which means we must also have all the nonces
|
||||
|
@ -244,7 +243,7 @@ func printPublicCommandForNextPeer(
|
|||
maybeNonceSecret = " --musig-nonce-secret '<insert-nonce-secret>'"
|
||||
}
|
||||
|
||||
fmt.Fprintf(os.Stderr, "the next signer and they should call this on their side:\nnak event --sec <insert-secret-key> --musig %d %s%s%s%s%s\n",
|
||||
log("the next signer and they should call this on their side:\nnak event --sec <insert-secret-key> --musig %d %s%s%s%s%s\n",
|
||||
numSigners,
|
||||
eventToCliArgs(evt),
|
||||
signersToCliArgs(knownSigners),
|
||||
|
|
Loading…
Reference in New Issue
Block a user