js-waku/classes/waku_message.WakuMessage.html

31 lines
41 KiB
HTML

<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>WakuMessage | js-waku</title><meta name="description" content="Documentation for js-waku"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">js-waku</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">js-waku</a></li><li><a href="../modules/waku_message.html">waku_message</a></li><li><a href="waku_message.WakuMessage.html">WakuMessage</a></li></ul><h1>Class WakuMessage</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">WakuMessage</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section tsd-is-private tsd-is-private-protected"><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-private"><a href="waku_message.WakuMessage.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#proto" class="tsd-kind-icon">proto</a></li></ul></section><section class="tsd-index-section "><h3>Accessors</h3><ul class="tsd-index-list"><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#contentTopic" class="tsd-kind-icon">content<wbr/>Topic</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#payload" class="tsd-kind-icon">payload</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#payloadAsUtf8" class="tsd-kind-icon">payload<wbr/>As<wbr/>Utf8</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#signature" class="tsd-kind-icon">signature</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#signaturePublicKey" class="tsd-kind-icon">signature<wbr/>Public<wbr/>Key</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#timestamp" class="tsd-kind-icon">timestamp</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#version" class="tsd-kind-icon">version</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#encode" class="tsd-kind-icon">encode</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="waku_message.WakuMessage.html#decode" class="tsd-kind-icon">decode</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="waku_message.WakuMessage.html#decodeProto" class="tsd-kind-icon">decode<wbr/>Proto</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="waku_message.WakuMessage.html#fromBytes" class="tsd-kind-icon">from<wbr/>Bytes</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="waku_message.WakuMessage.html#fromUtf8String" class="tsd-kind-icon">from<wbr/>Utf8<wbr/>String</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group tsd-is-private tsd-is-private-protected"><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-private"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagPrivate">Private</span> constructor<a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-private"><li class="tsd-signature tsd-kind-icon">new <wbr/>Waku<wbr/>Message<span class="tsd-signature-symbol">(</span>proto<span class="tsd-signature-symbol">: </span><a href="../modules/proto.html" class="tsd-signature-type" data-tsd-kind="Namespace">proto</a><span class="tsd-signature-symbol">.</span><a href="../modules/proto.html#WakuMessage-1" class="tsd-signature-type" data-tsd-kind="Variable">WakuMessage</a>, _signaturePublicKey<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Uint8Array</span>, _signature<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Uint8Array</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules/waku_message.html" class="tsd-signature-type" data-tsd-kind="Namespace">waku_message</a><span class="tsd-signature-symbol">.</span><a href="waku_message.WakuMessage.html" class="tsd-signature-type" data-tsd-kind="Class">WakuMessage</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L43">src/lib/waku_message/index.ts:43</a></li></ul></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>proto: <a href="../modules/proto.html" class="tsd-signature-type" data-tsd-kind="Namespace">proto</a><span class="tsd-signature-symbol">.</span><a href="../modules/proto.html#WakuMessage-1" class="tsd-signature-type" data-tsd-kind="Variable">WakuMessage</a></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> _signaturePublicKey: <span class="tsd-signature-type">Uint8Array</span></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> _signature: <span class="tsd-signature-type">Uint8Array</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="../modules/waku_message.html" class="tsd-signature-type" data-tsd-kind="Namespace">waku_message</a><span class="tsd-signature-symbol">.</span><a href="waku_message.WakuMessage.html" class="tsd-signature-type" data-tsd-kind="Class">WakuMessage</a></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="proto" class="tsd-anchor"></a><h3 class="tsd-anchor-link">proto<a href="#proto" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">proto<span class="tsd-signature-symbol">:</span> <a href="../modules/proto.html" class="tsd-signature-type" data-tsd-kind="Namespace">proto</a><span class="tsd-signature-symbol">.</span><a href="../modules/proto.html#WakuMessage-1" class="tsd-signature-type" data-tsd-kind="Variable">WakuMessage</a></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Accessors</h2><section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class"><a id="contentTopic" class="tsd-anchor"></a><h3 class="tsd-anchor-link">content<wbr/>Topic<a href="#contentTopic" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> contentTopic<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L264">src/lib/waku_message/index.ts:264</a></li></ul></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class"><a id="payload" class="tsd-anchor"></a><h3 class="tsd-anchor-link">payload<a href="#payload" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> payload<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Uint8Array</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L260">src/lib/waku_message/index.ts:260</a></li></ul></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Uint8Array</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class"><a id="payloadAsUtf8" class="tsd-anchor"></a><h3 class="tsd-anchor-link">payload<wbr/>As<wbr/>Utf8<a href="#payloadAsUtf8" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> payloadAsUtf8<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L252">src/lib/waku_message/index.ts:252</a></li></ul></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class"><a id="signature" class="tsd-anchor"></a><h3 class="tsd-anchor-link">signature<a href="#signature" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> signature<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Uint8Array</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L293">src/lib/waku_message/index.ts:293</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>The signature of the message.</p>
</div><div><p>MAY be present if the message is version 1.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Uint8Array</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class"><a id="signaturePublicKey" class="tsd-anchor"></a><h3 class="tsd-anchor-link">signature<wbr/>Public<wbr/>Key<a href="#signaturePublicKey" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> signaturePublicKey<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Uint8Array</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L284">src/lib/waku_message/index.ts:284</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>The public key used to sign the message.</p>
</div><div><p>MAY be present if the message is version 1.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Uint8Array</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class"><a id="timestamp" class="tsd-anchor"></a><h3 class="tsd-anchor-link">timestamp<a href="#timestamp" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> timestamp<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Date</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L272">src/lib/waku_message/index.ts:272</a></li></ul></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Date</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class"><a id="version" class="tsd-anchor"></a><h3 class="tsd-anchor-link">version<a href="#version" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> version<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L268">src/lib/waku_message/index.ts:268</a></li></ul></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="encode" class="tsd-anchor"></a><h3 class="tsd-anchor-link">encode<a href="#encode" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">encode<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L248">src/lib/waku_message/index.ts:248</a></li></ul></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Uint8Array</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="decode" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> decode<a href="#decode" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">decode<span class="tsd-signature-symbol">(</span>bytes<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span>, decryptionKeys<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>contentTopic<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span><span class="tsd-signature-symbol">; </span>method<span class="tsd-signature-symbol">?: </span><a href="../enums/waku_message.DecryptionMethod.html" class="tsd-signature-type" data-tsd-kind="Enumeration">DecryptionMethod</a><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../modules/waku_message.html" class="tsd-signature-type" data-tsd-kind="Namespace">waku_message</a><span class="tsd-signature-symbol">.</span><a href="waku_message.WakuMessage.html" class="tsd-signature-type" data-tsd-kind="Class">WakuMessage</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L124">src/lib/waku_message/index.ts:124</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Decode a byte array into Waku Message.</p>
</div><dl class="tsd-comment-tags"><dt>params</dt><dd><p>bytes The message encoded using protobuf as defined in <a href="https://rfc.vac.dev/spec/14/">14/WAKU2-MESSAGE</a>.</p>
</dd><dt>params</dt><dd><p>decryptionKeys If the payload is encrypted (version = 1), then the
keys are used to attempt decryption of the message. The passed key can either
be asymmetric private keys or symmetric keys, both method are tried for each
key until the message is decrypted or combinations are run out.</p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>bytes: <span class="tsd-signature-type">Uint8Array</span></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> decryptionKeys: <span class="tsd-signature-symbol">{ </span>contentTopic<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span><span class="tsd-signature-symbol">; </span>method<span class="tsd-signature-symbol">?: </span><a href="../enums/waku_message.DecryptionMethod.html" class="tsd-signature-type" data-tsd-kind="Enumeration">DecryptionMethod</a><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../modules/waku_message.html" class="tsd-signature-type" data-tsd-kind="Namespace">waku_message</a><span class="tsd-signature-symbol">.</span><a href="waku_message.WakuMessage.html" class="tsd-signature-type" data-tsd-kind="Class">WakuMessage</a><span class="tsd-signature-symbol">&gt;</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="decodeProto" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> decode<wbr/>Proto<a href="#decodeProto" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">decode<wbr/>Proto<span class="tsd-signature-symbol">(</span>protoBuf<span class="tsd-signature-symbol">: </span><a href="../modules/proto.html" class="tsd-signature-type" data-tsd-kind="Namespace">proto</a><span class="tsd-signature-symbol">.</span><a href="../modules/proto.html#WakuMessage-1" class="tsd-signature-type" data-tsd-kind="Variable">WakuMessage</a>, decryptionKeys<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>contentTopics<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span><span class="tsd-signature-symbol">; </span>method<span class="tsd-signature-symbol">?: </span><a href="../enums/waku_message.DecryptionMethod.html" class="tsd-signature-type" data-tsd-kind="Enumeration">DecryptionMethod</a><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../modules/waku_message.html" class="tsd-signature-type" data-tsd-kind="Namespace">waku_message</a><span class="tsd-signature-symbol">.</span><a href="waku_message.WakuMessage.html" class="tsd-signature-type" data-tsd-kind="Class">WakuMessage</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L146">src/lib/waku_message/index.ts:146</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Decode and decrypt Waku Message Protobuf Object into Waku Message.</p>
</div><dl class="tsd-comment-tags"><dt>params</dt><dd><p>protoBuf The message to decode and decrypt.</p>
</dd><dt>params</dt><dd><p>decryptionKeys If the payload is encrypted (version = 1), then the
keys are used to attempt decryption of the message. The passed key can either
be asymmetric private keys or symmetric keys, both method are tried for each
key until the message is decrypted or combinations are run out.</p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>protoBuf: <a href="../modules/proto.html" class="tsd-signature-type" data-tsd-kind="Namespace">proto</a><span class="tsd-signature-symbol">.</span><a href="../modules/proto.html#WakuMessage-1" class="tsd-signature-type" data-tsd-kind="Variable">WakuMessage</a></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> decryptionKeys: <span class="tsd-signature-symbol">{ </span>contentTopics<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span><span class="tsd-signature-symbol">; </span>method<span class="tsd-signature-symbol">?: </span><a href="../enums/waku_message.DecryptionMethod.html" class="tsd-signature-type" data-tsd-kind="Enumeration">DecryptionMethod</a><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../modules/waku_message.html" class="tsd-signature-type" data-tsd-kind="Namespace">waku_message</a><span class="tsd-signature-symbol">.</span><a href="waku_message.WakuMessage.html" class="tsd-signature-type" data-tsd-kind="Class">WakuMessage</a><span class="tsd-signature-symbol">&gt;</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="fromBytes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> from<wbr/>Bytes<a href="#fromBytes" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">from<wbr/>Bytes<span class="tsd-signature-symbol">(</span>payload<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span>, contentTopic<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, opts<span class="tsd-signature-symbol">?: </span><a href="../interfaces/waku_message.Options.html" class="tsd-signature-type" data-tsd-kind="Interface">Options</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules/waku_message.html" class="tsd-signature-type" data-tsd-kind="Namespace">waku_message</a><span class="tsd-signature-symbol">.</span><a href="waku_message.WakuMessage.html" class="tsd-signature-type" data-tsd-kind="Class">WakuMessage</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L73">src/lib/waku_message/index.ts:73</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Create a Waku Message with the given payload.</p>
</div><div><p>By default, the payload is kept clear (version 0).
If <code>opts.encPublicKey</code> is passed, the payload is encrypted using
asymmetric encryption (version 1).</p>
<p>If <code>opts.sigPrivKey</code> is passed and version 1 is used, the payload is signed
before encryption.</p>
</div><dl class="tsd-comment-tags"><dt>throws</dt><dd><p>if both <code>opts.encPublicKey</code> and <code>opt.symKey</code> are passed</p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>payload: <span class="tsd-signature-type">Uint8Array</span></h5></li><li><h5>contentTopic: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <a href="../interfaces/waku_message.Options.html" class="tsd-signature-type" data-tsd-kind="Interface">Options</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules/waku_message.html" class="tsd-signature-type" data-tsd-kind="Namespace">waku_message</a><span class="tsd-signature-symbol">.</span><a href="waku_message.WakuMessage.html" class="tsd-signature-type" data-tsd-kind="Class">WakuMessage</a><span class="tsd-signature-symbol">&gt;</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="fromUtf8String" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> from<wbr/>Utf8<wbr/>String<a href="#fromUtf8String" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">from<wbr/>Utf8<wbr/>String<span class="tsd-signature-symbol">(</span>utf8<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, contentTopic<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, opts<span class="tsd-signature-symbol">?: </span><a href="../interfaces/waku_message.Options.html" class="tsd-signature-type" data-tsd-kind="Interface">Options</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules/waku_message.html" class="tsd-signature-type" data-tsd-kind="Namespace">waku_message</a><span class="tsd-signature-symbol">.</span><a href="waku_message.WakuMessage.html" class="tsd-signature-type" data-tsd-kind="Class">WakuMessage</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/status-im/js-waku/blob/b50e211/src/lib/waku_message/index.ts#L52">src/lib/waku_message/index.ts:52</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Create Message with an utf-8 string as payload.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>utf8: <span class="tsd-signature-type">string</span></h5></li><li><h5>contentTopic: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <a href="../interfaces/waku_message.Options.html" class="tsd-signature-type" data-tsd-kind="Interface">Options</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules/waku_message.html" class="tsd-signature-type" data-tsd-kind="Namespace">waku_message</a><span class="tsd-signature-symbol">.</span><a href="waku_message.WakuMessage.html" class="tsd-signature-type" data-tsd-kind="Class">WakuMessage</a><span class="tsd-signature-symbol">&gt;</span></h4></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li><li class=" tsd-kind-namespace"><a href="../modules/discovery.html">discovery</a></li><li class=" tsd-kind-namespace"><a href="../modules/enr.html">enr</a></li><li class=" tsd-kind-namespace"><a href="../modules/proto.html">proto</a></li><li class=" tsd-kind-namespace"><a href="../modules/utf8.html">utf8</a></li><li class=" tsd-kind-namespace"><a href="../modules/utils.html">utils</a></li><li class=" tsd-kind-namespace"><a href="../modules/waku.html">waku</a></li><li class=" tsd-kind-namespace"><a href="../modules/waku_light_push.html">waku_<wbr/>light_<wbr/>push</a></li><li class="current tsd-kind-namespace"><a href="../modules/waku_message.html">waku_<wbr/>message</a></li><li class=" tsd-kind-namespace"><a href="../modules/waku_relay.html">waku_<wbr/>relay</a></li><li class=" tsd-kind-namespace"><a href="../modules/waku_store.html">waku_<wbr/>store</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class tsd-parent-kind-namespace"><a href="waku_message.WakuMessage.html" class="tsd-kind-icon">Waku<wbr/>Message</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-private"><a href="waku_message.WakuMessage.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#proto" class="tsd-kind-icon">proto</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#contentTopic" class="tsd-kind-icon">content<wbr/>Topic</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#payload" class="tsd-kind-icon">payload</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#payloadAsUtf8" class="tsd-kind-icon">payload<wbr/>As<wbr/>Utf8</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#signature" class="tsd-kind-icon">signature</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#signaturePublicKey" class="tsd-kind-icon">signature<wbr/>Public<wbr/>Key</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#timestamp" class="tsd-kind-icon">timestamp</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#version" class="tsd-kind-icon">version</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="waku_message.WakuMessage.html#encode" class="tsd-kind-icon">encode</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="waku_message.WakuMessage.html#decode" class="tsd-kind-icon">decode</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="waku_message.WakuMessage.html#decodeProto" class="tsd-kind-icon">decode<wbr/>Proto</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="waku_message.WakuMessage.html#fromBytes" class="tsd-kind-icon">from<wbr/>Bytes</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="waku_message.WakuMessage.html#fromUtf8String" class="tsd-kind-icon">from<wbr/>Utf8<wbr/>String</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>