Fix Nimbus Post implementation

This commit is contained in:
Pedro Pombeiro 2020-01-10 15:53:35 +01:00 committed by Pedro Pombeiro
parent d3de88f790
commit cbe2d621f4
2 changed files with 2 additions and 3 deletions

View File

@ -181,7 +181,7 @@ func (w *nimbusPublicWhisperAPIWrapper) Post(ctx context.Context, req types.NewM
defer C.free(unsafe.Pointer(symKeyID))
}
if req.PublicKey != nil && len(req.PublicKey) > 0 {
msg.pubKey = (*C.uchar)(C.CBytes(req.PublicKey))
msg.pubKey = (*C.uchar)(C.CBytes(req.PublicKey[1:]))
defer C.free(unsafe.Pointer(msg.pubKey))
}
msg.payloadLen = C.size_t(len(req.Payload))

View File

@ -5,12 +5,11 @@ package nimbusbridge
// https://golang.org/cmd/cgo/
/*
#cgo LDFLAGS: -Wl,-rpath,'$ORIGIN' -L${SRCDIR} -lnimbus -lpcre -lm
#include <stddef.h>
#include <stdbool.h>
#include <stdlib.h>
#include <libnimbus.h>
void onMessageHandler_cgo(received_message * msg, void* udata); // Forward declaration.
void onMessageHandler_cgo(received_message* msg, void* udata); // Forward declaration.
*/
import "C"