Add signature to Waku messages
This commit is contained in:
parent
8f702928bc
commit
14849fe62f
|
@ -6,7 +6,7 @@ import { utils } from "js-waku";
|
||||||
import * as secp256k1 from "secp256k1";
|
import * as secp256k1 from "secp256k1";
|
||||||
|
|
||||||
export class Identity {
|
export class Identity {
|
||||||
public constructor(private privateKey: Uint8Array) {}
|
public constructor(public privateKey: Uint8Array) {}
|
||||||
|
|
||||||
public static generate(): Identity {
|
public static generate(): Identity {
|
||||||
const privateKey = generatePrivateKey();
|
const privateKey = generatePrivateKey();
|
||||||
|
|
|
@ -84,11 +84,10 @@ export class Messenger {
|
||||||
this.identity
|
this.identity
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: Add signature
|
|
||||||
const wakuMessage = await WakuMessage.fromBytes(
|
const wakuMessage = await WakuMessage.fromBytes(
|
||||||
appMetadataMessage.encode(),
|
appMetadataMessage.encode(),
|
||||||
chat.contentTopic,
|
chat.contentTopic,
|
||||||
{ symKey: chat.symKey }
|
{ symKey: chat.symKey, sigPrivKey: this.identity.privateKey }
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.waku.relay.send(wakuMessage);
|
await this.waku.relay.send(wakuMessage);
|
||||||
|
|
Loading…
Reference in New Issue