mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-09 09:13:10 +00:00
revert change on encoder
This commit is contained in:
parent
065ef0adb0
commit
3c930dedfc
@ -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,
|
||||
|
||||
@ -82,9 +82,7 @@ describe("StoreCore", () => {
|
||||
const routingInfo: IRoutingInfo = {
|
||||
pubsubTopic: "test-topic",
|
||||
shardId: 1,
|
||||
networkConfig: { clusterId: 0 },
|
||||
isAutoSharding: false,
|
||||
isStaticSharding: false
|
||||
clusterId: 0
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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. */
|
||||
|
||||
@ -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. */
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
@ -66,7 +66,6 @@ export class MessageCollector {
|
||||
public async waitForMessages(
|
||||
numMessages: number,
|
||||
options?: {
|
||||
// pubsubTopic?: string;
|
||||
timeoutDuration?: number;
|
||||
exact?: boolean;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user