[PD2] some anotations on what to change in client
This commit is contained in:
parent
8f29d75d27
commit
247d2e73dc
1 changed files with 11 additions and 7 deletions
|
@ -32,7 +32,7 @@ func Run() {
|
|||
switch command {
|
||||
case "send":
|
||||
if flag.NArg() != 3 {
|
||||
printError("MSG SERVICE: command error!")
|
||||
printError("MSG SERVICE: command error!")
|
||||
showHelp()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func Run() {
|
|||
|
||||
case "askqueue":
|
||||
if flag.NArg() > 3 {
|
||||
printError("MSG SERVICE: command error!")
|
||||
printError("MSG SERVICE: command error!")
|
||||
showHelp()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ func Run() {
|
|||
|
||||
case "getmsg":
|
||||
if flag.NArg() < 2 {
|
||||
printError("MSG SERVICE: command error!")
|
||||
printError("MSG SERVICE: command error!")
|
||||
showHelp()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -83,14 +83,14 @@ func Run() {
|
|||
}
|
||||
err = getMsgCommand(clientKeyStore, num)
|
||||
if err != nil {
|
||||
printError(err.Error())
|
||||
printError(err.Error())
|
||||
}
|
||||
|
||||
case "help":
|
||||
showHelp()
|
||||
|
||||
default:
|
||||
printError("MSG SERVICE: command error!")
|
||||
printError("MSG SERVICE: command error!")
|
||||
showHelp()
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,7 @@ func sendCommand(clientKeyStore cryptoUtils.KeyStore, plainSubject, plainBody, u
|
|||
return err
|
||||
}
|
||||
|
||||
// FIX: adapt to api
|
||||
cl, err := networking.NewClient[protocol.Packet](&clientKeyStore)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -117,14 +118,17 @@ func sendCommand(clientKeyStore cryptoUtils.KeyStore, plainSubject, plainBody, u
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
subject, err := clientKeyStore.EncryptMessageContent(receiverCert, plainSubjectBytes)
|
||||
// NOTE: this will stay the same
|
||||
subject, err := clientKeyStore.EncryptMessageContent(receiverCert, uid, plainSubjectBytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
body, err := clientKeyStore.EncryptMessageContent(receiverCert, plainBodyBytes)
|
||||
body, err := clientKeyStore.EncryptMessageContent(receiverCert, uid, plainBodyBytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// FIX: adapt to api
|
||||
sendMsgPacket := protocol.NewSendMsgPacket(uid, subject, body)
|
||||
if err := cl.Connection.Send(sendMsgPacket); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue