revert change on encoder

This commit is contained in:
fryorcraken 2025-07-19 18:07:38 +10:00
parent 065ef0adb0
commit 3c930dedfc
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
7 changed files with 29 additions and 83 deletions

View File

@ -1,4 +1,5 @@
import type {
EncoderOptions,
IDecodedMessage,
IDecoder,
IEncoder,
@ -65,26 +66,6 @@ export class DecodedMessage implements IDecodedMessage {
}
}
export type EncoderOptions = {
/**
* The routing information for messages to encode.
*/
routingInfo: IRoutingInfo;
/** The content topic to set on outgoing messages. */
contentTopic: string;
/**
* An optional flag to mark message as ephemeral, i.e., not to be stored by Waku Store nodes.
* @defaultValue `false`
*/
ephemeral?: boolean;
/**
* A function called when encoding messages to set the meta field.
* @param IProtoMessage The message encoded for wire, without the meta field.
* If encryption is used, `metaSetter` only accesses _encrypted_ payload.
*/
metaSetter?: IMetaSetter;
};
export class Encoder implements IEncoder {
public constructor(
public contentTopic: string,

View File

@ -82,9 +82,7 @@ describe("StoreCore", () => {
const routingInfo: IRoutingInfo = {
pubsubTopic: "test-topic",
shardId: 1,
networkConfig: { clusterId: 0 },
isAutoSharding: false,
isStaticSharding: false
clusterId: 0
};
beforeEach(() => {

View File

@ -71,6 +71,26 @@ export interface IMetaSetter {
(message: IProtoMessage & { meta: undefined }): Uint8Array;
}
export interface EncoderOptions {
/**
* The routing information for the message (cluster id, shard id, pubsubTopic)
*/
routingInfo: IRoutingInfo;
/** The content topic to set on outgoing messages. */
contentTopic: string;
/**
* An optional flag to mark message as ephemeral, i.e., not to be stored by Waku Store nodes.
* @defaultValue `false`
*/
ephemeral?: boolean;
/**
* A function called when encoding messages to set the meta field.
* @param IProtoMessage The message encoded for wire, without the meta field.
* If encryption is used, `metaSetter` only accesses _encrypted_ payload.
*/
metaSetter?: IMetaSetter;
}
export interface IEncoder {
contentTopic: string;
ephemeral: boolean;

View File

@ -1,5 +1,6 @@
import { Decoder as DecoderV0 } from "@waku/core/lib/message/version_0";
import {
type EncoderOptions as BaseEncoderOptions,
type IDecoder,
type IEncoder,
type IEncryptedMessage,
@ -79,24 +80,7 @@ class Encoder implements IEncoder {
}
}
export interface EncoderOptions {
/**
* The routing information for messages to encode.
*/
routingInfo: IRoutingInfo;
/** The content topic to set on outgoing messages. */
contentTopic: string;
/**
* An optional flag to mark message as ephemeral, i.e., not to be stored by Waku Store nodes.
* @defaultValue `false`
*/
ephemeral?: boolean;
/**
* A function called when encoding messages to set the meta field.
* @param IProtoMessage The message encoded for wire, without the meta field.
* If encryption is used, `metaSetter` only accesses _encrypted_ payload.
*/
metaSetter?: IMetaSetter;
export interface EncoderOptions extends BaseEncoderOptions {
/** The public key to encrypt the payload for. */
publicKey: Uint8Array;
/** An optional private key to be used to sign the payload before encryption. */

View File

@ -1,5 +1,6 @@
import { Decoder as DecoderV0 } from "@waku/core/lib/message/version_0";
import type {
EncoderOptions as BaseEncoderOptions,
IDecoder,
IEncoder,
IEncryptedMessage,
@ -79,24 +80,7 @@ class Encoder implements IEncoder {
}
}
export interface EncoderOptions {
/**
* The routing information for messages to encode.
*/
routingInfo: IRoutingInfo;
/** The content topic to set on outgoing messages. */
contentTopic: string;
/**
* An optional flag to mark message as ephemeral, i.e., not to be stored by Waku Store nodes.
* @defaultValue `false`
*/
ephemeral?: boolean;
/**
* A function called when encoding messages to set the meta field.
* @param IProtoMessage The message encoded for wire, without the meta field.
* If encryption is used, `metaSetter` only accesses _encrypted_ payload.
*/
metaSetter?: IMetaSetter;
export interface EncoderOptions extends BaseEncoderOptions {
/** The symmetric key to encrypt the payload with. */
symKey: Uint8Array;
/** An optional private key to be used to sign the payload before encryption. */

View File

@ -2,8 +2,8 @@ import { createDecoder, createEncoder } from "@waku/core";
import type {
ContentTopic,
IDecodedMessage,
IMetaSetter,
IRoutingInfo
IRoutingInfo,
EncoderOptions as WakuEncoderOptions
} from "@waku/interfaces";
import { Logger } from "@waku/utils";
import init from "@waku/zerokit-rln-wasm";
@ -28,27 +28,7 @@ import { Zerokit } from "./zerokit.js";
const log = new Logger("waku:rln");
type WakuRLNEncoderOptions = {
/**
* The routing information for messages to encode.
*/
routingInfo: IRoutingInfo;
/** The content topic to set on outgoing messages. */
contentTopic: string;
/**
* An optional flag to mark message as ephemeral, i.e., not to be stored by Waku Store nodes.
* @defaultValue `false`
*/
ephemeral?: boolean;
/**
* A function called when encoding messages to set the meta field.
* @param IProtoMessage The message encoded for wire, without the meta field.
* If encryption is used, `metaSetter` only accesses _encrypted_ payload.
*/
metaSetter?: IMetaSetter;
/**
* RLN Credentials
*/
type WakuRLNEncoderOptions = WakuEncoderOptions & {
credentials: EncryptedCredentials | DecryptedCredentials;
};

View File

@ -66,7 +66,6 @@ export class MessageCollector {
public async waitForMessages(
numMessages: number,
options?: {
// pubsubTopic?: string;
timeoutDuration?: number;
exact?: boolean;
}