Fix SendToAddr to error when no sender configured (#149)

Fixes #145

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: #149
Reviewed-by: xuu <xuu@noreply@mills.io>
Co-authored-by: James Mills <james@mills.io>
Co-committed-by: James Mills <james@mills.io>
pull/147/head
James Mills 6 months ago committed by xuu
parent f3a847674c
commit 330701da86
  1. 5
      client.go
  2. BIN
      internal/web/app.wasm

@ -31,6 +31,7 @@ const (
var (
ErrNoMessages = errors.New("error: no messages found")
ErrNoSender = errors.New("error: no sender configured")
ErrNotConnected = errors.New("error: client not connected")
ErrMissingIdentity = errors.New("error: missing identity")
)
@ -375,6 +376,10 @@ func (cli *Client) Send(user, msg string) error {
}
func (cli *Client) SendToAddr(addr *Addr, msg string) error {
if cli.me == nil || cli.me.IsZero() {
return ErrNoSender
}
b, err := salty.Encrypt(cli.key, PackMessage(cli.me, msg), []string{addr.key.ID().String()})
if err != nil {
return fmt.Errorf("error encrypting message to %s: %w", addr, err)

BIN
internal/web/app.wasm (Stored with Git LFS)

Binary file not shown.
Loading…
Cancel
Save