mirror of
https://github.com/fiatjaf/nak.git
synced 2024-10-30 00:59:07 -04:00
use stdout() function instead of fmt.Println() in some places.
This commit is contained in:
parent
a4886dc445
commit
3215726417
|
@ -45,7 +45,7 @@ var encrypt = &cli.Command{
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(ciphertext)
|
||||
stdout(ciphertext)
|
||||
} else {
|
||||
ss, err := nip04.ComputeSharedSecret(target, sec)
|
||||
if err != nil {
|
||||
|
@ -55,7 +55,7 @@ var encrypt = &cli.Command{
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to encrypt as nip04: %w", err)
|
||||
}
|
||||
fmt.Println(ciphertext)
|
||||
stdout(ciphertext)
|
||||
}
|
||||
} else {
|
||||
kr, err := gatherKeyerFromArguments(ctx, c)
|
||||
|
@ -67,7 +67,7 @@ var encrypt = &cli.Command{
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to encrypt: %w", err)
|
||||
}
|
||||
fmt.Println(res)
|
||||
stdout(res)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -110,7 +110,7 @@ var decrypt = &cli.Command{
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(plaintext)
|
||||
stdout(plaintext)
|
||||
} else {
|
||||
ss, err := nip04.ComputeSharedSecret(source, sec)
|
||||
if err != nil {
|
||||
|
@ -120,7 +120,7 @@ var decrypt = &cli.Command{
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to encrypt as nip04: %w", err)
|
||||
}
|
||||
fmt.Println(plaintext)
|
||||
stdout(plaintext)
|
||||
}
|
||||
} else {
|
||||
kr, err := gatherKeyerFromArguments(ctx, c)
|
||||
|
@ -132,7 +132,7 @@ var decrypt = &cli.Command{
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to encrypt: %w", err)
|
||||
}
|
||||
fmt.Println(res)
|
||||
stdout(res)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
4
key.go
4
key.go
|
@ -252,13 +252,13 @@ However, if the intent is to check if two existing Nostr pubkeys match a given c
|
|||
}
|
||||
|
||||
res, _ := json.MarshalIndent(result, "", " ")
|
||||
fmt.Println(string(res))
|
||||
stdout(string(res))
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func getSecretKeysFromStdinLinesOrSlice(ctx context.Context, c *cli.Command, keys []string) chan string {
|
||||
func getSecretKeysFromStdinLinesOrSlice(ctx context.Context, _ *cli.Command, keys []string) chan string {
|
||||
ch := make(chan string)
|
||||
go func() {
|
||||
for sec := range getStdinLinesOrArgumentsFromSlice(keys) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user