Official cwtch.im peer and server implementations.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

group_test.go 711B

1234567891011121314151617181920212223242526
  1. package model
  2. import (
  3. "git.mascherari.press/cwtch/protocol"
  4. "github.com/golang/protobuf/proto"
  5. "testing"
  6. "time"
  7. )
  8. func TestGroup(t *testing.T) {
  9. g := NewGroup("server.onion")
  10. dgm := &protocol.DecryptedGroupMessage{
  11. Onion: proto.String("onion"),
  12. Text: proto.String("Hello World!"),
  13. Timestamp: proto.Int32(int32(time.Now().Unix())),
  14. SignedGroupId: []byte{},
  15. Signature: []byte{},
  16. }
  17. encMessage := g.EncryptMessage(dgm)
  18. ok, message := g.DecryptMessage(encMessage)
  19. if !ok || message.GetText() != "Hello World!" {
  20. t.Errorf("group encryption was invalid, or returned wrong message decrypted:%v message:%v", ok, message)
  21. return
  22. }
  23. t.Logf("Got message %v", message)
  24. }