This commit is contained in:
parent
050de1a0b3
commit
9b6caf4e62
12
client/helpers/logger.go
Normal file
12
client/helpers/logger.go
Normal file
@ -0,0 +1,12 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
var logger zerolog.Logger
|
||||
|
||||
// AddLogger sets the logger for the sublibrary
|
||||
func AddLogger(l zerolog.Logger) {
|
||||
logger = l
|
||||
}
|
12
client/logger.go
Normal file
12
client/logger.go
Normal file
@ -0,0 +1,12 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
var logger zerolog.Logger
|
||||
|
||||
// AddLogger sets the logger for the sublibrary
|
||||
func AddLogger(l zerolog.Logger) {
|
||||
logger = l
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"time"
|
||||
@ -206,7 +205,7 @@ func (p *Peer) AsymEncryptMessage(Message []byte) (*meowlib.EncryptedMessage, er
|
||||
// fmt.Println("[AsymEncryptMessage] Signature should be verified with:", p.MyIdentity.Public)
|
||||
enc, err := meowlib.AsymEncryptAndSign(p.ContactEncryption, p.MyIdentity.Private, Message)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
logger.Error().Err(err).Msg("Peer.AsymEncryptMessage")
|
||||
return enc, err
|
||||
}
|
||||
return enc, err
|
||||
@ -219,7 +218,7 @@ func (p *Peer) AsymDecryptMessage(Message []byte, Signature []byte) (DecryptedMe
|
||||
// fmt.Println("[AsymDecryptMessage] Signature will be verified with:", p.ContactPublicKey)
|
||||
DecryptedMessage, err = meowlib.AsymDecryptAndCheck(p.MyEncryptionKp.Private, p.ContactPublicKey, Message, Signature)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
logger.Error().Err(err).Msg("Peer.AsymDecryptMessage")
|
||||
return nil, err
|
||||
}
|
||||
return DecryptedMessage, err
|
||||
|
@ -1,7 +1,6 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -119,7 +118,7 @@ func (ints *Server) AsymEncryptMessage(Message []byte) (*meowlib.EncryptedMessag
|
||||
var enc *meowlib.EncryptedMessage
|
||||
enc, err := meowlib.AsymEncryptAndSign(ints.PublicKey, ints.UserKp.Private, Message)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
logger.Error().Err(err).Msg("Server.AsymEncryptMessage")
|
||||
return nil, err
|
||||
}
|
||||
return enc, err
|
||||
@ -129,7 +128,7 @@ func (ints *Server) AsymEncryptMessage(Message []byte) (*meowlib.EncryptedMessag
|
||||
func (ints *Server) AsymDecryptMessage(Message []byte, Signature []byte) (DecryptedMessage []byte, err error) {
|
||||
DecryptedMessage, err = meowlib.AsymDecryptAndCheck(ints.UserKp.Private, ints.PublicKey, Message, Signature)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
logger.Error().Err(err).Msg("Server.AsymDecryptMessage")
|
||||
return nil, err
|
||||
}
|
||||
return DecryptedMessage, err
|
||||
|
Loading…
Reference in New Issue
Block a user