Automatically detect piped stdin on the root command; it doubles as input and output
This commit is contained in:
parent
3470117c31
commit
505e0e4b41
8 changed files with 71 additions and 125 deletions
|
|
@ -7,11 +7,11 @@ import (
|
|||
"github.com/AYM1607/ccclip/pkg/crypto"
|
||||
)
|
||||
|
||||
func encryptForAll(plaintext string, pvk *ecdh.PrivateKey, devices []*api.Device) map[string][]byte {
|
||||
func encryptForAll(plaintext []byte, pvk *ecdh.PrivateKey, devices []*api.Device) map[string][]byte {
|
||||
res := map[string][]byte{}
|
||||
for _, d := range devices {
|
||||
key := crypto.NewSharedKey(pvk, crypto.PublicKeyFromBytes(d.PublicKey), crypto.SendDirection)
|
||||
res[d.ID] = crypto.Encrypt(key, []byte(plaintext))
|
||||
res[d.ID] = crypto.Encrypt(key, plaintext)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue