mirror of https://github.com/waku-org/js-waku.git
Merge pull request #1182 from waku-org/chore/nwaku-0.15.0
This commit is contained in:
commit
d8d7b8389b
|
@ -9,7 +9,7 @@ on:
|
|||
pull_request:
|
||||
|
||||
env:
|
||||
NWAKU_VERSION: "v0.13.0"
|
||||
NWAKU_VERSION: "v0.15.0"
|
||||
NODE_JS: "18"
|
||||
|
||||
jobs:
|
||||
|
|
2
nwaku
2
nwaku
|
@ -1 +1 @@
|
|||
Subproject commit 9debd44e2aebf07eaf96b4525a4497c69aaf4445
|
||||
Subproject commit e12b7cb4a8d7084f8174b378d38fa261428e406d
|
|
@ -81,13 +81,6 @@ export interface MessageRpcQuery {
|
|||
}
|
||||
|
||||
export interface MessageRpcResponse {
|
||||
payload: number[];
|
||||
contentTopic?: string;
|
||||
version?: number;
|
||||
timestamp?: bigint; // Unix epoch time in nanoseconds as a 64-bits integer value.
|
||||
}
|
||||
|
||||
export interface MessageRpcResponseHex {
|
||||
payload: string;
|
||||
contentTopic?: string;
|
||||
version?: number;
|
||||
|
@ -122,7 +115,7 @@ export class Nwaku {
|
|||
}
|
||||
|
||||
return {
|
||||
payload: bytesToHex(message.payload),
|
||||
payload: Buffer.from(message.payload).toString("base64url"),
|
||||
contentTopic: message.contentTopic,
|
||||
timestamp,
|
||||
};
|
||||
|
@ -321,10 +314,10 @@ export class Nwaku {
|
|||
async getAsymmetricMessages(
|
||||
privateKey: Uint8Array,
|
||||
pubSubTopic?: string
|
||||
): Promise<MessageRpcResponseHex[]> {
|
||||
): Promise<MessageRpcResponse[]> {
|
||||
this.checkProcess();
|
||||
|
||||
return await this.rpcCall<MessageRpcResponseHex[]>(
|
||||
return await this.rpcCall<MessageRpcResponse[]>(
|
||||
"get_waku_v2_private_v1_asymmetric_messages",
|
||||
[
|
||||
pubSubTopic ? pubSubTopic : DefaultPubSubTopic,
|
||||
|
@ -363,10 +356,10 @@ export class Nwaku {
|
|||
async getSymmetricMessages(
|
||||
symKey: Uint8Array,
|
||||
pubSubTopic?: string
|
||||
): Promise<MessageRpcResponseHex[]> {
|
||||
): Promise<MessageRpcResponse[]> {
|
||||
this.checkProcess();
|
||||
|
||||
return await this.rpcCall<MessageRpcResponseHex[]>(
|
||||
return await this.rpcCall<MessageRpcResponse[]>(
|
||||
"get_waku_v2_private_v1_symmetric_messages",
|
||||
[
|
||||
pubSubTopic ? pubSubTopic : DefaultPubSubTopic,
|
||||
|
@ -475,3 +468,7 @@ interface RpcInfoResponse {
|
|||
listenAddresses: string[];
|
||||
enrUri?: string;
|
||||
}
|
||||
|
||||
export function base64ToUtf8(b64: string): string {
|
||||
return Buffer.from(b64, "base64").toString("utf-8");
|
||||
}
|
||||
|
|
|
@ -2,11 +2,12 @@ import { createEncoder, waitForRemotePeer } from "@waku/core";
|
|||
import { createLightNode } from "@waku/create";
|
||||
import type { LightNode } from "@waku/interfaces";
|
||||
import { Protocols } from "@waku/interfaces";
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/utils";
|
||||
import { utf8ToBytes } from "@waku/utils";
|
||||
import { expect } from "chai";
|
||||
import debug from "debug";
|
||||
|
||||
import {
|
||||
base64ToUtf8,
|
||||
delay,
|
||||
makeLogFileName,
|
||||
MessageRpcResponse,
|
||||
|
@ -58,7 +59,7 @@ describe("Waku Light Push [node only]", () => {
|
|||
}
|
||||
|
||||
expect(msgs[0].contentTopic).to.equal(TestContentTopic);
|
||||
expect(bytesToUtf8(new Uint8Array(msgs[0].payload))).to.equal(messageText);
|
||||
expect(base64ToUtf8(msgs[0].payload)).to.equal(messageText);
|
||||
});
|
||||
|
||||
it("Push on custom pubsub topic", async function () {
|
||||
|
@ -105,6 +106,6 @@ describe("Waku Light Push [node only]", () => {
|
|||
}
|
||||
|
||||
expect(msgs[0].contentTopic).to.equal(TestContentTopic);
|
||||
expect(bytesToUtf8(new Uint8Array(msgs[0].payload))!).to.equal(messageText);
|
||||
expect(base64ToUtf8(msgs[0].payload!)).to.equal(messageText);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -25,6 +25,7 @@ import { expect } from "chai";
|
|||
import debug from "debug";
|
||||
|
||||
import {
|
||||
base64ToUtf8,
|
||||
delay,
|
||||
makeLogFileName,
|
||||
MessageRpcResponse,
|
||||
|
@ -389,9 +390,7 @@ describe("Waku Relay [node only]", () => {
|
|||
|
||||
expect(msgs[0].contentTopic).to.equal(TestContentTopic);
|
||||
expect(msgs[0].version).to.equal(0);
|
||||
expect(bytesToUtf8(new Uint8Array(msgs[0].payload))).to.equal(
|
||||
messageText
|
||||
);
|
||||
expect(base64ToUtf8(msgs[0].payload)).to.equal(messageText);
|
||||
});
|
||||
|
||||
it("Nwaku publishes", async function () {
|
||||
|
|
Loading…
Reference in New Issue