Richard Ramos 3d8aae5b81
Lightpush protocol
- Partially implements #20. Requires some tests
- Extracts wakurelay code to separate file
- Extracts request id gen to separate file
- Initial implementation of lightpush protocol
- Adds utils functions to obtain a message hash
- Publish receives a context to send a message
2021-04-28 16:10:44 -04:00

20 lines
328 B
Go

package pb
import (
gcrypto "github.com/ethereum/go-ethereum/crypto"
proto "github.com/golang/protobuf/proto"
)
func (msg *WakuMessage) Hash() ([]byte, error) {
out, err := proto.Marshal(msg)
if err != nil {
return nil, err
}
return Hash(out), nil
}
func Hash(data []byte) []byte {
return gcrypto.Keccak256(data)
}