mirror of
https://github.com/fiatjaf/nak.git
synced 2024-11-22 08:19:06 -05: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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println(ciphertext)
|
stdout(ciphertext)
|
||||||
} else {
|
} else {
|
||||||
ss, err := nip04.ComputeSharedSecret(target, sec)
|
ss, err := nip04.ComputeSharedSecret(target, sec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -55,7 +55,7 @@ var encrypt = &cli.Command{
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to encrypt as nip04: %w", err)
|
return fmt.Errorf("failed to encrypt as nip04: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Println(ciphertext)
|
stdout(ciphertext)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
kr, err := gatherKeyerFromArguments(ctx, c)
|
kr, err := gatherKeyerFromArguments(ctx, c)
|
||||||
|
@ -67,7 +67,7 @@ var encrypt = &cli.Command{
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to encrypt: %w", err)
|
return fmt.Errorf("failed to encrypt: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Println(res)
|
stdout(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -110,7 +110,7 @@ var decrypt = &cli.Command{
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println(plaintext)
|
stdout(plaintext)
|
||||||
} else {
|
} else {
|
||||||
ss, err := nip04.ComputeSharedSecret(source, sec)
|
ss, err := nip04.ComputeSharedSecret(source, sec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -120,7 +120,7 @@ var decrypt = &cli.Command{
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to encrypt as nip04: %w", err)
|
return fmt.Errorf("failed to encrypt as nip04: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Println(plaintext)
|
stdout(plaintext)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
kr, err := gatherKeyerFromArguments(ctx, c)
|
kr, err := gatherKeyerFromArguments(ctx, c)
|
||||||
|
@ -132,7 +132,7 @@ var decrypt = &cli.Command{
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to encrypt: %w", err)
|
return fmt.Errorf("failed to encrypt: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Println(res)
|
stdout(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
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, "", " ")
|
res, _ := json.MarshalIndent(result, "", " ")
|
||||||
fmt.Println(string(res))
|
stdout(string(res))
|
||||||
|
|
||||||
return nil
|
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)
|
ch := make(chan string)
|
||||||
go func() {
|
go func() {
|
||||||
for sec := range getStdinLinesOrArgumentsFromSlice(keys) {
|
for sec := range getStdinLinesOrArgumentsFromSlice(keys) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user