Add signature to Waku messages

This commit is contained in:
Franck Royer 2021-09-23 15:47:21 +10:00
parent 8f702928bc
commit 14849fe62f
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 2 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import { utils } from "js-waku";
import * as secp256k1 from "secp256k1";
export class Identity {
public constructor(private privateKey: Uint8Array) {}
public constructor(public privateKey: Uint8Array) {}
public static generate(): Identity {
const privateKey = generatePrivateKey();

View File

@ -84,11 +84,10 @@ export class Messenger {
this.identity
);
// TODO: Add signature
const wakuMessage = await WakuMessage.fromBytes(
appMetadataMessage.encode(),
chat.contentTopic,
{ symKey: chat.symKey }
{ symKey: chat.symKey, sigPrivKey: this.identity.privateKey }
);
await this.waku.relay.send(wakuMessage);