import type { PeerId } from "@libp2p/interface-peer-id"; import { Multiaddr } from "@multiformats/multiaddr"; import { IKeypair, KeypairType } from "./keypair"; import { ENRKey, ENRValue, NodeId, SequenceNumber } from "./types"; import { Waku2 } from "./waku2_codec"; export declare class ENR extends Map { static readonly RECORD_PREFIX = "enr:"; seq: SequenceNumber; signature: Uint8Array | null; peerId?: PeerId; private constructor(); static create(kvs?: Record, seq?: SequenceNumber, signature?: Uint8Array | null): Promise; static createV4(publicKey: Uint8Array, kvs?: Record): Promise; static createFromPeerId(peerId: PeerId, kvs?: Record): Promise; static decodeFromValues(decoded: Uint8Array[]): Promise; static decode(encoded: Uint8Array): Promise; static decodeTxt(encoded: string): Promise; set(k: ENRKey, v: ENRValue): this; get id(): string; get keypairType(): KeypairType; get publicKey(): Uint8Array | undefined; get keypair(): IKeypair | undefined; get nodeId(): NodeId | undefined; get ip(): string | undefined; set ip(ip: string | undefined); get tcp(): number | undefined; set tcp(port: number | undefined); get udp(): number | undefined; set udp(port: number | undefined); get ip6(): string | undefined; set ip6(ip: string | undefined); get tcp6(): number | undefined; set tcp6(port: number | undefined); get udp6(): number | undefined; set udp6(port: number | undefined); /** * Get the `multiaddrs` field from ENR. * * This field is used to store multiaddresses that cannot be stored with the current ENR pre-defined keys. * These can be a multiaddresses that include encapsulation (e.g. wss) or do not use `ip4` nor `ip6` for the host * address (e.g. `dns4`, `dnsaddr`, etc).. * * If the peer information only contains information that can be represented with the ENR pre-defined keys * (ip, tcp, etc) then the usage of { @link getLocationMultiaddr } should be preferred. * * The multiaddresses stored in this field are expected to be location multiaddresses, ie, peer id less. */ get multiaddrs(): Multiaddr[] | undefined; /** * Set the `multiaddrs` field on the ENR. * * This field is used to store multiaddresses that cannot be stored with the current ENR pre-defined keys. * These can be a multiaddresses that include encapsulation (e.g. wss) or do not use `ip4` nor `ip6` for the host * address (e.g. `dns4`, `dnsaddr`, etc).. * * If the peer information only contains information that can be represented with the ENR pre-defined keys * (ip, tcp, etc) then the usage of { @link setLocationMultiaddr } should be preferred. * The multiaddresses stored in this field must be location multiaddresses, * ie, without a peer id. */ set multiaddrs(multiaddrs: Multiaddr[] | undefined); getLocationMultiaddr(protocol: "udp" | "udp4" | "udp6" | "tcp" | "tcp4" | "tcp6"): Multiaddr | undefined; setLocationMultiaddr(multiaddr: Multiaddr): void; /** * Returns the full multiaddr from the ENR fields matching the provided * `protocol` parameter. * To return full multiaddrs from the `multiaddrs` ENR field, * use { @link ENR.getFullMultiaddrs }. * * @param protocol */ getFullMultiaddr(protocol: "udp" | "udp4" | "udp6" | "tcp" | "tcp4" | "tcp6"): Multiaddr | undefined; /** * Returns the full multiaddrs from the `multiaddrs` ENR field. */ getFullMultiaddrs(): Multiaddr[]; /** * Get the `waku2` field from ENR. */ get waku2(): Waku2 | undefined; /** * Set the `waku2` field on the ENR. */ set waku2(waku2: Waku2 | undefined); verify(data: Uint8Array, signature: Uint8Array): boolean; sign(data: Uint8Array, privateKey: Uint8Array): Promise; encodeToValues(privateKey?: Uint8Array): Promise<(ENRKey | ENRValue | number[])[]>; encode(privateKey?: Uint8Array): Promise; encodeTxt(privateKey?: Uint8Array): Promise; }