Skip to content
Snippets Groups Projects
Commit d8af915b authored by Jonah Husson's avatar Jonah Husson
Browse files

Add 0 byte to message contents

parent 4f23b48a
No related branches found
No related tags found
2 merge requests!170Release,!120Add 0 byte to message contents
......@@ -9,6 +9,7 @@ package bindings
import (
"encoding/json"
"fmt"
"github.com/pkg/errors"
"gitlab.com/elixxir/client/storage/edge"
"gitlab.com/elixxir/crypto/fingerprint"
......@@ -68,6 +69,7 @@ func NotificationsForMe(notifCSV, preimages string) (*ManyNotificationForMeRepor
}
list, err := notifications.DecodeNotificationsCSV(notifCSV)
fmt.Printf("%+v, %+v", list[0], list[1])
if err != nil {
return nil, err
......
......@@ -123,3 +123,23 @@ func TestManyNotificationForMeReport_Get(t *testing.T) {
t.Errorf("Didnt get error when too long")
}
}
func TestManyNotificationForMeReport_Get2(t *testing.T) {
//preimages := "[{\"Data\":\"+imfMoh4wSvzdqlXvkeM8HK37NSrcWWzNIQuN2SAWzQD\",\"Type\":\"default\",\"Source\":\"+imfMoh4wSvzdqlXvkeM8HK37NSrcWWzNIQuN2SAWzQD\"},{\"Data\":\"KyX9P0GJy1tGpX2Kl0RSHO7liXh8WZ3lVmgh0luiyPc=\",\"Type\":\"request\",\"Source\":\"+imfMoh4wSvzdqlXvkeM8HK37NSrcWWzNIQuN2SAWzQD\"},{\"Data\":\"AKpMwY5PX3A3VA+xW2P96XoAxm+w/qODIoCOv/C1jmg=\",\"Type\":\"e2e\",\"Source\":\"k2aR7LPdbI825ZM15PPQGgA5xHi5uj+945ozTWHXYn8D\"},{\"Data\":\"sFu5vVtjkpvyF9aRGadbEFpI1HtFfoz3o2y2wAcq7GE=\",\"Type\":\"silent\",\"Source\":\"k2aR7LPdbI825ZM15PPQGgA5xHi5uj+945ozTWHXYn8D\"},{\"Data\":\"fejEMJllneWUvTwG5xsk921iZymizzRakowl1odzMHM=\",\"Type\":\"endFT\",\"Source\":\"k2aR7LPdbI825ZM15PPQGgA5xHi5uj+945ozTWHXYn8D\"}]"
//csv := "LfDJYRwrmSBc9Y9Kt1C0TpxezIp42QUxZytbnoAkJrU=,NBWOG68cZhzmPrcnv0VbmuAutZ+Mfyx7vQ=="
preimages := "[{\"Data\":\"6i0/uGCZWM5CMfyS5TtqgZziDiwr62jkqI2VGP2OsfY=\",\"Type\":\"endFT\",\"Source\":\"yVbuL00vkMOMOq+9dzk7qUmc9KDUpK4QH5wxohURU7cD\"},{\"Data\":\"+imfMoh4wSvzdqlXvkeM8HK37NSrcWWzNIQuN2SAWzQD\",\"Type\":\"default\",\"Source\":\"+imfMoh4wSvzdqlXvkeM8HK37NSrcWWzNIQuN2SAWzQD\"},{\"Data\":\"AKpMwY5PX3A3VA+xW2P96XoAxm+w/qODIoCOv/C1jmg=\",\"Type\":\"e2e\",\"Source\":\"k2aR7LPdbI825ZM15PPQGgA5xHi5uj+945ozTWHXYn8D\"},{\"Data\":\"KyX9P0GJy1tGpX2Kl0RSHO7liXh8WZ3lVmgh0luiyPc=\",\"Type\":\"request\",\"Source\":\"+imfMoh4wSvzdqlXvkeM8HK37NSrcWWzNIQuN2SAWzQD\"},{\"Data\":\"fejEMJllneWUvTwG5xsk921iZymizzRakowl1odzMHM=\",\"Type\":\"endFT\",\"Source\":\"k2aR7LPdbI825ZM15PPQGgA5xHi5uj+945ozTWHXYn8D\"},{\"Data\":\"sFu5vVtjkpvyF9aRGadbEFpI1HtFfoz3o2y2wAcq7GE=\",\"Type\":\"silent\",\"Source\":\"k2aR7LPdbI825ZM15PPQGgA5xHi5uj+945ozTWHXYn8D\"},{\"Data\":\"z8jcb8HmzayFuzOGiPATJE7eaLCbu6p5TVky7zt9WWs=\",\"Type\":\"e2e\",\"Source\":\"yVbuL00vkMOMOq+9dzk7qUmc9KDUpK4QH5wxohURU7cD\"},{\"Data\":\"kMwwG5wg5/d7C5ptV/5qxOCcvXPNu1zEqAJJhAzpN1o=\",\"Type\":\"silent\",\"Source\":\"yVbuL00vkMOMOq+9dzk7qUmc9KDUpK4QH5wxohURU7cD\"}]"
// csv := "sonu7rdo4fnDnQr/EYcYfpdU3TOnZ/A+fvM5C9wYVRk=,6FZ+fEXi6DTbimit3xQv+629eXBd6cy7/w=="
csv := "dVRQWAgW7PD88S5LZQ2XehPSJn7U0h1cJT5b01Qesvw=,xFrwD5n5UmYNXAHPChpFmV6OecAJNxGP+w==\n2yDqIz9z01Pq+tV13HW/9TO4umz3jU6DaOhKATCRpqc=,kkKWe1VSwYEtiyKg6W4S5Q8Rzv53aLU6yQ=="
report, err := NotificationsForMe(csv, preimages)
if err != nil {
t.Errorf("Failed to check if notifications are for me: %+v", err)
}
var found bool
for _, i := range report.many {
found = found || i.forMe
}
if !found {
t.Errorf("No notifications for me :(")
}
}
......@@ -154,7 +154,8 @@ func buildSlotMessage(msg format.Message, recipient *id.ID, target *id.ID,
}
// Set the identity fingerprint
ifp := fingerprint.IdentityFP(msg.GetContents(), preimage)
ifp := fingerprint.IdentityFP(append([]byte{0}, msg.GetContents()...), preimage)
msg.SetIdentityFP(ifp)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment