mirror of
https://github.com/logos-messaging/lab.waku.org.git
synced 2026-01-04 06:43:11 +00:00
9618 lines
4.6 MiB
9618 lines
4.6 MiB
/*
|
||
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
||
* This devtool is neither made for production nor for readable output files.
|
||
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
||
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
||
* or disable the default devtool with "devtool: false".
|
||
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
||
*/
|
||
/******/ (() => { // webpackBootstrap
|
||
/******/ var __webpack_modules__ = ({
|
||
|
||
/***/ "./index.js":
|
||
/*!******************!*\
|
||
!*** ./index.js ***!
|
||
\******************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _waku_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/sdk */ \"./node_modules/@waku/sdk/dist/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _waku_noise__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/noise */ \"./node_modules/@waku/noise/dist/index.js\");\n/* harmony import */ var protobufjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! protobufjs */ \"./node_modules/protobufjs/index.js\");\n/* harmony import */ var protobufjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(protobufjs__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var qrcode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! qrcode */ \"./node_modules/qrcode/lib/browser.js\");\n\n\n\n\n\n\n// Protobuf\nconst ProtoMessage = new (protobufjs__WEBPACK_IMPORTED_MODULE_3___default().Type)(\"Message\").add(\n new (protobufjs__WEBPACK_IMPORTED_MODULE_3___default().Field)(\"data\", 3, \"string\")\n);\n\nmain();\n\nasync function main() {\n const ui = initUI();\n ui.waku.connecting();\n\n // Starting the node\n const node = await (0,_waku_sdk__WEBPACK_IMPORTED_MODULE_0__.createLightNode)({ defaultBootstrap: true });\n\n try {\n await node.start();\n await (0,_waku_sdk__WEBPACK_IMPORTED_MODULE_0__.waitForRemotePeer)(node, [\"filter\", \"lightpush\"]);\n\n ui.waku.connected();\n\n const myStaticKey = _waku_noise__WEBPACK_IMPORTED_MODULE_2__.generateX25519KeyPair();\n const urlPairingInfo = getPairingInfoFromURL();\n\n const pairingObj = new _waku_noise__WEBPACK_IMPORTED_MODULE_2__.WakuPairing(\n node.lightPush,\n node.filter,\n myStaticKey,\n urlPairingInfo || new _waku_noise__WEBPACK_IMPORTED_MODULE_2__.ResponderParameters()\n );\n const pExecute = pairingObj.execute(120000); // timeout after 2m\n\n scheduleHandshakeAuthConfirmation(pairingObj, ui);\n\n let sendWakuMessage;\n let listenToWakuMessages;\n\n try {\n ui.handshake.waiting();\n\n if (!urlPairingInfo) {\n const pairingURL = buildPairingURLFromObj(pairingObj);\n ui.shareInfo.setURL(pairingURL);\n ui.shareInfo.renderQR(pairingURL);\n ui.shareInfo.show();\n }\n\n [sendWakuMessage, listenToWakuMessages] = await buildWakuMessage(\n node,\n pExecute\n );\n\n ui.handshake.connected();\n ui.shareInfo.hide();\n } catch (err) {\n ui.handshake.error(err.message);\n ui.hide();\n }\n\n ui.message.display();\n\n const { peerConnection, sendMessage: sendRTCMessage } = initRTC({\n ui,\n onReceive: ui.message.onReceive.bind(ui.message),\n });\n\n peerConnection.onicecandidate = async (event) => {\n if (event.candidate) {\n console.log(\"candidate sent\");\n try {\n ui.rtc.sendingCandidate();\n await sendWakuMessage({\n type: \"candidate\",\n candidate: event.candidate,\n });\n } catch (error) {\n ui.rtc.error(error.message);\n }\n }\n };\n\n const sendOffer = async () => {\n console.log(\"offer sent\");\n ui.rtc.sendingOffer();\n\n try {\n const offer = await peerConnection.createOffer();\n await peerConnection.setLocalDescription(offer);\n\n await sendWakuMessage({\n type: \"offer\",\n offer,\n });\n } catch (error) {\n ui.rtc.error(error.message);\n }\n };\n\n const sendAnswer = async (data) => {\n console.log(\"answer sent\");\n ui.rtc.sendingAnswer();\n try {\n await peerConnection.setRemoteDescription(\n new RTCSessionDescription(data.offer)\n );\n\n const answer = await peerConnection.createAnswer();\n peerConnection.setLocalDescription(answer);\n\n await sendWakuMessage({\n type: \"answer\",\n answer,\n });\n } catch (error) {\n ui.rtc.error(error.message);\n }\n };\n\n const receiveAnswer = async (data) => {\n try {\n console.log(\"answer received\");\n await peerConnection.setRemoteDescription(\n new RTCSessionDescription(data.answer)\n );\n console.log(\"answer saved\");\n\n await sendWakuMessage({\n type: \"ready\",\n text: \"received answer\",\n });\n } catch (error) {\n ui.rtc.error(error.message);\n }\n };\n\n const receiveCandidate = async (data) => {\n try {\n console.log(\"candidate saved\");\n await peerConnection.addIceCandidate(\n new RTCIceCandidate(data.candidate)\n );\n } catch (error) {\n ui.rtc.error(error.message);\n }\n };\n\n const handleWakuMessages = async (data) => {\n if (data.type === \"offer\") {\n await sendAnswer(data);\n }\n\n if (data.type === \"answer\") {\n await receiveAnswer(data);\n }\n\n if (data.type === \"ready\") {\n console.log(\"RTC: partner is\", data.text);\n }\n\n if (data.type === \"candidate\") {\n await receiveCandidate(data);\n }\n };\n\n await listenToWakuMessages(handleWakuMessages);\n ui.message.onSend(sendRTCMessage);\n\n // if we are initiator of Noise handshake\n // let's initiate Web RTC as well\n if (!urlPairingInfo) {\n await sendOffer();\n }\n } catch (err) {\n ui.waku.error(err.message);\n ui.hide();\n }\n}\n\nfunction buildPairingURLFromObj(pairingObj) {\n const pInfo = pairingObj.getPairingInfo();\n\n // Data to encode in the QR code. The qrMessageNametag too to the QR string (separated by )\n const messageNameTagParam = `messageNameTag=${_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.bytesToHex(\n pInfo.qrMessageNameTag\n )}`;\n const qrCodeParam = `qrCode=${encodeURIComponent(pInfo.qrCode)}`;\n\n return `${window.location.href}?${messageNameTagParam}&${qrCodeParam}`;\n}\n\nfunction getPairingInfoFromURL() {\n const urlParams = new URLSearchParams(window.location.search);\n\n const messageNameTag = urlParams.get(\"messageNameTag\");\n const qrCodeString = urlParams.get(\"qrCode\");\n\n if (!(messageNameTag && qrCodeString)) {\n return undefined;\n }\n\n return new _waku_noise__WEBPACK_IMPORTED_MODULE_2__.InitiatorParameters(\n decodeURIComponent(qrCodeString),\n _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.hexToBytes(messageNameTag)\n );\n}\n\nasync function scheduleHandshakeAuthConfirmation(pairingObj, ui) {\n const authCode = await pairingObj.getAuthCode();\n ui.handshake.connecting();\n pairingObj.validateAuthCode(confirm(\"Confirm that authcode is: \" + authCode));\n}\n\nasync function buildWakuMessage(node, noiseExecute) {\n const [encoder, decoder] = await noiseExecute;\n\n const sendMessage = async (message) => {\n let payload = ProtoMessage.create({\n data: JSON.stringify(message),\n });\n payload = ProtoMessage.encode(payload).finish();\n\n return node.lightPush.send(encoder, { payload });\n };\n\n const listenToMessages = async (fn) => {\n return node.filter.subscribe([decoder], ({ payload }) => {\n const { data } = ProtoMessage.decode(payload);\n fn(JSON.parse(data));\n });\n };\n\n return [sendMessage, listenToMessages];\n}\n\nfunction initRTC({ ui, onReceive }) {\n const configuration = {\n iceServers: [{ urls: \"stun:stun.l.google.com:19302\" }],\n };\n const peerConnection = new RTCPeerConnection(configuration);\n const sendChannel = peerConnection.createDataChannel(\"chat\");\n\n let receiveChannel;\n\n sendChannel.onopen = (event) => {\n ui.rtc.ready();\n console.log(\"onopen send\", event);\n };\n\n peerConnection.ondatachannel = (event) => {\n receiveChannel = event.channel;\n\n receiveChannel.onmessage = (event) => {\n onReceive(JSON.parse(event.data));\n };\n\n receiveChannel.onopen = (event) => {\n ui.rtc.ready();\n console.log(\"onopen receive\", event);\n };\n };\n\n const sendMessage = (text, nick) => {\n sendChannel.send(JSON.stringify({ text, nick, timestamp: Date.now() }));\n };\n\n return {\n peerConnection,\n sendChannel,\n receiveChannel,\n sendMessage,\n };\n}\n\nfunction initUI() {\n const messagesList = document.getElementById(\"messages\");\n const nicknameInput = document.getElementById(\"nick-input\");\n const textInput = document.getElementById(\"text-input\");\n const sendButton = document.getElementById(\"send-btn\");\n const chatArea = document.getElementById(\"chat-area\");\n const wakuStatusSpan = document.getElementById(\"waku-status\");\n const handshakeStatusSpan = document.getElementById(\"handshake-status\");\n\n const qrCanvas = document.getElementById(\"qr-canvas\");\n const qrUrlContainer = document.getElementById(\"qr-url-container\");\n const qrUrl = document.getElementById(\"qr-url\");\n const copyURLButton = document.getElementById(\"copy-url\");\n const openTabButton = document.getElementById(\"open-tab\");\n\n const rtcStatus = document.getElementById(\"rtc-status\");\n const connectChat = document.getElementById(\"connect-chat-btn\");\n\n copyURLButton.onclick = () => {\n const copyText = document.getElementById(\"qr-url\"); // need to get it each time otherwise copying does not work\n copyText.select();\n copyText.setSelectionRange(0, 99999);\n navigator.clipboard.writeText(copyText.value);\n };\n\n openTabButton.onclick = () => {\n window.open(qrUrl.value, \"_blank\");\n };\n\n const disableChatUIStateIfNeeded = () => {\n const readyToSend = nicknameInput.value !== \"\";\n textInput.disabled = !readyToSend;\n sendButton.disabled = !readyToSend;\n };\n nicknameInput.onchange = disableChatUIStateIfNeeded;\n nicknameInput.onblur = disableChatUIStateIfNeeded;\n\n return {\n shareInfo: {\n setURL(url) {\n qrUrl.value = url;\n },\n hide() {\n qrUrlContainer.style.display = \"none\";\n },\n show() {\n qrUrlContainer.style.display = \"flex\";\n },\n renderQR(url) {\n qrcode__WEBPACK_IMPORTED_MODULE_4__.toCanvas(qrCanvas, url, (err) => {\n if (err) {\n throw err;\n }\n });\n },\n },\n waku: {\n _val(msg) {\n wakuStatusSpan.innerText = msg;\n },\n _class(name) {\n wakuStatusSpan.className = name;\n },\n connecting() {\n this._val(\"connecting...\");\n this._class(\"progress\");\n },\n connected() {\n this._val(\"connected\");\n this._class(\"success\");\n },\n error(msg) {\n this._val(msg);\n this._class(\"error\");\n },\n },\n handshake: {\n _val(val) {\n handshakeStatusSpan.innerText = val;\n },\n _class(name) {\n handshakeStatusSpan.className = name;\n },\n error(msg) {\n this._val(msg);\n this._class(\"error\");\n },\n waiting() {\n this._val(\"waiting for handshake...\");\n this._class(\"progress\");\n },\n generating() {\n this._val(\"generating QR code...\");\n this._class(\"progress\");\n },\n connecting() {\n this._val(\"executing handshake...\");\n this._class(\"progress\");\n },\n connected() {\n this._val(\"handshake completed!\");\n this._class(\"success\");\n },\n },\n message: {\n _render({ time, text, nick }) {\n messagesList.innerHTML += `\n <li>\n (${nick})\n <strong>${text}</strong>\n <i>[${new Date(time).toISOString()}]</i>\n </li>\n `;\n },\n _status(text, className) {\n sendButton.className = className;\n },\n onReceive(data) {\n const { timestamp, nick, text } = data;\n\n this._render({\n nick,\n time: timestamp,\n text,\n });\n },\n onSend(cb) {\n sendButton.addEventListener(\"click\", async () => {\n try {\n this._status(\"sending...\", \"progress\");\n await cb(textInput.value, nicknameInput.value);\n this._status(\"sent\", \"success\");\n\n this._render({\n time: Date.now(), // a bit different from what receiver will see but for the matter of example is good enough\n text: textInput.value,\n nick: nicknameInput.value,\n });\n textInput.value = \"\";\n } catch (e) {\n this._status(`error: ${e.message}`, \"error\");\n }\n });\n },\n display() {\n chatArea.style.display = \"block\";\n this._status(\"waiting for input\", \"progress\");\n },\n },\n rtc: {\n _val(msg) {\n rtcStatus.innerText = msg;\n },\n _class(name) {\n rtcStatus.className = name;\n },\n sendingOffer() {\n this._val(\"sending offer\");\n this._class(\"progress\");\n },\n sendingAnswer() {\n this._val(\"sending answer\");\n this._class(\"progress\");\n },\n sendingCandidate() {\n this._val(\"sending ice candidate\");\n this._class(\"progress\");\n },\n ready() {\n this._val(\"ready\");\n this._class(\"success\");\n },\n error(msg) {\n this._val(msg);\n this._class(\"error\");\n },\n onConnect(cb) {\n connectChat.addEventListener(\"click\", cb);\n },\n },\n hide() {\n this.shareInfo.hide();\n chatArea.style.display = \"none\";\n },\n };\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@ethersproject/bytes/lib.esm/_version.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/@ethersproject/bytes/lib.esm/_version.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"bytes/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@ethersproject/bytes/lib.esm/_version.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@ethersproject/bytes/lib.esm/index.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@ethersproject/bytes/lib.esm/index.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ arrayify: () => (/* binding */ arrayify),\n/* harmony export */ concat: () => (/* binding */ concat),\n/* harmony export */ hexConcat: () => (/* binding */ hexConcat),\n/* harmony export */ hexDataLength: () => (/* binding */ hexDataLength),\n/* harmony export */ hexDataSlice: () => (/* binding */ hexDataSlice),\n/* harmony export */ hexStripZeros: () => (/* binding */ hexStripZeros),\n/* harmony export */ hexValue: () => (/* binding */ hexValue),\n/* harmony export */ hexZeroPad: () => (/* binding */ hexZeroPad),\n/* harmony export */ hexlify: () => (/* binding */ hexlify),\n/* harmony export */ isBytes: () => (/* binding */ isBytes),\n/* harmony export */ isBytesLike: () => (/* binding */ isBytesLike),\n/* harmony export */ isHexString: () => (/* binding */ isHexString),\n/* harmony export */ joinSignature: () => (/* binding */ joinSignature),\n/* harmony export */ splitSignature: () => (/* binding */ splitSignature),\n/* harmony export */ stripZeros: () => (/* binding */ stripZeros),\n/* harmony export */ zeroPad: () => (/* binding */ zeroPad)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/bytes/lib.esm/_version.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nfunction isInteger(value) {\n return (typeof (value) === \"number\" && value == value && (value % 1) === 0);\n}\nfunction isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0\" + hex;\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nfunction stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nfunction zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nfunction isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nfunction hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof (value) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return (\"0x0\" + value);\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nfunction hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nfunction hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nfunction hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nfunction hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nfunction hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nfunction hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nfunction splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0,\n yParityAndS: \"0x\",\n compact: \"0x\"\n };\n if (isBytesLike(signature)) {\n let bytes = arrayify(signature);\n // Get the r, s and v\n if (bytes.length === 64) {\n // EIP-2098; pull the v from the top bit of s and clear it\n result.v = 27 + (bytes[32] >> 7);\n bytes[32] &= 0x7f;\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n }\n else if (bytes.length === 65) {\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n }\n else {\n logger.throwArgumentError(\"invalid signature string\", \"signature\", signature);\n }\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else {\n const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n result.yParityAndS = result._vs;\n result.compact = result.r + result.yParityAndS.substring(2);\n return result;\n}\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@ethersproject/bytes/lib.esm/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@ethersproject/logger/lib.esm/_version.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@ethersproject/logger/lib.esm/_version.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"logger/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@ethersproject/logger/lib.esm/_version.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@ethersproject/logger/lib.esm/index.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@ethersproject/logger/lib.esm/index.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ErrorCode: () => (/* binding */ ErrorCode),\n/* harmony export */ LogLevel: () => (/* binding */ LogLevel),\n/* harmony export */ Logger: () => (/* binding */ Logger)\n/* harmony export */ });\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/logger/lib.esm/_version.js\");\n\nlet _permanentCensorErrors = false;\nlet _censorErrors = false;\nconst LogLevels = { debug: 1, \"default\": 2, info: 2, warning: 3, error: 4, off: 5 };\nlet _logLevel = LogLevels[\"default\"];\n\nlet _globalLogger = null;\nfunction _checkNormalize() {\n try {\n const missing = [];\n // Make sure all forms of normalization are supported\n [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].forEach((form) => {\n try {\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad normalize\");\n }\n ;\n }\n catch (error) {\n missing.push(form);\n }\n });\n if (missing.length) {\n throw new Error(\"missing \" + missing.join(\", \"));\n }\n if (String.fromCharCode(0xe9).normalize(\"NFD\") !== String.fromCharCode(0x65, 0x0301)) {\n throw new Error(\"broken implementation\");\n }\n }\n catch (error) {\n return error.message;\n }\n return null;\n}\nconst _normalizeError = _checkNormalize();\nvar LogLevel;\n(function (LogLevel) {\n LogLevel[\"DEBUG\"] = \"DEBUG\";\n LogLevel[\"INFO\"] = \"INFO\";\n LogLevel[\"WARNING\"] = \"WARNING\";\n LogLevel[\"ERROR\"] = \"ERROR\";\n LogLevel[\"OFF\"] = \"OFF\";\n})(LogLevel || (LogLevel = {}));\nvar ErrorCode;\n(function (ErrorCode) {\n ///////////////////\n // Generic Errors\n // Unknown Error\n ErrorCode[\"UNKNOWN_ERROR\"] = \"UNKNOWN_ERROR\";\n // Not Implemented\n ErrorCode[\"NOT_IMPLEMENTED\"] = \"NOT_IMPLEMENTED\";\n // Unsupported Operation\n // - operation\n ErrorCode[\"UNSUPPORTED_OPERATION\"] = \"UNSUPPORTED_OPERATION\";\n // Network Error (i.e. Ethereum Network, such as an invalid chain ID)\n // - event (\"noNetwork\" is not re-thrown in provider.ready; otherwise thrown)\n ErrorCode[\"NETWORK_ERROR\"] = \"NETWORK_ERROR\";\n // Some sort of bad response from the server\n ErrorCode[\"SERVER_ERROR\"] = \"SERVER_ERROR\";\n // Timeout\n ErrorCode[\"TIMEOUT\"] = \"TIMEOUT\";\n ///////////////////\n // Operational Errors\n // Buffer Overrun\n ErrorCode[\"BUFFER_OVERRUN\"] = \"BUFFER_OVERRUN\";\n // Numeric Fault\n // - operation: the operation being executed\n // - fault: the reason this faulted\n ErrorCode[\"NUMERIC_FAULT\"] = \"NUMERIC_FAULT\";\n ///////////////////\n // Argument Errors\n // Missing new operator to an object\n // - name: The name of the class\n ErrorCode[\"MISSING_NEW\"] = \"MISSING_NEW\";\n // Invalid argument (e.g. value is incompatible with type) to a function:\n // - argument: The argument name that was invalid\n // - value: The value of the argument\n ErrorCode[\"INVALID_ARGUMENT\"] = \"INVALID_ARGUMENT\";\n // Missing argument to a function:\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"MISSING_ARGUMENT\"] = \"MISSING_ARGUMENT\";\n // Too many arguments\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"UNEXPECTED_ARGUMENT\"] = \"UNEXPECTED_ARGUMENT\";\n ///////////////////\n // Blockchain Errors\n // Call exception\n // - transaction: the transaction\n // - address?: the contract address\n // - args?: The arguments passed into the function\n // - method?: The Solidity method signature\n // - errorSignature?: The EIP848 error signature\n // - errorArgs?: The EIP848 error parameters\n // - reason: The reason (only for EIP848 \"Error(string)\")\n ErrorCode[\"CALL_EXCEPTION\"] = \"CALL_EXCEPTION\";\n // Insufficient funds (< value + gasLimit * gasPrice)\n // - transaction: the transaction attempted\n ErrorCode[\"INSUFFICIENT_FUNDS\"] = \"INSUFFICIENT_FUNDS\";\n // Nonce has already been used\n // - transaction: the transaction attempted\n ErrorCode[\"NONCE_EXPIRED\"] = \"NONCE_EXPIRED\";\n // The replacement fee for the transaction is too low\n // - transaction: the transaction attempted\n ErrorCode[\"REPLACEMENT_UNDERPRICED\"] = \"REPLACEMENT_UNDERPRICED\";\n // The gas limit could not be estimated\n // - transaction: the transaction passed to estimateGas\n ErrorCode[\"UNPREDICTABLE_GAS_LIMIT\"] = \"UNPREDICTABLE_GAS_LIMIT\";\n // The transaction was replaced by one with a higher gas price\n // - reason: \"cancelled\", \"replaced\" or \"repriced\"\n // - cancelled: true if reason == \"cancelled\" or reason == \"replaced\")\n // - hash: original transaction hash\n // - replacement: the full TransactionsResponse for the replacement\n // - receipt: the receipt of the replacement\n ErrorCode[\"TRANSACTION_REPLACED\"] = \"TRANSACTION_REPLACED\";\n ///////////////////\n // Interaction Errors\n // The user rejected the action, such as signing a message or sending\n // a transaction\n ErrorCode[\"ACTION_REJECTED\"] = \"ACTION_REJECTED\";\n})(ErrorCode || (ErrorCode = {}));\n;\nconst HEX = \"0123456789abcdef\";\nclass Logger {\n constructor(version) {\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n value: version,\n writable: false\n });\n }\n _log(logLevel, args) {\n const level = logLevel.toLowerCase();\n if (LogLevels[level] == null) {\n this.throwArgumentError(\"invalid log level name\", \"logLevel\", logLevel);\n }\n if (_logLevel > LogLevels[level]) {\n return;\n }\n console.log.apply(console, args);\n }\n debug(...args) {\n this._log(Logger.levels.DEBUG, args);\n }\n info(...args) {\n this._log(Logger.levels.INFO, args);\n }\n warn(...args) {\n this._log(Logger.levels.WARNING, args);\n }\n makeError(message, code, params) {\n // Errors are being censored\n if (_censorErrors) {\n return this.makeError(\"censored error\", code, {});\n }\n if (!code) {\n code = Logger.errors.UNKNOWN_ERROR;\n }\n if (!params) {\n params = {};\n }\n const messageDetails = [];\n Object.keys(params).forEach((key) => {\n const value = params[key];\n try {\n if (value instanceof Uint8Array) {\n let hex = \"\";\n for (let i = 0; i < value.length; i++) {\n hex += HEX[value[i] >> 4];\n hex += HEX[value[i] & 0x0f];\n }\n messageDetails.push(key + \"=Uint8Array(0x\" + hex + \")\");\n }\n else {\n messageDetails.push(key + \"=\" + JSON.stringify(value));\n }\n }\n catch (error) {\n messageDetails.push(key + \"=\" + JSON.stringify(params[key].toString()));\n }\n });\n messageDetails.push(`code=${code}`);\n messageDetails.push(`version=${this.version}`);\n const reason = message;\n let url = \"\";\n switch (code) {\n case ErrorCode.NUMERIC_FAULT: {\n url = \"NUMERIC_FAULT\";\n const fault = message;\n switch (fault) {\n case \"overflow\":\n case \"underflow\":\n case \"division-by-zero\":\n url += \"-\" + fault;\n break;\n case \"negative-power\":\n case \"negative-width\":\n url += \"-unsupported\";\n break;\n case \"unbound-bitwise-result\":\n url += \"-unbound-result\";\n break;\n }\n break;\n }\n case ErrorCode.CALL_EXCEPTION:\n case ErrorCode.INSUFFICIENT_FUNDS:\n case ErrorCode.MISSING_NEW:\n case ErrorCode.NONCE_EXPIRED:\n case ErrorCode.REPLACEMENT_UNDERPRICED:\n case ErrorCode.TRANSACTION_REPLACED:\n case ErrorCode.UNPREDICTABLE_GAS_LIMIT:\n url = code;\n break;\n }\n if (url) {\n message += \" [ See: https:/\\/links.ethers.org/v5-errors-\" + url + \" ]\";\n }\n if (messageDetails.length) {\n message += \" (\" + messageDetails.join(\", \") + \")\";\n }\n // @TODO: Any??\n const error = new Error(message);\n error.reason = reason;\n error.code = code;\n Object.keys(params).forEach(function (key) {\n error[key] = params[key];\n });\n return error;\n }\n throwError(message, code, params) {\n throw this.makeError(message, code, params);\n }\n throwArgumentError(message, name, value) {\n return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {\n argument: name,\n value: value\n });\n }\n assert(condition, message, code, params) {\n if (!!condition) {\n return;\n }\n this.throwError(message, code, params);\n }\n assertArgument(condition, message, name, value) {\n if (!!condition) {\n return;\n }\n this.throwArgumentError(message, name, value);\n }\n checkNormalize(message) {\n if (message == null) {\n message = \"platform missing String.prototype.normalize\";\n }\n if (_normalizeError) {\n this.throwError(\"platform missing String.prototype.normalize\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"String.prototype.normalize\", form: _normalizeError\n });\n }\n }\n checkSafeUint53(value, message) {\n if (typeof (value) !== \"number\") {\n return;\n }\n if (message == null) {\n message = \"value not safe\";\n }\n if (value < 0 || value >= 0x1fffffffffffff) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"out-of-safe-range\",\n value: value\n });\n }\n if (value % 1) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"non-integer\",\n value: value\n });\n }\n }\n checkArgumentCount(count, expectedCount, message) {\n if (message) {\n message = \": \" + message;\n }\n else {\n message = \"\";\n }\n if (count < expectedCount) {\n this.throwError(\"missing argument\" + message, Logger.errors.MISSING_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n if (count > expectedCount) {\n this.throwError(\"too many arguments\" + message, Logger.errors.UNEXPECTED_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n }\n checkNew(target, kind) {\n if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n checkAbstract(target, kind) {\n if (target === kind) {\n this.throwError(\"cannot instantiate abstract class \" + JSON.stringify(kind.name) + \" directly; use a sub-class\", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: \"new\" });\n }\n else if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n static globalLogger() {\n if (!_globalLogger) {\n _globalLogger = new Logger(_version__WEBPACK_IMPORTED_MODULE_0__.version);\n }\n return _globalLogger;\n }\n static setCensorship(censorship, permanent) {\n if (!censorship && permanent) {\n this.globalLogger().throwError(\"cannot permanently disable censorship\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n if (_permanentCensorErrors) {\n if (!censorship) {\n return;\n }\n this.globalLogger().throwError(\"error censorship permanent\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n _censorErrors = !!censorship;\n _permanentCensorErrors = !!permanent;\n }\n static setLogLevel(logLevel) {\n const level = LogLevels[logLevel.toLowerCase()];\n if (level == null) {\n Logger.globalLogger().warn(\"invalid log level - \" + logLevel);\n return;\n }\n _logLevel = level;\n }\n static from(version) {\n return new Logger(version);\n }\n}\nLogger.errors = ErrorCode;\nLogger.levels = LogLevel;\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@ethersproject/logger/lib.esm/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@ethersproject/rlp/lib.esm/_version.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@ethersproject/rlp/lib.esm/_version.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"rlp/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@ethersproject/rlp/lib.esm/_version.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@ethersproject/rlp/lib.esm/index.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@ethersproject/rlp/lib.esm/index.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/rlp/lib.esm/_version.js\");\n\n//See: https://github.com/ethereum/wiki/wiki/RLP\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction arrayifyInteger(value) {\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n let result = 0;\n for (let i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n let payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.isBytesLike)(object)) {\n logger.throwArgumentError(\"RLP object must be BytesLike\", \"object\", object);\n }\n const data = Array.prototype.slice.call((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(object));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nfunction encode(object) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(_encode(object));\n}\nfunction _decodeChildren(data, offset, childOffset, length) {\n const result = [];\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n if (childOffset > offset + 1 + length) {\n logger.throwError(\"child data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n }\n return { consumed: (1 + length), result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n if (data.length === 0) {\n logger.throwError(\"data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data short segment too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data long segment too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: (1 + lengthLength + length), result: result };\n }\n else if (data[offset] >= 0x80) {\n const length = data[offset] - 0x80;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data.slice(offset + 1, offset + 1 + length));\n return { consumed: (1 + length), result: result };\n }\n return { consumed: 1, result: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data[offset]) };\n}\nfunction decode(data) {\n const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(data);\n const decoded = _decode(bytes, 0);\n if (decoded.consumed !== bytes.length) {\n logger.throwArgumentError(\"invalid rlp data\", \"data\", data);\n }\n return decoded.result;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@ethersproject/rlp/lib.esm/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@protobufjs/aspromise/index.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/@protobufjs/aspromise/index.js ***!
|
||
\*****************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@protobufjs/aspromise/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@protobufjs/base64/index.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@protobufjs/base64/index.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@protobufjs/base64/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@protobufjs/codegen/index.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/@protobufjs/codegen/index.js ***!
|
||
\***************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\r\nmodule.exports = codegen;\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @param {string[]} functionParams Function parameter names\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n */\r\nfunction codegen(functionParams, functionName) {\r\n\r\n /* istanbul ignore if */\r\n if (typeof functionParams === \"string\") {\r\n functionName = functionParams;\r\n functionParams = undefined;\r\n }\r\n\r\n var body = [];\r\n\r\n /**\r\n * Appends code to the function's body or finishes generation.\r\n * @typedef Codegen\r\n * @type {function}\r\n * @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any\r\n * @param {...*} [formatParams] Format parameters\r\n * @returns {Codegen|Function} Itself or the generated function if finished\r\n * @throws {Error} If format parameter counts do not match\r\n */\r\n\r\n function Codegen(formatStringOrScope) {\r\n // note that explicit array handling below makes this ~50% faster\r\n\r\n // finish the function\r\n if (typeof formatStringOrScope !== \"string\") {\r\n var source = toString();\r\n if (codegen.verbose)\r\n console.log(\"codegen: \" + source); // eslint-disable-line no-console\r\n source = \"return \" + source;\r\n if (formatStringOrScope) {\r\n var scopeKeys = Object.keys(formatStringOrScope),\r\n scopeParams = new Array(scopeKeys.length + 1),\r\n scopeValues = new Array(scopeKeys.length),\r\n scopeOffset = 0;\r\n while (scopeOffset < scopeKeys.length) {\r\n scopeParams[scopeOffset] = scopeKeys[scopeOffset];\r\n scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];\r\n }\r\n scopeParams[scopeOffset] = source;\r\n return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func\r\n }\r\n return Function(source)(); // eslint-disable-line no-new-func\r\n }\r\n\r\n // otherwise append to body\r\n var formatParams = new Array(arguments.length - 1),\r\n formatOffset = 0;\r\n while (formatOffset < formatParams.length)\r\n formatParams[formatOffset] = arguments[++formatOffset];\r\n formatOffset = 0;\r\n formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {\r\n var value = formatParams[formatOffset++];\r\n switch ($1) {\r\n case \"d\": case \"f\": return String(Number(value));\r\n case \"i\": return String(Math.floor(value));\r\n case \"j\": return JSON.stringify(value);\r\n case \"s\": return String(value);\r\n }\r\n return \"%\";\r\n });\r\n if (formatOffset !== formatParams.length)\r\n throw Error(\"parameter count mismatch\");\r\n body.push(formatStringOrScope);\r\n return Codegen;\r\n }\r\n\r\n function toString(functionNameOverride) {\r\n return \"function \" + (functionNameOverride || functionName || \"\") + \"(\" + (functionParams && functionParams.join(\",\") || \"\") + \"){\\n \" + body.join(\"\\n \") + \"\\n}\";\r\n }\r\n\r\n Codegen.toString = toString;\r\n return Codegen;\r\n}\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @function codegen\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * When set to `true`, codegen will log generated code to console. Useful for debugging.\r\n * @name util.codegen.verbose\r\n * @type {boolean}\r\n */\r\ncodegen.verbose = false;\r\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@protobufjs/codegen/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@protobufjs/eventemitter/index.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/@protobufjs/eventemitter/index.js ***!
|
||
\********************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.<string,*>}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@protobufjs/eventemitter/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@protobufjs/fetch/index.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/@protobufjs/fetch/index.js ***!
|
||
\*************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\r\nmodule.exports = fetch;\r\n\r\nvar asPromise = __webpack_require__(/*! @protobufjs/aspromise */ \"./node_modules/@protobufjs/aspromise/index.js\"),\r\n inquire = __webpack_require__(/*! @protobufjs/inquire */ \"./node_modules/@protobufjs/inquire/index.js\");\r\n\r\nvar fs = inquire(\"fs\");\r\n\r\n/**\r\n * Node-style callback as used by {@link util.fetch}.\r\n * @typedef FetchCallback\r\n * @type {function}\r\n * @param {?Error} error Error, if any, otherwise `null`\r\n * @param {string} [contents] File contents, if there hasn't been an error\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Options as used by {@link util.fetch}.\r\n * @typedef FetchOptions\r\n * @type {Object}\r\n * @property {boolean} [binary=false] Whether expecting a binary response\r\n * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @memberof util\r\n * @param {string} filename File path or url\r\n * @param {FetchOptions} options Fetch options\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n */\r\nfunction fetch(filename, options, callback) {\r\n if (typeof options === \"function\") {\r\n callback = options;\r\n options = {};\r\n } else if (!options)\r\n options = {};\r\n\r\n if (!callback)\r\n return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this\r\n\r\n // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.\r\n if (!options.xhr && fs && fs.readFile)\r\n return fs.readFile(filename, function fetchReadFileCallback(err, contents) {\r\n return err && typeof XMLHttpRequest !== \"undefined\"\r\n ? fetch.xhr(filename, options, callback)\r\n : err\r\n ? callback(err)\r\n : callback(null, options.binary ? contents : contents.toString(\"utf8\"));\r\n });\r\n\r\n // use the XHR version otherwise.\r\n return fetch.xhr(filename, options, callback);\r\n}\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchOptions} [options] Fetch options\r\n * @returns {Promise<string|Uint8Array>} Promise\r\n * @variation 3\r\n */\r\n\r\n/**/\r\nfetch.xhr = function fetch_xhr(filename, options, callback) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {\r\n\r\n if (xhr.readyState !== 4)\r\n return undefined;\r\n\r\n // local cors security errors return status 0 / empty string, too. afaik this cannot be\r\n // reliably distinguished from an actually empty file for security reasons. feel free\r\n // to send a pull request if you are aware of a solution.\r\n if (xhr.status !== 0 && xhr.status !== 200)\r\n return callback(Error(\"status \" + xhr.status));\r\n\r\n // if binary data is expected, make sure that some sort of array is returned, even if\r\n // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.\r\n if (options.binary) {\r\n var buffer = xhr.response;\r\n if (!buffer) {\r\n buffer = [];\r\n for (var i = 0; i < xhr.responseText.length; ++i)\r\n buffer.push(xhr.responseText.charCodeAt(i) & 255);\r\n }\r\n return callback(null, typeof Uint8Array !== \"undefined\" ? new Uint8Array(buffer) : buffer);\r\n }\r\n return callback(null, xhr.responseText);\r\n };\r\n\r\n if (options.binary) {\r\n // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers\r\n if (\"overrideMimeType\" in xhr)\r\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\r\n xhr.responseType = \"arraybuffer\";\r\n }\r\n\r\n xhr.open(\"GET\", filename);\r\n xhr.send();\r\n};\r\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@protobufjs/fetch/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@protobufjs/float/index.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/@protobufjs/float/index.js ***!
|
||
\*************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@protobufjs/float/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@protobufjs/inquire/index.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/@protobufjs/inquire/index.js ***!
|
||
\***************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@protobufjs/inquire/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@protobufjs/path/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@protobufjs/path/index.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("\r\n\r\n/**\r\n * A minimal path module to resolve Unix, Windows and URL paths alike.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar path = exports;\r\n\r\nvar isAbsolute =\r\n/**\r\n * Tests if the specified path is absolute.\r\n * @param {string} path Path to test\r\n * @returns {boolean} `true` if path is absolute\r\n */\r\npath.isAbsolute = function isAbsolute(path) {\r\n return /^(?:\\/|\\w+:)/.test(path);\r\n};\r\n\r\nvar normalize =\r\n/**\r\n * Normalizes the specified path.\r\n * @param {string} path Path to normalize\r\n * @returns {string} Normalized path\r\n */\r\npath.normalize = function normalize(path) {\r\n path = path.replace(/\\\\/g, \"/\")\r\n .replace(/\\/{2,}/g, \"/\");\r\n var parts = path.split(\"/\"),\r\n absolute = isAbsolute(path),\r\n prefix = \"\";\r\n if (absolute)\r\n prefix = parts.shift() + \"/\";\r\n for (var i = 0; i < parts.length;) {\r\n if (parts[i] === \"..\") {\r\n if (i > 0 && parts[i - 1] !== \"..\")\r\n parts.splice(--i, 2);\r\n else if (absolute)\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n } else if (parts[i] === \".\")\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n return prefix + parts.join(\"/\");\r\n};\r\n\r\n/**\r\n * Resolves the specified include path against the specified origin path.\r\n * @param {string} originPath Path to the origin file\r\n * @param {string} includePath Include path relative to origin path\r\n * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized\r\n * @returns {string} Path to the include file\r\n */\r\npath.resolve = function resolve(originPath, includePath, alreadyNormalized) {\r\n if (!alreadyNormalized)\r\n includePath = normalize(includePath);\r\n if (isAbsolute(includePath))\r\n return includePath;\r\n if (!alreadyNormalized)\r\n originPath = normalize(originPath);\r\n return (originPath = originPath.replace(/(?:\\/|^)[^/]+$/, \"\")).length ? normalize(originPath + \"/\" + includePath) : includePath;\r\n};\r\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@protobufjs/path/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@protobufjs/pool/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@protobufjs/pool/index.js ***!
|
||
\************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@protobufjs/pool/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@protobufjs/utf8/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@protobufjs/utf8/index.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@protobufjs/utf8/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/binary/lib/binary.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@stablelib/binary/lib/binary.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package binary provides functions for encoding and decoding numbers in byte arrays.\n */\nvar int_1 = __webpack_require__(/*! @stablelib/int */ \"./node_modules/@stablelib/int/lib/int.js\");\n// TODO(dchest): add asserts for correct value ranges and array offsets.\n/**\n * Reads 2 bytes from array starting at offset as big-endian\n * signed 16-bit integer and returns it.\n */\nfunction readInt16BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (((array[offset + 0] << 8) | array[offset + 1]) << 16) >> 16;\n}\nexports.readInt16BE = readInt16BE;\n/**\n * Reads 2 bytes from array starting at offset as big-endian\n * unsigned 16-bit integer and returns it.\n */\nfunction readUint16BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset + 0] << 8) | array[offset + 1]) >>> 0;\n}\nexports.readUint16BE = readUint16BE;\n/**\n * Reads 2 bytes from array starting at offset as little-endian\n * signed 16-bit integer and returns it.\n */\nfunction readInt16LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (((array[offset + 1] << 8) | array[offset]) << 16) >> 16;\n}\nexports.readInt16LE = readInt16LE;\n/**\n * Reads 2 bytes from array starting at offset as little-endian\n * unsigned 16-bit integer and returns it.\n */\nfunction readUint16LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset + 1] << 8) | array[offset]) >>> 0;\n}\nexports.readUint16LE = readUint16LE;\n/**\n * Writes 2-byte big-endian representation of 16-bit unsigned\n * value to byte array starting at offset.\n *\n * If byte array is not given, creates a new 2-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint16BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(2); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 8;\n out[offset + 1] = value >>> 0;\n return out;\n}\nexports.writeUint16BE = writeUint16BE;\nexports.writeInt16BE = writeUint16BE;\n/**\n * Writes 2-byte little-endian representation of 16-bit unsigned\n * value to array starting at offset.\n *\n * If byte array is not given, creates a new 2-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint16LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(2); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 0;\n out[offset + 1] = value >>> 8;\n return out;\n}\nexports.writeUint16LE = writeUint16LE;\nexports.writeInt16LE = writeUint16LE;\n/**\n * Reads 4 bytes from array starting at offset as big-endian\n * signed 32-bit integer and returns it.\n */\nfunction readInt32BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (array[offset] << 24) |\n (array[offset + 1] << 16) |\n (array[offset + 2] << 8) |\n array[offset + 3];\n}\nexports.readInt32BE = readInt32BE;\n/**\n * Reads 4 bytes from array starting at offset as big-endian\n * unsigned 32-bit integer and returns it.\n */\nfunction readUint32BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset] << 24) |\n (array[offset + 1] << 16) |\n (array[offset + 2] << 8) |\n array[offset + 3]) >>> 0;\n}\nexports.readUint32BE = readUint32BE;\n/**\n * Reads 4 bytes from array starting at offset as little-endian\n * signed 32-bit integer and returns it.\n */\nfunction readInt32LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (array[offset + 3] << 24) |\n (array[offset + 2] << 16) |\n (array[offset + 1] << 8) |\n array[offset];\n}\nexports.readInt32LE = readInt32LE;\n/**\n * Reads 4 bytes from array starting at offset as little-endian\n * unsigned 32-bit integer and returns it.\n */\nfunction readUint32LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset + 3] << 24) |\n (array[offset + 2] << 16) |\n (array[offset + 1] << 8) |\n array[offset]) >>> 0;\n}\nexports.readUint32LE = readUint32LE;\n/**\n * Writes 4-byte big-endian representation of 32-bit unsigned\n * value to byte array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint32BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 24;\n out[offset + 1] = value >>> 16;\n out[offset + 2] = value >>> 8;\n out[offset + 3] = value >>> 0;\n return out;\n}\nexports.writeUint32BE = writeUint32BE;\nexports.writeInt32BE = writeUint32BE;\n/**\n * Writes 4-byte little-endian representation of 32-bit unsigned\n * value to array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint32LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 0;\n out[offset + 1] = value >>> 8;\n out[offset + 2] = value >>> 16;\n out[offset + 3] = value >>> 24;\n return out;\n}\nexports.writeUint32LE = writeUint32LE;\nexports.writeInt32LE = writeUint32LE;\n/**\n * Reads 8 bytes from array starting at offset as big-endian\n * signed 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports exact\n * numbers in range -9007199254740991 to 9007199254740991.\n * If the number stored in the byte array is outside this range,\n * the result is not exact.\n */\nfunction readInt64BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var hi = readInt32BE(array, offset);\n var lo = readInt32BE(array, offset + 4);\n return hi * 0x100000000 + lo - ((lo >> 31) * 0x100000000);\n}\nexports.readInt64BE = readInt64BE;\n/**\n * Reads 8 bytes from array starting at offset as big-endian\n * unsigned 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports values up to 2^53-1.\n */\nfunction readUint64BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var hi = readUint32BE(array, offset);\n var lo = readUint32BE(array, offset + 4);\n return hi * 0x100000000 + lo;\n}\nexports.readUint64BE = readUint64BE;\n/**\n * Reads 8 bytes from array starting at offset as little-endian\n * signed 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports exact\n * numbers in range -9007199254740991 to 9007199254740991.\n * If the number stored in the byte array is outside this range,\n * the result is not exact.\n */\nfunction readInt64LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var lo = readInt32LE(array, offset);\n var hi = readInt32LE(array, offset + 4);\n return hi * 0x100000000 + lo - ((lo >> 31) * 0x100000000);\n}\nexports.readInt64LE = readInt64LE;\n/**\n * Reads 8 bytes from array starting at offset as little-endian\n * unsigned 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports values up to 2^53-1.\n */\nfunction readUint64LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var lo = readUint32LE(array, offset);\n var hi = readUint32LE(array, offset + 4);\n return hi * 0x100000000 + lo;\n}\nexports.readUint64LE = readUint64LE;\n/**\n * Writes 8-byte big-endian representation of 64-bit unsigned\n * value to byte array starting at offset.\n *\n * Due to JavaScript limitation, supports values up to 2^53-1.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint64BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n writeUint32BE(value / 0x100000000 >>> 0, out, offset);\n writeUint32BE(value >>> 0, out, offset + 4);\n return out;\n}\nexports.writeUint64BE = writeUint64BE;\nexports.writeInt64BE = writeUint64BE;\n/**\n * Writes 8-byte little-endian representation of 64-bit unsigned\n * value to byte array starting at offset.\n *\n * Due to JavaScript limitation, supports values up to 2^53-1.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint64LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n writeUint32LE(value >>> 0, out, offset);\n writeUint32LE(value / 0x100000000 >>> 0, out, offset + 4);\n return out;\n}\nexports.writeUint64LE = writeUint64LE;\nexports.writeInt64LE = writeUint64LE;\n/**\n * Reads bytes from array starting at offset as big-endian\n * unsigned bitLen-bit integer and returns it.\n *\n * Supports bit lengths divisible by 8, up to 48.\n */\nfunction readUintBE(bitLength, array, offset) {\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error(\"readUintBE supports only bitLengths divisible by 8\");\n }\n if (bitLength / 8 > array.length - offset) {\n throw new Error(\"readUintBE: array is too short for the given bitLength\");\n }\n var result = 0;\n var mul = 1;\n for (var i = bitLength / 8 + offset - 1; i >= offset; i--) {\n result += array[i] * mul;\n mul *= 256;\n }\n return result;\n}\nexports.readUintBE = readUintBE;\n/**\n * Reads bytes from array starting at offset as little-endian\n * unsigned bitLen-bit integer and returns it.\n *\n * Supports bit lengths divisible by 8, up to 48.\n */\nfunction readUintLE(bitLength, array, offset) {\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error(\"readUintLE supports only bitLengths divisible by 8\");\n }\n if (bitLength / 8 > array.length - offset) {\n throw new Error(\"readUintLE: array is too short for the given bitLength\");\n }\n var result = 0;\n var mul = 1;\n for (var i = offset; i < offset + bitLength / 8; i++) {\n result += array[i] * mul;\n mul *= 256;\n }\n return result;\n}\nexports.readUintLE = readUintLE;\n/**\n * Writes a big-endian representation of bitLen-bit unsigned\n * value to array starting at offset.\n *\n * Supports bit lengths divisible by 8, up to 48.\n *\n * If byte array is not given, creates a new one.\n *\n * Returns the output byte array.\n */\nfunction writeUintBE(bitLength, value, out, offset) {\n if (out === void 0) { out = new Uint8Array(bitLength / 8); }\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error(\"writeUintBE supports only bitLengths divisible by 8\");\n }\n if (!int_1.isSafeInteger(value)) {\n throw new Error(\"writeUintBE value must be an integer\");\n }\n var div = 1;\n for (var i = bitLength / 8 + offset - 1; i >= offset; i--) {\n out[i] = (value / div) & 0xff;\n div *= 256;\n }\n return out;\n}\nexports.writeUintBE = writeUintBE;\n/**\n * Writes a little-endian representation of bitLen-bit unsigned\n * value to array starting at offset.\n *\n * Supports bit lengths divisible by 8, up to 48.\n *\n * If byte array is not given, creates a new one.\n *\n * Returns the output byte array.\n */\nfunction writeUintLE(bitLength, value, out, offset) {\n if (out === void 0) { out = new Uint8Array(bitLength / 8); }\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error(\"writeUintLE supports only bitLengths divisible by 8\");\n }\n if (!int_1.isSafeInteger(value)) {\n throw new Error(\"writeUintLE value must be an integer\");\n }\n var div = 1;\n for (var i = offset; i < offset + bitLength / 8; i++) {\n out[i] = (value / div) & 0xff;\n div *= 256;\n }\n return out;\n}\nexports.writeUintLE = writeUintLE;\n/**\n * Reads 4 bytes from array starting at offset as big-endian\n * 32-bit floating-point number and returns it.\n */\nfunction readFloat32BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat32(offset);\n}\nexports.readFloat32BE = readFloat32BE;\n/**\n * Reads 4 bytes from array starting at offset as little-endian\n * 32-bit floating-point number and returns it.\n */\nfunction readFloat32LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat32(offset, true);\n}\nexports.readFloat32LE = readFloat32LE;\n/**\n * Reads 8 bytes from array starting at offset as big-endian\n * 64-bit floating-point number (\"double\") and returns it.\n */\nfunction readFloat64BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat64(offset);\n}\nexports.readFloat64BE = readFloat64BE;\n/**\n * Reads 8 bytes from array starting at offset as little-endian\n * 64-bit floating-point number (\"double\") and returns it.\n */\nfunction readFloat64LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat64(offset, true);\n}\nexports.readFloat64LE = readFloat64LE;\n/**\n * Writes 4-byte big-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat32BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat32(offset, value);\n return out;\n}\nexports.writeFloat32BE = writeFloat32BE;\n/**\n * Writes 4-byte little-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat32LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat32(offset, value, true);\n return out;\n}\nexports.writeFloat32LE = writeFloat32LE;\n/**\n * Writes 8-byte big-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat64BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat64(offset, value);\n return out;\n}\nexports.writeFloat64BE = writeFloat64BE;\n/**\n * Writes 8-byte little-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat64LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat64(offset, value, true);\n return out;\n}\nexports.writeFloat64LE = writeFloat64LE;\n//# sourceMappingURL=binary.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/binary/lib/binary.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/chacha/lib/chacha.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@stablelib/chacha/lib/chacha.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package chacha implements ChaCha stream cipher.\n */\nvar binary_1 = __webpack_require__(/*! @stablelib/binary */ \"./node_modules/@stablelib/binary/lib/binary.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\n// Number of ChaCha rounds (ChaCha20).\nvar ROUNDS = 20;\n// Applies the ChaCha core function to 16-byte input,\n// 32-byte key key, and puts the result into 64-byte array out.\nfunction core(out, input, key) {\n var j0 = 0x61707865; // \"expa\" -- ChaCha's \"sigma\" constant\n var j1 = 0x3320646E; // \"nd 3\" for 32-byte keys\n var j2 = 0x79622D32; // \"2-by\"\n var j3 = 0x6B206574; // \"te k\"\n var j4 = (key[3] << 24) | (key[2] << 16) | (key[1] << 8) | key[0];\n var j5 = (key[7] << 24) | (key[6] << 16) | (key[5] << 8) | key[4];\n var j6 = (key[11] << 24) | (key[10] << 16) | (key[9] << 8) | key[8];\n var j7 = (key[15] << 24) | (key[14] << 16) | (key[13] << 8) | key[12];\n var j8 = (key[19] << 24) | (key[18] << 16) | (key[17] << 8) | key[16];\n var j9 = (key[23] << 24) | (key[22] << 16) | (key[21] << 8) | key[20];\n var j10 = (key[27] << 24) | (key[26] << 16) | (key[25] << 8) | key[24];\n var j11 = (key[31] << 24) | (key[30] << 16) | (key[29] << 8) | key[28];\n var j12 = (input[3] << 24) | (input[2] << 16) | (input[1] << 8) | input[0];\n var j13 = (input[7] << 24) | (input[6] << 16) | (input[5] << 8) | input[4];\n var j14 = (input[11] << 24) | (input[10] << 16) | (input[9] << 8) | input[8];\n var j15 = (input[15] << 24) | (input[14] << 16) | (input[13] << 8) | input[12];\n var x0 = j0;\n var x1 = j1;\n var x2 = j2;\n var x3 = j3;\n var x4 = j4;\n var x5 = j5;\n var x6 = j6;\n var x7 = j7;\n var x8 = j8;\n var x9 = j9;\n var x10 = j10;\n var x11 = j11;\n var x12 = j12;\n var x13 = j13;\n var x14 = j14;\n var x15 = j15;\n for (var i = 0; i < ROUNDS; i += 2) {\n x0 = x0 + x4 | 0;\n x12 ^= x0;\n x12 = x12 >>> (32 - 16) | x12 << 16;\n x8 = x8 + x12 | 0;\n x4 ^= x8;\n x4 = x4 >>> (32 - 12) | x4 << 12;\n x1 = x1 + x5 | 0;\n x13 ^= x1;\n x13 = x13 >>> (32 - 16) | x13 << 16;\n x9 = x9 + x13 | 0;\n x5 ^= x9;\n x5 = x5 >>> (32 - 12) | x5 << 12;\n x2 = x2 + x6 | 0;\n x14 ^= x2;\n x14 = x14 >>> (32 - 16) | x14 << 16;\n x10 = x10 + x14 | 0;\n x6 ^= x10;\n x6 = x6 >>> (32 - 12) | x6 << 12;\n x3 = x3 + x7 | 0;\n x15 ^= x3;\n x15 = x15 >>> (32 - 16) | x15 << 16;\n x11 = x11 + x15 | 0;\n x7 ^= x11;\n x7 = x7 >>> (32 - 12) | x7 << 12;\n x2 = x2 + x6 | 0;\n x14 ^= x2;\n x14 = x14 >>> (32 - 8) | x14 << 8;\n x10 = x10 + x14 | 0;\n x6 ^= x10;\n x6 = x6 >>> (32 - 7) | x6 << 7;\n x3 = x3 + x7 | 0;\n x15 ^= x3;\n x15 = x15 >>> (32 - 8) | x15 << 8;\n x11 = x11 + x15 | 0;\n x7 ^= x11;\n x7 = x7 >>> (32 - 7) | x7 << 7;\n x1 = x1 + x5 | 0;\n x13 ^= x1;\n x13 = x13 >>> (32 - 8) | x13 << 8;\n x9 = x9 + x13 | 0;\n x5 ^= x9;\n x5 = x5 >>> (32 - 7) | x5 << 7;\n x0 = x0 + x4 | 0;\n x12 ^= x0;\n x12 = x12 >>> (32 - 8) | x12 << 8;\n x8 = x8 + x12 | 0;\n x4 ^= x8;\n x4 = x4 >>> (32 - 7) | x4 << 7;\n x0 = x0 + x5 | 0;\n x15 ^= x0;\n x15 = x15 >>> (32 - 16) | x15 << 16;\n x10 = x10 + x15 | 0;\n x5 ^= x10;\n x5 = x5 >>> (32 - 12) | x5 << 12;\n x1 = x1 + x6 | 0;\n x12 ^= x1;\n x12 = x12 >>> (32 - 16) | x12 << 16;\n x11 = x11 + x12 | 0;\n x6 ^= x11;\n x6 = x6 >>> (32 - 12) | x6 << 12;\n x2 = x2 + x7 | 0;\n x13 ^= x2;\n x13 = x13 >>> (32 - 16) | x13 << 16;\n x8 = x8 + x13 | 0;\n x7 ^= x8;\n x7 = x7 >>> (32 - 12) | x7 << 12;\n x3 = x3 + x4 | 0;\n x14 ^= x3;\n x14 = x14 >>> (32 - 16) | x14 << 16;\n x9 = x9 + x14 | 0;\n x4 ^= x9;\n x4 = x4 >>> (32 - 12) | x4 << 12;\n x2 = x2 + x7 | 0;\n x13 ^= x2;\n x13 = x13 >>> (32 - 8) | x13 << 8;\n x8 = x8 + x13 | 0;\n x7 ^= x8;\n x7 = x7 >>> (32 - 7) | x7 << 7;\n x3 = x3 + x4 | 0;\n x14 ^= x3;\n x14 = x14 >>> (32 - 8) | x14 << 8;\n x9 = x9 + x14 | 0;\n x4 ^= x9;\n x4 = x4 >>> (32 - 7) | x4 << 7;\n x1 = x1 + x6 | 0;\n x12 ^= x1;\n x12 = x12 >>> (32 - 8) | x12 << 8;\n x11 = x11 + x12 | 0;\n x6 ^= x11;\n x6 = x6 >>> (32 - 7) | x6 << 7;\n x0 = x0 + x5 | 0;\n x15 ^= x0;\n x15 = x15 >>> (32 - 8) | x15 << 8;\n x10 = x10 + x15 | 0;\n x5 ^= x10;\n x5 = x5 >>> (32 - 7) | x5 << 7;\n }\n binary_1.writeUint32LE(x0 + j0 | 0, out, 0);\n binary_1.writeUint32LE(x1 + j1 | 0, out, 4);\n binary_1.writeUint32LE(x2 + j2 | 0, out, 8);\n binary_1.writeUint32LE(x3 + j3 | 0, out, 12);\n binary_1.writeUint32LE(x4 + j4 | 0, out, 16);\n binary_1.writeUint32LE(x5 + j5 | 0, out, 20);\n binary_1.writeUint32LE(x6 + j6 | 0, out, 24);\n binary_1.writeUint32LE(x7 + j7 | 0, out, 28);\n binary_1.writeUint32LE(x8 + j8 | 0, out, 32);\n binary_1.writeUint32LE(x9 + j9 | 0, out, 36);\n binary_1.writeUint32LE(x10 + j10 | 0, out, 40);\n binary_1.writeUint32LE(x11 + j11 | 0, out, 44);\n binary_1.writeUint32LE(x12 + j12 | 0, out, 48);\n binary_1.writeUint32LE(x13 + j13 | 0, out, 52);\n binary_1.writeUint32LE(x14 + j14 | 0, out, 56);\n binary_1.writeUint32LE(x15 + j15 | 0, out, 60);\n}\n/**\n * Encrypt src with ChaCha20 stream generated for the given 32-byte key and\n * 8-byte (as in original implementation) or 12-byte (as in RFC7539) nonce and\n * write the result into dst and return it.\n *\n * dst and src may be the same, but otherwise must not overlap.\n *\n * If nonce is 12 bytes, users should not encrypt more than 256 GiB with the\n * same key and nonce, otherwise the stream will repeat. The function will\n * throw error if counter overflows to prevent this.\n *\n * If nonce is 8 bytes, the output is practically unlimited (2^70 bytes, which\n * is more than a million petabytes). However, it is not recommended to\n * generate 8-byte nonces randomly, as the chance of collision is high.\n *\n * Never use the same key and nonce to encrypt more than one message.\n *\n * If nonceInplaceCounterLength is not 0, the nonce is assumed to be a 16-byte\n * array with stream counter in first nonceInplaceCounterLength bytes and nonce\n * in the last remaining bytes. The counter will be incremented inplace for\n * each ChaCha block. This is useful if you need to encrypt one stream of data\n * in chunks.\n */\nfunction streamXOR(key, nonce, src, dst, nonceInplaceCounterLength) {\n if (nonceInplaceCounterLength === void 0) { nonceInplaceCounterLength = 0; }\n // We only support 256-bit keys.\n if (key.length !== 32) {\n throw new Error(\"ChaCha: key size must be 32 bytes\");\n }\n if (dst.length < src.length) {\n throw new Error(\"ChaCha: destination is shorter than source\");\n }\n var nc;\n var counterLength;\n if (nonceInplaceCounterLength === 0) {\n if (nonce.length !== 8 && nonce.length !== 12) {\n throw new Error(\"ChaCha nonce must be 8 or 12 bytes\");\n }\n nc = new Uint8Array(16);\n // First counterLength bytes of nc are counter, starting with zero.\n counterLength = nc.length - nonce.length;\n // Last bytes of nc after counterLength are nonce, set them.\n nc.set(nonce, counterLength);\n }\n else {\n if (nonce.length !== 16) {\n throw new Error(\"ChaCha nonce with counter must be 16 bytes\");\n }\n // This will update passed nonce with counter inplace.\n nc = nonce;\n counterLength = nonceInplaceCounterLength;\n }\n // Allocate temporary space for ChaCha block.\n var block = new Uint8Array(64);\n for (var i = 0; i < src.length; i += 64) {\n // Generate a block.\n core(block, nc, key);\n // XOR block bytes with src into dst.\n for (var j = i; j < i + 64 && j < src.length; j++) {\n dst[j] = src[j] ^ block[j - i];\n }\n // Increment counter.\n incrementCounter(nc, 0, counterLength);\n }\n // Cleanup temporary space.\n wipe_1.wipe(block);\n if (nonceInplaceCounterLength === 0) {\n // Cleanup counter.\n wipe_1.wipe(nc);\n }\n return dst;\n}\nexports.streamXOR = streamXOR;\n/**\n * Generate ChaCha20 stream for the given 32-byte key and 8-byte or 12-byte\n * nonce and write it into dst and return it.\n *\n * Never use the same key and nonce to generate more than one stream.\n *\n * If nonceInplaceCounterLength is not 0, it behaves the same with respect to\n * the nonce as described in the streamXOR documentation.\n *\n * stream is like streamXOR with all-zero src.\n */\nfunction stream(key, nonce, dst, nonceInplaceCounterLength) {\n if (nonceInplaceCounterLength === void 0) { nonceInplaceCounterLength = 0; }\n wipe_1.wipe(dst);\n return streamXOR(key, nonce, dst, dst, nonceInplaceCounterLength);\n}\nexports.stream = stream;\nfunction incrementCounter(counter, pos, len) {\n var carry = 1;\n while (len--) {\n carry = carry + (counter[pos] & 0xff) | 0;\n counter[pos] = carry & 0xff;\n carry >>>= 8;\n pos++;\n }\n if (carry > 0) {\n throw new Error(\"ChaCha: counter overflow\");\n }\n}\n//# sourceMappingURL=chacha.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/chacha/lib/chacha.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/chacha20poly1305/lib/chacha20poly1305.js":
|
||
/*!**************************************************************************!*\
|
||
!*** ./node_modules/@stablelib/chacha20poly1305/lib/chacha20poly1305.js ***!
|
||
\**************************************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar chacha_1 = __webpack_require__(/*! @stablelib/chacha */ \"./node_modules/@stablelib/chacha/lib/chacha.js\");\nvar poly1305_1 = __webpack_require__(/*! @stablelib/poly1305 */ \"./node_modules/@stablelib/poly1305/lib/poly1305.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nvar binary_1 = __webpack_require__(/*! @stablelib/binary */ \"./node_modules/@stablelib/binary/lib/binary.js\");\nvar constant_time_1 = __webpack_require__(/*! @stablelib/constant-time */ \"./node_modules/@stablelib/constant-time/lib/constant-time.js\");\nexports.KEY_LENGTH = 32;\nexports.NONCE_LENGTH = 12;\nexports.TAG_LENGTH = 16;\nvar ZEROS = new Uint8Array(16);\n/**\n * ChaCha20-Poly1305 Authenticated Encryption with Associated Data.\n *\n * Defined in RFC7539.\n */\nvar ChaCha20Poly1305 = /** @class */ (function () {\n /**\n * Creates a new instance with the given 32-byte key.\n */\n function ChaCha20Poly1305(key) {\n this.nonceLength = exports.NONCE_LENGTH;\n this.tagLength = exports.TAG_LENGTH;\n if (key.length !== exports.KEY_LENGTH) {\n throw new Error(\"ChaCha20Poly1305 needs 32-byte key\");\n }\n // Copy key.\n this._key = new Uint8Array(key);\n }\n /**\n * Encrypts and authenticates plaintext, authenticates associated data,\n * and returns sealed ciphertext, which includes authentication tag.\n *\n * RFC7539 specifies 12 bytes for nonce. It may be this 12-byte nonce\n * (\"IV\"), or full 16-byte counter (called \"32-bit fixed-common part\")\n * and nonce.\n *\n * If dst is given (it must be the size of plaintext + the size of tag\n * length) the result will be put into it. Dst and plaintext must not\n * overlap.\n */\n ChaCha20Poly1305.prototype.seal = function (nonce, plaintext, associatedData, dst) {\n if (nonce.length > 16) {\n throw new Error(\"ChaCha20Poly1305: incorrect nonce length\");\n }\n // Allocate space for counter, and set nonce as last bytes of it.\n var counter = new Uint8Array(16);\n counter.set(nonce, counter.length - nonce.length);\n // Generate authentication key by taking first 32-bytes of stream.\n // We pass full counter, which has 12-byte nonce and 4-byte block counter,\n // and it will get incremented after generating the block, which is\n // exactly what we need: we only use the first 32 bytes of 64-byte\n // ChaCha block and discard the next 32 bytes.\n var authKey = new Uint8Array(32);\n chacha_1.stream(this._key, counter, authKey, 4);\n // Allocate space for sealed ciphertext.\n var resultLength = plaintext.length + this.tagLength;\n var result;\n if (dst) {\n if (dst.length !== resultLength) {\n throw new Error(\"ChaCha20Poly1305: incorrect destination length\");\n }\n result = dst;\n }\n else {\n result = new Uint8Array(resultLength);\n }\n // Encrypt plaintext.\n chacha_1.streamXOR(this._key, counter, plaintext, result, 4);\n // Authenticate.\n // XXX: can \"simplify\" here: pass full result (which is already padded\n // due to zeroes prepared for tag), and ciphertext length instead of\n // subarray of result.\n this._authenticate(result.subarray(result.length - this.tagLength, result.length), authKey, result.subarray(0, result.length - this.tagLength), associatedData);\n // Cleanup.\n wipe_1.wipe(counter);\n return result;\n };\n /**\n * Authenticates sealed ciphertext (which includes authentication tag) and\n * associated data, decrypts ciphertext and returns decrypted plaintext.\n *\n * RFC7539 specifies 12 bytes for nonce. It may be this 12-byte nonce\n * (\"IV\"), or full 16-byte counter (called \"32-bit fixed-common part\")\n * and nonce.\n *\n * If authentication fails, it returns null.\n *\n * If dst is given (it must be of ciphertext length minus tag length),\n * the result will be put into it. Dst and plaintext must not overlap.\n */\n ChaCha20Poly1305.prototype.open = function (nonce, sealed, associatedData, dst) {\n if (nonce.length > 16) {\n throw new Error(\"ChaCha20Poly1305: incorrect nonce length\");\n }\n // Sealed ciphertext should at least contain tag.\n if (sealed.length < this.tagLength) {\n // TODO(dchest): should we throw here instead?\n return null;\n }\n // Allocate space for counter, and set nonce as last bytes of it.\n var counter = new Uint8Array(16);\n counter.set(nonce, counter.length - nonce.length);\n // Generate authentication key by taking first 32-bytes of stream.\n var authKey = new Uint8Array(32);\n chacha_1.stream(this._key, counter, authKey, 4);\n // Authenticate.\n // XXX: can simplify and avoid allocation: since authenticate()\n // already allocates tag (from Poly1305.digest(), it can return)\n // it instead of copying to calculatedTag. But then in seal()\n // we'll need to copy it.\n var calculatedTag = new Uint8Array(this.tagLength);\n this._authenticate(calculatedTag, authKey, sealed.subarray(0, sealed.length - this.tagLength), associatedData);\n // Constant-time compare tags and return null if they differ.\n if (!constant_time_1.equal(calculatedTag, sealed.subarray(sealed.length - this.tagLength, sealed.length))) {\n return null;\n }\n // Allocate space for decrypted plaintext.\n var resultLength = sealed.length - this.tagLength;\n var result;\n if (dst) {\n if (dst.length !== resultLength) {\n throw new Error(\"ChaCha20Poly1305: incorrect destination length\");\n }\n result = dst;\n }\n else {\n result = new Uint8Array(resultLength);\n }\n // Decrypt.\n chacha_1.streamXOR(this._key, counter, sealed.subarray(0, sealed.length - this.tagLength), result, 4);\n // Cleanup.\n wipe_1.wipe(counter);\n return result;\n };\n ChaCha20Poly1305.prototype.clean = function () {\n wipe_1.wipe(this._key);\n return this;\n };\n ChaCha20Poly1305.prototype._authenticate = function (tagOut, authKey, ciphertext, associatedData) {\n // Initialize Poly1305 with authKey.\n var h = new poly1305_1.Poly1305(authKey);\n // Authenticate padded associated data.\n if (associatedData) {\n h.update(associatedData);\n if (associatedData.length % 16 > 0) {\n h.update(ZEROS.subarray(associatedData.length % 16));\n }\n }\n // Authenticate padded ciphertext.\n h.update(ciphertext);\n if (ciphertext.length % 16 > 0) {\n h.update(ZEROS.subarray(ciphertext.length % 16));\n }\n // Authenticate length of associated data.\n // XXX: can avoid allocation here?\n var length = new Uint8Array(8);\n if (associatedData) {\n binary_1.writeUint64LE(associatedData.length, length);\n }\n h.update(length);\n // Authenticate length of ciphertext.\n binary_1.writeUint64LE(ciphertext.length, length);\n h.update(length);\n // Get tag and copy it into tagOut.\n var tag = h.digest();\n for (var i = 0; i < tag.length; i++) {\n tagOut[i] = tag[i];\n }\n // Cleanup.\n h.clean();\n wipe_1.wipe(tag);\n wipe_1.wipe(length);\n };\n return ChaCha20Poly1305;\n}());\nexports.ChaCha20Poly1305 = ChaCha20Poly1305;\n//# sourceMappingURL=chacha20poly1305.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/chacha20poly1305/lib/chacha20poly1305.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/constant-time/lib/constant-time.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@stablelib/constant-time/lib/constant-time.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package constant-time provides functions for performing algorithmically constant-time operations.\n */\n/**\n * NOTE! Due to the inability to guarantee real constant time evaluation of\n * anything in JavaScript VM, this is module is the best effort.\n */\n/**\n * Returns resultIfOne if subject is 1, or resultIfZero if subject is 0.\n *\n * Supports only 32-bit integers, so resultIfOne or resultIfZero are not\n * integers, they'll be converted to them with bitwise operations.\n */\nfunction select(subject, resultIfOne, resultIfZero) {\n return (~(subject - 1) & resultIfOne) | ((subject - 1) & resultIfZero);\n}\nexports.select = select;\n/**\n * Returns 1 if a <= b, or 0 if not.\n * Arguments must be positive 32-bit integers less than or equal to 2^31 - 1.\n */\nfunction lessOrEqual(a, b) {\n return (((a | 0) - (b | 0) - 1) >>> 31) & 1;\n}\nexports.lessOrEqual = lessOrEqual;\n/**\n * Returns 1 if a and b are of equal length and their contents\n * are equal, or 0 otherwise.\n *\n * Note that unlike in equal(), zero-length inputs are considered\n * the same, so this function will return 1.\n */\nfunction compare(a, b) {\n if (a.length !== b.length) {\n return 0;\n }\n var result = 0;\n for (var i = 0; i < a.length; i++) {\n result |= a[i] ^ b[i];\n }\n return (1 & ((result - 1) >>> 8));\n}\nexports.compare = compare;\n/**\n * Returns true if a and b are of equal non-zero length,\n * and their contents are equal, or false otherwise.\n *\n * Note that unlike in compare() zero-length inputs are considered\n * _not_ equal, so this function will return false.\n */\nfunction equal(a, b) {\n if (a.length === 0 || b.length === 0) {\n return false;\n }\n return compare(a, b) !== 0;\n}\nexports.equal = equal;\n//# sourceMappingURL=constant-time.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/constant-time/lib/constant-time.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/hash/lib/hash.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@stablelib/hash/lib/hash.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nfunction isSerializableHash(h) {\n return (typeof h.saveState !== \"undefined\" &&\n typeof h.restoreState !== \"undefined\" &&\n typeof h.cleanSavedState !== \"undefined\");\n}\nexports.isSerializableHash = isSerializableHash;\n// TODO(dchest): figure out the standardized interface for XOF such as\n// SHAKE and BLAKE2X.\n//# sourceMappingURL=hash.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/hash/lib/hash.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/hkdf/lib/hkdf.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@stablelib/hkdf/lib/hkdf.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar hmac_1 = __webpack_require__(/*! @stablelib/hmac */ \"./node_modules/@stablelib/hmac/lib/hmac.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\n/**\n * HMAC-based Extract-and-Expand Key Derivation Function.\n *\n * Implements HKDF from RFC5869.\n *\n * Expands the given master key with salt and info into\n * a limited stream of key material.\n */\nvar HKDF = /** @class */ (function () {\n /**\n * Create a new HKDF instance for the given hash function\n * with the master key, optional salt, and info.\n *\n * - Master key is a high-entropy secret key (not a password).\n * - Salt is a non-secret random value.\n * - Info is application- and/or context-specific information.\n */\n function HKDF(hash, key, salt, info) {\n if (salt === void 0) { salt = new Uint8Array(0); }\n this._counter = new Uint8Array(1); // starts with zero\n this._hash = hash;\n this._info = info;\n // HKDF-Extract uses salt as HMAC key, and key as data.\n var okm = hmac_1.hmac(this._hash, salt, key);\n // Initialize HMAC for expanding with extracted key.\n this._hmac = new hmac_1.HMAC(hash, okm);\n // Allocate buffer.\n this._buffer = new Uint8Array(this._hmac.digestLength);\n this._bufpos = this._buffer.length;\n }\n // Fill buffer with new block of HKDF-Extract output.\n HKDF.prototype._fillBuffer = function () {\n // Increment counter.\n this._counter[0]++;\n var ctr = this._counter[0];\n // Check if counter overflowed.\n if (ctr === 0) {\n throw new Error(\"hkdf: cannot expand more\");\n }\n // Prepare HMAC instance for new data with old key.\n this._hmac.reset();\n // Hash in previous output if it was generated\n // (i.e. counter is greater than 1).\n if (ctr > 1) {\n this._hmac.update(this._buffer);\n }\n // Hash in info if it exists.\n if (this._info) {\n this._hmac.update(this._info);\n }\n // Hash in the counter.\n this._hmac.update(this._counter);\n // Output result to buffer and clean HMAC instance.\n this._hmac.finish(this._buffer);\n // Reset buffer position.\n this._bufpos = 0;\n };\n /**\n * Expand returns next key material of the given length.\n *\n * It throws if expansion limit is reached (which is\n * 254 digests of the underlying HMAC function).\n */\n HKDF.prototype.expand = function (length) {\n var out = new Uint8Array(length);\n for (var i = 0; i < out.length; i++) {\n if (this._bufpos === this._buffer.length) {\n this._fillBuffer();\n }\n out[i] = this._buffer[this._bufpos++];\n }\n return out;\n };\n HKDF.prototype.clean = function () {\n this._hmac.clean();\n wipe_1.wipe(this._buffer);\n wipe_1.wipe(this._counter);\n this._bufpos = 0;\n };\n return HKDF;\n}());\nexports.HKDF = HKDF;\n// TODO(dchest): maybe implement deriveKey?\n//# sourceMappingURL=hkdf.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/hkdf/lib/hkdf.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/hmac-drbg/lib/hmac-drbg.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@stablelib/hmac-drbg/lib/hmac-drbg.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.HMACDRBG = void 0;\n/**\n * Package hmac-drbg implements NIST's HMAC-based digital random byte generator.\n */\nconst random_1 = __webpack_require__(/*! @stablelib/random */ \"./node_modules/@stablelib/random/lib/random.js\");\nconst hmac_1 = __webpack_require__(/*! @stablelib/hmac */ \"./node_modules/@stablelib/hmac/lib/hmac.js\");\nconst sha256_1 = __webpack_require__(/*! @stablelib/sha256 */ \"./node_modules/@stablelib/sha256/lib/sha256.js\");\nconst wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nconst RESEED_INTERVAL = 255;\nconst MAX_BYTES_PER_REQUEST = 65536;\n/**\n * HMAC_DRBG from NIST SP800 90A.\n * http://csrc.nist.gov/publications/nistpubs/800-90A/SP800-90A.pdf\n */\nclass HMACDRBGInstance {\n constructor(_entropySource, _hash, _personalization, _reseedInterval // set to 0 to disable reseeding (not recommended)\n ) {\n this._entropySource = _entropySource;\n this._hash = _hash;\n this._personalization = _personalization;\n this._reseedInterval = _reseedInterval;\n this._byteZero = new Uint8Array([0x00]);\n this._byteOne = new Uint8Array([0x01]);\n if (!this._entropySource.isAvailable) {\n throw new Error(\"HMACDRBG: entropy source is not available\");\n }\n let h = new this._hash(); // to learn digest length\n this._digestLength = h.digestLength;\n this._K = new Uint8Array(h.digestLength);\n this._V = new Uint8Array(h.digestLength);\n for (let i = 0; i < this._V.length; i++) {\n this._V[i] = 0x01;\n }\n // Initial seed is (entropy || nonce || personalization).\n //\n // Nonce is \"a value with at least (1/2 security_strength) bits\n // of entropy\", ... \"may be acquired from the same source and at\n // the same time as the entropy input\". (8.6.7, p. 22)\n const n = h.digestLength + h.digestLength / 2;\n const initialSeed = new Uint8Array(n + this._personalization.length);\n // Acquire initial entropy and nonce and copy them into initial seed.\n const entropy = this._entropySource.randomBytes(n);\n initialSeed.set(entropy);\n // Copy personalization string.\n initialSeed.set(this._personalization, n);\n this._update(initialSeed);\n this._reseedCounter = 1;\n // Cleanup.\n (0, wipe_1.wipe)(entropy);\n (0, wipe_1.wipe)(initialSeed);\n }\n _reseed() {\n const entropy = this._entropySource.randomBytes(this._digestLength);\n this._update(entropy);\n this._reseedCounter = 1;\n // Cleanup.\n (0, wipe_1.wipe)(entropy);\n }\n _update(data) {\n // K = HMAC (K, V || 0x00 || provided_data)\n let h = new hmac_1.HMAC(this._hash, this._K);\n h.update(this._V);\n h.update(this._byteZero);\n if (data && data.length > 0) {\n h.update(data);\n }\n h.finish(this._K).clean();\n // V = HMAC (K, V)\n h = new hmac_1.HMAC(this._hash, this._K);\n h.update(this._V);\n h.finish(this._V);\n // If (provided_data = Null), then return K and V.\n if (!data || data.length === 0) {\n h.clean();\n return;\n }\n // K = HMAC (K, V || 0x01 || provided_data)\n h.reset();\n h.update(this._V);\n h.update(this._byteOne);\n h.update(data);\n h.finish(this._K).clean();\n // V = HMAC (K, V)\n h = new hmac_1.HMAC(this._hash, this._K);\n h.update(this._V);\n h.finish(this._V).clean();\n }\n _generate(out) {\n if (this._reseedInterval > 0 && this._reseedCounter > this._reseedInterval) {\n this._reseed();\n }\n let h = new hmac_1.HMAC(this._hash, this._K);\n for (let i = 0; i < out.length; i += h.digestLength) {\n h.update(this._V);\n h.finish(this._V);\n h.reset();\n for (let j = i; j < i + h.digestLength && j < out.length; j++) {\n out[j] = this._V[j - i];\n }\n }\n h.clean();\n this._update();\n this._reseedCounter++;\n }\n randomBytes(length) {\n const out = new Uint8Array(length);\n for (let i = 0; i < out.length; i += MAX_BYTES_PER_REQUEST) {\n this._generate(out.subarray(i, i + Math.min(out.length - i, MAX_BYTES_PER_REQUEST)));\n }\n return out;\n }\n}\nclass HMACDRBG {\n constructor(_entropySource = random_1.defaultRandomSource, _hash = sha256_1.SHA256, _personalization = new Uint8Array(0), _reseedInterval = RESEED_INTERVAL // set to 0 to disable reseeding (not recommended)\n ) {\n this._entropySource = _entropySource;\n this._hash = _hash;\n this._personalization = _personalization;\n this._reseedInterval = _reseedInterval;\n }\n get isInstantiated() {\n return this._instance !== undefined;\n }\n get isAvailable() {\n return this._entropySource.isAvailable;\n }\n randomBytes(length) {\n if (!this._instance) {\n this._instance = new HMACDRBGInstance(this._entropySource, this._hash, this._personalization, this._reseedInterval);\n }\n return this._instance.randomBytes(length);\n }\n}\nexports.HMACDRBG = HMACDRBG;\n//# sourceMappingURL=hmac-drbg.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/hmac-drbg/lib/hmac-drbg.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/hmac/lib/hmac.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@stablelib/hmac/lib/hmac.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package hmac implements HMAC algorithm.\n */\nvar hash_1 = __webpack_require__(/*! @stablelib/hash */ \"./node_modules/@stablelib/hash/lib/hash.js\");\nvar constant_time_1 = __webpack_require__(/*! @stablelib/constant-time */ \"./node_modules/@stablelib/constant-time/lib/constant-time.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\n/**\n * HMAC implements hash-based message authentication algorithm.\n */\nvar HMAC = /** @class */ (function () {\n /**\n * Constructs a new HMAC with the given Hash and secret key.\n */\n function HMAC(hash, key) {\n this._finished = false; // true if HMAC was finalized\n // Initialize inner and outer hashes.\n this._inner = new hash();\n this._outer = new hash();\n // Set block and digest sizes for this HMAC\n // instance to values from the hash.\n this.blockSize = this._outer.blockSize;\n this.digestLength = this._outer.digestLength;\n // Pad temporary stores a key (or its hash) padded with zeroes.\n var pad = new Uint8Array(this.blockSize);\n if (key.length > this.blockSize) {\n // If key is bigger than hash block size, it must be\n // hashed and this hash is used as a key instead.\n this._inner.update(key).finish(pad).clean();\n }\n else {\n // Otherwise, copy the key into pad.\n pad.set(key);\n }\n // Now two different keys are derived from padded key\n // by xoring a different byte value to each.\n // To make inner hash key, xor byte 0x36 into pad.\n for (var i = 0; i < pad.length; i++) {\n pad[i] ^= 0x36;\n }\n // Update inner hash with the result.\n this._inner.update(pad);\n // To make outer hash key, xor byte 0x5c into pad.\n // But since we already xored 0x36 there, we must\n // first undo this by xoring it again.\n for (var i = 0; i < pad.length; i++) {\n pad[i] ^= 0x36 ^ 0x5c;\n }\n // Update outer hash with the result.\n this._outer.update(pad);\n // Save states of both hashes, so that we can quickly restore\n // them later in reset() without the need to remember the actual\n // key and perform this initialization again.\n if (hash_1.isSerializableHash(this._inner) && hash_1.isSerializableHash(this._outer)) {\n this._innerKeyedState = this._inner.saveState();\n this._outerKeyedState = this._outer.saveState();\n }\n // Clean pad.\n wipe_1.wipe(pad);\n }\n /**\n * Returns HMAC state to the state initialized with key\n * to make it possible to run HMAC over the other data with the same\n * key without creating a new instance.\n */\n HMAC.prototype.reset = function () {\n if (!hash_1.isSerializableHash(this._inner) || !hash_1.isSerializableHash(this._outer)) {\n throw new Error(\"hmac: can't reset() because hash doesn't implement restoreState()\");\n }\n // Restore keyed states of inner and outer hashes.\n this._inner.restoreState(this._innerKeyedState);\n this._outer.restoreState(this._outerKeyedState);\n this._finished = false;\n return this;\n };\n /**\n * Cleans HMAC state.\n */\n HMAC.prototype.clean = function () {\n if (hash_1.isSerializableHash(this._inner)) {\n this._inner.cleanSavedState(this._innerKeyedState);\n }\n if (hash_1.isSerializableHash(this._outer)) {\n this._outer.cleanSavedState(this._outerKeyedState);\n }\n this._inner.clean();\n this._outer.clean();\n };\n /**\n * Updates state with provided data.\n */\n HMAC.prototype.update = function (data) {\n this._inner.update(data);\n return this;\n };\n /**\n * Finalizes HMAC and puts the result in out.\n */\n HMAC.prototype.finish = function (out) {\n if (this._finished) {\n // If HMAC was finalized, outer hash is also finalized,\n // so it produces the same digest it produced when it\n // was finalized.\n this._outer.finish(out);\n return this;\n }\n // Finalize inner hash and store the result temporarily.\n this._inner.finish(out);\n // Update outer hash with digest of inner hash and and finalize it.\n this._outer.update(out.subarray(0, this.digestLength)).finish(out);\n this._finished = true;\n return this;\n };\n /**\n * Returns the computed message authentication code.\n */\n HMAC.prototype.digest = function () {\n var out = new Uint8Array(this.digestLength);\n this.finish(out);\n return out;\n };\n /**\n * Saves HMAC state.\n * This function is needed for PBKDF2 optimization.\n */\n HMAC.prototype.saveState = function () {\n if (!hash_1.isSerializableHash(this._inner)) {\n throw new Error(\"hmac: can't saveState() because hash doesn't implement it\");\n }\n return this._inner.saveState();\n };\n HMAC.prototype.restoreState = function (savedState) {\n if (!hash_1.isSerializableHash(this._inner) || !hash_1.isSerializableHash(this._outer)) {\n throw new Error(\"hmac: can't restoreState() because hash doesn't implement it\");\n }\n this._inner.restoreState(savedState);\n this._outer.restoreState(this._outerKeyedState);\n this._finished = false;\n return this;\n };\n HMAC.prototype.cleanSavedState = function (savedState) {\n if (!hash_1.isSerializableHash(this._inner)) {\n throw new Error(\"hmac: can't cleanSavedState() because hash doesn't implement it\");\n }\n this._inner.cleanSavedState(savedState);\n };\n return HMAC;\n}());\nexports.HMAC = HMAC;\n/**\n * Returns HMAC using the given hash constructor for the key over data.\n */\nfunction hmac(hash, key, data) {\n var h = new HMAC(hash, key);\n h.update(data);\n var digest = h.digest();\n h.clean();\n return digest;\n}\nexports.hmac = hmac;\n/**\n * Returns true if two HMAC digests are equal.\n * Uses constant-time comparison to avoid leaking timing information.\n *\n * Example:\n *\n * const receivedDigest = ...\n * const realDigest = hmac(SHA256, key, data);\n * if (!equal(receivedDigest, realDigest)) {\n * throw new Error(\"Authentication error\");\n * }\n */\nexports.equal = constant_time_1.equal;\n//# sourceMappingURL=hmac.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/hmac/lib/hmac.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/int/lib/int.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@stablelib/int/lib/int.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package int provides helper functions for integerss.\n */\n// Shim using 16-bit pieces.\nfunction imulShim(a, b) {\n var ah = (a >>> 16) & 0xffff, al = a & 0xffff;\n var bh = (b >>> 16) & 0xffff, bl = b & 0xffff;\n return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);\n}\n/** 32-bit integer multiplication. */\n// Use system Math.imul if available, otherwise use our shim.\nexports.mul = Math.imul || imulShim;\n/** 32-bit integer addition. */\nfunction add(a, b) {\n return (a + b) | 0;\n}\nexports.add = add;\n/** 32-bit integer subtraction. */\nfunction sub(a, b) {\n return (a - b) | 0;\n}\nexports.sub = sub;\n/** 32-bit integer left rotation */\nfunction rotl(x, n) {\n return x << n | x >>> (32 - n);\n}\nexports.rotl = rotl;\n/** 32-bit integer left rotation */\nfunction rotr(x, n) {\n return x << (32 - n) | x >>> n;\n}\nexports.rotr = rotr;\nfunction isIntegerShim(n) {\n return typeof n === \"number\" && isFinite(n) && Math.floor(n) === n;\n}\n/**\n * Returns true if the argument is an integer number.\n *\n * In ES2015, Number.isInteger.\n */\nexports.isInteger = Number.isInteger || isIntegerShim;\n/**\n * Math.pow(2, 53) - 1\n *\n * In ES2015 Number.MAX_SAFE_INTEGER.\n */\nexports.MAX_SAFE_INTEGER = 9007199254740991;\n/**\n * Returns true if the argument is a safe integer number\n * (-MIN_SAFE_INTEGER < number <= MAX_SAFE_INTEGER)\n *\n * In ES2015, Number.isSafeInteger.\n */\nexports.isSafeInteger = function (n) {\n return exports.isInteger(n) && (n >= -exports.MAX_SAFE_INTEGER && n <= exports.MAX_SAFE_INTEGER);\n};\n//# sourceMappingURL=int.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/int/lib/int.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/poly1305/lib/poly1305.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@stablelib/poly1305/lib/poly1305.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package poly1305 implements Poly1305 one-time message authentication algorithm.\n */\nvar constant_time_1 = __webpack_require__(/*! @stablelib/constant-time */ \"./node_modules/@stablelib/constant-time/lib/constant-time.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nexports.DIGEST_LENGTH = 16;\n// Port of Andrew Moon's Poly1305-donna-16. Public domain.\n// https://github.com/floodyberry/poly1305-donna\n/**\n * Poly1305 computes 16-byte authenticator of message using\n * a one-time 32-byte key.\n *\n * Important: key should be used for only one message,\n * it should never repeat.\n */\nvar Poly1305 = /** @class */ (function () {\n function Poly1305(key) {\n this.digestLength = exports.DIGEST_LENGTH;\n this._buffer = new Uint8Array(16);\n this._r = new Uint16Array(10);\n this._h = new Uint16Array(10);\n this._pad = new Uint16Array(8);\n this._leftover = 0;\n this._fin = 0;\n this._finished = false;\n var t0 = key[0] | key[1] << 8;\n this._r[0] = (t0) & 0x1fff;\n var t1 = key[2] | key[3] << 8;\n this._r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n var t2 = key[4] | key[5] << 8;\n this._r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;\n var t3 = key[6] | key[7] << 8;\n this._r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n var t4 = key[8] | key[9] << 8;\n this._r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;\n this._r[5] = ((t4 >>> 1)) & 0x1ffe;\n var t5 = key[10] | key[11] << 8;\n this._r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n var t6 = key[12] | key[13] << 8;\n this._r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;\n var t7 = key[14] | key[15] << 8;\n this._r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n this._r[9] = ((t7 >>> 5)) & 0x007f;\n this._pad[0] = key[16] | key[17] << 8;\n this._pad[1] = key[18] | key[19] << 8;\n this._pad[2] = key[20] | key[21] << 8;\n this._pad[3] = key[22] | key[23] << 8;\n this._pad[4] = key[24] | key[25] << 8;\n this._pad[5] = key[26] | key[27] << 8;\n this._pad[6] = key[28] | key[29] << 8;\n this._pad[7] = key[30] | key[31] << 8;\n }\n Poly1305.prototype._blocks = function (m, mpos, bytes) {\n var hibit = this._fin ? 0 : 1 << 11;\n var h0 = this._h[0], h1 = this._h[1], h2 = this._h[2], h3 = this._h[3], h4 = this._h[4], h5 = this._h[5], h6 = this._h[6], h7 = this._h[7], h8 = this._h[8], h9 = this._h[9];\n var r0 = this._r[0], r1 = this._r[1], r2 = this._r[2], r3 = this._r[3], r4 = this._r[4], r5 = this._r[5], r6 = this._r[6], r7 = this._r[7], r8 = this._r[8], r9 = this._r[9];\n while (bytes >= 16) {\n var t0 = m[mpos + 0] | m[mpos + 1] << 8;\n h0 += (t0) & 0x1fff;\n var t1 = m[mpos + 2] | m[mpos + 3] << 8;\n h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n var t2 = m[mpos + 4] | m[mpos + 5] << 8;\n h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;\n var t3 = m[mpos + 6] | m[mpos + 7] << 8;\n h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n var t4 = m[mpos + 8] | m[mpos + 9] << 8;\n h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;\n h5 += ((t4 >>> 1)) & 0x1fff;\n var t5 = m[mpos + 10] | m[mpos + 11] << 8;\n h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n var t6 = m[mpos + 12] | m[mpos + 13] << 8;\n h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;\n var t7 = m[mpos + 14] | m[mpos + 15] << 8;\n h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n h9 += ((t7 >>> 5)) | hibit;\n var c = 0;\n var d0 = c;\n d0 += h0 * r0;\n d0 += h1 * (5 * r9);\n d0 += h2 * (5 * r8);\n d0 += h3 * (5 * r7);\n d0 += h4 * (5 * r6);\n c = (d0 >>> 13);\n d0 &= 0x1fff;\n d0 += h5 * (5 * r5);\n d0 += h6 * (5 * r4);\n d0 += h7 * (5 * r3);\n d0 += h8 * (5 * r2);\n d0 += h9 * (5 * r1);\n c += (d0 >>> 13);\n d0 &= 0x1fff;\n var d1 = c;\n d1 += h0 * r1;\n d1 += h1 * r0;\n d1 += h2 * (5 * r9);\n d1 += h3 * (5 * r8);\n d1 += h4 * (5 * r7);\n c = (d1 >>> 13);\n d1 &= 0x1fff;\n d1 += h5 * (5 * r6);\n d1 += h6 * (5 * r5);\n d1 += h7 * (5 * r4);\n d1 += h8 * (5 * r3);\n d1 += h9 * (5 * r2);\n c += (d1 >>> 13);\n d1 &= 0x1fff;\n var d2 = c;\n d2 += h0 * r2;\n d2 += h1 * r1;\n d2 += h2 * r0;\n d2 += h3 * (5 * r9);\n d2 += h4 * (5 * r8);\n c = (d2 >>> 13);\n d2 &= 0x1fff;\n d2 += h5 * (5 * r7);\n d2 += h6 * (5 * r6);\n d2 += h7 * (5 * r5);\n d2 += h8 * (5 * r4);\n d2 += h9 * (5 * r3);\n c += (d2 >>> 13);\n d2 &= 0x1fff;\n var d3 = c;\n d3 += h0 * r3;\n d3 += h1 * r2;\n d3 += h2 * r1;\n d3 += h3 * r0;\n d3 += h4 * (5 * r9);\n c = (d3 >>> 13);\n d3 &= 0x1fff;\n d3 += h5 * (5 * r8);\n d3 += h6 * (5 * r7);\n d3 += h7 * (5 * r6);\n d3 += h8 * (5 * r5);\n d3 += h9 * (5 * r4);\n c += (d3 >>> 13);\n d3 &= 0x1fff;\n var d4 = c;\n d4 += h0 * r4;\n d4 += h1 * r3;\n d4 += h2 * r2;\n d4 += h3 * r1;\n d4 += h4 * r0;\n c = (d4 >>> 13);\n d4 &= 0x1fff;\n d4 += h5 * (5 * r9);\n d4 += h6 * (5 * r8);\n d4 += h7 * (5 * r7);\n d4 += h8 * (5 * r6);\n d4 += h9 * (5 * r5);\n c += (d4 >>> 13);\n d4 &= 0x1fff;\n var d5 = c;\n d5 += h0 * r5;\n d5 += h1 * r4;\n d5 += h2 * r3;\n d5 += h3 * r2;\n d5 += h4 * r1;\n c = (d5 >>> 13);\n d5 &= 0x1fff;\n d5 += h5 * r0;\n d5 += h6 * (5 * r9);\n d5 += h7 * (5 * r8);\n d5 += h8 * (5 * r7);\n d5 += h9 * (5 * r6);\n c += (d5 >>> 13);\n d5 &= 0x1fff;\n var d6 = c;\n d6 += h0 * r6;\n d6 += h1 * r5;\n d6 += h2 * r4;\n d6 += h3 * r3;\n d6 += h4 * r2;\n c = (d6 >>> 13);\n d6 &= 0x1fff;\n d6 += h5 * r1;\n d6 += h6 * r0;\n d6 += h7 * (5 * r9);\n d6 += h8 * (5 * r8);\n d6 += h9 * (5 * r7);\n c += (d6 >>> 13);\n d6 &= 0x1fff;\n var d7 = c;\n d7 += h0 * r7;\n d7 += h1 * r6;\n d7 += h2 * r5;\n d7 += h3 * r4;\n d7 += h4 * r3;\n c = (d7 >>> 13);\n d7 &= 0x1fff;\n d7 += h5 * r2;\n d7 += h6 * r1;\n d7 += h7 * r0;\n d7 += h8 * (5 * r9);\n d7 += h9 * (5 * r8);\n c += (d7 >>> 13);\n d7 &= 0x1fff;\n var d8 = c;\n d8 += h0 * r8;\n d8 += h1 * r7;\n d8 += h2 * r6;\n d8 += h3 * r5;\n d8 += h4 * r4;\n c = (d8 >>> 13);\n d8 &= 0x1fff;\n d8 += h5 * r3;\n d8 += h6 * r2;\n d8 += h7 * r1;\n d8 += h8 * r0;\n d8 += h9 * (5 * r9);\n c += (d8 >>> 13);\n d8 &= 0x1fff;\n var d9 = c;\n d9 += h0 * r9;\n d9 += h1 * r8;\n d9 += h2 * r7;\n d9 += h3 * r6;\n d9 += h4 * r5;\n c = (d9 >>> 13);\n d9 &= 0x1fff;\n d9 += h5 * r4;\n d9 += h6 * r3;\n d9 += h7 * r2;\n d9 += h8 * r1;\n d9 += h9 * r0;\n c += (d9 >>> 13);\n d9 &= 0x1fff;\n c = (((c << 2) + c)) | 0;\n c = (c + d0) | 0;\n d0 = c & 0x1fff;\n c = (c >>> 13);\n d1 += c;\n h0 = d0;\n h1 = d1;\n h2 = d2;\n h3 = d3;\n h4 = d4;\n h5 = d5;\n h6 = d6;\n h7 = d7;\n h8 = d8;\n h9 = d9;\n mpos += 16;\n bytes -= 16;\n }\n this._h[0] = h0;\n this._h[1] = h1;\n this._h[2] = h2;\n this._h[3] = h3;\n this._h[4] = h4;\n this._h[5] = h5;\n this._h[6] = h6;\n this._h[7] = h7;\n this._h[8] = h8;\n this._h[9] = h9;\n };\n Poly1305.prototype.finish = function (mac, macpos) {\n if (macpos === void 0) { macpos = 0; }\n var g = new Uint16Array(10);\n var c;\n var mask;\n var f;\n var i;\n if (this._leftover) {\n i = this._leftover;\n this._buffer[i++] = 1;\n for (; i < 16; i++) {\n this._buffer[i] = 0;\n }\n this._fin = 1;\n this._blocks(this._buffer, 0, 16);\n }\n c = this._h[1] >>> 13;\n this._h[1] &= 0x1fff;\n for (i = 2; i < 10; i++) {\n this._h[i] += c;\n c = this._h[i] >>> 13;\n this._h[i] &= 0x1fff;\n }\n this._h[0] += (c * 5);\n c = this._h[0] >>> 13;\n this._h[0] &= 0x1fff;\n this._h[1] += c;\n c = this._h[1] >>> 13;\n this._h[1] &= 0x1fff;\n this._h[2] += c;\n g[0] = this._h[0] + 5;\n c = g[0] >>> 13;\n g[0] &= 0x1fff;\n for (i = 1; i < 10; i++) {\n g[i] = this._h[i] + c;\n c = g[i] >>> 13;\n g[i] &= 0x1fff;\n }\n g[9] -= (1 << 13);\n mask = (c ^ 1) - 1;\n for (i = 0; i < 10; i++) {\n g[i] &= mask;\n }\n mask = ~mask;\n for (i = 0; i < 10; i++) {\n this._h[i] = (this._h[i] & mask) | g[i];\n }\n this._h[0] = ((this._h[0]) | (this._h[1] << 13)) & 0xffff;\n this._h[1] = ((this._h[1] >>> 3) | (this._h[2] << 10)) & 0xffff;\n this._h[2] = ((this._h[2] >>> 6) | (this._h[3] << 7)) & 0xffff;\n this._h[3] = ((this._h[3] >>> 9) | (this._h[4] << 4)) & 0xffff;\n this._h[4] = ((this._h[4] >>> 12) | (this._h[5] << 1) | (this._h[6] << 14)) & 0xffff;\n this._h[5] = ((this._h[6] >>> 2) | (this._h[7] << 11)) & 0xffff;\n this._h[6] = ((this._h[7] >>> 5) | (this._h[8] << 8)) & 0xffff;\n this._h[7] = ((this._h[8] >>> 8) | (this._h[9] << 5)) & 0xffff;\n f = this._h[0] + this._pad[0];\n this._h[0] = f & 0xffff;\n for (i = 1; i < 8; i++) {\n f = (((this._h[i] + this._pad[i]) | 0) + (f >>> 16)) | 0;\n this._h[i] = f & 0xffff;\n }\n mac[macpos + 0] = this._h[0] >>> 0;\n mac[macpos + 1] = this._h[0] >>> 8;\n mac[macpos + 2] = this._h[1] >>> 0;\n mac[macpos + 3] = this._h[1] >>> 8;\n mac[macpos + 4] = this._h[2] >>> 0;\n mac[macpos + 5] = this._h[2] >>> 8;\n mac[macpos + 6] = this._h[3] >>> 0;\n mac[macpos + 7] = this._h[3] >>> 8;\n mac[macpos + 8] = this._h[4] >>> 0;\n mac[macpos + 9] = this._h[4] >>> 8;\n mac[macpos + 10] = this._h[5] >>> 0;\n mac[macpos + 11] = this._h[5] >>> 8;\n mac[macpos + 12] = this._h[6] >>> 0;\n mac[macpos + 13] = this._h[6] >>> 8;\n mac[macpos + 14] = this._h[7] >>> 0;\n mac[macpos + 15] = this._h[7] >>> 8;\n this._finished = true;\n return this;\n };\n Poly1305.prototype.update = function (m) {\n var mpos = 0;\n var bytes = m.length;\n var want;\n if (this._leftover) {\n want = (16 - this._leftover);\n if (want > bytes) {\n want = bytes;\n }\n for (var i = 0; i < want; i++) {\n this._buffer[this._leftover + i] = m[mpos + i];\n }\n bytes -= want;\n mpos += want;\n this._leftover += want;\n if (this._leftover < 16) {\n return this;\n }\n this._blocks(this._buffer, 0, 16);\n this._leftover = 0;\n }\n if (bytes >= 16) {\n want = bytes - (bytes % 16);\n this._blocks(m, mpos, want);\n mpos += want;\n bytes -= want;\n }\n if (bytes) {\n for (var i = 0; i < bytes; i++) {\n this._buffer[this._leftover + i] = m[mpos + i];\n }\n this._leftover += bytes;\n }\n return this;\n };\n Poly1305.prototype.digest = function () {\n // TODO(dchest): it behaves differently than other hashes/HMAC,\n // because it throws when finished — others just return saved result.\n if (this._finished) {\n throw new Error(\"Poly1305 was finished\");\n }\n var mac = new Uint8Array(16);\n this.finish(mac);\n return mac;\n };\n Poly1305.prototype.clean = function () {\n wipe_1.wipe(this._buffer);\n wipe_1.wipe(this._r);\n wipe_1.wipe(this._h);\n wipe_1.wipe(this._pad);\n this._leftover = 0;\n this._fin = 0;\n this._finished = true; // mark as finished even if not\n return this;\n };\n return Poly1305;\n}());\nexports.Poly1305 = Poly1305;\n/**\n * Returns 16-byte authenticator of data using a one-time 32-byte key.\n *\n * Important: key should be used for only one message, it should never repeat.\n */\nfunction oneTimeAuth(key, data) {\n var h = new Poly1305(key);\n h.update(data);\n var digest = h.digest();\n h.clean();\n return digest;\n}\nexports.oneTimeAuth = oneTimeAuth;\n/**\n * Returns true if two authenticators are 16-byte long and equal.\n * Uses contant-time comparison to avoid leaking timing information.\n */\nfunction equal(a, b) {\n if (a.length !== exports.DIGEST_LENGTH || b.length !== exports.DIGEST_LENGTH) {\n return false;\n }\n return constant_time_1.equal(a, b);\n}\nexports.equal = equal;\n//# sourceMappingURL=poly1305.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/poly1305/lib/poly1305.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/random/lib/random.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@stablelib/random/lib/random.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.randomStringForEntropy = exports.randomString = exports.randomUint32 = exports.randomBytes = exports.defaultRandomSource = void 0;\nconst system_1 = __webpack_require__(/*! ./source/system */ \"./node_modules/@stablelib/random/lib/source/system.js\");\nconst binary_1 = __webpack_require__(/*! @stablelib/binary */ \"./node_modules/@stablelib/binary/lib/binary.js\");\nconst wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nexports.defaultRandomSource = new system_1.SystemRandomSource();\nfunction randomBytes(length, prng = exports.defaultRandomSource) {\n return prng.randomBytes(length);\n}\nexports.randomBytes = randomBytes;\n/**\n * Returns a uniformly random unsigned 32-bit integer.\n */\nfunction randomUint32(prng = exports.defaultRandomSource) {\n // Generate 4-byte random buffer.\n const buf = randomBytes(4, prng);\n // Convert bytes from buffer into a 32-bit integer.\n // It's not important which byte order to use, since\n // the result is random.\n const result = (0, binary_1.readUint32LE)(buf);\n // Clean the buffer.\n (0, wipe_1.wipe)(buf);\n return result;\n}\nexports.randomUint32 = randomUint32;\n/** 62 alphanumeric characters for default charset of randomString() */\nconst ALPHANUMERIC = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n/**\n * Returns a uniform random string of the given length\n * with characters from the given charset.\n *\n * Charset must not have more than 256 characters.\n *\n * Default charset generates case-sensitive alphanumeric\n * strings (0-9, A-Z, a-z).\n */\nfunction randomString(length, charset = ALPHANUMERIC, prng = exports.defaultRandomSource) {\n if (charset.length < 2) {\n throw new Error(\"randomString charset is too short\");\n }\n if (charset.length > 256) {\n throw new Error(\"randomString charset is too long\");\n }\n let out = '';\n const charsLen = charset.length;\n const maxByte = 256 - (256 % charsLen);\n while (length > 0) {\n const buf = randomBytes(Math.ceil(length * 256 / maxByte), prng);\n for (let i = 0; i < buf.length && length > 0; i++) {\n const randomByte = buf[i];\n if (randomByte < maxByte) {\n out += charset.charAt(randomByte % charsLen);\n length--;\n }\n }\n (0, wipe_1.wipe)(buf);\n }\n return out;\n}\nexports.randomString = randomString;\n/**\n * Returns uniform random string containing at least the given\n * number of bits of entropy.\n *\n * For example, randomStringForEntropy(128) will return a 22-character\n * alphanumeric string, while randomStringForEntropy(128, \"0123456789\")\n * will return a 39-character numeric string, both will contain at\n * least 128 bits of entropy.\n *\n * Default charset generates case-sensitive alphanumeric\n * strings (0-9, A-Z, a-z).\n */\nfunction randomStringForEntropy(bits, charset = ALPHANUMERIC, prng = exports.defaultRandomSource) {\n const length = Math.ceil(bits / (Math.log(charset.length) / Math.LN2));\n return randomString(length, charset, prng);\n}\nexports.randomStringForEntropy = randomStringForEntropy;\n//# sourceMappingURL=random.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/random/lib/random.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/random/lib/source/browser.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/@stablelib/random/lib/source/browser.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.BrowserRandomSource = void 0;\nconst QUOTA = 65536;\nclass BrowserRandomSource {\n constructor() {\n this.isAvailable = false;\n this.isInstantiated = false;\n const browserCrypto = typeof self !== 'undefined'\n ? (self.crypto || self.msCrypto) // IE11 has msCrypto\n : null;\n if (browserCrypto && browserCrypto.getRandomValues !== undefined) {\n this._crypto = browserCrypto;\n this.isAvailable = true;\n this.isInstantiated = true;\n }\n }\n randomBytes(length) {\n if (!this.isAvailable || !this._crypto) {\n throw new Error(\"Browser random byte generator is not available.\");\n }\n const out = new Uint8Array(length);\n for (let i = 0; i < out.length; i += QUOTA) {\n this._crypto.getRandomValues(out.subarray(i, i + Math.min(out.length - i, QUOTA)));\n }\n return out;\n }\n}\nexports.BrowserRandomSource = BrowserRandomSource;\n//# sourceMappingURL=browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/random/lib/source/browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/random/lib/source/node.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@stablelib/random/lib/source/node.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.NodeRandomSource = void 0;\nconst wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nclass NodeRandomSource {\n constructor() {\n this.isAvailable = false;\n this.isInstantiated = false;\n if (true) {\n const nodeCrypto = __webpack_require__(/*! crypto */ \"?25ed\");\n if (nodeCrypto && nodeCrypto.randomBytes) {\n this._crypto = nodeCrypto;\n this.isAvailable = true;\n this.isInstantiated = true;\n }\n }\n }\n randomBytes(length) {\n if (!this.isAvailable || !this._crypto) {\n throw new Error(\"Node.js random byte generator is not available.\");\n }\n // Get random bytes (result is Buffer).\n let buffer = this._crypto.randomBytes(length);\n // Make sure we got the length that we requested.\n if (buffer.length !== length) {\n throw new Error(\"NodeRandomSource: got fewer bytes than requested\");\n }\n // Allocate output array.\n const out = new Uint8Array(length);\n // Copy bytes from buffer to output.\n for (let i = 0; i < out.length; i++) {\n out[i] = buffer[i];\n }\n // Cleanup.\n (0, wipe_1.wipe)(buffer);\n return out;\n }\n}\nexports.NodeRandomSource = NodeRandomSource;\n//# sourceMappingURL=node.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/random/lib/source/node.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/random/lib/source/system.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@stablelib/random/lib/source/system.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.SystemRandomSource = void 0;\nconst browser_1 = __webpack_require__(/*! ./browser */ \"./node_modules/@stablelib/random/lib/source/browser.js\");\nconst node_1 = __webpack_require__(/*! ./node */ \"./node_modules/@stablelib/random/lib/source/node.js\");\nclass SystemRandomSource {\n constructor() {\n this.isAvailable = false;\n this.name = \"\";\n // Try browser.\n this._source = new browser_1.BrowserRandomSource();\n if (this._source.isAvailable) {\n this.isAvailable = true;\n this.name = \"Browser\";\n return;\n }\n // If no browser source, try Node.\n this._source = new node_1.NodeRandomSource();\n if (this._source.isAvailable) {\n this.isAvailable = true;\n this.name = \"Node\";\n return;\n }\n // No sources, we're out of options.\n }\n randomBytes(length) {\n if (!this.isAvailable) {\n throw new Error(\"System random byte generator is not available.\");\n }\n return this._source.randomBytes(length);\n }\n}\nexports.SystemRandomSource = SystemRandomSource;\n//# sourceMappingURL=system.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/random/lib/source/system.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/sha256/lib/sha256.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@stablelib/sha256/lib/sha256.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar binary_1 = __webpack_require__(/*! @stablelib/binary */ \"./node_modules/@stablelib/binary/lib/binary.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nexports.DIGEST_LENGTH = 32;\nexports.BLOCK_SIZE = 64;\n/**\n * SHA2-256 cryptographic hash algorithm.\n */\nvar SHA256 = /** @class */ (function () {\n function SHA256() {\n /** Length of hash output */\n this.digestLength = exports.DIGEST_LENGTH;\n /** Block size */\n this.blockSize = exports.BLOCK_SIZE;\n // Note: Int32Array is used instead of Uint32Array for performance reasons.\n this._state = new Int32Array(8); // hash state\n this._temp = new Int32Array(64); // temporary state\n this._buffer = new Uint8Array(128); // buffer for data to hash\n this._bufferLength = 0; // number of bytes in buffer\n this._bytesHashed = 0; // number of total bytes hashed\n this._finished = false; // indicates whether the hash was finalized\n this.reset();\n }\n SHA256.prototype._initState = function () {\n this._state[0] = 0x6a09e667;\n this._state[1] = 0xbb67ae85;\n this._state[2] = 0x3c6ef372;\n this._state[3] = 0xa54ff53a;\n this._state[4] = 0x510e527f;\n this._state[5] = 0x9b05688c;\n this._state[6] = 0x1f83d9ab;\n this._state[7] = 0x5be0cd19;\n };\n /**\n * Resets hash state making it possible\n * to re-use this instance to hash other data.\n */\n SHA256.prototype.reset = function () {\n this._initState();\n this._bufferLength = 0;\n this._bytesHashed = 0;\n this._finished = false;\n return this;\n };\n /**\n * Cleans internal buffers and resets hash state.\n */\n SHA256.prototype.clean = function () {\n wipe_1.wipe(this._buffer);\n wipe_1.wipe(this._temp);\n this.reset();\n };\n /**\n * Updates hash state with the given data.\n *\n * Throws error when trying to update already finalized hash:\n * instance must be reset to update it again.\n */\n SHA256.prototype.update = function (data, dataLength) {\n if (dataLength === void 0) { dataLength = data.length; }\n if (this._finished) {\n throw new Error(\"SHA256: can't update because hash was finished.\");\n }\n var dataPos = 0;\n this._bytesHashed += dataLength;\n if (this._bufferLength > 0) {\n while (this._bufferLength < this.blockSize && dataLength > 0) {\n this._buffer[this._bufferLength++] = data[dataPos++];\n dataLength--;\n }\n if (this._bufferLength === this.blockSize) {\n hashBlocks(this._temp, this._state, this._buffer, 0, this.blockSize);\n this._bufferLength = 0;\n }\n }\n if (dataLength >= this.blockSize) {\n dataPos = hashBlocks(this._temp, this._state, data, dataPos, dataLength);\n dataLength %= this.blockSize;\n }\n while (dataLength > 0) {\n this._buffer[this._bufferLength++] = data[dataPos++];\n dataLength--;\n }\n return this;\n };\n /**\n * Finalizes hash state and puts hash into out.\n * If hash was already finalized, puts the same value.\n */\n SHA256.prototype.finish = function (out) {\n if (!this._finished) {\n var bytesHashed = this._bytesHashed;\n var left = this._bufferLength;\n var bitLenHi = (bytesHashed / 0x20000000) | 0;\n var bitLenLo = bytesHashed << 3;\n var padLength = (bytesHashed % 64 < 56) ? 64 : 128;\n this._buffer[left] = 0x80;\n for (var i = left + 1; i < padLength - 8; i++) {\n this._buffer[i] = 0;\n }\n binary_1.writeUint32BE(bitLenHi, this._buffer, padLength - 8);\n binary_1.writeUint32BE(bitLenLo, this._buffer, padLength - 4);\n hashBlocks(this._temp, this._state, this._buffer, 0, padLength);\n this._finished = true;\n }\n for (var i = 0; i < this.digestLength / 4; i++) {\n binary_1.writeUint32BE(this._state[i], out, i * 4);\n }\n return this;\n };\n /**\n * Returns the final hash digest.\n */\n SHA256.prototype.digest = function () {\n var out = new Uint8Array(this.digestLength);\n this.finish(out);\n return out;\n };\n /**\n * Function useful for HMAC/PBKDF2 optimization.\n * Returns hash state to be used with restoreState().\n * Only chain value is saved, not buffers or other\n * state variables.\n */\n SHA256.prototype.saveState = function () {\n if (this._finished) {\n throw new Error(\"SHA256: cannot save finished state\");\n }\n return {\n state: new Int32Array(this._state),\n buffer: this._bufferLength > 0 ? new Uint8Array(this._buffer) : undefined,\n bufferLength: this._bufferLength,\n bytesHashed: this._bytesHashed\n };\n };\n /**\n * Function useful for HMAC/PBKDF2 optimization.\n * Restores state saved by saveState() and sets bytesHashed\n * to the given value.\n */\n SHA256.prototype.restoreState = function (savedState) {\n this._state.set(savedState.state);\n this._bufferLength = savedState.bufferLength;\n if (savedState.buffer) {\n this._buffer.set(savedState.buffer);\n }\n this._bytesHashed = savedState.bytesHashed;\n this._finished = false;\n return this;\n };\n /**\n * Cleans state returned by saveState().\n */\n SHA256.prototype.cleanSavedState = function (savedState) {\n wipe_1.wipe(savedState.state);\n if (savedState.buffer) {\n wipe_1.wipe(savedState.buffer);\n }\n savedState.bufferLength = 0;\n savedState.bytesHashed = 0;\n };\n return SHA256;\n}());\nexports.SHA256 = SHA256;\n// Constants\nvar K = new Int32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,\n 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,\n 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,\n 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,\n 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,\n 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,\n 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,\n 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,\n 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\nfunction hashBlocks(w, v, p, pos, len) {\n while (len >= 64) {\n var a = v[0];\n var b = v[1];\n var c = v[2];\n var d = v[3];\n var e = v[4];\n var f = v[5];\n var g = v[6];\n var h = v[7];\n for (var i = 0; i < 16; i++) {\n var j = pos + i * 4;\n w[i] = binary_1.readUint32BE(p, j);\n }\n for (var i = 16; i < 64; i++) {\n var u = w[i - 2];\n var t1 = (u >>> 17 | u << (32 - 17)) ^ (u >>> 19 | u << (32 - 19)) ^ (u >>> 10);\n u = w[i - 15];\n var t2 = (u >>> 7 | u << (32 - 7)) ^ (u >>> 18 | u << (32 - 18)) ^ (u >>> 3);\n w[i] = (t1 + w[i - 7] | 0) + (t2 + w[i - 16] | 0);\n }\n for (var i = 0; i < 64; i++) {\n var t1 = (((((e >>> 6 | e << (32 - 6)) ^ (e >>> 11 | e << (32 - 11)) ^\n (e >>> 25 | e << (32 - 25))) + ((e & f) ^ (~e & g))) | 0) +\n ((h + ((K[i] + w[i]) | 0)) | 0)) | 0;\n var t2 = (((a >>> 2 | a << (32 - 2)) ^ (a >>> 13 | a << (32 - 13)) ^\n (a >>> 22 | a << (32 - 22))) + ((a & b) ^ (a & c) ^ (b & c))) | 0;\n h = g;\n g = f;\n f = e;\n e = (d + t1) | 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) | 0;\n }\n v[0] += a;\n v[1] += b;\n v[2] += c;\n v[3] += d;\n v[4] += e;\n v[5] += f;\n v[6] += g;\n v[7] += h;\n pos += 64;\n len -= 64;\n }\n return pos;\n}\nfunction hash(data) {\n var h = new SHA256();\n h.update(data);\n var digest = h.digest();\n h.clean();\n return digest;\n}\nexports.hash = hash;\n//# sourceMappingURL=sha256.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/sha256/lib/sha256.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/wipe/lib/wipe.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@stablelib/wipe/lib/wipe.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Sets all values in the given array to zero and returns it.\n *\n * The fact that it sets bytes to zero can be relied on.\n *\n * There is no guarantee that this function makes data disappear from memory,\n * as runtime implementation can, for example, have copying garbage collector\n * that will make copies of sensitive data before we wipe it. Or that an\n * operating system will write our data to swap or sleep image. Another thing\n * is that an optimizing compiler can remove calls to this function or make it\n * no-op. There's nothing we can do with it, so we just do our best and hope\n * that everything will be okay and good will triumph over evil.\n */\nfunction wipe(array) {\n // Right now it's similar to array.fill(0). If it turns\n // out that runtimes optimize this call away, maybe\n // we can try something else.\n for (var i = 0; i < array.length; i++) {\n array[i] = 0;\n }\n return array;\n}\nexports.wipe = wipe;\n//# sourceMappingURL=wipe.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/wipe/lib/wipe.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@stablelib/x25519/lib/x25519.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@stablelib/x25519/lib/x25519.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.sharedKey = exports.generateKeyPair = exports.generateKeyPairFromSeed = exports.scalarMultBase = exports.scalarMult = exports.SHARED_KEY_LENGTH = exports.SECRET_KEY_LENGTH = exports.PUBLIC_KEY_LENGTH = void 0;\n/**\n * Package x25519 implements X25519 key agreement.\n */\nconst random_1 = __webpack_require__(/*! @stablelib/random */ \"./node_modules/@stablelib/random/lib/random.js\");\nconst wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nexports.PUBLIC_KEY_LENGTH = 32;\nexports.SECRET_KEY_LENGTH = 32;\nexports.SHARED_KEY_LENGTH = 32;\n// Returns new zero-filled 16-element GF (Float64Array).\n// If passed an array of numbers, prefills the returned\n// array with them.\n//\n// We use Float64Array, because we need 48-bit numbers\n// for this implementation.\nfunction gf(init) {\n const r = new Float64Array(16);\n if (init) {\n for (let i = 0; i < init.length; i++) {\n r[i] = init[i];\n }\n }\n return r;\n}\n// Base point.\nconst _9 = new Uint8Array(32);\n_9[0] = 9;\nconst _121665 = gf([0xdb41, 1]);\nfunction car25519(o) {\n let c = 1;\n for (let i = 0; i < 16; i++) {\n let v = o[i] + c + 65535;\n c = Math.floor(v / 65536);\n o[i] = v - c * 65536;\n }\n o[0] += c - 1 + 37 * (c - 1);\n}\nfunction sel25519(p, q, b) {\n const c = ~(b - 1);\n for (let i = 0; i < 16; i++) {\n const t = c & (p[i] ^ q[i]);\n p[i] ^= t;\n q[i] ^= t;\n }\n}\nfunction pack25519(o, n) {\n const m = gf();\n const t = gf();\n for (let i = 0; i < 16; i++) {\n t[i] = n[i];\n }\n car25519(t);\n car25519(t);\n car25519(t);\n for (let j = 0; j < 2; j++) {\n m[0] = t[0] - 0xffed;\n for (let i = 1; i < 15; i++) {\n m[i] = t[i] - 0xffff - ((m[i - 1] >> 16) & 1);\n m[i - 1] &= 0xffff;\n }\n m[15] = t[15] - 0x7fff - ((m[14] >> 16) & 1);\n const b = (m[15] >> 16) & 1;\n m[14] &= 0xffff;\n sel25519(t, m, 1 - b);\n }\n for (let i = 0; i < 16; i++) {\n o[2 * i] = t[i] & 0xff;\n o[2 * i + 1] = t[i] >> 8;\n }\n}\nfunction unpack25519(o, n) {\n for (let i = 0; i < 16; i++) {\n o[i] = n[2 * i] + (n[2 * i + 1] << 8);\n }\n o[15] &= 0x7fff;\n}\nfunction add(o, a, b) {\n for (let i = 0; i < 16; i++) {\n o[i] = a[i] + b[i];\n }\n}\nfunction sub(o, a, b) {\n for (let i = 0; i < 16; i++) {\n o[i] = a[i] - b[i];\n }\n}\nfunction mul(o, a, b) {\n let v, c, t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11], b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15];\n v = a[0];\n t0 += v * b0;\n t1 += v * b1;\n t2 += v * b2;\n t3 += v * b3;\n t4 += v * b4;\n t5 += v * b5;\n t6 += v * b6;\n t7 += v * b7;\n t8 += v * b8;\n t9 += v * b9;\n t10 += v * b10;\n t11 += v * b11;\n t12 += v * b12;\n t13 += v * b13;\n t14 += v * b14;\n t15 += v * b15;\n v = a[1];\n t1 += v * b0;\n t2 += v * b1;\n t3 += v * b2;\n t4 += v * b3;\n t5 += v * b4;\n t6 += v * b5;\n t7 += v * b6;\n t8 += v * b7;\n t9 += v * b8;\n t10 += v * b9;\n t11 += v * b10;\n t12 += v * b11;\n t13 += v * b12;\n t14 += v * b13;\n t15 += v * b14;\n t16 += v * b15;\n v = a[2];\n t2 += v * b0;\n t3 += v * b1;\n t4 += v * b2;\n t5 += v * b3;\n t6 += v * b4;\n t7 += v * b5;\n t8 += v * b6;\n t9 += v * b7;\n t10 += v * b8;\n t11 += v * b9;\n t12 += v * b10;\n t13 += v * b11;\n t14 += v * b12;\n t15 += v * b13;\n t16 += v * b14;\n t17 += v * b15;\n v = a[3];\n t3 += v * b0;\n t4 += v * b1;\n t5 += v * b2;\n t6 += v * b3;\n t7 += v * b4;\n t8 += v * b5;\n t9 += v * b6;\n t10 += v * b7;\n t11 += v * b8;\n t12 += v * b9;\n t13 += v * b10;\n t14 += v * b11;\n t15 += v * b12;\n t16 += v * b13;\n t17 += v * b14;\n t18 += v * b15;\n v = a[4];\n t4 += v * b0;\n t5 += v * b1;\n t6 += v * b2;\n t7 += v * b3;\n t8 += v * b4;\n t9 += v * b5;\n t10 += v * b6;\n t11 += v * b7;\n t12 += v * b8;\n t13 += v * b9;\n t14 += v * b10;\n t15 += v * b11;\n t16 += v * b12;\n t17 += v * b13;\n t18 += v * b14;\n t19 += v * b15;\n v = a[5];\n t5 += v * b0;\n t6 += v * b1;\n t7 += v * b2;\n t8 += v * b3;\n t9 += v * b4;\n t10 += v * b5;\n t11 += v * b6;\n t12 += v * b7;\n t13 += v * b8;\n t14 += v * b9;\n t15 += v * b10;\n t16 += v * b11;\n t17 += v * b12;\n t18 += v * b13;\n t19 += v * b14;\n t20 += v * b15;\n v = a[6];\n t6 += v * b0;\n t7 += v * b1;\n t8 += v * b2;\n t9 += v * b3;\n t10 += v * b4;\n t11 += v * b5;\n t12 += v * b6;\n t13 += v * b7;\n t14 += v * b8;\n t15 += v * b9;\n t16 += v * b10;\n t17 += v * b11;\n t18 += v * b12;\n t19 += v * b13;\n t20 += v * b14;\n t21 += v * b15;\n v = a[7];\n t7 += v * b0;\n t8 += v * b1;\n t9 += v * b2;\n t10 += v * b3;\n t11 += v * b4;\n t12 += v * b5;\n t13 += v * b6;\n t14 += v * b7;\n t15 += v * b8;\n t16 += v * b9;\n t17 += v * b10;\n t18 += v * b11;\n t19 += v * b12;\n t20 += v * b13;\n t21 += v * b14;\n t22 += v * b15;\n v = a[8];\n t8 += v * b0;\n t9 += v * b1;\n t10 += v * b2;\n t11 += v * b3;\n t12 += v * b4;\n t13 += v * b5;\n t14 += v * b6;\n t15 += v * b7;\n t16 += v * b8;\n t17 += v * b9;\n t18 += v * b10;\n t19 += v * b11;\n t20 += v * b12;\n t21 += v * b13;\n t22 += v * b14;\n t23 += v * b15;\n v = a[9];\n t9 += v * b0;\n t10 += v * b1;\n t11 += v * b2;\n t12 += v * b3;\n t13 += v * b4;\n t14 += v * b5;\n t15 += v * b6;\n t16 += v * b7;\n t17 += v * b8;\n t18 += v * b9;\n t19 += v * b10;\n t20 += v * b11;\n t21 += v * b12;\n t22 += v * b13;\n t23 += v * b14;\n t24 += v * b15;\n v = a[10];\n t10 += v * b0;\n t11 += v * b1;\n t12 += v * b2;\n t13 += v * b3;\n t14 += v * b4;\n t15 += v * b5;\n t16 += v * b6;\n t17 += v * b7;\n t18 += v * b8;\n t19 += v * b9;\n t20 += v * b10;\n t21 += v * b11;\n t22 += v * b12;\n t23 += v * b13;\n t24 += v * b14;\n t25 += v * b15;\n v = a[11];\n t11 += v * b0;\n t12 += v * b1;\n t13 += v * b2;\n t14 += v * b3;\n t15 += v * b4;\n t16 += v * b5;\n t17 += v * b6;\n t18 += v * b7;\n t19 += v * b8;\n t20 += v * b9;\n t21 += v * b10;\n t22 += v * b11;\n t23 += v * b12;\n t24 += v * b13;\n t25 += v * b14;\n t26 += v * b15;\n v = a[12];\n t12 += v * b0;\n t13 += v * b1;\n t14 += v * b2;\n t15 += v * b3;\n t16 += v * b4;\n t17 += v * b5;\n t18 += v * b6;\n t19 += v * b7;\n t20 += v * b8;\n t21 += v * b9;\n t22 += v * b10;\n t23 += v * b11;\n t24 += v * b12;\n t25 += v * b13;\n t26 += v * b14;\n t27 += v * b15;\n v = a[13];\n t13 += v * b0;\n t14 += v * b1;\n t15 += v * b2;\n t16 += v * b3;\n t17 += v * b4;\n t18 += v * b5;\n t19 += v * b6;\n t20 += v * b7;\n t21 += v * b8;\n t22 += v * b9;\n t23 += v * b10;\n t24 += v * b11;\n t25 += v * b12;\n t26 += v * b13;\n t27 += v * b14;\n t28 += v * b15;\n v = a[14];\n t14 += v * b0;\n t15 += v * b1;\n t16 += v * b2;\n t17 += v * b3;\n t18 += v * b4;\n t19 += v * b5;\n t20 += v * b6;\n t21 += v * b7;\n t22 += v * b8;\n t23 += v * b9;\n t24 += v * b10;\n t25 += v * b11;\n t26 += v * b12;\n t27 += v * b13;\n t28 += v * b14;\n t29 += v * b15;\n v = a[15];\n t15 += v * b0;\n t16 += v * b1;\n t17 += v * b2;\n t18 += v * b3;\n t19 += v * b4;\n t20 += v * b5;\n t21 += v * b6;\n t22 += v * b7;\n t23 += v * b8;\n t24 += v * b9;\n t25 += v * b10;\n t26 += v * b11;\n t27 += v * b12;\n t28 += v * b13;\n t29 += v * b14;\n t30 += v * b15;\n t0 += 38 * t16;\n t1 += 38 * t17;\n t2 += 38 * t18;\n t3 += 38 * t19;\n t4 += 38 * t20;\n t5 += 38 * t21;\n t6 += 38 * t22;\n t7 += 38 * t23;\n t8 += 38 * t24;\n t9 += 38 * t25;\n t10 += 38 * t26;\n t11 += 38 * t27;\n t12 += 38 * t28;\n t13 += 38 * t29;\n t14 += 38 * t30;\n // t15 left as is\n // first car\n c = 1;\n v = t0 + c + 65535;\n c = Math.floor(v / 65536);\n t0 = v - c * 65536;\n v = t1 + c + 65535;\n c = Math.floor(v / 65536);\n t1 = v - c * 65536;\n v = t2 + c + 65535;\n c = Math.floor(v / 65536);\n t2 = v - c * 65536;\n v = t3 + c + 65535;\n c = Math.floor(v / 65536);\n t3 = v - c * 65536;\n v = t4 + c + 65535;\n c = Math.floor(v / 65536);\n t4 = v - c * 65536;\n v = t5 + c + 65535;\n c = Math.floor(v / 65536);\n t5 = v - c * 65536;\n v = t6 + c + 65535;\n c = Math.floor(v / 65536);\n t6 = v - c * 65536;\n v = t7 + c + 65535;\n c = Math.floor(v / 65536);\n t7 = v - c * 65536;\n v = t8 + c + 65535;\n c = Math.floor(v / 65536);\n t8 = v - c * 65536;\n v = t9 + c + 65535;\n c = Math.floor(v / 65536);\n t9 = v - c * 65536;\n v = t10 + c + 65535;\n c = Math.floor(v / 65536);\n t10 = v - c * 65536;\n v = t11 + c + 65535;\n c = Math.floor(v / 65536);\n t11 = v - c * 65536;\n v = t12 + c + 65535;\n c = Math.floor(v / 65536);\n t12 = v - c * 65536;\n v = t13 + c + 65535;\n c = Math.floor(v / 65536);\n t13 = v - c * 65536;\n v = t14 + c + 65535;\n c = Math.floor(v / 65536);\n t14 = v - c * 65536;\n v = t15 + c + 65535;\n c = Math.floor(v / 65536);\n t15 = v - c * 65536;\n t0 += c - 1 + 37 * (c - 1);\n // second car\n c = 1;\n v = t0 + c + 65535;\n c = Math.floor(v / 65536);\n t0 = v - c * 65536;\n v = t1 + c + 65535;\n c = Math.floor(v / 65536);\n t1 = v - c * 65536;\n v = t2 + c + 65535;\n c = Math.floor(v / 65536);\n t2 = v - c * 65536;\n v = t3 + c + 65535;\n c = Math.floor(v / 65536);\n t3 = v - c * 65536;\n v = t4 + c + 65535;\n c = Math.floor(v / 65536);\n t4 = v - c * 65536;\n v = t5 + c + 65535;\n c = Math.floor(v / 65536);\n t5 = v - c * 65536;\n v = t6 + c + 65535;\n c = Math.floor(v / 65536);\n t6 = v - c * 65536;\n v = t7 + c + 65535;\n c = Math.floor(v / 65536);\n t7 = v - c * 65536;\n v = t8 + c + 65535;\n c = Math.floor(v / 65536);\n t8 = v - c * 65536;\n v = t9 + c + 65535;\n c = Math.floor(v / 65536);\n t9 = v - c * 65536;\n v = t10 + c + 65535;\n c = Math.floor(v / 65536);\n t10 = v - c * 65536;\n v = t11 + c + 65535;\n c = Math.floor(v / 65536);\n t11 = v - c * 65536;\n v = t12 + c + 65535;\n c = Math.floor(v / 65536);\n t12 = v - c * 65536;\n v = t13 + c + 65535;\n c = Math.floor(v / 65536);\n t13 = v - c * 65536;\n v = t14 + c + 65535;\n c = Math.floor(v / 65536);\n t14 = v - c * 65536;\n v = t15 + c + 65535;\n c = Math.floor(v / 65536);\n t15 = v - c * 65536;\n t0 += c - 1 + 37 * (c - 1);\n o[0] = t0;\n o[1] = t1;\n o[2] = t2;\n o[3] = t3;\n o[4] = t4;\n o[5] = t5;\n o[6] = t6;\n o[7] = t7;\n o[8] = t8;\n o[9] = t9;\n o[10] = t10;\n o[11] = t11;\n o[12] = t12;\n o[13] = t13;\n o[14] = t14;\n o[15] = t15;\n}\nfunction square(o, a) {\n mul(o, a, a);\n}\nfunction inv25519(o, inp) {\n const c = gf();\n for (let i = 0; i < 16; i++) {\n c[i] = inp[i];\n }\n for (let i = 253; i >= 0; i--) {\n square(c, c);\n if (i !== 2 && i !== 4) {\n mul(c, c, inp);\n }\n }\n for (let i = 0; i < 16; i++) {\n o[i] = c[i];\n }\n}\nfunction scalarMult(n, p) {\n const z = new Uint8Array(32);\n const x = new Float64Array(80);\n const a = gf(), b = gf(), c = gf(), d = gf(), e = gf(), f = gf();\n for (let i = 0; i < 31; i++) {\n z[i] = n[i];\n }\n z[31] = (n[31] & 127) | 64;\n z[0] &= 248;\n unpack25519(x, p);\n for (let i = 0; i < 16; i++) {\n b[i] = x[i];\n }\n a[0] = d[0] = 1;\n for (let i = 254; i >= 0; --i) {\n const r = (z[i >>> 3] >>> (i & 7)) & 1;\n sel25519(a, b, r);\n sel25519(c, d, r);\n add(e, a, c);\n sub(a, a, c);\n add(c, b, d);\n sub(b, b, d);\n square(d, e);\n square(f, a);\n mul(a, c, a);\n mul(c, b, e);\n add(e, a, c);\n sub(a, a, c);\n square(b, a);\n sub(c, d, f);\n mul(a, c, _121665);\n add(a, a, d);\n mul(c, c, a);\n mul(a, d, f);\n mul(d, b, x);\n square(b, e);\n sel25519(a, b, r);\n sel25519(c, d, r);\n }\n for (let i = 0; i < 16; i++) {\n x[i + 16] = a[i];\n x[i + 32] = c[i];\n x[i + 48] = b[i];\n x[i + 64] = d[i];\n }\n const x32 = x.subarray(32);\n const x16 = x.subarray(16);\n inv25519(x32, x32);\n mul(x16, x16, x32);\n const q = new Uint8Array(32);\n pack25519(q, x16);\n return q;\n}\nexports.scalarMult = scalarMult;\nfunction scalarMultBase(n) {\n return scalarMult(n, _9);\n}\nexports.scalarMultBase = scalarMultBase;\nfunction generateKeyPairFromSeed(seed) {\n if (seed.length !== exports.SECRET_KEY_LENGTH) {\n throw new Error(`x25519: seed must be ${exports.SECRET_KEY_LENGTH} bytes`);\n }\n const secretKey = new Uint8Array(seed);\n const publicKey = scalarMultBase(secretKey);\n return {\n publicKey,\n secretKey\n };\n}\nexports.generateKeyPairFromSeed = generateKeyPairFromSeed;\nfunction generateKeyPair(prng) {\n const seed = (0, random_1.randomBytes)(32, prng);\n const result = generateKeyPairFromSeed(seed);\n (0, wipe_1.wipe)(seed);\n return result;\n}\nexports.generateKeyPair = generateKeyPair;\n/**\n * Returns a shared key between our secret key and a peer's public key.\n *\n * Throws an error if the given keys are of wrong length.\n *\n * If rejectZero is true throws if the calculated shared key is all-zero.\n * From RFC 7748:\n *\n * > Protocol designers using Diffie-Hellman over the curves defined in\n * > this document must not assume \"contributory behavior\". Specially,\n * > contributory behavior means that both parties' private keys\n * > contribute to the resulting shared key. Since curve25519 and\n * > curve448 have cofactors of 8 and 4 (respectively), an input point of\n * > small order will eliminate any contribution from the other party's\n * > private key. This situation can be detected by checking for the all-\n * > zero output, which implementations MAY do, as specified in Section 6.\n * > However, a large number of existing implementations do not do this.\n *\n * IMPORTANT: the returned key is a raw result of scalar multiplication.\n * To use it as a key material, hash it with a cryptographic hash function.\n */\nfunction sharedKey(mySecretKey, theirPublicKey, rejectZero = false) {\n if (mySecretKey.length !== exports.PUBLIC_KEY_LENGTH) {\n throw new Error(\"X25519: incorrect secret key length\");\n }\n if (theirPublicKey.length !== exports.PUBLIC_KEY_LENGTH) {\n throw new Error(\"X25519: incorrect public key length\");\n }\n const result = scalarMult(mySecretKey, theirPublicKey);\n if (rejectZero) {\n let zeros = 0;\n for (let i = 0; i < result.length; i++) {\n zeros |= result[i];\n }\n if (zeros === 0) {\n throw new Error(\"X25519: invalid shared key\");\n }\n }\n return result;\n}\nexports.sharedKey = sharedKey;\n//# sourceMappingURL=x25519.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@stablelib/x25519/lib/x25519.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/asn1js/build/index.es.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/asn1js/build/index.es.js ***!
|
||
\***********************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Any: () => (/* binding */ Any),\n/* harmony export */ BaseBlock: () => (/* binding */ BaseBlock),\n/* harmony export */ BaseStringBlock: () => (/* binding */ BaseStringBlock),\n/* harmony export */ BitString: () => (/* binding */ BitString),\n/* harmony export */ BmpString: () => (/* binding */ BmpString),\n/* harmony export */ Boolean: () => (/* binding */ Boolean),\n/* harmony export */ CharacterString: () => (/* binding */ CharacterString),\n/* harmony export */ Choice: () => (/* binding */ Choice),\n/* harmony export */ Constructed: () => (/* binding */ Constructed),\n/* harmony export */ DATE: () => (/* binding */ DATE),\n/* harmony export */ DateTime: () => (/* binding */ DateTime),\n/* harmony export */ Duration: () => (/* binding */ Duration),\n/* harmony export */ EndOfContent: () => (/* binding */ EndOfContent),\n/* harmony export */ Enumerated: () => (/* binding */ Enumerated),\n/* harmony export */ GeneralString: () => (/* binding */ GeneralString),\n/* harmony export */ GeneralizedTime: () => (/* binding */ GeneralizedTime),\n/* harmony export */ GraphicString: () => (/* binding */ GraphicString),\n/* harmony export */ HexBlock: () => (/* binding */ HexBlock),\n/* harmony export */ IA5String: () => (/* binding */ IA5String),\n/* harmony export */ Integer: () => (/* binding */ Integer),\n/* harmony export */ Null: () => (/* binding */ Null),\n/* harmony export */ NumericString: () => (/* binding */ NumericString),\n/* harmony export */ ObjectIdentifier: () => (/* binding */ ObjectIdentifier),\n/* harmony export */ OctetString: () => (/* binding */ OctetString),\n/* harmony export */ Primitive: () => (/* binding */ Primitive),\n/* harmony export */ PrintableString: () => (/* binding */ PrintableString),\n/* harmony export */ RawData: () => (/* binding */ RawData),\n/* harmony export */ RelativeObjectIdentifier: () => (/* binding */ RelativeObjectIdentifier),\n/* harmony export */ Repeated: () => (/* binding */ Repeated),\n/* harmony export */ Sequence: () => (/* binding */ Sequence),\n/* harmony export */ Set: () => (/* binding */ Set),\n/* harmony export */ TIME: () => (/* binding */ TIME),\n/* harmony export */ TeletexString: () => (/* binding */ TeletexString),\n/* harmony export */ TimeOfDay: () => (/* binding */ TimeOfDay),\n/* harmony export */ UTCTime: () => (/* binding */ UTCTime),\n/* harmony export */ UniversalString: () => (/* binding */ UniversalString),\n/* harmony export */ Utf8String: () => (/* binding */ Utf8String),\n/* harmony export */ ValueBlock: () => (/* binding */ ValueBlock),\n/* harmony export */ VideotexString: () => (/* binding */ VideotexString),\n/* harmony export */ ViewWriter: () => (/* binding */ ViewWriter),\n/* harmony export */ VisibleString: () => (/* binding */ VisibleString),\n/* harmony export */ compareSchema: () => (/* binding */ compareSchema),\n/* harmony export */ fromBER: () => (/* binding */ fromBER),\n/* harmony export */ verifySchema: () => (/* binding */ verifySchema)\n/* harmony export */ });\n/* harmony import */ var pvtsutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! pvtsutils */ \"./node_modules/pvtsutils/build/index.js\");\n/* harmony import */ var pvutils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! pvutils */ \"./node_modules/pvutils/build/utils.es.js\");\n/*!\n * Copyright (c) 2014, GMO GlobalSign\n * Copyright (c) 2015-2022, Peculiar Ventures\n * All rights reserved.\n * \n * Author 2014-2019, Yury Strozhevsky\n * \n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * \n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * \n * * Redistributions in binary form must reproduce the above copyright notice, this\n * list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * \n * * Neither the name of the copyright holder nor the names of its\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n * \n */\n\n\n\n\nfunction assertBigInt() {\r\n if (typeof BigInt === \"undefined\") {\r\n throw new Error(\"BigInt is not defined. Your environment doesn't implement BigInt.\");\r\n }\r\n}\r\nfunction concat(buffers) {\r\n let outputLength = 0;\r\n let prevLength = 0;\r\n for (let i = 0; i < buffers.length; i++) {\r\n const buffer = buffers[i];\r\n outputLength += buffer.byteLength;\r\n }\r\n const retView = new Uint8Array(outputLength);\r\n for (let i = 0; i < buffers.length; i++) {\r\n const buffer = buffers[i];\r\n retView.set(new Uint8Array(buffer), prevLength);\r\n prevLength += buffer.byteLength;\r\n }\r\n return retView.buffer;\r\n}\r\nfunction checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) {\r\n if (!(inputBuffer instanceof Uint8Array)) {\r\n baseBlock.error = \"Wrong parameter: inputBuffer must be 'Uint8Array'\";\r\n return false;\r\n }\r\n if (!inputBuffer.byteLength) {\r\n baseBlock.error = \"Wrong parameter: inputBuffer has zero length\";\r\n return false;\r\n }\r\n if (inputOffset < 0) {\r\n baseBlock.error = \"Wrong parameter: inputOffset less than zero\";\r\n return false;\r\n }\r\n if (inputLength < 0) {\r\n baseBlock.error = \"Wrong parameter: inputLength less than zero\";\r\n return false;\r\n }\r\n if ((inputBuffer.byteLength - inputOffset - inputLength) < 0) {\r\n baseBlock.error = \"End of input reached before message was fully decoded (inconsistent offset and length values)\";\r\n return false;\r\n }\r\n return true;\r\n}\n\nclass ViewWriter {\r\n constructor() {\r\n this.items = [];\r\n }\r\n write(buf) {\r\n this.items.push(buf);\r\n }\r\n final() {\r\n return concat(this.items);\r\n }\r\n}\n\nconst powers2 = [new Uint8Array([1])];\r\nconst digitsString = \"0123456789\";\r\nconst NAME = \"name\";\r\nconst VALUE_HEX_VIEW = \"valueHexView\";\r\nconst IS_HEX_ONLY = \"isHexOnly\";\r\nconst ID_BLOCK = \"idBlock\";\r\nconst TAG_CLASS = \"tagClass\";\r\nconst TAG_NUMBER = \"tagNumber\";\r\nconst IS_CONSTRUCTED = \"isConstructed\";\r\nconst FROM_BER = \"fromBER\";\r\nconst TO_BER = \"toBER\";\r\nconst LOCAL = \"local\";\r\nconst EMPTY_STRING = \"\";\r\nconst EMPTY_BUFFER = new ArrayBuffer(0);\r\nconst EMPTY_VIEW = new Uint8Array(0);\r\nconst END_OF_CONTENT_NAME = \"EndOfContent\";\r\nconst OCTET_STRING_NAME = \"OCTET STRING\";\r\nconst BIT_STRING_NAME = \"BIT STRING\";\n\nfunction HexBlock(BaseClass) {\r\n var _a;\r\n return _a = class Some extends BaseClass {\r\n constructor(...args) {\r\n var _a;\r\n super(...args);\r\n const params = args[0] || {};\r\n this.isHexOnly = (_a = params.isHexOnly) !== null && _a !== void 0 ? _a : false;\r\n this.valueHexView = params.valueHex ? pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(params.valueHex) : EMPTY_VIEW;\r\n }\r\n get valueHex() {\r\n return this.valueHexView.slice().buffer;\r\n }\r\n set valueHex(value) {\r\n this.valueHexView = new Uint8Array(value);\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n const view = inputBuffer instanceof ArrayBuffer ? new Uint8Array(inputBuffer) : inputBuffer;\r\n if (!checkBufferParams(this, view, inputOffset, inputLength)) {\r\n return -1;\r\n }\r\n const endLength = inputOffset + inputLength;\r\n this.valueHexView = view.subarray(inputOffset, endLength);\r\n if (!this.valueHexView.length) {\r\n this.warnings.push(\"Zero buffer length\");\r\n return inputOffset;\r\n }\r\n this.blockLength = inputLength;\r\n return endLength;\r\n }\r\n toBER(sizeOnly = false) {\r\n if (!this.isHexOnly) {\r\n this.error = \"Flag 'isHexOnly' is not set, abort\";\r\n return EMPTY_BUFFER;\r\n }\r\n if (sizeOnly) {\r\n return new ArrayBuffer(this.valueHexView.byteLength);\r\n }\r\n return (this.valueHexView.byteLength === this.valueHexView.buffer.byteLength)\r\n ? this.valueHexView.buffer\r\n : this.valueHexView.slice().buffer;\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n isHexOnly: this.isHexOnly,\r\n valueHex: pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueHexView),\r\n };\r\n }\r\n },\r\n _a.NAME = \"hexBlock\",\r\n _a;\r\n}\n\nclass LocalBaseBlock {\r\n constructor({ blockLength = 0, error = EMPTY_STRING, warnings = [], valueBeforeDecode = EMPTY_VIEW, } = {}) {\r\n this.blockLength = blockLength;\r\n this.error = error;\r\n this.warnings = warnings;\r\n this.valueBeforeDecodeView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(valueBeforeDecode);\r\n }\r\n static blockName() {\r\n return this.NAME;\r\n }\r\n get valueBeforeDecode() {\r\n return this.valueBeforeDecodeView.slice().buffer;\r\n }\r\n set valueBeforeDecode(value) {\r\n this.valueBeforeDecodeView = new Uint8Array(value);\r\n }\r\n toJSON() {\r\n return {\r\n blockName: this.constructor.NAME,\r\n blockLength: this.blockLength,\r\n error: this.error,\r\n warnings: this.warnings,\r\n valueBeforeDecode: pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueBeforeDecodeView),\r\n };\r\n }\r\n}\r\nLocalBaseBlock.NAME = \"baseBlock\";\n\nclass ValueBlock extends LocalBaseBlock {\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n throw TypeError(\"User need to make a specific function in a class which extends 'ValueBlock'\");\r\n }\r\n toBER(sizeOnly, writer) {\r\n throw TypeError(\"User need to make a specific function in a class which extends 'ValueBlock'\");\r\n }\r\n}\r\nValueBlock.NAME = \"valueBlock\";\n\nclass LocalIdentificationBlock extends HexBlock(LocalBaseBlock) {\r\n constructor({ idBlock = {}, } = {}) {\r\n var _a, _b, _c, _d;\r\n super();\r\n if (idBlock) {\r\n this.isHexOnly = (_a = idBlock.isHexOnly) !== null && _a !== void 0 ? _a : false;\r\n this.valueHexView = idBlock.valueHex ? pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(idBlock.valueHex) : EMPTY_VIEW;\r\n this.tagClass = (_b = idBlock.tagClass) !== null && _b !== void 0 ? _b : -1;\r\n this.tagNumber = (_c = idBlock.tagNumber) !== null && _c !== void 0 ? _c : -1;\r\n this.isConstructed = (_d = idBlock.isConstructed) !== null && _d !== void 0 ? _d : false;\r\n }\r\n else {\r\n this.tagClass = -1;\r\n this.tagNumber = -1;\r\n this.isConstructed = false;\r\n }\r\n }\r\n toBER(sizeOnly = false) {\r\n let firstOctet = 0;\r\n switch (this.tagClass) {\r\n case 1:\r\n firstOctet |= 0x00;\r\n break;\r\n case 2:\r\n firstOctet |= 0x40;\r\n break;\r\n case 3:\r\n firstOctet |= 0x80;\r\n break;\r\n case 4:\r\n firstOctet |= 0xC0;\r\n break;\r\n default:\r\n this.error = \"Unknown tag class\";\r\n return EMPTY_BUFFER;\r\n }\r\n if (this.isConstructed)\r\n firstOctet |= 0x20;\r\n if (this.tagNumber < 31 && !this.isHexOnly) {\r\n const retView = new Uint8Array(1);\r\n if (!sizeOnly) {\r\n let number = this.tagNumber;\r\n number &= 0x1F;\r\n firstOctet |= number;\r\n retView[0] = firstOctet;\r\n }\r\n return retView.buffer;\r\n }\r\n if (!this.isHexOnly) {\r\n const encodedBuf = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilToBase(this.tagNumber, 7);\r\n const encodedView = new Uint8Array(encodedBuf);\r\n const size = encodedBuf.byteLength;\r\n const retView = new Uint8Array(size + 1);\r\n retView[0] = (firstOctet | 0x1F);\r\n if (!sizeOnly) {\r\n for (let i = 0; i < (size - 1); i++)\r\n retView[i + 1] = encodedView[i] | 0x80;\r\n retView[size] = encodedView[size - 1];\r\n }\r\n return retView.buffer;\r\n }\r\n const retView = new Uint8Array(this.valueHexView.byteLength + 1);\r\n retView[0] = (firstOctet | 0x1F);\r\n if (!sizeOnly) {\r\n const curView = this.valueHexView;\r\n for (let i = 0; i < (curView.length - 1); i++)\r\n retView[i + 1] = curView[i] | 0x80;\r\n retView[this.valueHexView.byteLength] = curView[curView.length - 1];\r\n }\r\n return retView.buffer;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n const inputView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer);\r\n if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {\r\n return -1;\r\n }\r\n const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength);\r\n if (intBuffer.length === 0) {\r\n this.error = \"Zero buffer length\";\r\n return -1;\r\n }\r\n const tagClassMask = intBuffer[0] & 0xC0;\r\n switch (tagClassMask) {\r\n case 0x00:\r\n this.tagClass = (1);\r\n break;\r\n case 0x40:\r\n this.tagClass = (2);\r\n break;\r\n case 0x80:\r\n this.tagClass = (3);\r\n break;\r\n case 0xC0:\r\n this.tagClass = (4);\r\n break;\r\n default:\r\n this.error = \"Unknown tag class\";\r\n return -1;\r\n }\r\n this.isConstructed = (intBuffer[0] & 0x20) === 0x20;\r\n this.isHexOnly = false;\r\n const tagNumberMask = intBuffer[0] & 0x1F;\r\n if (tagNumberMask !== 0x1F) {\r\n this.tagNumber = (tagNumberMask);\r\n this.blockLength = 1;\r\n }\r\n else {\r\n let count = 1;\r\n let intTagNumberBuffer = this.valueHexView = new Uint8Array(255);\r\n let tagNumberBufferMaxLength = 255;\r\n while (intBuffer[count] & 0x80) {\r\n intTagNumberBuffer[count - 1] = intBuffer[count] & 0x7F;\r\n count++;\r\n if (count >= intBuffer.length) {\r\n this.error = \"End of input reached before message was fully decoded\";\r\n return -1;\r\n }\r\n if (count === tagNumberBufferMaxLength) {\r\n tagNumberBufferMaxLength += 255;\r\n const tempBufferView = new Uint8Array(tagNumberBufferMaxLength);\r\n for (let i = 0; i < intTagNumberBuffer.length; i++)\r\n tempBufferView[i] = intTagNumberBuffer[i];\r\n intTagNumberBuffer = this.valueHexView = new Uint8Array(tagNumberBufferMaxLength);\r\n }\r\n }\r\n this.blockLength = (count + 1);\r\n intTagNumberBuffer[count - 1] = intBuffer[count] & 0x7F;\r\n const tempBufferView = new Uint8Array(count);\r\n for (let i = 0; i < count; i++)\r\n tempBufferView[i] = intTagNumberBuffer[i];\r\n intTagNumberBuffer = this.valueHexView = new Uint8Array(count);\r\n intTagNumberBuffer.set(tempBufferView);\r\n if (this.blockLength <= 9)\r\n this.tagNumber = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilFromBase(intTagNumberBuffer, 7);\r\n else {\r\n this.isHexOnly = true;\r\n this.warnings.push(\"Tag too long, represented as hex-coded\");\r\n }\r\n }\r\n if (((this.tagClass === 1)) &&\r\n (this.isConstructed)) {\r\n switch (this.tagNumber) {\r\n case 1:\r\n case 2:\r\n case 5:\r\n case 6:\r\n case 9:\r\n case 13:\r\n case 14:\r\n case 23:\r\n case 24:\r\n case 31:\r\n case 32:\r\n case 33:\r\n case 34:\r\n this.error = \"Constructed encoding used for primitive type\";\r\n return -1;\r\n }\r\n }\r\n return (inputOffset + this.blockLength);\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n tagClass: this.tagClass,\r\n tagNumber: this.tagNumber,\r\n isConstructed: this.isConstructed,\r\n };\r\n }\r\n}\r\nLocalIdentificationBlock.NAME = \"identificationBlock\";\n\nclass LocalLengthBlock extends LocalBaseBlock {\r\n constructor({ lenBlock = {}, } = {}) {\r\n var _a, _b, _c;\r\n super();\r\n this.isIndefiniteForm = (_a = lenBlock.isIndefiniteForm) !== null && _a !== void 0 ? _a : false;\r\n this.longFormUsed = (_b = lenBlock.longFormUsed) !== null && _b !== void 0 ? _b : false;\r\n this.length = (_c = lenBlock.length) !== null && _c !== void 0 ? _c : 0;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n const view = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer);\r\n if (!checkBufferParams(this, view, inputOffset, inputLength)) {\r\n return -1;\r\n }\r\n const intBuffer = view.subarray(inputOffset, inputOffset + inputLength);\r\n if (intBuffer.length === 0) {\r\n this.error = \"Zero buffer length\";\r\n return -1;\r\n }\r\n if (intBuffer[0] === 0xFF) {\r\n this.error = \"Length block 0xFF is reserved by standard\";\r\n return -1;\r\n }\r\n this.isIndefiniteForm = intBuffer[0] === 0x80;\r\n if (this.isIndefiniteForm) {\r\n this.blockLength = 1;\r\n return (inputOffset + this.blockLength);\r\n }\r\n this.longFormUsed = !!(intBuffer[0] & 0x80);\r\n if (this.longFormUsed === false) {\r\n this.length = (intBuffer[0]);\r\n this.blockLength = 1;\r\n return (inputOffset + this.blockLength);\r\n }\r\n const count = intBuffer[0] & 0x7F;\r\n if (count > 8) {\r\n this.error = \"Too big integer\";\r\n return -1;\r\n }\r\n if ((count + 1) > intBuffer.length) {\r\n this.error = \"End of input reached before message was fully decoded\";\r\n return -1;\r\n }\r\n const lenOffset = inputOffset + 1;\r\n const lengthBufferView = view.subarray(lenOffset, lenOffset + count);\r\n if (lengthBufferView[count - 1] === 0x00)\r\n this.warnings.push(\"Needlessly long encoded length\");\r\n this.length = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilFromBase(lengthBufferView, 8);\r\n if (this.longFormUsed && (this.length <= 127))\r\n this.warnings.push(\"Unnecessary usage of long length form\");\r\n this.blockLength = count + 1;\r\n return (inputOffset + this.blockLength);\r\n }\r\n toBER(sizeOnly = false) {\r\n let retBuf;\r\n let retView;\r\n if (this.length > 127)\r\n this.longFormUsed = true;\r\n if (this.isIndefiniteForm) {\r\n retBuf = new ArrayBuffer(1);\r\n if (sizeOnly === false) {\r\n retView = new Uint8Array(retBuf);\r\n retView[0] = 0x80;\r\n }\r\n return retBuf;\r\n }\r\n if (this.longFormUsed) {\r\n const encodedBuf = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilToBase(this.length, 8);\r\n if (encodedBuf.byteLength > 127) {\r\n this.error = \"Too big length\";\r\n return (EMPTY_BUFFER);\r\n }\r\n retBuf = new ArrayBuffer(encodedBuf.byteLength + 1);\r\n if (sizeOnly)\r\n return retBuf;\r\n const encodedView = new Uint8Array(encodedBuf);\r\n retView = new Uint8Array(retBuf);\r\n retView[0] = encodedBuf.byteLength | 0x80;\r\n for (let i = 0; i < encodedBuf.byteLength; i++)\r\n retView[i + 1] = encodedView[i];\r\n return retBuf;\r\n }\r\n retBuf = new ArrayBuffer(1);\r\n if (sizeOnly === false) {\r\n retView = new Uint8Array(retBuf);\r\n retView[0] = this.length;\r\n }\r\n return retBuf;\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n isIndefiniteForm: this.isIndefiniteForm,\r\n longFormUsed: this.longFormUsed,\r\n length: this.length,\r\n };\r\n }\r\n}\r\nLocalLengthBlock.NAME = \"lengthBlock\";\n\nconst typeStore = {};\n\nclass BaseBlock extends LocalBaseBlock {\r\n constructor({ name = EMPTY_STRING, optional = false, primitiveSchema, ...parameters } = {}, valueBlockType) {\r\n super(parameters);\r\n this.name = name;\r\n this.optional = optional;\r\n if (primitiveSchema) {\r\n this.primitiveSchema = primitiveSchema;\r\n }\r\n this.idBlock = new LocalIdentificationBlock(parameters);\r\n this.lenBlock = new LocalLengthBlock(parameters);\r\n this.valueBlock = valueBlockType ? new valueBlockType(parameters) : new ValueBlock(parameters);\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm) ? inputLength : this.lenBlock.length);\r\n if (resultOffset === -1) {\r\n this.error = this.valueBlock.error;\r\n return resultOffset;\r\n }\r\n if (!this.idBlock.error.length)\r\n this.blockLength += this.idBlock.blockLength;\r\n if (!this.lenBlock.error.length)\r\n this.blockLength += this.lenBlock.blockLength;\r\n if (!this.valueBlock.error.length)\r\n this.blockLength += this.valueBlock.blockLength;\r\n return resultOffset;\r\n }\r\n toBER(sizeOnly, writer) {\r\n const _writer = writer || new ViewWriter();\r\n if (!writer) {\r\n prepareIndefiniteForm(this);\r\n }\r\n const idBlockBuf = this.idBlock.toBER(sizeOnly);\r\n _writer.write(idBlockBuf);\r\n if (this.lenBlock.isIndefiniteForm) {\r\n _writer.write(new Uint8Array([0x80]).buffer);\r\n this.valueBlock.toBER(sizeOnly, _writer);\r\n _writer.write(new ArrayBuffer(2));\r\n }\r\n else {\r\n const valueBlockBuf = this.valueBlock.toBER(sizeOnly);\r\n this.lenBlock.length = valueBlockBuf.byteLength;\r\n const lenBlockBuf = this.lenBlock.toBER(sizeOnly);\r\n _writer.write(lenBlockBuf);\r\n _writer.write(valueBlockBuf);\r\n }\r\n if (!writer) {\r\n return _writer.final();\r\n }\r\n return EMPTY_BUFFER;\r\n }\r\n toJSON() {\r\n const object = {\r\n ...super.toJSON(),\r\n idBlock: this.idBlock.toJSON(),\r\n lenBlock: this.lenBlock.toJSON(),\r\n valueBlock: this.valueBlock.toJSON(),\r\n name: this.name,\r\n optional: this.optional,\r\n };\r\n if (this.primitiveSchema)\r\n object.primitiveSchema = this.primitiveSchema.toJSON();\r\n return object;\r\n }\r\n toString(encoding = \"ascii\") {\r\n if (encoding === \"ascii\") {\r\n return this.onAsciiEncoding();\r\n }\r\n return pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.toBER());\r\n }\r\n onAsciiEncoding() {\r\n return `${this.constructor.NAME} : ${pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`;\r\n }\r\n isEqual(other) {\r\n if (this === other) {\r\n return true;\r\n }\r\n if (!(other instanceof this.constructor)) {\r\n return false;\r\n }\r\n const thisRaw = this.toBER();\r\n const otherRaw = other.toBER();\r\n return pvutils__WEBPACK_IMPORTED_MODULE_1__.isEqualBuffer(thisRaw, otherRaw);\r\n }\r\n}\r\nBaseBlock.NAME = \"BaseBlock\";\r\nfunction prepareIndefiniteForm(baseBlock) {\r\n if (baseBlock instanceof typeStore.Constructed) {\r\n for (const value of baseBlock.valueBlock.value) {\r\n if (prepareIndefiniteForm(value)) {\r\n baseBlock.lenBlock.isIndefiniteForm = true;\r\n }\r\n }\r\n }\r\n return !!baseBlock.lenBlock.isIndefiniteForm;\r\n}\n\nclass BaseStringBlock extends BaseBlock {\r\n constructor({ value = EMPTY_STRING, ...parameters } = {}, stringValueBlockType) {\r\n super(parameters, stringValueBlockType);\r\n if (value) {\r\n this.fromString(value);\r\n }\r\n }\r\n getValue() {\r\n return this.valueBlock.value;\r\n }\r\n setValue(value) {\r\n this.valueBlock.value = value;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm) ? inputLength : this.lenBlock.length);\r\n if (resultOffset === -1) {\r\n this.error = this.valueBlock.error;\r\n return resultOffset;\r\n }\r\n this.fromBuffer(this.valueBlock.valueHexView);\r\n if (!this.idBlock.error.length)\r\n this.blockLength += this.idBlock.blockLength;\r\n if (!this.lenBlock.error.length)\r\n this.blockLength += this.lenBlock.blockLength;\r\n if (!this.valueBlock.error.length)\r\n this.blockLength += this.valueBlock.blockLength;\r\n return resultOffset;\r\n }\r\n onAsciiEncoding() {\r\n return `${this.constructor.NAME} : '${this.valueBlock.value}'`;\r\n }\r\n}\r\nBaseStringBlock.NAME = \"BaseStringBlock\";\n\nclass LocalPrimitiveValueBlock extends HexBlock(ValueBlock) {\r\n constructor({ isHexOnly = true, ...parameters } = {}) {\r\n super(parameters);\r\n this.isHexOnly = isHexOnly;\r\n }\r\n}\r\nLocalPrimitiveValueBlock.NAME = \"PrimitiveValueBlock\";\n\nvar _a$w;\r\nclass Primitive extends BaseBlock {\r\n constructor(parameters = {}) {\r\n super(parameters, LocalPrimitiveValueBlock);\r\n this.idBlock.isConstructed = false;\r\n }\r\n}\r\n_a$w = Primitive;\r\n(() => {\r\n typeStore.Primitive = _a$w;\r\n})();\r\nPrimitive.NAME = \"PRIMITIVE\";\n\nfunction localChangeType(inputObject, newType) {\r\n if (inputObject instanceof newType) {\r\n return inputObject;\r\n }\r\n const newObject = new newType();\r\n newObject.idBlock = inputObject.idBlock;\r\n newObject.lenBlock = inputObject.lenBlock;\r\n newObject.warnings = inputObject.warnings;\r\n newObject.valueBeforeDecodeView = inputObject.valueBeforeDecodeView;\r\n return newObject;\r\n}\r\nfunction localFromBER(inputBuffer, inputOffset = 0, inputLength = inputBuffer.length) {\r\n const incomingOffset = inputOffset;\r\n let returnObject = new BaseBlock({}, ValueBlock);\r\n const baseBlock = new LocalBaseBlock();\r\n if (!checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength)) {\r\n returnObject.error = baseBlock.error;\r\n return {\r\n offset: -1,\r\n result: returnObject\r\n };\r\n }\r\n const intBuffer = inputBuffer.subarray(inputOffset, inputOffset + inputLength);\r\n if (!intBuffer.length) {\r\n returnObject.error = \"Zero buffer length\";\r\n return {\r\n offset: -1,\r\n result: returnObject\r\n };\r\n }\r\n let resultOffset = returnObject.idBlock.fromBER(inputBuffer, inputOffset, inputLength);\r\n if (returnObject.idBlock.warnings.length) {\r\n returnObject.warnings.concat(returnObject.idBlock.warnings);\r\n }\r\n if (resultOffset === -1) {\r\n returnObject.error = returnObject.idBlock.error;\r\n return {\r\n offset: -1,\r\n result: returnObject\r\n };\r\n }\r\n inputOffset = resultOffset;\r\n inputLength -= returnObject.idBlock.blockLength;\r\n resultOffset = returnObject.lenBlock.fromBER(inputBuffer, inputOffset, inputLength);\r\n if (returnObject.lenBlock.warnings.length) {\r\n returnObject.warnings.concat(returnObject.lenBlock.warnings);\r\n }\r\n if (resultOffset === -1) {\r\n returnObject.error = returnObject.lenBlock.error;\r\n return {\r\n offset: -1,\r\n result: returnObject\r\n };\r\n }\r\n inputOffset = resultOffset;\r\n inputLength -= returnObject.lenBlock.blockLength;\r\n if (!returnObject.idBlock.isConstructed &&\r\n returnObject.lenBlock.isIndefiniteForm) {\r\n returnObject.error = \"Indefinite length form used for primitive encoding form\";\r\n return {\r\n offset: -1,\r\n result: returnObject\r\n };\r\n }\r\n let newASN1Type = BaseBlock;\r\n switch (returnObject.idBlock.tagClass) {\r\n case 1:\r\n if ((returnObject.idBlock.tagNumber >= 37) &&\r\n (returnObject.idBlock.isHexOnly === false)) {\r\n returnObject.error = \"UNIVERSAL 37 and upper tags are reserved by ASN.1 standard\";\r\n return {\r\n offset: -1,\r\n result: returnObject\r\n };\r\n }\r\n switch (returnObject.idBlock.tagNumber) {\r\n case 0:\r\n if ((returnObject.idBlock.isConstructed) &&\r\n (returnObject.lenBlock.length > 0)) {\r\n returnObject.error = \"Type [UNIVERSAL 0] is reserved\";\r\n return {\r\n offset: -1,\r\n result: returnObject\r\n };\r\n }\r\n newASN1Type = typeStore.EndOfContent;\r\n break;\r\n case 1:\r\n newASN1Type = typeStore.Boolean;\r\n break;\r\n case 2:\r\n newASN1Type = typeStore.Integer;\r\n break;\r\n case 3:\r\n newASN1Type = typeStore.BitString;\r\n break;\r\n case 4:\r\n newASN1Type = typeStore.OctetString;\r\n break;\r\n case 5:\r\n newASN1Type = typeStore.Null;\r\n break;\r\n case 6:\r\n newASN1Type = typeStore.ObjectIdentifier;\r\n break;\r\n case 10:\r\n newASN1Type = typeStore.Enumerated;\r\n break;\r\n case 12:\r\n newASN1Type = typeStore.Utf8String;\r\n break;\r\n case 13:\r\n newASN1Type = typeStore.RelativeObjectIdentifier;\r\n break;\r\n case 14:\r\n newASN1Type = typeStore.TIME;\r\n break;\r\n case 15:\r\n returnObject.error = \"[UNIVERSAL 15] is reserved by ASN.1 standard\";\r\n return {\r\n offset: -1,\r\n result: returnObject\r\n };\r\n case 16:\r\n newASN1Type = typeStore.Sequence;\r\n break;\r\n case 17:\r\n newASN1Type = typeStore.Set;\r\n break;\r\n case 18:\r\n newASN1Type = typeStore.NumericString;\r\n break;\r\n case 19:\r\n newASN1Type = typeStore.PrintableString;\r\n break;\r\n case 20:\r\n newASN1Type = typeStore.TeletexString;\r\n break;\r\n case 21:\r\n newASN1Type = typeStore.VideotexString;\r\n break;\r\n case 22:\r\n newASN1Type = typeStore.IA5String;\r\n break;\r\n case 23:\r\n newASN1Type = typeStore.UTCTime;\r\n break;\r\n case 24:\r\n newASN1Type = typeStore.GeneralizedTime;\r\n break;\r\n case 25:\r\n newASN1Type = typeStore.GraphicString;\r\n break;\r\n case 26:\r\n newASN1Type = typeStore.VisibleString;\r\n break;\r\n case 27:\r\n newASN1Type = typeStore.GeneralString;\r\n break;\r\n case 28:\r\n newASN1Type = typeStore.UniversalString;\r\n break;\r\n case 29:\r\n newASN1Type = typeStore.CharacterString;\r\n break;\r\n case 30:\r\n newASN1Type = typeStore.BmpString;\r\n break;\r\n case 31:\r\n newASN1Type = typeStore.DATE;\r\n break;\r\n case 32:\r\n newASN1Type = typeStore.TimeOfDay;\r\n break;\r\n case 33:\r\n newASN1Type = typeStore.DateTime;\r\n break;\r\n case 34:\r\n newASN1Type = typeStore.Duration;\r\n break;\r\n default: {\r\n const newObject = returnObject.idBlock.isConstructed\r\n ? new typeStore.Constructed()\r\n : new typeStore.Primitive();\r\n newObject.idBlock = returnObject.idBlock;\r\n newObject.lenBlock = returnObject.lenBlock;\r\n newObject.warnings = returnObject.warnings;\r\n returnObject = newObject;\r\n }\r\n }\r\n break;\r\n case 2:\r\n case 3:\r\n case 4:\r\n default: {\r\n newASN1Type = returnObject.idBlock.isConstructed\r\n ? typeStore.Constructed\r\n : typeStore.Primitive;\r\n }\r\n }\r\n returnObject = localChangeType(returnObject, newASN1Type);\r\n resultOffset = returnObject.fromBER(inputBuffer, inputOffset, returnObject.lenBlock.isIndefiniteForm ? inputLength : returnObject.lenBlock.length);\r\n returnObject.valueBeforeDecodeView = inputBuffer.subarray(incomingOffset, incomingOffset + returnObject.blockLength);\r\n return {\r\n offset: resultOffset,\r\n result: returnObject\r\n };\r\n}\r\nfunction fromBER(inputBuffer) {\r\n if (!inputBuffer.byteLength) {\r\n const result = new BaseBlock({}, ValueBlock);\r\n result.error = \"Input buffer has zero length\";\r\n return {\r\n offset: -1,\r\n result\r\n };\r\n }\r\n return localFromBER(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer).slice(), 0, inputBuffer.byteLength);\r\n}\n\nfunction checkLen(indefiniteLength, length) {\r\n if (indefiniteLength) {\r\n return 1;\r\n }\r\n return length;\r\n}\r\nclass LocalConstructedValueBlock extends ValueBlock {\r\n constructor({ value = [], isIndefiniteForm = false, ...parameters } = {}) {\r\n super(parameters);\r\n this.value = value;\r\n this.isIndefiniteForm = isIndefiniteForm;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n const view = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer);\r\n if (!checkBufferParams(this, view, inputOffset, inputLength)) {\r\n return -1;\r\n }\r\n this.valueBeforeDecodeView = view.subarray(inputOffset, inputOffset + inputLength);\r\n if (this.valueBeforeDecodeView.length === 0) {\r\n this.warnings.push(\"Zero buffer length\");\r\n return inputOffset;\r\n }\r\n let currentOffset = inputOffset;\r\n while (checkLen(this.isIndefiniteForm, inputLength) > 0) {\r\n const returnObject = localFromBER(view, currentOffset, inputLength);\r\n if (returnObject.offset === -1) {\r\n this.error = returnObject.result.error;\r\n this.warnings.concat(returnObject.result.warnings);\r\n return -1;\r\n }\r\n currentOffset = returnObject.offset;\r\n this.blockLength += returnObject.result.blockLength;\r\n inputLength -= returnObject.result.blockLength;\r\n this.value.push(returnObject.result);\r\n if (this.isIndefiniteForm && returnObject.result.constructor.NAME === END_OF_CONTENT_NAME) {\r\n break;\r\n }\r\n }\r\n if (this.isIndefiniteForm) {\r\n if (this.value[this.value.length - 1].constructor.NAME === END_OF_CONTENT_NAME) {\r\n this.value.pop();\r\n }\r\n else {\r\n this.warnings.push(\"No EndOfContent block encoded\");\r\n }\r\n }\r\n return currentOffset;\r\n }\r\n toBER(sizeOnly, writer) {\r\n const _writer = writer || new ViewWriter();\r\n for (let i = 0; i < this.value.length; i++) {\r\n this.value[i].toBER(sizeOnly, _writer);\r\n }\r\n if (!writer) {\r\n return _writer.final();\r\n }\r\n return EMPTY_BUFFER;\r\n }\r\n toJSON() {\r\n const object = {\r\n ...super.toJSON(),\r\n isIndefiniteForm: this.isIndefiniteForm,\r\n value: [],\r\n };\r\n for (const value of this.value) {\r\n object.value.push(value.toJSON());\r\n }\r\n return object;\r\n }\r\n}\r\nLocalConstructedValueBlock.NAME = \"ConstructedValueBlock\";\n\nvar _a$v;\r\nclass Constructed extends BaseBlock {\r\n constructor(parameters = {}) {\r\n super(parameters, LocalConstructedValueBlock);\r\n this.idBlock.isConstructed = true;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm;\r\n const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm) ? inputLength : this.lenBlock.length);\r\n if (resultOffset === -1) {\r\n this.error = this.valueBlock.error;\r\n return resultOffset;\r\n }\r\n if (!this.idBlock.error.length)\r\n this.blockLength += this.idBlock.blockLength;\r\n if (!this.lenBlock.error.length)\r\n this.blockLength += this.lenBlock.blockLength;\r\n if (!this.valueBlock.error.length)\r\n this.blockLength += this.valueBlock.blockLength;\r\n return resultOffset;\r\n }\r\n onAsciiEncoding() {\r\n const values = [];\r\n for (const value of this.valueBlock.value) {\r\n values.push(value.toString(\"ascii\").split(\"\\n\").map(o => ` ${o}`).join(\"\\n\"));\r\n }\r\n const blockName = this.idBlock.tagClass === 3\r\n ? `[${this.idBlock.tagNumber}]`\r\n : this.constructor.NAME;\r\n return values.length\r\n ? `${blockName} :\\n${values.join(\"\\n\")}`\r\n : `${blockName} :`;\r\n }\r\n}\r\n_a$v = Constructed;\r\n(() => {\r\n typeStore.Constructed = _a$v;\r\n})();\r\nConstructed.NAME = \"CONSTRUCTED\";\n\nclass LocalEndOfContentValueBlock extends ValueBlock {\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n return inputOffset;\r\n }\r\n toBER(sizeOnly) {\r\n return EMPTY_BUFFER;\r\n }\r\n}\r\nLocalEndOfContentValueBlock.override = \"EndOfContentValueBlock\";\n\nvar _a$u;\r\nclass EndOfContent extends BaseBlock {\r\n constructor(parameters = {}) {\r\n super(parameters, LocalEndOfContentValueBlock);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 0;\r\n }\r\n}\r\n_a$u = EndOfContent;\r\n(() => {\r\n typeStore.EndOfContent = _a$u;\r\n})();\r\nEndOfContent.NAME = END_OF_CONTENT_NAME;\n\nvar _a$t;\r\nclass Null extends BaseBlock {\r\n constructor(parameters = {}) {\r\n super(parameters, ValueBlock);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 5;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n if (this.lenBlock.length > 0)\r\n this.warnings.push(\"Non-zero length of value block for Null type\");\r\n if (!this.idBlock.error.length)\r\n this.blockLength += this.idBlock.blockLength;\r\n if (!this.lenBlock.error.length)\r\n this.blockLength += this.lenBlock.blockLength;\r\n this.blockLength += inputLength;\r\n if ((inputOffset + inputLength) > inputBuffer.byteLength) {\r\n this.error = \"End of input reached before message was fully decoded (inconsistent offset and length values)\";\r\n return -1;\r\n }\r\n return (inputOffset + inputLength);\r\n }\r\n toBER(sizeOnly, writer) {\r\n const retBuf = new ArrayBuffer(2);\r\n if (!sizeOnly) {\r\n const retView = new Uint8Array(retBuf);\r\n retView[0] = 0x05;\r\n retView[1] = 0x00;\r\n }\r\n if (writer) {\r\n writer.write(retBuf);\r\n }\r\n return retBuf;\r\n }\r\n onAsciiEncoding() {\r\n return `${this.constructor.NAME}`;\r\n }\r\n}\r\n_a$t = Null;\r\n(() => {\r\n typeStore.Null = _a$t;\r\n})();\r\nNull.NAME = \"NULL\";\n\nclass LocalBooleanValueBlock extends HexBlock(ValueBlock) {\r\n constructor({ value, ...parameters } = {}) {\r\n super(parameters);\r\n if (parameters.valueHex) {\r\n this.valueHexView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(parameters.valueHex);\r\n }\r\n else {\r\n this.valueHexView = new Uint8Array(1);\r\n }\r\n if (value) {\r\n this.value = value;\r\n }\r\n }\r\n get value() {\r\n for (const octet of this.valueHexView) {\r\n if (octet > 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n set value(value) {\r\n this.valueHexView[0] = value ? 0xFF : 0x00;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n const inputView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer);\r\n if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {\r\n return -1;\r\n }\r\n this.valueHexView = inputView.subarray(inputOffset, inputOffset + inputLength);\r\n if (inputLength > 1)\r\n this.warnings.push(\"Boolean value encoded in more then 1 octet\");\r\n this.isHexOnly = true;\r\n pvutils__WEBPACK_IMPORTED_MODULE_1__.utilDecodeTC.call(this);\r\n this.blockLength = inputLength;\r\n return (inputOffset + inputLength);\r\n }\r\n toBER() {\r\n return this.valueHexView.slice();\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n value: this.value,\r\n };\r\n }\r\n}\r\nLocalBooleanValueBlock.NAME = \"BooleanValueBlock\";\n\nvar _a$s;\r\nclass Boolean extends BaseBlock {\r\n constructor(parameters = {}) {\r\n super(parameters, LocalBooleanValueBlock);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 1;\r\n }\r\n getValue() {\r\n return this.valueBlock.value;\r\n }\r\n setValue(value) {\r\n this.valueBlock.value = value;\r\n }\r\n onAsciiEncoding() {\r\n return `${this.constructor.NAME} : ${this.getValue}`;\r\n }\r\n}\r\n_a$s = Boolean;\r\n(() => {\r\n typeStore.Boolean = _a$s;\r\n})();\r\nBoolean.NAME = \"BOOLEAN\";\n\nclass LocalOctetStringValueBlock extends HexBlock(LocalConstructedValueBlock) {\r\n constructor({ isConstructed = false, ...parameters } = {}) {\r\n super(parameters);\r\n this.isConstructed = isConstructed;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n let resultOffset = 0;\r\n if (this.isConstructed) {\r\n this.isHexOnly = false;\r\n resultOffset = LocalConstructedValueBlock.prototype.fromBER.call(this, inputBuffer, inputOffset, inputLength);\r\n if (resultOffset === -1)\r\n return resultOffset;\r\n for (let i = 0; i < this.value.length; i++) {\r\n const currentBlockName = this.value[i].constructor.NAME;\r\n if (currentBlockName === END_OF_CONTENT_NAME) {\r\n if (this.isIndefiniteForm)\r\n break;\r\n else {\r\n this.error = \"EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only\";\r\n return -1;\r\n }\r\n }\r\n if (currentBlockName !== OCTET_STRING_NAME) {\r\n this.error = \"OCTET STRING may consists of OCTET STRINGs only\";\r\n return -1;\r\n }\r\n }\r\n }\r\n else {\r\n this.isHexOnly = true;\r\n resultOffset = super.fromBER(inputBuffer, inputOffset, inputLength);\r\n this.blockLength = inputLength;\r\n }\r\n return resultOffset;\r\n }\r\n toBER(sizeOnly, writer) {\r\n if (this.isConstructed)\r\n return LocalConstructedValueBlock.prototype.toBER.call(this, sizeOnly, writer);\r\n return sizeOnly\r\n ? new ArrayBuffer(this.valueHexView.byteLength)\r\n : this.valueHexView.slice().buffer;\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n isConstructed: this.isConstructed,\r\n };\r\n }\r\n}\r\nLocalOctetStringValueBlock.NAME = \"OctetStringValueBlock\";\n\nvar _a$r;\r\nclass OctetString extends BaseBlock {\r\n constructor({ idBlock = {}, lenBlock = {}, ...parameters } = {}) {\r\n var _b, _c;\r\n (_b = parameters.isConstructed) !== null && _b !== void 0 ? _b : (parameters.isConstructed = !!((_c = parameters.value) === null || _c === void 0 ? void 0 : _c.length));\r\n super({\r\n idBlock: {\r\n isConstructed: parameters.isConstructed,\r\n ...idBlock,\r\n },\r\n lenBlock: {\r\n ...lenBlock,\r\n isIndefiniteForm: !!parameters.isIndefiniteForm,\r\n },\r\n ...parameters,\r\n }, LocalOctetStringValueBlock);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 4;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n this.valueBlock.isConstructed = this.idBlock.isConstructed;\r\n this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm;\r\n if (inputLength === 0) {\r\n if (this.idBlock.error.length === 0)\r\n this.blockLength += this.idBlock.blockLength;\r\n if (this.lenBlock.error.length === 0)\r\n this.blockLength += this.lenBlock.blockLength;\r\n return inputOffset;\r\n }\r\n if (!this.valueBlock.isConstructed) {\r\n const view = inputBuffer instanceof ArrayBuffer ? new Uint8Array(inputBuffer) : inputBuffer;\r\n const buf = view.subarray(inputOffset, inputOffset + inputLength);\r\n try {\r\n if (buf.byteLength) {\r\n const asn = localFromBER(buf, 0, buf.byteLength);\r\n if (asn.offset !== -1 && asn.offset === inputLength) {\r\n this.valueBlock.value = [asn.result];\r\n }\r\n }\r\n }\r\n catch (e) {\r\n }\r\n }\r\n return super.fromBER(inputBuffer, inputOffset, inputLength);\r\n }\r\n onAsciiEncoding() {\r\n if (this.valueBlock.isConstructed || (this.valueBlock.value && this.valueBlock.value.length)) {\r\n return Constructed.prototype.onAsciiEncoding.call(this);\r\n }\r\n return `${this.constructor.NAME} : ${pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueBlock.valueHexView)}`;\r\n }\r\n getValue() {\r\n if (!this.idBlock.isConstructed) {\r\n return this.valueBlock.valueHexView.slice().buffer;\r\n }\r\n const array = [];\r\n for (const content of this.valueBlock.value) {\r\n if (content instanceof OctetString) {\r\n array.push(content.valueBlock.valueHexView);\r\n }\r\n }\r\n return pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.concat(array);\r\n }\r\n}\r\n_a$r = OctetString;\r\n(() => {\r\n typeStore.OctetString = _a$r;\r\n})();\r\nOctetString.NAME = OCTET_STRING_NAME;\n\nclass LocalBitStringValueBlock extends HexBlock(LocalConstructedValueBlock) {\r\n constructor({ unusedBits = 0, isConstructed = false, ...parameters } = {}) {\r\n super(parameters);\r\n this.unusedBits = unusedBits;\r\n this.isConstructed = isConstructed;\r\n this.blockLength = this.valueHexView.byteLength;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n if (!inputLength) {\r\n return inputOffset;\r\n }\r\n let resultOffset = -1;\r\n if (this.isConstructed) {\r\n resultOffset = LocalConstructedValueBlock.prototype.fromBER.call(this, inputBuffer, inputOffset, inputLength);\r\n if (resultOffset === -1)\r\n return resultOffset;\r\n for (const value of this.value) {\r\n const currentBlockName = value.constructor.NAME;\r\n if (currentBlockName === END_OF_CONTENT_NAME) {\r\n if (this.isIndefiniteForm)\r\n break;\r\n else {\r\n this.error = \"EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only\";\r\n return -1;\r\n }\r\n }\r\n if (currentBlockName !== BIT_STRING_NAME) {\r\n this.error = \"BIT STRING may consists of BIT STRINGs only\";\r\n return -1;\r\n }\r\n const valueBlock = value.valueBlock;\r\n if ((this.unusedBits > 0) && (valueBlock.unusedBits > 0)) {\r\n this.error = \"Using of \\\"unused bits\\\" inside constructive BIT STRING allowed for least one only\";\r\n return -1;\r\n }\r\n this.unusedBits = valueBlock.unusedBits;\r\n }\r\n return resultOffset;\r\n }\r\n const inputView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer);\r\n if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {\r\n return -1;\r\n }\r\n const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength);\r\n this.unusedBits = intBuffer[0];\r\n if (this.unusedBits > 7) {\r\n this.error = \"Unused bits for BitString must be in range 0-7\";\r\n return -1;\r\n }\r\n if (!this.unusedBits) {\r\n const buf = intBuffer.subarray(1);\r\n try {\r\n if (buf.byteLength) {\r\n const asn = localFromBER(buf, 0, buf.byteLength);\r\n if (asn.offset !== -1 && asn.offset === (inputLength - 1)) {\r\n this.value = [asn.result];\r\n }\r\n }\r\n }\r\n catch (e) {\r\n }\r\n }\r\n this.valueHexView = intBuffer.subarray(1);\r\n this.blockLength = intBuffer.length;\r\n return (inputOffset + inputLength);\r\n }\r\n toBER(sizeOnly, writer) {\r\n if (this.isConstructed) {\r\n return LocalConstructedValueBlock.prototype.toBER.call(this, sizeOnly, writer);\r\n }\r\n if (sizeOnly) {\r\n return new ArrayBuffer(this.valueHexView.byteLength + 1);\r\n }\r\n if (!this.valueHexView.byteLength) {\r\n return EMPTY_BUFFER;\r\n }\r\n const retView = new Uint8Array(this.valueHexView.length + 1);\r\n retView[0] = this.unusedBits;\r\n retView.set(this.valueHexView, 1);\r\n return retView.buffer;\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n unusedBits: this.unusedBits,\r\n isConstructed: this.isConstructed,\r\n };\r\n }\r\n}\r\nLocalBitStringValueBlock.NAME = \"BitStringValueBlock\";\n\nvar _a$q;\r\nclass BitString extends BaseBlock {\r\n constructor({ idBlock = {}, lenBlock = {}, ...parameters } = {}) {\r\n var _b, _c;\r\n (_b = parameters.isConstructed) !== null && _b !== void 0 ? _b : (parameters.isConstructed = !!((_c = parameters.value) === null || _c === void 0 ? void 0 : _c.length));\r\n super({\r\n idBlock: {\r\n isConstructed: parameters.isConstructed,\r\n ...idBlock,\r\n },\r\n lenBlock: {\r\n ...lenBlock,\r\n isIndefiniteForm: !!parameters.isIndefiniteForm,\r\n },\r\n ...parameters,\r\n }, LocalBitStringValueBlock);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 3;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n this.valueBlock.isConstructed = this.idBlock.isConstructed;\r\n this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm;\r\n return super.fromBER(inputBuffer, inputOffset, inputLength);\r\n }\r\n onAsciiEncoding() {\r\n if (this.valueBlock.isConstructed || (this.valueBlock.value && this.valueBlock.value.length)) {\r\n return Constructed.prototype.onAsciiEncoding.call(this);\r\n }\r\n else {\r\n const bits = [];\r\n const valueHex = this.valueBlock.valueHexView;\r\n for (const byte of valueHex) {\r\n bits.push(byte.toString(2).padStart(8, \"0\"));\r\n }\r\n const bitsStr = bits.join(\"\");\r\n return `${this.constructor.NAME} : ${bitsStr.substring(0, bitsStr.length - this.valueBlock.unusedBits)}`;\r\n }\r\n }\r\n}\r\n_a$q = BitString;\r\n(() => {\r\n typeStore.BitString = _a$q;\r\n})();\r\nBitString.NAME = BIT_STRING_NAME;\n\nvar _a$p;\r\nfunction viewAdd(first, second) {\r\n const c = new Uint8Array([0]);\r\n const firstView = new Uint8Array(first);\r\n const secondView = new Uint8Array(second);\r\n let firstViewCopy = firstView.slice(0);\r\n const firstViewCopyLength = firstViewCopy.length - 1;\r\n const secondViewCopy = secondView.slice(0);\r\n const secondViewCopyLength = secondViewCopy.length - 1;\r\n let value = 0;\r\n const max = (secondViewCopyLength < firstViewCopyLength) ? firstViewCopyLength : secondViewCopyLength;\r\n let counter = 0;\r\n for (let i = max; i >= 0; i--, counter++) {\r\n switch (true) {\r\n case (counter < secondViewCopy.length):\r\n value = firstViewCopy[firstViewCopyLength - counter] + secondViewCopy[secondViewCopyLength - counter] + c[0];\r\n break;\r\n default:\r\n value = firstViewCopy[firstViewCopyLength - counter] + c[0];\r\n }\r\n c[0] = value / 10;\r\n switch (true) {\r\n case (counter >= firstViewCopy.length):\r\n firstViewCopy = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilConcatView(new Uint8Array([value % 10]), firstViewCopy);\r\n break;\r\n default:\r\n firstViewCopy[firstViewCopyLength - counter] = value % 10;\r\n }\r\n }\r\n if (c[0] > 0)\r\n firstViewCopy = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilConcatView(c, firstViewCopy);\r\n return firstViewCopy;\r\n}\r\nfunction power2(n) {\r\n if (n >= powers2.length) {\r\n for (let p = powers2.length; p <= n; p++) {\r\n const c = new Uint8Array([0]);\r\n let digits = (powers2[p - 1]).slice(0);\r\n for (let i = (digits.length - 1); i >= 0; i--) {\r\n const newValue = new Uint8Array([(digits[i] << 1) + c[0]]);\r\n c[0] = newValue[0] / 10;\r\n digits[i] = newValue[0] % 10;\r\n }\r\n if (c[0] > 0)\r\n digits = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilConcatView(c, digits);\r\n powers2.push(digits);\r\n }\r\n }\r\n return powers2[n];\r\n}\r\nfunction viewSub(first, second) {\r\n let b = 0;\r\n const firstView = new Uint8Array(first);\r\n const secondView = new Uint8Array(second);\r\n const firstViewCopy = firstView.slice(0);\r\n const firstViewCopyLength = firstViewCopy.length - 1;\r\n const secondViewCopy = secondView.slice(0);\r\n const secondViewCopyLength = secondViewCopy.length - 1;\r\n let value;\r\n let counter = 0;\r\n for (let i = secondViewCopyLength; i >= 0; i--, counter++) {\r\n value = firstViewCopy[firstViewCopyLength - counter] - secondViewCopy[secondViewCopyLength - counter] - b;\r\n switch (true) {\r\n case (value < 0):\r\n b = 1;\r\n firstViewCopy[firstViewCopyLength - counter] = value + 10;\r\n break;\r\n default:\r\n b = 0;\r\n firstViewCopy[firstViewCopyLength - counter] = value;\r\n }\r\n }\r\n if (b > 0) {\r\n for (let i = (firstViewCopyLength - secondViewCopyLength + 1); i >= 0; i--, counter++) {\r\n value = firstViewCopy[firstViewCopyLength - counter] - b;\r\n if (value < 0) {\r\n b = 1;\r\n firstViewCopy[firstViewCopyLength - counter] = value + 10;\r\n }\r\n else {\r\n b = 0;\r\n firstViewCopy[firstViewCopyLength - counter] = value;\r\n break;\r\n }\r\n }\r\n }\r\n return firstViewCopy.slice();\r\n}\r\nclass LocalIntegerValueBlock extends HexBlock(ValueBlock) {\r\n constructor({ value, ...parameters } = {}) {\r\n super(parameters);\r\n this._valueDec = 0;\r\n if (parameters.valueHex) {\r\n this.setValueHex();\r\n }\r\n if (value !== undefined) {\r\n this.valueDec = value;\r\n }\r\n }\r\n setValueHex() {\r\n if (this.valueHexView.length >= 4) {\r\n this.warnings.push(\"Too big Integer for decoding, hex only\");\r\n this.isHexOnly = true;\r\n this._valueDec = 0;\r\n }\r\n else {\r\n this.isHexOnly = false;\r\n if (this.valueHexView.length > 0) {\r\n this._valueDec = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilDecodeTC.call(this);\r\n }\r\n }\r\n }\r\n set valueDec(v) {\r\n this._valueDec = v;\r\n this.isHexOnly = false;\r\n this.valueHexView = new Uint8Array(pvutils__WEBPACK_IMPORTED_MODULE_1__.utilEncodeTC(v));\r\n }\r\n get valueDec() {\r\n return this._valueDec;\r\n }\r\n fromDER(inputBuffer, inputOffset, inputLength, expectedLength = 0) {\r\n const offset = this.fromBER(inputBuffer, inputOffset, inputLength);\r\n if (offset === -1)\r\n return offset;\r\n const view = this.valueHexView;\r\n if ((view[0] === 0x00) && ((view[1] & 0x80) !== 0)) {\r\n this.valueHexView = view.subarray(1);\r\n }\r\n else {\r\n if (expectedLength !== 0) {\r\n if (view.length < expectedLength) {\r\n if ((expectedLength - view.length) > 1)\r\n expectedLength = view.length + 1;\r\n this.valueHexView = view.subarray(expectedLength - view.length);\r\n }\r\n }\r\n }\r\n return offset;\r\n }\r\n toDER(sizeOnly = false) {\r\n const view = this.valueHexView;\r\n switch (true) {\r\n case ((view[0] & 0x80) !== 0):\r\n {\r\n const updatedView = new Uint8Array(this.valueHexView.length + 1);\r\n updatedView[0] = 0x00;\r\n updatedView.set(view, 1);\r\n this.valueHexView = updatedView;\r\n }\r\n break;\r\n case ((view[0] === 0x00) && ((view[1] & 0x80) === 0)):\r\n {\r\n this.valueHexView = this.valueHexView.subarray(1);\r\n }\r\n break;\r\n }\r\n return this.toBER(sizeOnly);\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n const resultOffset = super.fromBER(inputBuffer, inputOffset, inputLength);\r\n if (resultOffset === -1) {\r\n return resultOffset;\r\n }\r\n this.setValueHex();\r\n return resultOffset;\r\n }\r\n toBER(sizeOnly) {\r\n return sizeOnly\r\n ? new ArrayBuffer(this.valueHexView.length)\r\n : this.valueHexView.slice().buffer;\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n valueDec: this.valueDec,\r\n };\r\n }\r\n toString() {\r\n const firstBit = (this.valueHexView.length * 8) - 1;\r\n let digits = new Uint8Array((this.valueHexView.length * 8) / 3);\r\n let bitNumber = 0;\r\n let currentByte;\r\n const asn1View = this.valueHexView;\r\n let result = \"\";\r\n let flag = false;\r\n for (let byteNumber = (asn1View.byteLength - 1); byteNumber >= 0; byteNumber--) {\r\n currentByte = asn1View[byteNumber];\r\n for (let i = 0; i < 8; i++) {\r\n if ((currentByte & 1) === 1) {\r\n switch (bitNumber) {\r\n case firstBit:\r\n digits = viewSub(power2(bitNumber), digits);\r\n result = \"-\";\r\n break;\r\n default:\r\n digits = viewAdd(digits, power2(bitNumber));\r\n }\r\n }\r\n bitNumber++;\r\n currentByte >>= 1;\r\n }\r\n }\r\n for (let i = 0; i < digits.length; i++) {\r\n if (digits[i])\r\n flag = true;\r\n if (flag)\r\n result += digitsString.charAt(digits[i]);\r\n }\r\n if (flag === false)\r\n result += digitsString.charAt(0);\r\n return result;\r\n }\r\n}\r\n_a$p = LocalIntegerValueBlock;\r\nLocalIntegerValueBlock.NAME = \"IntegerValueBlock\";\r\n(() => {\r\n Object.defineProperty(_a$p.prototype, \"valueHex\", {\r\n set: function (v) {\r\n this.valueHexView = new Uint8Array(v);\r\n this.setValueHex();\r\n },\r\n get: function () {\r\n return this.valueHexView.slice().buffer;\r\n },\r\n });\r\n})();\n\nvar _a$o;\r\nclass Integer extends BaseBlock {\r\n constructor(parameters = {}) {\r\n super(parameters, LocalIntegerValueBlock);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 2;\r\n }\r\n toBigInt() {\r\n assertBigInt();\r\n return BigInt(this.valueBlock.toString());\r\n }\r\n static fromBigInt(value) {\r\n assertBigInt();\r\n const bigIntValue = BigInt(value);\r\n const writer = new ViewWriter();\r\n const hex = bigIntValue.toString(16).replace(/^-/, \"\");\r\n const view = new Uint8Array(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.FromHex(hex));\r\n if (bigIntValue < 0) {\r\n const first = new Uint8Array(view.length + (view[0] & 0x80 ? 1 : 0));\r\n first[0] |= 0x80;\r\n const firstInt = BigInt(`0x${pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(first)}`);\r\n const secondInt = firstInt + bigIntValue;\r\n const second = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.FromHex(secondInt.toString(16)));\r\n second[0] |= 0x80;\r\n writer.write(second);\r\n }\r\n else {\r\n if (view[0] & 0x80) {\r\n writer.write(new Uint8Array([0]));\r\n }\r\n writer.write(view);\r\n }\r\n const res = new Integer({\r\n valueHex: writer.final(),\r\n });\r\n return res;\r\n }\r\n convertToDER() {\r\n const integer = new Integer({ valueHex: this.valueBlock.valueHexView });\r\n integer.valueBlock.toDER();\r\n return integer;\r\n }\r\n convertFromDER() {\r\n return new Integer({\r\n valueHex: this.valueBlock.valueHexView[0] === 0\r\n ? this.valueBlock.valueHexView.subarray(1)\r\n : this.valueBlock.valueHexView,\r\n });\r\n }\r\n onAsciiEncoding() {\r\n return `${this.constructor.NAME} : ${this.valueBlock.toString()}`;\r\n }\r\n}\r\n_a$o = Integer;\r\n(() => {\r\n typeStore.Integer = _a$o;\r\n})();\r\nInteger.NAME = \"INTEGER\";\n\nvar _a$n;\r\nclass Enumerated extends Integer {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 10;\r\n }\r\n}\r\n_a$n = Enumerated;\r\n(() => {\r\n typeStore.Enumerated = _a$n;\r\n})();\r\nEnumerated.NAME = \"ENUMERATED\";\n\nclass LocalSidValueBlock extends HexBlock(ValueBlock) {\r\n constructor({ valueDec = -1, isFirstSid = false, ...parameters } = {}) {\r\n super(parameters);\r\n this.valueDec = valueDec;\r\n this.isFirstSid = isFirstSid;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n if (!inputLength) {\r\n return inputOffset;\r\n }\r\n const inputView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer);\r\n if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {\r\n return -1;\r\n }\r\n const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength);\r\n this.valueHexView = new Uint8Array(inputLength);\r\n for (let i = 0; i < inputLength; i++) {\r\n this.valueHexView[i] = intBuffer[i] & 0x7F;\r\n this.blockLength++;\r\n if ((intBuffer[i] & 0x80) === 0x00)\r\n break;\r\n }\r\n const tempView = new Uint8Array(this.blockLength);\r\n for (let i = 0; i < this.blockLength; i++) {\r\n tempView[i] = this.valueHexView[i];\r\n }\r\n this.valueHexView = tempView;\r\n if ((intBuffer[this.blockLength - 1] & 0x80) !== 0x00) {\r\n this.error = \"End of input reached before message was fully decoded\";\r\n return -1;\r\n }\r\n if (this.valueHexView[0] === 0x00)\r\n this.warnings.push(\"Needlessly long format of SID encoding\");\r\n if (this.blockLength <= 8)\r\n this.valueDec = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilFromBase(this.valueHexView, 7);\r\n else {\r\n this.isHexOnly = true;\r\n this.warnings.push(\"Too big SID for decoding, hex only\");\r\n }\r\n return (inputOffset + this.blockLength);\r\n }\r\n set valueBigInt(value) {\r\n assertBigInt();\r\n let bits = BigInt(value).toString(2);\r\n while (bits.length % 7) {\r\n bits = \"0\" + bits;\r\n }\r\n const bytes = new Uint8Array(bits.length / 7);\r\n for (let i = 0; i < bytes.length; i++) {\r\n bytes[i] = parseInt(bits.slice(i * 7, i * 7 + 7), 2) + (i + 1 < bytes.length ? 0x80 : 0);\r\n }\r\n this.fromBER(bytes.buffer, 0, bytes.length);\r\n }\r\n toBER(sizeOnly) {\r\n if (this.isHexOnly) {\r\n if (sizeOnly)\r\n return (new ArrayBuffer(this.valueHexView.byteLength));\r\n const curView = this.valueHexView;\r\n const retView = new Uint8Array(this.blockLength);\r\n for (let i = 0; i < (this.blockLength - 1); i++)\r\n retView[i] = curView[i] | 0x80;\r\n retView[this.blockLength - 1] = curView[this.blockLength - 1];\r\n return retView.buffer;\r\n }\r\n const encodedBuf = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilToBase(this.valueDec, 7);\r\n if (encodedBuf.byteLength === 0) {\r\n this.error = \"Error during encoding SID value\";\r\n return EMPTY_BUFFER;\r\n }\r\n const retView = new Uint8Array(encodedBuf.byteLength);\r\n if (!sizeOnly) {\r\n const encodedView = new Uint8Array(encodedBuf);\r\n const len = encodedBuf.byteLength - 1;\r\n for (let i = 0; i < len; i++)\r\n retView[i] = encodedView[i] | 0x80;\r\n retView[len] = encodedView[len];\r\n }\r\n return retView;\r\n }\r\n toString() {\r\n let result = \"\";\r\n if (this.isHexOnly)\r\n result = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueHexView);\r\n else {\r\n if (this.isFirstSid) {\r\n let sidValue = this.valueDec;\r\n if (this.valueDec <= 39)\r\n result = \"0.\";\r\n else {\r\n if (this.valueDec <= 79) {\r\n result = \"1.\";\r\n sidValue -= 40;\r\n }\r\n else {\r\n result = \"2.\";\r\n sidValue -= 80;\r\n }\r\n }\r\n result += sidValue.toString();\r\n }\r\n else\r\n result = this.valueDec.toString();\r\n }\r\n return result;\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n valueDec: this.valueDec,\r\n isFirstSid: this.isFirstSid,\r\n };\r\n }\r\n}\r\nLocalSidValueBlock.NAME = \"sidBlock\";\n\nclass LocalObjectIdentifierValueBlock extends ValueBlock {\r\n constructor({ value = EMPTY_STRING, ...parameters } = {}) {\r\n super(parameters);\r\n this.value = [];\r\n if (value) {\r\n this.fromString(value);\r\n }\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n let resultOffset = inputOffset;\r\n while (inputLength > 0) {\r\n const sidBlock = new LocalSidValueBlock();\r\n resultOffset = sidBlock.fromBER(inputBuffer, resultOffset, inputLength);\r\n if (resultOffset === -1) {\r\n this.blockLength = 0;\r\n this.error = sidBlock.error;\r\n return resultOffset;\r\n }\r\n if (this.value.length === 0)\r\n sidBlock.isFirstSid = true;\r\n this.blockLength += sidBlock.blockLength;\r\n inputLength -= sidBlock.blockLength;\r\n this.value.push(sidBlock);\r\n }\r\n return resultOffset;\r\n }\r\n toBER(sizeOnly) {\r\n const retBuffers = [];\r\n for (let i = 0; i < this.value.length; i++) {\r\n const valueBuf = this.value[i].toBER(sizeOnly);\r\n if (valueBuf.byteLength === 0) {\r\n this.error = this.value[i].error;\r\n return EMPTY_BUFFER;\r\n }\r\n retBuffers.push(valueBuf);\r\n }\r\n return concat(retBuffers);\r\n }\r\n fromString(string) {\r\n this.value = [];\r\n let pos1 = 0;\r\n let pos2 = 0;\r\n let sid = \"\";\r\n let flag = false;\r\n do {\r\n pos2 = string.indexOf(\".\", pos1);\r\n if (pos2 === -1)\r\n sid = string.substring(pos1);\r\n else\r\n sid = string.substring(pos1, pos2);\r\n pos1 = pos2 + 1;\r\n if (flag) {\r\n const sidBlock = this.value[0];\r\n let plus = 0;\r\n switch (sidBlock.valueDec) {\r\n case 0:\r\n break;\r\n case 1:\r\n plus = 40;\r\n break;\r\n case 2:\r\n plus = 80;\r\n break;\r\n default:\r\n this.value = [];\r\n return;\r\n }\r\n const parsedSID = parseInt(sid, 10);\r\n if (isNaN(parsedSID))\r\n return;\r\n sidBlock.valueDec = parsedSID + plus;\r\n flag = false;\r\n }\r\n else {\r\n const sidBlock = new LocalSidValueBlock();\r\n if (sid > Number.MAX_SAFE_INTEGER) {\r\n assertBigInt();\r\n const sidValue = BigInt(sid);\r\n sidBlock.valueBigInt = sidValue;\r\n }\r\n else {\r\n sidBlock.valueDec = parseInt(sid, 10);\r\n if (isNaN(sidBlock.valueDec))\r\n return;\r\n }\r\n if (!this.value.length) {\r\n sidBlock.isFirstSid = true;\r\n flag = true;\r\n }\r\n this.value.push(sidBlock);\r\n }\r\n } while (pos2 !== -1);\r\n }\r\n toString() {\r\n let result = \"\";\r\n let isHexOnly = false;\r\n for (let i = 0; i < this.value.length; i++) {\r\n isHexOnly = this.value[i].isHexOnly;\r\n let sidStr = this.value[i].toString();\r\n if (i !== 0)\r\n result = `${result}.`;\r\n if (isHexOnly) {\r\n sidStr = `{${sidStr}}`;\r\n if (this.value[i].isFirstSid)\r\n result = `2.{${sidStr} - 80}`;\r\n else\r\n result += sidStr;\r\n }\r\n else\r\n result += sidStr;\r\n }\r\n return result;\r\n }\r\n toJSON() {\r\n const object = {\r\n ...super.toJSON(),\r\n value: this.toString(),\r\n sidArray: [],\r\n };\r\n for (let i = 0; i < this.value.length; i++) {\r\n object.sidArray.push(this.value[i].toJSON());\r\n }\r\n return object;\r\n }\r\n}\r\nLocalObjectIdentifierValueBlock.NAME = \"ObjectIdentifierValueBlock\";\n\nvar _a$m;\r\nclass ObjectIdentifier extends BaseBlock {\r\n constructor(parameters = {}) {\r\n super(parameters, LocalObjectIdentifierValueBlock);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 6;\r\n }\r\n getValue() {\r\n return this.valueBlock.toString();\r\n }\r\n setValue(value) {\r\n this.valueBlock.fromString(value);\r\n }\r\n onAsciiEncoding() {\r\n return `${this.constructor.NAME} : ${this.valueBlock.toString() || \"empty\"}`;\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n value: this.getValue(),\r\n };\r\n }\r\n}\r\n_a$m = ObjectIdentifier;\r\n(() => {\r\n typeStore.ObjectIdentifier = _a$m;\r\n})();\r\nObjectIdentifier.NAME = \"OBJECT IDENTIFIER\";\n\nclass LocalRelativeSidValueBlock extends HexBlock(LocalBaseBlock) {\r\n constructor({ valueDec = 0, ...parameters } = {}) {\r\n super(parameters);\r\n this.valueDec = valueDec;\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n if (inputLength === 0)\r\n return inputOffset;\r\n const inputView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer);\r\n if (!checkBufferParams(this, inputView, inputOffset, inputLength))\r\n return -1;\r\n const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength);\r\n this.valueHexView = new Uint8Array(inputLength);\r\n for (let i = 0; i < inputLength; i++) {\r\n this.valueHexView[i] = intBuffer[i] & 0x7F;\r\n this.blockLength++;\r\n if ((intBuffer[i] & 0x80) === 0x00)\r\n break;\r\n }\r\n const tempView = new Uint8Array(this.blockLength);\r\n for (let i = 0; i < this.blockLength; i++)\r\n tempView[i] = this.valueHexView[i];\r\n this.valueHexView = tempView;\r\n if ((intBuffer[this.blockLength - 1] & 0x80) !== 0x00) {\r\n this.error = \"End of input reached before message was fully decoded\";\r\n return -1;\r\n }\r\n if (this.valueHexView[0] === 0x00)\r\n this.warnings.push(\"Needlessly long format of SID encoding\");\r\n if (this.blockLength <= 8)\r\n this.valueDec = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilFromBase(this.valueHexView, 7);\r\n else {\r\n this.isHexOnly = true;\r\n this.warnings.push(\"Too big SID for decoding, hex only\");\r\n }\r\n return (inputOffset + this.blockLength);\r\n }\r\n toBER(sizeOnly) {\r\n if (this.isHexOnly) {\r\n if (sizeOnly)\r\n return (new ArrayBuffer(this.valueHexView.byteLength));\r\n const curView = this.valueHexView;\r\n const retView = new Uint8Array(this.blockLength);\r\n for (let i = 0; i < (this.blockLength - 1); i++)\r\n retView[i] = curView[i] | 0x80;\r\n retView[this.blockLength - 1] = curView[this.blockLength - 1];\r\n return retView.buffer;\r\n }\r\n const encodedBuf = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilToBase(this.valueDec, 7);\r\n if (encodedBuf.byteLength === 0) {\r\n this.error = \"Error during encoding SID value\";\r\n return EMPTY_BUFFER;\r\n }\r\n const retView = new Uint8Array(encodedBuf.byteLength);\r\n if (!sizeOnly) {\r\n const encodedView = new Uint8Array(encodedBuf);\r\n const len = encodedBuf.byteLength - 1;\r\n for (let i = 0; i < len; i++)\r\n retView[i] = encodedView[i] | 0x80;\r\n retView[len] = encodedView[len];\r\n }\r\n return retView.buffer;\r\n }\r\n toString() {\r\n let result = \"\";\r\n if (this.isHexOnly)\r\n result = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueHexView);\r\n else {\r\n result = this.valueDec.toString();\r\n }\r\n return result;\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n valueDec: this.valueDec,\r\n };\r\n }\r\n}\r\nLocalRelativeSidValueBlock.NAME = \"relativeSidBlock\";\n\nclass LocalRelativeObjectIdentifierValueBlock extends ValueBlock {\r\n constructor({ value = EMPTY_STRING, ...parameters } = {}) {\r\n super(parameters);\r\n this.value = [];\r\n if (value) {\r\n this.fromString(value);\r\n }\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n let resultOffset = inputOffset;\r\n while (inputLength > 0) {\r\n const sidBlock = new LocalRelativeSidValueBlock();\r\n resultOffset = sidBlock.fromBER(inputBuffer, resultOffset, inputLength);\r\n if (resultOffset === -1) {\r\n this.blockLength = 0;\r\n this.error = sidBlock.error;\r\n return resultOffset;\r\n }\r\n this.blockLength += sidBlock.blockLength;\r\n inputLength -= sidBlock.blockLength;\r\n this.value.push(sidBlock);\r\n }\r\n return resultOffset;\r\n }\r\n toBER(sizeOnly, writer) {\r\n const retBuffers = [];\r\n for (let i = 0; i < this.value.length; i++) {\r\n const valueBuf = this.value[i].toBER(sizeOnly);\r\n if (valueBuf.byteLength === 0) {\r\n this.error = this.value[i].error;\r\n return EMPTY_BUFFER;\r\n }\r\n retBuffers.push(valueBuf);\r\n }\r\n return concat(retBuffers);\r\n }\r\n fromString(string) {\r\n this.value = [];\r\n let pos1 = 0;\r\n let pos2 = 0;\r\n let sid = \"\";\r\n do {\r\n pos2 = string.indexOf(\".\", pos1);\r\n if (pos2 === -1)\r\n sid = string.substring(pos1);\r\n else\r\n sid = string.substring(pos1, pos2);\r\n pos1 = pos2 + 1;\r\n const sidBlock = new LocalRelativeSidValueBlock();\r\n sidBlock.valueDec = parseInt(sid, 10);\r\n if (isNaN(sidBlock.valueDec))\r\n return true;\r\n this.value.push(sidBlock);\r\n } while (pos2 !== -1);\r\n return true;\r\n }\r\n toString() {\r\n let result = \"\";\r\n let isHexOnly = false;\r\n for (let i = 0; i < this.value.length; i++) {\r\n isHexOnly = this.value[i].isHexOnly;\r\n let sidStr = this.value[i].toString();\r\n if (i !== 0)\r\n result = `${result}.`;\r\n if (isHexOnly) {\r\n sidStr = `{${sidStr}}`;\r\n result += sidStr;\r\n }\r\n else\r\n result += sidStr;\r\n }\r\n return result;\r\n }\r\n toJSON() {\r\n const object = {\r\n ...super.toJSON(),\r\n value: this.toString(),\r\n sidArray: [],\r\n };\r\n for (let i = 0; i < this.value.length; i++)\r\n object.sidArray.push(this.value[i].toJSON());\r\n return object;\r\n }\r\n}\r\nLocalRelativeObjectIdentifierValueBlock.NAME = \"RelativeObjectIdentifierValueBlock\";\n\nvar _a$l;\r\nclass RelativeObjectIdentifier extends BaseBlock {\r\n constructor(parameters = {}) {\r\n super(parameters, LocalRelativeObjectIdentifierValueBlock);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 13;\r\n }\r\n getValue() {\r\n return this.valueBlock.toString();\r\n }\r\n setValue(value) {\r\n this.valueBlock.fromString(value);\r\n }\r\n onAsciiEncoding() {\r\n return `${this.constructor.NAME} : ${this.valueBlock.toString() || \"empty\"}`;\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n value: this.getValue(),\r\n };\r\n }\r\n}\r\n_a$l = RelativeObjectIdentifier;\r\n(() => {\r\n typeStore.RelativeObjectIdentifier = _a$l;\r\n})();\r\nRelativeObjectIdentifier.NAME = \"RelativeObjectIdentifier\";\n\nvar _a$k;\r\nclass Sequence extends Constructed {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 16;\r\n }\r\n}\r\n_a$k = Sequence;\r\n(() => {\r\n typeStore.Sequence = _a$k;\r\n})();\r\nSequence.NAME = \"SEQUENCE\";\n\nvar _a$j;\r\nclass Set extends Constructed {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 17;\r\n }\r\n}\r\n_a$j = Set;\r\n(() => {\r\n typeStore.Set = _a$j;\r\n})();\r\nSet.NAME = \"SET\";\n\nclass LocalStringValueBlock extends HexBlock(ValueBlock) {\r\n constructor({ ...parameters } = {}) {\r\n super(parameters);\r\n this.isHexOnly = true;\r\n this.value = EMPTY_STRING;\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n value: this.value,\r\n };\r\n }\r\n}\r\nLocalStringValueBlock.NAME = \"StringValueBlock\";\n\nclass LocalSimpleStringValueBlock extends LocalStringValueBlock {\r\n}\r\nLocalSimpleStringValueBlock.NAME = \"SimpleStringValueBlock\";\n\nclass LocalSimpleStringBlock extends BaseStringBlock {\r\n constructor({ ...parameters } = {}) {\r\n super(parameters, LocalSimpleStringValueBlock);\r\n }\r\n fromBuffer(inputBuffer) {\r\n this.valueBlock.value = String.fromCharCode.apply(null, pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer));\r\n }\r\n fromString(inputString) {\r\n const strLen = inputString.length;\r\n const view = this.valueBlock.valueHexView = new Uint8Array(strLen);\r\n for (let i = 0; i < strLen; i++)\r\n view[i] = inputString.charCodeAt(i);\r\n this.valueBlock.value = inputString;\r\n }\r\n}\r\nLocalSimpleStringBlock.NAME = \"SIMPLE STRING\";\n\nclass LocalUtf8StringValueBlock extends LocalSimpleStringBlock {\r\n fromBuffer(inputBuffer) {\r\n this.valueBlock.valueHexView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer);\r\n try {\r\n this.valueBlock.value = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToUtf8String(inputBuffer);\r\n }\r\n catch (ex) {\r\n this.warnings.push(`Error during \"decodeURIComponent\": ${ex}, using raw string`);\r\n this.valueBlock.value = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToBinary(inputBuffer);\r\n }\r\n }\r\n fromString(inputString) {\r\n this.valueBlock.valueHexView = new Uint8Array(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.FromUtf8String(inputString));\r\n this.valueBlock.value = inputString;\r\n }\r\n}\r\nLocalUtf8StringValueBlock.NAME = \"Utf8StringValueBlock\";\n\nvar _a$i;\r\nclass Utf8String extends LocalUtf8StringValueBlock {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 12;\r\n }\r\n}\r\n_a$i = Utf8String;\r\n(() => {\r\n typeStore.Utf8String = _a$i;\r\n})();\r\nUtf8String.NAME = \"UTF8String\";\n\nclass LocalBmpStringValueBlock extends LocalSimpleStringBlock {\r\n fromBuffer(inputBuffer) {\r\n this.valueBlock.value = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToUtf16String(inputBuffer);\r\n this.valueBlock.valueHexView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer);\r\n }\r\n fromString(inputString) {\r\n this.valueBlock.value = inputString;\r\n this.valueBlock.valueHexView = new Uint8Array(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.FromUtf16String(inputString));\r\n }\r\n}\r\nLocalBmpStringValueBlock.NAME = \"BmpStringValueBlock\";\n\nvar _a$h;\r\nclass BmpString extends LocalBmpStringValueBlock {\r\n constructor({ ...parameters } = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 30;\r\n }\r\n}\r\n_a$h = BmpString;\r\n(() => {\r\n typeStore.BmpString = _a$h;\r\n})();\r\nBmpString.NAME = \"BMPString\";\n\nclass LocalUniversalStringValueBlock extends LocalSimpleStringBlock {\r\n fromBuffer(inputBuffer) {\r\n const copyBuffer = ArrayBuffer.isView(inputBuffer) ? inputBuffer.slice().buffer : inputBuffer.slice(0);\r\n const valueView = new Uint8Array(copyBuffer);\r\n for (let i = 0; i < valueView.length; i += 4) {\r\n valueView[i] = valueView[i + 3];\r\n valueView[i + 1] = valueView[i + 2];\r\n valueView[i + 2] = 0x00;\r\n valueView[i + 3] = 0x00;\r\n }\r\n this.valueBlock.value = String.fromCharCode.apply(null, new Uint32Array(copyBuffer));\r\n }\r\n fromString(inputString) {\r\n const strLength = inputString.length;\r\n const valueHexView = this.valueBlock.valueHexView = new Uint8Array(strLength * 4);\r\n for (let i = 0; i < strLength; i++) {\r\n const codeBuf = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilToBase(inputString.charCodeAt(i), 8);\r\n const codeView = new Uint8Array(codeBuf);\r\n if (codeView.length > 4)\r\n continue;\r\n const dif = 4 - codeView.length;\r\n for (let j = (codeView.length - 1); j >= 0; j--)\r\n valueHexView[i * 4 + j + dif] = codeView[j];\r\n }\r\n this.valueBlock.value = inputString;\r\n }\r\n}\r\nLocalUniversalStringValueBlock.NAME = \"UniversalStringValueBlock\";\n\nvar _a$g;\r\nclass UniversalString extends LocalUniversalStringValueBlock {\r\n constructor({ ...parameters } = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 28;\r\n }\r\n}\r\n_a$g = UniversalString;\r\n(() => {\r\n typeStore.UniversalString = _a$g;\r\n})();\r\nUniversalString.NAME = \"UniversalString\";\n\nvar _a$f;\r\nclass NumericString extends LocalSimpleStringBlock {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 18;\r\n }\r\n}\r\n_a$f = NumericString;\r\n(() => {\r\n typeStore.NumericString = _a$f;\r\n})();\r\nNumericString.NAME = \"NumericString\";\n\nvar _a$e;\r\nclass PrintableString extends LocalSimpleStringBlock {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 19;\r\n }\r\n}\r\n_a$e = PrintableString;\r\n(() => {\r\n typeStore.PrintableString = _a$e;\r\n})();\r\nPrintableString.NAME = \"PrintableString\";\n\nvar _a$d;\r\nclass TeletexString extends LocalSimpleStringBlock {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 20;\r\n }\r\n}\r\n_a$d = TeletexString;\r\n(() => {\r\n typeStore.TeletexString = _a$d;\r\n})();\r\nTeletexString.NAME = \"TeletexString\";\n\nvar _a$c;\r\nclass VideotexString extends LocalSimpleStringBlock {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 21;\r\n }\r\n}\r\n_a$c = VideotexString;\r\n(() => {\r\n typeStore.VideotexString = _a$c;\r\n})();\r\nVideotexString.NAME = \"VideotexString\";\n\nvar _a$b;\r\nclass IA5String extends LocalSimpleStringBlock {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 22;\r\n }\r\n}\r\n_a$b = IA5String;\r\n(() => {\r\n typeStore.IA5String = _a$b;\r\n})();\r\nIA5String.NAME = \"IA5String\";\n\nvar _a$a;\r\nclass GraphicString extends LocalSimpleStringBlock {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 25;\r\n }\r\n}\r\n_a$a = GraphicString;\r\n(() => {\r\n typeStore.GraphicString = _a$a;\r\n})();\r\nGraphicString.NAME = \"GraphicString\";\n\nvar _a$9;\r\nclass VisibleString extends LocalSimpleStringBlock {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 26;\r\n }\r\n}\r\n_a$9 = VisibleString;\r\n(() => {\r\n typeStore.VisibleString = _a$9;\r\n})();\r\nVisibleString.NAME = \"VisibleString\";\n\nvar _a$8;\r\nclass GeneralString extends LocalSimpleStringBlock {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 27;\r\n }\r\n}\r\n_a$8 = GeneralString;\r\n(() => {\r\n typeStore.GeneralString = _a$8;\r\n})();\r\nGeneralString.NAME = \"GeneralString\";\n\nvar _a$7;\r\nclass CharacterString extends LocalSimpleStringBlock {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 29;\r\n }\r\n}\r\n_a$7 = CharacterString;\r\n(() => {\r\n typeStore.CharacterString = _a$7;\r\n})();\r\nCharacterString.NAME = \"CharacterString\";\n\nvar _a$6;\r\nclass UTCTime extends VisibleString {\r\n constructor({ value, valueDate, ...parameters } = {}) {\r\n super(parameters);\r\n this.year = 0;\r\n this.month = 0;\r\n this.day = 0;\r\n this.hour = 0;\r\n this.minute = 0;\r\n this.second = 0;\r\n if (value) {\r\n this.fromString(value);\r\n this.valueBlock.valueHexView = new Uint8Array(value.length);\r\n for (let i = 0; i < value.length; i++)\r\n this.valueBlock.valueHexView[i] = value.charCodeAt(i);\r\n }\r\n if (valueDate) {\r\n this.fromDate(valueDate);\r\n this.valueBlock.valueHexView = new Uint8Array(this.toBuffer());\r\n }\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 23;\r\n }\r\n fromBuffer(inputBuffer) {\r\n this.fromString(String.fromCharCode.apply(null, pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer)));\r\n }\r\n toBuffer() {\r\n const str = this.toString();\r\n const buffer = new ArrayBuffer(str.length);\r\n const view = new Uint8Array(buffer);\r\n for (let i = 0; i < str.length; i++)\r\n view[i] = str.charCodeAt(i);\r\n return buffer;\r\n }\r\n fromDate(inputDate) {\r\n this.year = inputDate.getUTCFullYear();\r\n this.month = inputDate.getUTCMonth() + 1;\r\n this.day = inputDate.getUTCDate();\r\n this.hour = inputDate.getUTCHours();\r\n this.minute = inputDate.getUTCMinutes();\r\n this.second = inputDate.getUTCSeconds();\r\n }\r\n toDate() {\r\n return (new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second)));\r\n }\r\n fromString(inputString) {\r\n const parser = /(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})Z/ig;\r\n const parserArray = parser.exec(inputString);\r\n if (parserArray === null) {\r\n this.error = \"Wrong input string for conversion\";\r\n return;\r\n }\r\n const year = parseInt(parserArray[1], 10);\r\n if (year >= 50)\r\n this.year = 1900 + year;\r\n else\r\n this.year = 2000 + year;\r\n this.month = parseInt(parserArray[2], 10);\r\n this.day = parseInt(parserArray[3], 10);\r\n this.hour = parseInt(parserArray[4], 10);\r\n this.minute = parseInt(parserArray[5], 10);\r\n this.second = parseInt(parserArray[6], 10);\r\n }\r\n toString(encoding = \"iso\") {\r\n if (encoding === \"iso\") {\r\n const outputArray = new Array(7);\r\n outputArray[0] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(((this.year < 2000) ? (this.year - 1900) : (this.year - 2000)), 2);\r\n outputArray[1] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.month, 2);\r\n outputArray[2] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.day, 2);\r\n outputArray[3] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.hour, 2);\r\n outputArray[4] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.minute, 2);\r\n outputArray[5] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.second, 2);\r\n outputArray[6] = \"Z\";\r\n return outputArray.join(\"\");\r\n }\r\n return super.toString(encoding);\r\n }\r\n onAsciiEncoding() {\r\n return `${this.constructor.NAME} : ${this.toDate().toISOString()}`;\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n year: this.year,\r\n month: this.month,\r\n day: this.day,\r\n hour: this.hour,\r\n minute: this.minute,\r\n second: this.second,\r\n };\r\n }\r\n}\r\n_a$6 = UTCTime;\r\n(() => {\r\n typeStore.UTCTime = _a$6;\r\n})();\r\nUTCTime.NAME = \"UTCTime\";\n\nvar _a$5;\r\nclass GeneralizedTime extends UTCTime {\r\n constructor(parameters = {}) {\r\n var _b;\r\n super(parameters);\r\n (_b = this.millisecond) !== null && _b !== void 0 ? _b : (this.millisecond = 0);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 24;\r\n }\r\n fromDate(inputDate) {\r\n super.fromDate(inputDate);\r\n this.millisecond = inputDate.getUTCMilliseconds();\r\n }\r\n toDate() {\r\n return (new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond)));\r\n }\r\n fromString(inputString) {\r\n let isUTC = false;\r\n let timeString = \"\";\r\n let dateTimeString = \"\";\r\n let fractionPart = 0;\r\n let parser;\r\n let hourDifference = 0;\r\n let minuteDifference = 0;\r\n if (inputString[inputString.length - 1] === \"Z\") {\r\n timeString = inputString.substring(0, inputString.length - 1);\r\n isUTC = true;\r\n }\r\n else {\r\n const number = new Number(inputString[inputString.length - 1]);\r\n if (isNaN(number.valueOf()))\r\n throw new Error(\"Wrong input string for conversion\");\r\n timeString = inputString;\r\n }\r\n if (isUTC) {\r\n if (timeString.indexOf(\"+\") !== -1)\r\n throw new Error(\"Wrong input string for conversion\");\r\n if (timeString.indexOf(\"-\") !== -1)\r\n throw new Error(\"Wrong input string for conversion\");\r\n }\r\n else {\r\n let multiplier = 1;\r\n let differencePosition = timeString.indexOf(\"+\");\r\n let differenceString = \"\";\r\n if (differencePosition === -1) {\r\n differencePosition = timeString.indexOf(\"-\");\r\n multiplier = -1;\r\n }\r\n if (differencePosition !== -1) {\r\n differenceString = timeString.substring(differencePosition + 1);\r\n timeString = timeString.substring(0, differencePosition);\r\n if ((differenceString.length !== 2) && (differenceString.length !== 4))\r\n throw new Error(\"Wrong input string for conversion\");\r\n let number = parseInt(differenceString.substring(0, 2), 10);\r\n if (isNaN(number.valueOf()))\r\n throw new Error(\"Wrong input string for conversion\");\r\n hourDifference = multiplier * number;\r\n if (differenceString.length === 4) {\r\n number = parseInt(differenceString.substring(2, 4), 10);\r\n if (isNaN(number.valueOf()))\r\n throw new Error(\"Wrong input string for conversion\");\r\n minuteDifference = multiplier * number;\r\n }\r\n }\r\n }\r\n let fractionPointPosition = timeString.indexOf(\".\");\r\n if (fractionPointPosition === -1)\r\n fractionPointPosition = timeString.indexOf(\",\");\r\n if (fractionPointPosition !== -1) {\r\n const fractionPartCheck = new Number(`0${timeString.substring(fractionPointPosition)}`);\r\n if (isNaN(fractionPartCheck.valueOf()))\r\n throw new Error(\"Wrong input string for conversion\");\r\n fractionPart = fractionPartCheck.valueOf();\r\n dateTimeString = timeString.substring(0, fractionPointPosition);\r\n }\r\n else\r\n dateTimeString = timeString;\r\n switch (true) {\r\n case (dateTimeString.length === 8):\r\n parser = /(\\d{4})(\\d{2})(\\d{2})/ig;\r\n if (fractionPointPosition !== -1)\r\n throw new Error(\"Wrong input string for conversion\");\r\n break;\r\n case (dateTimeString.length === 10):\r\n parser = /(\\d{4})(\\d{2})(\\d{2})(\\d{2})/ig;\r\n if (fractionPointPosition !== -1) {\r\n let fractionResult = 60 * fractionPart;\r\n this.minute = Math.floor(fractionResult);\r\n fractionResult = 60 * (fractionResult - this.minute);\r\n this.second = Math.floor(fractionResult);\r\n fractionResult = 1000 * (fractionResult - this.second);\r\n this.millisecond = Math.floor(fractionResult);\r\n }\r\n break;\r\n case (dateTimeString.length === 12):\r\n parser = /(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/ig;\r\n if (fractionPointPosition !== -1) {\r\n let fractionResult = 60 * fractionPart;\r\n this.second = Math.floor(fractionResult);\r\n fractionResult = 1000 * (fractionResult - this.second);\r\n this.millisecond = Math.floor(fractionResult);\r\n }\r\n break;\r\n case (dateTimeString.length === 14):\r\n parser = /(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/ig;\r\n if (fractionPointPosition !== -1) {\r\n const fractionResult = 1000 * fractionPart;\r\n this.millisecond = Math.floor(fractionResult);\r\n }\r\n break;\r\n default:\r\n throw new Error(\"Wrong input string for conversion\");\r\n }\r\n const parserArray = parser.exec(dateTimeString);\r\n if (parserArray === null)\r\n throw new Error(\"Wrong input string for conversion\");\r\n for (let j = 1; j < parserArray.length; j++) {\r\n switch (j) {\r\n case 1:\r\n this.year = parseInt(parserArray[j], 10);\r\n break;\r\n case 2:\r\n this.month = parseInt(parserArray[j], 10);\r\n break;\r\n case 3:\r\n this.day = parseInt(parserArray[j], 10);\r\n break;\r\n case 4:\r\n this.hour = parseInt(parserArray[j], 10) + hourDifference;\r\n break;\r\n case 5:\r\n this.minute = parseInt(parserArray[j], 10) + minuteDifference;\r\n break;\r\n case 6:\r\n this.second = parseInt(parserArray[j], 10);\r\n break;\r\n default:\r\n throw new Error(\"Wrong input string for conversion\");\r\n }\r\n }\r\n if (isUTC === false) {\r\n const tempDate = new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);\r\n this.year = tempDate.getUTCFullYear();\r\n this.month = tempDate.getUTCMonth();\r\n this.day = tempDate.getUTCDay();\r\n this.hour = tempDate.getUTCHours();\r\n this.minute = tempDate.getUTCMinutes();\r\n this.second = tempDate.getUTCSeconds();\r\n this.millisecond = tempDate.getUTCMilliseconds();\r\n }\r\n }\r\n toString(encoding = \"iso\") {\r\n if (encoding === \"iso\") {\r\n const outputArray = [];\r\n outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.year, 4));\r\n outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.month, 2));\r\n outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.day, 2));\r\n outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.hour, 2));\r\n outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.minute, 2));\r\n outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.second, 2));\r\n if (this.millisecond !== 0) {\r\n outputArray.push(\".\");\r\n outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.millisecond, 3));\r\n }\r\n outputArray.push(\"Z\");\r\n return outputArray.join(\"\");\r\n }\r\n return super.toString(encoding);\r\n }\r\n toJSON() {\r\n return {\r\n ...super.toJSON(),\r\n millisecond: this.millisecond,\r\n };\r\n }\r\n}\r\n_a$5 = GeneralizedTime;\r\n(() => {\r\n typeStore.GeneralizedTime = _a$5;\r\n})();\r\nGeneralizedTime.NAME = \"GeneralizedTime\";\n\nvar _a$4;\r\nclass DATE extends Utf8String {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 31;\r\n }\r\n}\r\n_a$4 = DATE;\r\n(() => {\r\n typeStore.DATE = _a$4;\r\n})();\r\nDATE.NAME = \"DATE\";\n\nvar _a$3;\r\nclass TimeOfDay extends Utf8String {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 32;\r\n }\r\n}\r\n_a$3 = TimeOfDay;\r\n(() => {\r\n typeStore.TimeOfDay = _a$3;\r\n})();\r\nTimeOfDay.NAME = \"TimeOfDay\";\n\nvar _a$2;\r\nclass DateTime extends Utf8String {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 33;\r\n }\r\n}\r\n_a$2 = DateTime;\r\n(() => {\r\n typeStore.DateTime = _a$2;\r\n})();\r\nDateTime.NAME = \"DateTime\";\n\nvar _a$1;\r\nclass Duration extends Utf8String {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 34;\r\n }\r\n}\r\n_a$1 = Duration;\r\n(() => {\r\n typeStore.Duration = _a$1;\r\n})();\r\nDuration.NAME = \"Duration\";\n\nvar _a;\r\nclass TIME extends Utf8String {\r\n constructor(parameters = {}) {\r\n super(parameters);\r\n this.idBlock.tagClass = 1;\r\n this.idBlock.tagNumber = 14;\r\n }\r\n}\r\n_a = TIME;\r\n(() => {\r\n typeStore.TIME = _a;\r\n})();\r\nTIME.NAME = \"TIME\";\n\nclass Any {\r\n constructor({ name = EMPTY_STRING, optional = false, } = {}) {\r\n this.name = name;\r\n this.optional = optional;\r\n }\r\n}\n\nclass Choice extends Any {\r\n constructor({ value = [], ...parameters } = {}) {\r\n super(parameters);\r\n this.value = value;\r\n }\r\n}\n\nclass Repeated extends Any {\r\n constructor({ value = new Any(), local = false, ...parameters } = {}) {\r\n super(parameters);\r\n this.value = value;\r\n this.local = local;\r\n }\r\n}\n\nclass RawData {\r\n constructor({ data = EMPTY_VIEW } = {}) {\r\n this.dataView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(data);\r\n }\r\n get data() {\r\n return this.dataView.slice().buffer;\r\n }\r\n set data(value) {\r\n this.dataView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(value);\r\n }\r\n fromBER(inputBuffer, inputOffset, inputLength) {\r\n const endLength = inputOffset + inputLength;\r\n this.dataView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer).subarray(inputOffset, endLength);\r\n return endLength;\r\n }\r\n toBER(sizeOnly) {\r\n return this.dataView.slice().buffer;\r\n }\r\n}\n\nfunction compareSchema(root, inputData, inputSchema) {\r\n if (inputSchema instanceof Choice) {\r\n for (let j = 0; j < inputSchema.value.length; j++) {\r\n const result = compareSchema(root, inputData, inputSchema.value[j]);\r\n if (result.verified) {\r\n return {\r\n verified: true,\r\n result: root\r\n };\r\n }\r\n }\r\n {\r\n const _result = {\r\n verified: false,\r\n result: {\r\n error: \"Wrong values for Choice type\"\r\n },\r\n };\r\n if (inputSchema.hasOwnProperty(NAME))\r\n _result.name = inputSchema.name;\r\n return _result;\r\n }\r\n }\r\n if (inputSchema instanceof Any) {\r\n if (inputSchema.hasOwnProperty(NAME))\r\n root[inputSchema.name] = inputData;\r\n return {\r\n verified: true,\r\n result: root\r\n };\r\n }\r\n if ((root instanceof Object) === false) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong root object\" }\r\n };\r\n }\r\n if ((inputData instanceof Object) === false) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong ASN.1 data\" }\r\n };\r\n }\r\n if ((inputSchema instanceof Object) === false) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong ASN.1 schema\" }\r\n };\r\n }\r\n if ((ID_BLOCK in inputSchema) === false) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong ASN.1 schema\" }\r\n };\r\n }\r\n if ((FROM_BER in inputSchema.idBlock) === false) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong ASN.1 schema\" }\r\n };\r\n }\r\n if ((TO_BER in inputSchema.idBlock) === false) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong ASN.1 schema\" }\r\n };\r\n }\r\n const encodedId = inputSchema.idBlock.toBER(false);\r\n if (encodedId.byteLength === 0) {\r\n return {\r\n verified: false,\r\n result: { error: \"Error encoding idBlock for ASN.1 schema\" }\r\n };\r\n }\r\n const decodedOffset = inputSchema.idBlock.fromBER(encodedId, 0, encodedId.byteLength);\r\n if (decodedOffset === -1) {\r\n return {\r\n verified: false,\r\n result: { error: \"Error decoding idBlock for ASN.1 schema\" }\r\n };\r\n }\r\n if (inputSchema.idBlock.hasOwnProperty(TAG_CLASS) === false) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong ASN.1 schema\" }\r\n };\r\n }\r\n if (inputSchema.idBlock.tagClass !== inputData.idBlock.tagClass) {\r\n return {\r\n verified: false,\r\n result: root\r\n };\r\n }\r\n if (inputSchema.idBlock.hasOwnProperty(TAG_NUMBER) === false) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong ASN.1 schema\" }\r\n };\r\n }\r\n if (inputSchema.idBlock.tagNumber !== inputData.idBlock.tagNumber) {\r\n return {\r\n verified: false,\r\n result: root\r\n };\r\n }\r\n if (inputSchema.idBlock.hasOwnProperty(IS_CONSTRUCTED) === false) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong ASN.1 schema\" }\r\n };\r\n }\r\n if (inputSchema.idBlock.isConstructed !== inputData.idBlock.isConstructed) {\r\n return {\r\n verified: false,\r\n result: root\r\n };\r\n }\r\n if (!(IS_HEX_ONLY in inputSchema.idBlock)) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong ASN.1 schema\" }\r\n };\r\n }\r\n if (inputSchema.idBlock.isHexOnly !== inputData.idBlock.isHexOnly) {\r\n return {\r\n verified: false,\r\n result: root\r\n };\r\n }\r\n if (inputSchema.idBlock.isHexOnly) {\r\n if ((VALUE_HEX_VIEW in inputSchema.idBlock) === false) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong ASN.1 schema\" }\r\n };\r\n }\r\n const schemaView = inputSchema.idBlock.valueHexView;\r\n const asn1View = inputData.idBlock.valueHexView;\r\n if (schemaView.length !== asn1View.length) {\r\n return {\r\n verified: false,\r\n result: root\r\n };\r\n }\r\n for (let i = 0; i < schemaView.length; i++) {\r\n if (schemaView[i] !== asn1View[1]) {\r\n return {\r\n verified: false,\r\n result: root\r\n };\r\n }\r\n }\r\n }\r\n if (inputSchema.name) {\r\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\r\n if (inputSchema.name)\r\n root[inputSchema.name] = inputData;\r\n }\r\n if (inputSchema instanceof typeStore.Constructed) {\r\n let admission = 0;\r\n let result = {\r\n verified: false,\r\n result: {\r\n error: \"Unknown error\",\r\n }\r\n };\r\n let maxLength = inputSchema.valueBlock.value.length;\r\n if (maxLength > 0) {\r\n if (inputSchema.valueBlock.value[0] instanceof Repeated) {\r\n maxLength = inputData.valueBlock.value.length;\r\n }\r\n }\r\n if (maxLength === 0) {\r\n return {\r\n verified: true,\r\n result: root\r\n };\r\n }\r\n if ((inputData.valueBlock.value.length === 0) &&\r\n (inputSchema.valueBlock.value.length !== 0)) {\r\n let _optional = true;\r\n for (let i = 0; i < inputSchema.valueBlock.value.length; i++)\r\n _optional = _optional && (inputSchema.valueBlock.value[i].optional || false);\r\n if (_optional) {\r\n return {\r\n verified: true,\r\n result: root\r\n };\r\n }\r\n if (inputSchema.name) {\r\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\r\n if (inputSchema.name)\r\n delete root[inputSchema.name];\r\n }\r\n root.error = \"Inconsistent object length\";\r\n return {\r\n verified: false,\r\n result: root\r\n };\r\n }\r\n for (let i = 0; i < maxLength; i++) {\r\n if ((i - admission) >= inputData.valueBlock.value.length) {\r\n if (inputSchema.valueBlock.value[i].optional === false) {\r\n const _result = {\r\n verified: false,\r\n result: root\r\n };\r\n root.error = \"Inconsistent length between ASN.1 data and schema\";\r\n if (inputSchema.name) {\r\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\r\n if (inputSchema.name) {\r\n delete root[inputSchema.name];\r\n _result.name = inputSchema.name;\r\n }\r\n }\r\n return _result;\r\n }\r\n }\r\n else {\r\n if (inputSchema.valueBlock.value[0] instanceof Repeated) {\r\n result = compareSchema(root, inputData.valueBlock.value[i], inputSchema.valueBlock.value[0].value);\r\n if (result.verified === false) {\r\n if (inputSchema.valueBlock.value[0].optional)\r\n admission++;\r\n else {\r\n if (inputSchema.name) {\r\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\r\n if (inputSchema.name)\r\n delete root[inputSchema.name];\r\n }\r\n return result;\r\n }\r\n }\r\n if ((NAME in inputSchema.valueBlock.value[0]) && (inputSchema.valueBlock.value[0].name.length > 0)) {\r\n let arrayRoot = {};\r\n if ((LOCAL in inputSchema.valueBlock.value[0]) && (inputSchema.valueBlock.value[0].local))\r\n arrayRoot = inputData;\r\n else\r\n arrayRoot = root;\r\n if (typeof arrayRoot[inputSchema.valueBlock.value[0].name] === \"undefined\")\r\n arrayRoot[inputSchema.valueBlock.value[0].name] = [];\r\n arrayRoot[inputSchema.valueBlock.value[0].name].push(inputData.valueBlock.value[i]);\r\n }\r\n }\r\n else {\r\n result = compareSchema(root, inputData.valueBlock.value[i - admission], inputSchema.valueBlock.value[i]);\r\n if (result.verified === false) {\r\n if (inputSchema.valueBlock.value[i].optional)\r\n admission++;\r\n else {\r\n if (inputSchema.name) {\r\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\r\n if (inputSchema.name)\r\n delete root[inputSchema.name];\r\n }\r\n return result;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n if (result.verified === false) {\r\n const _result = {\r\n verified: false,\r\n result: root\r\n };\r\n if (inputSchema.name) {\r\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\r\n if (inputSchema.name) {\r\n delete root[inputSchema.name];\r\n _result.name = inputSchema.name;\r\n }\r\n }\r\n return _result;\r\n }\r\n return {\r\n verified: true,\r\n result: root\r\n };\r\n }\r\n if (inputSchema.primitiveSchema &&\r\n (VALUE_HEX_VIEW in inputData.valueBlock)) {\r\n const asn1 = localFromBER(inputData.valueBlock.valueHexView);\r\n if (asn1.offset === -1) {\r\n const _result = {\r\n verified: false,\r\n result: asn1.result\r\n };\r\n if (inputSchema.name) {\r\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\r\n if (inputSchema.name) {\r\n delete root[inputSchema.name];\r\n _result.name = inputSchema.name;\r\n }\r\n }\r\n return _result;\r\n }\r\n return compareSchema(root, asn1.result, inputSchema.primitiveSchema);\r\n }\r\n return {\r\n verified: true,\r\n result: root\r\n };\r\n}\r\nfunction verifySchema(inputBuffer, inputSchema) {\r\n if ((inputSchema instanceof Object) === false) {\r\n return {\r\n verified: false,\r\n result: { error: \"Wrong ASN.1 schema type\" }\r\n };\r\n }\r\n const asn1 = localFromBER(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer));\r\n if (asn1.offset === -1) {\r\n return {\r\n verified: false,\r\n result: asn1.result\r\n };\r\n }\r\n return compareSchema(asn1.result, asn1.result, inputSchema);\r\n}\n\n\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/asn1js/build/index.es.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/bn.js/lib/bn.js":
|
||
/*!**************************************!*\
|
||
!*** ./node_modules/bn.js/lib/bn.js ***!
|
||
\**************************************/
|
||
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
||
|
||
eval("/* module decorator */ module = __webpack_require__.nmd(module);\n(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = (__webpack_require__(/*! buffer */ \"?8131\").Buffer);\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this._strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // '0' - '9'\n if (c >= 48 && c <= 57) {\n return c - 48;\n // 'A' - 'F'\n } else if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n assert(false, 'Invalid character in ' + string);\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this._strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n b = c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n b = c;\n }\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this._strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move (dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move (dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype._strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect () {\n return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';\n }\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate (ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position++] = word & 0xff;\n if (position < res.length) {\n res[position++] = (word >> 8) & 0xff;\n }\n if (position < res.length) {\n res[position++] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position--] = word & 0xff;\n if (position >= 0) {\n res[position--] = (word >> 8) & 0xff;\n }\n if (position >= 0) {\n res[position--] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] >>> wbit) & 0x01;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this._strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this._strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo (self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q._strip();\n }\n a._strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n };\n\n // WARNING: DEPRECATED\n BN.prototype.modn = function modn (num) {\n return this.modrn(num);\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n this._strip();\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})( false || module, this);\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/bn.js/lib/bn.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/debug/src/browser.js":
|
||
/*!*******************************************!*\
|
||
!*** ./node_modules/debug/src/browser.js ***!
|
||
\*******************************************/
|
||
/***/ ((module, exports, __webpack_require__) => {
|
||
|
||
eval("/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = __webpack_require__(/*! ./common */ \"./node_modules/debug/src/common.js\")(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/debug/src/browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/debug/src/common.js":
|
||
/*!******************************************!*\
|
||
!*** ./node_modules/debug/src/common.js ***!
|
||
\******************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = __webpack_require__(/*! ms */ \"./node_modules/ms/index.js\");\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/debug/src/common.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/denque/index.js":
|
||
/*!**************************************!*\
|
||
!*** ./node_modules/denque/index.js ***!
|
||
\**************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\n\n/**\n * Custom implementation of a double ended queue.\n */\nfunction Denque(array, options) {\n var options = options || {};\n this._capacity = options.capacity;\n\n this._head = 0;\n this._tail = 0;\n\n if (Array.isArray(array)) {\n this._fromArray(array);\n } else {\n this._capacityMask = 0x3;\n this._list = new Array(4);\n }\n}\n\n/**\n * --------------\n * PUBLIC API\n * -------------\n */\n\n/**\n * Returns the item at the specified index from the list.\n * 0 is the first element, 1 is the second, and so on...\n * Elements at negative values are that many from the end: -1 is one before the end\n * (the last element), -2 is two before the end (one before last), etc.\n * @param index\n * @returns {*}\n */\nDenque.prototype.peekAt = function peekAt(index) {\n var i = index;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n var len = this.size();\n if (i >= len || i < -len) return undefined;\n if (i < 0) i += len;\n i = (this._head + i) & this._capacityMask;\n return this._list[i];\n};\n\n/**\n * Alias for peekAt()\n * @param i\n * @returns {*}\n */\nDenque.prototype.get = function get(i) {\n return this.peekAt(i);\n};\n\n/**\n * Returns the first item in the list without removing it.\n * @returns {*}\n */\nDenque.prototype.peek = function peek() {\n if (this._head === this._tail) return undefined;\n return this._list[this._head];\n};\n\n/**\n * Alias for peek()\n * @returns {*}\n */\nDenque.prototype.peekFront = function peekFront() {\n return this.peek();\n};\n\n/**\n * Returns the item that is at the back of the queue without removing it.\n * Uses peekAt(-1)\n */\nDenque.prototype.peekBack = function peekBack() {\n return this.peekAt(-1);\n};\n\n/**\n * Returns the current length of the queue\n * @return {Number}\n */\nObject.defineProperty(Denque.prototype, 'length', {\n get: function length() {\n return this.size();\n }\n});\n\n/**\n * Return the number of items on the list, or 0 if empty.\n * @returns {number}\n */\nDenque.prototype.size = function size() {\n if (this._head === this._tail) return 0;\n if (this._head < this._tail) return this._tail - this._head;\n else return this._capacityMask + 1 - (this._head - this._tail);\n};\n\n/**\n * Add an item at the beginning of the list.\n * @param item\n */\nDenque.prototype.unshift = function unshift(item) {\n if (arguments.length === 0) return this.size();\n var len = this._list.length;\n this._head = (this._head - 1 + len) & this._capacityMask;\n this._list[this._head] = item;\n if (this._tail === this._head) this._growArray();\n if (this._capacity && this.size() > this._capacity) this.pop();\n if (this._head < this._tail) return this._tail - this._head;\n else return this._capacityMask + 1 - (this._head - this._tail);\n};\n\n/**\n * Remove and return the first item on the list,\n * Returns undefined if the list is empty.\n * @returns {*}\n */\nDenque.prototype.shift = function shift() {\n var head = this._head;\n if (head === this._tail) return undefined;\n var item = this._list[head];\n this._list[head] = undefined;\n this._head = (head + 1) & this._capacityMask;\n if (head < 2 && this._tail > 10000 && this._tail <= this._list.length >>> 2) this._shrinkArray();\n return item;\n};\n\n/**\n * Add an item to the bottom of the list.\n * @param item\n */\nDenque.prototype.push = function push(item) {\n if (arguments.length === 0) return this.size();\n var tail = this._tail;\n this._list[tail] = item;\n this._tail = (tail + 1) & this._capacityMask;\n if (this._tail === this._head) {\n this._growArray();\n }\n if (this._capacity && this.size() > this._capacity) {\n this.shift();\n }\n if (this._head < this._tail) return this._tail - this._head;\n else return this._capacityMask + 1 - (this._head - this._tail);\n};\n\n/**\n * Remove and return the last item on the list.\n * Returns undefined if the list is empty.\n * @returns {*}\n */\nDenque.prototype.pop = function pop() {\n var tail = this._tail;\n if (tail === this._head) return undefined;\n var len = this._list.length;\n this._tail = (tail - 1 + len) & this._capacityMask;\n var item = this._list[this._tail];\n this._list[this._tail] = undefined;\n if (this._head < 2 && tail > 10000 && tail <= len >>> 2) this._shrinkArray();\n return item;\n};\n\n/**\n * Remove and return the item at the specified index from the list.\n * Returns undefined if the list is empty.\n * @param index\n * @returns {*}\n */\nDenque.prototype.removeOne = function removeOne(index) {\n var i = index;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n if (this._head === this._tail) return void 0;\n var size = this.size();\n var len = this._list.length;\n if (i >= size || i < -size) return void 0;\n if (i < 0) i += size;\n i = (this._head + i) & this._capacityMask;\n var item = this._list[i];\n var k;\n if (index < size / 2) {\n for (k = index; k > 0; k--) {\n this._list[i] = this._list[i = (i - 1 + len) & this._capacityMask];\n }\n this._list[i] = void 0;\n this._head = (this._head + 1 + len) & this._capacityMask;\n } else {\n for (k = size - 1 - index; k > 0; k--) {\n this._list[i] = this._list[i = (i + 1 + len) & this._capacityMask];\n }\n this._list[i] = void 0;\n this._tail = (this._tail - 1 + len) & this._capacityMask;\n }\n return item;\n};\n\n/**\n * Remove number of items from the specified index from the list.\n * Returns array of removed items.\n * Returns undefined if the list is empty.\n * @param index\n * @param count\n * @returns {array}\n */\nDenque.prototype.remove = function remove(index, count) {\n var i = index;\n var removed;\n var del_count = count;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n if (this._head === this._tail) return void 0;\n var size = this.size();\n var len = this._list.length;\n if (i >= size || i < -size || count < 1) return void 0;\n if (i < 0) i += size;\n if (count === 1 || !count) {\n removed = new Array(1);\n removed[0] = this.removeOne(i);\n return removed;\n }\n if (i === 0 && i + count >= size) {\n removed = this.toArray();\n this.clear();\n return removed;\n }\n if (i + count > size) count = size - i;\n var k;\n removed = new Array(count);\n for (k = 0; k < count; k++) {\n removed[k] = this._list[(this._head + i + k) & this._capacityMask];\n }\n i = (this._head + i) & this._capacityMask;\n if (index + count === size) {\n this._tail = (this._tail - count + len) & this._capacityMask;\n for (k = count; k > 0; k--) {\n this._list[i = (i + 1 + len) & this._capacityMask] = void 0;\n }\n return removed;\n }\n if (index === 0) {\n this._head = (this._head + count + len) & this._capacityMask;\n for (k = count - 1; k > 0; k--) {\n this._list[i = (i + 1 + len) & this._capacityMask] = void 0;\n }\n return removed;\n }\n if (i < size / 2) {\n this._head = (this._head + index + count + len) & this._capacityMask;\n for (k = index; k > 0; k--) {\n this.unshift(this._list[i = (i - 1 + len) & this._capacityMask]);\n }\n i = (this._head - 1 + len) & this._capacityMask;\n while (del_count > 0) {\n this._list[i = (i - 1 + len) & this._capacityMask] = void 0;\n del_count--;\n }\n if (index < 0) this._tail = i;\n } else {\n this._tail = i;\n i = (i + count + len) & this._capacityMask;\n for (k = size - (count + index); k > 0; k--) {\n this.push(this._list[i++]);\n }\n i = this._tail;\n while (del_count > 0) {\n this._list[i = (i + 1 + len) & this._capacityMask] = void 0;\n del_count--;\n }\n }\n if (this._head < 2 && this._tail > 10000 && this._tail <= len >>> 2) this._shrinkArray();\n return removed;\n};\n\n/**\n * Native splice implementation.\n * Remove number of items from the specified index from the list and/or add new elements.\n * Returns array of removed items or empty array if count == 0.\n * Returns undefined if the list is empty.\n *\n * @param index\n * @param count\n * @param {...*} [elements]\n * @returns {array}\n */\nDenque.prototype.splice = function splice(index, count) {\n var i = index;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n var size = this.size();\n if (i < 0) i += size;\n if (i > size) return void 0;\n if (arguments.length > 2) {\n var k;\n var temp;\n var removed;\n var arg_len = arguments.length;\n var len = this._list.length;\n var arguments_index = 2;\n if (!size || i < size / 2) {\n temp = new Array(i);\n for (k = 0; k < i; k++) {\n temp[k] = this._list[(this._head + k) & this._capacityMask];\n }\n if (count === 0) {\n removed = [];\n if (i > 0) {\n this._head = (this._head + i + len) & this._capacityMask;\n }\n } else {\n removed = this.remove(i, count);\n this._head = (this._head + i + len) & this._capacityMask;\n }\n while (arg_len > arguments_index) {\n this.unshift(arguments[--arg_len]);\n }\n for (k = i; k > 0; k--) {\n this.unshift(temp[k - 1]);\n }\n } else {\n temp = new Array(size - (i + count));\n var leng = temp.length;\n for (k = 0; k < leng; k++) {\n temp[k] = this._list[(this._head + i + count + k) & this._capacityMask];\n }\n if (count === 0) {\n removed = [];\n if (i != size) {\n this._tail = (this._head + i + len) & this._capacityMask;\n }\n } else {\n removed = this.remove(i, count);\n this._tail = (this._tail - leng + len) & this._capacityMask;\n }\n while (arguments_index < arg_len) {\n this.push(arguments[arguments_index++]);\n }\n for (k = 0; k < leng; k++) {\n this.push(temp[k]);\n }\n }\n return removed;\n } else {\n return this.remove(i, count);\n }\n};\n\n/**\n * Soft clear - does not reset capacity.\n */\nDenque.prototype.clear = function clear() {\n this._list = new Array(this._list.length);\n this._head = 0;\n this._tail = 0;\n};\n\n/**\n * Returns true or false whether the list is empty.\n * @returns {boolean}\n */\nDenque.prototype.isEmpty = function isEmpty() {\n return this._head === this._tail;\n};\n\n/**\n * Returns an array of all queue items.\n * @returns {Array}\n */\nDenque.prototype.toArray = function toArray() {\n return this._copyArray(false);\n};\n\n/**\n * -------------\n * INTERNALS\n * -------------\n */\n\n/**\n * Fills the queue with items from an array\n * For use in the constructor\n * @param array\n * @private\n */\nDenque.prototype._fromArray = function _fromArray(array) {\n var length = array.length;\n var capacity = this._nextPowerOf2(length);\n\n this._list = new Array(capacity);\n this._capacityMask = capacity - 1;\n this._tail = length;\n\n for (var i = 0; i < length; i++) this._list[i] = array[i];\n};\n\n/**\n *\n * @param fullCopy\n * @param size Initialize the array with a specific size. Will default to the current list size\n * @returns {Array}\n * @private\n */\nDenque.prototype._copyArray = function _copyArray(fullCopy, size) {\n var src = this._list;\n var capacity = src.length;\n var length = this.length;\n size = size | length;\n\n // No prealloc requested and the buffer is contiguous\n if (size == length && this._head < this._tail) {\n // Simply do a fast slice copy\n return this._list.slice(this._head, this._tail);\n }\n\n var dest = new Array(size);\n\n var k = 0;\n var i;\n if (fullCopy || this._head > this._tail) {\n for (i = this._head; i < capacity; i++) dest[k++] = src[i];\n for (i = 0; i < this._tail; i++) dest[k++] = src[i];\n } else {\n for (i = this._head; i < this._tail; i++) dest[k++] = src[i];\n }\n\n return dest;\n}\n\n/**\n * Grows the internal list array.\n * @private\n */\nDenque.prototype._growArray = function _growArray() {\n if (this._head != 0) {\n // double array size and copy existing data, head to end, then beginning to tail.\n var newList = this._copyArray(true, this._list.length << 1);\n\n this._tail = this._list.length;\n this._head = 0;\n\n this._list = newList;\n } else {\n this._tail = this._list.length;\n this._list.length <<= 1;\n }\n\n this._capacityMask = (this._capacityMask << 1) | 1;\n};\n\n/**\n * Shrinks the internal list array.\n * @private\n */\nDenque.prototype._shrinkArray = function _shrinkArray() {\n this._list.length >>>= 1;\n this._capacityMask >>>= 1;\n};\n\n/**\n * Find the next power of 2, at least 4\n * @private\n * @param {number} num \n * @returns {number}\n */\nDenque.prototype._nextPowerOf2 = function _nextPowerOf2(num) {\n var log2 = Math.log(num) / Math.log(2);\n var nextPow2 = 1 << (log2 + 1);\n\n return Math.max(nextPow2, 4);\n}\n\nmodule.exports = Denque;\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/denque/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/dijkstrajs/dijkstra.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/dijkstrajs/dijkstra.js ***!
|
||
\*********************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\n\n/******************************************************************************\n * Created 2008-08-19.\n *\n * Dijkstra path-finding functions. Adapted from the Dijkstar Python project.\n *\n * Copyright (C) 2008\n * Wyatt Baldwin <self@wyattbaldwin.com>\n * All rights reserved\n *\n * Licensed under the MIT license.\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *****************************************************************************/\nvar dijkstra = {\n single_source_shortest_paths: function(graph, s, d) {\n // Predecessor map for each node that has been encountered.\n // node ID => predecessor node ID\n var predecessors = {};\n\n // Costs of shortest paths from s to all nodes encountered.\n // node ID => cost\n var costs = {};\n costs[s] = 0;\n\n // Costs of shortest paths from s to all nodes encountered; differs from\n // `costs` in that it provides easy access to the node that currently has\n // the known shortest path from s.\n // XXX: Do we actually need both `costs` and `open`?\n var open = dijkstra.PriorityQueue.make();\n open.push(s, 0);\n\n var closest,\n u, v,\n cost_of_s_to_u,\n adjacent_nodes,\n cost_of_e,\n cost_of_s_to_u_plus_cost_of_e,\n cost_of_s_to_v,\n first_visit;\n while (!open.empty()) {\n // In the nodes remaining in graph that have a known cost from s,\n // find the node, u, that currently has the shortest path from s.\n closest = open.pop();\n u = closest.value;\n cost_of_s_to_u = closest.cost;\n\n // Get nodes adjacent to u...\n adjacent_nodes = graph[u] || {};\n\n // ...and explore the edges that connect u to those nodes, updating\n // the cost of the shortest paths to any or all of those nodes as\n // necessary. v is the node across the current edge from u.\n for (v in adjacent_nodes) {\n if (adjacent_nodes.hasOwnProperty(v)) {\n // Get the cost of the edge running from u to v.\n cost_of_e = adjacent_nodes[v];\n\n // Cost of s to u plus the cost of u to v across e--this is *a*\n // cost from s to v that may or may not be less than the current\n // known cost to v.\n cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;\n\n // If we haven't visited v yet OR if the current known cost from s to\n // v is greater than the new cost we just found (cost of s to u plus\n // cost of u to v across e), update v's cost in the cost list and\n // update v's predecessor in the predecessor list (it's now u).\n cost_of_s_to_v = costs[v];\n first_visit = (typeof costs[v] === 'undefined');\n if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {\n costs[v] = cost_of_s_to_u_plus_cost_of_e;\n open.push(v, cost_of_s_to_u_plus_cost_of_e);\n predecessors[v] = u;\n }\n }\n }\n }\n\n if (typeof d !== 'undefined' && typeof costs[d] === 'undefined') {\n var msg = ['Could not find a path from ', s, ' to ', d, '.'].join('');\n throw new Error(msg);\n }\n\n return predecessors;\n },\n\n extract_shortest_path_from_predecessor_list: function(predecessors, d) {\n var nodes = [];\n var u = d;\n var predecessor;\n while (u) {\n nodes.push(u);\n predecessor = predecessors[u];\n u = predecessors[u];\n }\n nodes.reverse();\n return nodes;\n },\n\n find_path: function(graph, s, d) {\n var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);\n return dijkstra.extract_shortest_path_from_predecessor_list(\n predecessors, d);\n },\n\n /**\n * A very naive priority queue implementation.\n */\n PriorityQueue: {\n make: function (opts) {\n var T = dijkstra.PriorityQueue,\n t = {},\n key;\n opts = opts || {};\n for (key in T) {\n if (T.hasOwnProperty(key)) {\n t[key] = T[key];\n }\n }\n t.queue = [];\n t.sorter = opts.sorter || T.default_sorter;\n return t;\n },\n\n default_sorter: function (a, b) {\n return a.cost - b.cost;\n },\n\n /**\n * Add a new item to the queue and ensure the highest priority element\n * is at the front of the queue.\n */\n push: function (value, cost) {\n var item = {value: value, cost: cost};\n this.queue.push(item);\n this.queue.sort(this.sorter);\n },\n\n /**\n * Return the highest priority element in the queue.\n */\n pop: function () {\n return this.queue.shift();\n },\n\n empty: function () {\n return this.queue.length === 0;\n }\n }\n};\n\n\n// node.js module exports\nif (true) {\n module.exports = dijkstra;\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/dijkstrajs/dijkstra.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/encode-utf8/index.js":
|
||
/*!*******************************************!*\
|
||
!*** ./node_modules/encode-utf8/index.js ***!
|
||
\*******************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\n\nmodule.exports = function encodeUtf8 (input) {\n var result = []\n var size = input.length\n\n for (var index = 0; index < size; index++) {\n var point = input.charCodeAt(index)\n\n if (point >= 0xD800 && point <= 0xDBFF && size > index + 1) {\n var second = input.charCodeAt(index + 1)\n\n if (second >= 0xDC00 && second <= 0xDFFF) {\n // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n point = (point - 0xD800) * 0x400 + second - 0xDC00 + 0x10000\n index += 1\n }\n }\n\n // US-ASCII\n if (point < 0x80) {\n result.push(point)\n continue\n }\n\n // 2-byte UTF-8\n if (point < 0x800) {\n result.push((point >> 6) | 192)\n result.push((point & 63) | 128)\n continue\n }\n\n // 3-byte UTF-8\n if (point < 0xD800 || (point >= 0xE000 && point < 0x10000)) {\n result.push((point >> 12) | 224)\n result.push(((point >> 6) & 63) | 128)\n result.push((point & 63) | 128)\n continue\n }\n\n // 4-byte UTF-8\n if (point >= 0x10000 && point <= 0x10FFFF) {\n result.push((point >> 18) | 240)\n result.push(((point >> 12) & 63) | 128)\n result.push(((point >> 6) & 63) | 128)\n result.push((point & 63) | 128)\n continue\n }\n\n // Invalid character\n result.push(0xEF, 0xBF, 0xBD)\n }\n\n return new Uint8Array(result).buffer\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/encode-utf8/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/err-code/index.js":
|
||
/*!****************************************!*\
|
||
!*** ./node_modules/err-code/index.js ***!
|
||
\****************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\n\n/**\n * @typedef {{ [key: string]: any }} Extensions\n * @typedef {Error} Err\n * @property {string} message\n */\n\n/**\n *\n * @param {Error} obj\n * @param {Extensions} props\n * @returns {Error & Extensions}\n */\nfunction assign(obj, props) {\n for (const key in props) {\n Object.defineProperty(obj, key, {\n value: props[key],\n enumerable: true,\n configurable: true,\n });\n }\n\n return obj;\n}\n\n/**\n *\n * @param {any} err - An Error\n * @param {string|Extensions} code - A string code or props to set on the error\n * @param {Extensions} [props] - Props to set on the error\n * @returns {Error & Extensions}\n */\nfunction createError(err, code, props) {\n if (!err || typeof err === 'string') {\n throw new TypeError('Please pass an Error to err-code');\n }\n\n if (!props) {\n props = {};\n }\n\n if (typeof code === 'object') {\n props = code;\n code = '';\n }\n\n if (code) {\n props.code = code;\n }\n\n try {\n return assign(err, props);\n } catch (_) {\n props.message = err.message;\n props.stack = err.stack;\n\n const ErrClass = function () {};\n\n ErrClass.prototype = Object.create(Object.getPrototypeOf(err));\n\n // @ts-ignore\n const output = assign(new ErrClass(), props);\n\n return output;\n }\n}\n\nmodule.exports = createError;\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/err-code/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/event-iterator/lib/dom.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/event-iterator/lib/dom.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst event_iterator_1 = __webpack_require__(/*! ./event-iterator */ \"./node_modules/event-iterator/lib/event-iterator.js\");\nexports.EventIterator = event_iterator_1.EventIterator;\nfunction subscribe(event, options, evOptions) {\n return new event_iterator_1.EventIterator(({ push }) => {\n this.addEventListener(event, push, options);\n return () => this.removeEventListener(event, push, options);\n }, evOptions);\n}\nexports.subscribe = subscribe;\nexports[\"default\"] = event_iterator_1.EventIterator;\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/event-iterator/lib/dom.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/event-iterator/lib/event-iterator.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/event-iterator/lib/event-iterator.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nclass EventQueue {\n constructor() {\n this.pullQueue = [];\n this.pushQueue = [];\n this.eventHandlers = {};\n this.isPaused = false;\n this.isStopped = false;\n }\n push(value) {\n if (this.isStopped)\n return;\n const resolution = { value, done: false };\n if (this.pullQueue.length) {\n const placeholder = this.pullQueue.shift();\n if (placeholder)\n placeholder.resolve(resolution);\n }\n else {\n this.pushQueue.push(Promise.resolve(resolution));\n if (this.highWaterMark !== undefined &&\n this.pushQueue.length >= this.highWaterMark &&\n !this.isPaused) {\n this.isPaused = true;\n if (this.eventHandlers.highWater) {\n this.eventHandlers.highWater();\n }\n else if (console) {\n console.warn(`EventIterator queue reached ${this.pushQueue.length} items`);\n }\n }\n }\n }\n stop() {\n if (this.isStopped)\n return;\n this.isStopped = true;\n this.remove();\n for (const placeholder of this.pullQueue) {\n placeholder.resolve({ value: undefined, done: true });\n }\n this.pullQueue.length = 0;\n }\n fail(error) {\n if (this.isStopped)\n return;\n this.isStopped = true;\n this.remove();\n if (this.pullQueue.length) {\n for (const placeholder of this.pullQueue) {\n placeholder.reject(error);\n }\n this.pullQueue.length = 0;\n }\n else {\n const rejection = Promise.reject(error);\n /* Attach error handler to avoid leaking an unhandled promise rejection. */\n rejection.catch(() => { });\n this.pushQueue.push(rejection);\n }\n }\n remove() {\n Promise.resolve().then(() => {\n if (this.removeCallback)\n this.removeCallback();\n });\n }\n [Symbol.asyncIterator]() {\n return {\n next: (value) => {\n const result = this.pushQueue.shift();\n if (result) {\n if (this.lowWaterMark !== undefined &&\n this.pushQueue.length <= this.lowWaterMark &&\n this.isPaused) {\n this.isPaused = false;\n if (this.eventHandlers.lowWater) {\n this.eventHandlers.lowWater();\n }\n }\n return result;\n }\n else if (this.isStopped) {\n return Promise.resolve({ value: undefined, done: true });\n }\n else {\n return new Promise((resolve, reject) => {\n this.pullQueue.push({ resolve, reject });\n });\n }\n },\n return: () => {\n this.isStopped = true;\n this.pushQueue.length = 0;\n this.remove();\n return Promise.resolve({ value: undefined, done: true });\n },\n };\n }\n}\nclass EventIterator {\n constructor(listen, { highWaterMark = 100, lowWaterMark = 1 } = {}) {\n const queue = new EventQueue();\n queue.highWaterMark = highWaterMark;\n queue.lowWaterMark = lowWaterMark;\n queue.removeCallback =\n listen({\n push: value => queue.push(value),\n stop: () => queue.stop(),\n fail: error => queue.fail(error),\n on: (event, fn) => {\n queue.eventHandlers[event] = fn;\n },\n }) || (() => { });\n this[Symbol.asyncIterator] = () => queue[Symbol.asyncIterator]();\n Object.freeze(this);\n }\n}\nexports.EventIterator = EventIterator;\nexports[\"default\"] = EventIterator;\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/event-iterator/lib/event-iterator.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/eventemitter3/index.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/eventemitter3/index.js ***!
|
||
\*********************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif (true) {\n module.exports = EventEmitter;\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/eventemitter3/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/hashlru/index.js":
|
||
/*!***************************************!*\
|
||
!*** ./node_modules/hashlru/index.js ***!
|
||
\***************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("module.exports = function (max) {\n\n if (!max) throw Error('hashlru must have a max value, of type number, greater than 0')\n\n var size = 0, cache = Object.create(null), _cache = Object.create(null)\n\n function update (key, value) {\n cache[key] = value\n size ++\n if(size >= max) {\n size = 0\n _cache = cache\n cache = Object.create(null)\n }\n }\n\n return {\n has: function (key) {\n return cache[key] !== undefined || _cache[key] !== undefined\n },\n remove: function (key) {\n if(cache[key] !== undefined)\n cache[key] = undefined\n if(_cache[key] !== undefined)\n _cache[key] = undefined\n },\n get: function (key) {\n var v = cache[key]\n if(v !== undefined) return v\n if((v = _cache[key]) !== undefined) {\n update(key, v)\n return v\n }\n },\n set: function (key, value) {\n if(cache[key] !== undefined) cache[key] = value\n else update(key, value)\n },\n clear: function () {\n cache = Object.create(null)\n _cache = Object.create(null)\n }\n }\n}\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/hashlru/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/hi-base32/src/base32.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/hi-base32/src/base32.js ***!
|
||
\**********************************************/
|
||
/***/ ((module, exports, __webpack_require__) => {
|
||
|
||
eval("var __WEBPACK_AMD_DEFINE_RESULT__;/*\n * [hi-base32]{@link https://github.com/emn178/hi-base32}\n *\n * @version 0.5.0\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\n * @copyright Chen, Yi-Cyuan 2015-2018\n * @license MIT\n */\n/*jslint bitwise: true */\n(function () {\n 'use strict';\n\n var root = typeof window === 'object' ? window : {};\n var NODE_JS = !root.HI_BASE32_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\n if (NODE_JS) {\n root = __webpack_require__.g;\n }\n var COMMON_JS = !root.HI_BASE32_NO_COMMON_JS && \"object\" === 'object' && module.exports;\n var AMD = true && __webpack_require__.amdO;\n var BASE32_ENCODE_CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'.split('');\n var BASE32_DECODE_CHAR = {\n 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8,\n 'J': 9, 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16,\n 'R': 17, 'S': 18, 'T': 19, 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24,\n 'Z': 25, '2': 26, '3': 27, '4': 28, '5': 29, '6': 30, '7': 31\n };\n\n var blocks = [0, 0, 0, 0, 0, 0, 0, 0];\n\n var throwInvalidUtf8 = function (position, partial) {\n if (partial.length > 10) {\n partial = '...' + partial.substr(-10);\n }\n var err = new Error('Decoded data is not valid UTF-8.'\n + ' Maybe try base32.decode.asBytes()?'\n + ' Partial data after reading ' + position + ' bytes: ' + partial + ' <-');\n err.position = position;\n throw err;\n };\n\n var toUtf8String = function (bytes) {\n var str = '', length = bytes.length, i = 0, followingChars = 0, b, c;\n while (i < length) {\n b = bytes[i++];\n if (b <= 0x7F) {\n str += String.fromCharCode(b);\n continue;\n } else if (b > 0xBF && b <= 0xDF) {\n c = b & 0x1F;\n followingChars = 1;\n } else if (b <= 0xEF) {\n c = b & 0x0F;\n followingChars = 2;\n } else if (b <= 0xF7) {\n c = b & 0x07;\n followingChars = 3;\n } else {\n throwInvalidUtf8(i, str);\n }\n\n for (var j = 0; j < followingChars; ++j) {\n b = bytes[i++];\n if (b < 0x80 || b > 0xBF) {\n throwInvalidUtf8(i, str);\n }\n c <<= 6;\n c += b & 0x3F;\n }\n if (c >= 0xD800 && c <= 0xDFFF) {\n throwInvalidUtf8(i, str);\n }\n if (c > 0x10FFFF) {\n throwInvalidUtf8(i, str);\n }\n\n if (c <= 0xFFFF) {\n str += String.fromCharCode(c);\n } else {\n c -= 0x10000;\n str += String.fromCharCode((c >> 10) + 0xD800);\n str += String.fromCharCode((c & 0x3FF) + 0xDC00);\n }\n }\n return str;\n };\n\n var decodeAsBytes = function (base32Str) {\n if (base32Str === '') {\n return [];\n } else if (!/^[A-Z2-7=]+$/.test(base32Str)) {\n throw new Error('Invalid base32 characters');\n }\n base32Str = base32Str.replace(/=/g, '');\n var v1, v2, v3, v4, v5, v6, v7, v8, bytes = [], index = 0, length = base32Str.length;\n\n // 4 char to 3 bytes\n for (var i = 0, count = length >> 3 << 3; i < count;) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v8 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n bytes[index++] = (v1 << 3 | v2 >>> 2) & 255;\n bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255;\n bytes[index++] = (v4 << 4 | v5 >>> 1) & 255;\n bytes[index++] = (v5 << 7 | v6 << 2 | v7 >>> 3) & 255;\n bytes[index++] = (v7 << 5 | v8) & 255;\n }\n\n // remain bytes\n var remain = length - count;\n if (remain === 2) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n bytes[index++] = (v1 << 3 | v2 >>> 2) & 255;\n } else if (remain === 4) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n bytes[index++] = (v1 << 3 | v2 >>> 2) & 255;\n bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255;\n } else if (remain === 5) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n bytes[index++] = (v1 << 3 | v2 >>> 2) & 255;\n bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255;\n bytes[index++] = (v4 << 4 | v5 >>> 1) & 255;\n } else if (remain === 7) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n bytes[index++] = (v1 << 3 | v2 >>> 2) & 255;\n bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255;\n bytes[index++] = (v4 << 4 | v5 >>> 1) & 255;\n bytes[index++] = (v5 << 7 | v6 << 2 | v7 >>> 3) & 255;\n }\n return bytes;\n };\n\n var encodeAscii = function (str) {\n var v1, v2, v3, v4, v5, base32Str = '', length = str.length;\n for (var i = 0, count = parseInt(length / 5) * 5; i < count;) {\n v1 = str.charCodeAt(i++);\n v2 = str.charCodeAt(i++);\n v3 = str.charCodeAt(i++);\n v4 = str.charCodeAt(i++);\n v5 = str.charCodeAt(i++);\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3 | v5 >>> 5) & 31] +\n BASE32_ENCODE_CHAR[v5 & 31];\n }\n\n // remain char\n var remain = length - count;\n if (remain === 1) {\n v1 = str.charCodeAt(i);\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2) & 31] +\n '======';\n } else if (remain === 2) {\n v1 = str.charCodeAt(i++);\n v2 = str.charCodeAt(i);\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4) & 31] +\n '====';\n } else if (remain === 3) {\n v1 = str.charCodeAt(i++);\n v2 = str.charCodeAt(i++);\n v3 = str.charCodeAt(i);\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1) & 31] +\n '===';\n } else if (remain === 4) {\n v1 = str.charCodeAt(i++);\n v2 = str.charCodeAt(i++);\n v3 = str.charCodeAt(i++);\n v4 = str.charCodeAt(i);\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3) & 31] +\n '=';\n }\n return base32Str;\n };\n\n var encodeUtf8 = function (str) {\n var v1, v2, v3, v4, v5, code, end = false, base32Str = '',\n index = 0, i, start = 0, bytes = 0, length = str.length;\n if (str === '') {\n return base32Str;\n }\n do {\n blocks[0] = blocks[5];\n blocks[1] = blocks[6];\n blocks[2] = blocks[7];\n for (i = start; index < length && i < 5; ++index) {\n code = str.charCodeAt(index);\n if (code < 0x80) {\n blocks[i++] = code;\n } else if (code < 0x800) {\n blocks[i++] = 0xc0 | (code >> 6);\n blocks[i++] = 0x80 | (code & 0x3f);\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i++] = 0xe0 | (code >> 12);\n blocks[i++] = 0x80 | ((code >> 6) & 0x3f);\n blocks[i++] = 0x80 | (code & 0x3f);\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++index) & 0x3ff));\n blocks[i++] = 0xf0 | (code >> 18);\n blocks[i++] = 0x80 | ((code >> 12) & 0x3f);\n blocks[i++] = 0x80 | ((code >> 6) & 0x3f);\n blocks[i++] = 0x80 | (code & 0x3f);\n }\n }\n bytes += i - start;\n start = i - 5;\n if (index === length) {\n ++index;\n }\n if (index > length && i < 6) {\n end = true;\n }\n v1 = blocks[0];\n if (i > 4) {\n v2 = blocks[1];\n v3 = blocks[2];\n v4 = blocks[3];\n v5 = blocks[4];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3 | v5 >>> 5) & 31] +\n BASE32_ENCODE_CHAR[v5 & 31];\n } else if (i === 1) {\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2) & 31] +\n '======';\n } else if (i === 2) {\n v2 = blocks[1];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4) & 31] +\n '====';\n } else if (i === 3) {\n v2 = blocks[1];\n v3 = blocks[2];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1) & 31] +\n '===';\n } else {\n v2 = blocks[1];\n v3 = blocks[2];\n v4 = blocks[3];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3) & 31] +\n '=';\n }\n } while (!end);\n return base32Str;\n };\n\n var encodeBytes = function (bytes) {\n var v1, v2, v3, v4, v5, base32Str = '', length = bytes.length;\n for (var i = 0, count = parseInt(length / 5) * 5; i < count;) {\n v1 = bytes[i++];\n v2 = bytes[i++];\n v3 = bytes[i++];\n v4 = bytes[i++];\n v5 = bytes[i++];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3 | v5 >>> 5) & 31] +\n BASE32_ENCODE_CHAR[v5 & 31];\n }\n\n // remain char\n var remain = length - count;\n if (remain === 1) {\n v1 = bytes[i];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2) & 31] +\n '======';\n } else if (remain === 2) {\n v1 = bytes[i++];\n v2 = bytes[i];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4) & 31] +\n '====';\n } else if (remain === 3) {\n v1 = bytes[i++];\n v2 = bytes[i++];\n v3 = bytes[i];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1) & 31] +\n '===';\n } else if (remain === 4) {\n v1 = bytes[i++];\n v2 = bytes[i++];\n v3 = bytes[i++];\n v4 = bytes[i];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3) & 31] +\n '=';\n }\n return base32Str;\n };\n\n var encode = function (input, asciiOnly) {\n var notString = typeof(input) !== 'string';\n if (notString && input.constructor === ArrayBuffer) {\n input = new Uint8Array(input);\n }\n if (notString) {\n return encodeBytes(input);\n } else if (asciiOnly) {\n return encodeAscii(input);\n } else {\n return encodeUtf8(input);\n }\n };\n\n var decode = function (base32Str, asciiOnly) {\n if (!asciiOnly) {\n return toUtf8String(decodeAsBytes(base32Str));\n }\n if (base32Str === '') {\n return '';\n } else if (!/^[A-Z2-7=]+$/.test(base32Str)) {\n throw new Error('Invalid base32 characters');\n }\n var v1, v2, v3, v4, v5, v6, v7, v8, str = '', length = base32Str.indexOf('=');\n if (length === -1) {\n length = base32Str.length;\n }\n\n // 8 char to 5 bytes\n for (var i = 0, count = length >> 3 << 3; i < count;) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v8 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) +\n String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255) +\n String.fromCharCode((v4 << 4 | v5 >>> 1) & 255) +\n String.fromCharCode((v5 << 7 | v6 << 2 | v7 >>> 3) & 255) +\n String.fromCharCode((v7 << 5 | v8) & 255);\n }\n\n // remain bytes\n var remain = length - count;\n if (remain === 2) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255);\n } else if (remain === 4) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) +\n String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255);\n } else if (remain === 5) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) +\n String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255) +\n String.fromCharCode((v4 << 4 | v5 >>> 1) & 255);\n } else if (remain === 7) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) +\n String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255) +\n String.fromCharCode((v4 << 4 | v5 >>> 1) & 255) +\n String.fromCharCode((v5 << 7 | v6 << 2 | v7 >>> 3) & 255);\n }\n return str;\n };\n\n var exports = {\n encode: encode,\n decode: decode\n };\n decode.asBytes = decodeAsBytes;\n\n if (COMMON_JS) {\n module.exports = exports;\n } else {\n root.base32 = exports;\n if (AMD) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {\n return exports;\n }).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n }\n }\n})();\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/hi-base32/src/base32.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/is-electron/index.js":
|
||
/*!*******************************************!*\
|
||
!*** ./node_modules/is-electron/index.js ***!
|
||
\*******************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("// https://github.com/electron/electron/issues/2288\nfunction isElectron() {\n // Renderer process\n if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {\n return true;\n }\n\n // Main process\n if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {\n return true;\n }\n\n // Detect the user agent when the `nodeIntegration` option is set to false\n if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {\n return true;\n }\n\n return false;\n}\n\nmodule.exports = isElectron;\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/is-electron/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/is-plain-obj/index.js":
|
||
/*!********************************************!*\
|
||
!*** ./node_modules/is-plain-obj/index.js ***!
|
||
\********************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\n\nmodule.exports = value => {\n\tif (Object.prototype.toString.call(value) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === null || prototype === Object.prototype;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/is-plain-obj/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/js-sha3/src/sha3.js":
|
||
/*!******************************************!*\
|
||
!*** ./node_modules/js-sha3/src/sha3.js ***!
|
||
\******************************************/
|
||
/***/ ((module, exports, __webpack_require__) => {
|
||
|
||
eval("var __WEBPACK_AMD_DEFINE_RESULT__;/**\n * [js-sha3]{@link https://github.com/emn178/js-sha3}\n *\n * @version 0.9.3\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\n * @copyright Chen, Yi-Cyuan 2015-2023\n * @license MIT\n */\n/*jslint bitwise: true */\n(function () {\n 'use strict';\n\n var INPUT_ERROR = 'input is invalid type';\n var FINALIZE_ERROR = 'finalize already called';\n var WINDOW = typeof window === 'object';\n var root = WINDOW ? window : {};\n if (root.JS_SHA3_NO_WINDOW) {\n WINDOW = false;\n }\n var WEB_WORKER = !WINDOW && typeof self === 'object';\n var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\n if (NODE_JS) {\n root = __webpack_require__.g;\n } else if (WEB_WORKER) {\n root = self;\n }\n var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && \"object\" === 'object' && module.exports;\n var AMD = true && __webpack_require__.amdO;\n var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';\n var HEX_CHARS = '0123456789abcdef'.split('');\n var SHAKE_PADDING = [31, 7936, 2031616, 520093696];\n var CSHAKE_PADDING = [4, 1024, 262144, 67108864];\n var KECCAK_PADDING = [1, 256, 65536, 16777216];\n var PADDING = [6, 1536, 393216, 100663296];\n var SHIFT = [0, 8, 16, 24];\n var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,\n 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,\n 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,\n 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,\n 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];\n var BITS = [224, 256, 384, 512];\n var SHAKE_BITS = [128, 256];\n var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];\n var CSHAKE_BYTEPAD = {\n '128': 168,\n '256': 136\n };\n\n\n var isArray = root.JS_SHA3_NO_NODE_JS || !Array.isArray\n ? function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n }\n : Array.isArray;\n\n var isView = (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView))\n ? function (obj) {\n return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;\n }\n : ArrayBuffer.isView;\n\n // [message: string, isString: bool]\n var formatMessage = function (message) {\n var type = typeof message;\n if (type === 'string') {\n return [message, true];\n }\n if (type !== 'object' || message === null) {\n throw new Error(INPUT_ERROR);\n }\n if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {\n return [new Uint8Array(message), false];\n }\n if (!isArray(message) && !isView(message)) {\n throw new Error(INPUT_ERROR);\n }\n return [message, false];\n }\n\n var empty = function (message) {\n return formatMessage(message)[0].length === 0;\n };\n\n var cloneArray = function (array) {\n var newArray = [];\n for (var i = 0; i < array.length; ++i) {\n newArray[i] = array[i];\n }\n return newArray;\n }\n\n var createOutputMethod = function (bits, padding, outputType) {\n return function (message) {\n return new Keccak(bits, padding, bits).update(message)[outputType]();\n };\n };\n\n var createShakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits) {\n return new Keccak(bits, padding, outputBits).update(message)[outputType]();\n };\n };\n\n var createCshakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits, n, s) {\n return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();\n };\n };\n\n var createKmacOutputMethod = function (bits, padding, outputType) {\n return function (key, message, outputBits, s) {\n return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();\n };\n };\n\n var createOutputMethods = function (method, createMethod, bits, padding) {\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\n var type = OUTPUT_TYPES[i];\n method[type] = createMethod(bits, padding, type);\n }\n return method;\n };\n\n var createMethod = function (bits, padding) {\n var method = createOutputMethod(bits, padding, 'hex');\n method.create = function () {\n return new Keccak(bits, padding, bits);\n };\n method.update = function (message) {\n return method.create().update(message);\n };\n return createOutputMethods(method, createOutputMethod, bits, padding);\n };\n\n var createShakeMethod = function (bits, padding) {\n var method = createShakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits) {\n return new Keccak(bits, padding, outputBits);\n };\n method.update = function (message, outputBits) {\n return method.create(outputBits).update(message);\n };\n return createOutputMethods(method, createShakeOutputMethod, bits, padding);\n };\n\n var createCshakeMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createCshakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits, n, s) {\n if (empty(n) && empty(s)) {\n return methods['shake' + bits].create(outputBits);\n } else {\n return new Keccak(bits, padding, outputBits).bytepad([n, s], w);\n }\n };\n method.update = function (message, outputBits, n, s) {\n return method.create(outputBits, n, s).update(message);\n };\n return createOutputMethods(method, createCshakeOutputMethod, bits, padding);\n };\n\n var createKmacMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createKmacOutputMethod(bits, padding, 'hex');\n method.create = function (key, outputBits, s) {\n return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);\n };\n method.update = function (key, message, outputBits, s) {\n return method.create(key, outputBits, s).update(message);\n };\n return createOutputMethods(method, createKmacOutputMethod, bits, padding);\n };\n\n var algorithms = [\n { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },\n { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },\n { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },\n { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },\n { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }\n ];\n\n var methods = {}, methodNames = [];\n\n for (var i = 0; i < algorithms.length; ++i) {\n var algorithm = algorithms[i];\n var bits = algorithm.bits;\n for (var j = 0; j < bits.length; ++j) {\n var methodName = algorithm.name + '_' + bits[j];\n methodNames.push(methodName);\n methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);\n if (algorithm.name !== 'sha3') {\n var newMethodName = algorithm.name + bits[j];\n methodNames.push(newMethodName);\n methods[newMethodName] = methods[methodName];\n }\n }\n }\n\n function Keccak(bits, padding, outputBits) {\n this.blocks = [];\n this.s = [];\n this.padding = padding;\n this.outputBits = outputBits;\n this.reset = true;\n this.finalized = false;\n this.block = 0;\n this.start = 0;\n this.blockCount = (1600 - (bits << 1)) >> 5;\n this.byteCount = this.blockCount << 2;\n this.outputBlocks = outputBits >> 5;\n this.extraBytes = (outputBits & 31) >> 3;\n\n for (var i = 0; i < 50; ++i) {\n this.s[i] = 0;\n }\n }\n\n Keccak.prototype.update = function (message) {\n if (this.finalized) {\n throw new Error(FINALIZE_ERROR);\n }\n var result = formatMessage(message);\n message = result[0];\n var isString = result[1];\n var blocks = this.blocks, byteCount = this.byteCount, length = message.length,\n blockCount = this.blockCount, index = 0, s = this.s, i, code;\n\n while (index < length) {\n if (this.reset) {\n this.reset = false;\n blocks[0] = this.block;\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n if (isString) {\n for (i = this.start; index < length && i < byteCount; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n }\n }\n } else {\n for (i = this.start; index < length && i < byteCount; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n }\n this.lastByteIndex = i;\n if (i >= byteCount) {\n this.start = i - byteCount;\n this.block = blocks[blockCount];\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n this.reset = true;\n } else {\n this.start = i;\n }\n }\n return this;\n };\n\n Keccak.prototype.encode = function (x, right) {\n var o = x & 255, n = 1;\n var bytes = [o];\n x = x >> 8;\n o = x & 255;\n while (o > 0) {\n bytes.unshift(o);\n x = x >> 8;\n o = x & 255;\n ++n;\n }\n if (right) {\n bytes.push(n);\n } else {\n bytes.unshift(n);\n }\n this.update(bytes);\n return bytes.length;\n };\n\n Keccak.prototype.encodeString = function (str) {\n var result = formatMessage(str);\n str = result[0];\n var isString = result[1];\n var bytes = 0, length = str.length;\n if (isString) {\n for (var i = 0; i < str.length; ++i) {\n var code = str.charCodeAt(i);\n if (code < 0x80) {\n bytes += 1;\n } else if (code < 0x800) {\n bytes += 2;\n } else if (code < 0xd800 || code >= 0xe000) {\n bytes += 3;\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));\n bytes += 4;\n }\n }\n } else {\n bytes = length;\n }\n bytes += this.encode(bytes * 8);\n this.update(str);\n return bytes;\n };\n\n Keccak.prototype.bytepad = function (strs, w) {\n var bytes = this.encode(w);\n for (var i = 0; i < strs.length; ++i) {\n bytes += this.encodeString(strs[i]);\n }\n var paddingBytes = (w - bytes % w) % w;\n var zeros = [];\n zeros.length = paddingBytes;\n this.update(zeros);\n return this;\n };\n\n Keccak.prototype.finalize = function () {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;\n blocks[i >> 2] |= this.padding[i & 3];\n if (this.lastByteIndex === this.byteCount) {\n blocks[0] = blocks[blockCount];\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n blocks[blockCount - 1] |= 0x80000000;\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n };\n\n Keccak.prototype.toString = Keccak.prototype.hex = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var hex = '', block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +\n HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +\n HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +\n HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];\n }\n if (j % blockCount === 0) {\n s = cloneArray(s);\n f(s);\n i = 0;\n }\n }\n if (extraBytes) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];\n if (extraBytes > 1) {\n hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];\n }\n if (extraBytes > 2) {\n hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];\n }\n }\n return hex;\n };\n\n Keccak.prototype.arrayBuffer = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var bytes = this.outputBits >> 3;\n var buffer;\n if (extraBytes) {\n buffer = new ArrayBuffer((outputBlocks + 1) << 2);\n } else {\n buffer = new ArrayBuffer(bytes);\n }\n var array = new Uint32Array(buffer);\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n array[j] = s[i];\n }\n if (j % blockCount === 0) {\n s = cloneArray(s);\n f(s);\n }\n }\n if (extraBytes) {\n array[j] = s[i];\n buffer = buffer.slice(0, bytes);\n }\n return buffer;\n };\n\n Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;\n\n Keccak.prototype.digest = Keccak.prototype.array = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var array = [], offset, block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n array[offset + 1] = (block >> 8) & 0xFF;\n array[offset + 2] = (block >> 16) & 0xFF;\n array[offset + 3] = (block >> 24) & 0xFF;\n }\n if (j % blockCount === 0) {\n s = cloneArray(s);\n f(s);\n }\n }\n if (extraBytes) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n if (extraBytes > 1) {\n array[offset + 1] = (block >> 8) & 0xFF;\n }\n if (extraBytes > 2) {\n array[offset + 2] = (block >> 16) & 0xFF;\n }\n }\n return array;\n };\n\n function Kmac(bits, padding, outputBits) {\n Keccak.call(this, bits, padding, outputBits);\n }\n\n Kmac.prototype = new Keccak();\n\n Kmac.prototype.finalize = function () {\n this.encode(this.outputBits, true);\n return Keccak.prototype.finalize.call(this);\n };\n\n var f = function (s) {\n var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,\n b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,\n b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,\n b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;\n for (n = 0; n < 48; n += 2) {\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\n\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\n s[0] ^= h;\n s[1] ^= l;\n s[10] ^= h;\n s[11] ^= l;\n s[20] ^= h;\n s[21] ^= l;\n s[30] ^= h;\n s[31] ^= l;\n s[40] ^= h;\n s[41] ^= l;\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\n s[2] ^= h;\n s[3] ^= l;\n s[12] ^= h;\n s[13] ^= l;\n s[22] ^= h;\n s[23] ^= l;\n s[32] ^= h;\n s[33] ^= l;\n s[42] ^= h;\n s[43] ^= l;\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\n s[4] ^= h;\n s[5] ^= l;\n s[14] ^= h;\n s[15] ^= l;\n s[24] ^= h;\n s[25] ^= l;\n s[34] ^= h;\n s[35] ^= l;\n s[44] ^= h;\n s[45] ^= l;\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\n s[6] ^= h;\n s[7] ^= l;\n s[16] ^= h;\n s[17] ^= l;\n s[26] ^= h;\n s[27] ^= l;\n s[36] ^= h;\n s[37] ^= l;\n s[46] ^= h;\n s[47] ^= l;\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\n s[8] ^= h;\n s[9] ^= l;\n s[18] ^= h;\n s[19] ^= l;\n s[28] ^= h;\n s[29] ^= l;\n s[38] ^= h;\n s[39] ^= l;\n s[48] ^= h;\n s[49] ^= l;\n\n b0 = s[0];\n b1 = s[1];\n b32 = (s[11] << 4) | (s[10] >>> 28);\n b33 = (s[10] << 4) | (s[11] >>> 28);\n b14 = (s[20] << 3) | (s[21] >>> 29);\n b15 = (s[21] << 3) | (s[20] >>> 29);\n b46 = (s[31] << 9) | (s[30] >>> 23);\n b47 = (s[30] << 9) | (s[31] >>> 23);\n b28 = (s[40] << 18) | (s[41] >>> 14);\n b29 = (s[41] << 18) | (s[40] >>> 14);\n b20 = (s[2] << 1) | (s[3] >>> 31);\n b21 = (s[3] << 1) | (s[2] >>> 31);\n b2 = (s[13] << 12) | (s[12] >>> 20);\n b3 = (s[12] << 12) | (s[13] >>> 20);\n b34 = (s[22] << 10) | (s[23] >>> 22);\n b35 = (s[23] << 10) | (s[22] >>> 22);\n b16 = (s[33] << 13) | (s[32] >>> 19);\n b17 = (s[32] << 13) | (s[33] >>> 19);\n b48 = (s[42] << 2) | (s[43] >>> 30);\n b49 = (s[43] << 2) | (s[42] >>> 30);\n b40 = (s[5] << 30) | (s[4] >>> 2);\n b41 = (s[4] << 30) | (s[5] >>> 2);\n b22 = (s[14] << 6) | (s[15] >>> 26);\n b23 = (s[15] << 6) | (s[14] >>> 26);\n b4 = (s[25] << 11) | (s[24] >>> 21);\n b5 = (s[24] << 11) | (s[25] >>> 21);\n b36 = (s[34] << 15) | (s[35] >>> 17);\n b37 = (s[35] << 15) | (s[34] >>> 17);\n b18 = (s[45] << 29) | (s[44] >>> 3);\n b19 = (s[44] << 29) | (s[45] >>> 3);\n b10 = (s[6] << 28) | (s[7] >>> 4);\n b11 = (s[7] << 28) | (s[6] >>> 4);\n b42 = (s[17] << 23) | (s[16] >>> 9);\n b43 = (s[16] << 23) | (s[17] >>> 9);\n b24 = (s[26] << 25) | (s[27] >>> 7);\n b25 = (s[27] << 25) | (s[26] >>> 7);\n b6 = (s[36] << 21) | (s[37] >>> 11);\n b7 = (s[37] << 21) | (s[36] >>> 11);\n b38 = (s[47] << 24) | (s[46] >>> 8);\n b39 = (s[46] << 24) | (s[47] >>> 8);\n b30 = (s[8] << 27) | (s[9] >>> 5);\n b31 = (s[9] << 27) | (s[8] >>> 5);\n b12 = (s[18] << 20) | (s[19] >>> 12);\n b13 = (s[19] << 20) | (s[18] >>> 12);\n b44 = (s[29] << 7) | (s[28] >>> 25);\n b45 = (s[28] << 7) | (s[29] >>> 25);\n b26 = (s[38] << 8) | (s[39] >>> 24);\n b27 = (s[39] << 8) | (s[38] >>> 24);\n b8 = (s[48] << 14) | (s[49] >>> 18);\n b9 = (s[49] << 14) | (s[48] >>> 18);\n\n s[0] = b0 ^ (~b2 & b4);\n s[1] = b1 ^ (~b3 & b5);\n s[10] = b10 ^ (~b12 & b14);\n s[11] = b11 ^ (~b13 & b15);\n s[20] = b20 ^ (~b22 & b24);\n s[21] = b21 ^ (~b23 & b25);\n s[30] = b30 ^ (~b32 & b34);\n s[31] = b31 ^ (~b33 & b35);\n s[40] = b40 ^ (~b42 & b44);\n s[41] = b41 ^ (~b43 & b45);\n s[2] = b2 ^ (~b4 & b6);\n s[3] = b3 ^ (~b5 & b7);\n s[12] = b12 ^ (~b14 & b16);\n s[13] = b13 ^ (~b15 & b17);\n s[22] = b22 ^ (~b24 & b26);\n s[23] = b23 ^ (~b25 & b27);\n s[32] = b32 ^ (~b34 & b36);\n s[33] = b33 ^ (~b35 & b37);\n s[42] = b42 ^ (~b44 & b46);\n s[43] = b43 ^ (~b45 & b47);\n s[4] = b4 ^ (~b6 & b8);\n s[5] = b5 ^ (~b7 & b9);\n s[14] = b14 ^ (~b16 & b18);\n s[15] = b15 ^ (~b17 & b19);\n s[24] = b24 ^ (~b26 & b28);\n s[25] = b25 ^ (~b27 & b29);\n s[34] = b34 ^ (~b36 & b38);\n s[35] = b35 ^ (~b37 & b39);\n s[44] = b44 ^ (~b46 & b48);\n s[45] = b45 ^ (~b47 & b49);\n s[6] = b6 ^ (~b8 & b0);\n s[7] = b7 ^ (~b9 & b1);\n s[16] = b16 ^ (~b18 & b10);\n s[17] = b17 ^ (~b19 & b11);\n s[26] = b26 ^ (~b28 & b20);\n s[27] = b27 ^ (~b29 & b21);\n s[36] = b36 ^ (~b38 & b30);\n s[37] = b37 ^ (~b39 & b31);\n s[46] = b46 ^ (~b48 & b40);\n s[47] = b47 ^ (~b49 & b41);\n s[8] = b8 ^ (~b0 & b2);\n s[9] = b9 ^ (~b1 & b3);\n s[18] = b18 ^ (~b10 & b12);\n s[19] = b19 ^ (~b11 & b13);\n s[28] = b28 ^ (~b20 & b22);\n s[29] = b29 ^ (~b21 & b23);\n s[38] = b38 ^ (~b30 & b32);\n s[39] = b39 ^ (~b31 & b33);\n s[48] = b48 ^ (~b40 & b42);\n s[49] = b49 ^ (~b41 & b43);\n\n s[0] ^= RC[n];\n s[1] ^= RC[n + 1];\n }\n };\n\n if (COMMON_JS) {\n module.exports = methods;\n } else {\n for (i = 0; i < methodNames.length; ++i) {\n root[methodNames[i]] = methods[methodNames[i]];\n }\n if (AMD) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n return methods;\n }).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n }\n }\n})();\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/js-sha3/src/sha3.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/merge-options/index.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/merge-options/index.js ***!
|
||
\*********************************************/
|
||
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
eval("\nconst isOptionObject = __webpack_require__(/*! is-plain-obj */ \"./node_modules/is-plain-obj/index.js\");\n\nconst {hasOwnProperty} = Object.prototype;\nconst {propertyIsEnumerable} = Object;\nconst defineProperty = (object, name, value) => Object.defineProperty(object, name, {\n\tvalue,\n\twritable: true,\n\tenumerable: true,\n\tconfigurable: true\n});\n\nconst globalThis = this;\nconst defaultMergeOptions = {\n\tconcatArrays: false,\n\tignoreUndefined: false\n};\n\nconst getEnumerableOwnPropertyKeys = value => {\n\tconst keys = [];\n\n\tfor (const key in value) {\n\t\tif (hasOwnProperty.call(value, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\n\t/* istanbul ignore else */\n\tif (Object.getOwnPropertySymbols) {\n\t\tconst symbols = Object.getOwnPropertySymbols(value);\n\n\t\tfor (const symbol of symbols) {\n\t\t\tif (propertyIsEnumerable.call(value, symbol)) {\n\t\t\t\tkeys.push(symbol);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn keys;\n};\n\nfunction clone(value) {\n\tif (Array.isArray(value)) {\n\t\treturn cloneArray(value);\n\t}\n\n\tif (isOptionObject(value)) {\n\t\treturn cloneOptionObject(value);\n\t}\n\n\treturn value;\n}\n\nfunction cloneArray(array) {\n\tconst result = array.slice(0, 0);\n\n\tgetEnumerableOwnPropertyKeys(array).forEach(key => {\n\t\tdefineProperty(result, key, clone(array[key]));\n\t});\n\n\treturn result;\n}\n\nfunction cloneOptionObject(object) {\n\tconst result = Object.getPrototypeOf(object) === null ? Object.create(null) : {};\n\n\tgetEnumerableOwnPropertyKeys(object).forEach(key => {\n\t\tdefineProperty(result, key, clone(object[key]));\n\t});\n\n\treturn result;\n}\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {string[]} keys keys to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n */\nconst mergeKeys = (merged, source, keys, config) => {\n\tkeys.forEach(key => {\n\t\tif (typeof source[key] === 'undefined' && config.ignoreUndefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Do not recurse into prototype chain of merged\n\t\tif (key in merged && merged[key] !== Object.getPrototypeOf(merged)) {\n\t\t\tdefineProperty(merged, key, merge(merged[key], source[key], config));\n\t\t} else {\n\t\t\tdefineProperty(merged, key, clone(source[key]));\n\t\t}\n\t});\n\n\treturn merged;\n};\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n *\n * see [Array.prototype.concat ( ...arguments )](http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.concat)\n */\nconst concatArrays = (merged, source, config) => {\n\tlet result = merged.slice(0, 0);\n\tlet resultIndex = 0;\n\n\t[merged, source].forEach(array => {\n\t\tconst indices = [];\n\n\t\t// `result.concat(array)` with cloning\n\t\tfor (let k = 0; k < array.length; k++) {\n\t\t\tif (!hasOwnProperty.call(array, k)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tindices.push(String(k));\n\n\t\t\tif (array === merged) {\n\t\t\t\t// Already cloned\n\t\t\t\tdefineProperty(result, resultIndex++, array[k]);\n\t\t\t} else {\n\t\t\t\tdefineProperty(result, resultIndex++, clone(array[k]));\n\t\t\t}\n\t\t}\n\n\t\t// Merge non-index keys\n\t\tresult = mergeKeys(result, array, getEnumerableOwnPropertyKeys(array).filter(key => !indices.includes(key)), config);\n\t});\n\n\treturn result;\n};\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n */\nfunction merge(merged, source, config) {\n\tif (config.concatArrays && Array.isArray(merged) && Array.isArray(source)) {\n\t\treturn concatArrays(merged, source, config);\n\t}\n\n\tif (!isOptionObject(source) || !isOptionObject(merged)) {\n\t\treturn clone(source);\n\t}\n\n\treturn mergeKeys(merged, source, getEnumerableOwnPropertyKeys(source), config);\n}\n\nmodule.exports = function (...options) {\n\tconst config = merge(clone(defaultMergeOptions), (this !== globalThis && this) || {}, defaultMergeOptions);\n\tlet merged = {_: {}};\n\n\tfor (const option of options) {\n\t\tif (option === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!isOptionObject(option)) {\n\t\t\tthrow new TypeError('`' + option + '` is not an Option Object');\n\t\t}\n\n\t\tmerged = merge(merged, {_: option}, config);\n\t}\n\n\treturn merged._;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/merge-options/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/ms/index.js":
|
||
/*!**********************************!*\
|
||
!*** ./node_modules/ms/index.js ***!
|
||
\**********************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/ms/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/netmask/lib/netmask.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/netmask/lib/netmask.js ***!
|
||
\*********************************************/
|
||
/***/ (function(__unused_webpack_module, exports) {
|
||
|
||
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var Netmask, atob, chr, chr0, chrA, chra, ip2long, long2ip;\n\n long2ip = function(long) {\n var a, b, c, d;\n a = (long & (0xff << 24)) >>> 24;\n b = (long & (0xff << 16)) >>> 16;\n c = (long & (0xff << 8)) >>> 8;\n d = long & 0xff;\n return [a, b, c, d].join('.');\n };\n\n ip2long = function(ip) {\n var b, c, i, j, n, ref;\n b = [];\n for (i = j = 0; j <= 3; i = ++j) {\n if (ip.length === 0) {\n break;\n }\n if (i > 0) {\n if (ip[0] !== '.') {\n throw new Error('Invalid IP');\n }\n ip = ip.substring(1);\n }\n ref = atob(ip), n = ref[0], c = ref[1];\n ip = ip.substring(c);\n b.push(n);\n }\n if (ip.length !== 0) {\n throw new Error('Invalid IP');\n }\n switch (b.length) {\n case 1:\n if (b[0] > 0xFFFFFFFF) {\n throw new Error('Invalid IP');\n }\n return b[0] >>> 0;\n case 2:\n if (b[0] > 0xFF || b[1] > 0xFFFFFF) {\n throw new Error('Invalid IP');\n }\n return (b[0] << 24 | b[1]) >>> 0;\n case 3:\n if (b[0] > 0xFF || b[1] > 0xFF || b[2] > 0xFFFF) {\n throw new Error('Invalid IP');\n }\n return (b[0] << 24 | b[1] << 16 | b[2]) >>> 0;\n case 4:\n if (b[0] > 0xFF || b[1] > 0xFF || b[2] > 0xFF || b[3] > 0xFF) {\n throw new Error('Invalid IP');\n }\n return (b[0] << 24 | b[1] << 16 | b[2] << 8 | b[3]) >>> 0;\n default:\n throw new Error('Invalid IP');\n }\n };\n\n chr = function(b) {\n return b.charCodeAt(0);\n };\n\n chr0 = chr('0');\n\n chra = chr('a');\n\n chrA = chr('A');\n\n atob = function(s) {\n var base, dmax, i, n, start;\n n = 0;\n base = 10;\n dmax = '9';\n i = 0;\n if (s.length > 1 && s[i] === '0') {\n if (s[i + 1] === 'x' || s[i + 1] === 'X') {\n i += 2;\n base = 16;\n } else if ('0' <= s[i + 1] && s[i + 1] <= '9') {\n i++;\n base = 8;\n dmax = '7';\n }\n }\n start = i;\n while (i < s.length) {\n if ('0' <= s[i] && s[i] <= dmax) {\n n = (n * base + (chr(s[i]) - chr0)) >>> 0;\n } else if (base === 16) {\n if ('a' <= s[i] && s[i] <= 'f') {\n n = (n * base + (10 + chr(s[i]) - chra)) >>> 0;\n } else if ('A' <= s[i] && s[i] <= 'F') {\n n = (n * base + (10 + chr(s[i]) - chrA)) >>> 0;\n } else {\n break;\n }\n } else {\n break;\n }\n if (n > 0xFFFFFFFF) {\n throw new Error('too large');\n }\n i++;\n }\n if (i === start) {\n throw new Error('empty octet');\n }\n return [n, i];\n };\n\n Netmask = (function() {\n function Netmask(net, mask) {\n var error, i, j, ref;\n if (typeof net !== 'string') {\n throw new Error(\"Missing `net' parameter\");\n }\n if (!mask) {\n ref = net.split('/', 2), net = ref[0], mask = ref[1];\n }\n if (!mask) {\n mask = 32;\n }\n if (typeof mask === 'string' && mask.indexOf('.') > -1) {\n try {\n this.maskLong = ip2long(mask);\n } catch (error1) {\n error = error1;\n throw new Error(\"Invalid mask: \" + mask);\n }\n for (i = j = 32; j >= 0; i = --j) {\n if (this.maskLong === (0xffffffff << (32 - i)) >>> 0) {\n this.bitmask = i;\n break;\n }\n }\n } else if (mask || mask === 0) {\n this.bitmask = parseInt(mask, 10);\n this.maskLong = 0;\n if (this.bitmask > 0) {\n this.maskLong = (0xffffffff << (32 - this.bitmask)) >>> 0;\n }\n } else {\n throw new Error(\"Invalid mask: empty\");\n }\n try {\n this.netLong = (ip2long(net) & this.maskLong) >>> 0;\n } catch (error1) {\n error = error1;\n throw new Error(\"Invalid net address: \" + net);\n }\n if (!(this.bitmask <= 32)) {\n throw new Error(\"Invalid mask for ip4: \" + mask);\n }\n this.size = Math.pow(2, 32 - this.bitmask);\n this.base = long2ip(this.netLong);\n this.mask = long2ip(this.maskLong);\n this.hostmask = long2ip(~this.maskLong);\n this.first = this.bitmask <= 30 ? long2ip(this.netLong + 1) : this.base;\n this.last = this.bitmask <= 30 ? long2ip(this.netLong + this.size - 2) : long2ip(this.netLong + this.size - 1);\n this.broadcast = this.bitmask <= 30 ? long2ip(this.netLong + this.size - 1) : void 0;\n }\n\n Netmask.prototype.contains = function(ip) {\n if (typeof ip === 'string' && (ip.indexOf('/') > 0 || ip.split('.').length !== 4)) {\n ip = new Netmask(ip);\n }\n if (ip instanceof Netmask) {\n return this.contains(ip.base) && this.contains(ip.broadcast || ip.last);\n } else {\n return (ip2long(ip) & this.maskLong) >>> 0 === (this.netLong & this.maskLong) >>> 0;\n }\n };\n\n Netmask.prototype.next = function(count) {\n if (count == null) {\n count = 1;\n }\n return new Netmask(long2ip(this.netLong + (this.size * count)), this.mask);\n };\n\n Netmask.prototype.forEach = function(fn) {\n var index, lastLong, long;\n long = ip2long(this.first);\n lastLong = ip2long(this.last);\n index = 0;\n while (long <= lastLong) {\n fn(long2ip(long), long, index);\n index++;\n long++;\n }\n };\n\n Netmask.prototype.toString = function() {\n return this.base + \"/\" + this.bitmask;\n };\n\n return Netmask;\n\n })();\n\n exports.ip2long = ip2long;\n\n exports.long2ip = long2ip;\n\n exports.Netmask = Netmask;\n\n}).call(this);\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/netmask/lib/netmask.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/aes.js":
|
||
/*!********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/aes.js ***!
|
||
\********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Advanced Encryption Standard (AES) implementation.\n *\n * This implementation is based on the public domain library 'jscrypto' which\n * was written by:\n *\n * Emily Stark (estark@stanford.edu)\n * Mike Hamburg (mhamburg@stanford.edu)\n * Dan Boneh (dabo@cs.stanford.edu)\n *\n * Parts of this code are based on the OpenSSL implementation of AES:\n * http://www.openssl.org\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./cipher */ \"./node_modules/node-forge/lib/cipher.js\");\n__webpack_require__(/*! ./cipherModes */ \"./node_modules/node-forge/lib/cipherModes.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\n/* AES API */\nmodule.exports = forge.aes = forge.aes || {};\n\n/**\n * Deprecated. Instead, use:\n *\n * var cipher = forge.cipher.createCipher('AES-<mode>', key);\n * cipher.start({iv: iv});\n *\n * Creates an AES cipher object to encrypt data using the given symmetric key.\n * The output will be stored in the 'output' member of the returned cipher.\n *\n * The key and iv may be given as a string of bytes, an array of bytes,\n * a byte buffer, or an array of 32-bit words.\n *\n * @param key the symmetric key to use.\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.aes.startEncrypting = function(key, iv, output, mode) {\n var cipher = _createCipher({\n key: key,\n output: output,\n decrypt: false,\n mode: mode\n });\n cipher.start(iv);\n return cipher;\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var cipher = forge.cipher.createCipher('AES-<mode>', key);\n *\n * Creates an AES cipher object to encrypt data using the given symmetric key.\n *\n * The key may be given as a string of bytes, an array of bytes, a\n * byte buffer, or an array of 32-bit words.\n *\n * @param key the symmetric key to use.\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.aes.createEncryptionCipher = function(key, mode) {\n return _createCipher({\n key: key,\n output: null,\n decrypt: false,\n mode: mode\n });\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var decipher = forge.cipher.createDecipher('AES-<mode>', key);\n * decipher.start({iv: iv});\n *\n * Creates an AES cipher object to decrypt data using the given symmetric key.\n * The output will be stored in the 'output' member of the returned cipher.\n *\n * The key and iv may be given as a string of bytes, an array of bytes,\n * a byte buffer, or an array of 32-bit words.\n *\n * @param key the symmetric key to use.\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.aes.startDecrypting = function(key, iv, output, mode) {\n var cipher = _createCipher({\n key: key,\n output: output,\n decrypt: true,\n mode: mode\n });\n cipher.start(iv);\n return cipher;\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var decipher = forge.cipher.createDecipher('AES-<mode>', key);\n *\n * Creates an AES cipher object to decrypt data using the given symmetric key.\n *\n * The key may be given as a string of bytes, an array of bytes, a\n * byte buffer, or an array of 32-bit words.\n *\n * @param key the symmetric key to use.\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.aes.createDecryptionCipher = function(key, mode) {\n return _createCipher({\n key: key,\n output: null,\n decrypt: true,\n mode: mode\n });\n};\n\n/**\n * Creates a new AES cipher algorithm object.\n *\n * @param name the name of the algorithm.\n * @param mode the mode factory function.\n *\n * @return the AES algorithm object.\n */\nforge.aes.Algorithm = function(name, mode) {\n if(!init) {\n initialize();\n }\n var self = this;\n self.name = name;\n self.mode = new mode({\n blockSize: 16,\n cipher: {\n encrypt: function(inBlock, outBlock) {\n return _updateBlock(self._w, inBlock, outBlock, false);\n },\n decrypt: function(inBlock, outBlock) {\n return _updateBlock(self._w, inBlock, outBlock, true);\n }\n }\n });\n self._init = false;\n};\n\n/**\n * Initializes this AES algorithm by expanding its key.\n *\n * @param options the options to use.\n * key the key to use with this algorithm.\n * decrypt true if the algorithm should be initialized for decryption,\n * false for encryption.\n */\nforge.aes.Algorithm.prototype.initialize = function(options) {\n if(this._init) {\n return;\n }\n\n var key = options.key;\n var tmp;\n\n /* Note: The key may be a string of bytes, an array of bytes, a byte\n buffer, or an array of 32-bit integers. If the key is in bytes, then\n it must be 16, 24, or 32 bytes in length. If it is in 32-bit\n integers, it must be 4, 6, or 8 integers long. */\n\n if(typeof key === 'string' &&\n (key.length === 16 || key.length === 24 || key.length === 32)) {\n // convert key string into byte buffer\n key = forge.util.createBuffer(key);\n } else if(forge.util.isArray(key) &&\n (key.length === 16 || key.length === 24 || key.length === 32)) {\n // convert key integer array into byte buffer\n tmp = key;\n key = forge.util.createBuffer();\n for(var i = 0; i < tmp.length; ++i) {\n key.putByte(tmp[i]);\n }\n }\n\n // convert key byte buffer into 32-bit integer array\n if(!forge.util.isArray(key)) {\n tmp = key;\n key = [];\n\n // key lengths of 16, 24, 32 bytes allowed\n var len = tmp.length();\n if(len === 16 || len === 24 || len === 32) {\n len = len >>> 2;\n for(var i = 0; i < len; ++i) {\n key.push(tmp.getInt32());\n }\n }\n }\n\n // key must be an array of 32-bit integers by now\n if(!forge.util.isArray(key) ||\n !(key.length === 4 || key.length === 6 || key.length === 8)) {\n throw new Error('Invalid key parameter.');\n }\n\n // encryption operation is always used for these modes\n var mode = this.mode.name;\n var encryptOp = (['CFB', 'OFB', 'CTR', 'GCM'].indexOf(mode) !== -1);\n\n // do key expansion\n this._w = _expandKey(key, options.decrypt && !encryptOp);\n this._init = true;\n};\n\n/**\n * Expands a key. Typically only used for testing.\n *\n * @param key the symmetric key to expand, as an array of 32-bit words.\n * @param decrypt true to expand for decryption, false for encryption.\n *\n * @return the expanded key.\n */\nforge.aes._expandKey = function(key, decrypt) {\n if(!init) {\n initialize();\n }\n return _expandKey(key, decrypt);\n};\n\n/**\n * Updates a single block. Typically only used for testing.\n *\n * @param w the expanded key to use.\n * @param input an array of block-size 32-bit words.\n * @param output an array of block-size 32-bit words.\n * @param decrypt true to decrypt, false to encrypt.\n */\nforge.aes._updateBlock = _updateBlock;\n\n/** Register AES algorithms **/\n\nregisterAlgorithm('AES-ECB', forge.cipher.modes.ecb);\nregisterAlgorithm('AES-CBC', forge.cipher.modes.cbc);\nregisterAlgorithm('AES-CFB', forge.cipher.modes.cfb);\nregisterAlgorithm('AES-OFB', forge.cipher.modes.ofb);\nregisterAlgorithm('AES-CTR', forge.cipher.modes.ctr);\nregisterAlgorithm('AES-GCM', forge.cipher.modes.gcm);\n\nfunction registerAlgorithm(name, mode) {\n var factory = function() {\n return new forge.aes.Algorithm(name, mode);\n };\n forge.cipher.registerAlgorithm(name, factory);\n}\n\n/** AES implementation **/\n\nvar init = false; // not yet initialized\nvar Nb = 4; // number of words comprising the state (AES = 4)\nvar sbox; // non-linear substitution table used in key expansion\nvar isbox; // inversion of sbox\nvar rcon; // round constant word array\nvar mix; // mix-columns table\nvar imix; // inverse mix-columns table\n\n/**\n * Performs initialization, ie: precomputes tables to optimize for speed.\n *\n * One way to understand how AES works is to imagine that 'addition' and\n * 'multiplication' are interfaces that require certain mathematical\n * properties to hold true (ie: they are associative) but they might have\n * different implementations and produce different kinds of results ...\n * provided that their mathematical properties remain true. AES defines\n * its own methods of addition and multiplication but keeps some important\n * properties the same, ie: associativity and distributivity. The\n * explanation below tries to shed some light on how AES defines addition\n * and multiplication of bytes and 32-bit words in order to perform its\n * encryption and decryption algorithms.\n *\n * The basics:\n *\n * The AES algorithm views bytes as binary representations of polynomials\n * that have either 1 or 0 as the coefficients. It defines the addition\n * or subtraction of two bytes as the XOR operation. It also defines the\n * multiplication of two bytes as a finite field referred to as GF(2^8)\n * (Note: 'GF' means \"Galois Field\" which is a field that contains a finite\n * number of elements so GF(2^8) has 256 elements).\n *\n * This means that any two bytes can be represented as binary polynomials;\n * when they multiplied together and modularly reduced by an irreducible\n * polynomial of the 8th degree, the results are the field GF(2^8). The\n * specific irreducible polynomial that AES uses in hexadecimal is 0x11b.\n * This multiplication is associative with 0x01 as the identity:\n *\n * (b * 0x01 = GF(b, 0x01) = b).\n *\n * The operation GF(b, 0x02) can be performed at the byte level by left\n * shifting b once and then XOR'ing it (to perform the modular reduction)\n * with 0x11b if b is >= 128. Repeated application of the multiplication\n * of 0x02 can be used to implement the multiplication of any two bytes.\n *\n * For instance, multiplying 0x57 and 0x13, denoted as GF(0x57, 0x13), can\n * be performed by factoring 0x13 into 0x01, 0x02, and 0x10. Then these\n * factors can each be multiplied by 0x57 and then added together. To do\n * the multiplication, values for 0x57 multiplied by each of these 3 factors\n * can be precomputed and stored in a table. To add them, the values from\n * the table are XOR'd together.\n *\n * AES also defines addition and multiplication of words, that is 4-byte\n * numbers represented as polynomials of 3 degrees where the coefficients\n * are the values of the bytes.\n *\n * The word [a0, a1, a2, a3] is a polynomial a3x^3 + a2x^2 + a1x + a0.\n *\n * Addition is performed by XOR'ing like powers of x. Multiplication\n * is performed in two steps, the first is an algebriac expansion as\n * you would do normally (where addition is XOR). But the result is\n * a polynomial larger than 3 degrees and thus it cannot fit in a word. So\n * next the result is modularly reduced by an AES-specific polynomial of\n * degree 4 which will always produce a polynomial of less than 4 degrees\n * such that it will fit in a word. In AES, this polynomial is x^4 + 1.\n *\n * The modular product of two polynomials 'a' and 'b' is thus:\n *\n * d(x) = d3x^3 + d2x^2 + d1x + d0\n * with\n * d0 = GF(a0, b0) ^ GF(a3, b1) ^ GF(a2, b2) ^ GF(a1, b3)\n * d1 = GF(a1, b0) ^ GF(a0, b1) ^ GF(a3, b2) ^ GF(a2, b3)\n * d2 = GF(a2, b0) ^ GF(a1, b1) ^ GF(a0, b2) ^ GF(a3, b3)\n * d3 = GF(a3, b0) ^ GF(a2, b1) ^ GF(a1, b2) ^ GF(a0, b3)\n *\n * As a matrix:\n *\n * [d0] = [a0 a3 a2 a1][b0]\n * [d1] [a1 a0 a3 a2][b1]\n * [d2] [a2 a1 a0 a3][b2]\n * [d3] [a3 a2 a1 a0][b3]\n *\n * Special polynomials defined by AES (0x02 == {02}):\n * a(x) = {03}x^3 + {01}x^2 + {01}x + {02}\n * a^-1(x) = {0b}x^3 + {0d}x^2 + {09}x + {0e}.\n *\n * These polynomials are used in the MixColumns() and InverseMixColumns()\n * operations, respectively, to cause each element in the state to affect\n * the output (referred to as diffusing).\n *\n * RotWord() uses: a0 = a1 = a2 = {00} and a3 = {01}, which is the\n * polynomial x3.\n *\n * The ShiftRows() method modifies the last 3 rows in the state (where\n * the state is 4 words with 4 bytes per word) by shifting bytes cyclically.\n * The 1st byte in the second row is moved to the end of the row. The 1st\n * and 2nd bytes in the third row are moved to the end of the row. The 1st,\n * 2nd, and 3rd bytes are moved in the fourth row.\n *\n * More details on how AES arithmetic works:\n *\n * In the polynomial representation of binary numbers, XOR performs addition\n * and subtraction and multiplication in GF(2^8) denoted as GF(a, b)\n * corresponds with the multiplication of polynomials modulo an irreducible\n * polynomial of degree 8. In other words, for AES, GF(a, b) will multiply\n * polynomial 'a' with polynomial 'b' and then do a modular reduction by\n * an AES-specific irreducible polynomial of degree 8.\n *\n * A polynomial is irreducible if its only divisors are one and itself. For\n * the AES algorithm, this irreducible polynomial is:\n *\n * m(x) = x^8 + x^4 + x^3 + x + 1,\n *\n * or {01}{1b} in hexadecimal notation, where each coefficient is a bit:\n * 100011011 = 283 = 0x11b.\n *\n * For example, GF(0x57, 0x83) = 0xc1 because\n *\n * 0x57 = 87 = 01010111 = x^6 + x^4 + x^2 + x + 1\n * 0x85 = 131 = 10000101 = x^7 + x + 1\n *\n * (x^6 + x^4 + x^2 + x + 1) * (x^7 + x + 1)\n * = x^13 + x^11 + x^9 + x^8 + x^7 +\n * x^7 + x^5 + x^3 + x^2 + x +\n * x^6 + x^4 + x^2 + x + 1\n * = x^13 + x^11 + x^9 + x^8 + x^6 + x^5 + x^4 + x^3 + 1 = y\n * y modulo (x^8 + x^4 + x^3 + x + 1)\n * = x^7 + x^6 + 1.\n *\n * The modular reduction by m(x) guarantees the result will be a binary\n * polynomial of less than degree 8, so that it can fit in a byte.\n *\n * The operation to multiply a binary polynomial b with x (the polynomial\n * x in binary representation is 00000010) is:\n *\n * b_7x^8 + b_6x^7 + b_5x^6 + b_4x^5 + b_3x^4 + b_2x^3 + b_1x^2 + b_0x^1\n *\n * To get GF(b, x) we must reduce that by m(x). If b_7 is 0 (that is the\n * most significant bit is 0 in b) then the result is already reduced. If\n * it is 1, then we can reduce it by subtracting m(x) via an XOR.\n *\n * It follows that multiplication by x (00000010 or 0x02) can be implemented\n * by performing a left shift followed by a conditional bitwise XOR with\n * 0x1b. This operation on bytes is denoted by xtime(). Multiplication by\n * higher powers of x can be implemented by repeated application of xtime().\n *\n * By adding intermediate results, multiplication by any constant can be\n * implemented. For instance:\n *\n * GF(0x57, 0x13) = 0xfe because:\n *\n * xtime(b) = (b & 128) ? (b << 1 ^ 0x11b) : (b << 1)\n *\n * Note: We XOR with 0x11b instead of 0x1b because in javascript our\n * datatype for b can be larger than 1 byte, so a left shift will not\n * automatically eliminate bits that overflow a byte ... by XOR'ing the\n * overflow bit with 1 (the extra one from 0x11b) we zero it out.\n *\n * GF(0x57, 0x02) = xtime(0x57) = 0xae\n * GF(0x57, 0x04) = xtime(0xae) = 0x47\n * GF(0x57, 0x08) = xtime(0x47) = 0x8e\n * GF(0x57, 0x10) = xtime(0x8e) = 0x07\n *\n * GF(0x57, 0x13) = GF(0x57, (0x01 ^ 0x02 ^ 0x10))\n *\n * And by the distributive property (since XOR is addition and GF() is\n * multiplication):\n *\n * = GF(0x57, 0x01) ^ GF(0x57, 0x02) ^ GF(0x57, 0x10)\n * = 0x57 ^ 0xae ^ 0x07\n * = 0xfe.\n */\nfunction initialize() {\n init = true;\n\n /* Populate the Rcon table. These are the values given by\n [x^(i-1),{00},{00},{00}] where x^(i-1) are powers of x (and x = 0x02)\n in the field of GF(2^8), where i starts at 1.\n\n rcon[0] = [0x00, 0x00, 0x00, 0x00]\n rcon[1] = [0x01, 0x00, 0x00, 0x00] 2^(1-1) = 2^0 = 1\n rcon[2] = [0x02, 0x00, 0x00, 0x00] 2^(2-1) = 2^1 = 2\n ...\n rcon[9] = [0x1B, 0x00, 0x00, 0x00] 2^(9-1) = 2^8 = 0x1B\n rcon[10] = [0x36, 0x00, 0x00, 0x00] 2^(10-1) = 2^9 = 0x36\n\n We only store the first byte because it is the only one used.\n */\n rcon = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36];\n\n // compute xtime table which maps i onto GF(i, 0x02)\n var xtime = new Array(256);\n for(var i = 0; i < 128; ++i) {\n xtime[i] = i << 1;\n xtime[i + 128] = (i + 128) << 1 ^ 0x11B;\n }\n\n // compute all other tables\n sbox = new Array(256);\n isbox = new Array(256);\n mix = new Array(4);\n imix = new Array(4);\n for(var i = 0; i < 4; ++i) {\n mix[i] = new Array(256);\n imix[i] = new Array(256);\n }\n var e = 0, ei = 0, e2, e4, e8, sx, sx2, me, ime;\n for(var i = 0; i < 256; ++i) {\n /* We need to generate the SubBytes() sbox and isbox tables so that\n we can perform byte substitutions. This requires us to traverse\n all of the elements in GF, find their multiplicative inverses,\n and apply to each the following affine transformation:\n\n bi' = bi ^ b(i + 4) mod 8 ^ b(i + 5) mod 8 ^ b(i + 6) mod 8 ^\n b(i + 7) mod 8 ^ ci\n for 0 <= i < 8, where bi is the ith bit of the byte, and ci is the\n ith bit of a byte c with the value {63} or {01100011}.\n\n It is possible to traverse every possible value in a Galois field\n using what is referred to as a 'generator'. There are many\n generators (128 out of 256): 3,5,6,9,11,82 to name a few. To fully\n traverse GF we iterate 255 times, multiplying by our generator\n each time.\n\n On each iteration we can determine the multiplicative inverse for\n the current element.\n\n Suppose there is an element in GF 'e'. For a given generator 'g',\n e = g^x. The multiplicative inverse of e is g^(255 - x). It turns\n out that if use the inverse of a generator as another generator\n it will produce all of the corresponding multiplicative inverses\n at the same time. For this reason, we choose 5 as our inverse\n generator because it only requires 2 multiplies and 1 add and its\n inverse, 82, requires relatively few operations as well.\n\n In order to apply the affine transformation, the multiplicative\n inverse 'ei' of 'e' can be repeatedly XOR'd (4 times) with a\n bit-cycling of 'ei'. To do this 'ei' is first stored in 's' and\n 'x'. Then 's' is left shifted and the high bit of 's' is made the\n low bit. The resulting value is stored in 's'. Then 'x' is XOR'd\n with 's' and stored in 'x'. On each subsequent iteration the same\n operation is performed. When 4 iterations are complete, 'x' is\n XOR'd with 'c' (0x63) and the transformed value is stored in 'x'.\n For example:\n\n s = 01000001\n x = 01000001\n\n iteration 1: s = 10000010, x ^= s\n iteration 2: s = 00000101, x ^= s\n iteration 3: s = 00001010, x ^= s\n iteration 4: s = 00010100, x ^= s\n x ^= 0x63\n\n This can be done with a loop where s = (s << 1) | (s >> 7). However,\n it can also be done by using a single 16-bit (in this case 32-bit)\n number 'sx'. Since XOR is an associative operation, we can set 'sx'\n to 'ei' and then XOR it with 'sx' left-shifted 1,2,3, and 4 times.\n The most significant bits will flow into the high 8 bit positions\n and be correctly XOR'd with one another. All that remains will be\n to cycle the high 8 bits by XOR'ing them all with the lower 8 bits\n afterwards.\n\n At the same time we're populating sbox and isbox we can precompute\n the multiplication we'll need to do to do MixColumns() later.\n */\n\n // apply affine transformation\n sx = ei ^ (ei << 1) ^ (ei << 2) ^ (ei << 3) ^ (ei << 4);\n sx = (sx >> 8) ^ (sx & 255) ^ 0x63;\n\n // update tables\n sbox[e] = sx;\n isbox[sx] = e;\n\n /* Mixing columns is done using matrix multiplication. The columns\n that are to be mixed are each a single word in the current state.\n The state has Nb columns (4 columns). Therefore each column is a\n 4 byte word. So to mix the columns in a single column 'c' where\n its rows are r0, r1, r2, and r3, we use the following matrix\n multiplication:\n\n [2 3 1 1]*[r0,c]=[r'0,c]\n [1 2 3 1] [r1,c] [r'1,c]\n [1 1 2 3] [r2,c] [r'2,c]\n [3 1 1 2] [r3,c] [r'3,c]\n\n r0, r1, r2, and r3 are each 1 byte of one of the words in the\n state (a column). To do matrix multiplication for each mixed\n column c' we multiply the corresponding row from the left matrix\n with the corresponding column from the right matrix. In total, we\n get 4 equations:\n\n r0,c' = 2*r0,c + 3*r1,c + 1*r2,c + 1*r3,c\n r1,c' = 1*r0,c + 2*r1,c + 3*r2,c + 1*r3,c\n r2,c' = 1*r0,c + 1*r1,c + 2*r2,c + 3*r3,c\n r3,c' = 3*r0,c + 1*r1,c + 1*r2,c + 2*r3,c\n\n As usual, the multiplication is as previously defined and the\n addition is XOR. In order to optimize mixing columns we can store\n the multiplication results in tables. If you think of the whole\n column as a word (it might help to visualize by mentally rotating\n the equations above by counterclockwise 90 degrees) then you can\n see that it would be useful to map the multiplications performed on\n each byte (r0, r1, r2, r3) onto a word as well. For instance, we\n could map 2*r0,1*r0,1*r0,3*r0 onto a word by storing 2*r0 in the\n highest 8 bits and 3*r0 in the lowest 8 bits (with the other two\n respectively in the middle). This means that a table can be\n constructed that uses r0 as an index to the word. We can do the\n same with r1, r2, and r3, creating a total of 4 tables.\n\n To construct a full c', we can just look up each byte of c in\n their respective tables and XOR the results together.\n\n Also, to build each table we only have to calculate the word\n for 2,1,1,3 for every byte ... which we can do on each iteration\n of this loop since we will iterate over every byte. After we have\n calculated 2,1,1,3 we can get the results for the other tables\n by cycling the byte at the end to the beginning. For instance\n we can take the result of table 2,1,1,3 and produce table 3,2,1,1\n by moving the right most byte to the left most position just like\n how you can imagine the 3 moved out of 2,1,1,3 and to the front\n to produce 3,2,1,1.\n\n There is another optimization in that the same multiples of\n the current element we need in order to advance our generator\n to the next iteration can be reused in performing the 2,1,1,3\n calculation. We also calculate the inverse mix column tables,\n with e,9,d,b being the inverse of 2,1,1,3.\n\n When we're done, and we need to actually mix columns, the first\n byte of each state word should be put through mix[0] (2,1,1,3),\n the second through mix[1] (3,2,1,1) and so forth. Then they should\n be XOR'd together to produce the fully mixed column.\n */\n\n // calculate mix and imix table values\n sx2 = xtime[sx];\n e2 = xtime[e];\n e4 = xtime[e2];\n e8 = xtime[e4];\n me =\n (sx2 << 24) ^ // 2\n (sx << 16) ^ // 1\n (sx << 8) ^ // 1\n (sx ^ sx2); // 3\n ime =\n (e2 ^ e4 ^ e8) << 24 ^ // E (14)\n (e ^ e8) << 16 ^ // 9\n (e ^ e4 ^ e8) << 8 ^ // D (13)\n (e ^ e2 ^ e8); // B (11)\n // produce each of the mix tables by rotating the 2,1,1,3 value\n for(var n = 0; n < 4; ++n) {\n mix[n][e] = me;\n imix[n][sx] = ime;\n // cycle the right most byte to the left most position\n // ie: 2,1,1,3 becomes 3,2,1,1\n me = me << 24 | me >>> 8;\n ime = ime << 24 | ime >>> 8;\n }\n\n // get next element and inverse\n if(e === 0) {\n // 1 is the inverse of 1\n e = ei = 1;\n } else {\n // e = 2e + 2*2*2*(10e)) = multiply e by 82 (chosen generator)\n // ei = ei + 2*2*ei = multiply ei by 5 (inverse generator)\n e = e2 ^ xtime[xtime[xtime[e2 ^ e8]]];\n ei ^= xtime[xtime[ei]];\n }\n }\n}\n\n/**\n * Generates a key schedule using the AES key expansion algorithm.\n *\n * The AES algorithm takes the Cipher Key, K, and performs a Key Expansion\n * routine to generate a key schedule. The Key Expansion generates a total\n * of Nb*(Nr + 1) words: the algorithm requires an initial set of Nb words,\n * and each of the Nr rounds requires Nb words of key data. The resulting\n * key schedule consists of a linear array of 4-byte words, denoted [wi ],\n * with i in the range 0 <= i < Nb(Nr + 1).\n *\n * KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)], Nk)\n * AES-128 (Nb=4, Nk=4, Nr=10)\n * AES-192 (Nb=4, Nk=6, Nr=12)\n * AES-256 (Nb=4, Nk=8, Nr=14)\n * Note: Nr=Nk+6.\n *\n * Nb is the number of columns (32-bit words) comprising the State (or\n * number of bytes in a block). For AES, Nb=4.\n *\n * @param key the key to schedule (as an array of 32-bit words).\n * @param decrypt true to modify the key schedule to decrypt, false not to.\n *\n * @return the generated key schedule.\n */\nfunction _expandKey(key, decrypt) {\n // copy the key's words to initialize the key schedule\n var w = key.slice(0);\n\n /* RotWord() will rotate a word, moving the first byte to the last\n byte's position (shifting the other bytes left).\n\n We will be getting the value of Rcon at i / Nk. 'i' will iterate\n from Nk to (Nb * Nr+1). Nk = 4 (4 byte key), Nb = 4 (4 words in\n a block), Nr = Nk + 6 (10). Therefore 'i' will iterate from\n 4 to 44 (exclusive). Each time we iterate 4 times, i / Nk will\n increase by 1. We use a counter iNk to keep track of this.\n */\n\n // go through the rounds expanding the key\n var temp, iNk = 1;\n var Nk = w.length;\n var Nr1 = Nk + 6 + 1;\n var end = Nb * Nr1;\n for(var i = Nk; i < end; ++i) {\n temp = w[i - 1];\n if(i % Nk === 0) {\n // temp = SubWord(RotWord(temp)) ^ Rcon[i / Nk]\n temp =\n sbox[temp >>> 16 & 255] << 24 ^\n sbox[temp >>> 8 & 255] << 16 ^\n sbox[temp & 255] << 8 ^\n sbox[temp >>> 24] ^ (rcon[iNk] << 24);\n iNk++;\n } else if(Nk > 6 && (i % Nk === 4)) {\n // temp = SubWord(temp)\n temp =\n sbox[temp >>> 24] << 24 ^\n sbox[temp >>> 16 & 255] << 16 ^\n sbox[temp >>> 8 & 255] << 8 ^\n sbox[temp & 255];\n }\n w[i] = w[i - Nk] ^ temp;\n }\n\n /* When we are updating a cipher block we always use the code path for\n encryption whether we are decrypting or not (to shorten code and\n simplify the generation of look up tables). However, because there\n are differences in the decryption algorithm, other than just swapping\n in different look up tables, we must transform our key schedule to\n account for these changes:\n\n 1. The decryption algorithm gets its key rounds in reverse order.\n 2. The decryption algorithm adds the round key before mixing columns\n instead of afterwards.\n\n We don't need to modify our key schedule to handle the first case,\n we can just traverse the key schedule in reverse order when decrypting.\n\n The second case requires a little work.\n\n The tables we built for performing rounds will take an input and then\n perform SubBytes() and MixColumns() or, for the decrypt version,\n InvSubBytes() and InvMixColumns(). But the decrypt algorithm requires\n us to AddRoundKey() before InvMixColumns(). This means we'll need to\n apply some transformations to the round key to inverse-mix its columns\n so they'll be correct for moving AddRoundKey() to after the state has\n had its columns inverse-mixed.\n\n To inverse-mix the columns of the state when we're decrypting we use a\n lookup table that will apply InvSubBytes() and InvMixColumns() at the\n same time. However, the round key's bytes are not inverse-substituted\n in the decryption algorithm. To get around this problem, we can first\n substitute the bytes in the round key so that when we apply the\n transformation via the InvSubBytes()+InvMixColumns() table, it will\n undo our substitution leaving us with the original value that we\n want -- and then inverse-mix that value.\n\n This change will correctly alter our key schedule so that we can XOR\n each round key with our already transformed decryption state. This\n allows us to use the same code path as the encryption algorithm.\n\n We make one more change to the decryption key. Since the decryption\n algorithm runs in reverse from the encryption algorithm, we reverse\n the order of the round keys to avoid having to iterate over the key\n schedule backwards when running the encryption algorithm later in\n decryption mode. In addition to reversing the order of the round keys,\n we also swap each round key's 2nd and 4th rows. See the comments\n section where rounds are performed for more details about why this is\n done. These changes are done inline with the other substitution\n described above.\n */\n if(decrypt) {\n var tmp;\n var m0 = imix[0];\n var m1 = imix[1];\n var m2 = imix[2];\n var m3 = imix[3];\n var wnew = w.slice(0);\n end = w.length;\n for(var i = 0, wi = end - Nb; i < end; i += Nb, wi -= Nb) {\n // do not sub the first or last round key (round keys are Nb\n // words) as no column mixing is performed before they are added,\n // but do change the key order\n if(i === 0 || i === (end - Nb)) {\n wnew[i] = w[wi];\n wnew[i + 1] = w[wi + 3];\n wnew[i + 2] = w[wi + 2];\n wnew[i + 3] = w[wi + 1];\n } else {\n // substitute each round key byte because the inverse-mix\n // table will inverse-substitute it (effectively cancel the\n // substitution because round key bytes aren't sub'd in\n // decryption mode) and swap indexes 3 and 1\n for(var n = 0; n < Nb; ++n) {\n tmp = w[wi + n];\n wnew[i + (3&-n)] =\n m0[sbox[tmp >>> 24]] ^\n m1[sbox[tmp >>> 16 & 255]] ^\n m2[sbox[tmp >>> 8 & 255]] ^\n m3[sbox[tmp & 255]];\n }\n }\n }\n w = wnew;\n }\n\n return w;\n}\n\n/**\n * Updates a single block (16 bytes) using AES. The update will either\n * encrypt or decrypt the block.\n *\n * @param w the key schedule.\n * @param input the input block (an array of 32-bit words).\n * @param output the updated output block.\n * @param decrypt true to decrypt the block, false to encrypt it.\n */\nfunction _updateBlock(w, input, output, decrypt) {\n /*\n Cipher(byte in[4*Nb], byte out[4*Nb], word w[Nb*(Nr+1)])\n begin\n byte state[4,Nb]\n state = in\n AddRoundKey(state, w[0, Nb-1])\n for round = 1 step 1 to Nr-1\n SubBytes(state)\n ShiftRows(state)\n MixColumns(state)\n AddRoundKey(state, w[round*Nb, (round+1)*Nb-1])\n end for\n SubBytes(state)\n ShiftRows(state)\n AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])\n out = state\n end\n\n InvCipher(byte in[4*Nb], byte out[4*Nb], word w[Nb*(Nr+1)])\n begin\n byte state[4,Nb]\n state = in\n AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])\n for round = Nr-1 step -1 downto 1\n InvShiftRows(state)\n InvSubBytes(state)\n AddRoundKey(state, w[round*Nb, (round+1)*Nb-1])\n InvMixColumns(state)\n end for\n InvShiftRows(state)\n InvSubBytes(state)\n AddRoundKey(state, w[0, Nb-1])\n out = state\n end\n */\n\n // Encrypt: AddRoundKey(state, w[0, Nb-1])\n // Decrypt: AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])\n var Nr = w.length / 4 - 1;\n var m0, m1, m2, m3, sub;\n if(decrypt) {\n m0 = imix[0];\n m1 = imix[1];\n m2 = imix[2];\n m3 = imix[3];\n sub = isbox;\n } else {\n m0 = mix[0];\n m1 = mix[1];\n m2 = mix[2];\n m3 = mix[3];\n sub = sbox;\n }\n var a, b, c, d, a2, b2, c2;\n a = input[0] ^ w[0];\n b = input[decrypt ? 3 : 1] ^ w[1];\n c = input[2] ^ w[2];\n d = input[decrypt ? 1 : 3] ^ w[3];\n var i = 3;\n\n /* In order to share code we follow the encryption algorithm when both\n encrypting and decrypting. To account for the changes required in the\n decryption algorithm, we use different lookup tables when decrypting\n and use a modified key schedule to account for the difference in the\n order of transformations applied when performing rounds. We also get\n key rounds in reverse order (relative to encryption). */\n for(var round = 1; round < Nr; ++round) {\n /* As described above, we'll be using table lookups to perform the\n column mixing. Each column is stored as a word in the state (the\n array 'input' has one column as a word at each index). In order to\n mix a column, we perform these transformations on each row in c,\n which is 1 byte in each word. The new column for c0 is c'0:\n\n m0 m1 m2 m3\n r0,c'0 = 2*r0,c0 + 3*r1,c0 + 1*r2,c0 + 1*r3,c0\n r1,c'0 = 1*r0,c0 + 2*r1,c0 + 3*r2,c0 + 1*r3,c0\n r2,c'0 = 1*r0,c0 + 1*r1,c0 + 2*r2,c0 + 3*r3,c0\n r3,c'0 = 3*r0,c0 + 1*r1,c0 + 1*r2,c0 + 2*r3,c0\n\n So using mix tables where c0 is a word with r0 being its upper\n 8 bits and r3 being its lower 8 bits:\n\n m0[c0 >> 24] will yield this word: [2*r0,1*r0,1*r0,3*r0]\n ...\n m3[c0 & 255] will yield this word: [1*r3,1*r3,3*r3,2*r3]\n\n Therefore to mix the columns in each word in the state we\n do the following (& 255 omitted for brevity):\n c'0,r0 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3]\n c'0,r1 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3]\n c'0,r2 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3]\n c'0,r3 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3]\n\n However, before mixing, the algorithm requires us to perform\n ShiftRows(). The ShiftRows() transformation cyclically shifts the\n last 3 rows of the state over different offsets. The first row\n (r = 0) is not shifted.\n\n s'_r,c = s_r,(c + shift(r, Nb) mod Nb\n for 0 < r < 4 and 0 <= c < Nb and\n shift(1, 4) = 1\n shift(2, 4) = 2\n shift(3, 4) = 3.\n\n This causes the first byte in r = 1 to be moved to the end of\n the row, the first 2 bytes in r = 2 to be moved to the end of\n the row, the first 3 bytes in r = 3 to be moved to the end of\n the row:\n\n r1: [c0 c1 c2 c3] => [c1 c2 c3 c0]\n r2: [c0 c1 c2 c3] [c2 c3 c0 c1]\n r3: [c0 c1 c2 c3] [c3 c0 c1 c2]\n\n We can make these substitutions inline with our column mixing to\n generate an updated set of equations to produce each word in the\n state (note the columns have changed positions):\n\n c0 c1 c2 c3 => c0 c1 c2 c3\n c0 c1 c2 c3 c1 c2 c3 c0 (cycled 1 byte)\n c0 c1 c2 c3 c2 c3 c0 c1 (cycled 2 bytes)\n c0 c1 c2 c3 c3 c0 c1 c2 (cycled 3 bytes)\n\n Therefore:\n\n c'0 = 2*r0,c0 + 3*r1,c1 + 1*r2,c2 + 1*r3,c3\n c'0 = 1*r0,c0 + 2*r1,c1 + 3*r2,c2 + 1*r3,c3\n c'0 = 1*r0,c0 + 1*r1,c1 + 2*r2,c2 + 3*r3,c3\n c'0 = 3*r0,c0 + 1*r1,c1 + 1*r2,c2 + 2*r3,c3\n\n c'1 = 2*r0,c1 + 3*r1,c2 + 1*r2,c3 + 1*r3,c0\n c'1 = 1*r0,c1 + 2*r1,c2 + 3*r2,c3 + 1*r3,c0\n c'1 = 1*r0,c1 + 1*r1,c2 + 2*r2,c3 + 3*r3,c0\n c'1 = 3*r0,c1 + 1*r1,c2 + 1*r2,c3 + 2*r3,c0\n\n ... and so forth for c'2 and c'3. The important distinction is\n that the columns are cycling, with c0 being used with the m0\n map when calculating c0, but c1 being used with the m0 map when\n calculating c1 ... and so forth.\n\n When performing the inverse we transform the mirror image and\n skip the bottom row, instead of the top one, and move upwards:\n\n c3 c2 c1 c0 => c0 c3 c2 c1 (cycled 3 bytes) *same as encryption\n c3 c2 c1 c0 c1 c0 c3 c2 (cycled 2 bytes)\n c3 c2 c1 c0 c2 c1 c0 c3 (cycled 1 byte) *same as encryption\n c3 c2 c1 c0 c3 c2 c1 c0\n\n If you compare the resulting matrices for ShiftRows()+MixColumns()\n and for InvShiftRows()+InvMixColumns() the 2nd and 4th columns are\n different (in encrypt mode vs. decrypt mode). So in order to use\n the same code to handle both encryption and decryption, we will\n need to do some mapping.\n\n If in encryption mode we let a=c0, b=c1, c=c2, d=c3, and r<N> be\n a row number in the state, then the resulting matrix in encryption\n mode for applying the above transformations would be:\n\n r1: a b c d\n r2: b c d a\n r3: c d a b\n r4: d a b c\n\n If we did the same in decryption mode we would get:\n\n r1: a d c b\n r2: b a d c\n r3: c b a d\n r4: d c b a\n\n If instead we swap d and b (set b=c3 and d=c1), then we get:\n\n r1: a b c d\n r2: d a b c\n r3: c d a b\n r4: b c d a\n\n Now the 1st and 3rd rows are the same as the encryption matrix. All\n we need to do then to make the mapping exactly the same is to swap\n the 2nd and 4th rows when in decryption mode. To do this without\n having to do it on each iteration, we swapped the 2nd and 4th rows\n in the decryption key schedule. We also have to do the swap above\n when we first pull in the input and when we set the final output. */\n a2 =\n m0[a >>> 24] ^\n m1[b >>> 16 & 255] ^\n m2[c >>> 8 & 255] ^\n m3[d & 255] ^ w[++i];\n b2 =\n m0[b >>> 24] ^\n m1[c >>> 16 & 255] ^\n m2[d >>> 8 & 255] ^\n m3[a & 255] ^ w[++i];\n c2 =\n m0[c >>> 24] ^\n m1[d >>> 16 & 255] ^\n m2[a >>> 8 & 255] ^\n m3[b & 255] ^ w[++i];\n d =\n m0[d >>> 24] ^\n m1[a >>> 16 & 255] ^\n m2[b >>> 8 & 255] ^\n m3[c & 255] ^ w[++i];\n a = a2;\n b = b2;\n c = c2;\n }\n\n /*\n Encrypt:\n SubBytes(state)\n ShiftRows(state)\n AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])\n\n Decrypt:\n InvShiftRows(state)\n InvSubBytes(state)\n AddRoundKey(state, w[0, Nb-1])\n */\n // Note: rows are shifted inline\n output[0] =\n (sub[a >>> 24] << 24) ^\n (sub[b >>> 16 & 255] << 16) ^\n (sub[c >>> 8 & 255] << 8) ^\n (sub[d & 255]) ^ w[++i];\n output[decrypt ? 3 : 1] =\n (sub[b >>> 24] << 24) ^\n (sub[c >>> 16 & 255] << 16) ^\n (sub[d >>> 8 & 255] << 8) ^\n (sub[a & 255]) ^ w[++i];\n output[2] =\n (sub[c >>> 24] << 24) ^\n (sub[d >>> 16 & 255] << 16) ^\n (sub[a >>> 8 & 255] << 8) ^\n (sub[b & 255]) ^ w[++i];\n output[decrypt ? 1 : 3] =\n (sub[d >>> 24] << 24) ^\n (sub[a >>> 16 & 255] << 16) ^\n (sub[b >>> 8 & 255] << 8) ^\n (sub[c & 255]) ^ w[++i];\n}\n\n/**\n * Deprecated. Instead, use:\n *\n * forge.cipher.createCipher('AES-<mode>', key);\n * forge.cipher.createDecipher('AES-<mode>', key);\n *\n * Creates a deprecated AES cipher object. This object's mode will default to\n * CBC (cipher-block-chaining).\n *\n * The key and iv may be given as a string of bytes, an array of bytes, a\n * byte buffer, or an array of 32-bit words.\n *\n * @param options the options to use.\n * key the symmetric key to use.\n * output the buffer to write to.\n * decrypt true for decryption, false for encryption.\n * mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nfunction _createCipher(options) {\n options = options || {};\n var mode = (options.mode || 'CBC').toUpperCase();\n var algorithm = 'AES-' + mode;\n\n var cipher;\n if(options.decrypt) {\n cipher = forge.cipher.createDecipher(algorithm, options.key);\n } else {\n cipher = forge.cipher.createCipher(algorithm, options.key);\n }\n\n // backwards compatible start API\n var start = cipher.start;\n cipher.start = function(iv, options) {\n // backwards compatibility: support second arg as output buffer\n var output = null;\n if(options instanceof forge.util.ByteBuffer) {\n output = options;\n options = {};\n }\n options = options || {};\n options.output = output;\n options.iv = iv;\n start.call(cipher, options);\n };\n\n return cipher;\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/aes.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/asn1.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/asn1.js ***!
|
||
\*********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Javascript implementation of Abstract Syntax Notation Number One.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2015 Digital Bazaar, Inc.\n *\n * An API for storing data using the Abstract Syntax Notation Number One\n * format using DER (Distinguished Encoding Rules) encoding. This encoding is\n * commonly used to store data for PKI, i.e. X.509 Certificates, and this\n * implementation exists for that purpose.\n *\n * Abstract Syntax Notation Number One (ASN.1) is used to define the abstract\n * syntax of information without restricting the way the information is encoded\n * for transmission. It provides a standard that allows for open systems\n * communication. ASN.1 defines the syntax of information data and a number of\n * simple data types as well as a notation for describing them and specifying\n * values for them.\n *\n * The RSA algorithm creates public and private keys that are often stored in\n * X.509 or PKCS#X formats -- which use ASN.1 (encoded in DER format). This\n * class provides the most basic functionality required to store and load DSA\n * keys that are encoded according to ASN.1.\n *\n * The most common binary encodings for ASN.1 are BER (Basic Encoding Rules)\n * and DER (Distinguished Encoding Rules). DER is just a subset of BER that\n * has stricter requirements for how data must be encoded.\n *\n * Each ASN.1 structure has a tag (a byte identifying the ASN.1 structure type)\n * and a byte array for the value of this ASN1 structure which may be data or a\n * list of ASN.1 structures.\n *\n * Each ASN.1 structure using BER is (Tag-Length-Value):\n *\n * | byte 0 | bytes X | bytes Y |\n * |--------|---------|----------\n * | tag | length | value |\n *\n * ASN.1 allows for tags to be of \"High-tag-number form\" which allows a tag to\n * be two or more octets, but that is not supported by this class. A tag is\n * only 1 byte. Bits 1-5 give the tag number (ie the data type within a\n * particular 'class'), 6 indicates whether or not the ASN.1 value is\n * constructed from other ASN.1 values, and bits 7 and 8 give the 'class'. If\n * bits 7 and 8 are both zero, the class is UNIVERSAL. If only bit 7 is set,\n * then the class is APPLICATION. If only bit 8 is set, then the class is\n * CONTEXT_SPECIFIC. If both bits 7 and 8 are set, then the class is PRIVATE.\n * The tag numbers for the data types for the class UNIVERSAL are listed below:\n *\n * UNIVERSAL 0 Reserved for use by the encoding rules\n * UNIVERSAL 1 Boolean type\n * UNIVERSAL 2 Integer type\n * UNIVERSAL 3 Bitstring type\n * UNIVERSAL 4 Octetstring type\n * UNIVERSAL 5 Null type\n * UNIVERSAL 6 Object identifier type\n * UNIVERSAL 7 Object descriptor type\n * UNIVERSAL 8 External type and Instance-of type\n * UNIVERSAL 9 Real type\n * UNIVERSAL 10 Enumerated type\n * UNIVERSAL 11 Embedded-pdv type\n * UNIVERSAL 12 UTF8String type\n * UNIVERSAL 13 Relative object identifier type\n * UNIVERSAL 14-15 Reserved for future editions\n * UNIVERSAL 16 Sequence and Sequence-of types\n * UNIVERSAL 17 Set and Set-of types\n * UNIVERSAL 18-22, 25-30 Character string types\n * UNIVERSAL 23-24 Time types\n *\n * The length of an ASN.1 structure is specified after the tag identifier.\n * There is a definite form and an indefinite form. The indefinite form may\n * be used if the encoding is constructed and not all immediately available.\n * The indefinite form is encoded using a length byte with only the 8th bit\n * set. The end of the constructed object is marked using end-of-contents\n * octets (two zero bytes).\n *\n * The definite form looks like this:\n *\n * The length may take up 1 or more bytes, it depends on the length of the\n * value of the ASN.1 structure. DER encoding requires that if the ASN.1\n * structure has a value that has a length greater than 127, more than 1 byte\n * will be used to store its length, otherwise just one byte will be used.\n * This is strict.\n *\n * In the case that the length of the ASN.1 value is less than 127, 1 octet\n * (byte) is used to store the \"short form\" length. The 8th bit has a value of\n * 0 indicating the length is \"short form\" and not \"long form\" and bits 7-1\n * give the length of the data. (The 8th bit is the left-most, most significant\n * bit: also known as big endian or network format).\n *\n * In the case that the length of the ASN.1 value is greater than 127, 2 to\n * 127 octets (bytes) are used to store the \"long form\" length. The first\n * byte's 8th bit is set to 1 to indicate the length is \"long form.\" Bits 7-1\n * give the number of additional octets. All following octets are in base 256\n * with the most significant digit first (typical big-endian binary unsigned\n * integer storage). So, for instance, if the length of a value was 257, the\n * first byte would be set to:\n *\n * 10000010 = 130 = 0x82.\n *\n * This indicates there are 2 octets (base 256) for the length. The second and\n * third bytes (the octets just mentioned) would store the length in base 256:\n *\n * octet 2: 00000001 = 1 * 256^1 = 256\n * octet 3: 00000001 = 1 * 256^0 = 1\n * total = 257\n *\n * The algorithm for converting a js integer value of 257 to base-256 is:\n *\n * var value = 257;\n * var bytes = [];\n * bytes[0] = (value >>> 8) & 0xFF; // most significant byte first\n * bytes[1] = value & 0xFF; // least significant byte last\n *\n * On the ASN.1 UNIVERSAL Object Identifier (OID) type:\n *\n * An OID can be written like: \"value1.value2.value3...valueN\"\n *\n * The DER encoding rules:\n *\n * The first byte has the value 40 * value1 + value2.\n * The following bytes, if any, encode the remaining values. Each value is\n * encoded in base 128, most significant digit first (big endian), with as\n * few digits as possible, and the most significant bit of each byte set\n * to 1 except the last in each value's encoding. For example: Given the\n * OID \"1.2.840.113549\", its DER encoding is (remember each byte except the\n * last one in each encoding is OR'd with 0x80):\n *\n * byte 1: 40 * 1 + 2 = 42 = 0x2A.\n * bytes 2-3: 128 * 6 + 72 = 840 = 6 72 = 6 72 = 0x0648 = 0x8648\n * bytes 4-6: 16384 * 6 + 128 * 119 + 13 = 6 119 13 = 0x06770D = 0x86F70D\n *\n * The final value is: 0x2A864886F70D.\n * The full OID (including ASN.1 tag and length of 6 bytes) is:\n * 0x06062A864886F70D\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n__webpack_require__(/*! ./oids */ \"./node_modules/node-forge/lib/oids.js\");\n\n/* ASN.1 API */\nvar asn1 = module.exports = forge.asn1 = forge.asn1 || {};\n\n/**\n * ASN.1 classes.\n */\nasn1.Class = {\n UNIVERSAL: 0x00,\n APPLICATION: 0x40,\n CONTEXT_SPECIFIC: 0x80,\n PRIVATE: 0xC0\n};\n\n/**\n * ASN.1 types. Not all types are supported by this implementation, only\n * those necessary to implement a simple PKI are implemented.\n */\nasn1.Type = {\n NONE: 0,\n BOOLEAN: 1,\n INTEGER: 2,\n BITSTRING: 3,\n OCTETSTRING: 4,\n NULL: 5,\n OID: 6,\n ODESC: 7,\n EXTERNAL: 8,\n REAL: 9,\n ENUMERATED: 10,\n EMBEDDED: 11,\n UTF8: 12,\n ROID: 13,\n SEQUENCE: 16,\n SET: 17,\n PRINTABLESTRING: 19,\n IA5STRING: 22,\n UTCTIME: 23,\n GENERALIZEDTIME: 24,\n BMPSTRING: 30\n};\n\n/**\n * Creates a new asn1 object.\n *\n * @param tagClass the tag class for the object.\n * @param type the data type (tag number) for the object.\n * @param constructed true if the asn1 object is in constructed form.\n * @param value the value for the object, if it is not constructed.\n * @param [options] the options to use:\n * [bitStringContents] the plain BIT STRING content including padding\n * byte.\n *\n * @return the asn1 object.\n */\nasn1.create = function(tagClass, type, constructed, value, options) {\n /* An asn1 object has a tagClass, a type, a constructed flag, and a\n value. The value's type depends on the constructed flag. If\n constructed, it will contain a list of other asn1 objects. If not,\n it will contain the ASN.1 value as an array of bytes formatted\n according to the ASN.1 data type. */\n\n // remove undefined values\n if(forge.util.isArray(value)) {\n var tmp = [];\n for(var i = 0; i < value.length; ++i) {\n if(value[i] !== undefined) {\n tmp.push(value[i]);\n }\n }\n value = tmp;\n }\n\n var obj = {\n tagClass: tagClass,\n type: type,\n constructed: constructed,\n composed: constructed || forge.util.isArray(value),\n value: value\n };\n if(options && 'bitStringContents' in options) {\n // TODO: copy byte buffer if it's a buffer not a string\n obj.bitStringContents = options.bitStringContents;\n // TODO: add readonly flag to avoid this overhead\n // save copy to detect changes\n obj.original = asn1.copy(obj);\n }\n return obj;\n};\n\n/**\n * Copies an asn1 object.\n *\n * @param obj the asn1 object.\n * @param [options] copy options:\n * [excludeBitStringContents] true to not copy bitStringContents\n *\n * @return the a copy of the asn1 object.\n */\nasn1.copy = function(obj, options) {\n var copy;\n\n if(forge.util.isArray(obj)) {\n copy = [];\n for(var i = 0; i < obj.length; ++i) {\n copy.push(asn1.copy(obj[i], options));\n }\n return copy;\n }\n\n if(typeof obj === 'string') {\n // TODO: copy byte buffer if it's a buffer not a string\n return obj;\n }\n\n copy = {\n tagClass: obj.tagClass,\n type: obj.type,\n constructed: obj.constructed,\n composed: obj.composed,\n value: asn1.copy(obj.value, options)\n };\n if(options && !options.excludeBitStringContents) {\n // TODO: copy byte buffer if it's a buffer not a string\n copy.bitStringContents = obj.bitStringContents;\n }\n return copy;\n};\n\n/**\n * Compares asn1 objects for equality.\n *\n * Note this function does not run in constant time.\n *\n * @param obj1 the first asn1 object.\n * @param obj2 the second asn1 object.\n * @param [options] compare options:\n * [includeBitStringContents] true to compare bitStringContents\n *\n * @return true if the asn1 objects are equal.\n */\nasn1.equals = function(obj1, obj2, options) {\n if(forge.util.isArray(obj1)) {\n if(!forge.util.isArray(obj2)) {\n return false;\n }\n if(obj1.length !== obj2.length) {\n return false;\n }\n for(var i = 0; i < obj1.length; ++i) {\n if(!asn1.equals(obj1[i], obj2[i])) {\n return false;\n }\n }\n return true;\n }\n\n if(typeof obj1 !== typeof obj2) {\n return false;\n }\n\n if(typeof obj1 === 'string') {\n return obj1 === obj2;\n }\n\n var equal = obj1.tagClass === obj2.tagClass &&\n obj1.type === obj2.type &&\n obj1.constructed === obj2.constructed &&\n obj1.composed === obj2.composed &&\n asn1.equals(obj1.value, obj2.value);\n if(options && options.includeBitStringContents) {\n equal = equal && (obj1.bitStringContents === obj2.bitStringContents);\n }\n\n return equal;\n};\n\n/**\n * Gets the length of a BER-encoded ASN.1 value.\n *\n * In case the length is not specified, undefined is returned.\n *\n * @param b the BER-encoded ASN.1 byte buffer, starting with the first\n * length byte.\n *\n * @return the length of the BER-encoded ASN.1 value or undefined.\n */\nasn1.getBerValueLength = function(b) {\n // TODO: move this function and related DER/BER functions to a der.js\n // file; better abstract ASN.1 away from der/ber.\n var b2 = b.getByte();\n if(b2 === 0x80) {\n return undefined;\n }\n\n // see if the length is \"short form\" or \"long form\" (bit 8 set)\n var length;\n var longForm = b2 & 0x80;\n if(!longForm) {\n // length is just the first byte\n length = b2;\n } else {\n // the number of bytes the length is specified in bits 7 through 1\n // and each length byte is in big-endian base-256\n length = b.getInt((b2 & 0x7F) << 3);\n }\n return length;\n};\n\n/**\n * Check if the byte buffer has enough bytes. Throws an Error if not.\n *\n * @param bytes the byte buffer to parse from.\n * @param remaining the bytes remaining in the current parsing state.\n * @param n the number of bytes the buffer must have.\n */\nfunction _checkBufferLength(bytes, remaining, n) {\n if(n > remaining) {\n var error = new Error('Too few bytes to parse DER.');\n error.available = bytes.length();\n error.remaining = remaining;\n error.requested = n;\n throw error;\n }\n}\n\n/**\n * Gets the length of a BER-encoded ASN.1 value.\n *\n * In case the length is not specified, undefined is returned.\n *\n * @param bytes the byte buffer to parse from.\n * @param remaining the bytes remaining in the current parsing state.\n *\n * @return the length of the BER-encoded ASN.1 value or undefined.\n */\nvar _getValueLength = function(bytes, remaining) {\n // TODO: move this function and related DER/BER functions to a der.js\n // file; better abstract ASN.1 away from der/ber.\n // fromDer already checked that this byte exists\n var b2 = bytes.getByte();\n remaining--;\n if(b2 === 0x80) {\n return undefined;\n }\n\n // see if the length is \"short form\" or \"long form\" (bit 8 set)\n var length;\n var longForm = b2 & 0x80;\n if(!longForm) {\n // length is just the first byte\n length = b2;\n } else {\n // the number of bytes the length is specified in bits 7 through 1\n // and each length byte is in big-endian base-256\n var longFormBytes = b2 & 0x7F;\n _checkBufferLength(bytes, remaining, longFormBytes);\n length = bytes.getInt(longFormBytes << 3);\n }\n // FIXME: this will only happen for 32 bit getInt with high bit set\n if(length < 0) {\n throw new Error('Negative length: ' + length);\n }\n return length;\n};\n\n/**\n * Parses an asn1 object from a byte buffer in DER format.\n *\n * @param bytes the byte buffer to parse from.\n * @param [strict] true to be strict when checking value lengths, false to\n * allow truncated values (default: true).\n * @param [options] object with options or boolean strict flag\n * [strict] true to be strict when checking value lengths, false to\n * allow truncated values (default: true).\n * [parseAllBytes] true to ensure all bytes are parsed\n * (default: true)\n * [decodeBitStrings] true to attempt to decode the content of\n * BIT STRINGs (not OCTET STRINGs) using strict mode. Note that\n * without schema support to understand the data context this can\n * erroneously decode values that happen to be valid ASN.1. This\n * flag will be deprecated or removed as soon as schema support is\n * available. (default: true)\n *\n * @throws Will throw an error for various malformed input conditions.\n *\n * @return the parsed asn1 object.\n */\nasn1.fromDer = function(bytes, options) {\n if(options === undefined) {\n options = {\n strict: true,\n parseAllBytes: true,\n decodeBitStrings: true\n };\n }\n if(typeof options === 'boolean') {\n options = {\n strict: options,\n parseAllBytes: true,\n decodeBitStrings: true\n };\n }\n if(!('strict' in options)) {\n options.strict = true;\n }\n if(!('parseAllBytes' in options)) {\n options.parseAllBytes = true;\n }\n if(!('decodeBitStrings' in options)) {\n options.decodeBitStrings = true;\n }\n\n // wrap in buffer if needed\n if(typeof bytes === 'string') {\n bytes = forge.util.createBuffer(bytes);\n }\n\n var byteCount = bytes.length();\n var value = _fromDer(bytes, bytes.length(), 0, options);\n if(options.parseAllBytes && bytes.length() !== 0) {\n var error = new Error('Unparsed DER bytes remain after ASN.1 parsing.');\n error.byteCount = byteCount;\n error.remaining = bytes.length();\n throw error;\n }\n return value;\n};\n\n/**\n * Internal function to parse an asn1 object from a byte buffer in DER format.\n *\n * @param bytes the byte buffer to parse from.\n * @param remaining the number of bytes remaining for this chunk.\n * @param depth the current parsing depth.\n * @param options object with same options as fromDer().\n *\n * @return the parsed asn1 object.\n */\nfunction _fromDer(bytes, remaining, depth, options) {\n // temporary storage for consumption calculations\n var start;\n\n // minimum length for ASN.1 DER structure is 2\n _checkBufferLength(bytes, remaining, 2);\n\n // get the first byte\n var b1 = bytes.getByte();\n // consumed one byte\n remaining--;\n\n // get the tag class\n var tagClass = (b1 & 0xC0);\n\n // get the type (bits 1-5)\n var type = b1 & 0x1F;\n\n // get the variable value length and adjust remaining bytes\n start = bytes.length();\n var length = _getValueLength(bytes, remaining);\n remaining -= start - bytes.length();\n\n // ensure there are enough bytes to get the value\n if(length !== undefined && length > remaining) {\n if(options.strict) {\n var error = new Error('Too few bytes to read ASN.1 value.');\n error.available = bytes.length();\n error.remaining = remaining;\n error.requested = length;\n throw error;\n }\n // Note: be lenient with truncated values and use remaining state bytes\n length = remaining;\n }\n\n // value storage\n var value;\n // possible BIT STRING contents storage\n var bitStringContents;\n\n // constructed flag is bit 6 (32 = 0x20) of the first byte\n var constructed = ((b1 & 0x20) === 0x20);\n if(constructed) {\n // parse child asn1 objects from the value\n value = [];\n if(length === undefined) {\n // asn1 object of indefinite length, read until end tag\n for(;;) {\n _checkBufferLength(bytes, remaining, 2);\n if(bytes.bytes(2) === String.fromCharCode(0, 0)) {\n bytes.getBytes(2);\n remaining -= 2;\n break;\n }\n start = bytes.length();\n value.push(_fromDer(bytes, remaining, depth + 1, options));\n remaining -= start - bytes.length();\n }\n } else {\n // parsing asn1 object of definite length\n while(length > 0) {\n start = bytes.length();\n value.push(_fromDer(bytes, length, depth + 1, options));\n remaining -= start - bytes.length();\n length -= start - bytes.length();\n }\n }\n }\n\n // if a BIT STRING, save the contents including padding\n if(value === undefined && tagClass === asn1.Class.UNIVERSAL &&\n type === asn1.Type.BITSTRING) {\n bitStringContents = bytes.bytes(length);\n }\n\n // determine if a non-constructed value should be decoded as a composed\n // value that contains other ASN.1 objects. BIT STRINGs (and OCTET STRINGs)\n // can be used this way.\n if(value === undefined && options.decodeBitStrings &&\n tagClass === asn1.Class.UNIVERSAL &&\n // FIXME: OCTET STRINGs not yet supported here\n // .. other parts of forge expect to decode OCTET STRINGs manually\n (type === asn1.Type.BITSTRING /*|| type === asn1.Type.OCTETSTRING*/) &&\n length > 1) {\n // save read position\n var savedRead = bytes.read;\n var savedRemaining = remaining;\n var unused = 0;\n if(type === asn1.Type.BITSTRING) {\n /* The first octet gives the number of bits by which the length of the\n bit string is less than the next multiple of eight (this is called\n the \"number of unused bits\").\n\n The second and following octets give the value of the bit string\n converted to an octet string. */\n _checkBufferLength(bytes, remaining, 1);\n unused = bytes.getByte();\n remaining--;\n }\n // if all bits are used, maybe the BIT/OCTET STRING holds ASN.1 objs\n if(unused === 0) {\n try {\n // attempt to parse child asn1 object from the value\n // (stored in array to signal composed value)\n start = bytes.length();\n var subOptions = {\n // enforce strict mode to avoid parsing ASN.1 from plain data\n strict: true,\n decodeBitStrings: true\n };\n var composed = _fromDer(bytes, remaining, depth + 1, subOptions);\n var used = start - bytes.length();\n remaining -= used;\n if(type == asn1.Type.BITSTRING) {\n used++;\n }\n\n // if the data all decoded and the class indicates UNIVERSAL or\n // CONTEXT_SPECIFIC then assume we've got an encapsulated ASN.1 object\n var tc = composed.tagClass;\n if(used === length &&\n (tc === asn1.Class.UNIVERSAL || tc === asn1.Class.CONTEXT_SPECIFIC)) {\n value = [composed];\n }\n } catch(ex) {\n }\n }\n if(value === undefined) {\n // restore read position\n bytes.read = savedRead;\n remaining = savedRemaining;\n }\n }\n\n if(value === undefined) {\n // asn1 not constructed or composed, get raw value\n // TODO: do DER to OID conversion and vice-versa in .toDer?\n\n if(length === undefined) {\n if(options.strict) {\n throw new Error('Non-constructed ASN.1 object of indefinite length.');\n }\n // be lenient and use remaining state bytes\n length = remaining;\n }\n\n if(type === asn1.Type.BMPSTRING) {\n value = '';\n for(; length > 0; length -= 2) {\n _checkBufferLength(bytes, remaining, 2);\n value += String.fromCharCode(bytes.getInt16());\n remaining -= 2;\n }\n } else {\n value = bytes.getBytes(length);\n remaining -= length;\n }\n }\n\n // add BIT STRING contents if available\n var asn1Options = bitStringContents === undefined ? null : {\n bitStringContents: bitStringContents\n };\n\n // create and return asn1 object\n return asn1.create(tagClass, type, constructed, value, asn1Options);\n}\n\n/**\n * Converts the given asn1 object to a buffer of bytes in DER format.\n *\n * @param asn1 the asn1 object to convert to bytes.\n *\n * @return the buffer of bytes.\n */\nasn1.toDer = function(obj) {\n var bytes = forge.util.createBuffer();\n\n // build the first byte\n var b1 = obj.tagClass | obj.type;\n\n // for storing the ASN.1 value\n var value = forge.util.createBuffer();\n\n // use BIT STRING contents if available and data not changed\n var useBitStringContents = false;\n if('bitStringContents' in obj) {\n useBitStringContents = true;\n if(obj.original) {\n useBitStringContents = asn1.equals(obj, obj.original);\n }\n }\n\n if(useBitStringContents) {\n value.putBytes(obj.bitStringContents);\n } else if(obj.composed) {\n // if composed, use each child asn1 object's DER bytes as value\n // turn on 6th bit (0x20 = 32) to indicate asn1 is constructed\n // from other asn1 objects\n if(obj.constructed) {\n b1 |= 0x20;\n } else {\n // type is a bit string, add unused bits of 0x00\n value.putByte(0x00);\n }\n\n // add all of the child DER bytes together\n for(var i = 0; i < obj.value.length; ++i) {\n if(obj.value[i] !== undefined) {\n value.putBuffer(asn1.toDer(obj.value[i]));\n }\n }\n } else {\n // use asn1.value directly\n if(obj.type === asn1.Type.BMPSTRING) {\n for(var i = 0; i < obj.value.length; ++i) {\n value.putInt16(obj.value.charCodeAt(i));\n }\n } else {\n // ensure integer is minimally-encoded\n // TODO: should all leading bytes be stripped vs just one?\n // .. ex '00 00 01' => '01'?\n if(obj.type === asn1.Type.INTEGER &&\n obj.value.length > 1 &&\n // leading 0x00 for positive integer\n ((obj.value.charCodeAt(0) === 0 &&\n (obj.value.charCodeAt(1) & 0x80) === 0) ||\n // leading 0xFF for negative integer\n (obj.value.charCodeAt(0) === 0xFF &&\n (obj.value.charCodeAt(1) & 0x80) === 0x80))) {\n value.putBytes(obj.value.substr(1));\n } else {\n value.putBytes(obj.value);\n }\n }\n }\n\n // add tag byte\n bytes.putByte(b1);\n\n // use \"short form\" encoding\n if(value.length() <= 127) {\n // one byte describes the length\n // bit 8 = 0 and bits 7-1 = length\n bytes.putByte(value.length() & 0x7F);\n } else {\n // use \"long form\" encoding\n // 2 to 127 bytes describe the length\n // first byte: bit 8 = 1 and bits 7-1 = # of additional bytes\n // other bytes: length in base 256, big-endian\n var len = value.length();\n var lenBytes = '';\n do {\n lenBytes += String.fromCharCode(len & 0xFF);\n len = len >>> 8;\n } while(len > 0);\n\n // set first byte to # bytes used to store the length and turn on\n // bit 8 to indicate long-form length is used\n bytes.putByte(lenBytes.length | 0x80);\n\n // concatenate length bytes in reverse since they were generated\n // little endian and we need big endian\n for(var i = lenBytes.length - 1; i >= 0; --i) {\n bytes.putByte(lenBytes.charCodeAt(i));\n }\n }\n\n // concatenate value bytes\n bytes.putBuffer(value);\n return bytes;\n};\n\n/**\n * Converts an OID dot-separated string to a byte buffer. The byte buffer\n * contains only the DER-encoded value, not any tag or length bytes.\n *\n * @param oid the OID dot-separated string.\n *\n * @return the byte buffer.\n */\nasn1.oidToDer = function(oid) {\n // split OID into individual values\n var values = oid.split('.');\n var bytes = forge.util.createBuffer();\n\n // first byte is 40 * value1 + value2\n bytes.putByte(40 * parseInt(values[0], 10) + parseInt(values[1], 10));\n // other bytes are each value in base 128 with 8th bit set except for\n // the last byte for each value\n var last, valueBytes, value, b;\n for(var i = 2; i < values.length; ++i) {\n // produce value bytes in reverse because we don't know how many\n // bytes it will take to store the value\n last = true;\n valueBytes = [];\n value = parseInt(values[i], 10);\n do {\n b = value & 0x7F;\n value = value >>> 7;\n // if value is not last, then turn on 8th bit\n if(!last) {\n b |= 0x80;\n }\n valueBytes.push(b);\n last = false;\n } while(value > 0);\n\n // add value bytes in reverse (needs to be in big endian)\n for(var n = valueBytes.length - 1; n >= 0; --n) {\n bytes.putByte(valueBytes[n]);\n }\n }\n\n return bytes;\n};\n\n/**\n * Converts a DER-encoded byte buffer to an OID dot-separated string. The\n * byte buffer should contain only the DER-encoded value, not any tag or\n * length bytes.\n *\n * @param bytes the byte buffer.\n *\n * @return the OID dot-separated string.\n */\nasn1.derToOid = function(bytes) {\n var oid;\n\n // wrap in buffer if needed\n if(typeof bytes === 'string') {\n bytes = forge.util.createBuffer(bytes);\n }\n\n // first byte is 40 * value1 + value2\n var b = bytes.getByte();\n oid = Math.floor(b / 40) + '.' + (b % 40);\n\n // other bytes are each value in base 128 with 8th bit set except for\n // the last byte for each value\n var value = 0;\n while(bytes.length() > 0) {\n b = bytes.getByte();\n value = value << 7;\n // not the last byte for the value\n if(b & 0x80) {\n value += b & 0x7F;\n } else {\n // last byte\n oid += '.' + (value + b);\n value = 0;\n }\n }\n\n return oid;\n};\n\n/**\n * Converts a UTCTime value to a date.\n *\n * Note: GeneralizedTime has 4 digits for the year and is used for X.509\n * dates past 2049. Parsing that structure hasn't been implemented yet.\n *\n * @param utc the UTCTime value to convert.\n *\n * @return the date.\n */\nasn1.utcTimeToDate = function(utc) {\n /* The following formats can be used:\n\n YYMMDDhhmmZ\n YYMMDDhhmm+hh'mm'\n YYMMDDhhmm-hh'mm'\n YYMMDDhhmmssZ\n YYMMDDhhmmss+hh'mm'\n YYMMDDhhmmss-hh'mm'\n\n Where:\n\n YY is the least significant two digits of the year\n MM is the month (01 to 12)\n DD is the day (01 to 31)\n hh is the hour (00 to 23)\n mm are the minutes (00 to 59)\n ss are the seconds (00 to 59)\n Z indicates that local time is GMT, + indicates that local time is\n later than GMT, and - indicates that local time is earlier than GMT\n hh' is the absolute value of the offset from GMT in hours\n mm' is the absolute value of the offset from GMT in minutes */\n var date = new Date();\n\n // if YY >= 50 use 19xx, if YY < 50 use 20xx\n var year = parseInt(utc.substr(0, 2), 10);\n year = (year >= 50) ? 1900 + year : 2000 + year;\n var MM = parseInt(utc.substr(2, 2), 10) - 1; // use 0-11 for month\n var DD = parseInt(utc.substr(4, 2), 10);\n var hh = parseInt(utc.substr(6, 2), 10);\n var mm = parseInt(utc.substr(8, 2), 10);\n var ss = 0;\n\n // not just YYMMDDhhmmZ\n if(utc.length > 11) {\n // get character after minutes\n var c = utc.charAt(10);\n var end = 10;\n\n // see if seconds are present\n if(c !== '+' && c !== '-') {\n // get seconds\n ss = parseInt(utc.substr(10, 2), 10);\n end += 2;\n }\n }\n\n // update date\n date.setUTCFullYear(year, MM, DD);\n date.setUTCHours(hh, mm, ss, 0);\n\n if(end) {\n // get +/- after end of time\n c = utc.charAt(end);\n if(c === '+' || c === '-') {\n // get hours+minutes offset\n var hhoffset = parseInt(utc.substr(end + 1, 2), 10);\n var mmoffset = parseInt(utc.substr(end + 4, 2), 10);\n\n // calculate offset in milliseconds\n var offset = hhoffset * 60 + mmoffset;\n offset *= 60000;\n\n // apply offset\n if(c === '+') {\n date.setTime(+date - offset);\n } else {\n date.setTime(+date + offset);\n }\n }\n }\n\n return date;\n};\n\n/**\n * Converts a GeneralizedTime value to a date.\n *\n * @param gentime the GeneralizedTime value to convert.\n *\n * @return the date.\n */\nasn1.generalizedTimeToDate = function(gentime) {\n /* The following formats can be used:\n\n YYYYMMDDHHMMSS\n YYYYMMDDHHMMSS.fff\n YYYYMMDDHHMMSSZ\n YYYYMMDDHHMMSS.fffZ\n YYYYMMDDHHMMSS+hh'mm'\n YYYYMMDDHHMMSS.fff+hh'mm'\n YYYYMMDDHHMMSS-hh'mm'\n YYYYMMDDHHMMSS.fff-hh'mm'\n\n Where:\n\n YYYY is the year\n MM is the month (01 to 12)\n DD is the day (01 to 31)\n hh is the hour (00 to 23)\n mm are the minutes (00 to 59)\n ss are the seconds (00 to 59)\n .fff is the second fraction, accurate to three decimal places\n Z indicates that local time is GMT, + indicates that local time is\n later than GMT, and - indicates that local time is earlier than GMT\n hh' is the absolute value of the offset from GMT in hours\n mm' is the absolute value of the offset from GMT in minutes */\n var date = new Date();\n\n var YYYY = parseInt(gentime.substr(0, 4), 10);\n var MM = parseInt(gentime.substr(4, 2), 10) - 1; // use 0-11 for month\n var DD = parseInt(gentime.substr(6, 2), 10);\n var hh = parseInt(gentime.substr(8, 2), 10);\n var mm = parseInt(gentime.substr(10, 2), 10);\n var ss = parseInt(gentime.substr(12, 2), 10);\n var fff = 0;\n var offset = 0;\n var isUTC = false;\n\n if(gentime.charAt(gentime.length - 1) === 'Z') {\n isUTC = true;\n }\n\n var end = gentime.length - 5, c = gentime.charAt(end);\n if(c === '+' || c === '-') {\n // get hours+minutes offset\n var hhoffset = parseInt(gentime.substr(end + 1, 2), 10);\n var mmoffset = parseInt(gentime.substr(end + 4, 2), 10);\n\n // calculate offset in milliseconds\n offset = hhoffset * 60 + mmoffset;\n offset *= 60000;\n\n // apply offset\n if(c === '+') {\n offset *= -1;\n }\n\n isUTC = true;\n }\n\n // check for second fraction\n if(gentime.charAt(14) === '.') {\n fff = parseFloat(gentime.substr(14), 10) * 1000;\n }\n\n if(isUTC) {\n date.setUTCFullYear(YYYY, MM, DD);\n date.setUTCHours(hh, mm, ss, fff);\n\n // apply offset\n date.setTime(+date + offset);\n } else {\n date.setFullYear(YYYY, MM, DD);\n date.setHours(hh, mm, ss, fff);\n }\n\n return date;\n};\n\n/**\n * Converts a date to a UTCTime value.\n *\n * Note: GeneralizedTime has 4 digits for the year and is used for X.509\n * dates past 2049. Converting to a GeneralizedTime hasn't been\n * implemented yet.\n *\n * @param date the date to convert.\n *\n * @return the UTCTime value.\n */\nasn1.dateToUtcTime = function(date) {\n // TODO: validate; currently assumes proper format\n if(typeof date === 'string') {\n return date;\n }\n\n var rval = '';\n\n // create format YYMMDDhhmmssZ\n var format = [];\n format.push(('' + date.getUTCFullYear()).substr(2));\n format.push('' + (date.getUTCMonth() + 1));\n format.push('' + date.getUTCDate());\n format.push('' + date.getUTCHours());\n format.push('' + date.getUTCMinutes());\n format.push('' + date.getUTCSeconds());\n\n // ensure 2 digits are used for each format entry\n for(var i = 0; i < format.length; ++i) {\n if(format[i].length < 2) {\n rval += '0';\n }\n rval += format[i];\n }\n rval += 'Z';\n\n return rval;\n};\n\n/**\n * Converts a date to a GeneralizedTime value.\n *\n * @param date the date to convert.\n *\n * @return the GeneralizedTime value as a string.\n */\nasn1.dateToGeneralizedTime = function(date) {\n // TODO: validate; currently assumes proper format\n if(typeof date === 'string') {\n return date;\n }\n\n var rval = '';\n\n // create format YYYYMMDDHHMMSSZ\n var format = [];\n format.push('' + date.getUTCFullYear());\n format.push('' + (date.getUTCMonth() + 1));\n format.push('' + date.getUTCDate());\n format.push('' + date.getUTCHours());\n format.push('' + date.getUTCMinutes());\n format.push('' + date.getUTCSeconds());\n\n // ensure 2 digits are used for each format entry\n for(var i = 0; i < format.length; ++i) {\n if(format[i].length < 2) {\n rval += '0';\n }\n rval += format[i];\n }\n rval += 'Z';\n\n return rval;\n};\n\n/**\n * Converts a javascript integer to a DER-encoded byte buffer to be used\n * as the value for an INTEGER type.\n *\n * @param x the integer.\n *\n * @return the byte buffer.\n */\nasn1.integerToDer = function(x) {\n var rval = forge.util.createBuffer();\n if(x >= -0x80 && x < 0x80) {\n return rval.putSignedInt(x, 8);\n }\n if(x >= -0x8000 && x < 0x8000) {\n return rval.putSignedInt(x, 16);\n }\n if(x >= -0x800000 && x < 0x800000) {\n return rval.putSignedInt(x, 24);\n }\n if(x >= -0x80000000 && x < 0x80000000) {\n return rval.putSignedInt(x, 32);\n }\n var error = new Error('Integer too large; max is 32-bits.');\n error.integer = x;\n throw error;\n};\n\n/**\n * Converts a DER-encoded byte buffer to a javascript integer. This is\n * typically used to decode the value of an INTEGER type.\n *\n * @param bytes the byte buffer.\n *\n * @return the integer.\n */\nasn1.derToInteger = function(bytes) {\n // wrap in buffer if needed\n if(typeof bytes === 'string') {\n bytes = forge.util.createBuffer(bytes);\n }\n\n var n = bytes.length() * 8;\n if(n > 32) {\n throw new Error('Integer too large; max is 32-bits.');\n }\n return bytes.getSignedInt(n);\n};\n\n/**\n * Validates that the given ASN.1 object is at least a super set of the\n * given ASN.1 structure. Only tag classes and types are checked. An\n * optional map may also be provided to capture ASN.1 values while the\n * structure is checked.\n *\n * To capture an ASN.1 value, set an object in the validator's 'capture'\n * parameter to the key to use in the capture map. To capture the full\n * ASN.1 object, specify 'captureAsn1'. To capture BIT STRING bytes, including\n * the leading unused bits counter byte, specify 'captureBitStringContents'.\n * To capture BIT STRING bytes, without the leading unused bits counter byte,\n * specify 'captureBitStringValue'.\n *\n * Objects in the validator may set a field 'optional' to true to indicate\n * that it isn't necessary to pass validation.\n *\n * @param obj the ASN.1 object to validate.\n * @param v the ASN.1 structure validator.\n * @param capture an optional map to capture values in.\n * @param errors an optional array for storing validation errors.\n *\n * @return true on success, false on failure.\n */\nasn1.validate = function(obj, v, capture, errors) {\n var rval = false;\n\n // ensure tag class and type are the same if specified\n if((obj.tagClass === v.tagClass || typeof(v.tagClass) === 'undefined') &&\n (obj.type === v.type || typeof(v.type) === 'undefined')) {\n // ensure constructed flag is the same if specified\n if(obj.constructed === v.constructed ||\n typeof(v.constructed) === 'undefined') {\n rval = true;\n\n // handle sub values\n if(v.value && forge.util.isArray(v.value)) {\n var j = 0;\n for(var i = 0; rval && i < v.value.length; ++i) {\n rval = v.value[i].optional || false;\n if(obj.value[j]) {\n rval = asn1.validate(obj.value[j], v.value[i], capture, errors);\n if(rval) {\n ++j;\n } else if(v.value[i].optional) {\n rval = true;\n }\n }\n if(!rval && errors) {\n errors.push(\n '[' + v.name + '] ' +\n 'Tag class \"' + v.tagClass + '\", type \"' +\n v.type + '\" expected value length \"' +\n v.value.length + '\", got \"' +\n obj.value.length + '\"');\n }\n }\n }\n\n if(rval && capture) {\n if(v.capture) {\n capture[v.capture] = obj.value;\n }\n if(v.captureAsn1) {\n capture[v.captureAsn1] = obj;\n }\n if(v.captureBitStringContents && 'bitStringContents' in obj) {\n capture[v.captureBitStringContents] = obj.bitStringContents;\n }\n if(v.captureBitStringValue && 'bitStringContents' in obj) {\n var value;\n if(obj.bitStringContents.length < 2) {\n capture[v.captureBitStringValue] = '';\n } else {\n // FIXME: support unused bits with data shifting\n var unused = obj.bitStringContents.charCodeAt(0);\n if(unused !== 0) {\n throw new Error(\n 'captureBitStringValue only supported for zero unused bits');\n }\n capture[v.captureBitStringValue] = obj.bitStringContents.slice(1);\n }\n }\n }\n } else if(errors) {\n errors.push(\n '[' + v.name + '] ' +\n 'Expected constructed \"' + v.constructed + '\", got \"' +\n obj.constructed + '\"');\n }\n } else if(errors) {\n if(obj.tagClass !== v.tagClass) {\n errors.push(\n '[' + v.name + '] ' +\n 'Expected tag class \"' + v.tagClass + '\", got \"' +\n obj.tagClass + '\"');\n }\n if(obj.type !== v.type) {\n errors.push(\n '[' + v.name + '] ' +\n 'Expected type \"' + v.type + '\", got \"' + obj.type + '\"');\n }\n }\n return rval;\n};\n\n// regex for testing for non-latin characters\nvar _nonLatinRegex = /[^\\\\u0000-\\\\u00ff]/;\n\n/**\n * Pretty prints an ASN.1 object to a string.\n *\n * @param obj the object to write out.\n * @param level the level in the tree.\n * @param indentation the indentation to use.\n *\n * @return the string.\n */\nasn1.prettyPrint = function(obj, level, indentation) {\n var rval = '';\n\n // set default level and indentation\n level = level || 0;\n indentation = indentation || 2;\n\n // start new line for deep levels\n if(level > 0) {\n rval += '\\n';\n }\n\n // create indent\n var indent = '';\n for(var i = 0; i < level * indentation; ++i) {\n indent += ' ';\n }\n\n // print class:type\n rval += indent + 'Tag: ';\n switch(obj.tagClass) {\n case asn1.Class.UNIVERSAL:\n rval += 'Universal:';\n break;\n case asn1.Class.APPLICATION:\n rval += 'Application:';\n break;\n case asn1.Class.CONTEXT_SPECIFIC:\n rval += 'Context-Specific:';\n break;\n case asn1.Class.PRIVATE:\n rval += 'Private:';\n break;\n }\n\n if(obj.tagClass === asn1.Class.UNIVERSAL) {\n rval += obj.type;\n\n // known types\n switch(obj.type) {\n case asn1.Type.NONE:\n rval += ' (None)';\n break;\n case asn1.Type.BOOLEAN:\n rval += ' (Boolean)';\n break;\n case asn1.Type.INTEGER:\n rval += ' (Integer)';\n break;\n case asn1.Type.BITSTRING:\n rval += ' (Bit string)';\n break;\n case asn1.Type.OCTETSTRING:\n rval += ' (Octet string)';\n break;\n case asn1.Type.NULL:\n rval += ' (Null)';\n break;\n case asn1.Type.OID:\n rval += ' (Object Identifier)';\n break;\n case asn1.Type.ODESC:\n rval += ' (Object Descriptor)';\n break;\n case asn1.Type.EXTERNAL:\n rval += ' (External or Instance of)';\n break;\n case asn1.Type.REAL:\n rval += ' (Real)';\n break;\n case asn1.Type.ENUMERATED:\n rval += ' (Enumerated)';\n break;\n case asn1.Type.EMBEDDED:\n rval += ' (Embedded PDV)';\n break;\n case asn1.Type.UTF8:\n rval += ' (UTF8)';\n break;\n case asn1.Type.ROID:\n rval += ' (Relative Object Identifier)';\n break;\n case asn1.Type.SEQUENCE:\n rval += ' (Sequence)';\n break;\n case asn1.Type.SET:\n rval += ' (Set)';\n break;\n case asn1.Type.PRINTABLESTRING:\n rval += ' (Printable String)';\n break;\n case asn1.Type.IA5String:\n rval += ' (IA5String (ASCII))';\n break;\n case asn1.Type.UTCTIME:\n rval += ' (UTC time)';\n break;\n case asn1.Type.GENERALIZEDTIME:\n rval += ' (Generalized time)';\n break;\n case asn1.Type.BMPSTRING:\n rval += ' (BMP String)';\n break;\n }\n } else {\n rval += obj.type;\n }\n\n rval += '\\n';\n rval += indent + 'Constructed: ' + obj.constructed + '\\n';\n\n if(obj.composed) {\n var subvalues = 0;\n var sub = '';\n for(var i = 0; i < obj.value.length; ++i) {\n if(obj.value[i] !== undefined) {\n subvalues += 1;\n sub += asn1.prettyPrint(obj.value[i], level + 1, indentation);\n if((i + 1) < obj.value.length) {\n sub += ',';\n }\n }\n }\n rval += indent + 'Sub values: ' + subvalues + sub;\n } else {\n rval += indent + 'Value: ';\n if(obj.type === asn1.Type.OID) {\n var oid = asn1.derToOid(obj.value);\n rval += oid;\n if(forge.pki && forge.pki.oids) {\n if(oid in forge.pki.oids) {\n rval += ' (' + forge.pki.oids[oid] + ') ';\n }\n }\n }\n if(obj.type === asn1.Type.INTEGER) {\n try {\n rval += asn1.derToInteger(obj.value);\n } catch(ex) {\n rval += '0x' + forge.util.bytesToHex(obj.value);\n }\n } else if(obj.type === asn1.Type.BITSTRING) {\n // TODO: shift bits as needed to display without padding\n if(obj.value.length > 1) {\n // remove unused bits field\n rval += '0x' + forge.util.bytesToHex(obj.value.slice(1));\n } else {\n rval += '(none)';\n }\n // show unused bit count\n if(obj.value.length > 0) {\n var unused = obj.value.charCodeAt(0);\n if(unused == 1) {\n rval += ' (1 unused bit shown)';\n } else if(unused > 1) {\n rval += ' (' + unused + ' unused bits shown)';\n }\n }\n } else if(obj.type === asn1.Type.OCTETSTRING) {\n if(!_nonLatinRegex.test(obj.value)) {\n rval += '(' + obj.value + ') ';\n }\n rval += '0x' + forge.util.bytesToHex(obj.value);\n } else if(obj.type === asn1.Type.UTF8) {\n try {\n rval += forge.util.decodeUtf8(obj.value);\n } catch(e) {\n if(e.message === 'URI malformed') {\n rval +=\n '0x' + forge.util.bytesToHex(obj.value) + ' (malformed UTF8)';\n } else {\n throw e;\n }\n }\n } else if(obj.type === asn1.Type.PRINTABLESTRING ||\n obj.type === asn1.Type.IA5String) {\n rval += obj.value;\n } else if(_nonLatinRegex.test(obj.value)) {\n rval += '0x' + forge.util.bytesToHex(obj.value);\n } else if(obj.value.length === 0) {\n rval += '[null]';\n } else {\n rval += obj.value;\n }\n }\n\n return rval;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/asn1.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/baseN.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/baseN.js ***!
|
||
\**********************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("/**\n * Base-N/Base-X encoding/decoding functions.\n *\n * Original implementation from base-x:\n * https://github.com/cryptocoinjs/base-x\n *\n * Which is MIT licensed:\n *\n * The MIT License (MIT)\n *\n * Copyright base-x contributors (c) 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nvar api = {};\nmodule.exports = api;\n\n// baseN alphabet indexes\nvar _reverseAlphabets = {};\n\n/**\n * BaseN-encodes a Uint8Array using the given alphabet.\n *\n * @param input the Uint8Array to encode.\n * @param maxline the maximum number of encoded characters per line to use,\n * defaults to none.\n *\n * @return the baseN-encoded output string.\n */\napi.encode = function(input, alphabet, maxline) {\n if(typeof alphabet !== 'string') {\n throw new TypeError('\"alphabet\" must be a string.');\n }\n if(maxline !== undefined && typeof maxline !== 'number') {\n throw new TypeError('\"maxline\" must be a number.');\n }\n\n var output = '';\n\n if(!(input instanceof Uint8Array)) {\n // assume forge byte buffer\n output = _encodeWithByteBuffer(input, alphabet);\n } else {\n var i = 0;\n var base = alphabet.length;\n var first = alphabet.charAt(0);\n var digits = [0];\n for(i = 0; i < input.length; ++i) {\n for(var j = 0, carry = input[i]; j < digits.length; ++j) {\n carry += digits[j] << 8;\n digits[j] = carry % base;\n carry = (carry / base) | 0;\n }\n\n while(carry > 0) {\n digits.push(carry % base);\n carry = (carry / base) | 0;\n }\n }\n\n // deal with leading zeros\n for(i = 0; input[i] === 0 && i < input.length - 1; ++i) {\n output += first;\n }\n // convert digits to a string\n for(i = digits.length - 1; i >= 0; --i) {\n output += alphabet[digits[i]];\n }\n }\n\n if(maxline) {\n var regex = new RegExp('.{1,' + maxline + '}', 'g');\n output = output.match(regex).join('\\r\\n');\n }\n\n return output;\n};\n\n/**\n * Decodes a baseN-encoded (using the given alphabet) string to a\n * Uint8Array.\n *\n * @param input the baseN-encoded input string.\n *\n * @return the Uint8Array.\n */\napi.decode = function(input, alphabet) {\n if(typeof input !== 'string') {\n throw new TypeError('\"input\" must be a string.');\n }\n if(typeof alphabet !== 'string') {\n throw new TypeError('\"alphabet\" must be a string.');\n }\n\n var table = _reverseAlphabets[alphabet];\n if(!table) {\n // compute reverse alphabet\n table = _reverseAlphabets[alphabet] = [];\n for(var i = 0; i < alphabet.length; ++i) {\n table[alphabet.charCodeAt(i)] = i;\n }\n }\n\n // remove whitespace characters\n input = input.replace(/\\s/g, '');\n\n var base = alphabet.length;\n var first = alphabet.charAt(0);\n var bytes = [0];\n for(var i = 0; i < input.length; i++) {\n var value = table[input.charCodeAt(i)];\n if(value === undefined) {\n return;\n }\n\n for(var j = 0, carry = value; j < bytes.length; ++j) {\n carry += bytes[j] * base;\n bytes[j] = carry & 0xff;\n carry >>= 8;\n }\n\n while(carry > 0) {\n bytes.push(carry & 0xff);\n carry >>= 8;\n }\n }\n\n // deal with leading zeros\n for(var k = 0; input[k] === first && k < input.length - 1; ++k) {\n bytes.push(0);\n }\n\n if(typeof Buffer !== 'undefined') {\n return Buffer.from(bytes.reverse());\n }\n\n return new Uint8Array(bytes.reverse());\n};\n\nfunction _encodeWithByteBuffer(input, alphabet) {\n var i = 0;\n var base = alphabet.length;\n var first = alphabet.charAt(0);\n var digits = [0];\n for(i = 0; i < input.length(); ++i) {\n for(var j = 0, carry = input.at(i); j < digits.length; ++j) {\n carry += digits[j] << 8;\n digits[j] = carry % base;\n carry = (carry / base) | 0;\n }\n\n while(carry > 0) {\n digits.push(carry % base);\n carry = (carry / base) | 0;\n }\n }\n\n var output = '';\n\n // deal with leading zeros\n for(i = 0; input.at(i) === 0 && i < input.length() - 1; ++i) {\n output += first;\n }\n // convert digits to a string\n for(i = digits.length - 1; i >= 0; --i) {\n output += alphabet[digits[i]];\n }\n\n return output;\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/baseN.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/cipher.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/cipher.js ***!
|
||
\***********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Cipher base API.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nmodule.exports = forge.cipher = forge.cipher || {};\n\n// registered algorithms\nforge.cipher.algorithms = forge.cipher.algorithms || {};\n\n/**\n * Creates a cipher object that can be used to encrypt data using the given\n * algorithm and key. The algorithm may be provided as a string value for a\n * previously registered algorithm or it may be given as a cipher algorithm\n * API object.\n *\n * @param algorithm the algorithm to use, either a string or an algorithm API\n * object.\n * @param key the key to use, as a binary-encoded string of bytes or a\n * byte buffer.\n *\n * @return the cipher.\n */\nforge.cipher.createCipher = function(algorithm, key) {\n var api = algorithm;\n if(typeof api === 'string') {\n api = forge.cipher.getAlgorithm(api);\n if(api) {\n api = api();\n }\n }\n if(!api) {\n throw new Error('Unsupported algorithm: ' + algorithm);\n }\n\n // assume block cipher\n return new forge.cipher.BlockCipher({\n algorithm: api,\n key: key,\n decrypt: false\n });\n};\n\n/**\n * Creates a decipher object that can be used to decrypt data using the given\n * algorithm and key. The algorithm may be provided as a string value for a\n * previously registered algorithm or it may be given as a cipher algorithm\n * API object.\n *\n * @param algorithm the algorithm to use, either a string or an algorithm API\n * object.\n * @param key the key to use, as a binary-encoded string of bytes or a\n * byte buffer.\n *\n * @return the cipher.\n */\nforge.cipher.createDecipher = function(algorithm, key) {\n var api = algorithm;\n if(typeof api === 'string') {\n api = forge.cipher.getAlgorithm(api);\n if(api) {\n api = api();\n }\n }\n if(!api) {\n throw new Error('Unsupported algorithm: ' + algorithm);\n }\n\n // assume block cipher\n return new forge.cipher.BlockCipher({\n algorithm: api,\n key: key,\n decrypt: true\n });\n};\n\n/**\n * Registers an algorithm by name. If the name was already registered, the\n * algorithm API object will be overwritten.\n *\n * @param name the name of the algorithm.\n * @param algorithm the algorithm API object.\n */\nforge.cipher.registerAlgorithm = function(name, algorithm) {\n name = name.toUpperCase();\n forge.cipher.algorithms[name] = algorithm;\n};\n\n/**\n * Gets a registered algorithm by name.\n *\n * @param name the name of the algorithm.\n *\n * @return the algorithm, if found, null if not.\n */\nforge.cipher.getAlgorithm = function(name) {\n name = name.toUpperCase();\n if(name in forge.cipher.algorithms) {\n return forge.cipher.algorithms[name];\n }\n return null;\n};\n\nvar BlockCipher = forge.cipher.BlockCipher = function(options) {\n this.algorithm = options.algorithm;\n this.mode = this.algorithm.mode;\n this.blockSize = this.mode.blockSize;\n this._finish = false;\n this._input = null;\n this.output = null;\n this._op = options.decrypt ? this.mode.decrypt : this.mode.encrypt;\n this._decrypt = options.decrypt;\n this.algorithm.initialize(options);\n};\n\n/**\n * Starts or restarts the encryption or decryption process, whichever\n * was previously configured.\n *\n * For non-GCM mode, the IV may be a binary-encoded string of bytes, an array\n * of bytes, a byte buffer, or an array of 32-bit integers. If the IV is in\n * bytes, then it must be Nb (16) bytes in length. If the IV is given in as\n * 32-bit integers, then it must be 4 integers long.\n *\n * Note: an IV is not required or used in ECB mode.\n *\n * For GCM-mode, the IV must be given as a binary-encoded string of bytes or\n * a byte buffer. The number of bytes should be 12 (96 bits) as recommended\n * by NIST SP-800-38D but another length may be given.\n *\n * @param options the options to use:\n * iv the initialization vector to use as a binary-encoded string of\n * bytes, null to reuse the last ciphered block from a previous\n * update() (this \"residue\" method is for legacy support only).\n * additionalData additional authentication data as a binary-encoded\n * string of bytes, for 'GCM' mode, (default: none).\n * tagLength desired length of authentication tag, in bits, for\n * 'GCM' mode (0-128, default: 128).\n * tag the authentication tag to check if decrypting, as a\n * binary-encoded string of bytes.\n * output the output the buffer to write to, null to create one.\n */\nBlockCipher.prototype.start = function(options) {\n options = options || {};\n var opts = {};\n for(var key in options) {\n opts[key] = options[key];\n }\n opts.decrypt = this._decrypt;\n this._finish = false;\n this._input = forge.util.createBuffer();\n this.output = options.output || forge.util.createBuffer();\n this.mode.start(opts);\n};\n\n/**\n * Updates the next block according to the cipher mode.\n *\n * @param input the buffer to read from.\n */\nBlockCipher.prototype.update = function(input) {\n if(input) {\n // input given, so empty it into the input buffer\n this._input.putBuffer(input);\n }\n\n // do cipher operation until it needs more input and not finished\n while(!this._op.call(this.mode, this._input, this.output, this._finish) &&\n !this._finish) {}\n\n // free consumed memory from input buffer\n this._input.compact();\n};\n\n/**\n * Finishes encrypting or decrypting.\n *\n * @param pad a padding function to use in CBC mode, null for default,\n * signature(blockSize, buffer, decrypt).\n *\n * @return true if successful, false on error.\n */\nBlockCipher.prototype.finish = function(pad) {\n // backwards-compatibility w/deprecated padding API\n // Note: will overwrite padding functions even after another start() call\n if(pad && (this.mode.name === 'ECB' || this.mode.name === 'CBC')) {\n this.mode.pad = function(input) {\n return pad(this.blockSize, input, false);\n };\n this.mode.unpad = function(output) {\n return pad(this.blockSize, output, true);\n };\n }\n\n // build options for padding and afterFinish functions\n var options = {};\n options.decrypt = this._decrypt;\n\n // get # of bytes that won't fill a block\n options.overflow = this._input.length() % this.blockSize;\n\n if(!this._decrypt && this.mode.pad) {\n if(!this.mode.pad(this._input, options)) {\n return false;\n }\n }\n\n // do final update\n this._finish = true;\n this.update();\n\n if(this._decrypt && this.mode.unpad) {\n if(!this.mode.unpad(this.output, options)) {\n return false;\n }\n }\n\n if(this.mode.afterFinish) {\n if(!this.mode.afterFinish(this.output, options)) {\n return false;\n }\n }\n\n return true;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/cipher.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/cipherModes.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/node-forge/lib/cipherModes.js ***!
|
||
\****************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Supported cipher modes.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nforge.cipher = forge.cipher || {};\n\n// supported cipher modes\nvar modes = module.exports = forge.cipher.modes = forge.cipher.modes || {};\n\n/** Electronic codebook (ECB) (Don't use this; it's not secure) **/\n\nmodes.ecb = function(options) {\n options = options || {};\n this.name = 'ECB';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = new Array(this._ints);\n this._outBlock = new Array(this._ints);\n};\n\nmodes.ecb.prototype.start = function(options) {};\n\nmodes.ecb.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // write output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i]);\n }\n};\n\nmodes.ecb.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n }\n\n // decrypt block\n this.cipher.decrypt(this._inBlock, this._outBlock);\n\n // write output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i]);\n }\n};\n\nmodes.ecb.prototype.pad = function(input, options) {\n // add PKCS#7 padding to block (each pad byte is the\n // value of the number of pad bytes)\n var padding = (input.length() === this.blockSize ?\n this.blockSize : (this.blockSize - input.length()));\n input.fillWithByte(padding, padding);\n return true;\n};\n\nmodes.ecb.prototype.unpad = function(output, options) {\n // check for error: input data not a multiple of blockSize\n if(options.overflow > 0) {\n return false;\n }\n\n // ensure padding byte count is valid\n var len = output.length();\n var count = output.at(len - 1);\n if(count > (this.blockSize << 2)) {\n return false;\n }\n\n // trim off padding bytes\n output.truncate(count);\n return true;\n};\n\n/** Cipher-block Chaining (CBC) **/\n\nmodes.cbc = function(options) {\n options = options || {};\n this.name = 'CBC';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = new Array(this._ints);\n this._outBlock = new Array(this._ints);\n};\n\nmodes.cbc.prototype.start = function(options) {\n // Note: legacy support for using IV residue (has security flaws)\n // if IV is null, reuse block from previous processing\n if(options.iv === null) {\n // must have a previous block\n if(!this._prev) {\n throw new Error('Invalid IV parameter.');\n }\n this._iv = this._prev.slice(0);\n } else if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n } else {\n // save IV as \"previous\" block\n this._iv = transformIV(options.iv, this.blockSize);\n this._prev = this._iv.slice(0);\n }\n};\n\nmodes.cbc.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n // CBC XOR's IV (or previous block) with plaintext\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._prev[i] ^ input.getInt32();\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // write output, save previous block\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i]);\n }\n this._prev = this._outBlock;\n};\n\nmodes.cbc.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n }\n\n // decrypt block\n this.cipher.decrypt(this._inBlock, this._outBlock);\n\n // write output, save previous ciphered block\n // CBC XOR's IV (or previous block) with ciphertext\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._prev[i] ^ this._outBlock[i]);\n }\n this._prev = this._inBlock.slice(0);\n};\n\nmodes.cbc.prototype.pad = function(input, options) {\n // add PKCS#7 padding to block (each pad byte is the\n // value of the number of pad bytes)\n var padding = (input.length() === this.blockSize ?\n this.blockSize : (this.blockSize - input.length()));\n input.fillWithByte(padding, padding);\n return true;\n};\n\nmodes.cbc.prototype.unpad = function(output, options) {\n // check for error: input data not a multiple of blockSize\n if(options.overflow > 0) {\n return false;\n }\n\n // ensure padding byte count is valid\n var len = output.length();\n var count = output.at(len - 1);\n if(count > (this.blockSize << 2)) {\n return false;\n }\n\n // trim off padding bytes\n output.truncate(count);\n return true;\n};\n\n/** Cipher feedback (CFB) **/\n\nmodes.cfb = function(options) {\n options = options || {};\n this.name = 'CFB';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = null;\n this._outBlock = new Array(this._ints);\n this._partialBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n};\n\nmodes.cfb.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // use IV as first input\n this._iv = transformIV(options.iv, this.blockSize);\n this._inBlock = this._iv.slice(0);\n this._partialBytes = 0;\n};\n\nmodes.cfb.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output, write input as output\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32() ^ this._outBlock[i];\n output.putInt32(this._inBlock[i]);\n }\n return;\n }\n\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output, write input as partial output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialBlock[i] = input.getInt32() ^ this._outBlock[i];\n this._partialOutput.putInt32(this._partialBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n } else {\n // block complete, update input block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._partialBlock[i];\n }\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n};\n\nmodes.cfb.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block (CFB always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output, write input as output\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n output.putInt32(this._inBlock[i] ^ this._outBlock[i]);\n }\n return;\n }\n\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output, write input as partial output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialBlock[i] = input.getInt32();\n this._partialOutput.putInt32(this._partialBlock[i] ^ this._outBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n } else {\n // block complete, update input block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._partialBlock[i];\n }\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n};\n\n/** Output feedback (OFB) **/\n\nmodes.ofb = function(options) {\n options = options || {};\n this.name = 'OFB';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = null;\n this._outBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n};\n\nmodes.ofb.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // use IV as first input\n this._iv = transformIV(options.iv, this.blockSize);\n this._inBlock = this._iv.slice(0);\n this._partialBytes = 0;\n};\n\nmodes.ofb.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(input.length() === 0) {\n return true;\n }\n\n // encrypt block (OFB always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output and update next input\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(input.getInt32() ^ this._outBlock[i]);\n this._inBlock[i] = this._outBlock[i];\n }\n return;\n }\n\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n } else {\n // block complete, update input block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._outBlock[i];\n }\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n};\n\nmodes.ofb.prototype.decrypt = modes.ofb.prototype.encrypt;\n\n/** Counter (CTR) **/\n\nmodes.ctr = function(options) {\n options = options || {};\n this.name = 'CTR';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = null;\n this._outBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n};\n\nmodes.ctr.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // use IV as first input\n this._iv = transformIV(options.iv, this.blockSize);\n this._inBlock = this._iv.slice(0);\n this._partialBytes = 0;\n};\n\nmodes.ctr.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block (CTR always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n } else {\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n }\n\n // block complete, increment counter (input block)\n inc32(this._inBlock);\n};\n\nmodes.ctr.prototype.decrypt = modes.ctr.prototype.encrypt;\n\n/** Galois/Counter Mode (GCM) **/\n\nmodes.gcm = function(options) {\n options = options || {};\n this.name = 'GCM';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = new Array(this._ints);\n this._outBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n\n // R is actually this value concatenated with 120 more zero bits, but\n // we only XOR against R so the other zeros have no effect -- we just\n // apply this value to the first integer in a block\n this._R = 0xE1000000;\n};\n\nmodes.gcm.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // ensure IV is a byte buffer\n var iv = forge.util.createBuffer(options.iv);\n\n // no ciphered data processed yet\n this._cipherLength = 0;\n\n // default additional data is none\n var additionalData;\n if('additionalData' in options) {\n additionalData = forge.util.createBuffer(options.additionalData);\n } else {\n additionalData = forge.util.createBuffer();\n }\n\n // default tag length is 128 bits\n if('tagLength' in options) {\n this._tagLength = options.tagLength;\n } else {\n this._tagLength = 128;\n }\n\n // if tag is given, ensure tag matches tag length\n this._tag = null;\n if(options.decrypt) {\n // save tag to check later\n this._tag = forge.util.createBuffer(options.tag).getBytes();\n if(this._tag.length !== (this._tagLength / 8)) {\n throw new Error('Authentication tag does not match tag length.');\n }\n }\n\n // create tmp storage for hash calculation\n this._hashBlock = new Array(this._ints);\n\n // no tag generated yet\n this.tag = null;\n\n // generate hash subkey\n // (apply block cipher to \"zero\" block)\n this._hashSubkey = new Array(this._ints);\n this.cipher.encrypt([0, 0, 0, 0], this._hashSubkey);\n\n // generate table M\n // use 4-bit tables (32 component decomposition of a 16 byte value)\n // 8-bit tables take more space and are known to have security\n // vulnerabilities (in native implementations)\n this.componentBits = 4;\n this._m = this.generateHashTable(this._hashSubkey, this.componentBits);\n\n // Note: support IV length different from 96 bits? (only supporting\n // 96 bits is recommended by NIST SP-800-38D)\n // generate J_0\n var ivLength = iv.length();\n if(ivLength === 12) {\n // 96-bit IV\n this._j0 = [iv.getInt32(), iv.getInt32(), iv.getInt32(), 1];\n } else {\n // IV is NOT 96-bits\n this._j0 = [0, 0, 0, 0];\n while(iv.length() > 0) {\n this._j0 = this.ghash(\n this._hashSubkey, this._j0,\n [iv.getInt32(), iv.getInt32(), iv.getInt32(), iv.getInt32()]);\n }\n this._j0 = this.ghash(\n this._hashSubkey, this._j0, [0, 0].concat(from64To32(ivLength * 8)));\n }\n\n // generate ICB (initial counter block)\n this._inBlock = this._j0.slice(0);\n inc32(this._inBlock);\n this._partialBytes = 0;\n\n // consume authentication data\n additionalData = forge.util.createBuffer(additionalData);\n // save additional data length as a BE 64-bit number\n this._aDataLength = from64To32(additionalData.length() * 8);\n // pad additional data to 128 bit (16 byte) block size\n var overflow = additionalData.length() % this.blockSize;\n if(overflow) {\n additionalData.fillWithByte(0, this.blockSize - overflow);\n }\n this._s = [0, 0, 0, 0];\n while(additionalData.length() > 0) {\n this._s = this.ghash(this._hashSubkey, this._s, [\n additionalData.getInt32(),\n additionalData.getInt32(),\n additionalData.getInt32(),\n additionalData.getInt32()\n ]);\n }\n};\n\nmodes.gcm.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i] ^= input.getInt32());\n }\n this._cipherLength += this.blockSize;\n } else {\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n\n if(partialBytes <= 0 || finish) {\n // handle overflow prior to hashing\n if(finish) {\n // get block overflow\n var overflow = inputLength % this.blockSize;\n this._cipherLength += overflow;\n // truncate for hash function\n this._partialOutput.truncate(this.blockSize - overflow);\n } else {\n this._cipherLength += this.blockSize;\n }\n\n // get output block for hashing\n for(var i = 0; i < this._ints; ++i) {\n this._outBlock[i] = this._partialOutput.getInt32();\n }\n this._partialOutput.read -= this.blockSize;\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n // block still incomplete, restore input buffer, get partial output,\n // and return early\n input.read -= this.blockSize;\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n }\n\n // update hash block S\n this._s = this.ghash(this._hashSubkey, this._s, this._outBlock);\n\n // increment counter (input block)\n inc32(this._inBlock);\n};\n\nmodes.gcm.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n var inputLength = input.length();\n if(inputLength < this.blockSize && !(finish && inputLength > 0)) {\n return true;\n }\n\n // encrypt block (GCM always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // increment counter (input block)\n inc32(this._inBlock);\n\n // update hash block S\n this._hashBlock[0] = input.getInt32();\n this._hashBlock[1] = input.getInt32();\n this._hashBlock[2] = input.getInt32();\n this._hashBlock[3] = input.getInt32();\n this._s = this.ghash(this._hashSubkey, this._s, this._hashBlock);\n\n // XOR hash input with output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i] ^ this._hashBlock[i]);\n }\n\n // increment cipher data length\n if(inputLength < this.blockSize) {\n this._cipherLength += inputLength % this.blockSize;\n } else {\n this._cipherLength += this.blockSize;\n }\n};\n\nmodes.gcm.prototype.afterFinish = function(output, options) {\n var rval = true;\n\n // handle overflow\n if(options.decrypt && options.overflow) {\n output.truncate(this.blockSize - options.overflow);\n }\n\n // handle authentication tag\n this.tag = forge.util.createBuffer();\n\n // concatenate additional data length with cipher length\n var lengths = this._aDataLength.concat(from64To32(this._cipherLength * 8));\n\n // include lengths in hash\n this._s = this.ghash(this._hashSubkey, this._s, lengths);\n\n // do GCTR(J_0, S)\n var tag = [];\n this.cipher.encrypt(this._j0, tag);\n for(var i = 0; i < this._ints; ++i) {\n this.tag.putInt32(this._s[i] ^ tag[i]);\n }\n\n // trim tag to length\n this.tag.truncate(this.tag.length() % (this._tagLength / 8));\n\n // check authentication tag\n if(options.decrypt && this.tag.bytes() !== this._tag) {\n rval = false;\n }\n\n return rval;\n};\n\n/**\n * See NIST SP-800-38D 6.3 (Algorithm 1). This function performs Galois\n * field multiplication. The field, GF(2^128), is defined by the polynomial:\n *\n * x^128 + x^7 + x^2 + x + 1\n *\n * Which is represented in little-endian binary form as: 11100001 (0xe1). When\n * the value of a coefficient is 1, a bit is set. The value R, is the\n * concatenation of this value and 120 zero bits, yielding a 128-bit value\n * which matches the block size.\n *\n * This function will multiply two elements (vectors of bytes), X and Y, in\n * the field GF(2^128). The result is initialized to zero. For each bit of\n * X (out of 128), x_i, if x_i is set, then the result is multiplied (XOR'd)\n * by the current value of Y. For each bit, the value of Y will be raised by\n * a power of x (multiplied by the polynomial x). This can be achieved by\n * shifting Y once to the right. If the current value of Y, prior to being\n * multiplied by x, has 0 as its LSB, then it is a 127th degree polynomial.\n * Otherwise, we must divide by R after shifting to find the remainder.\n *\n * @param x the first block to multiply by the second.\n * @param y the second block to multiply by the first.\n *\n * @return the block result of the multiplication.\n */\nmodes.gcm.prototype.multiply = function(x, y) {\n var z_i = [0, 0, 0, 0];\n var v_i = y.slice(0);\n\n // calculate Z_128 (block has 128 bits)\n for(var i = 0; i < 128; ++i) {\n // if x_i is 0, Z_{i+1} = Z_i (unchanged)\n // else Z_{i+1} = Z_i ^ V_i\n // get x_i by finding 32-bit int position, then left shift 1 by remainder\n var x_i = x[(i / 32) | 0] & (1 << (31 - i % 32));\n if(x_i) {\n z_i[0] ^= v_i[0];\n z_i[1] ^= v_i[1];\n z_i[2] ^= v_i[2];\n z_i[3] ^= v_i[3];\n }\n\n // if LSB(V_i) is 1, V_i = V_i >> 1\n // else V_i = (V_i >> 1) ^ R\n this.pow(v_i, v_i);\n }\n\n return z_i;\n};\n\nmodes.gcm.prototype.pow = function(x, out) {\n // if LSB(x) is 1, x = x >>> 1\n // else x = (x >>> 1) ^ R\n var lsb = x[3] & 1;\n\n // always do x >>> 1:\n // starting with the rightmost integer, shift each integer to the right\n // one bit, pulling in the bit from the integer to the left as its top\n // most bit (do this for the last 3 integers)\n for(var i = 3; i > 0; --i) {\n out[i] = (x[i] >>> 1) | ((x[i - 1] & 1) << 31);\n }\n // shift the first integer normally\n out[0] = x[0] >>> 1;\n\n // if lsb was not set, then polynomial had a degree of 127 and doesn't\n // need to divided; otherwise, XOR with R to find the remainder; we only\n // need to XOR the first integer since R technically ends w/120 zero bits\n if(lsb) {\n out[0] ^= this._R;\n }\n};\n\nmodes.gcm.prototype.tableMultiply = function(x) {\n // assumes 4-bit tables are used\n var z = [0, 0, 0, 0];\n for(var i = 0; i < 32; ++i) {\n var idx = (i / 8) | 0;\n var x_i = (x[idx] >>> ((7 - (i % 8)) * 4)) & 0xF;\n var ah = this._m[i][x_i];\n z[0] ^= ah[0];\n z[1] ^= ah[1];\n z[2] ^= ah[2];\n z[3] ^= ah[3];\n }\n return z;\n};\n\n/**\n * A continuing version of the GHASH algorithm that operates on a single\n * block. The hash block, last hash value (Ym) and the new block to hash\n * are given.\n *\n * @param h the hash block.\n * @param y the previous value for Ym, use [0, 0, 0, 0] for a new hash.\n * @param x the block to hash.\n *\n * @return the hashed value (Ym).\n */\nmodes.gcm.prototype.ghash = function(h, y, x) {\n y[0] ^= x[0];\n y[1] ^= x[1];\n y[2] ^= x[2];\n y[3] ^= x[3];\n return this.tableMultiply(y);\n //return this.multiply(y, h);\n};\n\n/**\n * Precomputes a table for multiplying against the hash subkey. This\n * mechanism provides a substantial speed increase over multiplication\n * performed without a table. The table-based multiplication this table is\n * for solves X * H by multiplying each component of X by H and then\n * composing the results together using XOR.\n *\n * This function can be used to generate tables with different bit sizes\n * for the components, however, this implementation assumes there are\n * 32 components of X (which is a 16 byte vector), therefore each component\n * takes 4-bits (so the table is constructed with bits=4).\n *\n * @param h the hash subkey.\n * @param bits the bit size for a component.\n */\nmodes.gcm.prototype.generateHashTable = function(h, bits) {\n // TODO: There are further optimizations that would use only the\n // first table M_0 (or some variant) along with a remainder table;\n // this can be explored in the future\n var multiplier = 8 / bits;\n var perInt = 4 * multiplier;\n var size = 16 * multiplier;\n var m = new Array(size);\n for(var i = 0; i < size; ++i) {\n var tmp = [0, 0, 0, 0];\n var idx = (i / perInt) | 0;\n var shft = ((perInt - 1 - (i % perInt)) * bits);\n tmp[idx] = (1 << (bits - 1)) << shft;\n m[i] = this.generateSubHashTable(this.multiply(tmp, h), bits);\n }\n return m;\n};\n\n/**\n * Generates a table for multiplying against the hash subkey for one\n * particular component (out of all possible component values).\n *\n * @param mid the pre-multiplied value for the middle key of the table.\n * @param bits the bit size for a component.\n */\nmodes.gcm.prototype.generateSubHashTable = function(mid, bits) {\n // compute the table quickly by minimizing the number of\n // POW operations -- they only need to be performed for powers of 2,\n // all other entries can be composed from those powers using XOR\n var size = 1 << bits;\n var half = size >>> 1;\n var m = new Array(size);\n m[half] = mid.slice(0);\n var i = half >>> 1;\n while(i > 0) {\n // raise m0[2 * i] and store in m0[i]\n this.pow(m[2 * i], m[i] = []);\n i >>= 1;\n }\n i = 2;\n while(i < half) {\n for(var j = 1; j < i; ++j) {\n var m_i = m[i];\n var m_j = m[j];\n m[i + j] = [\n m_i[0] ^ m_j[0],\n m_i[1] ^ m_j[1],\n m_i[2] ^ m_j[2],\n m_i[3] ^ m_j[3]\n ];\n }\n i *= 2;\n }\n m[0] = [0, 0, 0, 0];\n /* Note: We could avoid storing these by doing composition during multiply\n calculate top half using composition by speed is preferred. */\n for(i = half + 1; i < size; ++i) {\n var c = m[i ^ half];\n m[i] = [mid[0] ^ c[0], mid[1] ^ c[1], mid[2] ^ c[2], mid[3] ^ c[3]];\n }\n return m;\n};\n\n/** Utility functions */\n\nfunction transformIV(iv, blockSize) {\n if(typeof iv === 'string') {\n // convert iv string into byte buffer\n iv = forge.util.createBuffer(iv);\n }\n\n if(forge.util.isArray(iv) && iv.length > 4) {\n // convert iv byte array into byte buffer\n var tmp = iv;\n iv = forge.util.createBuffer();\n for(var i = 0; i < tmp.length; ++i) {\n iv.putByte(tmp[i]);\n }\n }\n\n if(iv.length() < blockSize) {\n throw new Error(\n 'Invalid IV length; got ' + iv.length() +\n ' bytes and expected ' + blockSize + ' bytes.');\n }\n\n if(!forge.util.isArray(iv)) {\n // convert iv byte buffer into 32-bit integer array\n var ints = [];\n var blocks = blockSize / 4;\n for(var i = 0; i < blocks; ++i) {\n ints.push(iv.getInt32());\n }\n iv = ints;\n }\n\n return iv;\n}\n\nfunction inc32(block) {\n // increment last 32 bits of block only\n block[block.length - 1] = (block[block.length - 1] + 1) & 0xFFFFFFFF;\n}\n\nfunction from64To32(num) {\n // convert 64-bit number to two BE Int32s\n return [(num / 0x100000000) | 0, num & 0xFFFFFFFF];\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/cipherModes.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/des.js":
|
||
/*!********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/des.js ***!
|
||
\********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * DES (Data Encryption Standard) implementation.\n *\n * This implementation supports DES as well as 3DES-EDE in ECB and CBC mode.\n * It is based on the BSD-licensed implementation by Paul Tero:\n *\n * Paul Tero, July 2001\n * http://www.tero.co.uk/des/\n *\n * Optimised for performance with large blocks by\n * Michael Hayworth, November 2001\n * http://www.netdealing.com\n *\n * THIS SOFTWARE IS PROVIDED \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * @author Stefan Siegl\n * @author Dave Longley\n *\n * Copyright (c) 2012 Stefan Siegl <stesie@brokenpipe.de>\n * Copyright (c) 2012-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./cipher */ \"./node_modules/node-forge/lib/cipher.js\");\n__webpack_require__(/*! ./cipherModes */ \"./node_modules/node-forge/lib/cipherModes.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\n/* DES API */\nmodule.exports = forge.des = forge.des || {};\n\n/**\n * Deprecated. Instead, use:\n *\n * var cipher = forge.cipher.createCipher('DES-<mode>', key);\n * cipher.start({iv: iv});\n *\n * Creates an DES cipher object to encrypt data using the given symmetric key.\n * The output will be stored in the 'output' member of the returned cipher.\n *\n * The key and iv may be given as binary-encoded strings of bytes or\n * byte buffers.\n *\n * @param key the symmetric key to use (64 or 192 bits).\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n * @param mode the cipher mode to use (default: 'CBC' if IV is\n * given, 'ECB' if null).\n *\n * @return the cipher.\n */\nforge.des.startEncrypting = function(key, iv, output, mode) {\n var cipher = _createCipher({\n key: key,\n output: output,\n decrypt: false,\n mode: mode || (iv === null ? 'ECB' : 'CBC')\n });\n cipher.start(iv);\n return cipher;\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var cipher = forge.cipher.createCipher('DES-<mode>', key);\n *\n * Creates an DES cipher object to encrypt data using the given symmetric key.\n *\n * The key may be given as a binary-encoded string of bytes or a byte buffer.\n *\n * @param key the symmetric key to use (64 or 192 bits).\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.des.createEncryptionCipher = function(key, mode) {\n return _createCipher({\n key: key,\n output: null,\n decrypt: false,\n mode: mode\n });\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var decipher = forge.cipher.createDecipher('DES-<mode>', key);\n * decipher.start({iv: iv});\n *\n * Creates an DES cipher object to decrypt data using the given symmetric key.\n * The output will be stored in the 'output' member of the returned cipher.\n *\n * The key and iv may be given as binary-encoded strings of bytes or\n * byte buffers.\n *\n * @param key the symmetric key to use (64 or 192 bits).\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n * @param mode the cipher mode to use (default: 'CBC' if IV is\n * given, 'ECB' if null).\n *\n * @return the cipher.\n */\nforge.des.startDecrypting = function(key, iv, output, mode) {\n var cipher = _createCipher({\n key: key,\n output: output,\n decrypt: true,\n mode: mode || (iv === null ? 'ECB' : 'CBC')\n });\n cipher.start(iv);\n return cipher;\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var decipher = forge.cipher.createDecipher('DES-<mode>', key);\n *\n * Creates an DES cipher object to decrypt data using the given symmetric key.\n *\n * The key may be given as a binary-encoded string of bytes or a byte buffer.\n *\n * @param key the symmetric key to use (64 or 192 bits).\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.des.createDecryptionCipher = function(key, mode) {\n return _createCipher({\n key: key,\n output: null,\n decrypt: true,\n mode: mode\n });\n};\n\n/**\n * Creates a new DES cipher algorithm object.\n *\n * @param name the name of the algorithm.\n * @param mode the mode factory function.\n *\n * @return the DES algorithm object.\n */\nforge.des.Algorithm = function(name, mode) {\n var self = this;\n self.name = name;\n self.mode = new mode({\n blockSize: 8,\n cipher: {\n encrypt: function(inBlock, outBlock) {\n return _updateBlock(self._keys, inBlock, outBlock, false);\n },\n decrypt: function(inBlock, outBlock) {\n return _updateBlock(self._keys, inBlock, outBlock, true);\n }\n }\n });\n self._init = false;\n};\n\n/**\n * Initializes this DES algorithm by expanding its key.\n *\n * @param options the options to use.\n * key the key to use with this algorithm.\n * decrypt true if the algorithm should be initialized for decryption,\n * false for encryption.\n */\nforge.des.Algorithm.prototype.initialize = function(options) {\n if(this._init) {\n return;\n }\n\n var key = forge.util.createBuffer(options.key);\n if(this.name.indexOf('3DES') === 0) {\n if(key.length() !== 24) {\n throw new Error('Invalid Triple-DES key size: ' + key.length() * 8);\n }\n }\n\n // do key expansion to 16 or 48 subkeys (single or triple DES)\n this._keys = _createKeys(key);\n this._init = true;\n};\n\n/** Register DES algorithms **/\n\nregisterAlgorithm('DES-ECB', forge.cipher.modes.ecb);\nregisterAlgorithm('DES-CBC', forge.cipher.modes.cbc);\nregisterAlgorithm('DES-CFB', forge.cipher.modes.cfb);\nregisterAlgorithm('DES-OFB', forge.cipher.modes.ofb);\nregisterAlgorithm('DES-CTR', forge.cipher.modes.ctr);\n\nregisterAlgorithm('3DES-ECB', forge.cipher.modes.ecb);\nregisterAlgorithm('3DES-CBC', forge.cipher.modes.cbc);\nregisterAlgorithm('3DES-CFB', forge.cipher.modes.cfb);\nregisterAlgorithm('3DES-OFB', forge.cipher.modes.ofb);\nregisterAlgorithm('3DES-CTR', forge.cipher.modes.ctr);\n\nfunction registerAlgorithm(name, mode) {\n var factory = function() {\n return new forge.des.Algorithm(name, mode);\n };\n forge.cipher.registerAlgorithm(name, factory);\n}\n\n/** DES implementation **/\n\nvar spfunction1 = [0x1010400,0,0x10000,0x1010404,0x1010004,0x10404,0x4,0x10000,0x400,0x1010400,0x1010404,0x400,0x1000404,0x1010004,0x1000000,0x4,0x404,0x1000400,0x1000400,0x10400,0x10400,0x1010000,0x1010000,0x1000404,0x10004,0x1000004,0x1000004,0x10004,0,0x404,0x10404,0x1000000,0x10000,0x1010404,0x4,0x1010000,0x1010400,0x1000000,0x1000000,0x400,0x1010004,0x10000,0x10400,0x1000004,0x400,0x4,0x1000404,0x10404,0x1010404,0x10004,0x1010000,0x1000404,0x1000004,0x404,0x10404,0x1010400,0x404,0x1000400,0x1000400,0,0x10004,0x10400,0,0x1010004];\nvar spfunction2 = [-0x7fef7fe0,-0x7fff8000,0x8000,0x108020,0x100000,0x20,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,0x100000,0x20,-0x7fefffe0,0x108000,0x100020,-0x7fff7fe0,0,-0x80000000,0x8000,0x108020,-0x7ff00000,0x100020,-0x7fffffe0,0,0x108000,0x8020,-0x7fef8000,-0x7ff00000,0x8020,0,0x108020,-0x7fefffe0,0x100000,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,0x8000,-0x7ff00000,-0x7fff8000,0x20,-0x7fef7fe0,0x108020,0x20,0x8000,-0x80000000,0x8020,-0x7fef8000,0x100000,-0x7fffffe0,0x100020,-0x7fff7fe0,-0x7fffffe0,0x100020,0x108000,0,-0x7fff8000,0x8020,-0x80000000,-0x7fefffe0,-0x7fef7fe0,0x108000];\nvar spfunction3 = [0x208,0x8020200,0,0x8020008,0x8000200,0,0x20208,0x8000200,0x20008,0x8000008,0x8000008,0x20000,0x8020208,0x20008,0x8020000,0x208,0x8000000,0x8,0x8020200,0x200,0x20200,0x8020000,0x8020008,0x20208,0x8000208,0x20200,0x20000,0x8000208,0x8,0x8020208,0x200,0x8000000,0x8020200,0x8000000,0x20008,0x208,0x20000,0x8020200,0x8000200,0,0x200,0x20008,0x8020208,0x8000200,0x8000008,0x200,0,0x8020008,0x8000208,0x20000,0x8000000,0x8020208,0x8,0x20208,0x20200,0x8000008,0x8020000,0x8000208,0x208,0x8020000,0x20208,0x8,0x8020008,0x20200];\nvar spfunction4 = [0x802001,0x2081,0x2081,0x80,0x802080,0x800081,0x800001,0x2001,0,0x802000,0x802000,0x802081,0x81,0,0x800080,0x800001,0x1,0x2000,0x800000,0x802001,0x80,0x800000,0x2001,0x2080,0x800081,0x1,0x2080,0x800080,0x2000,0x802080,0x802081,0x81,0x800080,0x800001,0x802000,0x802081,0x81,0,0,0x802000,0x2080,0x800080,0x800081,0x1,0x802001,0x2081,0x2081,0x80,0x802081,0x81,0x1,0x2000,0x800001,0x2001,0x802080,0x800081,0x2001,0x2080,0x800000,0x802001,0x80,0x800000,0x2000,0x802080];\nvar spfunction5 = [0x100,0x2080100,0x2080000,0x42000100,0x80000,0x100,0x40000000,0x2080000,0x40080100,0x80000,0x2000100,0x40080100,0x42000100,0x42080000,0x80100,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,0x80100,0x80000,0x42000100,0x100,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,0x100,0x2000000,0x42080000,0x42080100,0x80100,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,0x80100,0x2000100,0x40000100,0x80000,0,0x40080000,0x2080100,0x40000100];\nvar spfunction6 = [0x20000010,0x20400000,0x4000,0x20404010,0x20400000,0x10,0x20404010,0x400000,0x20004000,0x404010,0x400000,0x20000010,0x400010,0x20004000,0x20000000,0x4010,0,0x400010,0x20004010,0x4000,0x404000,0x20004010,0x10,0x20400010,0x20400010,0,0x404010,0x20404000,0x4010,0x404000,0x20404000,0x20000000,0x20004000,0x10,0x20400010,0x404000,0x20404010,0x400000,0x4010,0x20000010,0x400000,0x20004000,0x20000000,0x4010,0x20000010,0x20404010,0x404000,0x20400000,0x404010,0x20404000,0,0x20400010,0x10,0x4000,0x20400000,0x404010,0x4000,0x400010,0x20004010,0,0x20404000,0x20000000,0x400010,0x20004010];\nvar spfunction7 = [0x200000,0x4200002,0x4000802,0,0x800,0x4000802,0x200802,0x4200800,0x4200802,0x200000,0,0x4000002,0x2,0x4000000,0x4200002,0x802,0x4000800,0x200802,0x200002,0x4000800,0x4000002,0x4200000,0x4200800,0x200002,0x4200000,0x800,0x802,0x4200802,0x200800,0x2,0x4000000,0x200800,0x4000000,0x200800,0x200000,0x4000802,0x4000802,0x4200002,0x4200002,0x2,0x200002,0x4000000,0x4000800,0x200000,0x4200800,0x802,0x200802,0x4200800,0x802,0x4000002,0x4200802,0x4200000,0x200800,0,0x2,0x4200802,0,0x200802,0x4200000,0x800,0x4000002,0x4000800,0x800,0x200002];\nvar spfunction8 = [0x10001040,0x1000,0x40000,0x10041040,0x10000000,0x10001040,0x40,0x10000000,0x40040,0x10040000,0x10041040,0x41000,0x10041000,0x41040,0x1000,0x40,0x10040000,0x10000040,0x10001000,0x1040,0x41000,0x40040,0x10040040,0x10041000,0x1040,0,0,0x10040040,0x10000040,0x10001000,0x41040,0x40000,0x41040,0x40000,0x10041000,0x1000,0x40,0x10040040,0x1000,0x41040,0x10001000,0x40,0x10000040,0x10040000,0x10040040,0x10000000,0x40000,0x10001040,0,0x10041040,0x40040,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,0x41000,0x41000,0x1040,0x1040,0x40040,0x10000000,0x10041000];\n\n/**\n * Create necessary sub keys.\n *\n * @param key the 64-bit or 192-bit key.\n *\n * @return the expanded keys.\n */\nfunction _createKeys(key) {\n var pc2bytes0 = [0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204],\n pc2bytes1 = [0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101],\n pc2bytes2 = [0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808],\n pc2bytes3 = [0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000],\n pc2bytes4 = [0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010],\n pc2bytes5 = [0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420],\n pc2bytes6 = [0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002],\n pc2bytes7 = [0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800],\n pc2bytes8 = [0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002],\n pc2bytes9 = [0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408],\n pc2bytes10 = [0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020],\n pc2bytes11 = [0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200],\n pc2bytes12 = [0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010],\n pc2bytes13 = [0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105];\n\n // how many iterations (1 for des, 3 for triple des)\n // changed by Paul 16/6/2007 to use Triple DES for 9+ byte keys\n var iterations = key.length() > 8 ? 3 : 1;\n\n // stores the return keys\n var keys = [];\n\n // now define the left shifts which need to be done\n var shifts = [0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0];\n\n var n = 0, tmp;\n for(var j = 0; j < iterations; j++) {\n var left = key.getInt32();\n var right = key.getInt32();\n\n tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f;\n right ^= tmp;\n left ^= (tmp << 4);\n\n tmp = ((right >>> -16) ^ left) & 0x0000ffff;\n left ^= tmp;\n right ^= (tmp << -16);\n\n tmp = ((left >>> 2) ^ right) & 0x33333333;\n right ^= tmp;\n left ^= (tmp << 2);\n\n tmp = ((right >>> -16) ^ left) & 0x0000ffff;\n left ^= tmp;\n right ^= (tmp << -16);\n\n tmp = ((left >>> 1) ^ right) & 0x55555555;\n right ^= tmp;\n left ^= (tmp << 1);\n\n tmp = ((right >>> 8) ^ left) & 0x00ff00ff;\n left ^= tmp;\n right ^= (tmp << 8);\n\n tmp = ((left >>> 1) ^ right) & 0x55555555;\n right ^= tmp;\n left ^= (tmp << 1);\n\n // right needs to be shifted and OR'd with last four bits of left\n tmp = (left << 8) | ((right >>> 20) & 0x000000f0);\n\n // left needs to be put upside down\n left = ((right << 24) | ((right << 8) & 0xff0000) |\n ((right >>> 8) & 0xff00) | ((right >>> 24) & 0xf0));\n right = tmp;\n\n // now go through and perform these shifts on the left and right keys\n for(var i = 0; i < shifts.length; ++i) {\n //shift the keys either one or two bits to the left\n if(shifts[i]) {\n left = (left << 2) | (left >>> 26);\n right = (right << 2) | (right >>> 26);\n } else {\n left = (left << 1) | (left >>> 27);\n right = (right << 1) | (right >>> 27);\n }\n left &= -0xf;\n right &= -0xf;\n\n // now apply PC-2, in such a way that E is easier when encrypting or\n // decrypting this conversion will look like PC-2 except only the last 6\n // bits of each byte are used rather than 48 consecutive bits and the\n // order of lines will be according to how the S selection functions will\n // be applied: S2, S4, S6, S8, S1, S3, S5, S7\n var lefttmp = (\n pc2bytes0[left >>> 28] | pc2bytes1[(left >>> 24) & 0xf] |\n pc2bytes2[(left >>> 20) & 0xf] | pc2bytes3[(left >>> 16) & 0xf] |\n pc2bytes4[(left >>> 12) & 0xf] | pc2bytes5[(left >>> 8) & 0xf] |\n pc2bytes6[(left >>> 4) & 0xf]);\n var righttmp = (\n pc2bytes7[right >>> 28] | pc2bytes8[(right >>> 24) & 0xf] |\n pc2bytes9[(right >>> 20) & 0xf] | pc2bytes10[(right >>> 16) & 0xf] |\n pc2bytes11[(right >>> 12) & 0xf] | pc2bytes12[(right >>> 8) & 0xf] |\n pc2bytes13[(right >>> 4) & 0xf]);\n tmp = ((righttmp >>> 16) ^ lefttmp) & 0x0000ffff;\n keys[n++] = lefttmp ^ tmp;\n keys[n++] = righttmp ^ (tmp << 16);\n }\n }\n\n return keys;\n}\n\n/**\n * Updates a single block (1 byte) using DES. The update will either\n * encrypt or decrypt the block.\n *\n * @param keys the expanded keys.\n * @param input the input block (an array of 32-bit words).\n * @param output the updated output block.\n * @param decrypt true to decrypt the block, false to encrypt it.\n */\nfunction _updateBlock(keys, input, output, decrypt) {\n // set up loops for single or triple DES\n var iterations = keys.length === 32 ? 3 : 9;\n var looping;\n if(iterations === 3) {\n looping = decrypt ? [30, -2, -2] : [0, 32, 2];\n } else {\n looping = (decrypt ?\n [94, 62, -2, 32, 64, 2, 30, -2, -2] :\n [0, 32, 2, 62, 30, -2, 64, 96, 2]);\n }\n\n var tmp;\n\n var left = input[0];\n var right = input[1];\n\n // first each 64 bit chunk of the message must be permuted according to IP\n tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f;\n right ^= tmp;\n left ^= (tmp << 4);\n\n tmp = ((left >>> 16) ^ right) & 0x0000ffff;\n right ^= tmp;\n left ^= (tmp << 16);\n\n tmp = ((right >>> 2) ^ left) & 0x33333333;\n left ^= tmp;\n right ^= (tmp << 2);\n\n tmp = ((right >>> 8) ^ left) & 0x00ff00ff;\n left ^= tmp;\n right ^= (tmp << 8);\n\n tmp = ((left >>> 1) ^ right) & 0x55555555;\n right ^= tmp;\n left ^= (tmp << 1);\n\n // rotate left 1 bit\n left = ((left << 1) | (left >>> 31));\n right = ((right << 1) | (right >>> 31));\n\n for(var j = 0; j < iterations; j += 3) {\n var endloop = looping[j + 1];\n var loopinc = looping[j + 2];\n\n // now go through and perform the encryption or decryption\n for(var i = looping[j]; i != endloop; i += loopinc) {\n var right1 = right ^ keys[i];\n var right2 = ((right >>> 4) | (right << 28)) ^ keys[i + 1];\n\n // passing these bytes through the S selection functions\n tmp = left;\n left = right;\n right = tmp ^ (\n spfunction2[(right1 >>> 24) & 0x3f] |\n spfunction4[(right1 >>> 16) & 0x3f] |\n spfunction6[(right1 >>> 8) & 0x3f] |\n spfunction8[right1 & 0x3f] |\n spfunction1[(right2 >>> 24) & 0x3f] |\n spfunction3[(right2 >>> 16) & 0x3f] |\n spfunction5[(right2 >>> 8) & 0x3f] |\n spfunction7[right2 & 0x3f]);\n }\n // unreverse left and right\n tmp = left;\n left = right;\n right = tmp;\n }\n\n // rotate right 1 bit\n left = ((left >>> 1) | (left << 31));\n right = ((right >>> 1) | (right << 31));\n\n // now perform IP-1, which is IP in the opposite direction\n tmp = ((left >>> 1) ^ right) & 0x55555555;\n right ^= tmp;\n left ^= (tmp << 1);\n\n tmp = ((right >>> 8) ^ left) & 0x00ff00ff;\n left ^= tmp;\n right ^= (tmp << 8);\n\n tmp = ((right >>> 2) ^ left) & 0x33333333;\n left ^= tmp;\n right ^= (tmp << 2);\n\n tmp = ((left >>> 16) ^ right) & 0x0000ffff;\n right ^= tmp;\n left ^= (tmp << 16);\n\n tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f;\n right ^= tmp;\n left ^= (tmp << 4);\n\n output[0] = left;\n output[1] = right;\n}\n\n/**\n * Deprecated. Instead, use:\n *\n * forge.cipher.createCipher('DES-<mode>', key);\n * forge.cipher.createDecipher('DES-<mode>', key);\n *\n * Creates a deprecated DES cipher object. This object's mode will default to\n * CBC (cipher-block-chaining).\n *\n * The key may be given as a binary-encoded string of bytes or a byte buffer.\n *\n * @param options the options to use.\n * key the symmetric key to use (64 or 192 bits).\n * output the buffer to write to.\n * decrypt true for decryption, false for encryption.\n * mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nfunction _createCipher(options) {\n options = options || {};\n var mode = (options.mode || 'CBC').toUpperCase();\n var algorithm = 'DES-' + mode;\n\n var cipher;\n if(options.decrypt) {\n cipher = forge.cipher.createDecipher(algorithm, options.key);\n } else {\n cipher = forge.cipher.createCipher(algorithm, options.key);\n }\n\n // backwards compatible start API\n var start = cipher.start;\n cipher.start = function(iv, options) {\n // backwards compatibility: support second arg as output buffer\n var output = null;\n if(options instanceof forge.util.ByteBuffer) {\n output = options;\n options = {};\n }\n options = options || {};\n options.output = output;\n options.iv = iv;\n start.call(cipher, options);\n };\n\n return cipher;\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/des.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/forge.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/forge.js ***!
|
||
\**********************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("/**\n * Node.js module for Forge.\n *\n * @author Dave Longley\n *\n * Copyright 2011-2016 Digital Bazaar, Inc.\n */\nmodule.exports = {\n // default options\n options: {\n usePureJavaScript: false\n }\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/forge.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/hmac.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/hmac.js ***!
|
||
\*********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Hash-based Message Authentication Code implementation. Requires a message\n * digest object that can be obtained, for example, from forge.md.sha1 or\n * forge.md.md5.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2012 Digital Bazaar, Inc. All rights reserved.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\n/* HMAC API */\nvar hmac = module.exports = forge.hmac = forge.hmac || {};\n\n/**\n * Creates an HMAC object that uses the given message digest object.\n *\n * @return an HMAC object.\n */\nhmac.create = function() {\n // the hmac key to use\n var _key = null;\n\n // the message digest to use\n var _md = null;\n\n // the inner padding\n var _ipadding = null;\n\n // the outer padding\n var _opadding = null;\n\n // hmac context\n var ctx = {};\n\n /**\n * Starts or restarts the HMAC with the given key and message digest.\n *\n * @param md the message digest to use, null to reuse the previous one,\n * a string to use builtin 'sha1', 'md5', 'sha256'.\n * @param key the key to use as a string, array of bytes, byte buffer,\n * or null to reuse the previous key.\n */\n ctx.start = function(md, key) {\n if(md !== null) {\n if(typeof md === 'string') {\n // create builtin message digest\n md = md.toLowerCase();\n if(md in forge.md.algorithms) {\n _md = forge.md.algorithms[md].create();\n } else {\n throw new Error('Unknown hash algorithm \"' + md + '\"');\n }\n } else {\n // store message digest\n _md = md;\n }\n }\n\n if(key === null) {\n // reuse previous key\n key = _key;\n } else {\n if(typeof key === 'string') {\n // convert string into byte buffer\n key = forge.util.createBuffer(key);\n } else if(forge.util.isArray(key)) {\n // convert byte array into byte buffer\n var tmp = key;\n key = forge.util.createBuffer();\n for(var i = 0; i < tmp.length; ++i) {\n key.putByte(tmp[i]);\n }\n }\n\n // if key is longer than blocksize, hash it\n var keylen = key.length();\n if(keylen > _md.blockLength) {\n _md.start();\n _md.update(key.bytes());\n key = _md.digest();\n }\n\n // mix key into inner and outer padding\n // ipadding = [0x36 * blocksize] ^ key\n // opadding = [0x5C * blocksize] ^ key\n _ipadding = forge.util.createBuffer();\n _opadding = forge.util.createBuffer();\n keylen = key.length();\n for(var i = 0; i < keylen; ++i) {\n var tmp = key.at(i);\n _ipadding.putByte(0x36 ^ tmp);\n _opadding.putByte(0x5C ^ tmp);\n }\n\n // if key is shorter than blocksize, add additional padding\n if(keylen < _md.blockLength) {\n var tmp = _md.blockLength - keylen;\n for(var i = 0; i < tmp; ++i) {\n _ipadding.putByte(0x36);\n _opadding.putByte(0x5C);\n }\n }\n _key = key;\n _ipadding = _ipadding.bytes();\n _opadding = _opadding.bytes();\n }\n\n // digest is done like so: hash(opadding | hash(ipadding | message))\n\n // prepare to do inner hash\n // hash(ipadding | message)\n _md.start();\n _md.update(_ipadding);\n };\n\n /**\n * Updates the HMAC with the given message bytes.\n *\n * @param bytes the bytes to update with.\n */\n ctx.update = function(bytes) {\n _md.update(bytes);\n };\n\n /**\n * Produces the Message Authentication Code (MAC).\n *\n * @return a byte buffer containing the digest value.\n */\n ctx.getMac = function() {\n // digest is done like so: hash(opadding | hash(ipadding | message))\n // here we do the outer hashing\n var inner = _md.digest().bytes();\n _md.start();\n _md.update(_opadding);\n _md.update(inner);\n return _md.digest();\n };\n // alias for getMac\n ctx.digest = ctx.getMac;\n\n return ctx;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/hmac.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/jsbn.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/jsbn.js ***!
|
||
\*********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("// Copyright (c) 2005 Tom Wu\n// All Rights Reserved.\n// See \"LICENSE\" for details.\n\n// Basic JavaScript BN library - subset useful for RSA encryption.\n\n/*\nLicensing (LICENSE)\n-------------------\n\nThis software is covered under the following copyright:\n*/\n/*\n * Copyright (c) 2003-2005 Tom Wu\n * All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY\n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n *\n * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,\n * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER\n * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF\n * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * In addition, the following condition applies:\n *\n * All redistributions must retain an intact copy of this copyright notice\n * and disclaimer.\n */\n/*\nAddress all questions regarding this license to:\n\n Tom Wu\n tjw@cs.Stanford.EDU\n*/\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n\nmodule.exports = forge.jsbn = forge.jsbn || {};\n\n// Bits per digit\nvar dbits;\n\n// JavaScript engine analysis\nvar canary = 0xdeadbeefcafe;\nvar j_lm = ((canary&0xffffff)==0xefcafe);\n\n// (public) Constructor\nfunction BigInteger(a,b,c) {\n this.data = [];\n if(a != null)\n if(\"number\" == typeof a) this.fromNumber(a,b,c);\n else if(b == null && \"string\" != typeof a) this.fromString(a,256);\n else this.fromString(a,b);\n}\nforge.jsbn.BigInteger = BigInteger;\n\n// return new, unset BigInteger\nfunction nbi() { return new BigInteger(null); }\n\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\nfunction am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this.data[i++]+w.data[j]+c;\n c = Math.floor(v/0x4000000);\n w.data[j++] = v&0x3ffffff;\n }\n return c;\n}\n// am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\nfunction am2(i,x,w,j,c,n) {\n var xl = x&0x7fff, xh = x>>15;\n while(--n >= 0) {\n var l = this.data[i]&0x7fff;\n var h = this.data[i++]>>15;\n var m = xh*l+h*xl;\n l = xl*l+((m&0x7fff)<<15)+w.data[j]+(c&0x3fffffff);\n c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);\n w.data[j++] = l&0x3fffffff;\n }\n return c;\n}\n// Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\nfunction am3(i,x,w,j,c,n) {\n var xl = x&0x3fff, xh = x>>14;\n while(--n >= 0) {\n var l = this.data[i]&0x3fff;\n var h = this.data[i++]>>14;\n var m = xh*l+h*xl;\n l = xl*l+((m&0x3fff)<<14)+w.data[j]+c;\n c = (l>>28)+(m>>14)+xh*h;\n w.data[j++] = l&0xfffffff;\n }\n return c;\n}\n\n// node.js (no browser)\nif(typeof(navigator) === 'undefined')\n{\n BigInteger.prototype.am = am3;\n dbits = 28;\n} else if(j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\n BigInteger.prototype.am = am2;\n dbits = 30;\n} else if(j_lm && (navigator.appName != \"Netscape\")) {\n BigInteger.prototype.am = am1;\n dbits = 26;\n} else { // Mozilla/Netscape seems to prefer am3\n BigInteger.prototype.am = am3;\n dbits = 28;\n}\n\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = ((1<<dbits)-1);\nBigInteger.prototype.DV = (1<<dbits);\n\nvar BI_FP = 52;\nBigInteger.prototype.FV = Math.pow(2,BI_FP);\nBigInteger.prototype.F1 = BI_FP-dbits;\nBigInteger.prototype.F2 = 2*dbits-BI_FP;\n\n// Digit conversions\nvar BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\nvar BI_RC = new Array();\nvar rr,vv;\nrr = \"0\".charCodeAt(0);\nfor(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;\nrr = \"a\".charCodeAt(0);\nfor(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;\nrr = \"A\".charCodeAt(0);\nfor(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;\n\nfunction int2char(n) { return BI_RM.charAt(n); }\nfunction intAt(s,i) {\n var c = BI_RC[s.charCodeAt(i)];\n return (c==null)?-1:c;\n}\n\n// (protected) copy this to r\nfunction bnpCopyTo(r) {\n for(var i = this.t-1; i >= 0; --i) r.data[i] = this.data[i];\n r.t = this.t;\n r.s = this.s;\n}\n\n// (protected) set from integer value x, -DV <= x < DV\nfunction bnpFromInt(x) {\n this.t = 1;\n this.s = (x<0)?-1:0;\n if(x > 0) this.data[0] = x;\n else if(x < -1) this.data[0] = x+this.DV;\n else this.t = 0;\n}\n\n// return bigint initialized to value\nfunction nbv(i) { var r = nbi(); r.fromInt(i); return r; }\n\n// (protected) set from string and radix\nfunction bnpFromString(s,b) {\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 256) k = 8; // byte array\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else { this.fromRadix(s,b); return; }\n this.t = 0;\n this.s = 0;\n var i = s.length, mi = false, sh = 0;\n while(--i >= 0) {\n var x = (k==8)?s[i]&0xff:intAt(s,i);\n if(x < 0) {\n if(s.charAt(i) == \"-\") mi = true;\n continue;\n }\n mi = false;\n if(sh == 0)\n this.data[this.t++] = x;\n else if(sh+k > this.DB) {\n this.data[this.t-1] |= (x&((1<<(this.DB-sh))-1))<<sh;\n this.data[this.t++] = (x>>(this.DB-sh));\n } else\n this.data[this.t-1] |= x<<sh;\n sh += k;\n if(sh >= this.DB) sh -= this.DB;\n }\n if(k == 8 && (s[0]&0x80) != 0) {\n this.s = -1;\n if(sh > 0) this.data[this.t-1] |= ((1<<(this.DB-sh))-1)<<sh;\n }\n this.clamp();\n if(mi) BigInteger.ZERO.subTo(this,this);\n}\n\n// (protected) clamp off excess high words\nfunction bnpClamp() {\n var c = this.s&this.DM;\n while(this.t > 0 && this.data[this.t-1] == c) --this.t;\n}\n\n// (public) return string representation in given radix\nfunction bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}\n\n// (public) -this\nfunction bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }\n\n// (public) |this|\nfunction bnAbs() { return (this.s<0)?this.negate():this; }\n\n// (public) return + if this > a, - if this < a, 0 if equal\nfunction bnCompareTo(a) {\n var r = this.s-a.s;\n if(r != 0) return r;\n var i = this.t;\n r = i-a.t;\n if(r != 0) return (this.s<0)?-r:r;\n while(--i >= 0) if((r=this.data[i]-a.data[i]) != 0) return r;\n return 0;\n}\n\n// returns bit length of the integer x\nfunction nbits(x) {\n var r = 1, t;\n if((t=x>>>16) != 0) { x = t; r += 16; }\n if((t=x>>8) != 0) { x = t; r += 8; }\n if((t=x>>4) != 0) { x = t; r += 4; }\n if((t=x>>2) != 0) { x = t; r += 2; }\n if((t=x>>1) != 0) { x = t; r += 1; }\n return r;\n}\n\n// (public) return the number of bits in \"this\"\nfunction bnBitLength() {\n if(this.t <= 0) return 0;\n return this.DB*(this.t-1)+nbits(this.data[this.t-1]^(this.s&this.DM));\n}\n\n// (protected) r = this << n*DB\nfunction bnpDLShiftTo(n,r) {\n var i;\n for(i = this.t-1; i >= 0; --i) r.data[i+n] = this.data[i];\n for(i = n-1; i >= 0; --i) r.data[i] = 0;\n r.t = this.t+n;\n r.s = this.s;\n}\n\n// (protected) r = this >> n*DB\nfunction bnpDRShiftTo(n,r) {\n for(var i = n; i < this.t; ++i) r.data[i-n] = this.data[i];\n r.t = Math.max(this.t-n,0);\n r.s = this.s;\n}\n\n// (protected) r = this << n\nfunction bnpLShiftTo(n,r) {\n var bs = n%this.DB;\n var cbs = this.DB-bs;\n var bm = (1<<cbs)-1;\n var ds = Math.floor(n/this.DB), c = (this.s<<bs)&this.DM, i;\n for(i = this.t-1; i >= 0; --i) {\n r.data[i+ds+1] = (this.data[i]>>cbs)|c;\n c = (this.data[i]&bm)<<bs;\n }\n for(i = ds-1; i >= 0; --i) r.data[i] = 0;\n r.data[ds] = c;\n r.t = this.t+ds+1;\n r.s = this.s;\n r.clamp();\n}\n\n// (protected) r = this >> n\nfunction bnpRShiftTo(n,r) {\n r.s = this.s;\n var ds = Math.floor(n/this.DB);\n if(ds >= this.t) { r.t = 0; return; }\n var bs = n%this.DB;\n var cbs = this.DB-bs;\n var bm = (1<<bs)-1;\n r.data[0] = this.data[ds]>>bs;\n for(var i = ds+1; i < this.t; ++i) {\n r.data[i-ds-1] |= (this.data[i]&bm)<<cbs;\n r.data[i-ds] = this.data[i]>>bs;\n }\n if(bs > 0) r.data[this.t-ds-1] |= (this.s&bm)<<cbs;\n r.t = this.t-ds;\n r.clamp();\n}\n\n// (protected) r = this - a\nfunction bnpSubTo(a,r) {\n var i = 0, c = 0, m = Math.min(a.t,this.t);\n while(i < m) {\n c += this.data[i]-a.data[i];\n r.data[i++] = c&this.DM;\n c >>= this.DB;\n }\n if(a.t < this.t) {\n c -= a.s;\n while(i < this.t) {\n c += this.data[i];\n r.data[i++] = c&this.DM;\n c >>= this.DB;\n }\n c += this.s;\n } else {\n c += this.s;\n while(i < a.t) {\n c -= a.data[i];\n r.data[i++] = c&this.DM;\n c >>= this.DB;\n }\n c -= a.s;\n }\n r.s = (c<0)?-1:0;\n if(c < -1) r.data[i++] = this.DV+c;\n else if(c > 0) r.data[i++] = c;\n r.t = i;\n r.clamp();\n}\n\n// (protected) r = this * a, r != this,a (HAC 14.12)\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyTo(a,r) {\n var x = this.abs(), y = a.abs();\n var i = x.t;\n r.t = i+y.t;\n while(--i >= 0) r.data[i] = 0;\n for(i = 0; i < y.t; ++i) r.data[i+x.t] = x.am(0,y.data[i],r,i,0,x.t);\n r.s = 0;\n r.clamp();\n if(this.s != a.s) BigInteger.ZERO.subTo(r,r);\n}\n\n// (protected) r = this^2, r != this (HAC 14.16)\nfunction bnpSquareTo(r) {\n var x = this.abs();\n var i = r.t = 2*x.t;\n while(--i >= 0) r.data[i] = 0;\n for(i = 0; i < x.t-1; ++i) {\n var c = x.am(i,x.data[i],r,2*i,0,1);\n if((r.data[i+x.t]+=x.am(i+1,2*x.data[i],r,2*i+1,c,x.t-i-1)) >= x.DV) {\n r.data[i+x.t] -= x.DV;\n r.data[i+x.t+1] = 1;\n }\n }\n if(r.t > 0) r.data[r.t-1] += x.am(i,x.data[i],r,2*i,0,1);\n r.s = 0;\n r.clamp();\n}\n\n// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n// r != q, this != m. q or r may be null.\nfunction bnpDivRemTo(m,q,r) {\n var pm = m.abs();\n if(pm.t <= 0) return;\n var pt = this.abs();\n if(pt.t < pm.t) {\n if(q != null) q.fromInt(0);\n if(r != null) this.copyTo(r);\n return;\n }\n if(r == null) r = nbi();\n var y = nbi(), ts = this.s, ms = m.s;\n var nsh = this.DB-nbits(pm.data[pm.t-1]);\t// normalize modulus\n if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } else { pm.copyTo(y); pt.copyTo(r); }\n var ys = y.t;\n var y0 = y.data[ys-1];\n if(y0 == 0) return;\n var yt = y0*(1<<this.F1)+((ys>1)?y.data[ys-2]>>this.F2:0);\n var d1 = this.FV/yt, d2 = (1<<this.F1)/yt, e = 1<<this.F2;\n var i = r.t, j = i-ys, t = (q==null)?nbi():q;\n y.dlShiftTo(j,t);\n if(r.compareTo(t) >= 0) {\n r.data[r.t++] = 1;\n r.subTo(t,r);\n }\n BigInteger.ONE.dlShiftTo(ys,t);\n t.subTo(y,y);\t// \"negative\" y so we can replace sub with am later\n while(y.t < ys) y.data[y.t++] = 0;\n while(--j >= 0) {\n // Estimate quotient digit\n var qd = (r.data[--i]==y0)?this.DM:Math.floor(r.data[i]*d1+(r.data[i-1]+e)*d2);\n if((r.data[i]+=y.am(0,qd,r,j,0,ys)) < qd) {\t// Try it out\n y.dlShiftTo(j,t);\n r.subTo(t,r);\n while(r.data[i] < --qd) r.subTo(t,r);\n }\n }\n if(q != null) {\n r.drShiftTo(ys,q);\n if(ts != ms) BigInteger.ZERO.subTo(q,q);\n }\n r.t = ys;\n r.clamp();\n if(nsh > 0) r.rShiftTo(nsh,r);\t// Denormalize remainder\n if(ts < 0) BigInteger.ZERO.subTo(r,r);\n}\n\n// (public) this mod a\nfunction bnMod(a) {\n var r = nbi();\n this.abs().divRemTo(a,null,r);\n if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);\n return r;\n}\n\n// Modular reduction using \"classic\" algorithm\nfunction Classic(m) { this.m = m; }\nfunction cConvert(x) {\n if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);\n else return x;\n}\nfunction cRevert(x) { return x; }\nfunction cReduce(x) { x.divRemTo(this.m,null,x); }\nfunction cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\nfunction cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\nClassic.prototype.convert = cConvert;\nClassic.prototype.revert = cRevert;\nClassic.prototype.reduce = cReduce;\nClassic.prototype.mulTo = cMulTo;\nClassic.prototype.sqrTo = cSqrTo;\n\n// (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n// justification:\n// xy == 1 (mod m)\n// xy = 1+km\n// xy(2-xy) = (1+km)(1-km)\n// x[y(2-xy)] = 1-k^2m^2\n// x[y(2-xy)] == 1 (mod m^2)\n// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n// JS multiply \"overflows\" differently from C/C++, so care is needed here.\nfunction bnpInvDigit() {\n if(this.t < 1) return 0;\n var x = this.data[0];\n if((x&1) == 0) return 0;\n var y = x&3;\t\t// y == 1/x mod 2^2\n y = (y*(2-(x&0xf)*y))&0xf;\t// y == 1/x mod 2^4\n y = (y*(2-(x&0xff)*y))&0xff;\t// y == 1/x mod 2^8\n y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff;\t// y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly;\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n y = (y*(2-x*y%this.DV))%this.DV;\t\t// y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n return (y>0)?this.DV-y:-y;\n}\n\n// Montgomery reduction\nfunction Montgomery(m) {\n this.m = m;\n this.mp = m.invDigit();\n this.mpl = this.mp&0x7fff;\n this.mph = this.mp>>15;\n this.um = (1<<(m.DB-15))-1;\n this.mt2 = 2*m.t;\n}\n\n// xR mod m\nfunction montConvert(x) {\n var r = nbi();\n x.abs().dlShiftTo(this.m.t,r);\n r.divRemTo(this.m,null,r);\n if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);\n return r;\n}\n\n// x/R mod m\nfunction montRevert(x) {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n}\n\n// x = x/R mod m (HAC 14.32)\nfunction montReduce(x) {\n while(x.t <= this.mt2)\t// pad x so am has enough room later\n x.data[x.t++] = 0;\n for(var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x.data[i]*mp mod DV\n var j = x.data[i]&0x7fff;\n var u0 = (j*this.mpl+(((j*this.mph+(x.data[i]>>15)*this.mpl)&this.um)<<15))&x.DM;\n // use am to combine the multiply-shift-add into one call\n j = i+this.m.t;\n x.data[j] += this.m.am(0,u0,x,i,0,this.m.t);\n // propagate carry\n while(x.data[j] >= x.DV) { x.data[j] -= x.DV; x.data[++j]++; }\n }\n x.clamp();\n x.drShiftTo(this.m.t,x);\n if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);\n}\n\n// r = \"x^2/R mod m\"; x != r\nfunction montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\n// r = \"xy/R mod m\"; x,y != r\nfunction montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\n\nMontgomery.prototype.convert = montConvert;\nMontgomery.prototype.revert = montRevert;\nMontgomery.prototype.reduce = montReduce;\nMontgomery.prototype.mulTo = montMulTo;\nMontgomery.prototype.sqrTo = montSqrTo;\n\n// (protected) true iff this is even\nfunction bnpIsEven() { return ((this.t>0)?(this.data[0]&1):this.s) == 0; }\n\n// (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\nfunction bnpExp(e,z) {\n if(e > 0xffffffff || e < 1) return BigInteger.ONE;\n var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;\n g.copyTo(r);\n while(--i >= 0) {\n z.sqrTo(r,r2);\n if((e&(1<<i)) > 0) z.mulTo(r2,g,r);\n else { var t = r; r = r2; r2 = t; }\n }\n return z.revert(r);\n}\n\n// (public) this^e % m, 0 <= e < 2^32\nfunction bnModPowInt(e,m) {\n var z;\n if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);\n return this.exp(e,z);\n}\n\n// protected\nBigInteger.prototype.copyTo = bnpCopyTo;\nBigInteger.prototype.fromInt = bnpFromInt;\nBigInteger.prototype.fromString = bnpFromString;\nBigInteger.prototype.clamp = bnpClamp;\nBigInteger.prototype.dlShiftTo = bnpDLShiftTo;\nBigInteger.prototype.drShiftTo = bnpDRShiftTo;\nBigInteger.prototype.lShiftTo = bnpLShiftTo;\nBigInteger.prototype.rShiftTo = bnpRShiftTo;\nBigInteger.prototype.subTo = bnpSubTo;\nBigInteger.prototype.multiplyTo = bnpMultiplyTo;\nBigInteger.prototype.squareTo = bnpSquareTo;\nBigInteger.prototype.divRemTo = bnpDivRemTo;\nBigInteger.prototype.invDigit = bnpInvDigit;\nBigInteger.prototype.isEven = bnpIsEven;\nBigInteger.prototype.exp = bnpExp;\n\n// public\nBigInteger.prototype.toString = bnToString;\nBigInteger.prototype.negate = bnNegate;\nBigInteger.prototype.abs = bnAbs;\nBigInteger.prototype.compareTo = bnCompareTo;\nBigInteger.prototype.bitLength = bnBitLength;\nBigInteger.prototype.mod = bnMod;\nBigInteger.prototype.modPowInt = bnModPowInt;\n\n// \"constants\"\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);\n\n// jsbn2 lib\n\n//Copyright (c) 2005-2009 Tom Wu\n//All Rights Reserved.\n//See \"LICENSE\" for details (See jsbn.js for LICENSE).\n\n//Extended JavaScript BN functions, required for RSA private ops.\n\n//Version 1.1: new BigInteger(\"0\", 10) returns \"proper\" zero\n\n//(public)\nfunction bnClone() { var r = nbi(); this.copyTo(r); return r; }\n\n//(public) return value as integer\nfunction bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}\n\n//(public) return value as byte\nfunction bnByteValue() { return (this.t==0)?this.s:(this.data[0]<<24)>>24; }\n\n//(public) return value as short (assumes DB>=16)\nfunction bnShortValue() { return (this.t==0)?this.s:(this.data[0]<<16)>>16; }\n\n//(protected) return x s.t. r^x < DV\nfunction bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }\n\n//(public) 0 if this == 0, 1 if this > 0\nfunction bnSigNum() {\nif(this.s < 0) return -1;\nelse if(this.t <= 0 || (this.t == 1 && this.data[0] <= 0)) return 0;\nelse return 1;\n}\n\n//(protected) convert to radix string\nfunction bnpToRadix(b) {\nif(b == null) b = 10;\nif(this.signum() == 0 || b < 2 || b > 36) return \"0\";\nvar cs = this.chunkSize(b);\nvar a = Math.pow(b,cs);\nvar d = nbv(a), y = nbi(), z = nbi(), r = \"\";\nthis.divRemTo(d,y,z);\nwhile(y.signum() > 0) {\n r = (a+z.intValue()).toString(b).substr(1) + r;\n y.divRemTo(d,y,z);\n}\nreturn z.intValue().toString(b) + r;\n}\n\n//(protected) convert from radix string\nfunction bnpFromRadix(s,b) {\nthis.fromInt(0);\nif(b == null) b = 10;\nvar cs = this.chunkSize(b);\nvar d = Math.pow(b,cs), mi = false, j = 0, w = 0;\nfor(var i = 0; i < s.length; ++i) {\n var x = intAt(s,i);\n if(x < 0) {\n if(s.charAt(i) == \"-\" && this.signum() == 0) mi = true;\n continue;\n }\n w = b*w+x;\n if(++j >= cs) {\n this.dMultiply(d);\n this.dAddOffset(w,0);\n j = 0;\n w = 0;\n }\n}\nif(j > 0) {\n this.dMultiply(Math.pow(b,j));\n this.dAddOffset(w,0);\n}\nif(mi) BigInteger.ZERO.subTo(this,this);\n}\n\n//(protected) alternate constructor\nfunction bnpFromNumber(a,b,c) {\nif(\"number\" == typeof b) {\n // new BigInteger(int,int,RNG)\n if(a < 2) this.fromInt(1);\n else {\n this.fromNumber(a,c);\n if(!this.testBit(a-1)) // force MSB set\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);\n if(this.isEven()) this.dAddOffset(1,0); // force odd\n while(!this.isProbablePrime(b)) {\n this.dAddOffset(2,0);\n if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);\n }\n }\n} else {\n // new BigInteger(int,RNG)\n var x = new Array(), t = a&7;\n x.length = (a>>3)+1;\n b.nextBytes(x);\n if(t > 0) x[0] &= ((1<<t)-1); else x[0] = 0;\n this.fromString(x,256);\n}\n}\n\n//(public) convert to bigendian byte array\nfunction bnToByteArray() {\nvar i = this.t, r = new Array();\nr[0] = this.s;\nvar p = this.DB-(i*this.DB)%8, d, k = 0;\nif(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) != (this.s&this.DM)>>p)\n r[k++] = d|(this.s<<(this.DB-p));\n while(i >= 0) {\n if(p < 8) {\n d = (this.data[i]&((1<<p)-1))<<(8-p);\n d |= this.data[--i]>>(p+=this.DB-8);\n } else {\n d = (this.data[i]>>(p-=8))&0xff;\n if(p <= 0) { p += this.DB; --i; }\n }\n if((d&0x80) != 0) d |= -256;\n if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;\n if(k > 0 || d != this.s) r[k++] = d;\n }\n}\nreturn r;\n}\n\nfunction bnEquals(a) { return(this.compareTo(a)==0); }\nfunction bnMin(a) { return(this.compareTo(a)<0)?this:a; }\nfunction bnMax(a) { return(this.compareTo(a)>0)?this:a; }\n\n//(protected) r = this op a (bitwise)\nfunction bnpBitwiseTo(a,op,r) {\nvar i, f, m = Math.min(a.t,this.t);\nfor(i = 0; i < m; ++i) r.data[i] = op(this.data[i],a.data[i]);\nif(a.t < this.t) {\n f = a.s&this.DM;\n for(i = m; i < this.t; ++i) r.data[i] = op(this.data[i],f);\n r.t = this.t;\n} else {\n f = this.s&this.DM;\n for(i = m; i < a.t; ++i) r.data[i] = op(f,a.data[i]);\n r.t = a.t;\n}\nr.s = op(this.s,a.s);\nr.clamp();\n}\n\n//(public) this & a\nfunction op_and(x,y) { return x&y; }\nfunction bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }\n\n//(public) this | a\nfunction op_or(x,y) { return x|y; }\nfunction bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }\n\n//(public) this ^ a\nfunction op_xor(x,y) { return x^y; }\nfunction bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }\n\n//(public) this & ~a\nfunction op_andnot(x,y) { return x&~y; }\nfunction bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }\n\n//(public) ~this\nfunction bnNot() {\nvar r = nbi();\nfor(var i = 0; i < this.t; ++i) r.data[i] = this.DM&~this.data[i];\nr.t = this.t;\nr.s = ~this.s;\nreturn r;\n}\n\n//(public) this << n\nfunction bnShiftLeft(n) {\nvar r = nbi();\nif(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);\nreturn r;\n}\n\n//(public) this >> n\nfunction bnShiftRight(n) {\nvar r = nbi();\nif(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);\nreturn r;\n}\n\n//return index of lowest 1-bit in x, x < 2^31\nfunction lbit(x) {\nif(x == 0) return -1;\nvar r = 0;\nif((x&0xffff) == 0) { x >>= 16; r += 16; }\nif((x&0xff) == 0) { x >>= 8; r += 8; }\nif((x&0xf) == 0) { x >>= 4; r += 4; }\nif((x&3) == 0) { x >>= 2; r += 2; }\nif((x&1) == 0) ++r;\nreturn r;\n}\n\n//(public) returns index of lowest 1-bit (or -1 if none)\nfunction bnGetLowestSetBit() {\nfor(var i = 0; i < this.t; ++i)\n if(this.data[i] != 0) return i*this.DB+lbit(this.data[i]);\nif(this.s < 0) return this.t*this.DB;\nreturn -1;\n}\n\n//return number of 1 bits in x\nfunction cbit(x) {\nvar r = 0;\nwhile(x != 0) { x &= x-1; ++r; }\nreturn r;\n}\n\n//(public) return number of set bits\nfunction bnBitCount() {\nvar r = 0, x = this.s&this.DM;\nfor(var i = 0; i < this.t; ++i) r += cbit(this.data[i]^x);\nreturn r;\n}\n\n//(public) true iff nth bit is set\nfunction bnTestBit(n) {\nvar j = Math.floor(n/this.DB);\nif(j >= this.t) return(this.s!=0);\nreturn((this.data[j]&(1<<(n%this.DB)))!=0);\n}\n\n//(protected) this op (1<<n)\nfunction bnpChangeBit(n,op) {\nvar r = BigInteger.ONE.shiftLeft(n);\nthis.bitwiseTo(r,op,r);\nreturn r;\n}\n\n//(public) this | (1<<n)\nfunction bnSetBit(n) { return this.changeBit(n,op_or); }\n\n//(public) this & ~(1<<n)\nfunction bnClearBit(n) { return this.changeBit(n,op_andnot); }\n\n//(public) this ^ (1<<n)\nfunction bnFlipBit(n) { return this.changeBit(n,op_xor); }\n\n//(protected) r = this + a\nfunction bnpAddTo(a,r) {\nvar i = 0, c = 0, m = Math.min(a.t,this.t);\nwhile(i < m) {\n c += this.data[i]+a.data[i];\n r.data[i++] = c&this.DM;\n c >>= this.DB;\n}\nif(a.t < this.t) {\n c += a.s;\n while(i < this.t) {\n c += this.data[i];\n r.data[i++] = c&this.DM;\n c >>= this.DB;\n }\n c += this.s;\n} else {\n c += this.s;\n while(i < a.t) {\n c += a.data[i];\n r.data[i++] = c&this.DM;\n c >>= this.DB;\n }\n c += a.s;\n}\nr.s = (c<0)?-1:0;\nif(c > 0) r.data[i++] = c;\nelse if(c < -1) r.data[i++] = this.DV+c;\nr.t = i;\nr.clamp();\n}\n\n//(public) this + a\nfunction bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }\n\n//(public) this - a\nfunction bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }\n\n//(public) this * a\nfunction bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }\n\n//(public) this / a\nfunction bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }\n\n//(public) this % a\nfunction bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }\n\n//(public) [this/a,this%a]\nfunction bnDivideAndRemainder(a) {\nvar q = nbi(), r = nbi();\nthis.divRemTo(a,q,r);\nreturn new Array(q,r);\n}\n\n//(protected) this *= n, this >= 0, 1 < n < DV\nfunction bnpDMultiply(n) {\nthis.data[this.t] = this.am(0,n-1,this,0,0,this.t);\n++this.t;\nthis.clamp();\n}\n\n//(protected) this += n << w words, this >= 0\nfunction bnpDAddOffset(n,w) {\nif(n == 0) return;\nwhile(this.t <= w) this.data[this.t++] = 0;\nthis.data[w] += n;\nwhile(this.data[w] >= this.DV) {\n this.data[w] -= this.DV;\n if(++w >= this.t) this.data[this.t++] = 0;\n ++this.data[w];\n}\n}\n\n//A \"null\" reducer\nfunction NullExp() {}\nfunction nNop(x) { return x; }\nfunction nMulTo(x,y,r) { x.multiplyTo(y,r); }\nfunction nSqrTo(x,r) { x.squareTo(r); }\n\nNullExp.prototype.convert = nNop;\nNullExp.prototype.revert = nNop;\nNullExp.prototype.mulTo = nMulTo;\nNullExp.prototype.sqrTo = nSqrTo;\n\n//(public) this^e\nfunction bnPow(e) { return this.exp(e,new NullExp()); }\n\n//(protected) r = lower n words of \"this * a\", a.t <= n\n//\"this\" should be the larger one if appropriate.\nfunction bnpMultiplyLowerTo(a,n,r) {\nvar i = Math.min(this.t+a.t,n);\nr.s = 0; // assumes a,this >= 0\nr.t = i;\nwhile(i > 0) r.data[--i] = 0;\nvar j;\nfor(j = r.t-this.t; i < j; ++i) r.data[i+this.t] = this.am(0,a.data[i],r,i,0,this.t);\nfor(j = Math.min(a.t,n); i < j; ++i) this.am(0,a.data[i],r,i,0,n-i);\nr.clamp();\n}\n\n//(protected) r = \"this * a\" without lower n words, n > 0\n//\"this\" should be the larger one if appropriate.\nfunction bnpMultiplyUpperTo(a,n,r) {\n--n;\nvar i = r.t = this.t+a.t-n;\nr.s = 0; // assumes a,this >= 0\nwhile(--i >= 0) r.data[i] = 0;\nfor(i = Math.max(n-this.t,0); i < a.t; ++i)\n r.data[this.t+i-n] = this.am(n-i,a.data[i],r,0,0,this.t+i-n);\nr.clamp();\nr.drShiftTo(1,r);\n}\n\n//Barrett modular reduction\nfunction Barrett(m) {\n// setup Barrett\nthis.r2 = nbi();\nthis.q3 = nbi();\nBigInteger.ONE.dlShiftTo(2*m.t,this.r2);\nthis.mu = this.r2.divide(m);\nthis.m = m;\n}\n\nfunction barrettConvert(x) {\nif(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m);\nelse if(x.compareTo(this.m) < 0) return x;\nelse { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }\n}\n\nfunction barrettRevert(x) { return x; }\n\n//x = x mod m (HAC 14.42)\nfunction barrettReduce(x) {\nx.drShiftTo(this.m.t-1,this.r2);\nif(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }\nthis.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);\nthis.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);\nwhile(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);\nx.subTo(this.r2,x);\nwhile(x.compareTo(this.m) >= 0) x.subTo(this.m,x);\n}\n\n//r = x^2 mod m; x != r\nfunction barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\n//r = x*y mod m; x,y != r\nfunction barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\n\nBarrett.prototype.convert = barrettConvert;\nBarrett.prototype.revert = barrettRevert;\nBarrett.prototype.reduce = barrettReduce;\nBarrett.prototype.mulTo = barrettMulTo;\nBarrett.prototype.sqrTo = barrettSqrTo;\n\n//(public) this^e % m (HAC 14.85)\nfunction bnModPow(e,m) {\nvar i = e.bitLength(), k, r = nbv(1), z;\nif(i <= 0) return r;\nelse if(i < 18) k = 1;\nelse if(i < 48) k = 3;\nelse if(i < 144) k = 4;\nelse if(i < 768) k = 5;\nelse k = 6;\nif(i < 8)\n z = new Classic(m);\nelse if(m.isEven())\n z = new Barrett(m);\nelse\n z = new Montgomery(m);\n\n// precomputation\nvar g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;\ng[1] = z.convert(this);\nif(k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n}\n\nvar j = e.t-1, w, is1 = true, r2 = nbi(), t;\ni = nbits(e.data[j])-1;\nwhile(j >= 0) {\n if(i >= k1) w = (e.data[j]>>(i-k1))&km;\n else {\n w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);\n if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);\n }\n\n n = k;\n while((w&1) == 0) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n } else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n\n while(j >= 0 && (e.data[j]&(1<<i)) == 0) {\n z.sqrTo(r,r2); t = r; r = r2; r2 = t;\n if(--i < 0) { i = this.DB-1; --j; }\n }\n}\nreturn z.revert(r);\n}\n\n//(public) gcd(this,a) (HAC 14.54)\nfunction bnGCD(a) {\nvar x = (this.s<0)?this.negate():this.clone();\nvar y = (a.s<0)?a.negate():a.clone();\nif(x.compareTo(y) < 0) { var t = x; x = y; y = t; }\nvar i = x.getLowestSetBit(), g = y.getLowestSetBit();\nif(g < 0) return x;\nif(i < g) g = i;\nif(g > 0) {\n x.rShiftTo(g,x);\n y.rShiftTo(g,y);\n}\nwhile(x.signum() > 0) {\n if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x);\n if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y);\n if(x.compareTo(y) >= 0) {\n x.subTo(y,x);\n x.rShiftTo(1,x);\n } else {\n y.subTo(x,y);\n y.rShiftTo(1,y);\n }\n}\nif(g > 0) y.lShiftTo(g,y);\nreturn y;\n}\n\n//(protected) this % n, n < 2^26\nfunction bnpModInt(n) {\nif(n <= 0) return 0;\nvar d = this.DV%n, r = (this.s<0)?n-1:0;\nif(this.t > 0)\n if(d == 0) r = this.data[0]%n;\n else for(var i = this.t-1; i >= 0; --i) r = (d*r+this.data[i])%n;\nreturn r;\n}\n\n//(public) 1/this % m (HAC 14.61)\nfunction bnModInverse(m) {\nvar ac = m.isEven();\nif((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;\nvar u = m.clone(), v = this.clone();\nvar a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);\nwhile(u.signum() != 0) {\n while(u.isEven()) {\n u.rShiftTo(1,u);\n if(ac) {\n if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }\n a.rShiftTo(1,a);\n } else if(!b.isEven()) b.subTo(m,b);\n b.rShiftTo(1,b);\n }\n while(v.isEven()) {\n v.rShiftTo(1,v);\n if(ac) {\n if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }\n c.rShiftTo(1,c);\n } else if(!d.isEven()) d.subTo(m,d);\n d.rShiftTo(1,d);\n }\n if(u.compareTo(v) >= 0) {\n u.subTo(v,u);\n if(ac) a.subTo(c,a);\n b.subTo(d,b);\n } else {\n v.subTo(u,v);\n if(ac) c.subTo(a,c);\n d.subTo(b,d);\n }\n}\nif(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;\nif(d.compareTo(m) >= 0) return d.subtract(m);\nif(d.signum() < 0) d.addTo(m,d); else return d;\nif(d.signum() < 0) return d.add(m); else return d;\n}\n\nvar lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509];\nvar lplim = (1<<26)/lowprimes[lowprimes.length-1];\n\n//(public) test primality with certainty >= 1-.5^t\nfunction bnIsProbablePrime(t) {\nvar i, x = this.abs();\nif(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) {\n for(i = 0; i < lowprimes.length; ++i)\n if(x.data[0] == lowprimes[i]) return true;\n return false;\n}\nif(x.isEven()) return false;\ni = 1;\nwhile(i < lowprimes.length) {\n var m = lowprimes[i], j = i+1;\n while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n m = x.modInt(m);\n while(i < j) if(m%lowprimes[i++] == 0) return false;\n}\nreturn x.millerRabin(t);\n}\n\n//(protected) true if probably prime (HAC 4.24, Miller-Rabin)\nfunction bnpMillerRabin(t) {\nvar n1 = this.subtract(BigInteger.ONE);\nvar k = n1.getLowestSetBit();\nif(k <= 0) return false;\nvar r = n1.shiftRight(k);\nvar prng = bnGetPrng();\nvar a;\nfor(var i = 0; i < t; ++i) {\n // select witness 'a' at random from between 1 and n1\n do {\n a = new BigInteger(this.bitLength(), prng);\n }\n while(a.compareTo(BigInteger.ONE) <= 0 || a.compareTo(n1) >= 0);\n var y = a.modPow(r,this);\n if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\n var j = 1;\n while(j++ < k && y.compareTo(n1) != 0) {\n y = y.modPowInt(2,this);\n if(y.compareTo(BigInteger.ONE) == 0) return false;\n }\n if(y.compareTo(n1) != 0) return false;\n }\n}\nreturn true;\n}\n\n// get pseudo random number generator\nfunction bnGetPrng() {\n // create prng with api that matches BigInteger secure random\n return {\n // x is an array to fill with bytes\n nextBytes: function(x) {\n for(var i = 0; i < x.length; ++i) {\n x[i] = Math.floor(Math.random() * 0x0100);\n }\n }\n };\n}\n\n//protected\nBigInteger.prototype.chunkSize = bnpChunkSize;\nBigInteger.prototype.toRadix = bnpToRadix;\nBigInteger.prototype.fromRadix = bnpFromRadix;\nBigInteger.prototype.fromNumber = bnpFromNumber;\nBigInteger.prototype.bitwiseTo = bnpBitwiseTo;\nBigInteger.prototype.changeBit = bnpChangeBit;\nBigInteger.prototype.addTo = bnpAddTo;\nBigInteger.prototype.dMultiply = bnpDMultiply;\nBigInteger.prototype.dAddOffset = bnpDAddOffset;\nBigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\nBigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\nBigInteger.prototype.modInt = bnpModInt;\nBigInteger.prototype.millerRabin = bnpMillerRabin;\n\n//public\nBigInteger.prototype.clone = bnClone;\nBigInteger.prototype.intValue = bnIntValue;\nBigInteger.prototype.byteValue = bnByteValue;\nBigInteger.prototype.shortValue = bnShortValue;\nBigInteger.prototype.signum = bnSigNum;\nBigInteger.prototype.toByteArray = bnToByteArray;\nBigInteger.prototype.equals = bnEquals;\nBigInteger.prototype.min = bnMin;\nBigInteger.prototype.max = bnMax;\nBigInteger.prototype.and = bnAnd;\nBigInteger.prototype.or = bnOr;\nBigInteger.prototype.xor = bnXor;\nBigInteger.prototype.andNot = bnAndNot;\nBigInteger.prototype.not = bnNot;\nBigInteger.prototype.shiftLeft = bnShiftLeft;\nBigInteger.prototype.shiftRight = bnShiftRight;\nBigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\nBigInteger.prototype.bitCount = bnBitCount;\nBigInteger.prototype.testBit = bnTestBit;\nBigInteger.prototype.setBit = bnSetBit;\nBigInteger.prototype.clearBit = bnClearBit;\nBigInteger.prototype.flipBit = bnFlipBit;\nBigInteger.prototype.add = bnAdd;\nBigInteger.prototype.subtract = bnSubtract;\nBigInteger.prototype.multiply = bnMultiply;\nBigInteger.prototype.divide = bnDivide;\nBigInteger.prototype.remainder = bnRemainder;\nBigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;\nBigInteger.prototype.modPow = bnModPow;\nBigInteger.prototype.modInverse = bnModInverse;\nBigInteger.prototype.pow = bnPow;\nBigInteger.prototype.gcd = bnGCD;\nBigInteger.prototype.isProbablePrime = bnIsProbablePrime;\n\n//BigInteger interfaces not implemented in jsbn:\n\n//BigInteger(int signum, byte[] magnitude)\n//double doubleValue()\n//float floatValue()\n//int hashCode()\n//long longValue()\n//static BigInteger valueOf(long val)\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/jsbn.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/md.js":
|
||
/*!*******************************************!*\
|
||
!*** ./node_modules/node-forge/lib/md.js ***!
|
||
\*******************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Node.js module for Forge message digests.\n *\n * @author Dave Longley\n *\n * Copyright 2011-2017 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n\nmodule.exports = forge.md = forge.md || {};\nforge.md.algorithms = forge.md.algorithms || {};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/md.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/oids.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/oids.js ***!
|
||
\*********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Object IDs for ASN.1.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2013 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n\nforge.pki = forge.pki || {};\nvar oids = module.exports = forge.pki.oids = forge.oids = forge.oids || {};\n\n// set id to name mapping and name to id mapping\nfunction _IN(id, name) {\n oids[id] = name;\n oids[name] = id;\n}\n// set id to name mapping only\nfunction _I_(id, name) {\n oids[id] = name;\n}\n\n// algorithm OIDs\n_IN('1.2.840.113549.1.1.1', 'rsaEncryption');\n// Note: md2 & md4 not implemented\n//_IN('1.2.840.113549.1.1.2', 'md2WithRSAEncryption');\n//_IN('1.2.840.113549.1.1.3', 'md4WithRSAEncryption');\n_IN('1.2.840.113549.1.1.4', 'md5WithRSAEncryption');\n_IN('1.2.840.113549.1.1.5', 'sha1WithRSAEncryption');\n_IN('1.2.840.113549.1.1.7', 'RSAES-OAEP');\n_IN('1.2.840.113549.1.1.8', 'mgf1');\n_IN('1.2.840.113549.1.1.9', 'pSpecified');\n_IN('1.2.840.113549.1.1.10', 'RSASSA-PSS');\n_IN('1.2.840.113549.1.1.11', 'sha256WithRSAEncryption');\n_IN('1.2.840.113549.1.1.12', 'sha384WithRSAEncryption');\n_IN('1.2.840.113549.1.1.13', 'sha512WithRSAEncryption');\n// Edwards-curve Digital Signature Algorithm (EdDSA) Ed25519\n_IN('1.3.101.112', 'EdDSA25519');\n\n_IN('1.2.840.10040.4.3', 'dsa-with-sha1');\n\n_IN('1.3.14.3.2.7', 'desCBC');\n\n_IN('1.3.14.3.2.26', 'sha1');\n// Deprecated equivalent of sha1WithRSAEncryption\n_IN('1.3.14.3.2.29', 'sha1WithRSASignature');\n_IN('2.16.840.1.101.3.4.2.1', 'sha256');\n_IN('2.16.840.1.101.3.4.2.2', 'sha384');\n_IN('2.16.840.1.101.3.4.2.3', 'sha512');\n_IN('2.16.840.1.101.3.4.2.4', 'sha224');\n_IN('2.16.840.1.101.3.4.2.5', 'sha512-224');\n_IN('2.16.840.1.101.3.4.2.6', 'sha512-256');\n_IN('1.2.840.113549.2.2', 'md2');\n_IN('1.2.840.113549.2.5', 'md5');\n\n// pkcs#7 content types\n_IN('1.2.840.113549.1.7.1', 'data');\n_IN('1.2.840.113549.1.7.2', 'signedData');\n_IN('1.2.840.113549.1.7.3', 'envelopedData');\n_IN('1.2.840.113549.1.7.4', 'signedAndEnvelopedData');\n_IN('1.2.840.113549.1.7.5', 'digestedData');\n_IN('1.2.840.113549.1.7.6', 'encryptedData');\n\n// pkcs#9 oids\n_IN('1.2.840.113549.1.9.1', 'emailAddress');\n_IN('1.2.840.113549.1.9.2', 'unstructuredName');\n_IN('1.2.840.113549.1.9.3', 'contentType');\n_IN('1.2.840.113549.1.9.4', 'messageDigest');\n_IN('1.2.840.113549.1.9.5', 'signingTime');\n_IN('1.2.840.113549.1.9.6', 'counterSignature');\n_IN('1.2.840.113549.1.9.7', 'challengePassword');\n_IN('1.2.840.113549.1.9.8', 'unstructuredAddress');\n_IN('1.2.840.113549.1.9.14', 'extensionRequest');\n\n_IN('1.2.840.113549.1.9.20', 'friendlyName');\n_IN('1.2.840.113549.1.9.21', 'localKeyId');\n_IN('1.2.840.113549.1.9.22.1', 'x509Certificate');\n\n// pkcs#12 safe bags\n_IN('1.2.840.113549.1.12.10.1.1', 'keyBag');\n_IN('1.2.840.113549.1.12.10.1.2', 'pkcs8ShroudedKeyBag');\n_IN('1.2.840.113549.1.12.10.1.3', 'certBag');\n_IN('1.2.840.113549.1.12.10.1.4', 'crlBag');\n_IN('1.2.840.113549.1.12.10.1.5', 'secretBag');\n_IN('1.2.840.113549.1.12.10.1.6', 'safeContentsBag');\n\n// password-based-encryption for pkcs#12\n_IN('1.2.840.113549.1.5.13', 'pkcs5PBES2');\n_IN('1.2.840.113549.1.5.12', 'pkcs5PBKDF2');\n\n_IN('1.2.840.113549.1.12.1.1', 'pbeWithSHAAnd128BitRC4');\n_IN('1.2.840.113549.1.12.1.2', 'pbeWithSHAAnd40BitRC4');\n_IN('1.2.840.113549.1.12.1.3', 'pbeWithSHAAnd3-KeyTripleDES-CBC');\n_IN('1.2.840.113549.1.12.1.4', 'pbeWithSHAAnd2-KeyTripleDES-CBC');\n_IN('1.2.840.113549.1.12.1.5', 'pbeWithSHAAnd128BitRC2-CBC');\n_IN('1.2.840.113549.1.12.1.6', 'pbewithSHAAnd40BitRC2-CBC');\n\n// hmac OIDs\n_IN('1.2.840.113549.2.7', 'hmacWithSHA1');\n_IN('1.2.840.113549.2.8', 'hmacWithSHA224');\n_IN('1.2.840.113549.2.9', 'hmacWithSHA256');\n_IN('1.2.840.113549.2.10', 'hmacWithSHA384');\n_IN('1.2.840.113549.2.11', 'hmacWithSHA512');\n\n// symmetric key algorithm oids\n_IN('1.2.840.113549.3.7', 'des-EDE3-CBC');\n_IN('2.16.840.1.101.3.4.1.2', 'aes128-CBC');\n_IN('2.16.840.1.101.3.4.1.22', 'aes192-CBC');\n_IN('2.16.840.1.101.3.4.1.42', 'aes256-CBC');\n\n// certificate issuer/subject OIDs\n_IN('2.5.4.3', 'commonName');\n_IN('2.5.4.4', 'surname');\n_IN('2.5.4.5', 'serialNumber');\n_IN('2.5.4.6', 'countryName');\n_IN('2.5.4.7', 'localityName');\n_IN('2.5.4.8', 'stateOrProvinceName');\n_IN('2.5.4.9', 'streetAddress');\n_IN('2.5.4.10', 'organizationName');\n_IN('2.5.4.11', 'organizationalUnitName');\n_IN('2.5.4.12', 'title');\n_IN('2.5.4.13', 'description');\n_IN('2.5.4.15', 'businessCategory');\n_IN('2.5.4.17', 'postalCode');\n_IN('2.5.4.42', 'givenName');\n_IN('1.3.6.1.4.1.311.60.2.1.2', 'jurisdictionOfIncorporationStateOrProvinceName');\n_IN('1.3.6.1.4.1.311.60.2.1.3', 'jurisdictionOfIncorporationCountryName');\n\n// X.509 extension OIDs\n_IN('2.16.840.1.113730.1.1', 'nsCertType');\n_IN('2.16.840.1.113730.1.13', 'nsComment'); // deprecated in theory; still widely used\n_I_('2.5.29.1', 'authorityKeyIdentifier'); // deprecated, use .35\n_I_('2.5.29.2', 'keyAttributes'); // obsolete use .37 or .15\n_I_('2.5.29.3', 'certificatePolicies'); // deprecated, use .32\n_I_('2.5.29.4', 'keyUsageRestriction'); // obsolete use .37 or .15\n_I_('2.5.29.5', 'policyMapping'); // deprecated use .33\n_I_('2.5.29.6', 'subtreesConstraint'); // obsolete use .30\n_I_('2.5.29.7', 'subjectAltName'); // deprecated use .17\n_I_('2.5.29.8', 'issuerAltName'); // deprecated use .18\n_I_('2.5.29.9', 'subjectDirectoryAttributes');\n_I_('2.5.29.10', 'basicConstraints'); // deprecated use .19\n_I_('2.5.29.11', 'nameConstraints'); // deprecated use .30\n_I_('2.5.29.12', 'policyConstraints'); // deprecated use .36\n_I_('2.5.29.13', 'basicConstraints'); // deprecated use .19\n_IN('2.5.29.14', 'subjectKeyIdentifier');\n_IN('2.5.29.15', 'keyUsage');\n_I_('2.5.29.16', 'privateKeyUsagePeriod');\n_IN('2.5.29.17', 'subjectAltName');\n_IN('2.5.29.18', 'issuerAltName');\n_IN('2.5.29.19', 'basicConstraints');\n_I_('2.5.29.20', 'cRLNumber');\n_I_('2.5.29.21', 'cRLReason');\n_I_('2.5.29.22', 'expirationDate');\n_I_('2.5.29.23', 'instructionCode');\n_I_('2.5.29.24', 'invalidityDate');\n_I_('2.5.29.25', 'cRLDistributionPoints'); // deprecated use .31\n_I_('2.5.29.26', 'issuingDistributionPoint'); // deprecated use .28\n_I_('2.5.29.27', 'deltaCRLIndicator');\n_I_('2.5.29.28', 'issuingDistributionPoint');\n_I_('2.5.29.29', 'certificateIssuer');\n_I_('2.5.29.30', 'nameConstraints');\n_IN('2.5.29.31', 'cRLDistributionPoints');\n_IN('2.5.29.32', 'certificatePolicies');\n_I_('2.5.29.33', 'policyMappings');\n_I_('2.5.29.34', 'policyConstraints'); // deprecated use .36\n_IN('2.5.29.35', 'authorityKeyIdentifier');\n_I_('2.5.29.36', 'policyConstraints');\n_IN('2.5.29.37', 'extKeyUsage');\n_I_('2.5.29.46', 'freshestCRL');\n_I_('2.5.29.54', 'inhibitAnyPolicy');\n\n// extKeyUsage purposes\n_IN('1.3.6.1.4.1.11129.2.4.2', 'timestampList');\n_IN('1.3.6.1.5.5.7.1.1', 'authorityInfoAccess');\n_IN('1.3.6.1.5.5.7.3.1', 'serverAuth');\n_IN('1.3.6.1.5.5.7.3.2', 'clientAuth');\n_IN('1.3.6.1.5.5.7.3.3', 'codeSigning');\n_IN('1.3.6.1.5.5.7.3.4', 'emailProtection');\n_IN('1.3.6.1.5.5.7.3.8', 'timeStamping');\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/oids.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/pbe.js":
|
||
/*!********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/pbe.js ***!
|
||
\********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Password-based encryption functions.\n *\n * @author Dave Longley\n * @author Stefan Siegl <stesie@brokenpipe.de>\n *\n * Copyright (c) 2010-2013 Digital Bazaar, Inc.\n * Copyright (c) 2012 Stefan Siegl <stesie@brokenpipe.de>\n *\n * An EncryptedPrivateKeyInfo:\n *\n * EncryptedPrivateKeyInfo ::= SEQUENCE {\n * encryptionAlgorithm EncryptionAlgorithmIdentifier,\n * encryptedData EncryptedData }\n *\n * EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier\n *\n * EncryptedData ::= OCTET STRING\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./aes */ \"./node_modules/node-forge/lib/aes.js\");\n__webpack_require__(/*! ./asn1 */ \"./node_modules/node-forge/lib/asn1.js\");\n__webpack_require__(/*! ./des */ \"./node_modules/node-forge/lib/des.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./oids */ \"./node_modules/node-forge/lib/oids.js\");\n__webpack_require__(/*! ./pbkdf2 */ \"./node_modules/node-forge/lib/pbkdf2.js\");\n__webpack_require__(/*! ./pem */ \"./node_modules/node-forge/lib/pem.js\");\n__webpack_require__(/*! ./random */ \"./node_modules/node-forge/lib/random.js\");\n__webpack_require__(/*! ./rc2 */ \"./node_modules/node-forge/lib/rc2.js\");\n__webpack_require__(/*! ./rsa */ \"./node_modules/node-forge/lib/rsa.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nif(typeof BigInteger === 'undefined') {\n var BigInteger = forge.jsbn.BigInteger;\n}\n\n// shortcut for asn.1 API\nvar asn1 = forge.asn1;\n\n/* Password-based encryption implementation. */\nvar pki = forge.pki = forge.pki || {};\nmodule.exports = pki.pbe = forge.pbe = forge.pbe || {};\nvar oids = pki.oids;\n\n// validator for an EncryptedPrivateKeyInfo structure\n// Note: Currently only works w/algorithm params\nvar encryptedPrivateKeyValidator = {\n name: 'EncryptedPrivateKeyInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'EncryptedPrivateKeyInfo.encryptionAlgorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'AlgorithmIdentifier.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'encryptionOid'\n }, {\n name: 'AlgorithmIdentifier.parameters',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n captureAsn1: 'encryptionParams'\n }]\n }, {\n // encryptedData\n name: 'EncryptedPrivateKeyInfo.encryptedData',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'encryptedData'\n }]\n};\n\n// validator for a PBES2Algorithms structure\n// Note: Currently only works w/PBKDF2 + AES encryption schemes\nvar PBES2AlgorithmsValidator = {\n name: 'PBES2Algorithms',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.keyDerivationFunc',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.keyDerivationFunc.oid',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'kdfOid'\n }, {\n name: 'PBES2Algorithms.params',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.params.salt',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'kdfSalt'\n }, {\n name: 'PBES2Algorithms.params.iterationCount',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'kdfIterationCount'\n }, {\n name: 'PBES2Algorithms.params.keyLength',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n optional: true,\n capture: 'keyLength'\n }, {\n // prf\n name: 'PBES2Algorithms.params.prf',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n optional: true,\n value: [{\n name: 'PBES2Algorithms.params.prf.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'prfOid'\n }]\n }]\n }]\n }, {\n name: 'PBES2Algorithms.encryptionScheme',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.encryptionScheme.oid',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'encOid'\n }, {\n name: 'PBES2Algorithms.encryptionScheme.iv',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'encIv'\n }]\n }]\n};\n\nvar pkcs12PbeParamsValidator = {\n name: 'pkcs-12PbeParams',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'pkcs-12PbeParams.salt',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'salt'\n }, {\n name: 'pkcs-12PbeParams.iterations',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'iterations'\n }]\n};\n\n/**\n * Encrypts a ASN.1 PrivateKeyInfo object, producing an EncryptedPrivateKeyInfo.\n *\n * PBES2Algorithms ALGORITHM-IDENTIFIER ::=\n * { {PBES2-params IDENTIFIED BY id-PBES2}, ...}\n *\n * id-PBES2 OBJECT IDENTIFIER ::= {pkcs-5 13}\n *\n * PBES2-params ::= SEQUENCE {\n * keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}},\n * encryptionScheme AlgorithmIdentifier {{PBES2-Encs}}\n * }\n *\n * PBES2-KDFs ALGORITHM-IDENTIFIER ::=\n * { {PBKDF2-params IDENTIFIED BY id-PBKDF2}, ... }\n *\n * PBES2-Encs ALGORITHM-IDENTIFIER ::= { ... }\n *\n * PBKDF2-params ::= SEQUENCE {\n * salt CHOICE {\n * specified OCTET STRING,\n * otherSource AlgorithmIdentifier {{PBKDF2-SaltSources}}\n * },\n * iterationCount INTEGER (1..MAX),\n * keyLength INTEGER (1..MAX) OPTIONAL,\n * prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1\n * }\n *\n * @param obj the ASN.1 PrivateKeyInfo object.\n * @param password the password to encrypt with.\n * @param options:\n * algorithm the encryption algorithm to use\n * ('aes128', 'aes192', 'aes256', '3des'), defaults to 'aes128'.\n * count the iteration count to use.\n * saltSize the salt size to use.\n * prfAlgorithm the PRF message digest algorithm to use\n * ('sha1', 'sha224', 'sha256', 'sha384', 'sha512')\n *\n * @return the ASN.1 EncryptedPrivateKeyInfo.\n */\npki.encryptPrivateKeyInfo = function(obj, password, options) {\n // set default options\n options = options || {};\n options.saltSize = options.saltSize || 8;\n options.count = options.count || 2048;\n options.algorithm = options.algorithm || 'aes128';\n options.prfAlgorithm = options.prfAlgorithm || 'sha1';\n\n // generate PBE params\n var salt = forge.random.getBytesSync(options.saltSize);\n var count = options.count;\n var countBytes = asn1.integerToDer(count);\n var dkLen;\n var encryptionAlgorithm;\n var encryptedData;\n if(options.algorithm.indexOf('aes') === 0 || options.algorithm === 'des') {\n // do PBES2\n var ivLen, encOid, cipherFn;\n switch(options.algorithm) {\n case 'aes128':\n dkLen = 16;\n ivLen = 16;\n encOid = oids['aes128-CBC'];\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes192':\n dkLen = 24;\n ivLen = 16;\n encOid = oids['aes192-CBC'];\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes256':\n dkLen = 32;\n ivLen = 16;\n encOid = oids['aes256-CBC'];\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'des':\n dkLen = 8;\n ivLen = 8;\n encOid = oids['desCBC'];\n cipherFn = forge.des.createEncryptionCipher;\n break;\n default:\n var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.');\n error.algorithm = options.algorithm;\n throw error;\n }\n\n // get PRF message digest\n var prfAlgorithm = 'hmacWith' + options.prfAlgorithm.toUpperCase();\n var md = prfAlgorithmToMessageDigest(prfAlgorithm);\n\n // encrypt private key using pbe SHA-1 and AES/DES\n var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md);\n var iv = forge.random.getBytesSync(ivLen);\n var cipher = cipherFn(dk);\n cipher.start(iv);\n cipher.update(asn1.toDer(obj));\n cipher.finish();\n encryptedData = cipher.output.getBytes();\n\n // get PBKDF2-params\n var params = createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm);\n\n encryptionAlgorithm = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(oids['pkcs5PBES2']).getBytes()),\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // keyDerivationFunc\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(oids['pkcs5PBKDF2']).getBytes()),\n // PBKDF2-params\n params\n ]),\n // encryptionScheme\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(encOid).getBytes()),\n // iv\n asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, iv)\n ])\n ])\n ]);\n } else if(options.algorithm === '3des') {\n // Do PKCS12 PBE\n dkLen = 24;\n\n var saltBytes = new forge.util.ByteBuffer(salt);\n var dk = pki.pbe.generatePkcs12Key(password, saltBytes, 1, count, dkLen);\n var iv = pki.pbe.generatePkcs12Key(password, saltBytes, 2, count, dkLen);\n var cipher = forge.des.createEncryptionCipher(dk);\n cipher.start(iv);\n cipher.update(asn1.toDer(obj));\n cipher.finish();\n encryptedData = cipher.output.getBytes();\n\n encryptionAlgorithm = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(oids['pbeWithSHAAnd3-KeyTripleDES-CBC']).getBytes()),\n // pkcs-12PbeParams\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // salt\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt),\n // iteration count\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n countBytes.getBytes())\n ])\n ]);\n } else {\n var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.');\n error.algorithm = options.algorithm;\n throw error;\n }\n\n // EncryptedPrivateKeyInfo\n var rval = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // encryptionAlgorithm\n encryptionAlgorithm,\n // encryptedData\n asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, encryptedData)\n ]);\n return rval;\n};\n\n/**\n * Decrypts a ASN.1 PrivateKeyInfo object.\n *\n * @param obj the ASN.1 EncryptedPrivateKeyInfo object.\n * @param password the password to decrypt with.\n *\n * @return the ASN.1 PrivateKeyInfo on success, null on failure.\n */\npki.decryptPrivateKeyInfo = function(obj, password) {\n var rval = null;\n\n // get PBE params\n var capture = {};\n var errors = [];\n if(!asn1.validate(obj, encryptedPrivateKeyValidator, capture, errors)) {\n var error = new Error('Cannot read encrypted private key. ' +\n 'ASN.1 object is not a supported EncryptedPrivateKeyInfo.');\n error.errors = errors;\n throw error;\n }\n\n // get cipher\n var oid = asn1.derToOid(capture.encryptionOid);\n var cipher = pki.pbe.getCipher(oid, capture.encryptionParams, password);\n\n // get encrypted data\n var encrypted = forge.util.createBuffer(capture.encryptedData);\n\n cipher.update(encrypted);\n if(cipher.finish()) {\n rval = asn1.fromDer(cipher.output);\n }\n\n return rval;\n};\n\n/**\n * Converts a EncryptedPrivateKeyInfo to PEM format.\n *\n * @param epki the EncryptedPrivateKeyInfo.\n * @param maxline the maximum characters per line, defaults to 64.\n *\n * @return the PEM-formatted encrypted private key.\n */\npki.encryptedPrivateKeyToPem = function(epki, maxline) {\n // convert to DER, then PEM-encode\n var msg = {\n type: 'ENCRYPTED PRIVATE KEY',\n body: asn1.toDer(epki).getBytes()\n };\n return forge.pem.encode(msg, {maxline: maxline});\n};\n\n/**\n * Converts a PEM-encoded EncryptedPrivateKeyInfo to ASN.1 format. Decryption\n * is not performed.\n *\n * @param pem the EncryptedPrivateKeyInfo in PEM-format.\n *\n * @return the ASN.1 EncryptedPrivateKeyInfo.\n */\npki.encryptedPrivateKeyFromPem = function(pem) {\n var msg = forge.pem.decode(pem)[0];\n\n if(msg.type !== 'ENCRYPTED PRIVATE KEY') {\n var error = new Error('Could not convert encrypted private key from PEM; ' +\n 'PEM header type is \"ENCRYPTED PRIVATE KEY\".');\n error.headerType = msg.type;\n throw error;\n }\n if(msg.procType && msg.procType.type === 'ENCRYPTED') {\n throw new Error('Could not convert encrypted private key from PEM; ' +\n 'PEM is encrypted.');\n }\n\n // convert DER to ASN.1 object\n return asn1.fromDer(msg.body);\n};\n\n/**\n * Encrypts an RSA private key. By default, the key will be wrapped in\n * a PrivateKeyInfo and encrypted to produce a PKCS#8 EncryptedPrivateKeyInfo.\n * This is the standard, preferred way to encrypt a private key.\n *\n * To produce a non-standard PEM-encrypted private key that uses encapsulated\n * headers to indicate the encryption algorithm (old-style non-PKCS#8 OpenSSL\n * private key encryption), set the 'legacy' option to true. Note: Using this\n * option will cause the iteration count to be forced to 1.\n *\n * Note: The 'des' algorithm is supported, but it is not considered to be\n * secure because it only uses a single 56-bit key. If possible, it is highly\n * recommended that a different algorithm be used.\n *\n * @param rsaKey the RSA key to encrypt.\n * @param password the password to use.\n * @param options:\n * algorithm: the encryption algorithm to use\n * ('aes128', 'aes192', 'aes256', '3des', 'des').\n * count: the iteration count to use.\n * saltSize: the salt size to use.\n * legacy: output an old non-PKCS#8 PEM-encrypted+encapsulated\n * headers (DEK-Info) private key.\n *\n * @return the PEM-encoded ASN.1 EncryptedPrivateKeyInfo.\n */\npki.encryptRsaPrivateKey = function(rsaKey, password, options) {\n // standard PKCS#8\n options = options || {};\n if(!options.legacy) {\n // encrypt PrivateKeyInfo\n var rval = pki.wrapRsaPrivateKey(pki.privateKeyToAsn1(rsaKey));\n rval = pki.encryptPrivateKeyInfo(rval, password, options);\n return pki.encryptedPrivateKeyToPem(rval);\n }\n\n // legacy non-PKCS#8\n var algorithm;\n var iv;\n var dkLen;\n var cipherFn;\n switch(options.algorithm) {\n case 'aes128':\n algorithm = 'AES-128-CBC';\n dkLen = 16;\n iv = forge.random.getBytesSync(16);\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes192':\n algorithm = 'AES-192-CBC';\n dkLen = 24;\n iv = forge.random.getBytesSync(16);\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes256':\n algorithm = 'AES-256-CBC';\n dkLen = 32;\n iv = forge.random.getBytesSync(16);\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case '3des':\n algorithm = 'DES-EDE3-CBC';\n dkLen = 24;\n iv = forge.random.getBytesSync(8);\n cipherFn = forge.des.createEncryptionCipher;\n break;\n case 'des':\n algorithm = 'DES-CBC';\n dkLen = 8;\n iv = forge.random.getBytesSync(8);\n cipherFn = forge.des.createEncryptionCipher;\n break;\n default:\n var error = new Error('Could not encrypt RSA private key; unsupported ' +\n 'encryption algorithm \"' + options.algorithm + '\".');\n error.algorithm = options.algorithm;\n throw error;\n }\n\n // encrypt private key using OpenSSL legacy key derivation\n var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen);\n var cipher = cipherFn(dk);\n cipher.start(iv);\n cipher.update(asn1.toDer(pki.privateKeyToAsn1(rsaKey)));\n cipher.finish();\n\n var msg = {\n type: 'RSA PRIVATE KEY',\n procType: {\n version: '4',\n type: 'ENCRYPTED'\n },\n dekInfo: {\n algorithm: algorithm,\n parameters: forge.util.bytesToHex(iv).toUpperCase()\n },\n body: cipher.output.getBytes()\n };\n return forge.pem.encode(msg);\n};\n\n/**\n * Decrypts an RSA private key.\n *\n * @param pem the PEM-formatted EncryptedPrivateKeyInfo to decrypt.\n * @param password the password to use.\n *\n * @return the RSA key on success, null on failure.\n */\npki.decryptRsaPrivateKey = function(pem, password) {\n var rval = null;\n\n var msg = forge.pem.decode(pem)[0];\n\n if(msg.type !== 'ENCRYPTED PRIVATE KEY' &&\n msg.type !== 'PRIVATE KEY' &&\n msg.type !== 'RSA PRIVATE KEY') {\n var error = new Error('Could not convert private key from PEM; PEM header type ' +\n 'is not \"ENCRYPTED PRIVATE KEY\", \"PRIVATE KEY\", or \"RSA PRIVATE KEY\".');\n error.headerType = error;\n throw error;\n }\n\n if(msg.procType && msg.procType.type === 'ENCRYPTED') {\n var dkLen;\n var cipherFn;\n switch(msg.dekInfo.algorithm) {\n case 'DES-CBC':\n dkLen = 8;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n case 'DES-EDE3-CBC':\n dkLen = 24;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n case 'AES-128-CBC':\n dkLen = 16;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'AES-192-CBC':\n dkLen = 24;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'AES-256-CBC':\n dkLen = 32;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'RC2-40-CBC':\n dkLen = 5;\n cipherFn = function(key) {\n return forge.rc2.createDecryptionCipher(key, 40);\n };\n break;\n case 'RC2-64-CBC':\n dkLen = 8;\n cipherFn = function(key) {\n return forge.rc2.createDecryptionCipher(key, 64);\n };\n break;\n case 'RC2-128-CBC':\n dkLen = 16;\n cipherFn = function(key) {\n return forge.rc2.createDecryptionCipher(key, 128);\n };\n break;\n default:\n var error = new Error('Could not decrypt private key; unsupported ' +\n 'encryption algorithm \"' + msg.dekInfo.algorithm + '\".');\n error.algorithm = msg.dekInfo.algorithm;\n throw error;\n }\n\n // use OpenSSL legacy key derivation\n var iv = forge.util.hexToBytes(msg.dekInfo.parameters);\n var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen);\n var cipher = cipherFn(dk);\n cipher.start(iv);\n cipher.update(forge.util.createBuffer(msg.body));\n if(cipher.finish()) {\n rval = cipher.output.getBytes();\n } else {\n return rval;\n }\n } else {\n rval = msg.body;\n }\n\n if(msg.type === 'ENCRYPTED PRIVATE KEY') {\n rval = pki.decryptPrivateKeyInfo(asn1.fromDer(rval), password);\n } else {\n // decryption already performed above\n rval = asn1.fromDer(rval);\n }\n\n if(rval !== null) {\n rval = pki.privateKeyFromAsn1(rval);\n }\n\n return rval;\n};\n\n/**\n * Derives a PKCS#12 key.\n *\n * @param password the password to derive the key material from, null or\n * undefined for none.\n * @param salt the salt, as a ByteBuffer, to use.\n * @param id the PKCS#12 ID byte (1 = key material, 2 = IV, 3 = MAC).\n * @param iter the iteration count.\n * @param n the number of bytes to derive from the password.\n * @param md the message digest to use, defaults to SHA-1.\n *\n * @return a ByteBuffer with the bytes derived from the password.\n */\npki.pbe.generatePkcs12Key = function(password, salt, id, iter, n, md) {\n var j, l;\n\n if(typeof md === 'undefined' || md === null) {\n if(!('sha1' in forge.md)) {\n throw new Error('\"sha1\" hash algorithm unavailable.');\n }\n md = forge.md.sha1.create();\n }\n\n var u = md.digestLength;\n var v = md.blockLength;\n var result = new forge.util.ByteBuffer();\n\n /* Convert password to Unicode byte buffer + trailing 0-byte. */\n var passBuf = new forge.util.ByteBuffer();\n if(password !== null && password !== undefined) {\n for(l = 0; l < password.length; l++) {\n passBuf.putInt16(password.charCodeAt(l));\n }\n passBuf.putInt16(0);\n }\n\n /* Length of salt and password in BYTES. */\n var p = passBuf.length();\n var s = salt.length();\n\n /* 1. Construct a string, D (the \"diversifier\"), by concatenating\n v copies of ID. */\n var D = new forge.util.ByteBuffer();\n D.fillWithByte(id, v);\n\n /* 2. Concatenate copies of the salt together to create a string S of length\n v * ceil(s / v) bytes (the final copy of the salt may be trunacted\n to create S).\n Note that if the salt is the empty string, then so is S. */\n var Slen = v * Math.ceil(s / v);\n var S = new forge.util.ByteBuffer();\n for(l = 0; l < Slen; l++) {\n S.putByte(salt.at(l % s));\n }\n\n /* 3. Concatenate copies of the password together to create a string P of\n length v * ceil(p / v) bytes (the final copy of the password may be\n truncated to create P).\n Note that if the password is the empty string, then so is P. */\n var Plen = v * Math.ceil(p / v);\n var P = new forge.util.ByteBuffer();\n for(l = 0; l < Plen; l++) {\n P.putByte(passBuf.at(l % p));\n }\n\n /* 4. Set I=S||P to be the concatenation of S and P. */\n var I = S;\n I.putBuffer(P);\n\n /* 5. Set c=ceil(n / u). */\n var c = Math.ceil(n / u);\n\n /* 6. For i=1, 2, ..., c, do the following: */\n for(var i = 1; i <= c; i++) {\n /* a) Set Ai=H^r(D||I). (l.e. the rth hash of D||I, H(H(H(...H(D||I)))) */\n var buf = new forge.util.ByteBuffer();\n buf.putBytes(D.bytes());\n buf.putBytes(I.bytes());\n for(var round = 0; round < iter; round++) {\n md.start();\n md.update(buf.getBytes());\n buf = md.digest();\n }\n\n /* b) Concatenate copies of Ai to create a string B of length v bytes (the\n final copy of Ai may be truncated to create B). */\n var B = new forge.util.ByteBuffer();\n for(l = 0; l < v; l++) {\n B.putByte(buf.at(l % u));\n }\n\n /* c) Treating I as a concatenation I0, I1, ..., Ik-1 of v-byte blocks,\n where k=ceil(s / v) + ceil(p / v), modify I by setting\n Ij=(Ij+B+1) mod 2v for each j. */\n var k = Math.ceil(s / v) + Math.ceil(p / v);\n var Inew = new forge.util.ByteBuffer();\n for(j = 0; j < k; j++) {\n var chunk = new forge.util.ByteBuffer(I.getBytes(v));\n var x = 0x1ff;\n for(l = B.length() - 1; l >= 0; l--) {\n x = x >> 8;\n x += B.at(l) + chunk.at(l);\n chunk.setAt(l, x & 0xff);\n }\n Inew.putBuffer(chunk);\n }\n I = Inew;\n\n /* Add Ai to A. */\n result.putBuffer(buf);\n }\n\n result.truncate(result.length() - n);\n return result;\n};\n\n/**\n * Get new Forge cipher object instance.\n *\n * @param oid the OID (in string notation).\n * @param params the ASN.1 params object.\n * @param password the password to decrypt with.\n *\n * @return new cipher object instance.\n */\npki.pbe.getCipher = function(oid, params, password) {\n switch(oid) {\n case pki.oids['pkcs5PBES2']:\n return pki.pbe.getCipherForPBES2(oid, params, password);\n\n case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']:\n case pki.oids['pbewithSHAAnd40BitRC2-CBC']:\n return pki.pbe.getCipherForPKCS12PBE(oid, params, password);\n\n default:\n var error = new Error('Cannot read encrypted PBE data block. Unsupported OID.');\n error.oid = oid;\n error.supportedOids = [\n 'pkcs5PBES2',\n 'pbeWithSHAAnd3-KeyTripleDES-CBC',\n 'pbewithSHAAnd40BitRC2-CBC'\n ];\n throw error;\n }\n};\n\n/**\n * Get new Forge cipher object instance according to PBES2 params block.\n *\n * The returned cipher instance is already started using the IV\n * from PBES2 parameter block.\n *\n * @param oid the PKCS#5 PBKDF2 OID (in string notation).\n * @param params the ASN.1 PBES2-params object.\n * @param password the password to decrypt with.\n *\n * @return new cipher object instance.\n */\npki.pbe.getCipherForPBES2 = function(oid, params, password) {\n // get PBE params\n var capture = {};\n var errors = [];\n if(!asn1.validate(params, PBES2AlgorithmsValidator, capture, errors)) {\n var error = new Error('Cannot read password-based-encryption algorithm ' +\n 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.');\n error.errors = errors;\n throw error;\n }\n\n // check oids\n oid = asn1.derToOid(capture.kdfOid);\n if(oid !== pki.oids['pkcs5PBKDF2']) {\n var error = new Error('Cannot read encrypted private key. ' +\n 'Unsupported key derivation function OID.');\n error.oid = oid;\n error.supportedOids = ['pkcs5PBKDF2'];\n throw error;\n }\n oid = asn1.derToOid(capture.encOid);\n if(oid !== pki.oids['aes128-CBC'] &&\n oid !== pki.oids['aes192-CBC'] &&\n oid !== pki.oids['aes256-CBC'] &&\n oid !== pki.oids['des-EDE3-CBC'] &&\n oid !== pki.oids['desCBC']) {\n var error = new Error('Cannot read encrypted private key. ' +\n 'Unsupported encryption scheme OID.');\n error.oid = oid;\n error.supportedOids = [\n 'aes128-CBC', 'aes192-CBC', 'aes256-CBC', 'des-EDE3-CBC', 'desCBC'];\n throw error;\n }\n\n // set PBE params\n var salt = capture.kdfSalt;\n var count = forge.util.createBuffer(capture.kdfIterationCount);\n count = count.getInt(count.length() << 3);\n var dkLen;\n var cipherFn;\n switch(pki.oids[oid]) {\n case 'aes128-CBC':\n dkLen = 16;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'aes192-CBC':\n dkLen = 24;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'aes256-CBC':\n dkLen = 32;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'des-EDE3-CBC':\n dkLen = 24;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n case 'desCBC':\n dkLen = 8;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n }\n\n // get PRF message digest\n var md = prfOidToMessageDigest(capture.prfOid);\n\n // decrypt private key using pbe with chosen PRF and AES/DES\n var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md);\n var iv = capture.encIv;\n var cipher = cipherFn(dk);\n cipher.start(iv);\n\n return cipher;\n};\n\n/**\n * Get new Forge cipher object instance for PKCS#12 PBE.\n *\n * The returned cipher instance is already started using the key & IV\n * derived from the provided password and PKCS#12 PBE salt.\n *\n * @param oid The PKCS#12 PBE OID (in string notation).\n * @param params The ASN.1 PKCS#12 PBE-params object.\n * @param password The password to decrypt with.\n *\n * @return the new cipher object instance.\n */\npki.pbe.getCipherForPKCS12PBE = function(oid, params, password) {\n // get PBE params\n var capture = {};\n var errors = [];\n if(!asn1.validate(params, pkcs12PbeParamsValidator, capture, errors)) {\n var error = new Error('Cannot read password-based-encryption algorithm ' +\n 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.');\n error.errors = errors;\n throw error;\n }\n\n var salt = forge.util.createBuffer(capture.salt);\n var count = forge.util.createBuffer(capture.iterations);\n count = count.getInt(count.length() << 3);\n\n var dkLen, dIvLen, cipherFn;\n switch(oid) {\n case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']:\n dkLen = 24;\n dIvLen = 8;\n cipherFn = forge.des.startDecrypting;\n break;\n\n case pki.oids['pbewithSHAAnd40BitRC2-CBC']:\n dkLen = 5;\n dIvLen = 8;\n cipherFn = function(key, iv) {\n var cipher = forge.rc2.createDecryptionCipher(key, 40);\n cipher.start(iv, null);\n return cipher;\n };\n break;\n\n default:\n var error = new Error('Cannot read PKCS #12 PBE data block. Unsupported OID.');\n error.oid = oid;\n throw error;\n }\n\n // get PRF message digest\n var md = prfOidToMessageDigest(capture.prfOid);\n var key = pki.pbe.generatePkcs12Key(password, salt, 1, count, dkLen, md);\n md.start();\n var iv = pki.pbe.generatePkcs12Key(password, salt, 2, count, dIvLen, md);\n\n return cipherFn(key, iv);\n};\n\n/**\n * OpenSSL's legacy key derivation function.\n *\n * See: http://www.openssl.org/docs/crypto/EVP_BytesToKey.html\n *\n * @param password the password to derive the key from.\n * @param salt the salt to use, null for none.\n * @param dkLen the number of bytes needed for the derived key.\n * @param [options] the options to use:\n * [md] an optional message digest object to use.\n */\npki.pbe.opensslDeriveBytes = function(password, salt, dkLen, md) {\n if(typeof md === 'undefined' || md === null) {\n if(!('md5' in forge.md)) {\n throw new Error('\"md5\" hash algorithm unavailable.');\n }\n md = forge.md.md5.create();\n }\n if(salt === null) {\n salt = '';\n }\n var digests = [hash(md, password + salt)];\n for(var length = 16, i = 1; length < dkLen; ++i, length += 16) {\n digests.push(hash(md, digests[i - 1] + password + salt));\n }\n return digests.join('').substr(0, dkLen);\n};\n\nfunction hash(md, bytes) {\n return md.start().update(bytes).digest().getBytes();\n}\n\nfunction prfOidToMessageDigest(prfOid) {\n // get PRF algorithm, default to SHA-1\n var prfAlgorithm;\n if(!prfOid) {\n prfAlgorithm = 'hmacWithSHA1';\n } else {\n prfAlgorithm = pki.oids[asn1.derToOid(prfOid)];\n if(!prfAlgorithm) {\n var error = new Error('Unsupported PRF OID.');\n error.oid = prfOid;\n error.supported = [\n 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384',\n 'hmacWithSHA512'];\n throw error;\n }\n }\n return prfAlgorithmToMessageDigest(prfAlgorithm);\n}\n\nfunction prfAlgorithmToMessageDigest(prfAlgorithm) {\n var factory = forge.md;\n switch(prfAlgorithm) {\n case 'hmacWithSHA224':\n factory = forge.md.sha512;\n case 'hmacWithSHA1':\n case 'hmacWithSHA256':\n case 'hmacWithSHA384':\n case 'hmacWithSHA512':\n prfAlgorithm = prfAlgorithm.substr(8).toLowerCase();\n break;\n default:\n var error = new Error('Unsupported PRF algorithm.');\n error.algorithm = prfAlgorithm;\n error.supported = [\n 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384',\n 'hmacWithSHA512'];\n throw error;\n }\n if(!factory || !(prfAlgorithm in factory)) {\n throw new Error('Unknown hash algorithm: ' + prfAlgorithm);\n }\n return factory[prfAlgorithm].create();\n}\n\nfunction createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm) {\n var params = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // salt\n asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt),\n // iteration count\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n countBytes.getBytes())\n ]);\n // when PRF algorithm is not SHA-1 default, add key length and PRF algorithm\n if(prfAlgorithm !== 'hmacWithSHA1') {\n params.value.push(\n // key length\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n forge.util.hexToBytes(dkLen.toString(16))),\n // AlgorithmIdentifier\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // algorithm\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(pki.oids[prfAlgorithm]).getBytes()),\n // parameters (null)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')\n ]));\n }\n return params;\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/pbe.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/pbkdf2.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/pbkdf2.js ***!
|
||
\***********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Password-Based Key-Derivation Function #2 implementation.\n *\n * See RFC 2898 for details.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2013 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./hmac */ \"./node_modules/node-forge/lib/hmac.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar pkcs5 = forge.pkcs5 = forge.pkcs5 || {};\n\nvar crypto;\nif(forge.util.isNodejs && !forge.options.usePureJavaScript) {\n crypto = __webpack_require__(/*! crypto */ \"?b254\");\n}\n\n/**\n * Derives a key from a password.\n *\n * @param p the password as a binary-encoded string of bytes.\n * @param s the salt as a binary-encoded string of bytes.\n * @param c the iteration count, a positive integer.\n * @param dkLen the intended length, in bytes, of the derived key,\n * (max: 2^32 - 1) * hash length of the PRF.\n * @param [md] the message digest (or algorithm identifier as a string) to use\n * in the PRF, defaults to SHA-1.\n * @param [callback(err, key)] presence triggers asynchronous version, called\n * once the operation completes.\n *\n * @return the derived key, as a binary-encoded string of bytes, for the\n * synchronous version (if no callback is specified).\n */\nmodule.exports = forge.pbkdf2 = pkcs5.pbkdf2 = function(\n p, s, c, dkLen, md, callback) {\n if(typeof md === 'function') {\n callback = md;\n md = null;\n }\n\n // use native implementation if possible and not disabled, note that\n // some node versions only support SHA-1, others allow digest to be changed\n if(forge.util.isNodejs && !forge.options.usePureJavaScript &&\n crypto.pbkdf2 && (md === null || typeof md !== 'object') &&\n (crypto.pbkdf2Sync.length > 4 || (!md || md === 'sha1'))) {\n if(typeof md !== 'string') {\n // default prf to SHA-1\n md = 'sha1';\n }\n p = Buffer.from(p, 'binary');\n s = Buffer.from(s, 'binary');\n if(!callback) {\n if(crypto.pbkdf2Sync.length === 4) {\n return crypto.pbkdf2Sync(p, s, c, dkLen).toString('binary');\n }\n return crypto.pbkdf2Sync(p, s, c, dkLen, md).toString('binary');\n }\n if(crypto.pbkdf2Sync.length === 4) {\n return crypto.pbkdf2(p, s, c, dkLen, function(err, key) {\n if(err) {\n return callback(err);\n }\n callback(null, key.toString('binary'));\n });\n }\n return crypto.pbkdf2(p, s, c, dkLen, md, function(err, key) {\n if(err) {\n return callback(err);\n }\n callback(null, key.toString('binary'));\n });\n }\n\n if(typeof md === 'undefined' || md === null) {\n // default prf to SHA-1\n md = 'sha1';\n }\n if(typeof md === 'string') {\n if(!(md in forge.md.algorithms)) {\n throw new Error('Unknown hash algorithm: ' + md);\n }\n md = forge.md[md].create();\n }\n\n var hLen = md.digestLength;\n\n /* 1. If dkLen > (2^32 - 1) * hLen, output \"derived key too long\" and\n stop. */\n if(dkLen > (0xFFFFFFFF * hLen)) {\n var err = new Error('Derived key is too long.');\n if(callback) {\n return callback(err);\n }\n throw err;\n }\n\n /* 2. Let len be the number of hLen-octet blocks in the derived key,\n rounding up, and let r be the number of octets in the last\n block:\n\n len = CEIL(dkLen / hLen),\n r = dkLen - (len - 1) * hLen. */\n var len = Math.ceil(dkLen / hLen);\n var r = dkLen - (len - 1) * hLen;\n\n /* 3. For each block of the derived key apply the function F defined\n below to the password P, the salt S, the iteration count c, and\n the block index to compute the block:\n\n T_1 = F(P, S, c, 1),\n T_2 = F(P, S, c, 2),\n ...\n T_len = F(P, S, c, len),\n\n where the function F is defined as the exclusive-or sum of the\n first c iterates of the underlying pseudorandom function PRF\n applied to the password P and the concatenation of the salt S\n and the block index i:\n\n F(P, S, c, i) = u_1 XOR u_2 XOR ... XOR u_c\n\n where\n\n u_1 = PRF(P, S || INT(i)),\n u_2 = PRF(P, u_1),\n ...\n u_c = PRF(P, u_{c-1}).\n\n Here, INT(i) is a four-octet encoding of the integer i, most\n significant octet first. */\n var prf = forge.hmac.create();\n prf.start(md, p);\n var dk = '';\n var xor, u_c, u_c1;\n\n // sync version\n if(!callback) {\n for(var i = 1; i <= len; ++i) {\n // PRF(P, S || INT(i)) (first iteration)\n prf.start(null, null);\n prf.update(s);\n prf.update(forge.util.int32ToBytes(i));\n xor = u_c1 = prf.digest().getBytes();\n\n // PRF(P, u_{c-1}) (other iterations)\n for(var j = 2; j <= c; ++j) {\n prf.start(null, null);\n prf.update(u_c1);\n u_c = prf.digest().getBytes();\n // F(p, s, c, i)\n xor = forge.util.xorBytes(xor, u_c, hLen);\n u_c1 = u_c;\n }\n\n /* 4. Concatenate the blocks and extract the first dkLen octets to\n produce a derived key DK:\n\n DK = T_1 || T_2 || ... || T_len<0..r-1> */\n dk += (i < len) ? xor : xor.substr(0, r);\n }\n /* 5. Output the derived key DK. */\n return dk;\n }\n\n // async version\n var i = 1, j;\n function outer() {\n if(i > len) {\n // done\n return callback(null, dk);\n }\n\n // PRF(P, S || INT(i)) (first iteration)\n prf.start(null, null);\n prf.update(s);\n prf.update(forge.util.int32ToBytes(i));\n xor = u_c1 = prf.digest().getBytes();\n\n // PRF(P, u_{c-1}) (other iterations)\n j = 2;\n inner();\n }\n\n function inner() {\n if(j <= c) {\n prf.start(null, null);\n prf.update(u_c1);\n u_c = prf.digest().getBytes();\n // F(p, s, c, i)\n xor = forge.util.xorBytes(xor, u_c, hLen);\n u_c1 = u_c;\n ++j;\n return forge.util.setImmediate(inner);\n }\n\n /* 4. Concatenate the blocks and extract the first dkLen octets to\n produce a derived key DK:\n\n DK = T_1 || T_2 || ... || T_len<0..r-1> */\n dk += (i < len) ? xor : xor.substr(0, r);\n\n ++i;\n outer();\n }\n\n outer();\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/pbkdf2.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/pem.js":
|
||
/*!********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/pem.js ***!
|
||
\********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Javascript implementation of basic PEM (Privacy Enhanced Mail) algorithms.\n *\n * See: RFC 1421.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2013-2014 Digital Bazaar, Inc.\n *\n * A Forge PEM object has the following fields:\n *\n * type: identifies the type of message (eg: \"RSA PRIVATE KEY\").\n *\n * procType: identifies the type of processing performed on the message,\n * it has two subfields: version and type, eg: 4,ENCRYPTED.\n *\n * contentDomain: identifies the type of content in the message, typically\n * only uses the value: \"RFC822\".\n *\n * dekInfo: identifies the message encryption algorithm and mode and includes\n * any parameters for the algorithm, it has two subfields: algorithm and\n * parameters, eg: DES-CBC,F8143EDE5960C597.\n *\n * headers: contains all other PEM encapsulated headers -- where order is\n * significant (for pairing data like recipient ID + key info).\n *\n * body: the binary-encoded body.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\n// shortcut for pem API\nvar pem = module.exports = forge.pem = forge.pem || {};\n\n/**\n * Encodes (serializes) the given PEM object.\n *\n * @param msg the PEM message object to encode.\n * @param options the options to use:\n * maxline the maximum characters per line for the body, (default: 64).\n *\n * @return the PEM-formatted string.\n */\npem.encode = function(msg, options) {\n options = options || {};\n var rval = '-----BEGIN ' + msg.type + '-----\\r\\n';\n\n // encode special headers\n var header;\n if(msg.procType) {\n header = {\n name: 'Proc-Type',\n values: [String(msg.procType.version), msg.procType.type]\n };\n rval += foldHeader(header);\n }\n if(msg.contentDomain) {\n header = {name: 'Content-Domain', values: [msg.contentDomain]};\n rval += foldHeader(header);\n }\n if(msg.dekInfo) {\n header = {name: 'DEK-Info', values: [msg.dekInfo.algorithm]};\n if(msg.dekInfo.parameters) {\n header.values.push(msg.dekInfo.parameters);\n }\n rval += foldHeader(header);\n }\n\n if(msg.headers) {\n // encode all other headers\n for(var i = 0; i < msg.headers.length; ++i) {\n rval += foldHeader(msg.headers[i]);\n }\n }\n\n // terminate header\n if(msg.procType) {\n rval += '\\r\\n';\n }\n\n // add body\n rval += forge.util.encode64(msg.body, options.maxline || 64) + '\\r\\n';\n\n rval += '-----END ' + msg.type + '-----\\r\\n';\n return rval;\n};\n\n/**\n * Decodes (deserializes) all PEM messages found in the given string.\n *\n * @param str the PEM-formatted string to decode.\n *\n * @return the PEM message objects in an array.\n */\npem.decode = function(str) {\n var rval = [];\n\n // split string into PEM messages (be lenient w/EOF on BEGIN line)\n var rMessage = /\\s*-----BEGIN ([A-Z0-9- ]+)-----\\r?\\n?([\\x21-\\x7e\\s]+?(?:\\r?\\n\\r?\\n))?([:A-Za-z0-9+\\/=\\s]+?)-----END \\1-----/g;\n var rHeader = /([\\x21-\\x7e]+):\\s*([\\x21-\\x7e\\s^:]+)/;\n var rCRLF = /\\r?\\n/;\n var match;\n while(true) {\n match = rMessage.exec(str);\n if(!match) {\n break;\n }\n\n // accept \"NEW CERTIFICATE REQUEST\" as \"CERTIFICATE REQUEST\"\n // https://datatracker.ietf.org/doc/html/rfc7468#section-7\n var type = match[1];\n if(type === 'NEW CERTIFICATE REQUEST') {\n type = 'CERTIFICATE REQUEST';\n }\n\n var msg = {\n type: type,\n procType: null,\n contentDomain: null,\n dekInfo: null,\n headers: [],\n body: forge.util.decode64(match[3])\n };\n rval.push(msg);\n\n // no headers\n if(!match[2]) {\n continue;\n }\n\n // parse headers\n var lines = match[2].split(rCRLF);\n var li = 0;\n while(match && li < lines.length) {\n // get line, trim any rhs whitespace\n var line = lines[li].replace(/\\s+$/, '');\n\n // RFC2822 unfold any following folded lines\n for(var nl = li + 1; nl < lines.length; ++nl) {\n var next = lines[nl];\n if(!/\\s/.test(next[0])) {\n break;\n }\n line += next;\n li = nl;\n }\n\n // parse header\n match = line.match(rHeader);\n if(match) {\n var header = {name: match[1], values: []};\n var values = match[2].split(',');\n for(var vi = 0; vi < values.length; ++vi) {\n header.values.push(ltrim(values[vi]));\n }\n\n // Proc-Type must be the first header\n if(!msg.procType) {\n if(header.name !== 'Proc-Type') {\n throw new Error('Invalid PEM formatted message. The first ' +\n 'encapsulated header must be \"Proc-Type\".');\n } else if(header.values.length !== 2) {\n throw new Error('Invalid PEM formatted message. The \"Proc-Type\" ' +\n 'header must have two subfields.');\n }\n msg.procType = {version: values[0], type: values[1]};\n } else if(!msg.contentDomain && header.name === 'Content-Domain') {\n // special-case Content-Domain\n msg.contentDomain = values[0] || '';\n } else if(!msg.dekInfo && header.name === 'DEK-Info') {\n // special-case DEK-Info\n if(header.values.length === 0) {\n throw new Error('Invalid PEM formatted message. The \"DEK-Info\" ' +\n 'header must have at least one subfield.');\n }\n msg.dekInfo = {algorithm: values[0], parameters: values[1] || null};\n } else {\n msg.headers.push(header);\n }\n }\n\n ++li;\n }\n\n if(msg.procType === 'ENCRYPTED' && !msg.dekInfo) {\n throw new Error('Invalid PEM formatted message. The \"DEK-Info\" ' +\n 'header must be present if \"Proc-Type\" is \"ENCRYPTED\".');\n }\n }\n\n if(rval.length === 0) {\n throw new Error('Invalid PEM formatted message.');\n }\n\n return rval;\n};\n\nfunction foldHeader(header) {\n var rval = header.name + ': ';\n\n // ensure values with CRLF are folded\n var values = [];\n var insertSpace = function(match, $1) {\n return ' ' + $1;\n };\n for(var i = 0; i < header.values.length; ++i) {\n values.push(header.values[i].replace(/^(\\S+\\r\\n)/, insertSpace));\n }\n rval += values.join(',') + '\\r\\n';\n\n // do folding\n var length = 0;\n var candidate = -1;\n for(var i = 0; i < rval.length; ++i, ++length) {\n if(length > 65 && candidate !== -1) {\n var insert = rval[candidate];\n if(insert === ',') {\n ++candidate;\n rval = rval.substr(0, candidate) + '\\r\\n ' + rval.substr(candidate);\n } else {\n rval = rval.substr(0, candidate) +\n '\\r\\n' + insert + rval.substr(candidate + 1);\n }\n length = (i - candidate - 1);\n candidate = -1;\n ++i;\n } else if(rval[i] === ' ' || rval[i] === '\\t' || rval[i] === ',') {\n candidate = i;\n }\n }\n\n return rval;\n}\n\nfunction ltrim(str) {\n return str.replace(/^\\s+/, '');\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/pem.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/pkcs1.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/pkcs1.js ***!
|
||
\**********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Partial implementation of PKCS#1 v2.2: RSA-OEAP\n *\n * Modified but based on the following MIT and BSD licensed code:\n *\n * https://github.com/kjur/jsjws/blob/master/rsa.js:\n *\n * The 'jsjws'(JSON Web Signature JavaScript Library) License\n *\n * Copyright (c) 2012 Kenji Urushima\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * http://webrsa.cvs.sourceforge.net/viewvc/webrsa/Client/RSAES-OAEP.js?content-type=text%2Fplain:\n *\n * RSAES-OAEP.js\n * $Id: RSAES-OAEP.js,v 1.1.1.1 2003/03/19 15:37:20 ellispritchard Exp $\n * JavaScript Implementation of PKCS #1 v2.1 RSA CRYPTOGRAPHY STANDARD (RSA Laboratories, June 14, 2002)\n * Copyright (C) Ellis Pritchard, Guardian Unlimited 2003.\n * Contact: ellis@nukinetics.com\n * Distributed under the BSD License.\n *\n * Official documentation: http://www.rsa.com/rsalabs/node.asp?id=2125\n *\n * @author Evan Jones (http://evanjones.ca/)\n * @author Dave Longley\n *\n * Copyright (c) 2013-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n__webpack_require__(/*! ./random */ \"./node_modules/node-forge/lib/random.js\");\n__webpack_require__(/*! ./sha1 */ \"./node_modules/node-forge/lib/sha1.js\");\n\n// shortcut for PKCS#1 API\nvar pkcs1 = module.exports = forge.pkcs1 = forge.pkcs1 || {};\n\n/**\n * Encode the given RSAES-OAEP message (M) using key, with optional label (L)\n * and seed.\n *\n * This method does not perform RSA encryption, it only encodes the message\n * using RSAES-OAEP.\n *\n * @param key the RSA key to use.\n * @param message the message to encode.\n * @param options the options to use:\n * label an optional label to use.\n * seed the seed to use.\n * md the message digest object to use, undefined for SHA-1.\n * mgf1 optional mgf1 parameters:\n * md the message digest object to use for MGF1.\n *\n * @return the encoded message bytes.\n */\npkcs1.encode_rsa_oaep = function(key, message, options) {\n // parse arguments\n var label;\n var seed;\n var md;\n var mgf1Md;\n // legacy args (label, seed, md)\n if(typeof options === 'string') {\n label = options;\n seed = arguments[3] || undefined;\n md = arguments[4] || undefined;\n } else if(options) {\n label = options.label || undefined;\n seed = options.seed || undefined;\n md = options.md || undefined;\n if(options.mgf1 && options.mgf1.md) {\n mgf1Md = options.mgf1.md;\n }\n }\n\n // default OAEP to SHA-1 message digest\n if(!md) {\n md = forge.md.sha1.create();\n } else {\n md.start();\n }\n\n // default MGF-1 to same as OAEP\n if(!mgf1Md) {\n mgf1Md = md;\n }\n\n // compute length in bytes and check output\n var keyLength = Math.ceil(key.n.bitLength() / 8);\n var maxLength = keyLength - 2 * md.digestLength - 2;\n if(message.length > maxLength) {\n var error = new Error('RSAES-OAEP input message length is too long.');\n error.length = message.length;\n error.maxLength = maxLength;\n throw error;\n }\n\n if(!label) {\n label = '';\n }\n md.update(label, 'raw');\n var lHash = md.digest();\n\n var PS = '';\n var PS_length = maxLength - message.length;\n for(var i = 0; i < PS_length; i++) {\n PS += '\\x00';\n }\n\n var DB = lHash.getBytes() + PS + '\\x01' + message;\n\n if(!seed) {\n seed = forge.random.getBytes(md.digestLength);\n } else if(seed.length !== md.digestLength) {\n var error = new Error('Invalid RSAES-OAEP seed. The seed length must ' +\n 'match the digest length.');\n error.seedLength = seed.length;\n error.digestLength = md.digestLength;\n throw error;\n }\n\n var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md);\n var maskedDB = forge.util.xorBytes(DB, dbMask, DB.length);\n\n var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md);\n var maskedSeed = forge.util.xorBytes(seed, seedMask, seed.length);\n\n // return encoded message\n return '\\x00' + maskedSeed + maskedDB;\n};\n\n/**\n * Decode the given RSAES-OAEP encoded message (EM) using key, with optional\n * label (L).\n *\n * This method does not perform RSA decryption, it only decodes the message\n * using RSAES-OAEP.\n *\n * @param key the RSA key to use.\n * @param em the encoded message to decode.\n * @param options the options to use:\n * label an optional label to use.\n * md the message digest object to use for OAEP, undefined for SHA-1.\n * mgf1 optional mgf1 parameters:\n * md the message digest object to use for MGF1.\n *\n * @return the decoded message bytes.\n */\npkcs1.decode_rsa_oaep = function(key, em, options) {\n // parse args\n var label;\n var md;\n var mgf1Md;\n // legacy args\n if(typeof options === 'string') {\n label = options;\n md = arguments[3] || undefined;\n } else if(options) {\n label = options.label || undefined;\n md = options.md || undefined;\n if(options.mgf1 && options.mgf1.md) {\n mgf1Md = options.mgf1.md;\n }\n }\n\n // compute length in bytes\n var keyLength = Math.ceil(key.n.bitLength() / 8);\n\n if(em.length !== keyLength) {\n var error = new Error('RSAES-OAEP encoded message length is invalid.');\n error.length = em.length;\n error.expectedLength = keyLength;\n throw error;\n }\n\n // default OAEP to SHA-1 message digest\n if(md === undefined) {\n md = forge.md.sha1.create();\n } else {\n md.start();\n }\n\n // default MGF-1 to same as OAEP\n if(!mgf1Md) {\n mgf1Md = md;\n }\n\n if(keyLength < 2 * md.digestLength + 2) {\n throw new Error('RSAES-OAEP key is too short for the hash function.');\n }\n\n if(!label) {\n label = '';\n }\n md.update(label, 'raw');\n var lHash = md.digest().getBytes();\n\n // split the message into its parts\n var y = em.charAt(0);\n var maskedSeed = em.substring(1, md.digestLength + 1);\n var maskedDB = em.substring(1 + md.digestLength);\n\n var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md);\n var seed = forge.util.xorBytes(maskedSeed, seedMask, maskedSeed.length);\n\n var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md);\n var db = forge.util.xorBytes(maskedDB, dbMask, maskedDB.length);\n\n var lHashPrime = db.substring(0, md.digestLength);\n\n // constant time check that all values match what is expected\n var error = (y !== '\\x00');\n\n // constant time check lHash vs lHashPrime\n for(var i = 0; i < md.digestLength; ++i) {\n error |= (lHash.charAt(i) !== lHashPrime.charAt(i));\n }\n\n // \"constant time\" find the 0x1 byte separating the padding (zeros) from the\n // message\n // TODO: It must be possible to do this in a better/smarter way?\n var in_ps = 1;\n var index = md.digestLength;\n for(var j = md.digestLength; j < db.length; j++) {\n var code = db.charCodeAt(j);\n\n var is_0 = (code & 0x1) ^ 0x1;\n\n // non-zero if not 0 or 1 in the ps section\n var error_mask = in_ps ? 0xfffe : 0x0000;\n error |= (code & error_mask);\n\n // latch in_ps to zero after we find 0x1\n in_ps = in_ps & is_0;\n index += in_ps;\n }\n\n if(error || db.charCodeAt(index) !== 0x1) {\n throw new Error('Invalid RSAES-OAEP padding.');\n }\n\n return db.substring(index + 1);\n};\n\nfunction rsa_mgf1(seed, maskLength, hash) {\n // default to SHA-1 message digest\n if(!hash) {\n hash = forge.md.sha1.create();\n }\n var t = '';\n var count = Math.ceil(maskLength / hash.digestLength);\n for(var i = 0; i < count; ++i) {\n var c = String.fromCharCode(\n (i >> 24) & 0xFF, (i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF);\n hash.start();\n hash.update(seed + c);\n t += hash.digest().getBytes();\n }\n return t.substring(0, maskLength);\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/pkcs1.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/prime.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/prime.js ***!
|
||
\**********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Prime number generation API.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n__webpack_require__(/*! ./jsbn */ \"./node_modules/node-forge/lib/jsbn.js\");\n__webpack_require__(/*! ./random */ \"./node_modules/node-forge/lib/random.js\");\n\n(function() {\n\n// forge.prime already defined\nif(forge.prime) {\n module.exports = forge.prime;\n return;\n}\n\n/* PRIME API */\nvar prime = module.exports = forge.prime = forge.prime || {};\n\nvar BigInteger = forge.jsbn.BigInteger;\n\n// primes are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29\nvar GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2];\nvar THIRTY = new BigInteger(null);\nTHIRTY.fromInt(30);\nvar op_or = function(x, y) {return x|y;};\n\n/**\n * Generates a random probable prime with the given number of bits.\n *\n * Alternative algorithms can be specified by name as a string or as an\n * object with custom options like so:\n *\n * {\n * name: 'PRIMEINC',\n * options: {\n * maxBlockTime: <the maximum amount of time to block the main\n * thread before allowing I/O other JS to run>,\n * millerRabinTests: <the number of miller-rabin tests to run>,\n * workerScript: <the worker script URL>,\n * workers: <the number of web workers (if supported) to use,\n * -1 to use estimated cores minus one>.\n * workLoad: the size of the work load, ie: number of possible prime\n * numbers for each web worker to check per work assignment,\n * (default: 100).\n * }\n * }\n *\n * @param bits the number of bits for the prime number.\n * @param options the options to use.\n * [algorithm] the algorithm to use (default: 'PRIMEINC').\n * [prng] a custom crypto-secure pseudo-random number generator to use,\n * that must define \"getBytesSync\".\n *\n * @return callback(err, num) called once the operation completes.\n */\nprime.generateProbablePrime = function(bits, options, callback) {\n if(typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\n // default to PRIMEINC algorithm\n var algorithm = options.algorithm || 'PRIMEINC';\n if(typeof algorithm === 'string') {\n algorithm = {name: algorithm};\n }\n algorithm.options = algorithm.options || {};\n\n // create prng with api that matches BigInteger secure random\n var prng = options.prng || forge.random;\n var rng = {\n // x is an array to fill with bytes\n nextBytes: function(x) {\n var b = prng.getBytesSync(x.length);\n for(var i = 0; i < x.length; ++i) {\n x[i] = b.charCodeAt(i);\n }\n }\n };\n\n if(algorithm.name === 'PRIMEINC') {\n return primeincFindPrime(bits, rng, algorithm.options, callback);\n }\n\n throw new Error('Invalid prime generation algorithm: ' + algorithm.name);\n};\n\nfunction primeincFindPrime(bits, rng, options, callback) {\n if('workers' in options) {\n return primeincFindPrimeWithWorkers(bits, rng, options, callback);\n }\n return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);\n}\n\nfunction primeincFindPrimeWithoutWorkers(bits, rng, options, callback) {\n // initialize random number\n var num = generateRandom(bits, rng);\n\n /* Note: All primes are of the form 30k+i for i < 30 and gcd(30, i)=1. The\n number we are given is always aligned at 30k + 1. Each time the number is\n determined not to be prime we add to get to the next 'i', eg: if the number\n was at 30k + 1 we add 6. */\n var deltaIdx = 0;\n\n // get required number of MR tests\n var mrTests = getMillerRabinTests(num.bitLength());\n if('millerRabinTests' in options) {\n mrTests = options.millerRabinTests;\n }\n\n // find prime nearest to 'num' for maxBlockTime ms\n // 10 ms gives 5ms of leeway for other calculations before dropping\n // below 60fps (1000/60 == 16.67), but in reality, the number will\n // likely be higher due to an 'atomic' big int modPow\n var maxBlockTime = 10;\n if('maxBlockTime' in options) {\n maxBlockTime = options.maxBlockTime;\n }\n\n _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback);\n}\n\nfunction _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback) {\n var start = +new Date();\n do {\n // overflow, regenerate random number\n if(num.bitLength() > bits) {\n num = generateRandom(bits, rng);\n }\n // do primality test\n if(num.isProbablePrime(mrTests)) {\n return callback(null, num);\n }\n // get next potential prime\n num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0);\n } while(maxBlockTime < 0 || (+new Date() - start < maxBlockTime));\n\n // keep trying later\n forge.util.setImmediate(function() {\n _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback);\n });\n}\n\n// NOTE: This algorithm is indeterminate in nature because workers\n// run in parallel looking at different segments of numbers. Even if this\n// algorithm is run twice with the same input from a predictable RNG, it\n// may produce different outputs.\nfunction primeincFindPrimeWithWorkers(bits, rng, options, callback) {\n // web workers unavailable\n if(typeof Worker === 'undefined') {\n return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);\n }\n\n // initialize random number\n var num = generateRandom(bits, rng);\n\n // use web workers to generate keys\n var numWorkers = options.workers;\n var workLoad = options.workLoad || 100;\n var range = workLoad * 30 / 8;\n var workerScript = options.workerScript || 'forge/prime.worker.js';\n if(numWorkers === -1) {\n return forge.util.estimateCores(function(err, cores) {\n if(err) {\n // default to 2\n cores = 2;\n }\n numWorkers = cores - 1;\n generate();\n });\n }\n generate();\n\n function generate() {\n // require at least 1 worker\n numWorkers = Math.max(1, numWorkers);\n\n // TODO: consider optimizing by starting workers outside getPrime() ...\n // note that in order to clean up they will have to be made internally\n // asynchronous which may actually be slower\n\n // start workers immediately\n var workers = [];\n for(var i = 0; i < numWorkers; ++i) {\n // FIXME: fix path or use blob URLs\n workers[i] = new Worker(workerScript);\n }\n var running = numWorkers;\n\n // listen for requests from workers and assign ranges to find prime\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].addEventListener('message', workerMessage);\n }\n\n /* Note: The distribution of random numbers is unknown. Therefore, each\n web worker is continuously allocated a range of numbers to check for a\n random number until one is found.\n\n Every 30 numbers will be checked just 8 times, because prime numbers\n have the form:\n\n 30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this)\n\n Therefore, if we want a web worker to run N checks before asking for\n a new range of numbers, each range must contain N*30/8 numbers.\n\n For 100 checks (workLoad), this is a range of 375. */\n\n var found = false;\n function workerMessage(e) {\n // ignore message, prime already found\n if(found) {\n return;\n }\n\n --running;\n var data = e.data;\n if(data.found) {\n // terminate all workers\n for(var i = 0; i < workers.length; ++i) {\n workers[i].terminate();\n }\n found = true;\n return callback(null, new BigInteger(data.prime, 16));\n }\n\n // overflow, regenerate random number\n if(num.bitLength() > bits) {\n num = generateRandom(bits, rng);\n }\n\n // assign new range to check\n var hex = num.toString(16);\n\n // start prime search\n e.target.postMessage({\n hex: hex,\n workLoad: workLoad\n });\n\n num.dAddOffset(range, 0);\n }\n }\n}\n\n/**\n * Generates a random number using the given number of bits and RNG.\n *\n * @param bits the number of bits for the number.\n * @param rng the random number generator to use.\n *\n * @return the random number.\n */\nfunction generateRandom(bits, rng) {\n var num = new BigInteger(bits, rng);\n // force MSB set\n var bits1 = bits - 1;\n if(!num.testBit(bits1)) {\n num.bitwiseTo(BigInteger.ONE.shiftLeft(bits1), op_or, num);\n }\n // align number on 30k+1 boundary\n num.dAddOffset(31 - num.mod(THIRTY).byteValue(), 0);\n return num;\n}\n\n/**\n * Returns the required number of Miller-Rabin tests to generate a\n * prime with an error probability of (1/2)^80.\n *\n * See Handbook of Applied Cryptography Chapter 4, Table 4.4.\n *\n * @param bits the bit size.\n *\n * @return the required number of iterations.\n */\nfunction getMillerRabinTests(bits) {\n if(bits <= 100) return 27;\n if(bits <= 150) return 18;\n if(bits <= 200) return 15;\n if(bits <= 250) return 12;\n if(bits <= 300) return 9;\n if(bits <= 350) return 8;\n if(bits <= 400) return 7;\n if(bits <= 500) return 6;\n if(bits <= 600) return 5;\n if(bits <= 800) return 4;\n if(bits <= 1250) return 3;\n return 2;\n}\n\n})();\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/prime.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/prng.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/prng.js ***!
|
||
\*********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * A javascript implementation of a cryptographically-secure\n * Pseudo Random Number Generator (PRNG). The Fortuna algorithm is followed\n * here though the use of SHA-256 is not enforced; when generating an\n * a PRNG context, the hashing algorithm and block cipher used for\n * the generator are specified via a plugin.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar _crypto = null;\nif(forge.util.isNodejs && !forge.options.usePureJavaScript &&\n !process.versions['node-webkit']) {\n _crypto = __webpack_require__(/*! crypto */ \"?b254\");\n}\n\n/* PRNG API */\nvar prng = module.exports = forge.prng = forge.prng || {};\n\n/**\n * Creates a new PRNG context.\n *\n * A PRNG plugin must be passed in that will provide:\n *\n * 1. A function that initializes the key and seed of a PRNG context. It\n * will be given a 16 byte key and a 16 byte seed. Any key expansion\n * or transformation of the seed from a byte string into an array of\n * integers (or similar) should be performed.\n * 2. The cryptographic function used by the generator. It takes a key and\n * a seed.\n * 3. A seed increment function. It takes the seed and returns seed + 1.\n * 4. An api to create a message digest.\n *\n * For an example, see random.js.\n *\n * @param plugin the PRNG plugin to use.\n */\nprng.create = function(plugin) {\n var ctx = {\n plugin: plugin,\n key: null,\n seed: null,\n time: null,\n // number of reseeds so far\n reseeds: 0,\n // amount of data generated so far\n generated: 0,\n // no initial key bytes\n keyBytes: ''\n };\n\n // create 32 entropy pools (each is a message digest)\n var md = plugin.md;\n var pools = new Array(32);\n for(var i = 0; i < 32; ++i) {\n pools[i] = md.create();\n }\n ctx.pools = pools;\n\n // entropy pools are written to cyclically, starting at index 0\n ctx.pool = 0;\n\n /**\n * Generates random bytes. The bytes may be generated synchronously or\n * asynchronously. Web workers must use the asynchronous interface or\n * else the behavior is undefined.\n *\n * @param count the number of random bytes to generate.\n * @param [callback(err, bytes)] called once the operation completes.\n *\n * @return count random bytes as a string.\n */\n ctx.generate = function(count, callback) {\n // do synchronously\n if(!callback) {\n return ctx.generateSync(count);\n }\n\n // simple generator using counter-based CBC\n var cipher = ctx.plugin.cipher;\n var increment = ctx.plugin.increment;\n var formatKey = ctx.plugin.formatKey;\n var formatSeed = ctx.plugin.formatSeed;\n var b = forge.util.createBuffer();\n\n // paranoid deviation from Fortuna:\n // reset key for every request to protect previously\n // generated random bytes should the key be discovered;\n // there is no 100ms based reseeding because of this\n // forced reseed for every `generate` call\n ctx.key = null;\n\n generate();\n\n function generate(err) {\n if(err) {\n return callback(err);\n }\n\n // sufficient bytes generated\n if(b.length() >= count) {\n return callback(null, b.getBytes(count));\n }\n\n // if amount of data generated is greater than 1 MiB, trigger reseed\n if(ctx.generated > 0xfffff) {\n ctx.key = null;\n }\n\n if(ctx.key === null) {\n // prevent stack overflow\n return forge.util.nextTick(function() {\n _reseed(generate);\n });\n }\n\n // generate the random bytes\n var bytes = cipher(ctx.key, ctx.seed);\n ctx.generated += bytes.length;\n b.putBytes(bytes);\n\n // generate bytes for a new key and seed\n ctx.key = formatKey(cipher(ctx.key, increment(ctx.seed)));\n ctx.seed = formatSeed(cipher(ctx.key, ctx.seed));\n\n forge.util.setImmediate(generate);\n }\n };\n\n /**\n * Generates random bytes synchronously.\n *\n * @param count the number of random bytes to generate.\n *\n * @return count random bytes as a string.\n */\n ctx.generateSync = function(count) {\n // simple generator using counter-based CBC\n var cipher = ctx.plugin.cipher;\n var increment = ctx.plugin.increment;\n var formatKey = ctx.plugin.formatKey;\n var formatSeed = ctx.plugin.formatSeed;\n\n // paranoid deviation from Fortuna:\n // reset key for every request to protect previously\n // generated random bytes should the key be discovered;\n // there is no 100ms based reseeding because of this\n // forced reseed for every `generateSync` call\n ctx.key = null;\n\n var b = forge.util.createBuffer();\n while(b.length() < count) {\n // if amount of data generated is greater than 1 MiB, trigger reseed\n if(ctx.generated > 0xfffff) {\n ctx.key = null;\n }\n\n if(ctx.key === null) {\n _reseedSync();\n }\n\n // generate the random bytes\n var bytes = cipher(ctx.key, ctx.seed);\n ctx.generated += bytes.length;\n b.putBytes(bytes);\n\n // generate bytes for a new key and seed\n ctx.key = formatKey(cipher(ctx.key, increment(ctx.seed)));\n ctx.seed = formatSeed(cipher(ctx.key, ctx.seed));\n }\n\n return b.getBytes(count);\n };\n\n /**\n * Private function that asynchronously reseeds a generator.\n *\n * @param callback(err) called once the operation completes.\n */\n function _reseed(callback) {\n if(ctx.pools[0].messageLength >= 32) {\n _seed();\n return callback();\n }\n // not enough seed data...\n var needed = (32 - ctx.pools[0].messageLength) << 5;\n ctx.seedFile(needed, function(err, bytes) {\n if(err) {\n return callback(err);\n }\n ctx.collect(bytes);\n _seed();\n callback();\n });\n }\n\n /**\n * Private function that synchronously reseeds a generator.\n */\n function _reseedSync() {\n if(ctx.pools[0].messageLength >= 32) {\n return _seed();\n }\n // not enough seed data...\n var needed = (32 - ctx.pools[0].messageLength) << 5;\n ctx.collect(ctx.seedFileSync(needed));\n _seed();\n }\n\n /**\n * Private function that seeds a generator once enough bytes are available.\n */\n function _seed() {\n // update reseed count\n ctx.reseeds = (ctx.reseeds === 0xffffffff) ? 0 : ctx.reseeds + 1;\n\n // goal is to update `key` via:\n // key = hash(key + s)\n // where 's' is all collected entropy from selected pools, then...\n\n // create a plugin-based message digest\n var md = ctx.plugin.md.create();\n\n // consume current key bytes\n md.update(ctx.keyBytes);\n\n // digest the entropy of pools whose index k meet the\n // condition 'n mod 2^k == 0' where n is the number of reseeds\n var _2powK = 1;\n for(var k = 0; k < 32; ++k) {\n if(ctx.reseeds % _2powK === 0) {\n md.update(ctx.pools[k].digest().getBytes());\n ctx.pools[k].start();\n }\n _2powK = _2powK << 1;\n }\n\n // get digest for key bytes\n ctx.keyBytes = md.digest().getBytes();\n\n // paranoid deviation from Fortuna:\n // update `seed` via `seed = hash(key)`\n // instead of initializing to zero once and only\n // ever incrementing it\n md.start();\n md.update(ctx.keyBytes);\n var seedBytes = md.digest().getBytes();\n\n // update state\n ctx.key = ctx.plugin.formatKey(ctx.keyBytes);\n ctx.seed = ctx.plugin.formatSeed(seedBytes);\n ctx.generated = 0;\n }\n\n /**\n * The built-in default seedFile. This seedFile is used when entropy\n * is needed immediately.\n *\n * @param needed the number of bytes that are needed.\n *\n * @return the random bytes.\n */\n function defaultSeedFile(needed) {\n // use window.crypto.getRandomValues strong source of entropy if available\n var getRandomValues = null;\n var globalScope = forge.util.globalScope;\n var _crypto = globalScope.crypto || globalScope.msCrypto;\n if(_crypto && _crypto.getRandomValues) {\n getRandomValues = function(arr) {\n return _crypto.getRandomValues(arr);\n };\n }\n\n var b = forge.util.createBuffer();\n if(getRandomValues) {\n while(b.length() < needed) {\n // max byte length is 65536 before QuotaExceededError is thrown\n // http://www.w3.org/TR/WebCryptoAPI/#RandomSource-method-getRandomValues\n var count = Math.max(1, Math.min(needed - b.length(), 65536) / 4);\n var entropy = new Uint32Array(Math.floor(count));\n try {\n getRandomValues(entropy);\n for(var i = 0; i < entropy.length; ++i) {\n b.putInt32(entropy[i]);\n }\n } catch(e) {\n /* only ignore QuotaExceededError */\n if(!(typeof QuotaExceededError !== 'undefined' &&\n e instanceof QuotaExceededError)) {\n throw e;\n }\n }\n }\n }\n\n // be sad and add some weak random data\n if(b.length() < needed) {\n /* Draws from Park-Miller \"minimal standard\" 31 bit PRNG,\n implemented with David G. Carta's optimization: with 32 bit math\n and without division (Public Domain). */\n var hi, lo, next;\n var seed = Math.floor(Math.random() * 0x010000);\n while(b.length() < needed) {\n lo = 16807 * (seed & 0xFFFF);\n hi = 16807 * (seed >> 16);\n lo += (hi & 0x7FFF) << 16;\n lo += hi >> 15;\n lo = (lo & 0x7FFFFFFF) + (lo >> 31);\n seed = lo & 0xFFFFFFFF;\n\n // consume lower 3 bytes of seed\n for(var i = 0; i < 3; ++i) {\n // throw in more pseudo random\n next = seed >>> (i << 3);\n next ^= Math.floor(Math.random() * 0x0100);\n b.putByte(next & 0xFF);\n }\n }\n }\n\n return b.getBytes(needed);\n }\n // initialize seed file APIs\n if(_crypto) {\n // use nodejs async API\n ctx.seedFile = function(needed, callback) {\n _crypto.randomBytes(needed, function(err, bytes) {\n if(err) {\n return callback(err);\n }\n callback(null, bytes.toString());\n });\n };\n // use nodejs sync API\n ctx.seedFileSync = function(needed) {\n return _crypto.randomBytes(needed).toString();\n };\n } else {\n ctx.seedFile = function(needed, callback) {\n try {\n callback(null, defaultSeedFile(needed));\n } catch(e) {\n callback(e);\n }\n };\n ctx.seedFileSync = defaultSeedFile;\n }\n\n /**\n * Adds entropy to a prng ctx's accumulator.\n *\n * @param bytes the bytes of entropy as a string.\n */\n ctx.collect = function(bytes) {\n // iterate over pools distributing entropy cyclically\n var count = bytes.length;\n for(var i = 0; i < count; ++i) {\n ctx.pools[ctx.pool].update(bytes.substr(i, 1));\n ctx.pool = (ctx.pool === 31) ? 0 : ctx.pool + 1;\n }\n };\n\n /**\n * Collects an integer of n bits.\n *\n * @param i the integer entropy.\n * @param n the number of bits in the integer.\n */\n ctx.collectInt = function(i, n) {\n var bytes = '';\n for(var x = 0; x < n; x += 8) {\n bytes += String.fromCharCode((i >> x) & 0xFF);\n }\n ctx.collect(bytes);\n };\n\n /**\n * Registers a Web Worker to receive immediate entropy from the main thread.\n * This method is required until Web Workers can access the native crypto\n * API. This method should be called twice for each created worker, once in\n * the main thread, and once in the worker itself.\n *\n * @param worker the worker to register.\n */\n ctx.registerWorker = function(worker) {\n // worker receives random bytes\n if(worker === self) {\n ctx.seedFile = function(needed, callback) {\n function listener(e) {\n var data = e.data;\n if(data.forge && data.forge.prng) {\n self.removeEventListener('message', listener);\n callback(data.forge.prng.err, data.forge.prng.bytes);\n }\n }\n self.addEventListener('message', listener);\n self.postMessage({forge: {prng: {needed: needed}}});\n };\n } else {\n // main thread sends random bytes upon request\n var listener = function(e) {\n var data = e.data;\n if(data.forge && data.forge.prng) {\n ctx.seedFile(data.forge.prng.needed, function(err, bytes) {\n worker.postMessage({forge: {prng: {err: err, bytes: bytes}}});\n });\n }\n };\n // TODO: do we need to remove the event listener when the worker dies?\n worker.addEventListener('message', listener);\n }\n };\n\n return ctx;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/prng.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/random.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/random.js ***!
|
||
\***********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * An API for getting cryptographically-secure random bytes. The bytes are\n * generated using the Fortuna algorithm devised by Bruce Schneier and\n * Niels Ferguson.\n *\n * Getting strong random bytes is not yet easy to do in javascript. The only\n * truish random entropy that can be collected is from the mouse, keyboard, or\n * from timing with respect to page loads, etc. This generator makes a poor\n * attempt at providing random bytes when those sources haven't yet provided\n * enough entropy to initially seed or to reseed the PRNG.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2009-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./aes */ \"./node_modules/node-forge/lib/aes.js\");\n__webpack_require__(/*! ./sha256 */ \"./node_modules/node-forge/lib/sha256.js\");\n__webpack_require__(/*! ./prng */ \"./node_modules/node-forge/lib/prng.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\n(function() {\n\n// forge.random already defined\nif(forge.random && forge.random.getBytes) {\n module.exports = forge.random;\n return;\n}\n\n(function(jQuery) {\n\n// the default prng plugin, uses AES-128\nvar prng_aes = {};\nvar _prng_aes_output = new Array(4);\nvar _prng_aes_buffer = forge.util.createBuffer();\nprng_aes.formatKey = function(key) {\n // convert the key into 32-bit integers\n var tmp = forge.util.createBuffer(key);\n key = new Array(4);\n key[0] = tmp.getInt32();\n key[1] = tmp.getInt32();\n key[2] = tmp.getInt32();\n key[3] = tmp.getInt32();\n\n // return the expanded key\n return forge.aes._expandKey(key, false);\n};\nprng_aes.formatSeed = function(seed) {\n // convert seed into 32-bit integers\n var tmp = forge.util.createBuffer(seed);\n seed = new Array(4);\n seed[0] = tmp.getInt32();\n seed[1] = tmp.getInt32();\n seed[2] = tmp.getInt32();\n seed[3] = tmp.getInt32();\n return seed;\n};\nprng_aes.cipher = function(key, seed) {\n forge.aes._updateBlock(key, seed, _prng_aes_output, false);\n _prng_aes_buffer.putInt32(_prng_aes_output[0]);\n _prng_aes_buffer.putInt32(_prng_aes_output[1]);\n _prng_aes_buffer.putInt32(_prng_aes_output[2]);\n _prng_aes_buffer.putInt32(_prng_aes_output[3]);\n return _prng_aes_buffer.getBytes();\n};\nprng_aes.increment = function(seed) {\n // FIXME: do we care about carry or signed issues?\n ++seed[3];\n return seed;\n};\nprng_aes.md = forge.md.sha256;\n\n/**\n * Creates a new PRNG.\n */\nfunction spawnPrng() {\n var ctx = forge.prng.create(prng_aes);\n\n /**\n * Gets random bytes. If a native secure crypto API is unavailable, this\n * method tries to make the bytes more unpredictable by drawing from data that\n * can be collected from the user of the browser, eg: mouse movement.\n *\n * If a callback is given, this method will be called asynchronously.\n *\n * @param count the number of random bytes to get.\n * @param [callback(err, bytes)] called once the operation completes.\n *\n * @return the random bytes in a string.\n */\n ctx.getBytes = function(count, callback) {\n return ctx.generate(count, callback);\n };\n\n /**\n * Gets random bytes asynchronously. If a native secure crypto API is\n * unavailable, this method tries to make the bytes more unpredictable by\n * drawing from data that can be collected from the user of the browser,\n * eg: mouse movement.\n *\n * @param count the number of random bytes to get.\n *\n * @return the random bytes in a string.\n */\n ctx.getBytesSync = function(count) {\n return ctx.generate(count);\n };\n\n return ctx;\n}\n\n// create default prng context\nvar _ctx = spawnPrng();\n\n// add other sources of entropy only if window.crypto.getRandomValues is not\n// available -- otherwise this source will be automatically used by the prng\nvar getRandomValues = null;\nvar globalScope = forge.util.globalScope;\nvar _crypto = globalScope.crypto || globalScope.msCrypto;\nif(_crypto && _crypto.getRandomValues) {\n getRandomValues = function(arr) {\n return _crypto.getRandomValues(arr);\n };\n}\n\nif(forge.options.usePureJavaScript ||\n (!forge.util.isNodejs && !getRandomValues)) {\n // if this is a web worker, do not use weak entropy, instead register to\n // receive strong entropy asynchronously from the main thread\n if(typeof window === 'undefined' || window.document === undefined) {\n // FIXME:\n }\n\n // get load time entropy\n _ctx.collectInt(+new Date(), 32);\n\n // add some entropy from navigator object\n if(typeof(navigator) !== 'undefined') {\n var _navBytes = '';\n for(var key in navigator) {\n try {\n if(typeof(navigator[key]) == 'string') {\n _navBytes += navigator[key];\n }\n } catch(e) {\n /* Some navigator keys might not be accessible, e.g. the geolocation\n attribute throws an exception if touched in Mozilla chrome://\n context.\n\n Silently ignore this and just don't use this as a source of\n entropy. */\n }\n }\n _ctx.collect(_navBytes);\n _navBytes = null;\n }\n\n // add mouse and keyboard collectors if jquery is available\n if(jQuery) {\n // set up mouse entropy capture\n jQuery().mousemove(function(e) {\n // add mouse coords\n _ctx.collectInt(e.clientX, 16);\n _ctx.collectInt(e.clientY, 16);\n });\n\n // set up keyboard entropy capture\n jQuery().keypress(function(e) {\n _ctx.collectInt(e.charCode, 8);\n });\n }\n}\n\n/* Random API */\nif(!forge.random) {\n forge.random = _ctx;\n} else {\n // extend forge.random with _ctx\n for(var key in _ctx) {\n forge.random[key] = _ctx[key];\n }\n}\n\n// expose spawn PRNG\nforge.random.createInstance = spawnPrng;\n\nmodule.exports = forge.random;\n\n})(typeof(jQuery) !== 'undefined' ? jQuery : null);\n\n})();\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/random.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/rc2.js":
|
||
/*!********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/rc2.js ***!
|
||
\********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * RC2 implementation.\n *\n * @author Stefan Siegl\n *\n * Copyright (c) 2012 Stefan Siegl <stesie@brokenpipe.de>\n *\n * Information on the RC2 cipher is available from RFC #2268,\n * http://www.ietf.org/rfc/rfc2268.txt\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar piTable = [\n 0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d,\n 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2,\n 0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13, 0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32,\n 0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b, 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82,\n 0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c, 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc,\n 0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1, 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26,\n 0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57, 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03,\n 0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7, 0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7,\n 0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7, 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a,\n 0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74, 0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec,\n 0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc, 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39,\n 0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a, 0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31,\n 0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae, 0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9,\n 0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c, 0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9,\n 0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0, 0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e,\n 0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77, 0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad\n];\n\nvar s = [1, 2, 3, 5];\n\n/**\n * Rotate a word left by given number of bits.\n *\n * Bits that are shifted out on the left are put back in on the right\n * hand side.\n *\n * @param word The word to shift left.\n * @param bits The number of bits to shift by.\n * @return The rotated word.\n */\nvar rol = function(word, bits) {\n return ((word << bits) & 0xffff) | ((word & 0xffff) >> (16 - bits));\n};\n\n/**\n * Rotate a word right by given number of bits.\n *\n * Bits that are shifted out on the right are put back in on the left\n * hand side.\n *\n * @param word The word to shift right.\n * @param bits The number of bits to shift by.\n * @return The rotated word.\n */\nvar ror = function(word, bits) {\n return ((word & 0xffff) >> bits) | ((word << (16 - bits)) & 0xffff);\n};\n\n/* RC2 API */\nmodule.exports = forge.rc2 = forge.rc2 || {};\n\n/**\n * Perform RC2 key expansion as per RFC #2268, section 2.\n *\n * @param key variable-length user key (between 1 and 128 bytes)\n * @param effKeyBits number of effective key bits (default: 128)\n * @return the expanded RC2 key (ByteBuffer of 128 bytes)\n */\nforge.rc2.expandKey = function(key, effKeyBits) {\n if(typeof key === 'string') {\n key = forge.util.createBuffer(key);\n }\n effKeyBits = effKeyBits || 128;\n\n /* introduce variables that match the names used in RFC #2268 */\n var L = key;\n var T = key.length();\n var T1 = effKeyBits;\n var T8 = Math.ceil(T1 / 8);\n var TM = 0xff >> (T1 & 0x07);\n var i;\n\n for(i = T; i < 128; i++) {\n L.putByte(piTable[(L.at(i - 1) + L.at(i - T)) & 0xff]);\n }\n\n L.setAt(128 - T8, piTable[L.at(128 - T8) & TM]);\n\n for(i = 127 - T8; i >= 0; i--) {\n L.setAt(i, piTable[L.at(i + 1) ^ L.at(i + T8)]);\n }\n\n return L;\n};\n\n/**\n * Creates a RC2 cipher object.\n *\n * @param key the symmetric key to use (as base for key generation).\n * @param bits the number of effective key bits.\n * @param encrypt false for decryption, true for encryption.\n *\n * @return the cipher.\n */\nvar createCipher = function(key, bits, encrypt) {\n var _finish = false, _input = null, _output = null, _iv = null;\n var mixRound, mashRound;\n var i, j, K = [];\n\n /* Expand key and fill into K[] Array */\n key = forge.rc2.expandKey(key, bits);\n for(i = 0; i < 64; i++) {\n K.push(key.getInt16Le());\n }\n\n if(encrypt) {\n /**\n * Perform one mixing round \"in place\".\n *\n * @param R Array of four words to perform mixing on.\n */\n mixRound = function(R) {\n for(i = 0; i < 4; i++) {\n R[i] += K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) +\n ((~R[(i + 3) % 4]) & R[(i + 1) % 4]);\n R[i] = rol(R[i], s[i]);\n j++;\n }\n };\n\n /**\n * Perform one mashing round \"in place\".\n *\n * @param R Array of four words to perform mashing on.\n */\n mashRound = function(R) {\n for(i = 0; i < 4; i++) {\n R[i] += K[R[(i + 3) % 4] & 63];\n }\n };\n } else {\n /**\n * Perform one r-mixing round \"in place\".\n *\n * @param R Array of four words to perform mixing on.\n */\n mixRound = function(R) {\n for(i = 3; i >= 0; i--) {\n R[i] = ror(R[i], s[i]);\n R[i] -= K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) +\n ((~R[(i + 3) % 4]) & R[(i + 1) % 4]);\n j--;\n }\n };\n\n /**\n * Perform one r-mashing round \"in place\".\n *\n * @param R Array of four words to perform mashing on.\n */\n mashRound = function(R) {\n for(i = 3; i >= 0; i--) {\n R[i] -= K[R[(i + 3) % 4] & 63];\n }\n };\n }\n\n /**\n * Run the specified cipher execution plan.\n *\n * This function takes four words from the input buffer, applies the IV on\n * it (if requested) and runs the provided execution plan.\n *\n * The plan must be put together in form of a array of arrays. Where the\n * outer one is simply a list of steps to perform and the inner one needs\n * to have two elements: the first one telling how many rounds to perform,\n * the second one telling what to do (i.e. the function to call).\n *\n * @param {Array} plan The plan to execute.\n */\n var runPlan = function(plan) {\n var R = [];\n\n /* Get data from input buffer and fill the four words into R */\n for(i = 0; i < 4; i++) {\n var val = _input.getInt16Le();\n\n if(_iv !== null) {\n if(encrypt) {\n /* We're encrypting, apply the IV first. */\n val ^= _iv.getInt16Le();\n } else {\n /* We're decryption, keep cipher text for next block. */\n _iv.putInt16Le(val);\n }\n }\n\n R.push(val & 0xffff);\n }\n\n /* Reset global \"j\" variable as per spec. */\n j = encrypt ? 0 : 63;\n\n /* Run execution plan. */\n for(var ptr = 0; ptr < plan.length; ptr++) {\n for(var ctr = 0; ctr < plan[ptr][0]; ctr++) {\n plan[ptr][1](R);\n }\n }\n\n /* Write back result to output buffer. */\n for(i = 0; i < 4; i++) {\n if(_iv !== null) {\n if(encrypt) {\n /* We're encrypting in CBC-mode, feed back encrypted bytes into\n IV buffer to carry it forward to next block. */\n _iv.putInt16Le(R[i]);\n } else {\n R[i] ^= _iv.getInt16Le();\n }\n }\n\n _output.putInt16Le(R[i]);\n }\n };\n\n /* Create cipher object */\n var cipher = null;\n cipher = {\n /**\n * Starts or restarts the encryption or decryption process, whichever\n * was previously configured.\n *\n * To use the cipher in CBC mode, iv may be given either as a string\n * of bytes, or as a byte buffer. For ECB mode, give null as iv.\n *\n * @param iv the initialization vector to use, null for ECB mode.\n * @param output the output the buffer to write to, null to create one.\n */\n start: function(iv, output) {\n if(iv) {\n /* CBC mode */\n if(typeof iv === 'string') {\n iv = forge.util.createBuffer(iv);\n }\n }\n\n _finish = false;\n _input = forge.util.createBuffer();\n _output = output || new forge.util.createBuffer();\n _iv = iv;\n\n cipher.output = _output;\n },\n\n /**\n * Updates the next block.\n *\n * @param input the buffer to read from.\n */\n update: function(input) {\n if(!_finish) {\n // not finishing, so fill the input buffer with more input\n _input.putBuffer(input);\n }\n\n while(_input.length() >= 8) {\n runPlan([\n [ 5, mixRound ],\n [ 1, mashRound ],\n [ 6, mixRound ],\n [ 1, mashRound ],\n [ 5, mixRound ]\n ]);\n }\n },\n\n /**\n * Finishes encrypting or decrypting.\n *\n * @param pad a padding function to use, null for PKCS#7 padding,\n * signature(blockSize, buffer, decrypt).\n *\n * @return true if successful, false on error.\n */\n finish: function(pad) {\n var rval = true;\n\n if(encrypt) {\n if(pad) {\n rval = pad(8, _input, !encrypt);\n } else {\n // add PKCS#7 padding to block (each pad byte is the\n // value of the number of pad bytes)\n var padding = (_input.length() === 8) ? 8 : (8 - _input.length());\n _input.fillWithByte(padding, padding);\n }\n }\n\n if(rval) {\n // do final update\n _finish = true;\n cipher.update();\n }\n\n if(!encrypt) {\n // check for error: input data not a multiple of block size\n rval = (_input.length() === 0);\n if(rval) {\n if(pad) {\n rval = pad(8, _output, !encrypt);\n } else {\n // ensure padding byte count is valid\n var len = _output.length();\n var count = _output.at(len - 1);\n\n if(count > len) {\n rval = false;\n } else {\n // trim off padding bytes\n _output.truncate(count);\n }\n }\n }\n }\n\n return rval;\n }\n };\n\n return cipher;\n};\n\n/**\n * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the\n * given symmetric key. The output will be stored in the 'output' member\n * of the returned cipher.\n *\n * The key and iv may be given as a string of bytes or a byte buffer.\n * The cipher is initialized to use 128 effective key bits.\n *\n * @param key the symmetric key to use.\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n *\n * @return the cipher.\n */\nforge.rc2.startEncrypting = function(key, iv, output) {\n var cipher = forge.rc2.createEncryptionCipher(key, 128);\n cipher.start(iv, output);\n return cipher;\n};\n\n/**\n * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the\n * given symmetric key.\n *\n * The key may be given as a string of bytes or a byte buffer.\n *\n * To start encrypting call start() on the cipher with an iv and optional\n * output buffer.\n *\n * @param key the symmetric key to use.\n *\n * @return the cipher.\n */\nforge.rc2.createEncryptionCipher = function(key, bits) {\n return createCipher(key, bits, true);\n};\n\n/**\n * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the\n * given symmetric key. The output will be stored in the 'output' member\n * of the returned cipher.\n *\n * The key and iv may be given as a string of bytes or a byte buffer.\n * The cipher is initialized to use 128 effective key bits.\n *\n * @param key the symmetric key to use.\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n *\n * @return the cipher.\n */\nforge.rc2.startDecrypting = function(key, iv, output) {\n var cipher = forge.rc2.createDecryptionCipher(key, 128);\n cipher.start(iv, output);\n return cipher;\n};\n\n/**\n * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the\n * given symmetric key.\n *\n * The key may be given as a string of bytes or a byte buffer.\n *\n * To start decrypting call start() on the cipher with an iv and optional\n * output buffer.\n *\n * @param key the symmetric key to use.\n *\n * @return the cipher.\n */\nforge.rc2.createDecryptionCipher = function(key, bits) {\n return createCipher(key, bits, false);\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/rc2.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/rsa.js":
|
||
/*!********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/rsa.js ***!
|
||
\********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Javascript implementation of basic RSA algorithms.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n *\n * The only algorithm currently supported for PKI is RSA.\n *\n * An RSA key is often stored in ASN.1 DER format. The SubjectPublicKeyInfo\n * ASN.1 structure is composed of an algorithm of type AlgorithmIdentifier\n * and a subjectPublicKey of type bit string.\n *\n * The AlgorithmIdentifier contains an Object Identifier (OID) and parameters\n * for the algorithm, if any. In the case of RSA, there aren't any.\n *\n * SubjectPublicKeyInfo ::= SEQUENCE {\n * algorithm AlgorithmIdentifier,\n * subjectPublicKey BIT STRING\n * }\n *\n * AlgorithmIdentifer ::= SEQUENCE {\n * algorithm OBJECT IDENTIFIER,\n * parameters ANY DEFINED BY algorithm OPTIONAL\n * }\n *\n * For an RSA public key, the subjectPublicKey is:\n *\n * RSAPublicKey ::= SEQUENCE {\n * modulus INTEGER, -- n\n * publicExponent INTEGER -- e\n * }\n *\n * PrivateKeyInfo ::= SEQUENCE {\n * version Version,\n * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,\n * privateKey PrivateKey,\n * attributes [0] IMPLICIT Attributes OPTIONAL\n * }\n *\n * Version ::= INTEGER\n * PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier\n * PrivateKey ::= OCTET STRING\n * Attributes ::= SET OF Attribute\n *\n * An RSA private key as the following structure:\n *\n * RSAPrivateKey ::= SEQUENCE {\n * version Version,\n * modulus INTEGER, -- n\n * publicExponent INTEGER, -- e\n * privateExponent INTEGER, -- d\n * prime1 INTEGER, -- p\n * prime2 INTEGER, -- q\n * exponent1 INTEGER, -- d mod (p-1)\n * exponent2 INTEGER, -- d mod (q-1)\n * coefficient INTEGER -- (inverse of q) mod p\n * }\n *\n * Version ::= INTEGER\n *\n * The OID for the RSA key algorithm is: 1.2.840.113549.1.1.1\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./asn1 */ \"./node_modules/node-forge/lib/asn1.js\");\n__webpack_require__(/*! ./jsbn */ \"./node_modules/node-forge/lib/jsbn.js\");\n__webpack_require__(/*! ./oids */ \"./node_modules/node-forge/lib/oids.js\");\n__webpack_require__(/*! ./pkcs1 */ \"./node_modules/node-forge/lib/pkcs1.js\");\n__webpack_require__(/*! ./prime */ \"./node_modules/node-forge/lib/prime.js\");\n__webpack_require__(/*! ./random */ \"./node_modules/node-forge/lib/random.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nif(typeof BigInteger === 'undefined') {\n var BigInteger = forge.jsbn.BigInteger;\n}\n\nvar _crypto = forge.util.isNodejs ? __webpack_require__(/*! crypto */ \"?b254\") : null;\n\n// shortcut for asn.1 API\nvar asn1 = forge.asn1;\n\n// shortcut for util API\nvar util = forge.util;\n\n/*\n * RSA encryption and decryption, see RFC 2313.\n */\nforge.pki = forge.pki || {};\nmodule.exports = forge.pki.rsa = forge.rsa = forge.rsa || {};\nvar pki = forge.pki;\n\n// for finding primes, which are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29\nvar GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2];\n\n// validator for a PrivateKeyInfo structure\nvar privateKeyValidator = {\n // PrivateKeyInfo\n name: 'PrivateKeyInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n // Version (INTEGER)\n name: 'PrivateKeyInfo.version',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyVersion'\n }, {\n // privateKeyAlgorithm\n name: 'PrivateKeyInfo.privateKeyAlgorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'AlgorithmIdentifier.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'privateKeyOid'\n }]\n }, {\n // PrivateKey\n name: 'PrivateKeyInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'privateKey'\n }]\n};\n\n// validator for an RSA private key\nvar rsaPrivateKeyValidator = {\n // RSAPrivateKey\n name: 'RSAPrivateKey',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n // Version (INTEGER)\n name: 'RSAPrivateKey.version',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyVersion'\n }, {\n // modulus (n)\n name: 'RSAPrivateKey.modulus',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyModulus'\n }, {\n // publicExponent (e)\n name: 'RSAPrivateKey.publicExponent',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyPublicExponent'\n }, {\n // privateExponent (d)\n name: 'RSAPrivateKey.privateExponent',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyPrivateExponent'\n }, {\n // prime1 (p)\n name: 'RSAPrivateKey.prime1',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyPrime1'\n }, {\n // prime2 (q)\n name: 'RSAPrivateKey.prime2',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyPrime2'\n }, {\n // exponent1 (d mod (p-1))\n name: 'RSAPrivateKey.exponent1',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyExponent1'\n }, {\n // exponent2 (d mod (q-1))\n name: 'RSAPrivateKey.exponent2',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyExponent2'\n }, {\n // coefficient ((inverse of q) mod p)\n name: 'RSAPrivateKey.coefficient',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyCoefficient'\n }]\n};\n\n// validator for an RSA public key\nvar rsaPublicKeyValidator = {\n // RSAPublicKey\n name: 'RSAPublicKey',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n // modulus (n)\n name: 'RSAPublicKey.modulus',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'publicKeyModulus'\n }, {\n // publicExponent (e)\n name: 'RSAPublicKey.exponent',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'publicKeyExponent'\n }]\n};\n\n// validator for an SubjectPublicKeyInfo structure\n// Note: Currently only works with an RSA public key\nvar publicKeyValidator = forge.pki.rsa.publicKeyValidator = {\n name: 'SubjectPublicKeyInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n captureAsn1: 'subjectPublicKeyInfo',\n value: [{\n name: 'SubjectPublicKeyInfo.AlgorithmIdentifier',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'AlgorithmIdentifier.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'publicKeyOid'\n }]\n }, {\n // subjectPublicKey\n name: 'SubjectPublicKeyInfo.subjectPublicKey',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.BITSTRING,\n constructed: false,\n value: [{\n // RSAPublicKey\n name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n optional: true,\n captureAsn1: 'rsaPublicKey'\n }]\n }]\n};\n\n// validator for a DigestInfo structure\nvar digestInfoValidator = {\n name: 'DigestInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'DigestInfo.DigestAlgorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'DigestInfo.DigestAlgorithm.algorithmIdentifier',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'algorithmIdentifier'\n }, {\n // NULL paramters\n name: 'DigestInfo.DigestAlgorithm.parameters',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.NULL,\n // captured only to check existence for md2 and md5\n capture: 'parameters',\n optional: true,\n constructed: false\n }]\n }, {\n // digest\n name: 'DigestInfo.digest',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'digest'\n }]\n};\n\n/**\n * Wrap digest in DigestInfo object.\n *\n * This function implements EMSA-PKCS1-v1_5-ENCODE as per RFC 3447.\n *\n * DigestInfo ::= SEQUENCE {\n * digestAlgorithm DigestAlgorithmIdentifier,\n * digest Digest\n * }\n *\n * DigestAlgorithmIdentifier ::= AlgorithmIdentifier\n * Digest ::= OCTET STRING\n *\n * @param md the message digest object with the hash to sign.\n *\n * @return the encoded message (ready for RSA encrytion)\n */\nvar emsaPkcs1v15encode = function(md) {\n // get the oid for the algorithm\n var oid;\n if(md.algorithm in pki.oids) {\n oid = pki.oids[md.algorithm];\n } else {\n var error = new Error('Unknown message digest algorithm.');\n error.algorithm = md.algorithm;\n throw error;\n }\n var oidBytes = asn1.oidToDer(oid).getBytes();\n\n // create the digest info\n var digestInfo = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n var digestAlgorithm = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n digestAlgorithm.value.push(asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OID, false, oidBytes));\n digestAlgorithm.value.push(asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.NULL, false, ''));\n var digest = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING,\n false, md.digest().getBytes());\n digestInfo.value.push(digestAlgorithm);\n digestInfo.value.push(digest);\n\n // encode digest info\n return asn1.toDer(digestInfo).getBytes();\n};\n\n/**\n * Performs x^c mod n (RSA encryption or decryption operation).\n *\n * @param x the number to raise and mod.\n * @param key the key to use.\n * @param pub true if the key is public, false if private.\n *\n * @return the result of x^c mod n.\n */\nvar _modPow = function(x, key, pub) {\n if(pub) {\n return x.modPow(key.e, key.n);\n }\n\n if(!key.p || !key.q) {\n // allow calculation without CRT params (slow)\n return x.modPow(key.d, key.n);\n }\n\n // pre-compute dP, dQ, and qInv if necessary\n if(!key.dP) {\n key.dP = key.d.mod(key.p.subtract(BigInteger.ONE));\n }\n if(!key.dQ) {\n key.dQ = key.d.mod(key.q.subtract(BigInteger.ONE));\n }\n if(!key.qInv) {\n key.qInv = key.q.modInverse(key.p);\n }\n\n /* Chinese remainder theorem (CRT) states:\n\n Suppose n1, n2, ..., nk are positive integers which are pairwise\n coprime (n1 and n2 have no common factors other than 1). For any\n integers x1, x2, ..., xk there exists an integer x solving the\n system of simultaneous congruences (where ~= means modularly\n congruent so a ~= b mod n means a mod n = b mod n):\n\n x ~= x1 mod n1\n x ~= x2 mod n2\n ...\n x ~= xk mod nk\n\n This system of congruences has a single simultaneous solution x\n between 0 and n - 1. Furthermore, each xk solution and x itself\n is congruent modulo the product n = n1*n2*...*nk.\n So x1 mod n = x2 mod n = xk mod n = x mod n.\n\n The single simultaneous solution x can be solved with the following\n equation:\n\n x = sum(xi*ri*si) mod n where ri = n/ni and si = ri^-1 mod ni.\n\n Where x is less than n, xi = x mod ni.\n\n For RSA we are only concerned with k = 2. The modulus n = pq, where\n p and q are coprime. The RSA decryption algorithm is:\n\n y = x^d mod n\n\n Given the above:\n\n x1 = x^d mod p\n r1 = n/p = q\n s1 = q^-1 mod p\n x2 = x^d mod q\n r2 = n/q = p\n s2 = p^-1 mod q\n\n So y = (x1r1s1 + x2r2s2) mod n\n = ((x^d mod p)q(q^-1 mod p) + (x^d mod q)p(p^-1 mod q)) mod n\n\n According to Fermat's Little Theorem, if the modulus P is prime,\n for any integer A not evenly divisible by P, A^(P-1) ~= 1 mod P.\n Since A is not divisible by P it follows that if:\n N ~= M mod (P - 1), then A^N mod P = A^M mod P. Therefore:\n\n A^N mod P = A^(M mod (P - 1)) mod P. (The latter takes less effort\n to calculate). In order to calculate x^d mod p more quickly the\n exponent d mod (p - 1) is stored in the RSA private key (the same\n is done for x^d mod q). These values are referred to as dP and dQ\n respectively. Therefore we now have:\n\n y = ((x^dP mod p)q(q^-1 mod p) + (x^dQ mod q)p(p^-1 mod q)) mod n\n\n Since we'll be reducing x^dP by modulo p (same for q) we can also\n reduce x by p (and q respectively) before hand. Therefore, let\n\n xp = ((x mod p)^dP mod p), and\n xq = ((x mod q)^dQ mod q), yielding:\n\n y = (xp*q*(q^-1 mod p) + xq*p*(p^-1 mod q)) mod n\n\n This can be further reduced to a simple algorithm that only\n requires 1 inverse (the q inverse is used) to be used and stored.\n The algorithm is called Garner's algorithm. If qInv is the\n inverse of q, we simply calculate:\n\n y = (qInv*(xp - xq) mod p) * q + xq\n\n However, there are two further complications. First, we need to\n ensure that xp > xq to prevent signed BigIntegers from being used\n so we add p until this is true (since we will be mod'ing with\n p anyway). Then, there is a known timing attack on algorithms\n using the CRT. To mitigate this risk, \"cryptographic blinding\"\n should be used. This requires simply generating a random number r\n between 0 and n-1 and its inverse and multiplying x by r^e before\n calculating y and then multiplying y by r^-1 afterwards. Note that\n r must be coprime with n (gcd(r, n) === 1) in order to have an\n inverse.\n */\n\n // cryptographic blinding\n var r;\n do {\n r = new BigInteger(\n forge.util.bytesToHex(forge.random.getBytes(key.n.bitLength() / 8)),\n 16);\n } while(r.compareTo(key.n) >= 0 || !r.gcd(key.n).equals(BigInteger.ONE));\n x = x.multiply(r.modPow(key.e, key.n)).mod(key.n);\n\n // calculate xp and xq\n var xp = x.mod(key.p).modPow(key.dP, key.p);\n var xq = x.mod(key.q).modPow(key.dQ, key.q);\n\n // xp must be larger than xq to avoid signed bit usage\n while(xp.compareTo(xq) < 0) {\n xp = xp.add(key.p);\n }\n\n // do last step\n var y = xp.subtract(xq)\n .multiply(key.qInv).mod(key.p)\n .multiply(key.q).add(xq);\n\n // remove effect of random for cryptographic blinding\n y = y.multiply(r.modInverse(key.n)).mod(key.n);\n\n return y;\n};\n\n/**\n * NOTE: THIS METHOD IS DEPRECATED, use 'sign' on a private key object or\n * 'encrypt' on a public key object instead.\n *\n * Performs RSA encryption.\n *\n * The parameter bt controls whether to put padding bytes before the\n * message passed in. Set bt to either true or false to disable padding\n * completely (in order to handle e.g. EMSA-PSS encoding seperately before),\n * signaling whether the encryption operation is a public key operation\n * (i.e. encrypting data) or not, i.e. private key operation (data signing).\n *\n * For PKCS#1 v1.5 padding pass in the block type to use, i.e. either 0x01\n * (for signing) or 0x02 (for encryption). The key operation mode (private\n * or public) is derived from this flag in that case).\n *\n * @param m the message to encrypt as a byte string.\n * @param key the RSA key to use.\n * @param bt for PKCS#1 v1.5 padding, the block type to use\n * (0x01 for private key, 0x02 for public),\n * to disable padding: true = public key, false = private key.\n *\n * @return the encrypted bytes as a string.\n */\npki.rsa.encrypt = function(m, key, bt) {\n var pub = bt;\n var eb;\n\n // get the length of the modulus in bytes\n var k = Math.ceil(key.n.bitLength() / 8);\n\n if(bt !== false && bt !== true) {\n // legacy, default to PKCS#1 v1.5 padding\n pub = (bt === 0x02);\n eb = _encodePkcs1_v1_5(m, key, bt);\n } else {\n eb = forge.util.createBuffer();\n eb.putBytes(m);\n }\n\n // load encryption block as big integer 'x'\n // FIXME: hex conversion inefficient, get BigInteger w/byte strings\n var x = new BigInteger(eb.toHex(), 16);\n\n // do RSA encryption\n var y = _modPow(x, key, pub);\n\n // convert y into the encrypted data byte string, if y is shorter in\n // bytes than k, then prepend zero bytes to fill up ed\n // FIXME: hex conversion inefficient, get BigInteger w/byte strings\n var yhex = y.toString(16);\n var ed = forge.util.createBuffer();\n var zeros = k - Math.ceil(yhex.length / 2);\n while(zeros > 0) {\n ed.putByte(0x00);\n --zeros;\n }\n ed.putBytes(forge.util.hexToBytes(yhex));\n return ed.getBytes();\n};\n\n/**\n * NOTE: THIS METHOD IS DEPRECATED, use 'decrypt' on a private key object or\n * 'verify' on a public key object instead.\n *\n * Performs RSA decryption.\n *\n * The parameter ml controls whether to apply PKCS#1 v1.5 padding\n * or not. Set ml = false to disable padding removal completely\n * (in order to handle e.g. EMSA-PSS later on) and simply pass back\n * the RSA encryption block.\n *\n * @param ed the encrypted data to decrypt in as a byte string.\n * @param key the RSA key to use.\n * @param pub true for a public key operation, false for private.\n * @param ml the message length, if known, false to disable padding.\n *\n * @return the decrypted message as a byte string.\n */\npki.rsa.decrypt = function(ed, key, pub, ml) {\n // get the length of the modulus in bytes\n var k = Math.ceil(key.n.bitLength() / 8);\n\n // error if the length of the encrypted data ED is not k\n if(ed.length !== k) {\n var error = new Error('Encrypted message length is invalid.');\n error.length = ed.length;\n error.expected = k;\n throw error;\n }\n\n // convert encrypted data into a big integer\n // FIXME: hex conversion inefficient, get BigInteger w/byte strings\n var y = new BigInteger(forge.util.createBuffer(ed).toHex(), 16);\n\n // y must be less than the modulus or it wasn't the result of\n // a previous mod operation (encryption) using that modulus\n if(y.compareTo(key.n) >= 0) {\n throw new Error('Encrypted message is invalid.');\n }\n\n // do RSA decryption\n var x = _modPow(y, key, pub);\n\n // create the encryption block, if x is shorter in bytes than k, then\n // prepend zero bytes to fill up eb\n // FIXME: hex conversion inefficient, get BigInteger w/byte strings\n var xhex = x.toString(16);\n var eb = forge.util.createBuffer();\n var zeros = k - Math.ceil(xhex.length / 2);\n while(zeros > 0) {\n eb.putByte(0x00);\n --zeros;\n }\n eb.putBytes(forge.util.hexToBytes(xhex));\n\n if(ml !== false) {\n // legacy, default to PKCS#1 v1.5 padding\n return _decodePkcs1_v1_5(eb.getBytes(), key, pub);\n }\n\n // return message\n return eb.getBytes();\n};\n\n/**\n * Creates an RSA key-pair generation state object. It is used to allow\n * key-generation to be performed in steps. It also allows for a UI to\n * display progress updates.\n *\n * @param bits the size for the private key in bits, defaults to 2048.\n * @param e the public exponent to use, defaults to 65537 (0x10001).\n * @param [options] the options to use.\n * prng a custom crypto-secure pseudo-random number generator to use,\n * that must define \"getBytesSync\".\n * algorithm the algorithm to use (default: 'PRIMEINC').\n *\n * @return the state object to use to generate the key-pair.\n */\npki.rsa.createKeyPairGenerationState = function(bits, e, options) {\n // TODO: migrate step-based prime generation code to forge.prime\n\n // set default bits\n if(typeof(bits) === 'string') {\n bits = parseInt(bits, 10);\n }\n bits = bits || 2048;\n\n // create prng with api that matches BigInteger secure random\n options = options || {};\n var prng = options.prng || forge.random;\n var rng = {\n // x is an array to fill with bytes\n nextBytes: function(x) {\n var b = prng.getBytesSync(x.length);\n for(var i = 0; i < x.length; ++i) {\n x[i] = b.charCodeAt(i);\n }\n }\n };\n\n var algorithm = options.algorithm || 'PRIMEINC';\n\n // create PRIMEINC algorithm state\n var rval;\n if(algorithm === 'PRIMEINC') {\n rval = {\n algorithm: algorithm,\n state: 0,\n bits: bits,\n rng: rng,\n eInt: e || 65537,\n e: new BigInteger(null),\n p: null,\n q: null,\n qBits: bits >> 1,\n pBits: bits - (bits >> 1),\n pqState: 0,\n num: null,\n keys: null\n };\n rval.e.fromInt(rval.eInt);\n } else {\n throw new Error('Invalid key generation algorithm: ' + algorithm);\n }\n\n return rval;\n};\n\n/**\n * Attempts to runs the key-generation algorithm for at most n seconds\n * (approximately) using the given state. When key-generation has completed,\n * the keys will be stored in state.keys.\n *\n * To use this function to update a UI while generating a key or to prevent\n * causing browser lockups/warnings, set \"n\" to a value other than 0. A\n * simple pattern for generating a key and showing a progress indicator is:\n *\n * var state = pki.rsa.createKeyPairGenerationState(2048);\n * var step = function() {\n * // step key-generation, run algorithm for 100 ms, repeat\n * if(!forge.pki.rsa.stepKeyPairGenerationState(state, 100)) {\n * setTimeout(step, 1);\n * } else {\n * // key-generation complete\n * // TODO: turn off progress indicator here\n * // TODO: use the generated key-pair in \"state.keys\"\n * }\n * };\n * // TODO: turn on progress indicator here\n * setTimeout(step, 0);\n *\n * @param state the state to use.\n * @param n the maximum number of milliseconds to run the algorithm for, 0\n * to run the algorithm to completion.\n *\n * @return true if the key-generation completed, false if not.\n */\npki.rsa.stepKeyPairGenerationState = function(state, n) {\n // set default algorithm if not set\n if(!('algorithm' in state)) {\n state.algorithm = 'PRIMEINC';\n }\n\n // TODO: migrate step-based prime generation code to forge.prime\n // TODO: abstract as PRIMEINC algorithm\n\n // do key generation (based on Tom Wu's rsa.js, see jsbn.js license)\n // with some minor optimizations and designed to run in steps\n\n // local state vars\n var THIRTY = new BigInteger(null);\n THIRTY.fromInt(30);\n var deltaIdx = 0;\n var op_or = function(x, y) {return x | y;};\n\n // keep stepping until time limit is reached or done\n var t1 = +new Date();\n var t2;\n var total = 0;\n while(state.keys === null && (n <= 0 || total < n)) {\n // generate p or q\n if(state.state === 0) {\n /* Note: All primes are of the form:\n\n 30k+i, for i < 30 and gcd(30, i)=1, where there are 8 values for i\n\n When we generate a random number, we always align it at 30k + 1. Each\n time the number is determined not to be prime we add to get to the\n next 'i', eg: if the number was at 30k + 1 we add 6. */\n var bits = (state.p === null) ? state.pBits : state.qBits;\n var bits1 = bits - 1;\n\n // get a random number\n if(state.pqState === 0) {\n state.num = new BigInteger(bits, state.rng);\n // force MSB set\n if(!state.num.testBit(bits1)) {\n state.num.bitwiseTo(\n BigInteger.ONE.shiftLeft(bits1), op_or, state.num);\n }\n // align number on 30k+1 boundary\n state.num.dAddOffset(31 - state.num.mod(THIRTY).byteValue(), 0);\n deltaIdx = 0;\n\n ++state.pqState;\n } else if(state.pqState === 1) {\n // try to make the number a prime\n if(state.num.bitLength() > bits) {\n // overflow, try again\n state.pqState = 0;\n // do primality test\n } else if(state.num.isProbablePrime(\n _getMillerRabinTests(state.num.bitLength()))) {\n ++state.pqState;\n } else {\n // get next potential prime\n state.num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0);\n }\n } else if(state.pqState === 2) {\n // ensure number is coprime with e\n state.pqState =\n (state.num.subtract(BigInteger.ONE).gcd(state.e)\n .compareTo(BigInteger.ONE) === 0) ? 3 : 0;\n } else if(state.pqState === 3) {\n // store p or q\n state.pqState = 0;\n if(state.p === null) {\n state.p = state.num;\n } else {\n state.q = state.num;\n }\n\n // advance state if both p and q are ready\n if(state.p !== null && state.q !== null) {\n ++state.state;\n }\n state.num = null;\n }\n } else if(state.state === 1) {\n // ensure p is larger than q (swap them if not)\n if(state.p.compareTo(state.q) < 0) {\n state.num = state.p;\n state.p = state.q;\n state.q = state.num;\n }\n ++state.state;\n } else if(state.state === 2) {\n // compute phi: (p - 1)(q - 1) (Euler's totient function)\n state.p1 = state.p.subtract(BigInteger.ONE);\n state.q1 = state.q.subtract(BigInteger.ONE);\n state.phi = state.p1.multiply(state.q1);\n ++state.state;\n } else if(state.state === 3) {\n // ensure e and phi are coprime\n if(state.phi.gcd(state.e).compareTo(BigInteger.ONE) === 0) {\n // phi and e are coprime, advance\n ++state.state;\n } else {\n // phi and e aren't coprime, so generate a new p and q\n state.p = null;\n state.q = null;\n state.state = 0;\n }\n } else if(state.state === 4) {\n // create n, ensure n is has the right number of bits\n state.n = state.p.multiply(state.q);\n\n // ensure n is right number of bits\n if(state.n.bitLength() === state.bits) {\n // success, advance\n ++state.state;\n } else {\n // failed, get new q\n state.q = null;\n state.state = 0;\n }\n } else if(state.state === 5) {\n // set keys\n var d = state.e.modInverse(state.phi);\n state.keys = {\n privateKey: pki.rsa.setPrivateKey(\n state.n, state.e, d, state.p, state.q,\n d.mod(state.p1), d.mod(state.q1),\n state.q.modInverse(state.p)),\n publicKey: pki.rsa.setPublicKey(state.n, state.e)\n };\n }\n\n // update timing\n t2 = +new Date();\n total += t2 - t1;\n t1 = t2;\n }\n\n return state.keys !== null;\n};\n\n/**\n * Generates an RSA public-private key pair in a single call.\n *\n * To generate a key-pair in steps (to allow for progress updates and to\n * prevent blocking or warnings in slow browsers) then use the key-pair\n * generation state functions.\n *\n * To generate a key-pair asynchronously (either through web-workers, if\n * available, or by breaking up the work on the main thread), pass a\n * callback function.\n *\n * @param [bits] the size for the private key in bits, defaults to 2048.\n * @param [e] the public exponent to use, defaults to 65537.\n * @param [options] options for key-pair generation, if given then 'bits'\n * and 'e' must *not* be given:\n * bits the size for the private key in bits, (default: 2048).\n * e the public exponent to use, (default: 65537 (0x10001)).\n * workerScript the worker script URL.\n * workers the number of web workers (if supported) to use,\n * (default: 2).\n * workLoad the size of the work load, ie: number of possible prime\n * numbers for each web worker to check per work assignment,\n * (default: 100).\n * prng a custom crypto-secure pseudo-random number generator to use,\n * that must define \"getBytesSync\". Disables use of native APIs.\n * algorithm the algorithm to use (default: 'PRIMEINC').\n * @param [callback(err, keypair)] called once the operation completes.\n *\n * @return an object with privateKey and publicKey properties.\n */\npki.rsa.generateKeyPair = function(bits, e, options, callback) {\n // (bits), (options), (callback)\n if(arguments.length === 1) {\n if(typeof bits === 'object') {\n options = bits;\n bits = undefined;\n } else if(typeof bits === 'function') {\n callback = bits;\n bits = undefined;\n }\n } else if(arguments.length === 2) {\n // (bits, e), (bits, options), (bits, callback), (options, callback)\n if(typeof bits === 'number') {\n if(typeof e === 'function') {\n callback = e;\n e = undefined;\n } else if(typeof e !== 'number') {\n options = e;\n e = undefined;\n }\n } else {\n options = bits;\n callback = e;\n bits = undefined;\n e = undefined;\n }\n } else if(arguments.length === 3) {\n // (bits, e, options), (bits, e, callback), (bits, options, callback)\n if(typeof e === 'number') {\n if(typeof options === 'function') {\n callback = options;\n options = undefined;\n }\n } else {\n callback = options;\n options = e;\n e = undefined;\n }\n }\n options = options || {};\n if(bits === undefined) {\n bits = options.bits || 2048;\n }\n if(e === undefined) {\n e = options.e || 0x10001;\n }\n\n // use native code if permitted, available, and parameters are acceptable\n if(!forge.options.usePureJavaScript && !options.prng &&\n bits >= 256 && bits <= 16384 && (e === 0x10001 || e === 3)) {\n if(callback) {\n // try native async\n if(_detectNodeCrypto('generateKeyPair')) {\n return _crypto.generateKeyPair('rsa', {\n modulusLength: bits,\n publicExponent: e,\n publicKeyEncoding: {\n type: 'spki',\n format: 'pem'\n },\n privateKeyEncoding: {\n type: 'pkcs8',\n format: 'pem'\n }\n }, function(err, pub, priv) {\n if(err) {\n return callback(err);\n }\n callback(null, {\n privateKey: pki.privateKeyFromPem(priv),\n publicKey: pki.publicKeyFromPem(pub)\n });\n });\n }\n if(_detectSubtleCrypto('generateKey') &&\n _detectSubtleCrypto('exportKey')) {\n // use standard native generateKey\n return util.globalScope.crypto.subtle.generateKey({\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: bits,\n publicExponent: _intToUint8Array(e),\n hash: {name: 'SHA-256'}\n }, true /* key can be exported*/, ['sign', 'verify'])\n .then(function(pair) {\n return util.globalScope.crypto.subtle.exportKey(\n 'pkcs8', pair.privateKey);\n // avoiding catch(function(err) {...}) to support IE <= 8\n }).then(undefined, function(err) {\n callback(err);\n }).then(function(pkcs8) {\n if(pkcs8) {\n var privateKey = pki.privateKeyFromAsn1(\n asn1.fromDer(forge.util.createBuffer(pkcs8)));\n callback(null, {\n privateKey: privateKey,\n publicKey: pki.setRsaPublicKey(privateKey.n, privateKey.e)\n });\n }\n });\n }\n if(_detectSubtleMsCrypto('generateKey') &&\n _detectSubtleMsCrypto('exportKey')) {\n var genOp = util.globalScope.msCrypto.subtle.generateKey({\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: bits,\n publicExponent: _intToUint8Array(e),\n hash: {name: 'SHA-256'}\n }, true /* key can be exported*/, ['sign', 'verify']);\n genOp.oncomplete = function(e) {\n var pair = e.target.result;\n var exportOp = util.globalScope.msCrypto.subtle.exportKey(\n 'pkcs8', pair.privateKey);\n exportOp.oncomplete = function(e) {\n var pkcs8 = e.target.result;\n var privateKey = pki.privateKeyFromAsn1(\n asn1.fromDer(forge.util.createBuffer(pkcs8)));\n callback(null, {\n privateKey: privateKey,\n publicKey: pki.setRsaPublicKey(privateKey.n, privateKey.e)\n });\n };\n exportOp.onerror = function(err) {\n callback(err);\n };\n };\n genOp.onerror = function(err) {\n callback(err);\n };\n return;\n }\n } else {\n // try native sync\n if(_detectNodeCrypto('generateKeyPairSync')) {\n var keypair = _crypto.generateKeyPairSync('rsa', {\n modulusLength: bits,\n publicExponent: e,\n publicKeyEncoding: {\n type: 'spki',\n format: 'pem'\n },\n privateKeyEncoding: {\n type: 'pkcs8',\n format: 'pem'\n }\n });\n return {\n privateKey: pki.privateKeyFromPem(keypair.privateKey),\n publicKey: pki.publicKeyFromPem(keypair.publicKey)\n };\n }\n }\n }\n\n // use JavaScript implementation\n var state = pki.rsa.createKeyPairGenerationState(bits, e, options);\n if(!callback) {\n pki.rsa.stepKeyPairGenerationState(state, 0);\n return state.keys;\n }\n _generateKeyPair(state, options, callback);\n};\n\n/**\n * Sets an RSA public key from BigIntegers modulus and exponent.\n *\n * @param n the modulus.\n * @param e the exponent.\n *\n * @return the public key.\n */\npki.setRsaPublicKey = pki.rsa.setPublicKey = function(n, e) {\n var key = {\n n: n,\n e: e\n };\n\n /**\n * Encrypts the given data with this public key. Newer applications\n * should use the 'RSA-OAEP' decryption scheme, 'RSAES-PKCS1-V1_5' is for\n * legacy applications.\n *\n * @param data the byte string to encrypt.\n * @param scheme the encryption scheme to use:\n * 'RSAES-PKCS1-V1_5' (default),\n * 'RSA-OAEP',\n * 'RAW', 'NONE', or null to perform raw RSA encryption,\n * an object with an 'encode' property set to a function\n * with the signature 'function(data, key)' that returns\n * a binary-encoded string representing the encoded data.\n * @param schemeOptions any scheme-specific options.\n *\n * @return the encrypted byte string.\n */\n key.encrypt = function(data, scheme, schemeOptions) {\n if(typeof scheme === 'string') {\n scheme = scheme.toUpperCase();\n } else if(scheme === undefined) {\n scheme = 'RSAES-PKCS1-V1_5';\n }\n\n if(scheme === 'RSAES-PKCS1-V1_5') {\n scheme = {\n encode: function(m, key, pub) {\n return _encodePkcs1_v1_5(m, key, 0x02).getBytes();\n }\n };\n } else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') {\n scheme = {\n encode: function(m, key) {\n return forge.pkcs1.encode_rsa_oaep(key, m, schemeOptions);\n }\n };\n } else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) {\n scheme = {encode: function(e) {return e;}};\n } else if(typeof scheme === 'string') {\n throw new Error('Unsupported encryption scheme: \"' + scheme + '\".');\n }\n\n // do scheme-based encoding then rsa encryption\n var e = scheme.encode(data, key, true);\n return pki.rsa.encrypt(e, key, true);\n };\n\n /**\n * Verifies the given signature against the given digest.\n *\n * PKCS#1 supports multiple (currently two) signature schemes:\n * RSASSA-PKCS1-V1_5 and RSASSA-PSS.\n *\n * By default this implementation uses the \"old scheme\", i.e.\n * RSASSA-PKCS1-V1_5, in which case once RSA-decrypted, the\n * signature is an OCTET STRING that holds a DigestInfo.\n *\n * DigestInfo ::= SEQUENCE {\n * digestAlgorithm DigestAlgorithmIdentifier,\n * digest Digest\n * }\n * DigestAlgorithmIdentifier ::= AlgorithmIdentifier\n * Digest ::= OCTET STRING\n *\n * To perform PSS signature verification, provide an instance\n * of Forge PSS object as the scheme parameter.\n *\n * @param digest the message digest hash to compare against the signature,\n * as a binary-encoded string.\n * @param signature the signature to verify, as a binary-encoded string.\n * @param scheme signature verification scheme to use:\n * 'RSASSA-PKCS1-V1_5' or undefined for RSASSA PKCS#1 v1.5,\n * a Forge PSS object for RSASSA-PSS,\n * 'NONE' or null for none, DigestInfo will not be expected, but\n * PKCS#1 v1.5 padding will still be used.\n * @param options optional verify options\n * _parseAllDigestBytes testing flag to control parsing of all\n * digest bytes. Unsupported and not for general usage.\n * (default: true)\n *\n * @return true if the signature was verified, false if not.\n */\n key.verify = function(digest, signature, scheme, options) {\n if(typeof scheme === 'string') {\n scheme = scheme.toUpperCase();\n } else if(scheme === undefined) {\n scheme = 'RSASSA-PKCS1-V1_5';\n }\n if(options === undefined) {\n options = {\n _parseAllDigestBytes: true\n };\n }\n if(!('_parseAllDigestBytes' in options)) {\n options._parseAllDigestBytes = true;\n }\n\n if(scheme === 'RSASSA-PKCS1-V1_5') {\n scheme = {\n verify: function(digest, d) {\n // remove padding\n d = _decodePkcs1_v1_5(d, key, true);\n // d is ASN.1 BER-encoded DigestInfo\n var obj = asn1.fromDer(d, {\n parseAllBytes: options._parseAllDigestBytes\n });\n\n // validate DigestInfo\n var capture = {};\n var errors = [];\n if(!asn1.validate(obj, digestInfoValidator, capture, errors)) {\n var error = new Error(\n 'ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 ' +\n 'DigestInfo value.');\n error.errors = errors;\n throw error;\n }\n // check hash algorithm identifier\n // see PKCS1-v1-5DigestAlgorithms in RFC 8017\n // FIXME: add support to vaidator for strict value choices\n var oid = asn1.derToOid(capture.algorithmIdentifier);\n if(!(oid === forge.oids.md2 ||\n oid === forge.oids.md5 ||\n oid === forge.oids.sha1 ||\n oid === forge.oids.sha224 ||\n oid === forge.oids.sha256 ||\n oid === forge.oids.sha384 ||\n oid === forge.oids.sha512 ||\n oid === forge.oids['sha512-224'] ||\n oid === forge.oids['sha512-256'])) {\n var error = new Error(\n 'Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.');\n error.oid = oid;\n throw error;\n }\n\n // special check for md2 and md5 that NULL parameters exist\n if(oid === forge.oids.md2 || oid === forge.oids.md5) {\n if(!('parameters' in capture)) {\n throw new Error(\n 'ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 ' +\n 'DigestInfo value. ' +\n 'Missing algorithm identifer NULL parameters.');\n }\n }\n\n // compare the given digest to the decrypted one\n return digest === capture.digest;\n }\n };\n } else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) {\n scheme = {\n verify: function(digest, d) {\n // remove padding\n d = _decodePkcs1_v1_5(d, key, true);\n return digest === d;\n }\n };\n }\n\n // do rsa decryption w/o any decoding, then verify -- which does decoding\n var d = pki.rsa.decrypt(signature, key, true, false);\n return scheme.verify(digest, d, key.n.bitLength());\n };\n\n return key;\n};\n\n/**\n * Sets an RSA private key from BigIntegers modulus, exponent, primes,\n * prime exponents, and modular multiplicative inverse.\n *\n * @param n the modulus.\n * @param e the public exponent.\n * @param d the private exponent ((inverse of e) mod n).\n * @param p the first prime.\n * @param q the second prime.\n * @param dP exponent1 (d mod (p-1)).\n * @param dQ exponent2 (d mod (q-1)).\n * @param qInv ((inverse of q) mod p)\n *\n * @return the private key.\n */\npki.setRsaPrivateKey = pki.rsa.setPrivateKey = function(\n n, e, d, p, q, dP, dQ, qInv) {\n var key = {\n n: n,\n e: e,\n d: d,\n p: p,\n q: q,\n dP: dP,\n dQ: dQ,\n qInv: qInv\n };\n\n /**\n * Decrypts the given data with this private key. The decryption scheme\n * must match the one used to encrypt the data.\n *\n * @param data the byte string to decrypt.\n * @param scheme the decryption scheme to use:\n * 'RSAES-PKCS1-V1_5' (default),\n * 'RSA-OAEP',\n * 'RAW', 'NONE', or null to perform raw RSA decryption.\n * @param schemeOptions any scheme-specific options.\n *\n * @return the decrypted byte string.\n */\n key.decrypt = function(data, scheme, schemeOptions) {\n if(typeof scheme === 'string') {\n scheme = scheme.toUpperCase();\n } else if(scheme === undefined) {\n scheme = 'RSAES-PKCS1-V1_5';\n }\n\n // do rsa decryption w/o any decoding\n var d = pki.rsa.decrypt(data, key, false, false);\n\n if(scheme === 'RSAES-PKCS1-V1_5') {\n scheme = {decode: _decodePkcs1_v1_5};\n } else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') {\n scheme = {\n decode: function(d, key) {\n return forge.pkcs1.decode_rsa_oaep(key, d, schemeOptions);\n }\n };\n } else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) {\n scheme = {decode: function(d) {return d;}};\n } else {\n throw new Error('Unsupported encryption scheme: \"' + scheme + '\".');\n }\n\n // decode according to scheme\n return scheme.decode(d, key, false);\n };\n\n /**\n * Signs the given digest, producing a signature.\n *\n * PKCS#1 supports multiple (currently two) signature schemes:\n * RSASSA-PKCS1-V1_5 and RSASSA-PSS.\n *\n * By default this implementation uses the \"old scheme\", i.e.\n * RSASSA-PKCS1-V1_5. In order to generate a PSS signature, provide\n * an instance of Forge PSS object as the scheme parameter.\n *\n * @param md the message digest object with the hash to sign.\n * @param scheme the signature scheme to use:\n * 'RSASSA-PKCS1-V1_5' or undefined for RSASSA PKCS#1 v1.5,\n * a Forge PSS object for RSASSA-PSS,\n * 'NONE' or null for none, DigestInfo will not be used but\n * PKCS#1 v1.5 padding will still be used.\n *\n * @return the signature as a byte string.\n */\n key.sign = function(md, scheme) {\n /* Note: The internal implementation of RSA operations is being\n transitioned away from a PKCS#1 v1.5 hard-coded scheme. Some legacy\n code like the use of an encoding block identifier 'bt' will eventually\n be removed. */\n\n // private key operation\n var bt = false;\n\n if(typeof scheme === 'string') {\n scheme = scheme.toUpperCase();\n }\n\n if(scheme === undefined || scheme === 'RSASSA-PKCS1-V1_5') {\n scheme = {encode: emsaPkcs1v15encode};\n bt = 0x01;\n } else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) {\n scheme = {encode: function() {return md;}};\n bt = 0x01;\n }\n\n // encode and then encrypt\n var d = scheme.encode(md, key.n.bitLength());\n return pki.rsa.encrypt(d, key, bt);\n };\n\n return key;\n};\n\n/**\n * Wraps an RSAPrivateKey ASN.1 object in an ASN.1 PrivateKeyInfo object.\n *\n * @param rsaKey the ASN.1 RSAPrivateKey.\n *\n * @return the ASN.1 PrivateKeyInfo.\n */\npki.wrapRsaPrivateKey = function(rsaKey) {\n // PrivateKeyInfo\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // version (0)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n asn1.integerToDer(0).getBytes()),\n // privateKeyAlgorithm\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(pki.oids.rsaEncryption).getBytes()),\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')\n ]),\n // PrivateKey\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false,\n asn1.toDer(rsaKey).getBytes())\n ]);\n};\n\n/**\n * Converts a private key from an ASN.1 object.\n *\n * @param obj the ASN.1 representation of a PrivateKeyInfo containing an\n * RSAPrivateKey or an RSAPrivateKey.\n *\n * @return the private key.\n */\npki.privateKeyFromAsn1 = function(obj) {\n // get PrivateKeyInfo\n var capture = {};\n var errors = [];\n if(asn1.validate(obj, privateKeyValidator, capture, errors)) {\n obj = asn1.fromDer(forge.util.createBuffer(capture.privateKey));\n }\n\n // get RSAPrivateKey\n capture = {};\n errors = [];\n if(!asn1.validate(obj, rsaPrivateKeyValidator, capture, errors)) {\n var error = new Error('Cannot read private key. ' +\n 'ASN.1 object does not contain an RSAPrivateKey.');\n error.errors = errors;\n throw error;\n }\n\n // Note: Version is currently ignored.\n // capture.privateKeyVersion\n // FIXME: inefficient, get a BigInteger that uses byte strings\n var n, e, d, p, q, dP, dQ, qInv;\n n = forge.util.createBuffer(capture.privateKeyModulus).toHex();\n e = forge.util.createBuffer(capture.privateKeyPublicExponent).toHex();\n d = forge.util.createBuffer(capture.privateKeyPrivateExponent).toHex();\n p = forge.util.createBuffer(capture.privateKeyPrime1).toHex();\n q = forge.util.createBuffer(capture.privateKeyPrime2).toHex();\n dP = forge.util.createBuffer(capture.privateKeyExponent1).toHex();\n dQ = forge.util.createBuffer(capture.privateKeyExponent2).toHex();\n qInv = forge.util.createBuffer(capture.privateKeyCoefficient).toHex();\n\n // set private key\n return pki.setRsaPrivateKey(\n new BigInteger(n, 16),\n new BigInteger(e, 16),\n new BigInteger(d, 16),\n new BigInteger(p, 16),\n new BigInteger(q, 16),\n new BigInteger(dP, 16),\n new BigInteger(dQ, 16),\n new BigInteger(qInv, 16));\n};\n\n/**\n * Converts a private key to an ASN.1 RSAPrivateKey.\n *\n * @param key the private key.\n *\n * @return the ASN.1 representation of an RSAPrivateKey.\n */\npki.privateKeyToAsn1 = pki.privateKeyToRSAPrivateKey = function(key) {\n // RSAPrivateKey\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // version (0 = only 2 primes, 1 multiple primes)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n asn1.integerToDer(0).getBytes()),\n // modulus (n)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.n)),\n // publicExponent (e)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.e)),\n // privateExponent (d)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.d)),\n // privateKeyPrime1 (p)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.p)),\n // privateKeyPrime2 (q)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.q)),\n // privateKeyExponent1 (dP)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.dP)),\n // privateKeyExponent2 (dQ)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.dQ)),\n // coefficient (qInv)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.qInv))\n ]);\n};\n\n/**\n * Converts a public key from an ASN.1 SubjectPublicKeyInfo or RSAPublicKey.\n *\n * @param obj the asn1 representation of a SubjectPublicKeyInfo or RSAPublicKey.\n *\n * @return the public key.\n */\npki.publicKeyFromAsn1 = function(obj) {\n // get SubjectPublicKeyInfo\n var capture = {};\n var errors = [];\n if(asn1.validate(obj, publicKeyValidator, capture, errors)) {\n // get oid\n var oid = asn1.derToOid(capture.publicKeyOid);\n if(oid !== pki.oids.rsaEncryption) {\n var error = new Error('Cannot read public key. Unknown OID.');\n error.oid = oid;\n throw error;\n }\n obj = capture.rsaPublicKey;\n }\n\n // get RSA params\n errors = [];\n if(!asn1.validate(obj, rsaPublicKeyValidator, capture, errors)) {\n var error = new Error('Cannot read public key. ' +\n 'ASN.1 object does not contain an RSAPublicKey.');\n error.errors = errors;\n throw error;\n }\n\n // FIXME: inefficient, get a BigInteger that uses byte strings\n var n = forge.util.createBuffer(capture.publicKeyModulus).toHex();\n var e = forge.util.createBuffer(capture.publicKeyExponent).toHex();\n\n // set public key\n return pki.setRsaPublicKey(\n new BigInteger(n, 16),\n new BigInteger(e, 16));\n};\n\n/**\n * Converts a public key to an ASN.1 SubjectPublicKeyInfo.\n *\n * @param key the public key.\n *\n * @return the asn1 representation of a SubjectPublicKeyInfo.\n */\npki.publicKeyToAsn1 = pki.publicKeyToSubjectPublicKeyInfo = function(key) {\n // SubjectPublicKeyInfo\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // AlgorithmIdentifier\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // algorithm\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(pki.oids.rsaEncryption).getBytes()),\n // parameters (null)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')\n ]),\n // subjectPublicKey\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, [\n pki.publicKeyToRSAPublicKey(key)\n ])\n ]);\n};\n\n/**\n * Converts a public key to an ASN.1 RSAPublicKey.\n *\n * @param key the public key.\n *\n * @return the asn1 representation of a RSAPublicKey.\n */\npki.publicKeyToRSAPublicKey = function(key) {\n // RSAPublicKey\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // modulus (n)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.n)),\n // publicExponent (e)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.e))\n ]);\n};\n\n/**\n * Encodes a message using PKCS#1 v1.5 padding.\n *\n * @param m the message to encode.\n * @param key the RSA key to use.\n * @param bt the block type to use, i.e. either 0x01 (for signing) or 0x02\n * (for encryption).\n *\n * @return the padded byte buffer.\n */\nfunction _encodePkcs1_v1_5(m, key, bt) {\n var eb = forge.util.createBuffer();\n\n // get the length of the modulus in bytes\n var k = Math.ceil(key.n.bitLength() / 8);\n\n /* use PKCS#1 v1.5 padding */\n if(m.length > (k - 11)) {\n var error = new Error('Message is too long for PKCS#1 v1.5 padding.');\n error.length = m.length;\n error.max = k - 11;\n throw error;\n }\n\n /* A block type BT, a padding string PS, and the data D shall be\n formatted into an octet string EB, the encryption block:\n\n EB = 00 || BT || PS || 00 || D\n\n The block type BT shall be a single octet indicating the structure of\n the encryption block. For this version of the document it shall have\n value 00, 01, or 02. For a private-key operation, the block type\n shall be 00 or 01. For a public-key operation, it shall be 02.\n\n The padding string PS shall consist of k-3-||D|| octets. For block\n type 00, the octets shall have value 00; for block type 01, they\n shall have value FF; and for block type 02, they shall be\n pseudorandomly generated and nonzero. This makes the length of the\n encryption block EB equal to k. */\n\n // build the encryption block\n eb.putByte(0x00);\n eb.putByte(bt);\n\n // create the padding\n var padNum = k - 3 - m.length;\n var padByte;\n // private key op\n if(bt === 0x00 || bt === 0x01) {\n padByte = (bt === 0x00) ? 0x00 : 0xFF;\n for(var i = 0; i < padNum; ++i) {\n eb.putByte(padByte);\n }\n } else {\n // public key op\n // pad with random non-zero values\n while(padNum > 0) {\n var numZeros = 0;\n var padBytes = forge.random.getBytes(padNum);\n for(var i = 0; i < padNum; ++i) {\n padByte = padBytes.charCodeAt(i);\n if(padByte === 0) {\n ++numZeros;\n } else {\n eb.putByte(padByte);\n }\n }\n padNum = numZeros;\n }\n }\n\n // zero followed by message\n eb.putByte(0x00);\n eb.putBytes(m);\n\n return eb;\n}\n\n/**\n * Decodes a message using PKCS#1 v1.5 padding.\n *\n * @param em the message to decode.\n * @param key the RSA key to use.\n * @param pub true if the key is a public key, false if it is private.\n * @param ml the message length, if specified.\n *\n * @return the decoded bytes.\n */\nfunction _decodePkcs1_v1_5(em, key, pub, ml) {\n // get the length of the modulus in bytes\n var k = Math.ceil(key.n.bitLength() / 8);\n\n /* It is an error if any of the following conditions occurs:\n\n 1. The encryption block EB cannot be parsed unambiguously.\n 2. The padding string PS consists of fewer than eight octets\n or is inconsisent with the block type BT.\n 3. The decryption process is a public-key operation and the block\n type BT is not 00 or 01, or the decryption process is a\n private-key operation and the block type is not 02.\n */\n\n // parse the encryption block\n var eb = forge.util.createBuffer(em);\n var first = eb.getByte();\n var bt = eb.getByte();\n if(first !== 0x00 ||\n (pub && bt !== 0x00 && bt !== 0x01) ||\n (!pub && bt != 0x02) ||\n (pub && bt === 0x00 && typeof(ml) === 'undefined')) {\n throw new Error('Encryption block is invalid.');\n }\n\n var padNum = 0;\n if(bt === 0x00) {\n // check all padding bytes for 0x00\n padNum = k - 3 - ml;\n for(var i = 0; i < padNum; ++i) {\n if(eb.getByte() !== 0x00) {\n throw new Error('Encryption block is invalid.');\n }\n }\n } else if(bt === 0x01) {\n // find the first byte that isn't 0xFF, should be after all padding\n padNum = 0;\n while(eb.length() > 1) {\n if(eb.getByte() !== 0xFF) {\n --eb.read;\n break;\n }\n ++padNum;\n }\n } else if(bt === 0x02) {\n // look for 0x00 byte\n padNum = 0;\n while(eb.length() > 1) {\n if(eb.getByte() === 0x00) {\n --eb.read;\n break;\n }\n ++padNum;\n }\n }\n\n // zero must be 0x00 and padNum must be (k - 3 - message length)\n var zero = eb.getByte();\n if(zero !== 0x00 || padNum !== (k - 3 - eb.length())) {\n throw new Error('Encryption block is invalid.');\n }\n\n return eb.getBytes();\n}\n\n/**\n * Runs the key-generation algorithm asynchronously, either in the background\n * via Web Workers, or using the main thread and setImmediate.\n *\n * @param state the key-pair generation state.\n * @param [options] options for key-pair generation:\n * workerScript the worker script URL.\n * workers the number of web workers (if supported) to use,\n * (default: 2, -1 to use estimated cores minus one).\n * workLoad the size of the work load, ie: number of possible prime\n * numbers for each web worker to check per work assignment,\n * (default: 100).\n * @param callback(err, keypair) called once the operation completes.\n */\nfunction _generateKeyPair(state, options, callback) {\n if(typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\n var opts = {\n algorithm: {\n name: options.algorithm || 'PRIMEINC',\n options: {\n workers: options.workers || 2,\n workLoad: options.workLoad || 100,\n workerScript: options.workerScript\n }\n }\n };\n if('prng' in options) {\n opts.prng = options.prng;\n }\n\n generate();\n\n function generate() {\n // find p and then q (done in series to simplify)\n getPrime(state.pBits, function(err, num) {\n if(err) {\n return callback(err);\n }\n state.p = num;\n if(state.q !== null) {\n return finish(err, state.q);\n }\n getPrime(state.qBits, finish);\n });\n }\n\n function getPrime(bits, callback) {\n forge.prime.generateProbablePrime(bits, opts, callback);\n }\n\n function finish(err, num) {\n if(err) {\n return callback(err);\n }\n\n // set q\n state.q = num;\n\n // ensure p is larger than q (swap them if not)\n if(state.p.compareTo(state.q) < 0) {\n var tmp = state.p;\n state.p = state.q;\n state.q = tmp;\n }\n\n // ensure p is coprime with e\n if(state.p.subtract(BigInteger.ONE).gcd(state.e)\n .compareTo(BigInteger.ONE) !== 0) {\n state.p = null;\n generate();\n return;\n }\n\n // ensure q is coprime with e\n if(state.q.subtract(BigInteger.ONE).gcd(state.e)\n .compareTo(BigInteger.ONE) !== 0) {\n state.q = null;\n getPrime(state.qBits, finish);\n return;\n }\n\n // compute phi: (p - 1)(q - 1) (Euler's totient function)\n state.p1 = state.p.subtract(BigInteger.ONE);\n state.q1 = state.q.subtract(BigInteger.ONE);\n state.phi = state.p1.multiply(state.q1);\n\n // ensure e and phi are coprime\n if(state.phi.gcd(state.e).compareTo(BigInteger.ONE) !== 0) {\n // phi and e aren't coprime, so generate a new p and q\n state.p = state.q = null;\n generate();\n return;\n }\n\n // create n, ensure n is has the right number of bits\n state.n = state.p.multiply(state.q);\n if(state.n.bitLength() !== state.bits) {\n // failed, get new q\n state.q = null;\n getPrime(state.qBits, finish);\n return;\n }\n\n // set keys\n var d = state.e.modInverse(state.phi);\n state.keys = {\n privateKey: pki.rsa.setPrivateKey(\n state.n, state.e, d, state.p, state.q,\n d.mod(state.p1), d.mod(state.q1),\n state.q.modInverse(state.p)),\n publicKey: pki.rsa.setPublicKey(state.n, state.e)\n };\n\n callback(null, state.keys);\n }\n}\n\n/**\n * Converts a positive BigInteger into 2's-complement big-endian bytes.\n *\n * @param b the big integer to convert.\n *\n * @return the bytes.\n */\nfunction _bnToBytes(b) {\n // prepend 0x00 if first byte >= 0x80\n var hex = b.toString(16);\n if(hex[0] >= '8') {\n hex = '00' + hex;\n }\n var bytes = forge.util.hexToBytes(hex);\n\n // ensure integer is minimally-encoded\n if(bytes.length > 1 &&\n // leading 0x00 for positive integer\n ((bytes.charCodeAt(0) === 0 &&\n (bytes.charCodeAt(1) & 0x80) === 0) ||\n // leading 0xFF for negative integer\n (bytes.charCodeAt(0) === 0xFF &&\n (bytes.charCodeAt(1) & 0x80) === 0x80))) {\n return bytes.substr(1);\n }\n return bytes;\n}\n\n/**\n * Returns the required number of Miller-Rabin tests to generate a\n * prime with an error probability of (1/2)^80.\n *\n * See Handbook of Applied Cryptography Chapter 4, Table 4.4.\n *\n * @param bits the bit size.\n *\n * @return the required number of iterations.\n */\nfunction _getMillerRabinTests(bits) {\n if(bits <= 100) return 27;\n if(bits <= 150) return 18;\n if(bits <= 200) return 15;\n if(bits <= 250) return 12;\n if(bits <= 300) return 9;\n if(bits <= 350) return 8;\n if(bits <= 400) return 7;\n if(bits <= 500) return 6;\n if(bits <= 600) return 5;\n if(bits <= 800) return 4;\n if(bits <= 1250) return 3;\n return 2;\n}\n\n/**\n * Performs feature detection on the Node crypto interface.\n *\n * @param fn the feature (function) to detect.\n *\n * @return true if detected, false if not.\n */\nfunction _detectNodeCrypto(fn) {\n return forge.util.isNodejs && typeof _crypto[fn] === 'function';\n}\n\n/**\n * Performs feature detection on the SubtleCrypto interface.\n *\n * @param fn the feature (function) to detect.\n *\n * @return true if detected, false if not.\n */\nfunction _detectSubtleCrypto(fn) {\n return (typeof util.globalScope !== 'undefined' &&\n typeof util.globalScope.crypto === 'object' &&\n typeof util.globalScope.crypto.subtle === 'object' &&\n typeof util.globalScope.crypto.subtle[fn] === 'function');\n}\n\n/**\n * Performs feature detection on the deprecated Microsoft Internet Explorer\n * outdated SubtleCrypto interface. This function should only be used after\n * checking for the modern, standard SubtleCrypto interface.\n *\n * @param fn the feature (function) to detect.\n *\n * @return true if detected, false if not.\n */\nfunction _detectSubtleMsCrypto(fn) {\n return (typeof util.globalScope !== 'undefined' &&\n typeof util.globalScope.msCrypto === 'object' &&\n typeof util.globalScope.msCrypto.subtle === 'object' &&\n typeof util.globalScope.msCrypto.subtle[fn] === 'function');\n}\n\nfunction _intToUint8Array(x) {\n var bytes = forge.util.hexToBytes(x.toString(16));\n var buffer = new Uint8Array(bytes.length);\n for(var i = 0; i < bytes.length; ++i) {\n buffer[i] = bytes.charCodeAt(i);\n }\n return buffer;\n}\n\nfunction _privateKeyFromJwk(jwk) {\n if(jwk.kty !== 'RSA') {\n throw new Error(\n 'Unsupported key algorithm \"' + jwk.kty + '\"; algorithm must be \"RSA\".');\n }\n return pki.setRsaPrivateKey(\n _base64ToBigInt(jwk.n),\n _base64ToBigInt(jwk.e),\n _base64ToBigInt(jwk.d),\n _base64ToBigInt(jwk.p),\n _base64ToBigInt(jwk.q),\n _base64ToBigInt(jwk.dp),\n _base64ToBigInt(jwk.dq),\n _base64ToBigInt(jwk.qi));\n}\n\nfunction _publicKeyFromJwk(jwk) {\n if(jwk.kty !== 'RSA') {\n throw new Error('Key algorithm must be \"RSA\".');\n }\n return pki.setRsaPublicKey(\n _base64ToBigInt(jwk.n),\n _base64ToBigInt(jwk.e));\n}\n\nfunction _base64ToBigInt(b64) {\n return new BigInteger(forge.util.bytesToHex(forge.util.decode64(b64)), 16);\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/rsa.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/sha1.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/sha1.js ***!
|
||
\*********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Secure Hash Algorithm with 160-bit digest (SHA-1) implementation.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2015 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar sha1 = module.exports = forge.sha1 = forge.sha1 || {};\nforge.md.sha1 = forge.md.algorithms.sha1 = sha1;\n\n/**\n * Creates a SHA-1 message digest object.\n *\n * @return a message digest object.\n */\nsha1.create = function() {\n // do initialization as necessary\n if(!_initialized) {\n _init();\n }\n\n // SHA-1 state contains five 32-bit integers\n var _state = null;\n\n // input buffer\n var _input = forge.util.createBuffer();\n\n // used for word storage\n var _w = new Array(80);\n\n // message digest object\n var md = {\n algorithm: 'sha1',\n blockLength: 64,\n digestLength: 20,\n // 56-bit length of message so far (does not including padding)\n messageLength: 0,\n // true message length\n fullMessageLength: null,\n // size of message length in bytes\n messageLengthSize: 8\n };\n\n /**\n * Starts the digest.\n *\n * @return this digest object.\n */\n md.start = function() {\n // up to 56-bit message length for convenience\n md.messageLength = 0;\n\n // full message length (set md.messageLength64 for backwards-compatibility)\n md.fullMessageLength = md.messageLength64 = [];\n var int32s = md.messageLengthSize / 4;\n for(var i = 0; i < int32s; ++i) {\n md.fullMessageLength.push(0);\n }\n _input = forge.util.createBuffer();\n _state = {\n h0: 0x67452301,\n h1: 0xEFCDAB89,\n h2: 0x98BADCFE,\n h3: 0x10325476,\n h4: 0xC3D2E1F0\n };\n return md;\n };\n // start digest automatically for first time\n md.start();\n\n /**\n * Updates the digest with the given message input. The given input can\n * treated as raw input (no encoding will be applied) or an encoding of\n * 'utf8' maybe given to encode the input using UTF-8.\n *\n * @param msg the message input to update with.\n * @param encoding the encoding to use (default: 'raw', other: 'utf8').\n *\n * @return this digest object.\n */\n md.update = function(msg, encoding) {\n if(encoding === 'utf8') {\n msg = forge.util.encodeUtf8(msg);\n }\n\n // update message length\n var len = msg.length;\n md.messageLength += len;\n len = [(len / 0x100000000) >>> 0, len >>> 0];\n for(var i = md.fullMessageLength.length - 1; i >= 0; --i) {\n md.fullMessageLength[i] += len[1];\n len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0);\n md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0;\n len[0] = ((len[1] / 0x100000000) >>> 0);\n }\n\n // add bytes to input buffer\n _input.putBytes(msg);\n\n // process bytes\n _update(_state, _w, _input);\n\n // compact input buffer every 2K or if empty\n if(_input.read > 2048 || _input.length() === 0) {\n _input.compact();\n }\n\n return md;\n };\n\n /**\n * Produces the digest.\n *\n * @return a byte buffer containing the digest value.\n */\n md.digest = function() {\n /* Note: Here we copy the remaining bytes in the input buffer and\n add the appropriate SHA-1 padding. Then we do the final update\n on a copy of the state so that if the user wants to get\n intermediate digests they can do so. */\n\n /* Determine the number of bytes that must be added to the message\n to ensure its length is congruent to 448 mod 512. In other words,\n the data to be digested must be a multiple of 512 bits (or 128 bytes).\n This data includes the message, some padding, and the length of the\n message. Since the length of the message will be encoded as 8 bytes (64\n bits), that means that the last segment of the data must have 56 bytes\n (448 bits) of message and padding. Therefore, the length of the message\n plus the padding must be congruent to 448 mod 512 because\n 512 - 128 = 448.\n\n In order to fill up the message length it must be filled with\n padding that begins with 1 bit followed by all 0 bits. Padding\n must *always* be present, so if the message length is already\n congruent to 448 mod 512, then 512 padding bits must be added. */\n\n var finalBlock = forge.util.createBuffer();\n finalBlock.putBytes(_input.bytes());\n\n // compute remaining size to be digested (include message length size)\n var remaining = (\n md.fullMessageLength[md.fullMessageLength.length - 1] +\n md.messageLengthSize);\n\n // add padding for overflow blockSize - overflow\n // _padding starts with 1 byte with first bit is set (byte value 128), then\n // there may be up to (blockSize - 1) other pad bytes\n var overflow = remaining & (md.blockLength - 1);\n finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow));\n\n // serialize message length in bits in big-endian order; since length\n // is stored in bytes we multiply by 8 and add carry from next int\n var next, carry;\n var bits = md.fullMessageLength[0] * 8;\n for(var i = 0; i < md.fullMessageLength.length - 1; ++i) {\n next = md.fullMessageLength[i + 1] * 8;\n carry = (next / 0x100000000) >>> 0;\n bits += carry;\n finalBlock.putInt32(bits >>> 0);\n bits = next >>> 0;\n }\n finalBlock.putInt32(bits);\n\n var s2 = {\n h0: _state.h0,\n h1: _state.h1,\n h2: _state.h2,\n h3: _state.h3,\n h4: _state.h4\n };\n _update(s2, _w, finalBlock);\n var rval = forge.util.createBuffer();\n rval.putInt32(s2.h0);\n rval.putInt32(s2.h1);\n rval.putInt32(s2.h2);\n rval.putInt32(s2.h3);\n rval.putInt32(s2.h4);\n return rval;\n };\n\n return md;\n};\n\n// sha-1 padding bytes not initialized yet\nvar _padding = null;\nvar _initialized = false;\n\n/**\n * Initializes the constant tables.\n */\nfunction _init() {\n // create padding\n _padding = String.fromCharCode(128);\n _padding += forge.util.fillString(String.fromCharCode(0x00), 64);\n\n // now initialized\n _initialized = true;\n}\n\n/**\n * Updates a SHA-1 state with the given byte buffer.\n *\n * @param s the SHA-1 state to update.\n * @param w the array to use to store words.\n * @param bytes the byte buffer to update with.\n */\nfunction _update(s, w, bytes) {\n // consume 512 bit (64 byte) chunks\n var t, a, b, c, d, e, f, i;\n var len = bytes.length();\n while(len >= 64) {\n // the w array will be populated with sixteen 32-bit big-endian words\n // and then extended into 80 32-bit words according to SHA-1 algorithm\n // and for 32-79 using Max Locktyukhin's optimization\n\n // initialize hash value for this chunk\n a = s.h0;\n b = s.h1;\n c = s.h2;\n d = s.h3;\n e = s.h4;\n\n // round 1\n for(i = 0; i < 16; ++i) {\n t = bytes.getInt32();\n w[i] = t;\n f = d ^ (b & (c ^ d));\n t = ((a << 5) | (a >>> 27)) + f + e + 0x5A827999 + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n for(; i < 20; ++i) {\n t = (w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]);\n t = (t << 1) | (t >>> 31);\n w[i] = t;\n f = d ^ (b & (c ^ d));\n t = ((a << 5) | (a >>> 27)) + f + e + 0x5A827999 + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n // round 2\n for(; i < 32; ++i) {\n t = (w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]);\n t = (t << 1) | (t >>> 31);\n w[i] = t;\n f = b ^ c ^ d;\n t = ((a << 5) | (a >>> 27)) + f + e + 0x6ED9EBA1 + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n for(; i < 40; ++i) {\n t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]);\n t = (t << 2) | (t >>> 30);\n w[i] = t;\n f = b ^ c ^ d;\n t = ((a << 5) | (a >>> 27)) + f + e + 0x6ED9EBA1 + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n // round 3\n for(; i < 60; ++i) {\n t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]);\n t = (t << 2) | (t >>> 30);\n w[i] = t;\n f = (b & c) | (d & (b ^ c));\n t = ((a << 5) | (a >>> 27)) + f + e + 0x8F1BBCDC + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n // round 4\n for(; i < 80; ++i) {\n t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]);\n t = (t << 2) | (t >>> 30);\n w[i] = t;\n f = b ^ c ^ d;\n t = ((a << 5) | (a >>> 27)) + f + e + 0xCA62C1D6 + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n\n // update hash state\n s.h0 = (s.h0 + a) | 0;\n s.h1 = (s.h1 + b) | 0;\n s.h2 = (s.h2 + c) | 0;\n s.h3 = (s.h3 + d) | 0;\n s.h4 = (s.h4 + e) | 0;\n\n len -= 64;\n }\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/sha1.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/sha256.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/sha256.js ***!
|
||
\***********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Secure Hash Algorithm with 256-bit digest (SHA-256) implementation.\n *\n * See FIPS 180-2 for details.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2015 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar sha256 = module.exports = forge.sha256 = forge.sha256 || {};\nforge.md.sha256 = forge.md.algorithms.sha256 = sha256;\n\n/**\n * Creates a SHA-256 message digest object.\n *\n * @return a message digest object.\n */\nsha256.create = function() {\n // do initialization as necessary\n if(!_initialized) {\n _init();\n }\n\n // SHA-256 state contains eight 32-bit integers\n var _state = null;\n\n // input buffer\n var _input = forge.util.createBuffer();\n\n // used for word storage\n var _w = new Array(64);\n\n // message digest object\n var md = {\n algorithm: 'sha256',\n blockLength: 64,\n digestLength: 32,\n // 56-bit length of message so far (does not including padding)\n messageLength: 0,\n // true message length\n fullMessageLength: null,\n // size of message length in bytes\n messageLengthSize: 8\n };\n\n /**\n * Starts the digest.\n *\n * @return this digest object.\n */\n md.start = function() {\n // up to 56-bit message length for convenience\n md.messageLength = 0;\n\n // full message length (set md.messageLength64 for backwards-compatibility)\n md.fullMessageLength = md.messageLength64 = [];\n var int32s = md.messageLengthSize / 4;\n for(var i = 0; i < int32s; ++i) {\n md.fullMessageLength.push(0);\n }\n _input = forge.util.createBuffer();\n _state = {\n h0: 0x6A09E667,\n h1: 0xBB67AE85,\n h2: 0x3C6EF372,\n h3: 0xA54FF53A,\n h4: 0x510E527F,\n h5: 0x9B05688C,\n h6: 0x1F83D9AB,\n h7: 0x5BE0CD19\n };\n return md;\n };\n // start digest automatically for first time\n md.start();\n\n /**\n * Updates the digest with the given message input. The given input can\n * treated as raw input (no encoding will be applied) or an encoding of\n * 'utf8' maybe given to encode the input using UTF-8.\n *\n * @param msg the message input to update with.\n * @param encoding the encoding to use (default: 'raw', other: 'utf8').\n *\n * @return this digest object.\n */\n md.update = function(msg, encoding) {\n if(encoding === 'utf8') {\n msg = forge.util.encodeUtf8(msg);\n }\n\n // update message length\n var len = msg.length;\n md.messageLength += len;\n len = [(len / 0x100000000) >>> 0, len >>> 0];\n for(var i = md.fullMessageLength.length - 1; i >= 0; --i) {\n md.fullMessageLength[i] += len[1];\n len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0);\n md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0;\n len[0] = ((len[1] / 0x100000000) >>> 0);\n }\n\n // add bytes to input buffer\n _input.putBytes(msg);\n\n // process bytes\n _update(_state, _w, _input);\n\n // compact input buffer every 2K or if empty\n if(_input.read > 2048 || _input.length() === 0) {\n _input.compact();\n }\n\n return md;\n };\n\n /**\n * Produces the digest.\n *\n * @return a byte buffer containing the digest value.\n */\n md.digest = function() {\n /* Note: Here we copy the remaining bytes in the input buffer and\n add the appropriate SHA-256 padding. Then we do the final update\n on a copy of the state so that if the user wants to get\n intermediate digests they can do so. */\n\n /* Determine the number of bytes that must be added to the message\n to ensure its length is congruent to 448 mod 512. In other words,\n the data to be digested must be a multiple of 512 bits (or 128 bytes).\n This data includes the message, some padding, and the length of the\n message. Since the length of the message will be encoded as 8 bytes (64\n bits), that means that the last segment of the data must have 56 bytes\n (448 bits) of message and padding. Therefore, the length of the message\n plus the padding must be congruent to 448 mod 512 because\n 512 - 128 = 448.\n\n In order to fill up the message length it must be filled with\n padding that begins with 1 bit followed by all 0 bits. Padding\n must *always* be present, so if the message length is already\n congruent to 448 mod 512, then 512 padding bits must be added. */\n\n var finalBlock = forge.util.createBuffer();\n finalBlock.putBytes(_input.bytes());\n\n // compute remaining size to be digested (include message length size)\n var remaining = (\n md.fullMessageLength[md.fullMessageLength.length - 1] +\n md.messageLengthSize);\n\n // add padding for overflow blockSize - overflow\n // _padding starts with 1 byte with first bit is set (byte value 128), then\n // there may be up to (blockSize - 1) other pad bytes\n var overflow = remaining & (md.blockLength - 1);\n finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow));\n\n // serialize message length in bits in big-endian order; since length\n // is stored in bytes we multiply by 8 and add carry from next int\n var next, carry;\n var bits = md.fullMessageLength[0] * 8;\n for(var i = 0; i < md.fullMessageLength.length - 1; ++i) {\n next = md.fullMessageLength[i + 1] * 8;\n carry = (next / 0x100000000) >>> 0;\n bits += carry;\n finalBlock.putInt32(bits >>> 0);\n bits = next >>> 0;\n }\n finalBlock.putInt32(bits);\n\n var s2 = {\n h0: _state.h0,\n h1: _state.h1,\n h2: _state.h2,\n h3: _state.h3,\n h4: _state.h4,\n h5: _state.h5,\n h6: _state.h6,\n h7: _state.h7\n };\n _update(s2, _w, finalBlock);\n var rval = forge.util.createBuffer();\n rval.putInt32(s2.h0);\n rval.putInt32(s2.h1);\n rval.putInt32(s2.h2);\n rval.putInt32(s2.h3);\n rval.putInt32(s2.h4);\n rval.putInt32(s2.h5);\n rval.putInt32(s2.h6);\n rval.putInt32(s2.h7);\n return rval;\n };\n\n return md;\n};\n\n// sha-256 padding bytes not initialized yet\nvar _padding = null;\nvar _initialized = false;\n\n// table of constants\nvar _k = null;\n\n/**\n * Initializes the constant tables.\n */\nfunction _init() {\n // create padding\n _padding = String.fromCharCode(128);\n _padding += forge.util.fillString(String.fromCharCode(0x00), 64);\n\n // create K table for SHA-256\n _k = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,\n 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,\n 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,\n 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];\n\n // now initialized\n _initialized = true;\n}\n\n/**\n * Updates a SHA-256 state with the given byte buffer.\n *\n * @param s the SHA-256 state to update.\n * @param w the array to use to store words.\n * @param bytes the byte buffer to update with.\n */\nfunction _update(s, w, bytes) {\n // consume 512 bit (64 byte) chunks\n var t1, t2, s0, s1, ch, maj, i, a, b, c, d, e, f, g, h;\n var len = bytes.length();\n while(len >= 64) {\n // the w array will be populated with sixteen 32-bit big-endian words\n // and then extended into 64 32-bit words according to SHA-256\n for(i = 0; i < 16; ++i) {\n w[i] = bytes.getInt32();\n }\n for(; i < 64; ++i) {\n // XOR word 2 words ago rot right 17, rot right 19, shft right 10\n t1 = w[i - 2];\n t1 =\n ((t1 >>> 17) | (t1 << 15)) ^\n ((t1 >>> 19) | (t1 << 13)) ^\n (t1 >>> 10);\n // XOR word 15 words ago rot right 7, rot right 18, shft right 3\n t2 = w[i - 15];\n t2 =\n ((t2 >>> 7) | (t2 << 25)) ^\n ((t2 >>> 18) | (t2 << 14)) ^\n (t2 >>> 3);\n // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^32\n w[i] = (t1 + w[i - 7] + t2 + w[i - 16]) | 0;\n }\n\n // initialize hash value for this chunk\n a = s.h0;\n b = s.h1;\n c = s.h2;\n d = s.h3;\n e = s.h4;\n f = s.h5;\n g = s.h6;\n h = s.h7;\n\n // round function\n for(i = 0; i < 64; ++i) {\n // Sum1(e)\n s1 =\n ((e >>> 6) | (e << 26)) ^\n ((e >>> 11) | (e << 21)) ^\n ((e >>> 25) | (e << 7));\n // Ch(e, f, g) (optimized the same way as SHA-1)\n ch = g ^ (e & (f ^ g));\n // Sum0(a)\n s0 =\n ((a >>> 2) | (a << 30)) ^\n ((a >>> 13) | (a << 19)) ^\n ((a >>> 22) | (a << 10));\n // Maj(a, b, c) (optimized the same way as SHA-1)\n maj = (a & b) | (c & (a ^ b));\n\n // main algorithm\n t1 = h + s1 + ch + _k[i] + w[i];\n t2 = s0 + maj;\n h = g;\n g = f;\n f = e;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n // can't truncate with `| 0`\n e = (d + t1) >>> 0;\n d = c;\n c = b;\n b = a;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n // can't truncate with `| 0`\n a = (t1 + t2) >>> 0;\n }\n\n // update hash state\n s.h0 = (s.h0 + a) | 0;\n s.h1 = (s.h1 + b) | 0;\n s.h2 = (s.h2 + c) | 0;\n s.h3 = (s.h3 + d) | 0;\n s.h4 = (s.h4 + e) | 0;\n s.h5 = (s.h5 + f) | 0;\n s.h6 = (s.h6 + g) | 0;\n s.h7 = (s.h7 + h) | 0;\n len -= 64;\n }\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/sha256.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/sha512.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/sha512.js ***!
|
||
\***********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Secure Hash Algorithm with a 1024-bit block size implementation.\n *\n * This includes: SHA-512, SHA-384, SHA-512/224, and SHA-512/256. For\n * SHA-256 (block size 512 bits), see sha256.js.\n *\n * See FIPS 180-4 for details.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2014-2015 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar sha512 = module.exports = forge.sha512 = forge.sha512 || {};\n\n// SHA-512\nforge.md.sha512 = forge.md.algorithms.sha512 = sha512;\n\n// SHA-384\nvar sha384 = forge.sha384 = forge.sha512.sha384 = forge.sha512.sha384 || {};\nsha384.create = function() {\n return sha512.create('SHA-384');\n};\nforge.md.sha384 = forge.md.algorithms.sha384 = sha384;\n\n// SHA-512/256\nforge.sha512.sha256 = forge.sha512.sha256 || {\n create: function() {\n return sha512.create('SHA-512/256');\n }\n};\nforge.md['sha512/256'] = forge.md.algorithms['sha512/256'] =\n forge.sha512.sha256;\n\n// SHA-512/224\nforge.sha512.sha224 = forge.sha512.sha224 || {\n create: function() {\n return sha512.create('SHA-512/224');\n }\n};\nforge.md['sha512/224'] = forge.md.algorithms['sha512/224'] =\n forge.sha512.sha224;\n\n/**\n * Creates a SHA-2 message digest object.\n *\n * @param algorithm the algorithm to use (SHA-512, SHA-384, SHA-512/224,\n * SHA-512/256).\n *\n * @return a message digest object.\n */\nsha512.create = function(algorithm) {\n // do initialization as necessary\n if(!_initialized) {\n _init();\n }\n\n if(typeof algorithm === 'undefined') {\n algorithm = 'SHA-512';\n }\n\n if(!(algorithm in _states)) {\n throw new Error('Invalid SHA-512 algorithm: ' + algorithm);\n }\n\n // SHA-512 state contains eight 64-bit integers (each as two 32-bit ints)\n var _state = _states[algorithm];\n var _h = null;\n\n // input buffer\n var _input = forge.util.createBuffer();\n\n // used for 64-bit word storage\n var _w = new Array(80);\n for(var wi = 0; wi < 80; ++wi) {\n _w[wi] = new Array(2);\n }\n\n // determine digest length by algorithm name (default)\n var digestLength = 64;\n switch(algorithm) {\n case 'SHA-384':\n digestLength = 48;\n break;\n case 'SHA-512/256':\n digestLength = 32;\n break;\n case 'SHA-512/224':\n digestLength = 28;\n break;\n }\n\n // message digest object\n var md = {\n // SHA-512 => sha512\n algorithm: algorithm.replace('-', '').toLowerCase(),\n blockLength: 128,\n digestLength: digestLength,\n // 56-bit length of message so far (does not including padding)\n messageLength: 0,\n // true message length\n fullMessageLength: null,\n // size of message length in bytes\n messageLengthSize: 16\n };\n\n /**\n * Starts the digest.\n *\n * @return this digest object.\n */\n md.start = function() {\n // up to 56-bit message length for convenience\n md.messageLength = 0;\n\n // full message length (set md.messageLength128 for backwards-compatibility)\n md.fullMessageLength = md.messageLength128 = [];\n var int32s = md.messageLengthSize / 4;\n for(var i = 0; i < int32s; ++i) {\n md.fullMessageLength.push(0);\n }\n _input = forge.util.createBuffer();\n _h = new Array(_state.length);\n for(var i = 0; i < _state.length; ++i) {\n _h[i] = _state[i].slice(0);\n }\n return md;\n };\n // start digest automatically for first time\n md.start();\n\n /**\n * Updates the digest with the given message input. The given input can\n * treated as raw input (no encoding will be applied) or an encoding of\n * 'utf8' maybe given to encode the input using UTF-8.\n *\n * @param msg the message input to update with.\n * @param encoding the encoding to use (default: 'raw', other: 'utf8').\n *\n * @return this digest object.\n */\n md.update = function(msg, encoding) {\n if(encoding === 'utf8') {\n msg = forge.util.encodeUtf8(msg);\n }\n\n // update message length\n var len = msg.length;\n md.messageLength += len;\n len = [(len / 0x100000000) >>> 0, len >>> 0];\n for(var i = md.fullMessageLength.length - 1; i >= 0; --i) {\n md.fullMessageLength[i] += len[1];\n len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0);\n md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0;\n len[0] = ((len[1] / 0x100000000) >>> 0);\n }\n\n // add bytes to input buffer\n _input.putBytes(msg);\n\n // process bytes\n _update(_h, _w, _input);\n\n // compact input buffer every 2K or if empty\n if(_input.read > 2048 || _input.length() === 0) {\n _input.compact();\n }\n\n return md;\n };\n\n /**\n * Produces the digest.\n *\n * @return a byte buffer containing the digest value.\n */\n md.digest = function() {\n /* Note: Here we copy the remaining bytes in the input buffer and\n add the appropriate SHA-512 padding. Then we do the final update\n on a copy of the state so that if the user wants to get\n intermediate digests they can do so. */\n\n /* Determine the number of bytes that must be added to the message\n to ensure its length is congruent to 896 mod 1024. In other words,\n the data to be digested must be a multiple of 1024 bits (or 128 bytes).\n This data includes the message, some padding, and the length of the\n message. Since the length of the message will be encoded as 16 bytes (128\n bits), that means that the last segment of the data must have 112 bytes\n (896 bits) of message and padding. Therefore, the length of the message\n plus the padding must be congruent to 896 mod 1024 because\n 1024 - 128 = 896.\n\n In order to fill up the message length it must be filled with\n padding that begins with 1 bit followed by all 0 bits. Padding\n must *always* be present, so if the message length is already\n congruent to 896 mod 1024, then 1024 padding bits must be added. */\n\n var finalBlock = forge.util.createBuffer();\n finalBlock.putBytes(_input.bytes());\n\n // compute remaining size to be digested (include message length size)\n var remaining = (\n md.fullMessageLength[md.fullMessageLength.length - 1] +\n md.messageLengthSize);\n\n // add padding for overflow blockSize - overflow\n // _padding starts with 1 byte with first bit is set (byte value 128), then\n // there may be up to (blockSize - 1) other pad bytes\n var overflow = remaining & (md.blockLength - 1);\n finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow));\n\n // serialize message length in bits in big-endian order; since length\n // is stored in bytes we multiply by 8 and add carry from next int\n var next, carry;\n var bits = md.fullMessageLength[0] * 8;\n for(var i = 0; i < md.fullMessageLength.length - 1; ++i) {\n next = md.fullMessageLength[i + 1] * 8;\n carry = (next / 0x100000000) >>> 0;\n bits += carry;\n finalBlock.putInt32(bits >>> 0);\n bits = next >>> 0;\n }\n finalBlock.putInt32(bits);\n\n var h = new Array(_h.length);\n for(var i = 0; i < _h.length; ++i) {\n h[i] = _h[i].slice(0);\n }\n _update(h, _w, finalBlock);\n var rval = forge.util.createBuffer();\n var hlen;\n if(algorithm === 'SHA-512') {\n hlen = h.length;\n } else if(algorithm === 'SHA-384') {\n hlen = h.length - 2;\n } else {\n hlen = h.length - 4;\n }\n for(var i = 0; i < hlen; ++i) {\n rval.putInt32(h[i][0]);\n if(i !== hlen - 1 || algorithm !== 'SHA-512/224') {\n rval.putInt32(h[i][1]);\n }\n }\n return rval;\n };\n\n return md;\n};\n\n// sha-512 padding bytes not initialized yet\nvar _padding = null;\nvar _initialized = false;\n\n// table of constants\nvar _k = null;\n\n// initial hash states\nvar _states = null;\n\n/**\n * Initializes the constant tables.\n */\nfunction _init() {\n // create padding\n _padding = String.fromCharCode(128);\n _padding += forge.util.fillString(String.fromCharCode(0x00), 128);\n\n // create K table for SHA-512\n _k = [\n [0x428a2f98, 0xd728ae22], [0x71374491, 0x23ef65cd],\n [0xb5c0fbcf, 0xec4d3b2f], [0xe9b5dba5, 0x8189dbbc],\n [0x3956c25b, 0xf348b538], [0x59f111f1, 0xb605d019],\n [0x923f82a4, 0xaf194f9b], [0xab1c5ed5, 0xda6d8118],\n [0xd807aa98, 0xa3030242], [0x12835b01, 0x45706fbe],\n [0x243185be, 0x4ee4b28c], [0x550c7dc3, 0xd5ffb4e2],\n [0x72be5d74, 0xf27b896f], [0x80deb1fe, 0x3b1696b1],\n [0x9bdc06a7, 0x25c71235], [0xc19bf174, 0xcf692694],\n [0xe49b69c1, 0x9ef14ad2], [0xefbe4786, 0x384f25e3],\n [0x0fc19dc6, 0x8b8cd5b5], [0x240ca1cc, 0x77ac9c65],\n [0x2de92c6f, 0x592b0275], [0x4a7484aa, 0x6ea6e483],\n [0x5cb0a9dc, 0xbd41fbd4], [0x76f988da, 0x831153b5],\n [0x983e5152, 0xee66dfab], [0xa831c66d, 0x2db43210],\n [0xb00327c8, 0x98fb213f], [0xbf597fc7, 0xbeef0ee4],\n [0xc6e00bf3, 0x3da88fc2], [0xd5a79147, 0x930aa725],\n [0x06ca6351, 0xe003826f], [0x14292967, 0x0a0e6e70],\n [0x27b70a85, 0x46d22ffc], [0x2e1b2138, 0x5c26c926],\n [0x4d2c6dfc, 0x5ac42aed], [0x53380d13, 0x9d95b3df],\n [0x650a7354, 0x8baf63de], [0x766a0abb, 0x3c77b2a8],\n [0x81c2c92e, 0x47edaee6], [0x92722c85, 0x1482353b],\n [0xa2bfe8a1, 0x4cf10364], [0xa81a664b, 0xbc423001],\n [0xc24b8b70, 0xd0f89791], [0xc76c51a3, 0x0654be30],\n [0xd192e819, 0xd6ef5218], [0xd6990624, 0x5565a910],\n [0xf40e3585, 0x5771202a], [0x106aa070, 0x32bbd1b8],\n [0x19a4c116, 0xb8d2d0c8], [0x1e376c08, 0x5141ab53],\n [0x2748774c, 0xdf8eeb99], [0x34b0bcb5, 0xe19b48a8],\n [0x391c0cb3, 0xc5c95a63], [0x4ed8aa4a, 0xe3418acb],\n [0x5b9cca4f, 0x7763e373], [0x682e6ff3, 0xd6b2b8a3],\n [0x748f82ee, 0x5defb2fc], [0x78a5636f, 0x43172f60],\n [0x84c87814, 0xa1f0ab72], [0x8cc70208, 0x1a6439ec],\n [0x90befffa, 0x23631e28], [0xa4506ceb, 0xde82bde9],\n [0xbef9a3f7, 0xb2c67915], [0xc67178f2, 0xe372532b],\n [0xca273ece, 0xea26619c], [0xd186b8c7, 0x21c0c207],\n [0xeada7dd6, 0xcde0eb1e], [0xf57d4f7f, 0xee6ed178],\n [0x06f067aa, 0x72176fba], [0x0a637dc5, 0xa2c898a6],\n [0x113f9804, 0xbef90dae], [0x1b710b35, 0x131c471b],\n [0x28db77f5, 0x23047d84], [0x32caab7b, 0x40c72493],\n [0x3c9ebe0a, 0x15c9bebc], [0x431d67c4, 0x9c100d4c],\n [0x4cc5d4be, 0xcb3e42b6], [0x597f299c, 0xfc657e2a],\n [0x5fcb6fab, 0x3ad6faec], [0x6c44198c, 0x4a475817]\n ];\n\n // initial hash states\n _states = {};\n _states['SHA-512'] = [\n [0x6a09e667, 0xf3bcc908],\n [0xbb67ae85, 0x84caa73b],\n [0x3c6ef372, 0xfe94f82b],\n [0xa54ff53a, 0x5f1d36f1],\n [0x510e527f, 0xade682d1],\n [0x9b05688c, 0x2b3e6c1f],\n [0x1f83d9ab, 0xfb41bd6b],\n [0x5be0cd19, 0x137e2179]\n ];\n _states['SHA-384'] = [\n [0xcbbb9d5d, 0xc1059ed8],\n [0x629a292a, 0x367cd507],\n [0x9159015a, 0x3070dd17],\n [0x152fecd8, 0xf70e5939],\n [0x67332667, 0xffc00b31],\n [0x8eb44a87, 0x68581511],\n [0xdb0c2e0d, 0x64f98fa7],\n [0x47b5481d, 0xbefa4fa4]\n ];\n _states['SHA-512/256'] = [\n [0x22312194, 0xFC2BF72C],\n [0x9F555FA3, 0xC84C64C2],\n [0x2393B86B, 0x6F53B151],\n [0x96387719, 0x5940EABD],\n [0x96283EE2, 0xA88EFFE3],\n [0xBE5E1E25, 0x53863992],\n [0x2B0199FC, 0x2C85B8AA],\n [0x0EB72DDC, 0x81C52CA2]\n ];\n _states['SHA-512/224'] = [\n [0x8C3D37C8, 0x19544DA2],\n [0x73E19966, 0x89DCD4D6],\n [0x1DFAB7AE, 0x32FF9C82],\n [0x679DD514, 0x582F9FCF],\n [0x0F6D2B69, 0x7BD44DA8],\n [0x77E36F73, 0x04C48942],\n [0x3F9D85A8, 0x6A1D36C8],\n [0x1112E6AD, 0x91D692A1]\n ];\n\n // now initialized\n _initialized = true;\n}\n\n/**\n * Updates a SHA-512 state with the given byte buffer.\n *\n * @param s the SHA-512 state to update.\n * @param w the array to use to store words.\n * @param bytes the byte buffer to update with.\n */\nfunction _update(s, w, bytes) {\n // consume 512 bit (128 byte) chunks\n var t1_hi, t1_lo;\n var t2_hi, t2_lo;\n var s0_hi, s0_lo;\n var s1_hi, s1_lo;\n var ch_hi, ch_lo;\n var maj_hi, maj_lo;\n var a_hi, a_lo;\n var b_hi, b_lo;\n var c_hi, c_lo;\n var d_hi, d_lo;\n var e_hi, e_lo;\n var f_hi, f_lo;\n var g_hi, g_lo;\n var h_hi, h_lo;\n var i, hi, lo, w2, w7, w15, w16;\n var len = bytes.length();\n while(len >= 128) {\n // the w array will be populated with sixteen 64-bit big-endian words\n // and then extended into 64 64-bit words according to SHA-512\n for(i = 0; i < 16; ++i) {\n w[i][0] = bytes.getInt32() >>> 0;\n w[i][1] = bytes.getInt32() >>> 0;\n }\n for(; i < 80; ++i) {\n // for word 2 words ago: ROTR 19(x) ^ ROTR 61(x) ^ SHR 6(x)\n w2 = w[i - 2];\n hi = w2[0];\n lo = w2[1];\n\n // high bits\n t1_hi = (\n ((hi >>> 19) | (lo << 13)) ^ // ROTR 19\n ((lo >>> 29) | (hi << 3)) ^ // ROTR 61/(swap + ROTR 29)\n (hi >>> 6)) >>> 0; // SHR 6\n // low bits\n t1_lo = (\n ((hi << 13) | (lo >>> 19)) ^ // ROTR 19\n ((lo << 3) | (hi >>> 29)) ^ // ROTR 61/(swap + ROTR 29)\n ((hi << 26) | (lo >>> 6))) >>> 0; // SHR 6\n\n // for word 15 words ago: ROTR 1(x) ^ ROTR 8(x) ^ SHR 7(x)\n w15 = w[i - 15];\n hi = w15[0];\n lo = w15[1];\n\n // high bits\n t2_hi = (\n ((hi >>> 1) | (lo << 31)) ^ // ROTR 1\n ((hi >>> 8) | (lo << 24)) ^ // ROTR 8\n (hi >>> 7)) >>> 0; // SHR 7\n // low bits\n t2_lo = (\n ((hi << 31) | (lo >>> 1)) ^ // ROTR 1\n ((hi << 24) | (lo >>> 8)) ^ // ROTR 8\n ((hi << 25) | (lo >>> 7))) >>> 0; // SHR 7\n\n // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^64 (carry lo overflow)\n w7 = w[i - 7];\n w16 = w[i - 16];\n lo = (t1_lo + w7[1] + t2_lo + w16[1]);\n w[i][0] = (t1_hi + w7[0] + t2_hi + w16[0] +\n ((lo / 0x100000000) >>> 0)) >>> 0;\n w[i][1] = lo >>> 0;\n }\n\n // initialize hash value for this chunk\n a_hi = s[0][0];\n a_lo = s[0][1];\n b_hi = s[1][0];\n b_lo = s[1][1];\n c_hi = s[2][0];\n c_lo = s[2][1];\n d_hi = s[3][0];\n d_lo = s[3][1];\n e_hi = s[4][0];\n e_lo = s[4][1];\n f_hi = s[5][0];\n f_lo = s[5][1];\n g_hi = s[6][0];\n g_lo = s[6][1];\n h_hi = s[7][0];\n h_lo = s[7][1];\n\n // round function\n for(i = 0; i < 80; ++i) {\n // Sum1(e) = ROTR 14(e) ^ ROTR 18(e) ^ ROTR 41(e)\n s1_hi = (\n ((e_hi >>> 14) | (e_lo << 18)) ^ // ROTR 14\n ((e_hi >>> 18) | (e_lo << 14)) ^ // ROTR 18\n ((e_lo >>> 9) | (e_hi << 23))) >>> 0; // ROTR 41/(swap + ROTR 9)\n s1_lo = (\n ((e_hi << 18) | (e_lo >>> 14)) ^ // ROTR 14\n ((e_hi << 14) | (e_lo >>> 18)) ^ // ROTR 18\n ((e_lo << 23) | (e_hi >>> 9))) >>> 0; // ROTR 41/(swap + ROTR 9)\n\n // Ch(e, f, g) (optimized the same way as SHA-1)\n ch_hi = (g_hi ^ (e_hi & (f_hi ^ g_hi))) >>> 0;\n ch_lo = (g_lo ^ (e_lo & (f_lo ^ g_lo))) >>> 0;\n\n // Sum0(a) = ROTR 28(a) ^ ROTR 34(a) ^ ROTR 39(a)\n s0_hi = (\n ((a_hi >>> 28) | (a_lo << 4)) ^ // ROTR 28\n ((a_lo >>> 2) | (a_hi << 30)) ^ // ROTR 34/(swap + ROTR 2)\n ((a_lo >>> 7) | (a_hi << 25))) >>> 0; // ROTR 39/(swap + ROTR 7)\n s0_lo = (\n ((a_hi << 4) | (a_lo >>> 28)) ^ // ROTR 28\n ((a_lo << 30) | (a_hi >>> 2)) ^ // ROTR 34/(swap + ROTR 2)\n ((a_lo << 25) | (a_hi >>> 7))) >>> 0; // ROTR 39/(swap + ROTR 7)\n\n // Maj(a, b, c) (optimized the same way as SHA-1)\n maj_hi = ((a_hi & b_hi) | (c_hi & (a_hi ^ b_hi))) >>> 0;\n maj_lo = ((a_lo & b_lo) | (c_lo & (a_lo ^ b_lo))) >>> 0;\n\n // main algorithm\n // t1 = (h + s1 + ch + _k[i] + _w[i]) modulo 2^64 (carry lo overflow)\n lo = (h_lo + s1_lo + ch_lo + _k[i][1] + w[i][1]);\n t1_hi = (h_hi + s1_hi + ch_hi + _k[i][0] + w[i][0] +\n ((lo / 0x100000000) >>> 0)) >>> 0;\n t1_lo = lo >>> 0;\n\n // t2 = s0 + maj modulo 2^64 (carry lo overflow)\n lo = s0_lo + maj_lo;\n t2_hi = (s0_hi + maj_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n t2_lo = lo >>> 0;\n\n h_hi = g_hi;\n h_lo = g_lo;\n\n g_hi = f_hi;\n g_lo = f_lo;\n\n f_hi = e_hi;\n f_lo = e_lo;\n\n // e = (d + t1) modulo 2^64 (carry lo overflow)\n lo = d_lo + t1_lo;\n e_hi = (d_hi + t1_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n e_lo = lo >>> 0;\n\n d_hi = c_hi;\n d_lo = c_lo;\n\n c_hi = b_hi;\n c_lo = b_lo;\n\n b_hi = a_hi;\n b_lo = a_lo;\n\n // a = (t1 + t2) modulo 2^64 (carry lo overflow)\n lo = t1_lo + t2_lo;\n a_hi = (t1_hi + t2_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n a_lo = lo >>> 0;\n }\n\n // update hash state (additional modulo 2^64)\n lo = s[0][1] + a_lo;\n s[0][0] = (s[0][0] + a_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[0][1] = lo >>> 0;\n\n lo = s[1][1] + b_lo;\n s[1][0] = (s[1][0] + b_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[1][1] = lo >>> 0;\n\n lo = s[2][1] + c_lo;\n s[2][0] = (s[2][0] + c_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[2][1] = lo >>> 0;\n\n lo = s[3][1] + d_lo;\n s[3][0] = (s[3][0] + d_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[3][1] = lo >>> 0;\n\n lo = s[4][1] + e_lo;\n s[4][0] = (s[4][0] + e_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[4][1] = lo >>> 0;\n\n lo = s[5][1] + f_lo;\n s[5][0] = (s[5][0] + f_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[5][1] = lo >>> 0;\n\n lo = s[6][1] + g_lo;\n s[6][0] = (s[6][0] + g_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[6][1] = lo >>> 0;\n\n lo = s[7][1] + h_lo;\n s[7][0] = (s[7][0] + h_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[7][1] = lo >>> 0;\n\n len -= 128;\n }\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/sha512.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/node-forge/lib/util.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/node-forge/lib/util.js ***!
|
||
\*********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Utility functions for web applications.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2018 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\nvar baseN = __webpack_require__(/*! ./baseN */ \"./node_modules/node-forge/lib/baseN.js\");\n\n/* Utilities API */\nvar util = module.exports = forge.util = forge.util || {};\n\n// define setImmediate and nextTick\n(function() {\n // use native nextTick (unless we're in webpack)\n // webpack (or better node-libs-browser polyfill) sets process.browser.\n // this way we can detect webpack properly\n if(typeof process !== 'undefined' && process.nextTick && !process.browser) {\n util.nextTick = process.nextTick;\n if(typeof setImmediate === 'function') {\n util.setImmediate = setImmediate;\n } else {\n // polyfill setImmediate with nextTick, older versions of node\n // (those w/o setImmediate) won't totally starve IO\n util.setImmediate = util.nextTick;\n }\n return;\n }\n\n // polyfill nextTick with native setImmediate\n if(typeof setImmediate === 'function') {\n util.setImmediate = function() { return setImmediate.apply(undefined, arguments); };\n util.nextTick = function(callback) {\n return setImmediate(callback);\n };\n return;\n }\n\n /* Note: A polyfill upgrade pattern is used here to allow combining\n polyfills. For example, MutationObserver is fast, but blocks UI updates,\n so it needs to allow UI updates periodically, so it falls back on\n postMessage or setTimeout. */\n\n // polyfill with setTimeout\n util.setImmediate = function(callback) {\n setTimeout(callback, 0);\n };\n\n // upgrade polyfill to use postMessage\n if(typeof window !== 'undefined' &&\n typeof window.postMessage === 'function') {\n var msg = 'forge.setImmediate';\n var callbacks = [];\n util.setImmediate = function(callback) {\n callbacks.push(callback);\n // only send message when one hasn't been sent in\n // the current turn of the event loop\n if(callbacks.length === 1) {\n window.postMessage(msg, '*');\n }\n };\n function handler(event) {\n if(event.source === window && event.data === msg) {\n event.stopPropagation();\n var copy = callbacks.slice();\n callbacks.length = 0;\n copy.forEach(function(callback) {\n callback();\n });\n }\n }\n window.addEventListener('message', handler, true);\n }\n\n // upgrade polyfill to use MutationObserver\n if(typeof MutationObserver !== 'undefined') {\n // polyfill with MutationObserver\n var now = Date.now();\n var attr = true;\n var div = document.createElement('div');\n var callbacks = [];\n new MutationObserver(function() {\n var copy = callbacks.slice();\n callbacks.length = 0;\n copy.forEach(function(callback) {\n callback();\n });\n }).observe(div, {attributes: true});\n var oldSetImmediate = util.setImmediate;\n util.setImmediate = function(callback) {\n if(Date.now() - now > 15) {\n now = Date.now();\n oldSetImmediate(callback);\n } else {\n callbacks.push(callback);\n // only trigger observer when it hasn't been triggered in\n // the current turn of the event loop\n if(callbacks.length === 1) {\n div.setAttribute('a', attr = !attr);\n }\n }\n };\n }\n\n util.nextTick = util.setImmediate;\n})();\n\n// check if running under Node.js\nutil.isNodejs =\n typeof process !== 'undefined' && process.versions && process.versions.node;\n\n\n// 'self' will also work in Web Workers (instance of WorkerGlobalScope) while\n// it will point to `window` in the main thread.\n// To remain compatible with older browsers, we fall back to 'window' if 'self'\n// is not available.\nutil.globalScope = (function() {\n if(util.isNodejs) {\n return __webpack_require__.g;\n }\n\n return typeof self === 'undefined' ? window : self;\n})();\n\n// define isArray\nutil.isArray = Array.isArray || function(x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n};\n\n// define isArrayBuffer\nutil.isArrayBuffer = function(x) {\n return typeof ArrayBuffer !== 'undefined' && x instanceof ArrayBuffer;\n};\n\n// define isArrayBufferView\nutil.isArrayBufferView = function(x) {\n return x && util.isArrayBuffer(x.buffer) && x.byteLength !== undefined;\n};\n\n/**\n * Ensure a bits param is 8, 16, 24, or 32. Used to validate input for\n * algorithms where bit manipulation, JavaScript limitations, and/or algorithm\n * design only allow for byte operations of a limited size.\n *\n * @param n number of bits.\n *\n * Throw Error if n invalid.\n */\nfunction _checkBitsParam(n) {\n if(!(n === 8 || n === 16 || n === 24 || n === 32)) {\n throw new Error('Only 8, 16, 24, or 32 bits supported: ' + n);\n }\n}\n\n// TODO: set ByteBuffer to best available backing\nutil.ByteBuffer = ByteStringBuffer;\n\n/** Buffer w/BinaryString backing */\n\n/**\n * Constructor for a binary string backed byte buffer.\n *\n * @param [b] the bytes to wrap (either encoded as string, one byte per\n * character, or as an ArrayBuffer or Typed Array).\n */\nfunction ByteStringBuffer(b) {\n // TODO: update to match DataBuffer API\n\n // the data in this buffer\n this.data = '';\n // the pointer for reading from this buffer\n this.read = 0;\n\n if(typeof b === 'string') {\n this.data = b;\n } else if(util.isArrayBuffer(b) || util.isArrayBufferView(b)) {\n if(typeof Buffer !== 'undefined' && b instanceof Buffer) {\n this.data = b.toString('binary');\n } else {\n // convert native buffer to forge buffer\n // FIXME: support native buffers internally instead\n var arr = new Uint8Array(b);\n try {\n this.data = String.fromCharCode.apply(null, arr);\n } catch(e) {\n for(var i = 0; i < arr.length; ++i) {\n this.putByte(arr[i]);\n }\n }\n }\n } else if(b instanceof ByteStringBuffer ||\n (typeof b === 'object' && typeof b.data === 'string' &&\n typeof b.read === 'number')) {\n // copy existing buffer\n this.data = b.data;\n this.read = b.read;\n }\n\n // used for v8 optimization\n this._constructedStringLength = 0;\n}\nutil.ByteStringBuffer = ByteStringBuffer;\n\n/* Note: This is an optimization for V8-based browsers. When V8 concatenates\n a string, the strings are only joined logically using a \"cons string\" or\n \"constructed/concatenated string\". These containers keep references to one\n another and can result in very large memory usage. For example, if a 2MB\n string is constructed by concatenating 4 bytes together at a time, the\n memory usage will be ~44MB; so ~22x increase. The strings are only joined\n together when an operation requiring their joining takes place, such as\n substr(). This function is called when adding data to this buffer to ensure\n these types of strings are periodically joined to reduce the memory\n footprint. */\nvar _MAX_CONSTRUCTED_STRING_LENGTH = 4096;\nutil.ByteStringBuffer.prototype._optimizeConstructedString = function(x) {\n this._constructedStringLength += x;\n if(this._constructedStringLength > _MAX_CONSTRUCTED_STRING_LENGTH) {\n // this substr() should cause the constructed string to join\n this.data.substr(0, 1);\n this._constructedStringLength = 0;\n }\n};\n\n/**\n * Gets the number of bytes in this buffer.\n *\n * @return the number of bytes in this buffer.\n */\nutil.ByteStringBuffer.prototype.length = function() {\n return this.data.length - this.read;\n};\n\n/**\n * Gets whether or not this buffer is empty.\n *\n * @return true if this buffer is empty, false if not.\n */\nutil.ByteStringBuffer.prototype.isEmpty = function() {\n return this.length() <= 0;\n};\n\n/**\n * Puts a byte in this buffer.\n *\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putByte = function(b) {\n return this.putBytes(String.fromCharCode(b));\n};\n\n/**\n * Puts a byte in this buffer N times.\n *\n * @param b the byte to put.\n * @param n the number of bytes of value b to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.fillWithByte = function(b, n) {\n b = String.fromCharCode(b);\n var d = this.data;\n while(n > 0) {\n if(n & 1) {\n d += b;\n }\n n >>>= 1;\n if(n > 0) {\n b += b;\n }\n }\n this.data = d;\n this._optimizeConstructedString(n);\n return this;\n};\n\n/**\n * Puts bytes in this buffer.\n *\n * @param bytes the bytes (as a binary encoded string) to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putBytes = function(bytes) {\n this.data += bytes;\n this._optimizeConstructedString(bytes.length);\n return this;\n};\n\n/**\n * Puts a UTF-16 encoded string into this buffer.\n *\n * @param str the string to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putString = function(str) {\n return this.putBytes(util.encodeUtf8(str));\n};\n\n/**\n * Puts a 16-bit integer in this buffer in big-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt16 = function(i) {\n return this.putBytes(\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n/**\n * Puts a 24-bit integer in this buffer in big-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt24 = function(i) {\n return this.putBytes(\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n/**\n * Puts a 32-bit integer in this buffer in big-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt32 = function(i) {\n return this.putBytes(\n String.fromCharCode(i >> 24 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n/**\n * Puts a 16-bit integer in this buffer in little-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt16Le = function(i) {\n return this.putBytes(\n String.fromCharCode(i & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF));\n};\n\n/**\n * Puts a 24-bit integer in this buffer in little-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt24Le = function(i) {\n return this.putBytes(\n String.fromCharCode(i & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF));\n};\n\n/**\n * Puts a 32-bit integer in this buffer in little-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt32Le = function(i) {\n return this.putBytes(\n String.fromCharCode(i & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 24 & 0xFF));\n};\n\n/**\n * Puts an n-bit integer in this buffer in big-endian order.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt = function(i, n) {\n _checkBitsParam(n);\n var bytes = '';\n do {\n n -= 8;\n bytes += String.fromCharCode((i >> n) & 0xFF);\n } while(n > 0);\n return this.putBytes(bytes);\n};\n\n/**\n * Puts a signed n-bit integer in this buffer in big-endian order. Two's\n * complement representation is used.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putSignedInt = function(i, n) {\n // putInt checks n\n if(i < 0) {\n i += 2 << (n - 1);\n }\n return this.putInt(i, n);\n};\n\n/**\n * Puts the given buffer into this buffer.\n *\n * @param buffer the buffer to put into this one.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putBuffer = function(buffer) {\n return this.putBytes(buffer.getBytes());\n};\n\n/**\n * Gets a byte from this buffer and advances the read pointer by 1.\n *\n * @return the byte.\n */\nutil.ByteStringBuffer.prototype.getByte = function() {\n return this.data.charCodeAt(this.read++);\n};\n\n/**\n * Gets a uint16 from this buffer in big-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.ByteStringBuffer.prototype.getInt16 = function() {\n var rval = (\n this.data.charCodeAt(this.read) << 8 ^\n this.data.charCodeAt(this.read + 1));\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in big-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.ByteStringBuffer.prototype.getInt24 = function() {\n var rval = (\n this.data.charCodeAt(this.read) << 16 ^\n this.data.charCodeAt(this.read + 1) << 8 ^\n this.data.charCodeAt(this.read + 2));\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in big-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.ByteStringBuffer.prototype.getInt32 = function() {\n var rval = (\n this.data.charCodeAt(this.read) << 24 ^\n this.data.charCodeAt(this.read + 1) << 16 ^\n this.data.charCodeAt(this.read + 2) << 8 ^\n this.data.charCodeAt(this.read + 3));\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets a uint16 from this buffer in little-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.ByteStringBuffer.prototype.getInt16Le = function() {\n var rval = (\n this.data.charCodeAt(this.read) ^\n this.data.charCodeAt(this.read + 1) << 8);\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in little-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.ByteStringBuffer.prototype.getInt24Le = function() {\n var rval = (\n this.data.charCodeAt(this.read) ^\n this.data.charCodeAt(this.read + 1) << 8 ^\n this.data.charCodeAt(this.read + 2) << 16);\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in little-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.ByteStringBuffer.prototype.getInt32Le = function() {\n var rval = (\n this.data.charCodeAt(this.read) ^\n this.data.charCodeAt(this.read + 1) << 8 ^\n this.data.charCodeAt(this.read + 2) << 16 ^\n this.data.charCodeAt(this.read + 3) << 24);\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets an n-bit integer from this buffer in big-endian order and advances the\n * read pointer by ceil(n/8).\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.ByteStringBuffer.prototype.getInt = function(n) {\n _checkBitsParam(n);\n var rval = 0;\n do {\n // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits.\n rval = (rval << 8) + this.data.charCodeAt(this.read++);\n n -= 8;\n } while(n > 0);\n return rval;\n};\n\n/**\n * Gets a signed n-bit integer from this buffer in big-endian order, using\n * two's complement, and advances the read pointer by n/8.\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.ByteStringBuffer.prototype.getSignedInt = function(n) {\n // getInt checks n\n var x = this.getInt(n);\n var max = 2 << (n - 2);\n if(x >= max) {\n x -= max << 1;\n }\n return x;\n};\n\n/**\n * Reads bytes out as a binary encoded string and clears them from the\n * buffer. Note that the resulting string is binary encoded (in node.js this\n * encoding is referred to as `binary`, it is *not* `utf8`).\n *\n * @param count the number of bytes to read, undefined or null for all.\n *\n * @return a binary encoded string of bytes.\n */\nutil.ByteStringBuffer.prototype.getBytes = function(count) {\n var rval;\n if(count) {\n // read count bytes\n count = Math.min(this.length(), count);\n rval = this.data.slice(this.read, this.read + count);\n this.read += count;\n } else if(count === 0) {\n rval = '';\n } else {\n // read all bytes, optimize to only copy when needed\n rval = (this.read === 0) ? this.data : this.data.slice(this.read);\n this.clear();\n }\n return rval;\n};\n\n/**\n * Gets a binary encoded string of the bytes from this buffer without\n * modifying the read pointer.\n *\n * @param count the number of bytes to get, omit to get all.\n *\n * @return a string full of binary encoded characters.\n */\nutil.ByteStringBuffer.prototype.bytes = function(count) {\n return (typeof(count) === 'undefined' ?\n this.data.slice(this.read) :\n this.data.slice(this.read, this.read + count));\n};\n\n/**\n * Gets a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n *\n * @return the byte.\n */\nutil.ByteStringBuffer.prototype.at = function(i) {\n return this.data.charCodeAt(this.read + i);\n};\n\n/**\n * Puts a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.setAt = function(i, b) {\n this.data = this.data.substr(0, this.read + i) +\n String.fromCharCode(b) +\n this.data.substr(this.read + i + 1);\n return this;\n};\n\n/**\n * Gets the last byte without modifying the read pointer.\n *\n * @return the last byte.\n */\nutil.ByteStringBuffer.prototype.last = function() {\n return this.data.charCodeAt(this.data.length - 1);\n};\n\n/**\n * Creates a copy of this buffer.\n *\n * @return the copy.\n */\nutil.ByteStringBuffer.prototype.copy = function() {\n var c = util.createBuffer(this.data);\n c.read = this.read;\n return c;\n};\n\n/**\n * Compacts this buffer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.compact = function() {\n if(this.read > 0) {\n this.data = this.data.slice(this.read);\n this.read = 0;\n }\n return this;\n};\n\n/**\n * Clears this buffer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.clear = function() {\n this.data = '';\n this.read = 0;\n return this;\n};\n\n/**\n * Shortens this buffer by triming bytes off of the end of this buffer.\n *\n * @param count the number of bytes to trim off.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.truncate = function(count) {\n var len = Math.max(0, this.length() - count);\n this.data = this.data.substr(this.read, len);\n this.read = 0;\n return this;\n};\n\n/**\n * Converts this buffer to a hexadecimal string.\n *\n * @return a hexadecimal string.\n */\nutil.ByteStringBuffer.prototype.toHex = function() {\n var rval = '';\n for(var i = this.read; i < this.data.length; ++i) {\n var b = this.data.charCodeAt(i);\n if(b < 16) {\n rval += '0';\n }\n rval += b.toString(16);\n }\n return rval;\n};\n\n/**\n * Converts this buffer to a UTF-16 string (standard JavaScript string).\n *\n * @return a UTF-16 string.\n */\nutil.ByteStringBuffer.prototype.toString = function() {\n return util.decodeUtf8(this.bytes());\n};\n\n/** End Buffer w/BinaryString backing */\n\n/** Buffer w/UInt8Array backing */\n\n/**\n * FIXME: Experimental. Do not use yet.\n *\n * Constructor for an ArrayBuffer-backed byte buffer.\n *\n * The buffer may be constructed from a string, an ArrayBuffer, DataView, or a\n * TypedArray.\n *\n * If a string is given, its encoding should be provided as an option,\n * otherwise it will default to 'binary'. A 'binary' string is encoded such\n * that each character is one byte in length and size.\n *\n * If an ArrayBuffer, DataView, or TypedArray is given, it will be used\n * *directly* without any copying. Note that, if a write to the buffer requires\n * more space, the buffer will allocate a new backing ArrayBuffer to\n * accommodate. The starting read and write offsets for the buffer may be\n * given as options.\n *\n * @param [b] the initial bytes for this buffer.\n * @param options the options to use:\n * [readOffset] the starting read offset to use (default: 0).\n * [writeOffset] the starting write offset to use (default: the\n * length of the first parameter).\n * [growSize] the minimum amount, in bytes, to grow the buffer by to\n * accommodate writes (default: 1024).\n * [encoding] the encoding ('binary', 'utf8', 'utf16', 'hex') for the\n * first parameter, if it is a string (default: 'binary').\n */\nfunction DataBuffer(b, options) {\n // default options\n options = options || {};\n\n // pointers for read from/write to buffer\n this.read = options.readOffset || 0;\n this.growSize = options.growSize || 1024;\n\n var isArrayBuffer = util.isArrayBuffer(b);\n var isArrayBufferView = util.isArrayBufferView(b);\n if(isArrayBuffer || isArrayBufferView) {\n // use ArrayBuffer directly\n if(isArrayBuffer) {\n this.data = new DataView(b);\n } else {\n // TODO: adjust read/write offset based on the type of view\n // or specify that this must be done in the options ... that the\n // offsets are byte-based\n this.data = new DataView(b.buffer, b.byteOffset, b.byteLength);\n }\n this.write = ('writeOffset' in options ?\n options.writeOffset : this.data.byteLength);\n return;\n }\n\n // initialize to empty array buffer and add any given bytes using putBytes\n this.data = new DataView(new ArrayBuffer(0));\n this.write = 0;\n\n if(b !== null && b !== undefined) {\n this.putBytes(b);\n }\n\n if('writeOffset' in options) {\n this.write = options.writeOffset;\n }\n}\nutil.DataBuffer = DataBuffer;\n\n/**\n * Gets the number of bytes in this buffer.\n *\n * @return the number of bytes in this buffer.\n */\nutil.DataBuffer.prototype.length = function() {\n return this.write - this.read;\n};\n\n/**\n * Gets whether or not this buffer is empty.\n *\n * @return true if this buffer is empty, false if not.\n */\nutil.DataBuffer.prototype.isEmpty = function() {\n return this.length() <= 0;\n};\n\n/**\n * Ensures this buffer has enough empty space to accommodate the given number\n * of bytes. An optional parameter may be given that indicates a minimum\n * amount to grow the buffer if necessary. If the parameter is not given,\n * the buffer will be grown by some previously-specified default amount\n * or heuristic.\n *\n * @param amount the number of bytes to accommodate.\n * @param [growSize] the minimum amount, in bytes, to grow the buffer by if\n * necessary.\n */\nutil.DataBuffer.prototype.accommodate = function(amount, growSize) {\n if(this.length() >= amount) {\n return this;\n }\n growSize = Math.max(growSize || this.growSize, amount);\n\n // grow buffer\n var src = new Uint8Array(\n this.data.buffer, this.data.byteOffset, this.data.byteLength);\n var dst = new Uint8Array(this.length() + growSize);\n dst.set(src);\n this.data = new DataView(dst.buffer);\n\n return this;\n};\n\n/**\n * Puts a byte in this buffer.\n *\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putByte = function(b) {\n this.accommodate(1);\n this.data.setUint8(this.write++, b);\n return this;\n};\n\n/**\n * Puts a byte in this buffer N times.\n *\n * @param b the byte to put.\n * @param n the number of bytes of value b to put.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.fillWithByte = function(b, n) {\n this.accommodate(n);\n for(var i = 0; i < n; ++i) {\n this.data.setUint8(b);\n }\n return this;\n};\n\n/**\n * Puts bytes in this buffer. The bytes may be given as a string, an\n * ArrayBuffer, a DataView, or a TypedArray.\n *\n * @param bytes the bytes to put.\n * @param [encoding] the encoding for the first parameter ('binary', 'utf8',\n * 'utf16', 'hex'), if it is a string (default: 'binary').\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putBytes = function(bytes, encoding) {\n if(util.isArrayBufferView(bytes)) {\n var src = new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n var len = src.byteLength - src.byteOffset;\n this.accommodate(len);\n var dst = new Uint8Array(this.data.buffer, this.write);\n dst.set(src);\n this.write += len;\n return this;\n }\n\n if(util.isArrayBuffer(bytes)) {\n var src = new Uint8Array(bytes);\n this.accommodate(src.byteLength);\n var dst = new Uint8Array(this.data.buffer);\n dst.set(src, this.write);\n this.write += src.byteLength;\n return this;\n }\n\n // bytes is a util.DataBuffer or equivalent\n if(bytes instanceof util.DataBuffer ||\n (typeof bytes === 'object' &&\n typeof bytes.read === 'number' && typeof bytes.write === 'number' &&\n util.isArrayBufferView(bytes.data))) {\n var src = new Uint8Array(bytes.data.byteLength, bytes.read, bytes.length());\n this.accommodate(src.byteLength);\n var dst = new Uint8Array(bytes.data.byteLength, this.write);\n dst.set(src);\n this.write += src.byteLength;\n return this;\n }\n\n if(bytes instanceof util.ByteStringBuffer) {\n // copy binary string and process as the same as a string parameter below\n bytes = bytes.data;\n encoding = 'binary';\n }\n\n // string conversion\n encoding = encoding || 'binary';\n if(typeof bytes === 'string') {\n var view;\n\n // decode from string\n if(encoding === 'hex') {\n this.accommodate(Math.ceil(bytes.length / 2));\n view = new Uint8Array(this.data.buffer, this.write);\n this.write += util.binary.hex.decode(bytes, view, this.write);\n return this;\n }\n if(encoding === 'base64') {\n this.accommodate(Math.ceil(bytes.length / 4) * 3);\n view = new Uint8Array(this.data.buffer, this.write);\n this.write += util.binary.base64.decode(bytes, view, this.write);\n return this;\n }\n\n // encode text as UTF-8 bytes\n if(encoding === 'utf8') {\n // encode as UTF-8 then decode string as raw binary\n bytes = util.encodeUtf8(bytes);\n encoding = 'binary';\n }\n\n // decode string as raw binary\n if(encoding === 'binary' || encoding === 'raw') {\n // one byte per character\n this.accommodate(bytes.length);\n view = new Uint8Array(this.data.buffer, this.write);\n this.write += util.binary.raw.decode(view);\n return this;\n }\n\n // encode text as UTF-16 bytes\n if(encoding === 'utf16') {\n // two bytes per character\n this.accommodate(bytes.length * 2);\n view = new Uint16Array(this.data.buffer, this.write);\n this.write += util.text.utf16.encode(view);\n return this;\n }\n\n throw new Error('Invalid encoding: ' + encoding);\n }\n\n throw Error('Invalid parameter: ' + bytes);\n};\n\n/**\n * Puts the given buffer into this buffer.\n *\n * @param buffer the buffer to put into this one.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putBuffer = function(buffer) {\n this.putBytes(buffer);\n buffer.clear();\n return this;\n};\n\n/**\n * Puts a string into this buffer.\n *\n * @param str the string to put.\n * @param [encoding] the encoding for the string (default: 'utf16').\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putString = function(str) {\n return this.putBytes(str, 'utf16');\n};\n\n/**\n * Puts a 16-bit integer in this buffer in big-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt16 = function(i) {\n this.accommodate(2);\n this.data.setInt16(this.write, i);\n this.write += 2;\n return this;\n};\n\n/**\n * Puts a 24-bit integer in this buffer in big-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt24 = function(i) {\n this.accommodate(3);\n this.data.setInt16(this.write, i >> 8 & 0xFFFF);\n this.data.setInt8(this.write, i >> 16 & 0xFF);\n this.write += 3;\n return this;\n};\n\n/**\n * Puts a 32-bit integer in this buffer in big-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt32 = function(i) {\n this.accommodate(4);\n this.data.setInt32(this.write, i);\n this.write += 4;\n return this;\n};\n\n/**\n * Puts a 16-bit integer in this buffer in little-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt16Le = function(i) {\n this.accommodate(2);\n this.data.setInt16(this.write, i, true);\n this.write += 2;\n return this;\n};\n\n/**\n * Puts a 24-bit integer in this buffer in little-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt24Le = function(i) {\n this.accommodate(3);\n this.data.setInt8(this.write, i >> 16 & 0xFF);\n this.data.setInt16(this.write, i >> 8 & 0xFFFF, true);\n this.write += 3;\n return this;\n};\n\n/**\n * Puts a 32-bit integer in this buffer in little-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt32Le = function(i) {\n this.accommodate(4);\n this.data.setInt32(this.write, i, true);\n this.write += 4;\n return this;\n};\n\n/**\n * Puts an n-bit integer in this buffer in big-endian order.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt = function(i, n) {\n _checkBitsParam(n);\n this.accommodate(n / 8);\n do {\n n -= 8;\n this.data.setInt8(this.write++, (i >> n) & 0xFF);\n } while(n > 0);\n return this;\n};\n\n/**\n * Puts a signed n-bit integer in this buffer in big-endian order. Two's\n * complement representation is used.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putSignedInt = function(i, n) {\n _checkBitsParam(n);\n this.accommodate(n / 8);\n if(i < 0) {\n i += 2 << (n - 1);\n }\n return this.putInt(i, n);\n};\n\n/**\n * Gets a byte from this buffer and advances the read pointer by 1.\n *\n * @return the byte.\n */\nutil.DataBuffer.prototype.getByte = function() {\n return this.data.getInt8(this.read++);\n};\n\n/**\n * Gets a uint16 from this buffer in big-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.DataBuffer.prototype.getInt16 = function() {\n var rval = this.data.getInt16(this.read);\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in big-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.DataBuffer.prototype.getInt24 = function() {\n var rval = (\n this.data.getInt16(this.read) << 8 ^\n this.data.getInt8(this.read + 2));\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in big-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.DataBuffer.prototype.getInt32 = function() {\n var rval = this.data.getInt32(this.read);\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets a uint16 from this buffer in little-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.DataBuffer.prototype.getInt16Le = function() {\n var rval = this.data.getInt16(this.read, true);\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in little-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.DataBuffer.prototype.getInt24Le = function() {\n var rval = (\n this.data.getInt8(this.read) ^\n this.data.getInt16(this.read + 1, true) << 8);\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in little-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.DataBuffer.prototype.getInt32Le = function() {\n var rval = this.data.getInt32(this.read, true);\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets an n-bit integer from this buffer in big-endian order and advances the\n * read pointer by n/8.\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.DataBuffer.prototype.getInt = function(n) {\n _checkBitsParam(n);\n var rval = 0;\n do {\n // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits.\n rval = (rval << 8) + this.data.getInt8(this.read++);\n n -= 8;\n } while(n > 0);\n return rval;\n};\n\n/**\n * Gets a signed n-bit integer from this buffer in big-endian order, using\n * two's complement, and advances the read pointer by n/8.\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.DataBuffer.prototype.getSignedInt = function(n) {\n // getInt checks n\n var x = this.getInt(n);\n var max = 2 << (n - 2);\n if(x >= max) {\n x -= max << 1;\n }\n return x;\n};\n\n/**\n * Reads bytes out as a binary encoded string and clears them from the\n * buffer.\n *\n * @param count the number of bytes to read, undefined or null for all.\n *\n * @return a binary encoded string of bytes.\n */\nutil.DataBuffer.prototype.getBytes = function(count) {\n // TODO: deprecate this method, it is poorly named and\n // this.toString('binary') replaces it\n // add a toTypedArray()/toArrayBuffer() function\n var rval;\n if(count) {\n // read count bytes\n count = Math.min(this.length(), count);\n rval = this.data.slice(this.read, this.read + count);\n this.read += count;\n } else if(count === 0) {\n rval = '';\n } else {\n // read all bytes, optimize to only copy when needed\n rval = (this.read === 0) ? this.data : this.data.slice(this.read);\n this.clear();\n }\n return rval;\n};\n\n/**\n * Gets a binary encoded string of the bytes from this buffer without\n * modifying the read pointer.\n *\n * @param count the number of bytes to get, omit to get all.\n *\n * @return a string full of binary encoded characters.\n */\nutil.DataBuffer.prototype.bytes = function(count) {\n // TODO: deprecate this method, it is poorly named, add \"getString()\"\n return (typeof(count) === 'undefined' ?\n this.data.slice(this.read) :\n this.data.slice(this.read, this.read + count));\n};\n\n/**\n * Gets a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n *\n * @return the byte.\n */\nutil.DataBuffer.prototype.at = function(i) {\n return this.data.getUint8(this.read + i);\n};\n\n/**\n * Puts a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.setAt = function(i, b) {\n this.data.setUint8(i, b);\n return this;\n};\n\n/**\n * Gets the last byte without modifying the read pointer.\n *\n * @return the last byte.\n */\nutil.DataBuffer.prototype.last = function() {\n return this.data.getUint8(this.write - 1);\n};\n\n/**\n * Creates a copy of this buffer.\n *\n * @return the copy.\n */\nutil.DataBuffer.prototype.copy = function() {\n return new util.DataBuffer(this);\n};\n\n/**\n * Compacts this buffer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.compact = function() {\n if(this.read > 0) {\n var src = new Uint8Array(this.data.buffer, this.read);\n var dst = new Uint8Array(src.byteLength);\n dst.set(src);\n this.data = new DataView(dst);\n this.write -= this.read;\n this.read = 0;\n }\n return this;\n};\n\n/**\n * Clears this buffer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.clear = function() {\n this.data = new DataView(new ArrayBuffer(0));\n this.read = this.write = 0;\n return this;\n};\n\n/**\n * Shortens this buffer by triming bytes off of the end of this buffer.\n *\n * @param count the number of bytes to trim off.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.truncate = function(count) {\n this.write = Math.max(0, this.length() - count);\n this.read = Math.min(this.read, this.write);\n return this;\n};\n\n/**\n * Converts this buffer to a hexadecimal string.\n *\n * @return a hexadecimal string.\n */\nutil.DataBuffer.prototype.toHex = function() {\n var rval = '';\n for(var i = this.read; i < this.data.byteLength; ++i) {\n var b = this.data.getUint8(i);\n if(b < 16) {\n rval += '0';\n }\n rval += b.toString(16);\n }\n return rval;\n};\n\n/**\n * Converts this buffer to a string, using the given encoding. If no\n * encoding is given, 'utf8' (UTF-8) is used.\n *\n * @param [encoding] the encoding to use: 'binary', 'utf8', 'utf16', 'hex',\n * 'base64' (default: 'utf8').\n *\n * @return a string representation of the bytes in this buffer.\n */\nutil.DataBuffer.prototype.toString = function(encoding) {\n var view = new Uint8Array(this.data, this.read, this.length());\n encoding = encoding || 'utf8';\n\n // encode to string\n if(encoding === 'binary' || encoding === 'raw') {\n return util.binary.raw.encode(view);\n }\n if(encoding === 'hex') {\n return util.binary.hex.encode(view);\n }\n if(encoding === 'base64') {\n return util.binary.base64.encode(view);\n }\n\n // decode to text\n if(encoding === 'utf8') {\n return util.text.utf8.decode(view);\n }\n if(encoding === 'utf16') {\n return util.text.utf16.decode(view);\n }\n\n throw new Error('Invalid encoding: ' + encoding);\n};\n\n/** End Buffer w/UInt8Array backing */\n\n/**\n * Creates a buffer that stores bytes. A value may be given to populate the\n * buffer with data. This value can either be string of encoded bytes or a\n * regular string of characters. When passing a string of binary encoded\n * bytes, the encoding `raw` should be given. This is also the default. When\n * passing a string of characters, the encoding `utf8` should be given.\n *\n * @param [input] a string with encoded bytes to store in the buffer.\n * @param [encoding] (default: 'raw', other: 'utf8').\n */\nutil.createBuffer = function(input, encoding) {\n // TODO: deprecate, use new ByteBuffer() instead\n encoding = encoding || 'raw';\n if(input !== undefined && encoding === 'utf8') {\n input = util.encodeUtf8(input);\n }\n return new util.ByteBuffer(input);\n};\n\n/**\n * Fills a string with a particular value. If you want the string to be a byte\n * string, pass in String.fromCharCode(theByte).\n *\n * @param c the character to fill the string with, use String.fromCharCode\n * to fill the string with a byte value.\n * @param n the number of characters of value c to fill with.\n *\n * @return the filled string.\n */\nutil.fillString = function(c, n) {\n var s = '';\n while(n > 0) {\n if(n & 1) {\n s += c;\n }\n n >>>= 1;\n if(n > 0) {\n c += c;\n }\n }\n return s;\n};\n\n/**\n * Performs a per byte XOR between two byte strings and returns the result as a\n * string of bytes.\n *\n * @param s1 first string of bytes.\n * @param s2 second string of bytes.\n * @param n the number of bytes to XOR.\n *\n * @return the XOR'd result.\n */\nutil.xorBytes = function(s1, s2, n) {\n var s3 = '';\n var b = '';\n var t = '';\n var i = 0;\n var c = 0;\n for(; n > 0; --n, ++i) {\n b = s1.charCodeAt(i) ^ s2.charCodeAt(i);\n if(c >= 10) {\n s3 += t;\n t = '';\n c = 0;\n }\n t += String.fromCharCode(b);\n ++c;\n }\n s3 += t;\n return s3;\n};\n\n/**\n * Converts a hex string into a 'binary' encoded string of bytes.\n *\n * @param hex the hexadecimal string to convert.\n *\n * @return the binary-encoded string of bytes.\n */\nutil.hexToBytes = function(hex) {\n // TODO: deprecate: \"Deprecated. Use util.binary.hex.decode instead.\"\n var rval = '';\n var i = 0;\n if(hex.length & 1 == 1) {\n // odd number of characters, convert first character alone\n i = 1;\n rval += String.fromCharCode(parseInt(hex[0], 16));\n }\n // convert 2 characters (1 byte) at a time\n for(; i < hex.length; i += 2) {\n rval += String.fromCharCode(parseInt(hex.substr(i, 2), 16));\n }\n return rval;\n};\n\n/**\n * Converts a 'binary' encoded string of bytes to hex.\n *\n * @param bytes the byte string to convert.\n *\n * @return the string of hexadecimal characters.\n */\nutil.bytesToHex = function(bytes) {\n // TODO: deprecate: \"Deprecated. Use util.binary.hex.encode instead.\"\n return util.createBuffer(bytes).toHex();\n};\n\n/**\n * Converts an 32-bit integer to 4-big-endian byte string.\n *\n * @param i the integer.\n *\n * @return the byte string.\n */\nutil.int32ToBytes = function(i) {\n return (\n String.fromCharCode(i >> 24 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n// base64 characters, reverse mapping\nvar _base64 =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\nvar _base64Idx = [\n/*43 -43 = 0*/\n/*'+', 1, 2, 3,'/' */\n 62, -1, -1, -1, 63,\n\n/*'0','1','2','3','4','5','6','7','8','9' */\n 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,\n\n/*15, 16, 17,'=', 19, 20, 21 */\n -1, -1, -1, 64, -1, -1, -1,\n\n/*65 - 43 = 22*/\n/*'A','B','C','D','E','F','G','H','I','J','K','L','M', */\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,\n\n/*'N','O','P','Q','R','S','T','U','V','W','X','Y','Z' */\n 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,\n\n/*91 - 43 = 48 */\n/*48, 49, 50, 51, 52, 53 */\n -1, -1, -1, -1, -1, -1,\n\n/*97 - 43 = 54*/\n/*'a','b','c','d','e','f','g','h','i','j','k','l','m' */\n 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,\n\n/*'n','o','p','q','r','s','t','u','v','w','x','y','z' */\n 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51\n];\n\n// base58 characters (Bitcoin alphabet)\nvar _base58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\n\n/**\n * Base64 encodes a 'binary' encoded string of bytes.\n *\n * @param input the binary encoded string of bytes to base64-encode.\n * @param maxline the maximum number of encoded characters per line to use,\n * defaults to none.\n *\n * @return the base64-encoded output.\n */\nutil.encode64 = function(input, maxline) {\n // TODO: deprecate: \"Deprecated. Use util.binary.base64.encode instead.\"\n var line = '';\n var output = '';\n var chr1, chr2, chr3;\n var i = 0;\n while(i < input.length) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n\n // encode 4 character group\n line += _base64.charAt(chr1 >> 2);\n line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4));\n if(isNaN(chr2)) {\n line += '==';\n } else {\n line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6));\n line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63);\n }\n\n if(maxline && line.length > maxline) {\n output += line.substr(0, maxline) + '\\r\\n';\n line = line.substr(maxline);\n }\n }\n output += line;\n return output;\n};\n\n/**\n * Base64 decodes a string into a 'binary' encoded string of bytes.\n *\n * @param input the base64-encoded input.\n *\n * @return the binary encoded string.\n */\nutil.decode64 = function(input) {\n // TODO: deprecate: \"Deprecated. Use util.binary.base64.decode instead.\"\n\n // remove all non-base64 characters\n input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, '');\n\n var output = '';\n var enc1, enc2, enc3, enc4;\n var i = 0;\n\n while(i < input.length) {\n enc1 = _base64Idx[input.charCodeAt(i++) - 43];\n enc2 = _base64Idx[input.charCodeAt(i++) - 43];\n enc3 = _base64Idx[input.charCodeAt(i++) - 43];\n enc4 = _base64Idx[input.charCodeAt(i++) - 43];\n\n output += String.fromCharCode((enc1 << 2) | (enc2 >> 4));\n if(enc3 !== 64) {\n // decoded at least 2 bytes\n output += String.fromCharCode(((enc2 & 15) << 4) | (enc3 >> 2));\n if(enc4 !== 64) {\n // decoded 3 bytes\n output += String.fromCharCode(((enc3 & 3) << 6) | enc4);\n }\n }\n }\n\n return output;\n};\n\n/**\n * Encodes the given string of characters (a standard JavaScript\n * string) as a binary encoded string where the bytes represent\n * a UTF-8 encoded string of characters. Non-ASCII characters will be\n * encoded as multiple bytes according to UTF-8.\n *\n * @param str a standard string of characters to encode.\n *\n * @return the binary encoded string.\n */\nutil.encodeUtf8 = function(str) {\n return unescape(encodeURIComponent(str));\n};\n\n/**\n * Decodes a binary encoded string that contains bytes that\n * represent a UTF-8 encoded string of characters -- into a\n * string of characters (a standard JavaScript string).\n *\n * @param str the binary encoded string to decode.\n *\n * @return the resulting standard string of characters.\n */\nutil.decodeUtf8 = function(str) {\n return decodeURIComponent(escape(str));\n};\n\n// binary encoding/decoding tools\n// FIXME: Experimental. Do not use yet.\nutil.binary = {\n raw: {},\n hex: {},\n base64: {},\n base58: {},\n baseN : {\n encode: baseN.encode,\n decode: baseN.decode\n }\n};\n\n/**\n * Encodes a Uint8Array as a binary-encoded string. This encoding uses\n * a value between 0 and 255 for each character.\n *\n * @param bytes the Uint8Array to encode.\n *\n * @return the binary-encoded string.\n */\nutil.binary.raw.encode = function(bytes) {\n return String.fromCharCode.apply(null, bytes);\n};\n\n/**\n * Decodes a binary-encoded string to a Uint8Array. This encoding uses\n * a value between 0 and 255 for each character.\n *\n * @param str the binary-encoded string to decode.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.binary.raw.decode = function(str, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(str.length);\n }\n offset = offset || 0;\n var j = offset;\n for(var i = 0; i < str.length; ++i) {\n out[j++] = str.charCodeAt(i);\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Encodes a 'binary' string, ArrayBuffer, DataView, TypedArray, or\n * ByteBuffer as a string of hexadecimal characters.\n *\n * @param bytes the bytes to convert.\n *\n * @return the string of hexadecimal characters.\n */\nutil.binary.hex.encode = util.bytesToHex;\n\n/**\n * Decodes a hex-encoded string to a Uint8Array.\n *\n * @param hex the hexadecimal string to convert.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.binary.hex.decode = function(hex, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(Math.ceil(hex.length / 2));\n }\n offset = offset || 0;\n var i = 0, j = offset;\n if(hex.length & 1) {\n // odd number of characters, convert first character alone\n i = 1;\n out[j++] = parseInt(hex[0], 16);\n }\n // convert 2 characters (1 byte) at a time\n for(; i < hex.length; i += 2) {\n out[j++] = parseInt(hex.substr(i, 2), 16);\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Base64-encodes a Uint8Array.\n *\n * @param input the Uint8Array to encode.\n * @param maxline the maximum number of encoded characters per line to use,\n * defaults to none.\n *\n * @return the base64-encoded output string.\n */\nutil.binary.base64.encode = function(input, maxline) {\n var line = '';\n var output = '';\n var chr1, chr2, chr3;\n var i = 0;\n while(i < input.byteLength) {\n chr1 = input[i++];\n chr2 = input[i++];\n chr3 = input[i++];\n\n // encode 4 character group\n line += _base64.charAt(chr1 >> 2);\n line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4));\n if(isNaN(chr2)) {\n line += '==';\n } else {\n line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6));\n line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63);\n }\n\n if(maxline && line.length > maxline) {\n output += line.substr(0, maxline) + '\\r\\n';\n line = line.substr(maxline);\n }\n }\n output += line;\n return output;\n};\n\n/**\n * Decodes a base64-encoded string to a Uint8Array.\n *\n * @param input the base64-encoded input string.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.binary.base64.decode = function(input, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(Math.ceil(input.length / 4) * 3);\n }\n\n // remove all non-base64 characters\n input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, '');\n\n offset = offset || 0;\n var enc1, enc2, enc3, enc4;\n var i = 0, j = offset;\n\n while(i < input.length) {\n enc1 = _base64Idx[input.charCodeAt(i++) - 43];\n enc2 = _base64Idx[input.charCodeAt(i++) - 43];\n enc3 = _base64Idx[input.charCodeAt(i++) - 43];\n enc4 = _base64Idx[input.charCodeAt(i++) - 43];\n\n out[j++] = (enc1 << 2) | (enc2 >> 4);\n if(enc3 !== 64) {\n // decoded at least 2 bytes\n out[j++] = ((enc2 & 15) << 4) | (enc3 >> 2);\n if(enc4 !== 64) {\n // decoded 3 bytes\n out[j++] = ((enc3 & 3) << 6) | enc4;\n }\n }\n }\n\n // make sure result is the exact decoded length\n return output ? (j - offset) : out.subarray(0, j);\n};\n\n// add support for base58 encoding/decoding with Bitcoin alphabet\nutil.binary.base58.encode = function(input, maxline) {\n return util.binary.baseN.encode(input, _base58, maxline);\n};\nutil.binary.base58.decode = function(input, maxline) {\n return util.binary.baseN.decode(input, _base58, maxline);\n};\n\n// text encoding/decoding tools\n// FIXME: Experimental. Do not use yet.\nutil.text = {\n utf8: {},\n utf16: {}\n};\n\n/**\n * Encodes the given string as UTF-8 in a Uint8Array.\n *\n * @param str the string to encode.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.text.utf8.encode = function(str, output, offset) {\n str = util.encodeUtf8(str);\n var out = output;\n if(!out) {\n out = new Uint8Array(str.length);\n }\n offset = offset || 0;\n var j = offset;\n for(var i = 0; i < str.length; ++i) {\n out[j++] = str.charCodeAt(i);\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Decodes the UTF-8 contents from a Uint8Array.\n *\n * @param bytes the Uint8Array to decode.\n *\n * @return the resulting string.\n */\nutil.text.utf8.decode = function(bytes) {\n return util.decodeUtf8(String.fromCharCode.apply(null, bytes));\n};\n\n/**\n * Encodes the given string as UTF-16 in a Uint8Array.\n *\n * @param str the string to encode.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.text.utf16.encode = function(str, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(str.length * 2);\n }\n var view = new Uint16Array(out.buffer);\n offset = offset || 0;\n var j = offset;\n var k = offset;\n for(var i = 0; i < str.length; ++i) {\n view[k++] = str.charCodeAt(i);\n j += 2;\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Decodes the UTF-16 contents from a Uint8Array.\n *\n * @param bytes the Uint8Array to decode.\n *\n * @return the resulting string.\n */\nutil.text.utf16.decode = function(bytes) {\n return String.fromCharCode.apply(null, new Uint16Array(bytes.buffer));\n};\n\n/**\n * Deflates the given data using a flash interface.\n *\n * @param api the flash interface.\n * @param bytes the data.\n * @param raw true to return only raw deflate data, false to include zlib\n * header and trailer.\n *\n * @return the deflated data as a string.\n */\nutil.deflate = function(api, bytes, raw) {\n bytes = util.decode64(api.deflate(util.encode64(bytes)).rval);\n\n // strip zlib header and trailer if necessary\n if(raw) {\n // zlib header is 2 bytes (CMF,FLG) where FLG indicates that\n // there is a 4-byte DICT (alder-32) block before the data if\n // its 5th bit is set\n var start = 2;\n var flg = bytes.charCodeAt(1);\n if(flg & 0x20) {\n start = 6;\n }\n // zlib trailer is 4 bytes of adler-32\n bytes = bytes.substring(start, bytes.length - 4);\n }\n\n return bytes;\n};\n\n/**\n * Inflates the given data using a flash interface.\n *\n * @param api the flash interface.\n * @param bytes the data.\n * @param raw true if the incoming data has no zlib header or trailer and is\n * raw DEFLATE data.\n *\n * @return the inflated data as a string, null on error.\n */\nutil.inflate = function(api, bytes, raw) {\n // TODO: add zlib header and trailer if necessary/possible\n var rval = api.inflate(util.encode64(bytes)).rval;\n return (rval === null) ? null : util.decode64(rval);\n};\n\n/**\n * Sets a storage object.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param obj the storage object, null to remove.\n */\nvar _setStorageObject = function(api, id, obj) {\n if(!api) {\n throw new Error('WebStorage not available.');\n }\n\n var rval;\n if(obj === null) {\n rval = api.removeItem(id);\n } else {\n // json-encode and base64-encode object\n obj = util.encode64(JSON.stringify(obj));\n rval = api.setItem(id, obj);\n }\n\n // handle potential flash error\n if(typeof(rval) !== 'undefined' && rval.rval !== true) {\n var error = new Error(rval.error.message);\n error.id = rval.error.id;\n error.name = rval.error.name;\n throw error;\n }\n};\n\n/**\n * Gets a storage object.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n *\n * @return the storage object entry or null if none exists.\n */\nvar _getStorageObject = function(api, id) {\n if(!api) {\n throw new Error('WebStorage not available.');\n }\n\n // get the existing entry\n var rval = api.getItem(id);\n\n /* Note: We check api.init because we can't do (api == localStorage)\n on IE because of \"Class doesn't support Automation\" exception. Only\n the flash api has an init method so this works too, but we need a\n better solution in the future. */\n\n // flash returns item wrapped in an object, handle special case\n if(api.init) {\n if(rval.rval === null) {\n if(rval.error) {\n var error = new Error(rval.error.message);\n error.id = rval.error.id;\n error.name = rval.error.name;\n throw error;\n }\n // no error, but also no item\n rval = null;\n } else {\n rval = rval.rval;\n }\n }\n\n // handle decoding\n if(rval !== null) {\n // base64-decode and json-decode data\n rval = JSON.parse(util.decode64(rval));\n }\n\n return rval;\n};\n\n/**\n * Stores an item in local storage.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param data the data for the item (any javascript object/primitive).\n */\nvar _setItem = function(api, id, key, data) {\n // get storage object\n var obj = _getStorageObject(api, id);\n if(obj === null) {\n // create a new storage object\n obj = {};\n }\n // update key\n obj[key] = data;\n\n // set storage object\n _setStorageObject(api, id, obj);\n};\n\n/**\n * Gets an item from local storage.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n *\n * @return the item.\n */\nvar _getItem = function(api, id, key) {\n // get storage object\n var rval = _getStorageObject(api, id);\n if(rval !== null) {\n // return data at key\n rval = (key in rval) ? rval[key] : null;\n }\n\n return rval;\n};\n\n/**\n * Removes an item from local storage.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n */\nvar _removeItem = function(api, id, key) {\n // get storage object\n var obj = _getStorageObject(api, id);\n if(obj !== null && key in obj) {\n // remove key\n delete obj[key];\n\n // see if entry has no keys remaining\n var empty = true;\n for(var prop in obj) {\n empty = false;\n break;\n }\n if(empty) {\n // remove entry entirely if no keys are left\n obj = null;\n }\n\n // set storage object\n _setStorageObject(api, id, obj);\n }\n};\n\n/**\n * Clears the local disk storage identified by the given ID.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n */\nvar _clearItems = function(api, id) {\n _setStorageObject(api, id, null);\n};\n\n/**\n * Calls a storage function.\n *\n * @param func the function to call.\n * @param args the arguments for the function.\n * @param location the location argument.\n *\n * @return the return value from the function.\n */\nvar _callStorageFunction = function(func, args, location) {\n var rval = null;\n\n // default storage types\n if(typeof(location) === 'undefined') {\n location = ['web', 'flash'];\n }\n\n // apply storage types in order of preference\n var type;\n var done = false;\n var exception = null;\n for(var idx in location) {\n type = location[idx];\n try {\n if(type === 'flash' || type === 'both') {\n if(args[0] === null) {\n throw new Error('Flash local storage not available.');\n }\n rval = func.apply(this, args);\n done = (type === 'flash');\n }\n if(type === 'web' || type === 'both') {\n args[0] = localStorage;\n rval = func.apply(this, args);\n done = true;\n }\n } catch(ex) {\n exception = ex;\n }\n if(done) {\n break;\n }\n }\n\n if(!done) {\n throw exception;\n }\n\n return rval;\n};\n\n/**\n * Stores an item on local disk.\n *\n * The available types of local storage include 'flash', 'web', and 'both'.\n *\n * The type 'flash' refers to flash local storage (SharedObject). In order\n * to use flash local storage, the 'api' parameter must be valid. The type\n * 'web' refers to WebStorage, if supported by the browser. The type 'both'\n * refers to storing using both 'flash' and 'web', not just one or the\n * other.\n *\n * The location array should list the storage types to use in order of\n * preference:\n *\n * ['flash']: flash only storage\n * ['web']: web only storage\n * ['both']: try to store in both\n * ['flash','web']: store in flash first, but if not available, 'web'\n * ['web','flash']: store in web first, but if not available, 'flash'\n *\n * The location array defaults to: ['web', 'flash']\n *\n * @param api the flash interface, null to use only WebStorage.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param data the data for the item (any javascript object/primitive).\n * @param location an array with the preferred types of storage to use.\n */\nutil.setItem = function(api, id, key, data, location) {\n _callStorageFunction(_setItem, arguments, location);\n};\n\n/**\n * Gets an item on local disk.\n *\n * Set setItem() for details on storage types.\n *\n * @param api the flash interface, null to use only WebStorage.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param location an array with the preferred types of storage to use.\n *\n * @return the item.\n */\nutil.getItem = function(api, id, key, location) {\n return _callStorageFunction(_getItem, arguments, location);\n};\n\n/**\n * Removes an item on local disk.\n *\n * Set setItem() for details on storage types.\n *\n * @param api the flash interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param location an array with the preferred types of storage to use.\n */\nutil.removeItem = function(api, id, key, location) {\n _callStorageFunction(_removeItem, arguments, location);\n};\n\n/**\n * Clears the local disk storage identified by the given ID.\n *\n * Set setItem() for details on storage types.\n *\n * @param api the flash interface if flash is available.\n * @param id the storage ID to use.\n * @param location an array with the preferred types of storage to use.\n */\nutil.clearItems = function(api, id, location) {\n _callStorageFunction(_clearItems, arguments, location);\n};\n\n/**\n * Check if an object is empty.\n *\n * Taken from:\n * http://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object-from-json/679937#679937\n *\n * @param object the object to check.\n */\nutil.isEmpty = function(obj) {\n for(var prop in obj) {\n if(obj.hasOwnProperty(prop)) {\n return false;\n }\n }\n return true;\n};\n\n/**\n * Format with simple printf-style interpolation.\n *\n * %%: literal '%'\n * %s,%o: convert next argument into a string.\n *\n * @param format the string to format.\n * @param ... arguments to interpolate into the format string.\n */\nutil.format = function(format) {\n var re = /%./g;\n // current match\n var match;\n // current part\n var part;\n // current arg index\n var argi = 0;\n // collected parts to recombine later\n var parts = [];\n // last index found\n var last = 0;\n // loop while matches remain\n while((match = re.exec(format))) {\n part = format.substring(last, re.lastIndex - 2);\n // don't add empty strings (ie, parts between %s%s)\n if(part.length > 0) {\n parts.push(part);\n }\n last = re.lastIndex;\n // switch on % code\n var code = match[0][1];\n switch(code) {\n case 's':\n case 'o':\n // check if enough arguments were given\n if(argi < arguments.length) {\n parts.push(arguments[argi++ + 1]);\n } else {\n parts.push('<?>');\n }\n break;\n // FIXME: do proper formating for numbers, etc\n //case 'f':\n //case 'd':\n case '%':\n parts.push('%');\n break;\n default:\n parts.push('<%' + code + '?>');\n }\n }\n // add trailing part of format string\n parts.push(format.substring(last));\n return parts.join('');\n};\n\n/**\n * Formats a number.\n *\n * http://snipplr.com/view/5945/javascript-numberformat--ported-from-php/\n */\nutil.formatNumber = function(number, decimals, dec_point, thousands_sep) {\n // http://kevin.vanzonneveld.net\n // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)\n // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)\n // + bugfix by: Michael White (http://crestidg.com)\n // + bugfix by: Benjamin Lupton\n // + bugfix by: Allan Jensen (http://www.winternet.no)\n // + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)\n // * example 1: number_format(1234.5678, 2, '.', '');\n // * returns 1: 1234.57\n\n var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;\n var d = dec_point === undefined ? ',' : dec_point;\n var t = thousands_sep === undefined ?\n '.' : thousands_sep, s = n < 0 ? '-' : '';\n var i = parseInt((n = Math.abs(+n || 0).toFixed(c)), 10) + '';\n var j = (i.length > 3) ? i.length % 3 : 0;\n return s + (j ? i.substr(0, j) + t : '') +\n i.substr(j).replace(/(\\d{3})(?=\\d)/g, '$1' + t) +\n (c ? d + Math.abs(n - i).toFixed(c).slice(2) : '');\n};\n\n/**\n * Formats a byte size.\n *\n * http://snipplr.com/view/5949/format-humanize-file-byte-size-presentation-in-javascript/\n */\nutil.formatSize = function(size) {\n if(size >= 1073741824) {\n size = util.formatNumber(size / 1073741824, 2, '.', '') + ' GiB';\n } else if(size >= 1048576) {\n size = util.formatNumber(size / 1048576, 2, '.', '') + ' MiB';\n } else if(size >= 1024) {\n size = util.formatNumber(size / 1024, 0) + ' KiB';\n } else {\n size = util.formatNumber(size, 0) + ' bytes';\n }\n return size;\n};\n\n/**\n * Converts an IPv4 or IPv6 string representation into bytes (in network order).\n *\n * @param ip the IPv4 or IPv6 address to convert.\n *\n * @return the 4-byte IPv6 or 16-byte IPv6 address or null if the address can't\n * be parsed.\n */\nutil.bytesFromIP = function(ip) {\n if(ip.indexOf('.') !== -1) {\n return util.bytesFromIPv4(ip);\n }\n if(ip.indexOf(':') !== -1) {\n return util.bytesFromIPv6(ip);\n }\n return null;\n};\n\n/**\n * Converts an IPv4 string representation into bytes (in network order).\n *\n * @param ip the IPv4 address to convert.\n *\n * @return the 4-byte address or null if the address can't be parsed.\n */\nutil.bytesFromIPv4 = function(ip) {\n ip = ip.split('.');\n if(ip.length !== 4) {\n return null;\n }\n var b = util.createBuffer();\n for(var i = 0; i < ip.length; ++i) {\n var num = parseInt(ip[i], 10);\n if(isNaN(num)) {\n return null;\n }\n b.putByte(num);\n }\n return b.getBytes();\n};\n\n/**\n * Converts an IPv6 string representation into bytes (in network order).\n *\n * @param ip the IPv6 address to convert.\n *\n * @return the 16-byte address or null if the address can't be parsed.\n */\nutil.bytesFromIPv6 = function(ip) {\n var blanks = 0;\n ip = ip.split(':').filter(function(e) {\n if(e.length === 0) ++blanks;\n return true;\n });\n var zeros = (8 - ip.length + blanks) * 2;\n var b = util.createBuffer();\n for(var i = 0; i < 8; ++i) {\n if(!ip[i] || ip[i].length === 0) {\n b.fillWithByte(0, zeros);\n zeros = 0;\n continue;\n }\n var bytes = util.hexToBytes(ip[i]);\n if(bytes.length < 2) {\n b.putByte(0);\n }\n b.putBytes(bytes);\n }\n return b.getBytes();\n};\n\n/**\n * Converts 4-bytes into an IPv4 string representation or 16-bytes into\n * an IPv6 string representation. The bytes must be in network order.\n *\n * @param bytes the bytes to convert.\n *\n * @return the IPv4 or IPv6 string representation if 4 or 16 bytes,\n * respectively, are given, otherwise null.\n */\nutil.bytesToIP = function(bytes) {\n if(bytes.length === 4) {\n return util.bytesToIPv4(bytes);\n }\n if(bytes.length === 16) {\n return util.bytesToIPv6(bytes);\n }\n return null;\n};\n\n/**\n * Converts 4-bytes into an IPv4 string representation. The bytes must be\n * in network order.\n *\n * @param bytes the bytes to convert.\n *\n * @return the IPv4 string representation or null for an invalid # of bytes.\n */\nutil.bytesToIPv4 = function(bytes) {\n if(bytes.length !== 4) {\n return null;\n }\n var ip = [];\n for(var i = 0; i < bytes.length; ++i) {\n ip.push(bytes.charCodeAt(i));\n }\n return ip.join('.');\n};\n\n/**\n * Converts 16-bytes into an IPv16 string representation. The bytes must be\n * in network order.\n *\n * @param bytes the bytes to convert.\n *\n * @return the IPv16 string representation or null for an invalid # of bytes.\n */\nutil.bytesToIPv6 = function(bytes) {\n if(bytes.length !== 16) {\n return null;\n }\n var ip = [];\n var zeroGroups = [];\n var zeroMaxGroup = 0;\n for(var i = 0; i < bytes.length; i += 2) {\n var hex = util.bytesToHex(bytes[i] + bytes[i + 1]);\n // canonicalize zero representation\n while(hex[0] === '0' && hex !== '0') {\n hex = hex.substr(1);\n }\n if(hex === '0') {\n var last = zeroGroups[zeroGroups.length - 1];\n var idx = ip.length;\n if(!last || idx !== last.end + 1) {\n zeroGroups.push({start: idx, end: idx});\n } else {\n last.end = idx;\n if((last.end - last.start) >\n (zeroGroups[zeroMaxGroup].end - zeroGroups[zeroMaxGroup].start)) {\n zeroMaxGroup = zeroGroups.length - 1;\n }\n }\n }\n ip.push(hex);\n }\n if(zeroGroups.length > 0) {\n var group = zeroGroups[zeroMaxGroup];\n // only shorten group of length > 0\n if(group.end - group.start > 0) {\n ip.splice(group.start, group.end - group.start + 1, '');\n if(group.start === 0) {\n ip.unshift('');\n }\n if(group.end === 7) {\n ip.push('');\n }\n }\n }\n return ip.join(':');\n};\n\n/**\n * Estimates the number of processes that can be run concurrently. If\n * creating Web Workers, keep in mind that the main JavaScript process needs\n * its own core.\n *\n * @param options the options to use:\n * update true to force an update (not use the cached value).\n * @param callback(err, max) called once the operation completes.\n */\nutil.estimateCores = function(options, callback) {\n if(typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n if('cores' in util && !options.update) {\n return callback(null, util.cores);\n }\n if(typeof navigator !== 'undefined' &&\n 'hardwareConcurrency' in navigator &&\n navigator.hardwareConcurrency > 0) {\n util.cores = navigator.hardwareConcurrency;\n return callback(null, util.cores);\n }\n if(typeof Worker === 'undefined') {\n // workers not available\n util.cores = 1;\n return callback(null, util.cores);\n }\n if(typeof Blob === 'undefined') {\n // can't estimate, default to 2\n util.cores = 2;\n return callback(null, util.cores);\n }\n\n // create worker concurrency estimation code as blob\n var blobUrl = URL.createObjectURL(new Blob(['(',\n function() {\n self.addEventListener('message', function(e) {\n // run worker for 4 ms\n var st = Date.now();\n var et = st + 4;\n while(Date.now() < et);\n self.postMessage({st: st, et: et});\n });\n }.toString(),\n ')()'], {type: 'application/javascript'}));\n\n // take 5 samples using 16 workers\n sample([], 5, 16);\n\n function sample(max, samples, numWorkers) {\n if(samples === 0) {\n // get overlap average\n var avg = Math.floor(max.reduce(function(avg, x) {\n return avg + x;\n }, 0) / max.length);\n util.cores = Math.max(1, avg);\n URL.revokeObjectURL(blobUrl);\n return callback(null, util.cores);\n }\n map(numWorkers, function(err, results) {\n max.push(reduce(numWorkers, results));\n sample(max, samples - 1, numWorkers);\n });\n }\n\n function map(numWorkers, callback) {\n var workers = [];\n var results = [];\n for(var i = 0; i < numWorkers; ++i) {\n var worker = new Worker(blobUrl);\n worker.addEventListener('message', function(e) {\n results.push(e.data);\n if(results.length === numWorkers) {\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].terminate();\n }\n callback(null, results);\n }\n });\n workers.push(worker);\n }\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].postMessage(i);\n }\n }\n\n function reduce(numWorkers, results) {\n // find overlapping time windows\n var overlaps = [];\n for(var n = 0; n < numWorkers; ++n) {\n var r1 = results[n];\n var overlap = overlaps[n] = [];\n for(var i = 0; i < numWorkers; ++i) {\n if(n === i) {\n continue;\n }\n var r2 = results[i];\n if((r1.st > r2.st && r1.st < r2.et) ||\n (r2.st > r1.st && r2.st < r1.et)) {\n overlap.push(i);\n }\n }\n }\n // get maximum overlaps ... don't include overlapping worker itself\n // as the main JS process was also being scheduled during the work and\n // would have to be subtracted from the estimate anyway\n return overlaps.reduce(function(max, overlap) {\n return Math.max(max, overlap.length);\n }, 0);\n }\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/node-forge/lib/util.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/pkcs7-padding/index.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/pkcs7-padding/index.js ***!
|
||
\*********************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("var DEF_PAD_LENGTH = 16;\n\n/**\n * Append PKCS#7 padding to a buffer or a string.\n *\n * @see {@link http://tools.ietf.org/html/rfc5652|RFC 5652 section 6.3}\n *\n * @param {!(string|Uint8Array|Uint8ClampedArray)} data - the data to be padded\n * @param {number=} size - the block size to pad for\n * @return {!(string|Uint8Array|Uint8ClampedArray)} the padded data, if the function succeed\n */\nfunction pad(data, size) {\n var out = data;\n if (typeof size !== 'number') {\n size = DEF_PAD_LENGTH;\n } else if (size > 255) {\n throw new RangeError('pad(): PKCS#7 padding cannot be longer than 255 bytes');\n } else if (size < 0) {\n throw new RangeError('pad(): PKCS#7 padding size must be positive');\n }\n if (typeof data === 'string') {\n var padLen = size - data.length % size;\n if (isNaN(padLen)) padLen = 0;\n var padChar = String.fromCharCode(padLen);\n for (var i = 0; i < padLen; i++) {\n out += padChar;\n }\n } else if (data instanceof Uint8Array || data instanceof Uint8ClampedArray) {\n var baseLen = data.byteLength;\n padLen = size - baseLen % size;\n if (isNaN(padLen)) padLen = 0;\n var newLen = baseLen + padLen;\n out = new data.constructor(newLen);\n out.set(data);\n for (i = baseLen; i < newLen; i++) {\n out[i] = padLen;\n }\n } else {\n throw new TypeError('pad(): data could not be padded');\n }\n return out;\n}\n\n/**\n * Remove the PKCS#7 padding from a buffer or a string.\n *\n * @see {@link http://tools.ietf.org/html/rfc5652|RFC 5652 section 6.3}\n *\n * @param {!(string|Uint8Array|Uint8ClampedArray)} data - the data to be unpadded\n * @return {!(string|Uint8Array|Uint8ClampedArray)} the unpadded data, if the function succeed\n */\nfunction unpad(data) {\n var out = data;\n if (typeof data === 'string' && data.length > 0) {\n var padLen = data.charCodeAt(data.length - 1);\n if (padLen > data.length) {\n throw new Error('unpad(): cannot remove ' + padLen + ' bytes from a ' +\n data.length + '-byte(s) string');\n }\n for (var i = data.length - 2, end = data.length - padLen; i >= end; i--) {\n if (data.charCodeAt(i) !== padLen) {\n throw new Error('unpad(): found a padding byte of ' + data.charCodeAt(i) +\n ' instead of ' + padLen + ' at position ' + i);\n }\n }\n out = data.substring(0, end);\n } else if (data instanceof Uint8Array || data instanceof Uint8ClampedArray) {\n var baseLen = data.byteLength;\n padLen = data[baseLen - 1];\n var newLen = baseLen - padLen;\n if (newLen < 0) {\n throw new Error('unpad(): cannot remove ' + padLen + ' bytes from a ' +\n baseLen + '-byte(s) string');\n }\n for (i = baseLen - 2; i >= newLen; i--) {\n if (data[i] !== padLen) {\n throw new Error('unpad(): found a padding byte of ' + data[i] +\n ' instead of ' + padLen + ' at position ' + i);\n }\n }\n out = data.slice(0, newLen);\n }\n return out;\n}\n\nmodule.exports = { pad: pad, unpad: unpad };\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/pkcs7-padding/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/index.js":
|
||
/*!******************************************!*\
|
||
!*** ./node_modules/protobufjs/index.js ***!
|
||
\******************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("// full library entry point.\n\n\nmodule.exports = __webpack_require__(/*! ./src/index */ \"./node_modules/protobufjs/src/index.js\");\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/common.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/common.js ***!
|
||
\***********************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = common;\n\nvar commonRe = /\\/|\\./;\n\n/**\n * Provides common type definitions.\n * Can also be used to provide additional google types or your own custom types.\n * @param {string} name Short name as in `google/protobuf/[name].proto` or full file name\n * @param {Object.<string,*>} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition\n * @returns {undefined}\n * @property {INamespace} google/protobuf/any.proto Any\n * @property {INamespace} google/protobuf/duration.proto Duration\n * @property {INamespace} google/protobuf/empty.proto Empty\n * @property {INamespace} google/protobuf/field_mask.proto FieldMask\n * @property {INamespace} google/protobuf/struct.proto Struct, Value, NullValue and ListValue\n * @property {INamespace} google/protobuf/timestamp.proto Timestamp\n * @property {INamespace} google/protobuf/wrappers.proto Wrappers\n * @example\n * // manually provides descriptor.proto (assumes google/protobuf/ namespace and .proto extension)\n * protobuf.common(\"descriptor\", descriptorJson);\n *\n * // manually provides a custom definition (uses my.foo namespace)\n * protobuf.common(\"my/foo/bar.proto\", myFooBarJson);\n */\nfunction common(name, json) {\n if (!commonRe.test(name)) {\n name = \"google/protobuf/\" + name + \".proto\";\n json = { nested: { google: { nested: { protobuf: { nested: json } } } } };\n }\n common[name] = json;\n}\n\n// Not provided because of limited use (feel free to discuss or to provide yourself):\n//\n// google/protobuf/descriptor.proto\n// google/protobuf/source_context.proto\n// google/protobuf/type.proto\n//\n// Stripped and pre-parsed versions of these non-bundled files are instead available as part of\n// the repository or package within the google/protobuf directory.\n\ncommon(\"any\", {\n\n /**\n * Properties of a google.protobuf.Any message.\n * @interface IAny\n * @type {Object}\n * @property {string} [typeUrl]\n * @property {Uint8Array} [bytes]\n * @memberof common\n */\n Any: {\n fields: {\n type_url: {\n type: \"string\",\n id: 1\n },\n value: {\n type: \"bytes\",\n id: 2\n }\n }\n }\n});\n\nvar timeType;\n\ncommon(\"duration\", {\n\n /**\n * Properties of a google.protobuf.Duration message.\n * @interface IDuration\n * @type {Object}\n * @property {number|Long} [seconds]\n * @property {number} [nanos]\n * @memberof common\n */\n Duration: timeType = {\n fields: {\n seconds: {\n type: \"int64\",\n id: 1\n },\n nanos: {\n type: \"int32\",\n id: 2\n }\n }\n }\n});\n\ncommon(\"timestamp\", {\n\n /**\n * Properties of a google.protobuf.Timestamp message.\n * @interface ITimestamp\n * @type {Object}\n * @property {number|Long} [seconds]\n * @property {number} [nanos]\n * @memberof common\n */\n Timestamp: timeType\n});\n\ncommon(\"empty\", {\n\n /**\n * Properties of a google.protobuf.Empty message.\n * @interface IEmpty\n * @memberof common\n */\n Empty: {\n fields: {}\n }\n});\n\ncommon(\"struct\", {\n\n /**\n * Properties of a google.protobuf.Struct message.\n * @interface IStruct\n * @type {Object}\n * @property {Object.<string,IValue>} [fields]\n * @memberof common\n */\n Struct: {\n fields: {\n fields: {\n keyType: \"string\",\n type: \"Value\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.Value message.\n * @interface IValue\n * @type {Object}\n * @property {string} [kind]\n * @property {0} [nullValue]\n * @property {number} [numberValue]\n * @property {string} [stringValue]\n * @property {boolean} [boolValue]\n * @property {IStruct} [structValue]\n * @property {IListValue} [listValue]\n * @memberof common\n */\n Value: {\n oneofs: {\n kind: {\n oneof: [\n \"nullValue\",\n \"numberValue\",\n \"stringValue\",\n \"boolValue\",\n \"structValue\",\n \"listValue\"\n ]\n }\n },\n fields: {\n nullValue: {\n type: \"NullValue\",\n id: 1\n },\n numberValue: {\n type: \"double\",\n id: 2\n },\n stringValue: {\n type: \"string\",\n id: 3\n },\n boolValue: {\n type: \"bool\",\n id: 4\n },\n structValue: {\n type: \"Struct\",\n id: 5\n },\n listValue: {\n type: \"ListValue\",\n id: 6\n }\n }\n },\n\n NullValue: {\n values: {\n NULL_VALUE: 0\n }\n },\n\n /**\n * Properties of a google.protobuf.ListValue message.\n * @interface IListValue\n * @type {Object}\n * @property {Array.<IValue>} [values]\n * @memberof common\n */\n ListValue: {\n fields: {\n values: {\n rule: \"repeated\",\n type: \"Value\",\n id: 1\n }\n }\n }\n});\n\ncommon(\"wrappers\", {\n\n /**\n * Properties of a google.protobuf.DoubleValue message.\n * @interface IDoubleValue\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n DoubleValue: {\n fields: {\n value: {\n type: \"double\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.FloatValue message.\n * @interface IFloatValue\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n FloatValue: {\n fields: {\n value: {\n type: \"float\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.Int64Value message.\n * @interface IInt64Value\n * @type {Object}\n * @property {number|Long} [value]\n * @memberof common\n */\n Int64Value: {\n fields: {\n value: {\n type: \"int64\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.UInt64Value message.\n * @interface IUInt64Value\n * @type {Object}\n * @property {number|Long} [value]\n * @memberof common\n */\n UInt64Value: {\n fields: {\n value: {\n type: \"uint64\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.Int32Value message.\n * @interface IInt32Value\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n Int32Value: {\n fields: {\n value: {\n type: \"int32\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.UInt32Value message.\n * @interface IUInt32Value\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n UInt32Value: {\n fields: {\n value: {\n type: \"uint32\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.BoolValue message.\n * @interface IBoolValue\n * @type {Object}\n * @property {boolean} [value]\n * @memberof common\n */\n BoolValue: {\n fields: {\n value: {\n type: \"bool\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.StringValue message.\n * @interface IStringValue\n * @type {Object}\n * @property {string} [value]\n * @memberof common\n */\n StringValue: {\n fields: {\n value: {\n type: \"string\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.BytesValue message.\n * @interface IBytesValue\n * @type {Object}\n * @property {Uint8Array} [value]\n * @memberof common\n */\n BytesValue: {\n fields: {\n value: {\n type: \"bytes\",\n id: 1\n }\n }\n }\n});\n\ncommon(\"field_mask\", {\n\n /**\n * Properties of a google.protobuf.FieldMask message.\n * @interface IDoubleValue\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n FieldMask: {\n fields: {\n paths: {\n rule: \"repeated\",\n type: \"string\",\n id: 1\n }\n }\n }\n});\n\n/**\n * Gets the root definition of the specified common proto file.\n *\n * Bundled definitions are:\n * - google/protobuf/any.proto\n * - google/protobuf/duration.proto\n * - google/protobuf/empty.proto\n * - google/protobuf/field_mask.proto\n * - google/protobuf/struct.proto\n * - google/protobuf/timestamp.proto\n * - google/protobuf/wrappers.proto\n *\n * @param {string} file Proto file name\n * @returns {INamespace|null} Root definition or `null` if not defined\n */\ncommon.get = function get(file) {\n return common[file] || null;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/common.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/converter.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/converter.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n/**\n * Runtime message from/to plain object converters.\n * @namespace\n */\nvar converter = exports;\n\nvar Enum = __webpack_require__(/*! ./enum */ \"./node_modules/protobufjs/src/enum.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\n/**\n * Generates a partial value fromObject conveter.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} prop Property reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genValuePartial_fromObject(gen, field, fieldIndex, prop) {\n var defaultAlreadyEmitted = false;\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n if (field.resolvedType) {\n if (field.resolvedType instanceof Enum) { gen\n (\"switch(d%s){\", prop);\n for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {\n // enum unknown values passthrough\n if (values[keys[i]] === field.typeDefault && !defaultAlreadyEmitted) { gen\n (\"default:\")\n (\"if(typeof(d%s)===\\\"number\\\"){m%s=d%s;break}\", prop, prop, prop);\n if (!field.repeated) gen // fallback to default value only for\n // arrays, to avoid leaving holes.\n (\"break\"); // for non-repeated fields, just ignore\n defaultAlreadyEmitted = true;\n }\n gen\n (\"case%j:\", keys[i])\n (\"case %i:\", values[keys[i]])\n (\"m%s=%j\", prop, values[keys[i]])\n (\"break\");\n } gen\n (\"}\");\n } else gen\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\n (\"m%s=types[%i].fromObject(d%s)\", prop, fieldIndex, prop);\n } else {\n var isUnsigned = false;\n switch (field.type) {\n case \"double\":\n case \"float\": gen\n (\"m%s=Number(d%s)\", prop, prop); // also catches \"NaN\", \"Infinity\"\n break;\n case \"uint32\":\n case \"fixed32\": gen\n (\"m%s=d%s>>>0\", prop, prop);\n break;\n case \"int32\":\n case \"sint32\":\n case \"sfixed32\": gen\n (\"m%s=d%s|0\", prop, prop);\n break;\n case \"uint64\":\n isUnsigned = true;\n // eslint-disable-next-line no-fallthrough\n case \"int64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(util.Long)\")\n (\"(m%s=util.Long.fromValue(d%s)).unsigned=%j\", prop, prop, isUnsigned)\n (\"else if(typeof d%s===\\\"string\\\")\", prop)\n (\"m%s=parseInt(d%s,10)\", prop, prop)\n (\"else if(typeof d%s===\\\"number\\\")\", prop)\n (\"m%s=d%s\", prop, prop)\n (\"else if(typeof d%s===\\\"object\\\")\", prop)\n (\"m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)\", prop, prop, prop, isUnsigned ? \"true\" : \"\");\n break;\n case \"bytes\": gen\n (\"if(typeof d%s===\\\"string\\\")\", prop)\n (\"util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)\", prop, prop, prop)\n (\"else if(d%s.length >= 0)\", prop)\n (\"m%s=d%s\", prop, prop);\n break;\n case \"string\": gen\n (\"m%s=String(d%s)\", prop, prop);\n break;\n case \"bool\": gen\n (\"m%s=Boolean(d%s)\", prop, prop);\n break;\n /* default: gen\n (\"m%s=d%s\", prop, prop);\n break; */\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n\n/**\n * Generates a plain object to runtime message converter specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nconverter.fromObject = function fromObject(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var fields = mtype.fieldsArray;\n var gen = util.codegen([\"d\"], mtype.name + \"$fromObject\")\n (\"if(d instanceof this.ctor)\")\n (\"return d\");\n if (!fields.length) return gen\n (\"return new this.ctor\");\n gen\n (\"var m=new this.ctor\");\n for (var i = 0; i < fields.length; ++i) {\n var field = fields[i].resolve(),\n prop = util.safeProp(field.name);\n\n // Map fields\n if (field.map) { gen\n (\"if(d%s){\", prop)\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\n (\"m%s={}\", prop)\n (\"for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){\", prop);\n genValuePartial_fromObject(gen, field, /* not sorted */ i, prop + \"[ks[i]]\")\n (\"}\")\n (\"}\");\n\n // Repeated fields\n } else if (field.repeated) { gen\n (\"if(d%s){\", prop)\n (\"if(!Array.isArray(d%s))\", prop)\n (\"throw TypeError(%j)\", field.fullName + \": array expected\")\n (\"m%s=[]\", prop)\n (\"for(var i=0;i<d%s.length;++i){\", prop);\n genValuePartial_fromObject(gen, field, /* not sorted */ i, prop + \"[i]\")\n (\"}\")\n (\"}\");\n\n // Non-repeated fields\n } else {\n if (!(field.resolvedType instanceof Enum)) gen // no need to test for null/undefined if an enum (uses switch)\n (\"if(d%s!=null){\", prop); // !== undefined && !== null\n genValuePartial_fromObject(gen, field, /* not sorted */ i, prop);\n if (!(field.resolvedType instanceof Enum)) gen\n (\"}\");\n }\n } return gen\n (\"return m\");\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n};\n\n/**\n * Generates a partial value toObject converter.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} prop Property reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genValuePartial_toObject(gen, field, fieldIndex, prop) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n if (field.resolvedType) {\n if (field.resolvedType instanceof Enum) gen\n (\"d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s\", prop, fieldIndex, prop, prop, fieldIndex, prop, prop);\n else gen\n (\"d%s=types[%i].toObject(m%s,o)\", prop, fieldIndex, prop);\n } else {\n var isUnsigned = false;\n switch (field.type) {\n case \"double\":\n case \"float\": gen\n (\"d%s=o.json&&!isFinite(m%s)?String(m%s):m%s\", prop, prop, prop, prop);\n break;\n case \"uint64\":\n isUnsigned = true;\n // eslint-disable-next-line no-fallthrough\n case \"int64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(typeof m%s===\\\"number\\\")\", prop)\n (\"d%s=o.longs===String?String(m%s):m%s\", prop, prop, prop)\n (\"else\") // Long-like\n (\"d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s\", prop, prop, prop, prop, isUnsigned ? \"true\": \"\", prop);\n break;\n case \"bytes\": gen\n (\"d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s\", prop, prop, prop, prop, prop);\n break;\n default: gen\n (\"d%s=m%s\", prop, prop);\n break;\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n\n/**\n * Generates a runtime message to plain object converter specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nconverter.toObject = function toObject(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);\n if (!fields.length)\n return util.codegen()(\"return {}\");\n var gen = util.codegen([\"m\", \"o\"], mtype.name + \"$toObject\")\n (\"if(!o)\")\n (\"o={}\")\n (\"var d={}\");\n\n var repeatedFields = [],\n mapFields = [],\n normalFields = [],\n i = 0;\n for (; i < fields.length; ++i)\n if (!fields[i].partOf)\n ( fields[i].resolve().repeated ? repeatedFields\n : fields[i].map ? mapFields\n : normalFields).push(fields[i]);\n\n if (repeatedFields.length) { gen\n (\"if(o.arrays||o.defaults){\");\n for (i = 0; i < repeatedFields.length; ++i) gen\n (\"d%s=[]\", util.safeProp(repeatedFields[i].name));\n gen\n (\"}\");\n }\n\n if (mapFields.length) { gen\n (\"if(o.objects||o.defaults){\");\n for (i = 0; i < mapFields.length; ++i) gen\n (\"d%s={}\", util.safeProp(mapFields[i].name));\n gen\n (\"}\");\n }\n\n if (normalFields.length) { gen\n (\"if(o.defaults){\");\n for (i = 0; i < normalFields.length; ++i) {\n var field = normalFields[i],\n prop = util.safeProp(field.name);\n if (field.resolvedType instanceof Enum) gen\n (\"d%s=o.enums===String?%j:%j\", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault);\n else if (field.long) gen\n (\"if(util.Long){\")\n (\"var n=new util.Long(%i,%i,%j)\", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)\n (\"d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n\", prop)\n (\"}else\")\n (\"d%s=o.longs===String?%j:%i\", prop, field.typeDefault.toString(), field.typeDefault.toNumber());\n else if (field.bytes) {\n var arrayDefault = \"[\" + Array.prototype.slice.call(field.typeDefault).join(\",\") + \"]\";\n gen\n (\"if(o.bytes===String)d%s=%j\", prop, String.fromCharCode.apply(String, field.typeDefault))\n (\"else{\")\n (\"d%s=%s\", prop, arrayDefault)\n (\"if(o.bytes!==Array)d%s=util.newBuffer(d%s)\", prop, prop)\n (\"}\");\n } else gen\n (\"d%s=%j\", prop, field.typeDefault); // also messages (=null)\n } gen\n (\"}\");\n }\n var hasKs2 = false;\n for (i = 0; i < fields.length; ++i) {\n var field = fields[i],\n index = mtype._fieldsArray.indexOf(field),\n prop = util.safeProp(field.name);\n if (field.map) {\n if (!hasKs2) { hasKs2 = true; gen\n (\"var ks2\");\n } gen\n (\"if(m%s&&(ks2=Object.keys(m%s)).length){\", prop, prop)\n (\"d%s={}\", prop)\n (\"for(var j=0;j<ks2.length;++j){\");\n genValuePartial_toObject(gen, field, /* sorted */ index, prop + \"[ks2[j]]\")\n (\"}\");\n } else if (field.repeated) { gen\n (\"if(m%s&&m%s.length){\", prop, prop)\n (\"d%s=[]\", prop)\n (\"for(var j=0;j<m%s.length;++j){\", prop);\n genValuePartial_toObject(gen, field, /* sorted */ index, prop + \"[j]\")\n (\"}\");\n } else { gen\n (\"if(m%s!=null&&m.hasOwnProperty(%j)){\", prop, field.name); // !== undefined && !== null\n genValuePartial_toObject(gen, field, /* sorted */ index, prop);\n if (field.partOf) gen\n (\"if(o.oneofs)\")\n (\"d%s=%j\", util.safeProp(field.partOf.name), field.name);\n }\n gen\n (\"}\");\n }\n return gen\n (\"return d\");\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/converter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/decoder.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/decoder.js ***!
|
||
\************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = decoder;\n\nvar Enum = __webpack_require__(/*! ./enum */ \"./node_modules/protobufjs/src/enum.js\"),\n types = __webpack_require__(/*! ./types */ \"./node_modules/protobufjs/src/types.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\nfunction missing(field) {\n return \"missing required '\" + field.name + \"'\";\n}\n\n/**\n * Generates a decoder specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nfunction decoder(mtype) {\n /* eslint-disable no-unexpected-multiline */\n var gen = util.codegen([\"r\", \"l\"], mtype.name + \"$decode\")\n (\"if(!(r instanceof Reader))\")\n (\"r=Reader.create(r)\")\n (\"var c=l===undefined?r.len:r.pos+l,m=new this.ctor\" + (mtype.fieldsArray.filter(function(field) { return field.map; }).length ? \",k,value\" : \"\"))\n (\"while(r.pos<c){\")\n (\"var t=r.uint32()\");\n if (mtype.group) gen\n (\"if((t&7)===4)\")\n (\"break\");\n gen\n (\"switch(t>>>3){\");\n\n var i = 0;\n for (; i < /* initializes */ mtype.fieldsArray.length; ++i) {\n var field = mtype._fieldsArray[i].resolve(),\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\n ref = \"m\" + util.safeProp(field.name); gen\n (\"case %i: {\", field.id);\n\n // Map fields\n if (field.map) { gen\n (\"if(%s===util.emptyObject)\", ref)\n (\"%s={}\", ref)\n (\"var c2 = r.uint32()+r.pos\");\n\n if (types.defaults[field.keyType] !== undefined) gen\n (\"k=%j\", types.defaults[field.keyType]);\n else gen\n (\"k=null\");\n\n if (types.defaults[type] !== undefined) gen\n (\"value=%j\", types.defaults[type]);\n else gen\n (\"value=null\");\n\n gen\n (\"while(r.pos<c2){\")\n (\"var tag2=r.uint32()\")\n (\"switch(tag2>>>3){\")\n (\"case 1: k=r.%s(); break\", field.keyType)\n (\"case 2:\");\n\n if (types.basic[type] === undefined) gen\n (\"value=types[%i].decode(r,r.uint32())\", i); // can't be groups\n else gen\n (\"value=r.%s()\", type);\n\n gen\n (\"break\")\n (\"default:\")\n (\"r.skipType(tag2&7)\")\n (\"break\")\n (\"}\")\n (\"}\");\n\n if (types.long[field.keyType] !== undefined) gen\n (\"%s[typeof k===\\\"object\\\"?util.longToHash(k):k]=value\", ref);\n else gen\n (\"%s[k]=value\", ref);\n\n // Repeated fields\n } else if (field.repeated) { gen\n\n (\"if(!(%s&&%s.length))\", ref, ref)\n (\"%s=[]\", ref);\n\n // Packable (always check for forward and backward compatiblity)\n if (types.packed[type] !== undefined) gen\n (\"if((t&7)===2){\")\n (\"var c2=r.uint32()+r.pos\")\n (\"while(r.pos<c2)\")\n (\"%s.push(r.%s())\", ref, type)\n (\"}else\");\n\n // Non-packed\n if (types.basic[type] === undefined) gen(field.resolvedType.group\n ? \"%s.push(types[%i].decode(r))\"\n : \"%s.push(types[%i].decode(r,r.uint32()))\", ref, i);\n else gen\n (\"%s.push(r.%s())\", ref, type);\n\n // Non-repeated\n } else if (types.basic[type] === undefined) gen(field.resolvedType.group\n ? \"%s=types[%i].decode(r)\"\n : \"%s=types[%i].decode(r,r.uint32())\", ref, i);\n else gen\n (\"%s=r.%s()\", ref, type);\n gen\n (\"break\")\n (\"}\");\n // Unknown fields\n } gen\n (\"default:\")\n (\"r.skipType(t&7)\")\n (\"break\")\n\n (\"}\")\n (\"}\");\n\n // Field presence\n for (i = 0; i < mtype._fieldsArray.length; ++i) {\n var rfield = mtype._fieldsArray[i];\n if (rfield.required) gen\n (\"if(!m.hasOwnProperty(%j))\", rfield.name)\n (\"throw util.ProtocolError(%j,{instance:m})\", missing(rfield));\n }\n\n return gen\n (\"return m\");\n /* eslint-enable no-unexpected-multiline */\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/decoder.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/encoder.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/encoder.js ***!
|
||
\************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = encoder;\n\nvar Enum = __webpack_require__(/*! ./enum */ \"./node_modules/protobufjs/src/enum.js\"),\n types = __webpack_require__(/*! ./types */ \"./node_modules/protobufjs/src/types.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\n/**\n * Generates a partial message type encoder.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} ref Variable reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genTypePartial(gen, field, fieldIndex, ref) {\n return field.resolvedType.group\n ? gen(\"types[%i].encode(%s,w.uint32(%i)).uint32(%i)\", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0)\n : gen(\"types[%i].encode(%s,w.uint32(%i).fork()).ldelim()\", fieldIndex, ref, (field.id << 3 | 2) >>> 0);\n}\n\n/**\n * Generates an encoder specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nfunction encoder(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var gen = util.codegen([\"m\", \"w\"], mtype.name + \"$encode\")\n (\"if(!w)\")\n (\"w=Writer.create()\");\n\n var i, ref;\n\n // \"when a message is serialized its known fields should be written sequentially by field number\"\n var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById);\n\n for (var i = 0; i < fields.length; ++i) {\n var field = fields[i].resolve(),\n index = mtype._fieldsArray.indexOf(field),\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\n wireType = types.basic[type];\n ref = \"m\" + util.safeProp(field.name);\n\n // Map fields\n if (field.map) {\n gen\n (\"if(%s!=null&&Object.hasOwnProperty.call(m,%j)){\", ref, field.name) // !== undefined && !== null\n (\"for(var ks=Object.keys(%s),i=0;i<ks.length;++i){\", ref)\n (\"w.uint32(%i).fork().uint32(%i).%s(ks[i])\", (field.id << 3 | 2) >>> 0, 8 | types.mapKey[field.keyType], field.keyType);\n if (wireType === undefined) gen\n (\"types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()\", index, ref); // can't be groups\n else gen\n (\".uint32(%i).%s(%s[ks[i]]).ldelim()\", 16 | wireType, type, ref);\n gen\n (\"}\")\n (\"}\");\n\n // Repeated fields\n } else if (field.repeated) { gen\n (\"if(%s!=null&&%s.length){\", ref, ref); // !== undefined && !== null\n\n // Packed repeated\n if (field.packed && types.packed[type] !== undefined) { gen\n\n (\"w.uint32(%i).fork()\", (field.id << 3 | 2) >>> 0)\n (\"for(var i=0;i<%s.length;++i)\", ref)\n (\"w.%s(%s[i])\", type, ref)\n (\"w.ldelim()\");\n\n // Non-packed\n } else { gen\n\n (\"for(var i=0;i<%s.length;++i)\", ref);\n if (wireType === undefined)\n genTypePartial(gen, field, index, ref + \"[i]\");\n else gen\n (\"w.uint32(%i).%s(%s[i])\", (field.id << 3 | wireType) >>> 0, type, ref);\n\n } gen\n (\"}\");\n\n // Non-repeated\n } else {\n if (field.optional) gen\n (\"if(%s!=null&&Object.hasOwnProperty.call(m,%j))\", ref, field.name); // !== undefined && !== null\n\n if (wireType === undefined)\n genTypePartial(gen, field, index, ref);\n else gen\n (\"w.uint32(%i).%s(%s)\", (field.id << 3 | wireType) >>> 0, type, ref);\n\n }\n }\n\n return gen\n (\"return w\");\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/encoder.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/enum.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/enum.js ***!
|
||
\*********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = Enum;\n\n// extends ReflectionObject\nvar ReflectionObject = __webpack_require__(/*! ./object */ \"./node_modules/protobufjs/src/object.js\");\n((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = \"Enum\";\n\nvar Namespace = __webpack_require__(/*! ./namespace */ \"./node_modules/protobufjs/src/namespace.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\n/**\n * Constructs a new enum instance.\n * @classdesc Reflected enum.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {Object.<string,number>} [values] Enum values as an object, by name\n * @param {Object.<string,*>} [options] Declared options\n * @param {string} [comment] The comment for this enum\n * @param {Object.<string,string>} [comments] The value comments for this enum\n * @param {Object.<string,Object<string,*>>|undefined} [valuesOptions] The value options for this enum\n */\nfunction Enum(name, values, options, comment, comments, valuesOptions) {\n ReflectionObject.call(this, name, options);\n\n if (values && typeof values !== \"object\")\n throw TypeError(\"values must be an object\");\n\n /**\n * Enum values by id.\n * @type {Object.<number,string>}\n */\n this.valuesById = {};\n\n /**\n * Enum values by name.\n * @type {Object.<string,number>}\n */\n this.values = Object.create(this.valuesById); // toJSON, marker\n\n /**\n * Enum comment text.\n * @type {string|null}\n */\n this.comment = comment;\n\n /**\n * Value comment texts, if any.\n * @type {Object.<string,string>}\n */\n this.comments = comments || {};\n\n /**\n * Values options, if any\n * @type {Object<string, Object<string, *>>|undefined}\n */\n this.valuesOptions = valuesOptions;\n\n /**\n * Reserved ranges, if any.\n * @type {Array.<number[]|string>}\n */\n this.reserved = undefined; // toJSON\n\n // Note that values inherit valuesById on their prototype which makes them a TypeScript-\n // compatible enum. This is used by pbts to write actual enum definitions that work for\n // static and reflection code alike instead of emitting generic object definitions.\n\n if (values)\n for (var keys = Object.keys(values), i = 0; i < keys.length; ++i)\n if (typeof values[keys[i]] === \"number\") // use forward entries only\n this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i];\n}\n\n/**\n * Enum descriptor.\n * @interface IEnum\n * @property {Object.<string,number>} values Enum values\n * @property {Object.<string,*>} [options] Enum options\n */\n\n/**\n * Constructs an enum from an enum descriptor.\n * @param {string} name Enum name\n * @param {IEnum} json Enum descriptor\n * @returns {Enum} Created enum\n * @throws {TypeError} If arguments are invalid\n */\nEnum.fromJSON = function fromJSON(name, json) {\n var enm = new Enum(name, json.values, json.options, json.comment, json.comments);\n enm.reserved = json.reserved;\n return enm;\n};\n\n/**\n * Converts this enum to an enum descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IEnum} Enum descriptor\n */\nEnum.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , this.options,\n \"valuesOptions\" , this.valuesOptions,\n \"values\" , this.values,\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\n \"comment\" , keepComments ? this.comment : undefined,\n \"comments\" , keepComments ? this.comments : undefined\n ]);\n};\n\n/**\n * Adds a value to this enum.\n * @param {string} name Value name\n * @param {number} id Value id\n * @param {string} [comment] Comment, if any\n * @param {Object.<string, *>|undefined} [options] Options, if any\n * @returns {Enum} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a value with this name or id\n */\nEnum.prototype.add = function add(name, id, comment, options) {\n // utilized by the parser but not by .fromJSON\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n if (!util.isInteger(id))\n throw TypeError(\"id must be an integer\");\n\n if (this.values[name] !== undefined)\n throw Error(\"duplicate name '\" + name + \"' in \" + this);\n\n if (this.isReservedId(id))\n throw Error(\"id \" + id + \" is reserved in \" + this);\n\n if (this.isReservedName(name))\n throw Error(\"name '\" + name + \"' is reserved in \" + this);\n\n if (this.valuesById[id] !== undefined) {\n if (!(this.options && this.options.allow_alias))\n throw Error(\"duplicate id \" + id + \" in \" + this);\n this.values[name] = id;\n } else\n this.valuesById[this.values[name] = id] = name;\n\n if (options) {\n if (this.valuesOptions === undefined)\n this.valuesOptions = {};\n this.valuesOptions[name] = options || null;\n }\n\n this.comments[name] = comment || null;\n return this;\n};\n\n/**\n * Removes a value from this enum\n * @param {string} name Value name\n * @returns {Enum} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `name` is not a name of this enum\n */\nEnum.prototype.remove = function remove(name) {\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n var val = this.values[name];\n if (val == null)\n throw Error(\"name '\" + name + \"' does not exist in \" + this);\n\n delete this.valuesById[val];\n delete this.values[name];\n delete this.comments[name];\n if (this.valuesOptions)\n delete this.valuesOptions[name];\n\n return this;\n};\n\n/**\n * Tests if the specified id is reserved.\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nEnum.prototype.isReservedId = function isReservedId(id) {\n return Namespace.isReservedId(this.reserved, id);\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nEnum.prototype.isReservedName = function isReservedName(name) {\n return Namespace.isReservedName(this.reserved, name);\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/enum.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/field.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/field.js ***!
|
||
\**********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = Field;\n\n// extends ReflectionObject\nvar ReflectionObject = __webpack_require__(/*! ./object */ \"./node_modules/protobufjs/src/object.js\");\n((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = \"Field\";\n\nvar Enum = __webpack_require__(/*! ./enum */ \"./node_modules/protobufjs/src/enum.js\"),\n types = __webpack_require__(/*! ./types */ \"./node_modules/protobufjs/src/types.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\nvar Type; // cyclic\n\nvar ruleRe = /^required|optional|repeated$/;\n\n/**\n * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class.\n * @name Field\n * @classdesc Reflected message field.\n * @extends FieldBase\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} type Value type\n * @param {string|Object.<string,*>} [rule=\"optional\"] Field rule\n * @param {string|Object.<string,*>} [extend] Extended type if different from parent\n * @param {Object.<string,*>} [options] Declared options\n */\n\n/**\n * Constructs a field from a field descriptor.\n * @param {string} name Field name\n * @param {IField} json Field descriptor\n * @returns {Field} Created field\n * @throws {TypeError} If arguments are invalid\n */\nField.fromJSON = function fromJSON(name, json) {\n return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment);\n};\n\n/**\n * Not an actual constructor. Use {@link Field} instead.\n * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions.\n * @exports FieldBase\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} type Value type\n * @param {string|Object.<string,*>} [rule=\"optional\"] Field rule\n * @param {string|Object.<string,*>} [extend] Extended type if different from parent\n * @param {Object.<string,*>} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction Field(name, id, type, rule, extend, options, comment) {\n\n if (util.isObject(rule)) {\n comment = extend;\n options = rule;\n rule = extend = undefined;\n } else if (util.isObject(extend)) {\n comment = options;\n options = extend;\n extend = undefined;\n }\n\n ReflectionObject.call(this, name, options);\n\n if (!util.isInteger(id) || id < 0)\n throw TypeError(\"id must be a non-negative integer\");\n\n if (!util.isString(type))\n throw TypeError(\"type must be a string\");\n\n if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase()))\n throw TypeError(\"rule must be a string rule\");\n\n if (extend !== undefined && !util.isString(extend))\n throw TypeError(\"extend must be a string\");\n\n /**\n * Field rule, if any.\n * @type {string|undefined}\n */\n if (rule === \"proto3_optional\") {\n rule = \"optional\";\n }\n this.rule = rule && rule !== \"optional\" ? rule : undefined; // toJSON\n\n /**\n * Field type.\n * @type {string}\n */\n this.type = type; // toJSON\n\n /**\n * Unique field id.\n * @type {number}\n */\n this.id = id; // toJSON, marker\n\n /**\n * Extended type if different from parent.\n * @type {string|undefined}\n */\n this.extend = extend || undefined; // toJSON\n\n /**\n * Whether this field is required.\n * @type {boolean}\n */\n this.required = rule === \"required\";\n\n /**\n * Whether this field is optional.\n * @type {boolean}\n */\n this.optional = !this.required;\n\n /**\n * Whether this field is repeated.\n * @type {boolean}\n */\n this.repeated = rule === \"repeated\";\n\n /**\n * Whether this field is a map or not.\n * @type {boolean}\n */\n this.map = false;\n\n /**\n * Message this field belongs to.\n * @type {Type|null}\n */\n this.message = null;\n\n /**\n * OneOf this field belongs to, if any,\n * @type {OneOf|null}\n */\n this.partOf = null;\n\n /**\n * The field type's default value.\n * @type {*}\n */\n this.typeDefault = null;\n\n /**\n * The field's default value on prototypes.\n * @type {*}\n */\n this.defaultValue = null;\n\n /**\n * Whether this field's value should be treated as a long.\n * @type {boolean}\n */\n this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false;\n\n /**\n * Whether this field's value is a buffer.\n * @type {boolean}\n */\n this.bytes = type === \"bytes\";\n\n /**\n * Resolved type if not a basic type.\n * @type {Type|Enum|null}\n */\n this.resolvedType = null;\n\n /**\n * Sister-field within the extended type if a declaring extension field.\n * @type {Field|null}\n */\n this.extensionField = null;\n\n /**\n * Sister-field within the declaring namespace if an extended field.\n * @type {Field|null}\n */\n this.declaringField = null;\n\n /**\n * Internally remembers whether this field is packed.\n * @type {boolean|null}\n * @private\n */\n this._packed = null;\n\n /**\n * Comment for this field.\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Determines whether this field is packed. Only relevant when repeated and working with proto2.\n * @name Field#packed\n * @type {boolean}\n * @readonly\n */\nObject.defineProperty(Field.prototype, \"packed\", {\n get: function() {\n // defaults to packed=true if not explicity set to false\n if (this._packed === null)\n this._packed = this.getOption(\"packed\") !== false;\n return this._packed;\n }\n});\n\n/**\n * @override\n */\nField.prototype.setOption = function setOption(name, value, ifNotSet) {\n if (name === \"packed\") // clear cached before setting\n this._packed = null;\n return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet);\n};\n\n/**\n * Field descriptor.\n * @interface IField\n * @property {string} [rule=\"optional\"] Field rule\n * @property {string} type Field type\n * @property {number} id Field id\n * @property {Object.<string,*>} [options] Field options\n */\n\n/**\n * Extension field descriptor.\n * @interface IExtensionField\n * @extends IField\n * @property {string} extend Extended type\n */\n\n/**\n * Converts this field to a field descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IField} Field descriptor\n */\nField.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"rule\" , this.rule !== \"optional\" && this.rule || undefined,\n \"type\" , this.type,\n \"id\" , this.id,\n \"extend\" , this.extend,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Resolves this field's type references.\n * @returns {Field} `this`\n * @throws {Error} If any reference cannot be resolved\n */\nField.prototype.resolve = function resolve() {\n\n if (this.resolved)\n return this;\n\n if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it\n this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type);\n if (this.resolvedType instanceof Type)\n this.typeDefault = null;\n else // instanceof Enum\n this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined\n } else if (this.options && this.options.proto3_optional) {\n // proto3 scalar value marked optional; should default to null\n this.typeDefault = null;\n }\n\n // use explicitly set default value if present\n if (this.options && this.options[\"default\"] != null) {\n this.typeDefault = this.options[\"default\"];\n if (this.resolvedType instanceof Enum && typeof this.typeDefault === \"string\")\n this.typeDefault = this.resolvedType.values[this.typeDefault];\n }\n\n // remove unnecessary options\n if (this.options) {\n if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum))\n delete this.options.packed;\n if (!Object.keys(this.options).length)\n this.options = undefined;\n }\n\n // convert to internal data type if necesssary\n if (this.long) {\n this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === \"u\");\n\n /* istanbul ignore else */\n if (Object.freeze)\n Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it)\n\n } else if (this.bytes && typeof this.typeDefault === \"string\") {\n var buf;\n if (util.base64.test(this.typeDefault))\n util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0);\n else\n util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0);\n this.typeDefault = buf;\n }\n\n // take special care of maps and repeated fields\n if (this.map)\n this.defaultValue = util.emptyObject;\n else if (this.repeated)\n this.defaultValue = util.emptyArray;\n else\n this.defaultValue = this.typeDefault;\n\n // ensure proper value on prototype\n if (this.parent instanceof Type)\n this.parent.ctor.prototype[this.name] = this.defaultValue;\n\n return ReflectionObject.prototype.resolve.call(this);\n};\n\n/**\n * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript).\n * @typedef FieldDecorator\n * @type {function}\n * @param {Object} prototype Target prototype\n * @param {string} fieldName Field name\n * @returns {undefined}\n */\n\n/**\n * Field decorator (TypeScript).\n * @name Field.d\n * @function\n * @param {number} fieldId Field id\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"string\"|\"bool\"|\"bytes\"|Object} fieldType Field type\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\n * @param {T} [defaultValue] Default value\n * @returns {FieldDecorator} Decorator function\n * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[]\n */\nField.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) {\n\n // submessage: decorate the submessage and use its name as the type\n if (typeof fieldType === \"function\")\n fieldType = util.decorateType(fieldType).name;\n\n // enum reference: create a reflected copy of the enum and keep reuseing it\n else if (fieldType && typeof fieldType === \"object\")\n fieldType = util.decorateEnum(fieldType).name;\n\n return function fieldDecorator(prototype, fieldName) {\n util.decorateType(prototype.constructor)\n .add(new Field(fieldName, fieldId, fieldType, fieldRule, { \"default\": defaultValue }));\n };\n};\n\n/**\n * Field decorator (TypeScript).\n * @name Field.d\n * @function\n * @param {number} fieldId Field id\n * @param {Constructor<T>|string} fieldType Field type\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\n * @returns {FieldDecorator} Decorator function\n * @template T extends Message<T>\n * @variation 2\n */\n// like Field.d but without a default value\n\n// Sets up cyclic dependencies (called in index-light)\nField._configure = function configure(Type_) {\n Type = Type_;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/field.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/index-light.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/index-light.js ***!
|
||
\****************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nvar protobuf = module.exports = __webpack_require__(/*! ./index-minimal */ \"./node_modules/protobufjs/src/index-minimal.js\");\n\nprotobuf.build = \"light\";\n\n/**\n * A node-style callback as used by {@link load} and {@link Root#load}.\n * @typedef LoadCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Root} [root] Root, if there hasn't been an error\n * @returns {undefined}\n */\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} root Root namespace, defaults to create a new one if omitted.\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @see {@link Root#load}\n */\nfunction load(filename, root, callback) {\n if (typeof root === \"function\") {\n callback = root;\n root = new protobuf.Root();\n } else if (!root)\n root = new protobuf.Root();\n return root.load(filename, callback);\n}\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\n * @name load\n * @function\n * @param {string|string[]} filename One or multiple files to load\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @see {@link Root#load}\n * @variation 2\n */\n// function load(filename:string, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise.\n * @name load\n * @function\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\n * @returns {Promise<Root>} Promise\n * @see {@link Root#load}\n * @variation 3\n */\n// function load(filename:string, [root:Root]):Promise<Root>\n\nprotobuf.load = load;\n\n/**\n * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only).\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\n * @returns {Root} Root namespace\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\n * @see {@link Root#loadSync}\n */\nfunction loadSync(filename, root) {\n if (!root)\n root = new protobuf.Root();\n return root.loadSync(filename);\n}\n\nprotobuf.loadSync = loadSync;\n\n// Serialization\nprotobuf.encoder = __webpack_require__(/*! ./encoder */ \"./node_modules/protobufjs/src/encoder.js\");\nprotobuf.decoder = __webpack_require__(/*! ./decoder */ \"./node_modules/protobufjs/src/decoder.js\");\nprotobuf.verifier = __webpack_require__(/*! ./verifier */ \"./node_modules/protobufjs/src/verifier.js\");\nprotobuf.converter = __webpack_require__(/*! ./converter */ \"./node_modules/protobufjs/src/converter.js\");\n\n// Reflection\nprotobuf.ReflectionObject = __webpack_require__(/*! ./object */ \"./node_modules/protobufjs/src/object.js\");\nprotobuf.Namespace = __webpack_require__(/*! ./namespace */ \"./node_modules/protobufjs/src/namespace.js\");\nprotobuf.Root = __webpack_require__(/*! ./root */ \"./node_modules/protobufjs/src/root.js\");\nprotobuf.Enum = __webpack_require__(/*! ./enum */ \"./node_modules/protobufjs/src/enum.js\");\nprotobuf.Type = __webpack_require__(/*! ./type */ \"./node_modules/protobufjs/src/type.js\");\nprotobuf.Field = __webpack_require__(/*! ./field */ \"./node_modules/protobufjs/src/field.js\");\nprotobuf.OneOf = __webpack_require__(/*! ./oneof */ \"./node_modules/protobufjs/src/oneof.js\");\nprotobuf.MapField = __webpack_require__(/*! ./mapfield */ \"./node_modules/protobufjs/src/mapfield.js\");\nprotobuf.Service = __webpack_require__(/*! ./service */ \"./node_modules/protobufjs/src/service.js\");\nprotobuf.Method = __webpack_require__(/*! ./method */ \"./node_modules/protobufjs/src/method.js\");\n\n// Runtime\nprotobuf.Message = __webpack_require__(/*! ./message */ \"./node_modules/protobufjs/src/message.js\");\nprotobuf.wrappers = __webpack_require__(/*! ./wrappers */ \"./node_modules/protobufjs/src/wrappers.js\");\n\n// Utility\nprotobuf.types = __webpack_require__(/*! ./types */ \"./node_modules/protobufjs/src/types.js\");\nprotobuf.util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\n// Set up possibly cyclic reflection dependencies\nprotobuf.ReflectionObject._configure(protobuf.Root);\nprotobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);\nprotobuf.Root._configure(protobuf.Type);\nprotobuf.Field._configure(protobuf.Type);\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/index-light.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/index-minimal.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/index-minimal.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = __webpack_require__(/*! ./writer */ \"./node_modules/protobufjs/src/writer.js\");\nprotobuf.BufferWriter = __webpack_require__(/*! ./writer_buffer */ \"./node_modules/protobufjs/src/writer_buffer.js\");\nprotobuf.Reader = __webpack_require__(/*! ./reader */ \"./node_modules/protobufjs/src/reader.js\");\nprotobuf.BufferReader = __webpack_require__(/*! ./reader_buffer */ \"./node_modules/protobufjs/src/reader_buffer.js\");\n\n// Utility\nprotobuf.util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\nprotobuf.rpc = __webpack_require__(/*! ./rpc */ \"./node_modules/protobufjs/src/rpc.js\");\nprotobuf.roots = __webpack_require__(/*! ./roots */ \"./node_modules/protobufjs/src/roots.js\");\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/index-minimal.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/index.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/index.js ***!
|
||
\**********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nvar protobuf = module.exports = __webpack_require__(/*! ./index-light */ \"./node_modules/protobufjs/src/index-light.js\");\n\nprotobuf.build = \"full\";\n\n// Parser\nprotobuf.tokenize = __webpack_require__(/*! ./tokenize */ \"./node_modules/protobufjs/src/tokenize.js\");\nprotobuf.parse = __webpack_require__(/*! ./parse */ \"./node_modules/protobufjs/src/parse.js\");\nprotobuf.common = __webpack_require__(/*! ./common */ \"./node_modules/protobufjs/src/common.js\");\n\n// Configure parser\nprotobuf.Root._configure(protobuf.Type, protobuf.parse, protobuf.common);\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/mapfield.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/mapfield.js ***!
|
||
\*************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = MapField;\n\n// extends Field\nvar Field = __webpack_require__(/*! ./field */ \"./node_modules/protobufjs/src/field.js\");\n((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = \"MapField\";\n\nvar types = __webpack_require__(/*! ./types */ \"./node_modules/protobufjs/src/types.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\n/**\n * Constructs a new map field instance.\n * @classdesc Reflected map field.\n * @extends FieldBase\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} keyType Key type\n * @param {string} type Value type\n * @param {Object.<string,*>} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction MapField(name, id, keyType, type, options, comment) {\n Field.call(this, name, id, type, undefined, undefined, options, comment);\n\n /* istanbul ignore if */\n if (!util.isString(keyType))\n throw TypeError(\"keyType must be a string\");\n\n /**\n * Key type.\n * @type {string}\n */\n this.keyType = keyType; // toJSON, marker\n\n /**\n * Resolved key type if not a basic type.\n * @type {ReflectionObject|null}\n */\n this.resolvedKeyType = null;\n\n // Overrides Field#map\n this.map = true;\n}\n\n/**\n * Map field descriptor.\n * @interface IMapField\n * @extends {IField}\n * @property {string} keyType Key type\n */\n\n/**\n * Extension map field descriptor.\n * @interface IExtensionMapField\n * @extends IMapField\n * @property {string} extend Extended type\n */\n\n/**\n * Constructs a map field from a map field descriptor.\n * @param {string} name Field name\n * @param {IMapField} json Map field descriptor\n * @returns {MapField} Created map field\n * @throws {TypeError} If arguments are invalid\n */\nMapField.fromJSON = function fromJSON(name, json) {\n return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);\n};\n\n/**\n * Converts this map field to a map field descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IMapField} Map field descriptor\n */\nMapField.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"keyType\" , this.keyType,\n \"type\" , this.type,\n \"id\" , this.id,\n \"extend\" , this.extend,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nMapField.prototype.resolve = function resolve() {\n if (this.resolved)\n return this;\n\n // Besides a value type, map fields have a key type that may be \"any scalar type except for floating point types and bytes\"\n if (types.mapKey[this.keyType] === undefined)\n throw Error(\"invalid key type: \" + this.keyType);\n\n return Field.prototype.resolve.call(this);\n};\n\n/**\n * Map field decorator (TypeScript).\n * @name MapField.d\n * @function\n * @param {number} fieldId Field id\n * @param {\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"} fieldKeyType Field key type\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"|\"bytes\"|Object|Constructor<{}>} fieldValueType Field value type\n * @returns {FieldDecorator} Decorator function\n * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> }\n */\nMapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) {\n\n // submessage value: decorate the submessage and use its name as the type\n if (typeof fieldValueType === \"function\")\n fieldValueType = util.decorateType(fieldValueType).name;\n\n // enum reference value: create a reflected copy of the enum and keep reuseing it\n else if (fieldValueType && typeof fieldValueType === \"object\")\n fieldValueType = util.decorateEnum(fieldValueType).name;\n\n return function mapFieldDecorator(prototype, fieldName) {\n util.decorateType(prototype.constructor)\n .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType));\n };\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/mapfield.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/message.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/message.js ***!
|
||
\************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = Message;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs a new message instance.\n * @classdesc Abstract runtime message.\n * @constructor\n * @param {Properties<T>} [properties] Properties to set\n * @template T extends object = object\n */\nfunction Message(properties) {\n // not used internally\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n this[keys[i]] = properties[keys[i]];\n}\n\n/**\n * Reference to the reflected type.\n * @name Message.$type\n * @type {Type}\n * @readonly\n */\n\n/**\n * Reference to the reflected type.\n * @name Message#$type\n * @type {Type}\n * @readonly\n */\n\n/*eslint-disable valid-jsdoc*/\n\n/**\n * Creates a new message of this type using the specified properties.\n * @param {Object.<string,*>} [properties] Properties to set\n * @returns {Message<T>} Message instance\n * @template T extends Message<T>\n * @this Constructor<T>\n */\nMessage.create = function create(properties) {\n return this.$type.create(properties);\n};\n\n/**\n * Encodes a message of this type.\n * @param {T|Object.<string,*>} message Message to encode\n * @param {Writer} [writer] Writer to use\n * @returns {Writer} Writer\n * @template T extends Message<T>\n * @this Constructor<T>\n */\nMessage.encode = function encode(message, writer) {\n return this.$type.encode(message, writer);\n};\n\n/**\n * Encodes a message of this type preceeded by its length as a varint.\n * @param {T|Object.<string,*>} message Message to encode\n * @param {Writer} [writer] Writer to use\n * @returns {Writer} Writer\n * @template T extends Message<T>\n * @this Constructor<T>\n */\nMessage.encodeDelimited = function encodeDelimited(message, writer) {\n return this.$type.encodeDelimited(message, writer);\n};\n\n/**\n * Decodes a message of this type.\n * @name Message.decode\n * @function\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\n * @returns {T} Decoded message\n * @template T extends Message<T>\n * @this Constructor<T>\n */\nMessage.decode = function decode(reader) {\n return this.$type.decode(reader);\n};\n\n/**\n * Decodes a message of this type preceeded by its length as a varint.\n * @name Message.decodeDelimited\n * @function\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\n * @returns {T} Decoded message\n * @template T extends Message<T>\n * @this Constructor<T>\n */\nMessage.decodeDelimited = function decodeDelimited(reader) {\n return this.$type.decodeDelimited(reader);\n};\n\n/**\n * Verifies a message of this type.\n * @name Message.verify\n * @function\n * @param {Object.<string,*>} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\nMessage.verify = function verify(message) {\n return this.$type.verify(message);\n};\n\n/**\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\n * @param {Object.<string,*>} object Plain object\n * @returns {T} Message instance\n * @template T extends Message<T>\n * @this Constructor<T>\n */\nMessage.fromObject = function fromObject(object) {\n return this.$type.fromObject(object);\n};\n\n/**\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\n * @param {T} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.<string,*>} Plain object\n * @template T extends Message<T>\n * @this Constructor<T>\n */\nMessage.toObject = function toObject(message, options) {\n return this.$type.toObject(message, options);\n};\n\n/**\n * Converts this message to JSON.\n * @returns {Object.<string,*>} JSON object\n */\nMessage.prototype.toJSON = function toJSON() {\n return this.$type.toObject(this, util.toJSONOptions);\n};\n\n/*eslint-enable valid-jsdoc*/\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/method.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/method.js ***!
|
||
\***********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = Method;\n\n// extends ReflectionObject\nvar ReflectionObject = __webpack_require__(/*! ./object */ \"./node_modules/protobufjs/src/object.js\");\n((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = \"Method\";\n\nvar util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\n/**\n * Constructs a new service method instance.\n * @classdesc Reflected service method.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Method name\n * @param {string|undefined} type Method type, usually `\"rpc\"`\n * @param {string} requestType Request message type\n * @param {string} responseType Response message type\n * @param {boolean|Object.<string,*>} [requestStream] Whether the request is streamed\n * @param {boolean|Object.<string,*>} [responseStream] Whether the response is streamed\n * @param {Object.<string,*>} [options] Declared options\n * @param {string} [comment] The comment for this method\n * @param {Object.<string,*>} [parsedOptions] Declared options, properly parsed into an object\n */\nfunction Method(name, type, requestType, responseType, requestStream, responseStream, options, comment, parsedOptions) {\n\n /* istanbul ignore next */\n if (util.isObject(requestStream)) {\n options = requestStream;\n requestStream = responseStream = undefined;\n } else if (util.isObject(responseStream)) {\n options = responseStream;\n responseStream = undefined;\n }\n\n /* istanbul ignore if */\n if (!(type === undefined || util.isString(type)))\n throw TypeError(\"type must be a string\");\n\n /* istanbul ignore if */\n if (!util.isString(requestType))\n throw TypeError(\"requestType must be a string\");\n\n /* istanbul ignore if */\n if (!util.isString(responseType))\n throw TypeError(\"responseType must be a string\");\n\n ReflectionObject.call(this, name, options);\n\n /**\n * Method type.\n * @type {string}\n */\n this.type = type || \"rpc\"; // toJSON\n\n /**\n * Request type.\n * @type {string}\n */\n this.requestType = requestType; // toJSON, marker\n\n /**\n * Whether requests are streamed or not.\n * @type {boolean|undefined}\n */\n this.requestStream = requestStream ? true : undefined; // toJSON\n\n /**\n * Response type.\n * @type {string}\n */\n this.responseType = responseType; // toJSON\n\n /**\n * Whether responses are streamed or not.\n * @type {boolean|undefined}\n */\n this.responseStream = responseStream ? true : undefined; // toJSON\n\n /**\n * Resolved request type.\n * @type {Type|null}\n */\n this.resolvedRequestType = null;\n\n /**\n * Resolved response type.\n * @type {Type|null}\n */\n this.resolvedResponseType = null;\n\n /**\n * Comment for this method\n * @type {string|null}\n */\n this.comment = comment;\n\n /**\n * Options properly parsed into an object\n */\n this.parsedOptions = parsedOptions;\n}\n\n/**\n * Method descriptor.\n * @interface IMethod\n * @property {string} [type=\"rpc\"] Method type\n * @property {string} requestType Request type\n * @property {string} responseType Response type\n * @property {boolean} [requestStream=false] Whether requests are streamed\n * @property {boolean} [responseStream=false] Whether responses are streamed\n * @property {Object.<string,*>} [options] Method options\n * @property {string} comment Method comments\n * @property {Object.<string,*>} [parsedOptions] Method options properly parsed into an object\n */\n\n/**\n * Constructs a method from a method descriptor.\n * @param {string} name Method name\n * @param {IMethod} json Method descriptor\n * @returns {Method} Created method\n * @throws {TypeError} If arguments are invalid\n */\nMethod.fromJSON = function fromJSON(name, json) {\n return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment, json.parsedOptions);\n};\n\n/**\n * Converts this method to a method descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IMethod} Method descriptor\n */\nMethod.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"type\" , this.type !== \"rpc\" && /* istanbul ignore next */ this.type || undefined,\n \"requestType\" , this.requestType,\n \"requestStream\" , this.requestStream,\n \"responseType\" , this.responseType,\n \"responseStream\" , this.responseStream,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined,\n \"parsedOptions\" , this.parsedOptions,\n ]);\n};\n\n/**\n * @override\n */\nMethod.prototype.resolve = function resolve() {\n\n /* istanbul ignore if */\n if (this.resolved)\n return this;\n\n this.resolvedRequestType = this.parent.lookupType(this.requestType);\n this.resolvedResponseType = this.parent.lookupType(this.responseType);\n\n return ReflectionObject.prototype.resolve.call(this);\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/method.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/namespace.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/namespace.js ***!
|
||
\**************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = Namespace;\n\n// extends ReflectionObject\nvar ReflectionObject = __webpack_require__(/*! ./object */ \"./node_modules/protobufjs/src/object.js\");\n((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = \"Namespace\";\n\nvar Field = __webpack_require__(/*! ./field */ \"./node_modules/protobufjs/src/field.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\"),\n OneOf = __webpack_require__(/*! ./oneof */ \"./node_modules/protobufjs/src/oneof.js\");\n\nvar Type, // cyclic\n Service,\n Enum;\n\n/**\n * Constructs a new namespace instance.\n * @name Namespace\n * @classdesc Reflected namespace.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Namespace name\n * @param {Object.<string,*>} [options] Declared options\n */\n\n/**\n * Constructs a namespace from JSON.\n * @memberof Namespace\n * @function\n * @param {string} name Namespace name\n * @param {Object.<string,*>} json JSON object\n * @returns {Namespace} Created namespace\n * @throws {TypeError} If arguments are invalid\n */\nNamespace.fromJSON = function fromJSON(name, json) {\n return new Namespace(name, json.options).addJSON(json.nested);\n};\n\n/**\n * Converts an array of reflection objects to JSON.\n * @memberof Namespace\n * @param {ReflectionObject[]} array Object array\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {Object.<string,*>|undefined} JSON object or `undefined` when array is empty\n */\nfunction arrayToJSON(array, toJSONOptions) {\n if (!(array && array.length))\n return undefined;\n var obj = {};\n for (var i = 0; i < array.length; ++i)\n obj[array[i].name] = array[i].toJSON(toJSONOptions);\n return obj;\n}\n\nNamespace.arrayToJSON = arrayToJSON;\n\n/**\n * Tests if the specified id is reserved.\n * @param {Array.<number[]|string>|undefined} reserved Array of reserved ranges and names\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nNamespace.isReservedId = function isReservedId(reserved, id) {\n if (reserved)\n for (var i = 0; i < reserved.length; ++i)\n if (typeof reserved[i] !== \"string\" && reserved[i][0] <= id && reserved[i][1] > id)\n return true;\n return false;\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {Array.<number[]|string>|undefined} reserved Array of reserved ranges and names\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nNamespace.isReservedName = function isReservedName(reserved, name) {\n if (reserved)\n for (var i = 0; i < reserved.length; ++i)\n if (reserved[i] === name)\n return true;\n return false;\n};\n\n/**\n * Not an actual constructor. Use {@link Namespace} instead.\n * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions.\n * @exports NamespaceBase\n * @extends ReflectionObject\n * @abstract\n * @constructor\n * @param {string} name Namespace name\n * @param {Object.<string,*>} [options] Declared options\n * @see {@link Namespace}\n */\nfunction Namespace(name, options) {\n ReflectionObject.call(this, name, options);\n\n /**\n * Nested objects by name.\n * @type {Object.<string,ReflectionObject>|undefined}\n */\n this.nested = undefined; // toJSON\n\n /**\n * Cached nested objects as an array.\n * @type {ReflectionObject[]|null}\n * @private\n */\n this._nestedArray = null;\n}\n\nfunction clearCache(namespace) {\n namespace._nestedArray = null;\n return namespace;\n}\n\n/**\n * Nested objects of this namespace as an array for iteration.\n * @name NamespaceBase#nestedArray\n * @type {ReflectionObject[]}\n * @readonly\n */\nObject.defineProperty(Namespace.prototype, \"nestedArray\", {\n get: function() {\n return this._nestedArray || (this._nestedArray = util.toArray(this.nested));\n }\n});\n\n/**\n * Namespace descriptor.\n * @interface INamespace\n * @property {Object.<string,*>} [options] Namespace options\n * @property {Object.<string,AnyNestedObject>} [nested] Nested object descriptors\n */\n\n/**\n * Any extension field descriptor.\n * @typedef AnyExtensionField\n * @type {IExtensionField|IExtensionMapField}\n */\n\n/**\n * Any nested object descriptor.\n * @typedef AnyNestedObject\n * @type {IEnum|IType|IService|AnyExtensionField|INamespace|IOneOf}\n */\n\n/**\n * Converts this namespace to a namespace descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {INamespace} Namespace descriptor\n */\nNamespace.prototype.toJSON = function toJSON(toJSONOptions) {\n return util.toObject([\n \"options\" , this.options,\n \"nested\" , arrayToJSON(this.nestedArray, toJSONOptions)\n ]);\n};\n\n/**\n * Adds nested objects to this namespace from nested object descriptors.\n * @param {Object.<string,AnyNestedObject>} nestedJson Any nested object descriptors\n * @returns {Namespace} `this`\n */\nNamespace.prototype.addJSON = function addJSON(nestedJson) {\n var ns = this;\n /* istanbul ignore else */\n if (nestedJson) {\n for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) {\n nested = nestedJson[names[i]];\n ns.add( // most to least likely\n ( nested.fields !== undefined\n ? Type.fromJSON\n : nested.values !== undefined\n ? Enum.fromJSON\n : nested.methods !== undefined\n ? Service.fromJSON\n : nested.id !== undefined\n ? Field.fromJSON\n : Namespace.fromJSON )(names[i], nested)\n );\n }\n }\n return this;\n};\n\n/**\n * Gets the nested object of the specified name.\n * @param {string} name Nested object name\n * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist\n */\nNamespace.prototype.get = function get(name) {\n return this.nested && this.nested[name]\n || null;\n};\n\n/**\n * Gets the values of the nested {@link Enum|enum} of the specified name.\n * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`.\n * @param {string} name Nested enum name\n * @returns {Object.<string,number>} Enum values\n * @throws {Error} If there is no such enum\n */\nNamespace.prototype.getEnum = function getEnum(name) {\n if (this.nested && this.nested[name] instanceof Enum)\n return this.nested[name].values;\n throw Error(\"no such enum: \" + name);\n};\n\n/**\n * Adds a nested object to this namespace.\n * @param {ReflectionObject} object Nested object to add\n * @returns {Namespace} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a nested object with this name\n */\nNamespace.prototype.add = function add(object) {\n\n if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof OneOf || object instanceof Enum || object instanceof Service || object instanceof Namespace))\n throw TypeError(\"object must be a valid nested object\");\n\n if (!this.nested)\n this.nested = {};\n else {\n var prev = this.get(object.name);\n if (prev) {\n if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) {\n // replace plain namespace but keep existing nested elements and options\n var nested = prev.nestedArray;\n for (var i = 0; i < nested.length; ++i)\n object.add(nested[i]);\n this.remove(prev);\n if (!this.nested)\n this.nested = {};\n object.setOptions(prev.options, true);\n\n } else\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n }\n }\n this.nested[object.name] = object;\n object.onAdd(this);\n return clearCache(this);\n};\n\n/**\n * Removes a nested object from this namespace.\n * @param {ReflectionObject} object Nested object to remove\n * @returns {Namespace} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `object` is not a member of this namespace\n */\nNamespace.prototype.remove = function remove(object) {\n\n if (!(object instanceof ReflectionObject))\n throw TypeError(\"object must be a ReflectionObject\");\n if (object.parent !== this)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.nested[object.name];\n if (!Object.keys(this.nested).length)\n this.nested = undefined;\n\n object.onRemove(this);\n return clearCache(this);\n};\n\n/**\n * Defines additial namespaces within this one if not yet existing.\n * @param {string|string[]} path Path to create\n * @param {*} [json] Nested types to create from JSON\n * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty\n */\nNamespace.prototype.define = function define(path, json) {\n\n if (util.isString(path))\n path = path.split(\".\");\n else if (!Array.isArray(path))\n throw TypeError(\"illegal path\");\n if (path && path.length && path[0] === \"\")\n throw Error(\"path must be relative\");\n\n var ptr = this;\n while (path.length > 0) {\n var part = path.shift();\n if (ptr.nested && ptr.nested[part]) {\n ptr = ptr.nested[part];\n if (!(ptr instanceof Namespace))\n throw Error(\"path conflicts with non-namespace objects\");\n } else\n ptr.add(ptr = new Namespace(part));\n }\n if (json)\n ptr.addJSON(json);\n return ptr;\n};\n\n/**\n * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost.\n * @returns {Namespace} `this`\n */\nNamespace.prototype.resolveAll = function resolveAll() {\n var nested = this.nestedArray, i = 0;\n while (i < nested.length)\n if (nested[i] instanceof Namespace)\n nested[i++].resolveAll();\n else\n nested[i++].resolve();\n return this.resolve();\n};\n\n/**\n * Recursively looks up the reflection object matching the specified path in the scope of this namespace.\n * @param {string|string[]} path Path to look up\n * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc.\n * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\n */\nNamespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) {\n\n /* istanbul ignore next */\n if (typeof filterTypes === \"boolean\") {\n parentAlreadyChecked = filterTypes;\n filterTypes = undefined;\n } else if (filterTypes && !Array.isArray(filterTypes))\n filterTypes = [ filterTypes ];\n\n if (util.isString(path) && path.length) {\n if (path === \".\")\n return this.root;\n path = path.split(\".\");\n } else if (!path.length)\n return this;\n\n // Start at root if path is absolute\n if (path[0] === \"\")\n return this.root.lookup(path.slice(1), filterTypes);\n\n // Test if the first part matches any nested object, and if so, traverse if path contains more\n var found = this.get(path[0]);\n if (found) {\n if (path.length === 1) {\n if (!filterTypes || filterTypes.indexOf(found.constructor) > -1)\n return found;\n } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true)))\n return found;\n\n // Otherwise try each nested namespace\n } else\n for (var i = 0; i < this.nestedArray.length; ++i)\n if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true)))\n return found;\n\n // If there hasn't been a match, try again at the parent\n if (this.parent === null || parentAlreadyChecked)\n return null;\n return this.parent.lookup(path, filterTypes);\n};\n\n/**\n * Looks up the reflection object at the specified path, relative to this namespace.\n * @name NamespaceBase#lookup\n * @function\n * @param {string|string[]} path Path to look up\n * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\n * @variation 2\n */\n// lookup(path: string, [parentAlreadyChecked: boolean])\n\n/**\n * Looks up the {@link Type|type} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Type} Looked up type\n * @throws {Error} If `path` does not point to a type\n */\nNamespace.prototype.lookupType = function lookupType(path) {\n var found = this.lookup(path, [ Type ]);\n if (!found)\n throw Error(\"no such type: \" + path);\n return found;\n};\n\n/**\n * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Enum} Looked up enum\n * @throws {Error} If `path` does not point to an enum\n */\nNamespace.prototype.lookupEnum = function lookupEnum(path) {\n var found = this.lookup(path, [ Enum ]);\n if (!found)\n throw Error(\"no such Enum '\" + path + \"' in \" + this);\n return found;\n};\n\n/**\n * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Type} Looked up type or enum\n * @throws {Error} If `path` does not point to a type or enum\n */\nNamespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) {\n var found = this.lookup(path, [ Type, Enum ]);\n if (!found)\n throw Error(\"no such Type or Enum '\" + path + \"' in \" + this);\n return found;\n};\n\n/**\n * Looks up the {@link Service|service} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Service} Looked up service\n * @throws {Error} If `path` does not point to a service\n */\nNamespace.prototype.lookupService = function lookupService(path) {\n var found = this.lookup(path, [ Service ]);\n if (!found)\n throw Error(\"no such Service '\" + path + \"' in \" + this);\n return found;\n};\n\n// Sets up cyclic dependencies (called in index-light)\nNamespace._configure = function(Type_, Service_, Enum_) {\n Type = Type_;\n Service = Service_;\n Enum = Enum_;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/namespace.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/object.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/object.js ***!
|
||
\***********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = ReflectionObject;\n\nReflectionObject.className = \"ReflectionObject\";\n\nvar util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\nvar Root; // cyclic\n\n/**\n * Constructs a new reflection object instance.\n * @classdesc Base class of all reflection objects.\n * @constructor\n * @param {string} name Object name\n * @param {Object.<string,*>} [options] Declared options\n * @abstract\n */\nfunction ReflectionObject(name, options) {\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n if (options && !util.isObject(options))\n throw TypeError(\"options must be an object\");\n\n /**\n * Options.\n * @type {Object.<string,*>|undefined}\n */\n this.options = options; // toJSON\n\n /**\n * Parsed Options.\n * @type {Array.<Object.<string,*>>|undefined}\n */\n this.parsedOptions = null;\n\n /**\n * Unique name within its namespace.\n * @type {string}\n */\n this.name = name;\n\n /**\n * Parent namespace.\n * @type {Namespace|null}\n */\n this.parent = null;\n\n /**\n * Whether already resolved or not.\n * @type {boolean}\n */\n this.resolved = false;\n\n /**\n * Comment text, if any.\n * @type {string|null}\n */\n this.comment = null;\n\n /**\n * Defining file name.\n * @type {string|null}\n */\n this.filename = null;\n}\n\nObject.defineProperties(ReflectionObject.prototype, {\n\n /**\n * Reference to the root namespace.\n * @name ReflectionObject#root\n * @type {Root}\n * @readonly\n */\n root: {\n get: function() {\n var ptr = this;\n while (ptr.parent !== null)\n ptr = ptr.parent;\n return ptr;\n }\n },\n\n /**\n * Full name including leading dot.\n * @name ReflectionObject#fullName\n * @type {string}\n * @readonly\n */\n fullName: {\n get: function() {\n var path = [ this.name ],\n ptr = this.parent;\n while (ptr) {\n path.unshift(ptr.name);\n ptr = ptr.parent;\n }\n return path.join(\".\");\n }\n }\n});\n\n/**\n * Converts this reflection object to its descriptor representation.\n * @returns {Object.<string,*>} Descriptor\n * @abstract\n */\nReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() {\n throw Error(); // not implemented, shouldn't happen\n};\n\n/**\n * Called when this object is added to a parent.\n * @param {ReflectionObject} parent Parent added to\n * @returns {undefined}\n */\nReflectionObject.prototype.onAdd = function onAdd(parent) {\n if (this.parent && this.parent !== parent)\n this.parent.remove(this);\n this.parent = parent;\n this.resolved = false;\n var root = parent.root;\n if (root instanceof Root)\n root._handleAdd(this);\n};\n\n/**\n * Called when this object is removed from a parent.\n * @param {ReflectionObject} parent Parent removed from\n * @returns {undefined}\n */\nReflectionObject.prototype.onRemove = function onRemove(parent) {\n var root = parent.root;\n if (root instanceof Root)\n root._handleRemove(this);\n this.parent = null;\n this.resolved = false;\n};\n\n/**\n * Resolves this objects type references.\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.resolve = function resolve() {\n if (this.resolved)\n return this;\n if (this.root instanceof Root)\n this.resolved = true; // only if part of a root\n return this;\n};\n\n/**\n * Gets an option value.\n * @param {string} name Option name\n * @returns {*} Option value or `undefined` if not set\n */\nReflectionObject.prototype.getOption = function getOption(name) {\n if (this.options)\n return this.options[name];\n return undefined;\n};\n\n/**\n * Sets an option.\n * @param {string} name Option name\n * @param {*} value Option value\n * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) {\n if (!ifNotSet || !this.options || this.options[name] === undefined)\n (this.options || (this.options = {}))[name] = value;\n return this;\n};\n\n/**\n * Sets a parsed option.\n * @param {string} name parsed Option name\n * @param {*} value Option value\n * @param {string} propName dot '.' delimited full path of property within the option to set. if undefined\\empty, will add a new option with that value\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) {\n if (!this.parsedOptions) {\n this.parsedOptions = [];\n }\n var parsedOptions = this.parsedOptions;\n if (propName) {\n // If setting a sub property of an option then try to merge it\n // with an existing option\n var opt = parsedOptions.find(function (opt) {\n return Object.prototype.hasOwnProperty.call(opt, name);\n });\n if (opt) {\n // If we found an existing option - just merge the property value\n var newValue = opt[name];\n util.setProperty(newValue, propName, value);\n } else {\n // otherwise, create a new option, set it's property and add it to the list\n opt = {};\n opt[name] = util.setProperty({}, propName, value);\n parsedOptions.push(opt);\n }\n } else {\n // Always create a new option when setting the value of the option itself\n var newOpt = {};\n newOpt[name] = value;\n parsedOptions.push(newOpt);\n }\n return this;\n};\n\n/**\n * Sets multiple options.\n * @param {Object.<string,*>} options Options to set\n * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) {\n if (options)\n for (var keys = Object.keys(options), i = 0; i < keys.length; ++i)\n this.setOption(keys[i], options[keys[i]], ifNotSet);\n return this;\n};\n\n/**\n * Converts this instance to its string representation.\n * @returns {string} Class name[, space, full name]\n */\nReflectionObject.prototype.toString = function toString() {\n var className = this.constructor.className,\n fullName = this.fullName;\n if (fullName.length)\n return className + \" \" + fullName;\n return className;\n};\n\n// Sets up cyclic dependencies (called in index-light)\nReflectionObject._configure = function(Root_) {\n Root = Root_;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/object.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/oneof.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/oneof.js ***!
|
||
\**********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = OneOf;\n\n// extends ReflectionObject\nvar ReflectionObject = __webpack_require__(/*! ./object */ \"./node_modules/protobufjs/src/object.js\");\n((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = \"OneOf\";\n\nvar Field = __webpack_require__(/*! ./field */ \"./node_modules/protobufjs/src/field.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\n/**\n * Constructs a new oneof instance.\n * @classdesc Reflected oneof.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Oneof name\n * @param {string[]|Object.<string,*>} [fieldNames] Field names\n * @param {Object.<string,*>} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction OneOf(name, fieldNames, options, comment) {\n if (!Array.isArray(fieldNames)) {\n options = fieldNames;\n fieldNames = undefined;\n }\n ReflectionObject.call(this, name, options);\n\n /* istanbul ignore if */\n if (!(fieldNames === undefined || Array.isArray(fieldNames)))\n throw TypeError(\"fieldNames must be an Array\");\n\n /**\n * Field names that belong to this oneof.\n * @type {string[]}\n */\n this.oneof = fieldNames || []; // toJSON, marker\n\n /**\n * Fields that belong to this oneof as an array for iteration.\n * @type {Field[]}\n * @readonly\n */\n this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent\n\n /**\n * Comment for this field.\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Oneof descriptor.\n * @interface IOneOf\n * @property {Array.<string>} oneof Oneof field names\n * @property {Object.<string,*>} [options] Oneof options\n */\n\n/**\n * Constructs a oneof from a oneof descriptor.\n * @param {string} name Oneof name\n * @param {IOneOf} json Oneof descriptor\n * @returns {OneOf} Created oneof\n * @throws {TypeError} If arguments are invalid\n */\nOneOf.fromJSON = function fromJSON(name, json) {\n return new OneOf(name, json.oneof, json.options, json.comment);\n};\n\n/**\n * Converts this oneof to a oneof descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IOneOf} Oneof descriptor\n */\nOneOf.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , this.options,\n \"oneof\" , this.oneof,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Adds the fields of the specified oneof to the parent if not already done so.\n * @param {OneOf} oneof The oneof\n * @returns {undefined}\n * @inner\n * @ignore\n */\nfunction addFieldsToParent(oneof) {\n if (oneof.parent)\n for (var i = 0; i < oneof.fieldsArray.length; ++i)\n if (!oneof.fieldsArray[i].parent)\n oneof.parent.add(oneof.fieldsArray[i]);\n}\n\n/**\n * Adds a field to this oneof and removes it from its current parent, if any.\n * @param {Field} field Field to add\n * @returns {OneOf} `this`\n */\nOneOf.prototype.add = function add(field) {\n\n /* istanbul ignore if */\n if (!(field instanceof Field))\n throw TypeError(\"field must be a Field\");\n\n if (field.parent && field.parent !== this.parent)\n field.parent.remove(field);\n this.oneof.push(field.name);\n this.fieldsArray.push(field);\n field.partOf = this; // field.parent remains null\n addFieldsToParent(this);\n return this;\n};\n\n/**\n * Removes a field from this oneof and puts it back to the oneof's parent.\n * @param {Field} field Field to remove\n * @returns {OneOf} `this`\n */\nOneOf.prototype.remove = function remove(field) {\n\n /* istanbul ignore if */\n if (!(field instanceof Field))\n throw TypeError(\"field must be a Field\");\n\n var index = this.fieldsArray.indexOf(field);\n\n /* istanbul ignore if */\n if (index < 0)\n throw Error(field + \" is not a member of \" + this);\n\n this.fieldsArray.splice(index, 1);\n index = this.oneof.indexOf(field.name);\n\n /* istanbul ignore else */\n if (index > -1) // theoretical\n this.oneof.splice(index, 1);\n\n field.partOf = null;\n return this;\n};\n\n/**\n * @override\n */\nOneOf.prototype.onAdd = function onAdd(parent) {\n ReflectionObject.prototype.onAdd.call(this, parent);\n var self = this;\n // Collect present fields\n for (var i = 0; i < this.oneof.length; ++i) {\n var field = parent.get(this.oneof[i]);\n if (field && !field.partOf) {\n field.partOf = self;\n self.fieldsArray.push(field);\n }\n }\n // Add not yet present fields\n addFieldsToParent(this);\n};\n\n/**\n * @override\n */\nOneOf.prototype.onRemove = function onRemove(parent) {\n for (var i = 0, field; i < this.fieldsArray.length; ++i)\n if ((field = this.fieldsArray[i]).parent)\n field.parent.remove(field);\n ReflectionObject.prototype.onRemove.call(this, parent);\n};\n\n/**\n * Decorator function as returned by {@link OneOf.d} (TypeScript).\n * @typedef OneOfDecorator\n * @type {function}\n * @param {Object} prototype Target prototype\n * @param {string} oneofName OneOf name\n * @returns {undefined}\n */\n\n/**\n * OneOf decorator (TypeScript).\n * @function\n * @param {...string} fieldNames Field names\n * @returns {OneOfDecorator} Decorator function\n * @template T extends string\n */\nOneOf.d = function decorateOneOf() {\n var fieldNames = new Array(arguments.length),\n index = 0;\n while (index < arguments.length)\n fieldNames[index] = arguments[index++];\n return function oneOfDecorator(prototype, oneofName) {\n util.decorateType(prototype.constructor)\n .add(new OneOf(oneofName, fieldNames));\n Object.defineProperty(prototype, oneofName, {\n get: util.oneOfGetter(fieldNames),\n set: util.oneOfSetter(fieldNames)\n });\n };\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/oneof.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/parse.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/parse.js ***!
|
||
\**********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = parse;\n\nparse.filename = null;\nparse.defaults = { keepCase: false };\n\nvar tokenize = __webpack_require__(/*! ./tokenize */ \"./node_modules/protobufjs/src/tokenize.js\"),\n Root = __webpack_require__(/*! ./root */ \"./node_modules/protobufjs/src/root.js\"),\n Type = __webpack_require__(/*! ./type */ \"./node_modules/protobufjs/src/type.js\"),\n Field = __webpack_require__(/*! ./field */ \"./node_modules/protobufjs/src/field.js\"),\n MapField = __webpack_require__(/*! ./mapfield */ \"./node_modules/protobufjs/src/mapfield.js\"),\n OneOf = __webpack_require__(/*! ./oneof */ \"./node_modules/protobufjs/src/oneof.js\"),\n Enum = __webpack_require__(/*! ./enum */ \"./node_modules/protobufjs/src/enum.js\"),\n Service = __webpack_require__(/*! ./service */ \"./node_modules/protobufjs/src/service.js\"),\n Method = __webpack_require__(/*! ./method */ \"./node_modules/protobufjs/src/method.js\"),\n types = __webpack_require__(/*! ./types */ \"./node_modules/protobufjs/src/types.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\nvar base10Re = /^[1-9][0-9]*$/,\n base10NegRe = /^-?[1-9][0-9]*$/,\n base16Re = /^0[x][0-9a-fA-F]+$/,\n base16NegRe = /^-?0[x][0-9a-fA-F]+$/,\n base8Re = /^0[0-7]+$/,\n base8NegRe = /^-?0[0-7]+$/,\n numberRe = /^(?![eE])[0-9]*(?:\\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,\n nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/,\n typeRefRe = /^(?:\\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,\n fqTypeRefRe = /^(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;\n\n/**\n * Result object returned from {@link parse}.\n * @interface IParserResult\n * @property {string|undefined} package Package name, if declared\n * @property {string[]|undefined} imports Imports, if any\n * @property {string[]|undefined} weakImports Weak imports, if any\n * @property {string|undefined} syntax Syntax, if specified (either `\"proto2\"` or `\"proto3\"`)\n * @property {Root} root Populated root instance\n */\n\n/**\n * Options modifying the behavior of {@link parse}.\n * @interface IParseOptions\n * @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case\n * @property {boolean} [alternateCommentMode=false] Recognize double-slash comments in addition to doc-block comments.\n * @property {boolean} [preferTrailingComment=false] Use trailing comment when both leading comment and trailing comment exist.\n */\n\n/**\n * Options modifying the behavior of JSON serialization.\n * @interface IToJSONOptions\n * @property {boolean} [keepComments=false] Serializes comments.\n */\n\n/**\n * Parses the given .proto source and returns an object with the parsed contents.\n * @param {string} source Source contents\n * @param {Root} root Root to populate\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {IParserResult} Parser result\n * @property {string} filename=null Currently processing file name for error reporting, if known\n * @property {IParseOptions} defaults Default {@link IParseOptions}\n */\nfunction parse(source, root, options) {\n /* eslint-disable callback-return */\n if (!(root instanceof Root)) {\n options = root;\n root = new Root();\n }\n if (!options)\n options = parse.defaults;\n\n var preferTrailingComment = options.preferTrailingComment || false;\n var tn = tokenize(source, options.alternateCommentMode || false),\n next = tn.next,\n push = tn.push,\n peek = tn.peek,\n skip = tn.skip,\n cmnt = tn.cmnt;\n\n var head = true,\n pkg,\n imports,\n weakImports,\n syntax,\n isProto3 = false;\n\n var ptr = root;\n\n var applyCase = options.keepCase ? function(name) { return name; } : util.camelCase;\n\n /* istanbul ignore next */\n function illegal(token, name, insideTryCatch) {\n var filename = parse.filename;\n if (!insideTryCatch)\n parse.filename = null;\n return Error(\"illegal \" + (name || \"token\") + \" '\" + token + \"' (\" + (filename ? filename + \", \" : \"\") + \"line \" + tn.line + \")\");\n }\n\n function readString() {\n var values = [],\n token;\n do {\n /* istanbul ignore if */\n if ((token = next()) !== \"\\\"\" && token !== \"'\")\n throw illegal(token);\n\n values.push(next());\n skip(token);\n token = peek();\n } while (token === \"\\\"\" || token === \"'\");\n return values.join(\"\");\n }\n\n function readValue(acceptTypeRef) {\n var token = next();\n switch (token) {\n case \"'\":\n case \"\\\"\":\n push(token);\n return readString();\n case \"true\": case \"TRUE\":\n return true;\n case \"false\": case \"FALSE\":\n return false;\n }\n try {\n return parseNumber(token, /* insideTryCatch */ true);\n } catch (e) {\n\n /* istanbul ignore else */\n if (acceptTypeRef && typeRefRe.test(token))\n return token;\n\n /* istanbul ignore next */\n throw illegal(token, \"value\");\n }\n }\n\n function readRanges(target, acceptStrings) {\n var token, start;\n do {\n if (acceptStrings && ((token = peek()) === \"\\\"\" || token === \"'\"))\n target.push(readString());\n else\n target.push([ start = parseId(next()), skip(\"to\", true) ? parseId(next()) : start ]);\n } while (skip(\",\", true));\n skip(\";\");\n }\n\n function parseNumber(token, insideTryCatch) {\n var sign = 1;\n if (token.charAt(0) === \"-\") {\n sign = -1;\n token = token.substring(1);\n }\n switch (token) {\n case \"inf\": case \"INF\": case \"Inf\":\n return sign * Infinity;\n case \"nan\": case \"NAN\": case \"Nan\": case \"NaN\":\n return NaN;\n case \"0\":\n return 0;\n }\n if (base10Re.test(token))\n return sign * parseInt(token, 10);\n if (base16Re.test(token))\n return sign * parseInt(token, 16);\n if (base8Re.test(token))\n return sign * parseInt(token, 8);\n\n /* istanbul ignore else */\n if (numberRe.test(token))\n return sign * parseFloat(token);\n\n /* istanbul ignore next */\n throw illegal(token, \"number\", insideTryCatch);\n }\n\n function parseId(token, acceptNegative) {\n switch (token) {\n case \"max\": case \"MAX\": case \"Max\":\n return 536870911;\n case \"0\":\n return 0;\n }\n\n /* istanbul ignore if */\n if (!acceptNegative && token.charAt(0) === \"-\")\n throw illegal(token, \"id\");\n\n if (base10NegRe.test(token))\n return parseInt(token, 10);\n if (base16NegRe.test(token))\n return parseInt(token, 16);\n\n /* istanbul ignore else */\n if (base8NegRe.test(token))\n return parseInt(token, 8);\n\n /* istanbul ignore next */\n throw illegal(token, \"id\");\n }\n\n function parsePackage() {\n\n /* istanbul ignore if */\n if (pkg !== undefined)\n throw illegal(\"package\");\n\n pkg = next();\n\n /* istanbul ignore if */\n if (!typeRefRe.test(pkg))\n throw illegal(pkg, \"name\");\n\n ptr = ptr.define(pkg);\n skip(\";\");\n }\n\n function parseImport() {\n var token = peek();\n var whichImports;\n switch (token) {\n case \"weak\":\n whichImports = weakImports || (weakImports = []);\n next();\n break;\n case \"public\":\n next();\n // eslint-disable-next-line no-fallthrough\n default:\n whichImports = imports || (imports = []);\n break;\n }\n token = readString();\n skip(\";\");\n whichImports.push(token);\n }\n\n function parseSyntax() {\n skip(\"=\");\n syntax = readString();\n isProto3 = syntax === \"proto3\";\n\n /* istanbul ignore if */\n if (!isProto3 && syntax !== \"proto2\")\n throw illegal(syntax, \"syntax\");\n\n skip(\";\");\n }\n\n function parseCommon(parent, token) {\n switch (token) {\n\n case \"option\":\n parseOption(parent, token);\n skip(\";\");\n return true;\n\n case \"message\":\n parseType(parent, token);\n return true;\n\n case \"enum\":\n parseEnum(parent, token);\n return true;\n\n case \"service\":\n parseService(parent, token);\n return true;\n\n case \"extend\":\n parseExtension(parent, token);\n return true;\n }\n return false;\n }\n\n function ifBlock(obj, fnIf, fnElse) {\n var trailingLine = tn.line;\n if (obj) {\n if(typeof obj.comment !== \"string\") {\n obj.comment = cmnt(); // try block-type comment\n }\n obj.filename = parse.filename;\n }\n if (skip(\"{\", true)) {\n var token;\n while ((token = next()) !== \"}\")\n fnIf(token);\n skip(\";\", true);\n } else {\n if (fnElse)\n fnElse();\n skip(\";\");\n if (obj && (typeof obj.comment !== \"string\" || preferTrailingComment))\n obj.comment = cmnt(trailingLine) || obj.comment; // try line-type comment\n }\n }\n\n function parseType(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"type name\");\n\n var type = new Type(token);\n ifBlock(type, function parseType_block(token) {\n if (parseCommon(type, token))\n return;\n\n switch (token) {\n\n case \"map\":\n parseMapField(type, token);\n break;\n\n case \"required\":\n case \"repeated\":\n parseField(type, token);\n break;\n\n case \"optional\":\n /* istanbul ignore if */\n if (isProto3) {\n parseField(type, \"proto3_optional\");\n } else {\n parseField(type, \"optional\");\n }\n break;\n\n case \"oneof\":\n parseOneOf(type, token);\n break;\n\n case \"extensions\":\n readRanges(type.extensions || (type.extensions = []));\n break;\n\n case \"reserved\":\n readRanges(type.reserved || (type.reserved = []), true);\n break;\n\n default:\n /* istanbul ignore if */\n if (!isProto3 || !typeRefRe.test(token))\n throw illegal(token);\n\n push(token);\n parseField(type, \"optional\");\n break;\n }\n });\n parent.add(type);\n }\n\n function parseField(parent, rule, extend) {\n var type = next();\n if (type === \"group\") {\n parseGroup(parent, rule);\n return;\n }\n // Type names can consume multiple tokens, in multiple variants:\n // package.subpackage field tokens: \"package.subpackage\" [TYPE NAME ENDS HERE] \"field\"\n // package . subpackage field tokens: \"package\" \".\" \"subpackage\" [TYPE NAME ENDS HERE] \"field\"\n // package. subpackage field tokens: \"package.\" \"subpackage\" [TYPE NAME ENDS HERE] \"field\"\n // package .subpackage field tokens: \"package\" \".subpackage\" [TYPE NAME ENDS HERE] \"field\"\n // Keep reading tokens until we get a type name with no period at the end,\n // and the next token does not start with a period.\n while (type.endsWith(\".\") || peek().startsWith(\".\")) {\n type += next();\n }\n\n /* istanbul ignore if */\n if (!typeRefRe.test(type))\n throw illegal(type, \"type\");\n\n var name = next();\n\n /* istanbul ignore if */\n if (!nameRe.test(name))\n throw illegal(name, \"name\");\n\n name = applyCase(name);\n skip(\"=\");\n\n var field = new Field(name, parseId(next()), type, rule, extend);\n ifBlock(field, function parseField_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(field, token);\n skip(\";\");\n } else\n throw illegal(token);\n\n }, function parseField_line() {\n parseInlineOptions(field);\n });\n\n if (rule === \"proto3_optional\") {\n // for proto3 optional fields, we create a single-member Oneof to mimic \"optional\" behavior\n var oneof = new OneOf(\"_\" + name);\n field.setOption(\"proto3_optional\", true);\n oneof.add(field);\n parent.add(oneof);\n } else {\n parent.add(field);\n }\n\n // JSON defaults to packed=true if not set so we have to set packed=false explicity when\n // parsing proto2 descriptors without the option, where applicable. This must be done for\n // all known packable types and anything that could be an enum (= is not a basic type).\n if (!isProto3 && field.repeated && (types.packed[type] !== undefined || types.basic[type] === undefined))\n field.setOption(\"packed\", false, /* ifNotSet */ true);\n }\n\n function parseGroup(parent, rule) {\n var name = next();\n\n /* istanbul ignore if */\n if (!nameRe.test(name))\n throw illegal(name, \"name\");\n\n var fieldName = util.lcFirst(name);\n if (name === fieldName)\n name = util.ucFirst(name);\n skip(\"=\");\n var id = parseId(next());\n var type = new Type(name);\n type.group = true;\n var field = new Field(fieldName, id, name, rule);\n field.filename = parse.filename;\n ifBlock(type, function parseGroup_block(token) {\n switch (token) {\n\n case \"option\":\n parseOption(type, token);\n skip(\";\");\n break;\n\n case \"required\":\n case \"repeated\":\n parseField(type, token);\n break;\n\n case \"optional\":\n /* istanbul ignore if */\n if (isProto3) {\n parseField(type, \"proto3_optional\");\n } else {\n parseField(type, \"optional\");\n }\n break;\n\n case \"message\":\n parseType(type, token);\n break;\n\n case \"enum\":\n parseEnum(type, token);\n break;\n\n /* istanbul ignore next */\n default:\n throw illegal(token); // there are no groups with proto3 semantics\n }\n });\n parent.add(type)\n .add(field);\n }\n\n function parseMapField(parent) {\n skip(\"<\");\n var keyType = next();\n\n /* istanbul ignore if */\n if (types.mapKey[keyType] === undefined)\n throw illegal(keyType, \"type\");\n\n skip(\",\");\n var valueType = next();\n\n /* istanbul ignore if */\n if (!typeRefRe.test(valueType))\n throw illegal(valueType, \"type\");\n\n skip(\">\");\n var name = next();\n\n /* istanbul ignore if */\n if (!nameRe.test(name))\n throw illegal(name, \"name\");\n\n skip(\"=\");\n var field = new MapField(applyCase(name), parseId(next()), keyType, valueType);\n ifBlock(field, function parseMapField_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(field, token);\n skip(\";\");\n } else\n throw illegal(token);\n\n }, function parseMapField_line() {\n parseInlineOptions(field);\n });\n parent.add(field);\n }\n\n function parseOneOf(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var oneof = new OneOf(applyCase(token));\n ifBlock(oneof, function parseOneOf_block(token) {\n if (token === \"option\") {\n parseOption(oneof, token);\n skip(\";\");\n } else {\n push(token);\n parseField(oneof, \"optional\");\n }\n });\n parent.add(oneof);\n }\n\n function parseEnum(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var enm = new Enum(token);\n ifBlock(enm, function parseEnum_block(token) {\n switch(token) {\n case \"option\":\n parseOption(enm, token);\n skip(\";\");\n break;\n\n case \"reserved\":\n readRanges(enm.reserved || (enm.reserved = []), true);\n break;\n\n default:\n parseEnumValue(enm, token);\n }\n });\n parent.add(enm);\n }\n\n function parseEnumValue(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token))\n throw illegal(token, \"name\");\n\n skip(\"=\");\n var value = parseId(next(), true),\n dummy = {\n options: undefined\n };\n dummy.setOption = function(name, value) {\n if (this.options === undefined)\n this.options = {};\n this.options[name] = value;\n };\n ifBlock(dummy, function parseEnumValue_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(dummy, token); // skip\n skip(\";\");\n } else\n throw illegal(token);\n\n }, function parseEnumValue_line() {\n parseInlineOptions(dummy); // skip\n });\n parent.add(token, value, dummy.comment, dummy.options);\n }\n\n function parseOption(parent, token) {\n var isCustom = skip(\"(\", true);\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var name = token;\n var option = name;\n var propName;\n\n if (isCustom) {\n skip(\")\");\n name = \"(\" + name + \")\";\n option = name;\n token = peek();\n if (fqTypeRefRe.test(token)) {\n propName = token.slice(1); //remove '.' before property name\n name += token;\n next();\n }\n }\n skip(\"=\");\n var optionValue = parseOptionValue(parent, name);\n setParsedOption(parent, option, optionValue, propName);\n }\n\n function parseOptionValue(parent, name) {\n // { a: \"foo\" b { c: \"bar\" } }\n if (skip(\"{\", true)) {\n var objectResult = {};\n\n while (!skip(\"}\", true)) {\n /* istanbul ignore if */\n if (!nameRe.test(token = next())) {\n throw illegal(token, \"name\");\n }\n if (token === null) {\n throw illegal(token, \"end of input\");\n }\n\n var value;\n var propName = token;\n\n skip(\":\", true);\n\n if (peek() === \"{\")\n value = parseOptionValue(parent, name + \".\" + token);\n else if (peek() === \"[\") {\n // option (my_option) = {\n // repeated_value: [ \"foo\", \"bar\" ]\n // };\n value = [];\n var lastValue;\n if (skip(\"[\", true)) {\n do {\n lastValue = readValue(true);\n value.push(lastValue);\n } while (skip(\",\", true));\n skip(\"]\");\n if (typeof lastValue !== \"undefined\") {\n setOption(parent, name + \".\" + token, lastValue);\n }\n }\n } else {\n value = readValue(true);\n setOption(parent, name + \".\" + token, value);\n }\n\n var prevValue = objectResult[propName];\n\n if (prevValue)\n value = [].concat(prevValue).concat(value);\n\n objectResult[propName] = value;\n\n // Semicolons and commas can be optional\n skip(\",\", true);\n skip(\";\", true);\n }\n\n return objectResult;\n }\n\n var simpleValue = readValue(true);\n setOption(parent, name, simpleValue);\n return simpleValue;\n // Does not enforce a delimiter to be universal\n }\n\n function setOption(parent, name, value) {\n if (parent.setOption)\n parent.setOption(name, value);\n }\n\n function setParsedOption(parent, name, value, propName) {\n if (parent.setParsedOption)\n parent.setParsedOption(name, value, propName);\n }\n\n function parseInlineOptions(parent) {\n if (skip(\"[\", true)) {\n do {\n parseOption(parent, \"option\");\n } while (skip(\",\", true));\n skip(\"]\");\n }\n return parent;\n }\n\n function parseService(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"service name\");\n\n var service = new Service(token);\n ifBlock(service, function parseService_block(token) {\n if (parseCommon(service, token))\n return;\n\n /* istanbul ignore else */\n if (token === \"rpc\")\n parseMethod(service, token);\n else\n throw illegal(token);\n });\n parent.add(service);\n }\n\n function parseMethod(parent, token) {\n // Get the comment of the preceding line now (if one exists) in case the\n // method is defined across multiple lines.\n var commentText = cmnt();\n\n var type = token;\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var name = token,\n requestType, requestStream,\n responseType, responseStream;\n\n skip(\"(\");\n if (skip(\"stream\", true))\n requestStream = true;\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token);\n\n requestType = token;\n skip(\")\"); skip(\"returns\"); skip(\"(\");\n if (skip(\"stream\", true))\n responseStream = true;\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token);\n\n responseType = token;\n skip(\")\");\n\n var method = new Method(name, type, requestType, responseType, requestStream, responseStream);\n method.comment = commentText;\n ifBlock(method, function parseMethod_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(method, token);\n skip(\";\");\n } else\n throw illegal(token);\n\n });\n parent.add(method);\n }\n\n function parseExtension(parent, token) {\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token, \"reference\");\n\n var reference = token;\n ifBlock(null, function parseExtension_block(token) {\n switch (token) {\n\n case \"required\":\n case \"repeated\":\n parseField(parent, token, reference);\n break;\n\n case \"optional\":\n /* istanbul ignore if */\n if (isProto3) {\n parseField(parent, \"proto3_optional\", reference);\n } else {\n parseField(parent, \"optional\", reference);\n }\n break;\n\n default:\n /* istanbul ignore if */\n if (!isProto3 || !typeRefRe.test(token))\n throw illegal(token);\n push(token);\n parseField(parent, \"optional\", reference);\n break;\n }\n });\n }\n\n var token;\n while ((token = next()) !== null) {\n switch (token) {\n\n case \"package\":\n\n /* istanbul ignore if */\n if (!head)\n throw illegal(token);\n\n parsePackage();\n break;\n\n case \"import\":\n\n /* istanbul ignore if */\n if (!head)\n throw illegal(token);\n\n parseImport();\n break;\n\n case \"syntax\":\n\n /* istanbul ignore if */\n if (!head)\n throw illegal(token);\n\n parseSyntax();\n break;\n\n case \"option\":\n\n parseOption(ptr, token);\n skip(\";\");\n break;\n\n default:\n\n /* istanbul ignore else */\n if (parseCommon(ptr, token)) {\n head = false;\n continue;\n }\n\n /* istanbul ignore next */\n throw illegal(token);\n }\n }\n\n parse.filename = null;\n return {\n \"package\" : pkg,\n \"imports\" : imports,\n weakImports : weakImports,\n syntax : syntax,\n root : root\n };\n}\n\n/**\n * Parses the given .proto source and returns an object with the parsed contents.\n * @name parse\n * @function\n * @param {string} source Source contents\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {IParserResult} Parser result\n * @property {string} filename=null Currently processing file name for error reporting, if known\n * @property {IParseOptions} defaults Default {@link IParseOptions}\n * @variation 2\n */\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/parse.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/reader.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/reader.js ***!
|
||
\***********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = Reader;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n\n if (start === end) { // fix for IE 10/Win8 and others' subarray returning array of size 1\n var nativeBuffer = util.Buffer;\n return nativeBuffer\n ? nativeBuffer.alloc(0)\n : new this.buf.constructor(0);\n }\n return this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/reader.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/reader_buffer.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/reader_buffer.js ***!
|
||
\******************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = __webpack_require__(/*! ./reader */ \"./node_modules/protobufjs/src/reader.js\");\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/reader_buffer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/root.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/root.js ***!
|
||
\*********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = Root;\n\n// extends Namespace\nvar Namespace = __webpack_require__(/*! ./namespace */ \"./node_modules/protobufjs/src/namespace.js\");\n((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = \"Root\";\n\nvar Field = __webpack_require__(/*! ./field */ \"./node_modules/protobufjs/src/field.js\"),\n Enum = __webpack_require__(/*! ./enum */ \"./node_modules/protobufjs/src/enum.js\"),\n OneOf = __webpack_require__(/*! ./oneof */ \"./node_modules/protobufjs/src/oneof.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\nvar Type, // cyclic\n parse, // might be excluded\n common; // \"\n\n/**\n * Constructs a new root namespace instance.\n * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together.\n * @extends NamespaceBase\n * @constructor\n * @param {Object.<string,*>} [options] Top level options\n */\nfunction Root(options) {\n Namespace.call(this, \"\", options);\n\n /**\n * Deferred extension fields.\n * @type {Field[]}\n */\n this.deferred = [];\n\n /**\n * Resolved file names of loaded files.\n * @type {string[]}\n */\n this.files = [];\n}\n\n/**\n * Loads a namespace descriptor into a root namespace.\n * @param {INamespace} json Nameespace descriptor\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted\n * @returns {Root} Root namespace\n */\nRoot.fromJSON = function fromJSON(json, root) {\n if (!root)\n root = new Root();\n if (json.options)\n root.setOptions(json.options);\n return root.addJSON(json.nested);\n};\n\n/**\n * Resolves the path of an imported file, relative to the importing origin.\n * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories.\n * @function\n * @param {string} origin The file name of the importing file\n * @param {string} target The file name being imported\n * @returns {string|null} Resolved path to `target` or `null` to skip the file\n */\nRoot.prototype.resolvePath = util.path.resolve;\n\n/**\n * Fetch content from file path or url\n * This method exists so you can override it with your own logic.\n * @function\n * @param {string} path File path or url\n * @param {FetchCallback} callback Callback function\n * @returns {undefined}\n */\nRoot.prototype.fetch = util.fetch;\n\n// A symbol-like function to safely signal synchronous loading\n/* istanbul ignore next */\nfunction SYNC() {} // eslint-disable-line no-empty-function\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} options Parse options\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n */\nRoot.prototype.load = function load(filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = undefined;\n }\n var self = this;\n if (!callback)\n return util.asPromise(load, self, filename, options);\n\n var sync = callback === SYNC; // undocumented\n\n // Finishes loading by calling the callback (exactly once)\n function finish(err, root) {\n /* istanbul ignore if */\n if (!callback)\n return;\n if (sync)\n throw err;\n var cb = callback;\n callback = null;\n cb(err, root);\n }\n\n // Bundled definition existence checking\n function getBundledFileName(filename) {\n var idx = filename.lastIndexOf(\"google/protobuf/\");\n if (idx > -1) {\n var altname = filename.substring(idx);\n if (altname in common) return altname;\n }\n return null;\n }\n\n // Processes a single file\n function process(filename, source) {\n try {\n if (util.isString(source) && source.charAt(0) === \"{\")\n source = JSON.parse(source);\n if (!util.isString(source))\n self.setOptions(source.options).addJSON(source.nested);\n else {\n parse.filename = filename;\n var parsed = parse(source, self, options),\n resolved,\n i = 0;\n if (parsed.imports)\n for (; i < parsed.imports.length; ++i)\n if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i]))\n fetch(resolved);\n if (parsed.weakImports)\n for (i = 0; i < parsed.weakImports.length; ++i)\n if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i]))\n fetch(resolved, true);\n }\n } catch (err) {\n finish(err);\n }\n if (!sync && !queued)\n finish(null, self); // only once anyway\n }\n\n // Fetches a single file\n function fetch(filename, weak) {\n filename = getBundledFileName(filename) || filename;\n\n // Skip if already loaded / attempted\n if (self.files.indexOf(filename) > -1)\n return;\n self.files.push(filename);\n\n // Shortcut bundled definitions\n if (filename in common) {\n if (sync)\n process(filename, common[filename]);\n else {\n ++queued;\n setTimeout(function() {\n --queued;\n process(filename, common[filename]);\n });\n }\n return;\n }\n\n // Otherwise fetch from disk or network\n if (sync) {\n var source;\n try {\n source = util.fs.readFileSync(filename).toString(\"utf8\");\n } catch (err) {\n if (!weak)\n finish(err);\n return;\n }\n process(filename, source);\n } else {\n ++queued;\n self.fetch(filename, function(err, source) {\n --queued;\n /* istanbul ignore if */\n if (!callback)\n return; // terminated meanwhile\n if (err) {\n /* istanbul ignore else */\n if (!weak)\n finish(err);\n else if (!queued) // can't be covered reliably\n finish(null, self);\n return;\n }\n process(filename, source);\n });\n }\n }\n var queued = 0;\n\n // Assembling the root namespace doesn't require working type\n // references anymore, so we can load everything in parallel\n if (util.isString(filename))\n filename = [ filename ];\n for (var i = 0, resolved; i < filename.length; ++i)\n if (resolved = self.resolvePath(\"\", filename[i]))\n fetch(resolved);\n\n if (sync)\n return self;\n if (!queued)\n finish(null, self);\n return undefined;\n};\n// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\n * @function Root#load\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @variation 2\n */\n// function load(filename:string, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise.\n * @function Root#load\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {Promise<Root>} Promise\n * @variation 3\n */\n// function load(filename:string, [options:IParseOptions]):Promise<Root>\n\n/**\n * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only).\n * @function Root#loadSync\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {Root} Root namespace\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\n */\nRoot.prototype.loadSync = function loadSync(filename, options) {\n if (!util.isNode)\n throw Error(\"not supported\");\n return this.load(filename, options, SYNC);\n};\n\n/**\n * @override\n */\nRoot.prototype.resolveAll = function resolveAll() {\n if (this.deferred.length)\n throw Error(\"unresolvable extensions: \" + this.deferred.map(function(field) {\n return \"'extend \" + field.extend + \"' in \" + field.parent.fullName;\n }).join(\", \"));\n return Namespace.prototype.resolveAll.call(this);\n};\n\n// only uppercased (and thus conflict-free) children are exposed, see below\nvar exposeRe = /^[A-Z]/;\n\n/**\n * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type.\n * @param {Root} root Root instance\n * @param {Field} field Declaring extension field witin the declaring type\n * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise\n * @inner\n * @ignore\n */\nfunction tryHandleExtension(root, field) {\n var extendedType = field.parent.lookup(field.extend);\n if (extendedType) {\n var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options);\n //do not allow to extend same field twice to prevent the error\n if (extendedType.get(sisterField.name)) {\n return true;\n }\n sisterField.declaringField = field;\n field.extensionField = sisterField;\n extendedType.add(sisterField);\n return true;\n }\n return false;\n}\n\n/**\n * Called when any object is added to this root or its sub-namespaces.\n * @param {ReflectionObject} object Object added\n * @returns {undefined}\n * @private\n */\nRoot.prototype._handleAdd = function _handleAdd(object) {\n if (object instanceof Field) {\n\n if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField)\n if (!tryHandleExtension(this, object))\n this.deferred.push(object);\n\n } else if (object instanceof Enum) {\n\n if (exposeRe.test(object.name))\n object.parent[object.name] = object.values; // expose enum values as property of its parent\n\n } else if (!(object instanceof OneOf)) /* everything else is a namespace */ {\n\n if (object instanceof Type) // Try to handle any deferred extensions\n for (var i = 0; i < this.deferred.length;)\n if (tryHandleExtension(this, this.deferred[i]))\n this.deferred.splice(i, 1);\n else\n ++i;\n for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace\n this._handleAdd(object._nestedArray[j]);\n if (exposeRe.test(object.name))\n object.parent[object.name] = object; // expose namespace as property of its parent\n }\n\n // The above also adds uppercased (and thus conflict-free) nested types, services and enums as\n // properties of namespaces just like static code does. This allows using a .d.ts generated for\n // a static module with reflection-based solutions where the condition is met.\n};\n\n/**\n * Called when any object is removed from this root or its sub-namespaces.\n * @param {ReflectionObject} object Object removed\n * @returns {undefined}\n * @private\n */\nRoot.prototype._handleRemove = function _handleRemove(object) {\n if (object instanceof Field) {\n\n if (/* an extension field */ object.extend !== undefined) {\n if (/* already handled */ object.extensionField) { // remove its sister field\n object.extensionField.parent.remove(object.extensionField);\n object.extensionField = null;\n } else { // cancel the extension\n var index = this.deferred.indexOf(object);\n /* istanbul ignore else */\n if (index > -1)\n this.deferred.splice(index, 1);\n }\n }\n\n } else if (object instanceof Enum) {\n\n if (exposeRe.test(object.name))\n delete object.parent[object.name]; // unexpose enum values\n\n } else if (object instanceof Namespace) {\n\n for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace\n this._handleRemove(object._nestedArray[i]);\n\n if (exposeRe.test(object.name))\n delete object.parent[object.name]; // unexpose namespaces\n\n }\n};\n\n// Sets up cyclic dependencies (called in index-light)\nRoot._configure = function(Type_, parse_, common_) {\n Type = Type_;\n parse = parse_;\n common = common_;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/root.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/roots.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/roots.js ***!
|
||
\**********************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available across modules.\n * @name roots\n * @type {Object.<string,Root>}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/roots.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/rpc.js":
|
||
/*!********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/rpc.js ***!
|
||
\********************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod<Message<{}>,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = __webpack_require__(/*! ./rpc/service */ \"./node_modules/protobufjs/src/rpc/service.js\");\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/rpc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/rpc/service.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/rpc/service.js ***!
|
||
\****************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = Service;\n\nvar util = __webpack_require__(/*! ../util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message<TRes>\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message<TReq>\n * @template TRes extends Message<TRes>\n * @type {function}\n * @param {TReq|Properties<TReq>} request Request message or plain object\n * @param {rpc.ServiceMethodCallback<TRes>} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise<Message<TRes>>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod<TReq,TRes>} method Reflected or static method\n * @param {Constructor<TReq>} requestCtor Request constructor\n * @param {Constructor<TRes>} responseCtor Response constructor\n * @param {TReq|Properties<TReq>} request Request message or plain object\n * @param {rpc.ServiceMethodCallback<TRes>} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message<TReq>\n * @template TRes extends Message<TRes>\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/rpc/service.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/service.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/service.js ***!
|
||
\************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = Service;\n\n// extends Namespace\nvar Namespace = __webpack_require__(/*! ./namespace */ \"./node_modules/protobufjs/src/namespace.js\");\n((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = \"Service\";\n\nvar Method = __webpack_require__(/*! ./method */ \"./node_modules/protobufjs/src/method.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\"),\n rpc = __webpack_require__(/*! ./rpc */ \"./node_modules/protobufjs/src/rpc.js\");\n\n/**\n * Constructs a new service instance.\n * @classdesc Reflected service.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Service name\n * @param {Object.<string,*>} [options] Service options\n * @throws {TypeError} If arguments are invalid\n */\nfunction Service(name, options) {\n Namespace.call(this, name, options);\n\n /**\n * Service methods.\n * @type {Object.<string,Method>}\n */\n this.methods = {}; // toJSON, marker\n\n /**\n * Cached methods as an array.\n * @type {Method[]|null}\n * @private\n */\n this._methodsArray = null;\n}\n\n/**\n * Service descriptor.\n * @interface IService\n * @extends INamespace\n * @property {Object.<string,IMethod>} methods Method descriptors\n */\n\n/**\n * Constructs a service from a service descriptor.\n * @param {string} name Service name\n * @param {IService} json Service descriptor\n * @returns {Service} Created service\n * @throws {TypeError} If arguments are invalid\n */\nService.fromJSON = function fromJSON(name, json) {\n var service = new Service(name, json.options);\n /* istanbul ignore else */\n if (json.methods)\n for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i)\n service.add(Method.fromJSON(names[i], json.methods[names[i]]));\n if (json.nested)\n service.addJSON(json.nested);\n service.comment = json.comment;\n return service;\n};\n\n/**\n * Converts this service to a service descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IService} Service descriptor\n */\nService.prototype.toJSON = function toJSON(toJSONOptions) {\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , inherited && inherited.options || undefined,\n \"methods\" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {},\n \"nested\" , inherited && inherited.nested || undefined,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Methods of this service as an array for iteration.\n * @name Service#methodsArray\n * @type {Method[]}\n * @readonly\n */\nObject.defineProperty(Service.prototype, \"methodsArray\", {\n get: function() {\n return this._methodsArray || (this._methodsArray = util.toArray(this.methods));\n }\n});\n\nfunction clearCache(service) {\n service._methodsArray = null;\n return service;\n}\n\n/**\n * @override\n */\nService.prototype.get = function get(name) {\n return this.methods[name]\n || Namespace.prototype.get.call(this, name);\n};\n\n/**\n * @override\n */\nService.prototype.resolveAll = function resolveAll() {\n var methods = this.methodsArray;\n for (var i = 0; i < methods.length; ++i)\n methods[i].resolve();\n return Namespace.prototype.resolve.call(this);\n};\n\n/**\n * @override\n */\nService.prototype.add = function add(object) {\n\n /* istanbul ignore if */\n if (this.get(object.name))\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n\n if (object instanceof Method) {\n this.methods[object.name] = object;\n object.parent = this;\n return clearCache(this);\n }\n return Namespace.prototype.add.call(this, object);\n};\n\n/**\n * @override\n */\nService.prototype.remove = function remove(object) {\n if (object instanceof Method) {\n\n /* istanbul ignore if */\n if (this.methods[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.methods[object.name];\n object.parent = null;\n return clearCache(this);\n }\n return Namespace.prototype.remove.call(this, object);\n};\n\n/**\n * Creates a runtime service using the specified rpc implementation.\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed.\n */\nService.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) {\n var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);\n for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {\n var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\\w_]/g, \"\");\n rpcService[methodName] = util.codegen([\"r\",\"c\"], util.isReserved(methodName) ? methodName + \"_\" : methodName)(\"return this.rpcCall(m,q,s,r,c)\")({\n m: method,\n q: method.resolvedRequestType.ctor,\n s: method.resolvedResponseType.ctor\n });\n }\n return rpcService;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/service.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/tokenize.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/tokenize.js ***!
|
||
\*************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = tokenize;\n\nvar delimRe = /[\\s{}=;:[\\],'\"()<>]/g,\n stringDoubleRe = /(?:\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\")/g,\n stringSingleRe = /(?:'([^'\\\\]*(?:\\\\.[^'\\\\]*)*)')/g;\n\nvar setCommentRe = /^ *[*/]+ */,\n setCommentAltRe = /^\\s*\\*?\\/*/,\n setCommentSplitRe = /\\n/g,\n whitespaceRe = /\\s/,\n unescapeRe = /\\\\(.?)/g;\n\nvar unescapeMap = {\n \"0\": \"\\0\",\n \"r\": \"\\r\",\n \"n\": \"\\n\",\n \"t\": \"\\t\"\n};\n\n/**\n * Unescapes a string.\n * @param {string} str String to unescape\n * @returns {string} Unescaped string\n * @property {Object.<string,string>} map Special characters map\n * @memberof tokenize\n */\nfunction unescape(str) {\n return str.replace(unescapeRe, function($0, $1) {\n switch ($1) {\n case \"\\\\\":\n case \"\":\n return $1;\n default:\n return unescapeMap[$1] || \"\";\n }\n });\n}\n\ntokenize.unescape = unescape;\n\n/**\n * Gets the next token and advances.\n * @typedef TokenizerHandleNext\n * @type {function}\n * @returns {string|null} Next token or `null` on eof\n */\n\n/**\n * Peeks for the next token.\n * @typedef TokenizerHandlePeek\n * @type {function}\n * @returns {string|null} Next token or `null` on eof\n */\n\n/**\n * Pushes a token back to the stack.\n * @typedef TokenizerHandlePush\n * @type {function}\n * @param {string} token Token\n * @returns {undefined}\n */\n\n/**\n * Skips the next token.\n * @typedef TokenizerHandleSkip\n * @type {function}\n * @param {string} expected Expected token\n * @param {boolean} [optional=false] If optional\n * @returns {boolean} Whether the token matched\n * @throws {Error} If the token didn't match and is not optional\n */\n\n/**\n * Gets the comment on the previous line or, alternatively, the line comment on the specified line.\n * @typedef TokenizerHandleCmnt\n * @type {function}\n * @param {number} [line] Line number\n * @returns {string|null} Comment text or `null` if none\n */\n\n/**\n * Handle object returned from {@link tokenize}.\n * @interface ITokenizerHandle\n * @property {TokenizerHandleNext} next Gets the next token and advances (`null` on eof)\n * @property {TokenizerHandlePeek} peek Peeks for the next token (`null` on eof)\n * @property {TokenizerHandlePush} push Pushes a token back to the stack\n * @property {TokenizerHandleSkip} skip Skips a token, returns its presence and advances or, if non-optional and not present, throws\n * @property {TokenizerHandleCmnt} cmnt Gets the comment on the previous line or the line comment on the specified line, if any\n * @property {number} line Current line number\n */\n\n/**\n * Tokenizes the given .proto source and returns an object with useful utility functions.\n * @param {string} source Source contents\n * @param {boolean} alternateCommentMode Whether we should activate alternate comment parsing mode.\n * @returns {ITokenizerHandle} Tokenizer handle\n */\nfunction tokenize(source, alternateCommentMode) {\n /* eslint-disable callback-return */\n source = source.toString();\n\n var offset = 0,\n length = source.length,\n line = 1,\n lastCommentLine = 0,\n comments = {};\n\n var stack = [];\n\n var stringDelim = null;\n\n /* istanbul ignore next */\n /**\n * Creates an error for illegal syntax.\n * @param {string} subject Subject\n * @returns {Error} Error created\n * @inner\n */\n function illegal(subject) {\n return Error(\"illegal \" + subject + \" (line \" + line + \")\");\n }\n\n /**\n * Reads a string till its end.\n * @returns {string} String read\n * @inner\n */\n function readString() {\n var re = stringDelim === \"'\" ? stringSingleRe : stringDoubleRe;\n re.lastIndex = offset - 1;\n var match = re.exec(source);\n if (!match)\n throw illegal(\"string\");\n offset = re.lastIndex;\n push(stringDelim);\n stringDelim = null;\n return unescape(match[1]);\n }\n\n /**\n * Gets the character at `pos` within the source.\n * @param {number} pos Position\n * @returns {string} Character\n * @inner\n */\n function charAt(pos) {\n return source.charAt(pos);\n }\n\n /**\n * Sets the current comment text.\n * @param {number} start Start offset\n * @param {number} end End offset\n * @param {boolean} isLeading set if a leading comment\n * @returns {undefined}\n * @inner\n */\n function setComment(start, end, isLeading) {\n var comment = {\n type: source.charAt(start++),\n lineEmpty: false,\n leading: isLeading,\n };\n var lookback;\n if (alternateCommentMode) {\n lookback = 2; // alternate comment parsing: \"//\" or \"/*\"\n } else {\n lookback = 3; // \"///\" or \"/**\"\n }\n var commentOffset = start - lookback,\n c;\n do {\n if (--commentOffset < 0 ||\n (c = source.charAt(commentOffset)) === \"\\n\") {\n comment.lineEmpty = true;\n break;\n }\n } while (c === \" \" || c === \"\\t\");\n var lines = source\n .substring(start, end)\n .split(setCommentSplitRe);\n for (var i = 0; i < lines.length; ++i)\n lines[i] = lines[i]\n .replace(alternateCommentMode ? setCommentAltRe : setCommentRe, \"\")\n .trim();\n comment.text = lines\n .join(\"\\n\")\n .trim();\n\n comments[line] = comment;\n lastCommentLine = line;\n }\n\n function isDoubleSlashCommentLine(startOffset) {\n var endOffset = findEndOfLine(startOffset);\n\n // see if remaining line matches comment pattern\n var lineText = source.substring(startOffset, endOffset);\n var isComment = /^\\s*\\/\\//.test(lineText);\n return isComment;\n }\n\n function findEndOfLine(cursor) {\n // find end of cursor's line\n var endOffset = cursor;\n while (endOffset < length && charAt(endOffset) !== \"\\n\") {\n endOffset++;\n }\n return endOffset;\n }\n\n /**\n * Obtains the next token.\n * @returns {string|null} Next token or `null` on eof\n * @inner\n */\n function next() {\n if (stack.length > 0)\n return stack.shift();\n if (stringDelim)\n return readString();\n var repeat,\n prev,\n curr,\n start,\n isDoc,\n isLeadingComment = offset === 0;\n do {\n if (offset === length)\n return null;\n repeat = false;\n while (whitespaceRe.test(curr = charAt(offset))) {\n if (curr === \"\\n\") {\n isLeadingComment = true;\n ++line;\n }\n if (++offset === length)\n return null;\n }\n\n if (charAt(offset) === \"/\") {\n if (++offset === length) {\n throw illegal(\"comment\");\n }\n if (charAt(offset) === \"/\") { // Line\n if (!alternateCommentMode) {\n // check for triple-slash comment\n isDoc = charAt(start = offset + 1) === \"/\";\n\n while (charAt(++offset) !== \"\\n\") {\n if (offset === length) {\n return null;\n }\n }\n ++offset;\n if (isDoc) {\n setComment(start, offset - 1, isLeadingComment);\n // Trailing comment cannot not be multi-line,\n // so leading comment state should be reset to handle potential next comments\n isLeadingComment = true;\n }\n ++line;\n repeat = true;\n } else {\n // check for double-slash comments, consolidating consecutive lines\n start = offset;\n isDoc = false;\n if (isDoubleSlashCommentLine(offset - 1)) {\n isDoc = true;\n do {\n offset = findEndOfLine(offset);\n if (offset === length) {\n break;\n }\n offset++;\n if (!isLeadingComment) {\n // Trailing comment cannot not be multi-line\n break;\n }\n } while (isDoubleSlashCommentLine(offset));\n } else {\n offset = Math.min(length, findEndOfLine(offset) + 1);\n }\n if (isDoc) {\n setComment(start, offset, isLeadingComment);\n isLeadingComment = true;\n }\n line++;\n repeat = true;\n }\n } else if ((curr = charAt(offset)) === \"*\") { /* Block */\n // check for /** (regular comment mode) or /* (alternate comment mode)\n start = offset + 1;\n isDoc = alternateCommentMode || charAt(start) === \"*\";\n do {\n if (curr === \"\\n\") {\n ++line;\n }\n if (++offset === length) {\n throw illegal(\"comment\");\n }\n prev = curr;\n curr = charAt(offset);\n } while (prev !== \"*\" || curr !== \"/\");\n ++offset;\n if (isDoc) {\n setComment(start, offset - 2, isLeadingComment);\n isLeadingComment = true;\n }\n repeat = true;\n } else {\n return \"/\";\n }\n }\n } while (repeat);\n\n // offset !== length if we got here\n\n var end = offset;\n delimRe.lastIndex = 0;\n var delim = delimRe.test(charAt(end++));\n if (!delim)\n while (end < length && !delimRe.test(charAt(end)))\n ++end;\n var token = source.substring(offset, offset = end);\n if (token === \"\\\"\" || token === \"'\")\n stringDelim = token;\n return token;\n }\n\n /**\n * Pushes a token back to the stack.\n * @param {string} token Token\n * @returns {undefined}\n * @inner\n */\n function push(token) {\n stack.push(token);\n }\n\n /**\n * Peeks for the next token.\n * @returns {string|null} Token or `null` on eof\n * @inner\n */\n function peek() {\n if (!stack.length) {\n var token = next();\n if (token === null)\n return null;\n push(token);\n }\n return stack[0];\n }\n\n /**\n * Skips a token.\n * @param {string} expected Expected token\n * @param {boolean} [optional=false] Whether the token is optional\n * @returns {boolean} `true` when skipped, `false` if not\n * @throws {Error} When a required token is not present\n * @inner\n */\n function skip(expected, optional) {\n var actual = peek(),\n equals = actual === expected;\n if (equals) {\n next();\n return true;\n }\n if (!optional)\n throw illegal(\"token '\" + actual + \"', '\" + expected + \"' expected\");\n return false;\n }\n\n /**\n * Gets a comment.\n * @param {number} [trailingLine] Line number if looking for a trailing comment\n * @returns {string|null} Comment text\n * @inner\n */\n function cmnt(trailingLine) {\n var ret = null;\n var comment;\n if (trailingLine === undefined) {\n comment = comments[line - 1];\n delete comments[line - 1];\n if (comment && (alternateCommentMode || comment.type === \"*\" || comment.lineEmpty)) {\n ret = comment.leading ? comment.text : null;\n }\n } else {\n /* istanbul ignore else */\n if (lastCommentLine < trailingLine) {\n peek();\n }\n comment = comments[trailingLine];\n delete comments[trailingLine];\n if (comment && !comment.lineEmpty && (alternateCommentMode || comment.type === \"/\")) {\n ret = comment.leading ? null : comment.text;\n }\n }\n return ret;\n }\n\n return Object.defineProperty({\n next: next,\n peek: peek,\n push: push,\n skip: skip,\n cmnt: cmnt\n }, \"line\", {\n get: function() { return line; }\n });\n /* eslint-enable callback-return */\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/tokenize.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/type.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/type.js ***!
|
||
\*********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = Type;\n\n// extends Namespace\nvar Namespace = __webpack_require__(/*! ./namespace */ \"./node_modules/protobufjs/src/namespace.js\");\n((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = \"Type\";\n\nvar Enum = __webpack_require__(/*! ./enum */ \"./node_modules/protobufjs/src/enum.js\"),\n OneOf = __webpack_require__(/*! ./oneof */ \"./node_modules/protobufjs/src/oneof.js\"),\n Field = __webpack_require__(/*! ./field */ \"./node_modules/protobufjs/src/field.js\"),\n MapField = __webpack_require__(/*! ./mapfield */ \"./node_modules/protobufjs/src/mapfield.js\"),\n Service = __webpack_require__(/*! ./service */ \"./node_modules/protobufjs/src/service.js\"),\n Message = __webpack_require__(/*! ./message */ \"./node_modules/protobufjs/src/message.js\"),\n Reader = __webpack_require__(/*! ./reader */ \"./node_modules/protobufjs/src/reader.js\"),\n Writer = __webpack_require__(/*! ./writer */ \"./node_modules/protobufjs/src/writer.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\"),\n encoder = __webpack_require__(/*! ./encoder */ \"./node_modules/protobufjs/src/encoder.js\"),\n decoder = __webpack_require__(/*! ./decoder */ \"./node_modules/protobufjs/src/decoder.js\"),\n verifier = __webpack_require__(/*! ./verifier */ \"./node_modules/protobufjs/src/verifier.js\"),\n converter = __webpack_require__(/*! ./converter */ \"./node_modules/protobufjs/src/converter.js\"),\n wrappers = __webpack_require__(/*! ./wrappers */ \"./node_modules/protobufjs/src/wrappers.js\");\n\n/**\n * Constructs a new reflected message type instance.\n * @classdesc Reflected message type.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Message name\n * @param {Object.<string,*>} [options] Declared options\n */\nfunction Type(name, options) {\n Namespace.call(this, name, options);\n\n /**\n * Message fields.\n * @type {Object.<string,Field>}\n */\n this.fields = {}; // toJSON, marker\n\n /**\n * Oneofs declared within this namespace, if any.\n * @type {Object.<string,OneOf>}\n */\n this.oneofs = undefined; // toJSON\n\n /**\n * Extension ranges, if any.\n * @type {number[][]}\n */\n this.extensions = undefined; // toJSON\n\n /**\n * Reserved ranges, if any.\n * @type {Array.<number[]|string>}\n */\n this.reserved = undefined; // toJSON\n\n /*?\n * Whether this type is a legacy group.\n * @type {boolean|undefined}\n */\n this.group = undefined; // toJSON\n\n /**\n * Cached fields by id.\n * @type {Object.<number,Field>|null}\n * @private\n */\n this._fieldsById = null;\n\n /**\n * Cached fields as an array.\n * @type {Field[]|null}\n * @private\n */\n this._fieldsArray = null;\n\n /**\n * Cached oneofs as an array.\n * @type {OneOf[]|null}\n * @private\n */\n this._oneofsArray = null;\n\n /**\n * Cached constructor.\n * @type {Constructor<{}>}\n * @private\n */\n this._ctor = null;\n}\n\nObject.defineProperties(Type.prototype, {\n\n /**\n * Message fields by id.\n * @name Type#fieldsById\n * @type {Object.<number,Field>}\n * @readonly\n */\n fieldsById: {\n get: function() {\n\n /* istanbul ignore if */\n if (this._fieldsById)\n return this._fieldsById;\n\n this._fieldsById = {};\n for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) {\n var field = this.fields[names[i]],\n id = field.id;\n\n /* istanbul ignore if */\n if (this._fieldsById[id])\n throw Error(\"duplicate id \" + id + \" in \" + this);\n\n this._fieldsById[id] = field;\n }\n return this._fieldsById;\n }\n },\n\n /**\n * Fields of this message as an array for iteration.\n * @name Type#fieldsArray\n * @type {Field[]}\n * @readonly\n */\n fieldsArray: {\n get: function() {\n return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields));\n }\n },\n\n /**\n * Oneofs of this message as an array for iteration.\n * @name Type#oneofsArray\n * @type {OneOf[]}\n * @readonly\n */\n oneofsArray: {\n get: function() {\n return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs));\n }\n },\n\n /**\n * The registered constructor, if any registered, otherwise a generic constructor.\n * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.\n * @name Type#ctor\n * @type {Constructor<{}>}\n */\n ctor: {\n get: function() {\n return this._ctor || (this.ctor = Type.generateConstructor(this)());\n },\n set: function(ctor) {\n\n // Ensure proper prototype\n var prototype = ctor.prototype;\n if (!(prototype instanceof Message)) {\n (ctor.prototype = new Message()).constructor = ctor;\n util.merge(ctor.prototype, prototype);\n }\n\n // Classes and messages reference their reflected type\n ctor.$type = ctor.prototype.$type = this;\n\n // Mix in static methods\n util.merge(ctor, Message, true);\n\n this._ctor = ctor;\n\n // Messages have non-enumerable default values on their prototype\n var i = 0;\n for (; i < /* initializes */ this.fieldsArray.length; ++i)\n this._fieldsArray[i].resolve(); // ensures a proper value\n\n // Messages have non-enumerable getters and setters for each virtual oneof field\n var ctorProperties = {};\n for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i)\n ctorProperties[this._oneofsArray[i].resolve().name] = {\n get: util.oneOfGetter(this._oneofsArray[i].oneof),\n set: util.oneOfSetter(this._oneofsArray[i].oneof)\n };\n if (i)\n Object.defineProperties(ctor.prototype, ctorProperties);\n }\n }\n});\n\n/**\n * Generates a constructor function for the specified type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nType.generateConstructor = function generateConstructor(mtype) {\n /* eslint-disable no-unexpected-multiline */\n var gen = util.codegen([\"p\"], mtype.name);\n // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype\n for (var i = 0, field; i < mtype.fieldsArray.length; ++i)\n if ((field = mtype._fieldsArray[i]).map) gen\n (\"this%s={}\", util.safeProp(field.name));\n else if (field.repeated) gen\n (\"this%s=[]\", util.safeProp(field.name));\n return gen\n (\"if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)\") // omit undefined or null\n (\"this[ks[i]]=p[ks[i]]\");\n /* eslint-enable no-unexpected-multiline */\n};\n\nfunction clearCache(type) {\n type._fieldsById = type._fieldsArray = type._oneofsArray = null;\n delete type.encode;\n delete type.decode;\n delete type.verify;\n return type;\n}\n\n/**\n * Message type descriptor.\n * @interface IType\n * @extends INamespace\n * @property {Object.<string,IOneOf>} [oneofs] Oneof descriptors\n * @property {Object.<string,IField>} fields Field descriptors\n * @property {number[][]} [extensions] Extension ranges\n * @property {number[][]} [reserved] Reserved ranges\n * @property {boolean} [group=false] Whether a legacy group or not\n */\n\n/**\n * Creates a message type from a message type descriptor.\n * @param {string} name Message name\n * @param {IType} json Message type descriptor\n * @returns {Type} Created message type\n */\nType.fromJSON = function fromJSON(name, json) {\n var type = new Type(name, json.options);\n type.extensions = json.extensions;\n type.reserved = json.reserved;\n var names = Object.keys(json.fields),\n i = 0;\n for (; i < names.length; ++i)\n type.add(\n ( typeof json.fields[names[i]].keyType !== \"undefined\"\n ? MapField.fromJSON\n : Field.fromJSON )(names[i], json.fields[names[i]])\n );\n if (json.oneofs)\n for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i)\n type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]]));\n if (json.nested)\n for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) {\n var nested = json.nested[names[i]];\n type.add( // most to least likely\n ( nested.id !== undefined\n ? Field.fromJSON\n : nested.fields !== undefined\n ? Type.fromJSON\n : nested.values !== undefined\n ? Enum.fromJSON\n : nested.methods !== undefined\n ? Service.fromJSON\n : Namespace.fromJSON )(names[i], nested)\n );\n }\n if (json.extensions && json.extensions.length)\n type.extensions = json.extensions;\n if (json.reserved && json.reserved.length)\n type.reserved = json.reserved;\n if (json.group)\n type.group = true;\n if (json.comment)\n type.comment = json.comment;\n return type;\n};\n\n/**\n * Converts this message type to a message type descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IType} Message type descriptor\n */\nType.prototype.toJSON = function toJSON(toJSONOptions) {\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , inherited && inherited.options || undefined,\n \"oneofs\" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions),\n \"fields\" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {},\n \"extensions\" , this.extensions && this.extensions.length ? this.extensions : undefined,\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\n \"group\" , this.group || undefined,\n \"nested\" , inherited && inherited.nested || undefined,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nType.prototype.resolveAll = function resolveAll() {\n var fields = this.fieldsArray, i = 0;\n while (i < fields.length)\n fields[i++].resolve();\n var oneofs = this.oneofsArray; i = 0;\n while (i < oneofs.length)\n oneofs[i++].resolve();\n return Namespace.prototype.resolveAll.call(this);\n};\n\n/**\n * @override\n */\nType.prototype.get = function get(name) {\n return this.fields[name]\n || this.oneofs && this.oneofs[name]\n || this.nested && this.nested[name]\n || null;\n};\n\n/**\n * Adds a nested object to this type.\n * @param {ReflectionObject} object Nested object to add\n * @returns {Type} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id\n */\nType.prototype.add = function add(object) {\n\n if (this.get(object.name))\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n\n if (object instanceof Field && object.extend === undefined) {\n // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects.\n // The root object takes care of adding distinct sister-fields to the respective extended\n // type instead.\n\n // avoids calling the getter if not absolutely necessary because it's called quite frequently\n if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id])\n throw Error(\"duplicate id \" + object.id + \" in \" + this);\n if (this.isReservedId(object.id))\n throw Error(\"id \" + object.id + \" is reserved in \" + this);\n if (this.isReservedName(object.name))\n throw Error(\"name '\" + object.name + \"' is reserved in \" + this);\n\n if (object.parent)\n object.parent.remove(object);\n this.fields[object.name] = object;\n object.message = this;\n object.onAdd(this);\n return clearCache(this);\n }\n if (object instanceof OneOf) {\n if (!this.oneofs)\n this.oneofs = {};\n this.oneofs[object.name] = object;\n object.onAdd(this);\n return clearCache(this);\n }\n return Namespace.prototype.add.call(this, object);\n};\n\n/**\n * Removes a nested object from this type.\n * @param {ReflectionObject} object Nested object to remove\n * @returns {Type} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `object` is not a member of this type\n */\nType.prototype.remove = function remove(object) {\n if (object instanceof Field && object.extend === undefined) {\n // See Type#add for the reason why extension fields are excluded here.\n\n /* istanbul ignore if */\n if (!this.fields || this.fields[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.fields[object.name];\n object.parent = null;\n object.onRemove(this);\n return clearCache(this);\n }\n if (object instanceof OneOf) {\n\n /* istanbul ignore if */\n if (!this.oneofs || this.oneofs[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.oneofs[object.name];\n object.parent = null;\n object.onRemove(this);\n return clearCache(this);\n }\n return Namespace.prototype.remove.call(this, object);\n};\n\n/**\n * Tests if the specified id is reserved.\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nType.prototype.isReservedId = function isReservedId(id) {\n return Namespace.isReservedId(this.reserved, id);\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nType.prototype.isReservedName = function isReservedName(name) {\n return Namespace.isReservedName(this.reserved, name);\n};\n\n/**\n * Creates a new message of this type using the specified properties.\n * @param {Object.<string,*>} [properties] Properties to set\n * @returns {Message<{}>} Message instance\n */\nType.prototype.create = function create(properties) {\n return new this.ctor(properties);\n};\n\n/**\n * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}.\n * @returns {Type} `this`\n */\nType.prototype.setup = function setup() {\n // Sets up everything at once so that the prototype chain does not have to be re-evaluated\n // multiple times (V8, soft-deopt prototype-check).\n\n var fullName = this.fullName,\n types = [];\n for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i)\n types.push(this._fieldsArray[i].resolve().resolvedType);\n\n // Replace setup methods with type-specific generated functions\n this.encode = encoder(this)({\n Writer : Writer,\n types : types,\n util : util\n });\n this.decode = decoder(this)({\n Reader : Reader,\n types : types,\n util : util\n });\n this.verify = verifier(this)({\n types : types,\n util : util\n });\n this.fromObject = converter.fromObject(this)({\n types : types,\n util : util\n });\n this.toObject = converter.toObject(this)({\n types : types,\n util : util\n });\n\n // Inject custom wrappers for common types\n var wrapper = wrappers[fullName];\n if (wrapper) {\n var originalThis = Object.create(this);\n // if (wrapper.fromObject) {\n originalThis.fromObject = this.fromObject;\n this.fromObject = wrapper.fromObject.bind(originalThis);\n // }\n // if (wrapper.toObject) {\n originalThis.toObject = this.toObject;\n this.toObject = wrapper.toObject.bind(originalThis);\n // }\n }\n\n return this;\n};\n\n/**\n * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages.\n * @param {Message<{}>|Object.<string,*>} message Message instance or plain object\n * @param {Writer} [writer] Writer to encode to\n * @returns {Writer} writer\n */\nType.prototype.encode = function encode_setup(message, writer) {\n return this.setup().encode(message, writer); // overrides this method\n};\n\n/**\n * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages.\n * @param {Message<{}>|Object.<string,*>} message Message instance or plain object\n * @param {Writer} [writer] Writer to encode to\n * @returns {Writer} writer\n */\nType.prototype.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();\n};\n\n/**\n * Decodes a message of this type.\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Length of the message, if known beforehand\n * @returns {Message<{}>} Decoded message\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {util.ProtocolError<{}>} If required fields are missing\n */\nType.prototype.decode = function decode_setup(reader, length) {\n return this.setup().decode(reader, length); // overrides this method\n};\n\n/**\n * Decodes a message of this type preceeded by its byte length as a varint.\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {Message<{}>} Decoded message\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {util.ProtocolError} If required fields are missing\n */\nType.prototype.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof Reader))\n reader = Reader.create(reader);\n return this.decode(reader, reader.uint32());\n};\n\n/**\n * Verifies that field values are valid and that required fields are present.\n * @param {Object.<string,*>} message Plain object to verify\n * @returns {null|string} `null` if valid, otherwise the reason why it is not\n */\nType.prototype.verify = function verify_setup(message) {\n return this.setup().verify(message); // overrides this method\n};\n\n/**\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\n * @param {Object.<string,*>} object Plain object to convert\n * @returns {Message<{}>} Message instance\n */\nType.prototype.fromObject = function fromObject(object) {\n return this.setup().fromObject(object);\n};\n\n/**\n * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}.\n * @interface IConversionOptions\n * @property {Function} [longs] Long conversion type.\n * Valid values are `String` and `Number` (the global types).\n * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library.\n * @property {Function} [enums] Enum value conversion type.\n * Only valid value is `String` (the global type).\n * Defaults to copy the present value, which is the numeric id.\n * @property {Function} [bytes] Bytes value conversion type.\n * Valid values are `Array` and (a base64 encoded) `String` (the global types).\n * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser.\n * @property {boolean} [defaults=false] Also sets default values on the resulting object\n * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false`\n * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false`\n * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any\n * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings\n */\n\n/**\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\n * @param {Message<{}>} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.<string,*>} Plain object\n */\nType.prototype.toObject = function toObject(message, options) {\n return this.setup().toObject(message, options);\n};\n\n/**\n * Decorator function as returned by {@link Type.d} (TypeScript).\n * @typedef TypeDecorator\n * @type {function}\n * @param {Constructor<T>} target Target constructor\n * @returns {undefined}\n * @template T extends Message<T>\n */\n\n/**\n * Type decorator (TypeScript).\n * @param {string} [typeName] Type name, defaults to the constructor's name\n * @returns {TypeDecorator<T>} Decorator function\n * @template T extends Message<T>\n */\nType.d = function decorateType(typeName) {\n return function typeDecorator(target) {\n util.decorateType(target, typeName);\n };\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/type.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/types.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/types.js ***!
|
||
\**********************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\n/**\n * Common type constants.\n * @namespace\n */\nvar types = exports;\n\nvar util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\nvar s = [\n \"double\", // 0\n \"float\", // 1\n \"int32\", // 2\n \"uint32\", // 3\n \"sint32\", // 4\n \"fixed32\", // 5\n \"sfixed32\", // 6\n \"int64\", // 7\n \"uint64\", // 8\n \"sint64\", // 9\n \"fixed64\", // 10\n \"sfixed64\", // 11\n \"bool\", // 12\n \"string\", // 13\n \"bytes\" // 14\n];\n\nfunction bake(values, offset) {\n var i = 0, o = {};\n offset |= 0;\n while (i < values.length) o[s[i + offset]] = values[i++];\n return o;\n}\n\n/**\n * Basic type wire types.\n * @type {Object.<string,number>}\n * @const\n * @property {number} double=1 Fixed64 wire type\n * @property {number} float=5 Fixed32 wire type\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n * @property {number} string=2 Ldelim wire type\n * @property {number} bytes=2 Ldelim wire type\n */\ntypes.basic = bake([\n /* double */ 1,\n /* float */ 5,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0,\n /* string */ 2,\n /* bytes */ 2\n]);\n\n/**\n * Basic type defaults.\n * @type {Object.<string,*>}\n * @const\n * @property {number} double=0 Double default\n * @property {number} float=0 Float default\n * @property {number} int32=0 Int32 default\n * @property {number} uint32=0 Uint32 default\n * @property {number} sint32=0 Sint32 default\n * @property {number} fixed32=0 Fixed32 default\n * @property {number} sfixed32=0 Sfixed32 default\n * @property {number} int64=0 Int64 default\n * @property {number} uint64=0 Uint64 default\n * @property {number} sint64=0 Sint32 default\n * @property {number} fixed64=0 Fixed64 default\n * @property {number} sfixed64=0 Sfixed64 default\n * @property {boolean} bool=false Bool default\n * @property {string} string=\"\" String default\n * @property {Array.<number>} bytes=Array(0) Bytes default\n * @property {null} message=null Message default\n */\ntypes.defaults = bake([\n /* double */ 0,\n /* float */ 0,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 0,\n /* sfixed32 */ 0,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 0,\n /* sfixed64 */ 0,\n /* bool */ false,\n /* string */ \"\",\n /* bytes */ util.emptyArray,\n /* message */ null\n]);\n\n/**\n * Basic long type wire types.\n * @type {Object.<string,number>}\n * @const\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n */\ntypes.long = bake([\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1\n], 7);\n\n/**\n * Allowed types for map keys with their associated wire type.\n * @type {Object.<string,number>}\n * @const\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n * @property {number} string=2 Ldelim wire type\n */\ntypes.mapKey = bake([\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0,\n /* string */ 2\n], 2);\n\n/**\n * Allowed types for packed repeated fields with their associated wire type.\n * @type {Object.<string,number>}\n * @const\n * @property {number} double=1 Fixed64 wire type\n * @property {number} float=5 Fixed32 wire type\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n */\ntypes.packed = bake([\n /* double */ 1,\n /* float */ 5,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0\n]);\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/types.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/util.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/util.js ***!
|
||
\*********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\n/**\n * Various utility functions.\n * @namespace\n */\nvar util = module.exports = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\nvar roots = __webpack_require__(/*! ./roots */ \"./node_modules/protobufjs/src/roots.js\");\n\nvar Type, // cyclic\n Enum;\n\nutil.codegen = __webpack_require__(/*! @protobufjs/codegen */ \"./node_modules/@protobufjs/codegen/index.js\");\nutil.fetch = __webpack_require__(/*! @protobufjs/fetch */ \"./node_modules/@protobufjs/fetch/index.js\");\nutil.path = __webpack_require__(/*! @protobufjs/path */ \"./node_modules/@protobufjs/path/index.js\");\n\n/**\n * Node's fs module if available.\n * @type {Object.<string,*>}\n */\nutil.fs = util.inquire(\"fs\");\n\n/**\n * Converts an object's values to an array.\n * @param {Object.<string,*>} object Object to convert\n * @returns {Array.<*>} Converted array\n */\nutil.toArray = function toArray(object) {\n if (object) {\n var keys = Object.keys(object),\n array = new Array(keys.length),\n index = 0;\n while (index < keys.length)\n array[index] = object[keys[index++]];\n return array;\n }\n return [];\n};\n\n/**\n * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values.\n * @param {Array.<*>} array Array to convert\n * @returns {Object.<string,*>} Converted object\n */\nutil.toObject = function toObject(array) {\n var object = {},\n index = 0;\n while (index < array.length) {\n var key = array[index++],\n val = array[index++];\n if (val !== undefined)\n object[key] = val;\n }\n return object;\n};\n\nvar safePropBackslashRe = /\\\\/g,\n safePropQuoteRe = /\"/g;\n\n/**\n * Tests whether the specified name is a reserved word in JS.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nutil.isReserved = function isReserved(name) {\n return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name);\n};\n\n/**\n * Returns a safe property accessor for the specified property name.\n * @param {string} prop Property name\n * @returns {string} Safe accessor\n */\nutil.safeProp = function safeProp(prop) {\n if (!/^[$\\w_]+$/.test(prop) || util.isReserved(prop))\n return \"[\\\"\" + prop.replace(safePropBackslashRe, \"\\\\\\\\\").replace(safePropQuoteRe, \"\\\\\\\"\") + \"\\\"]\";\n return \".\" + prop;\n};\n\n/**\n * Converts the first character of a string to upper case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.ucFirst = function ucFirst(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n};\n\nvar camelCaseRe = /_([a-z])/g;\n\n/**\n * Converts a string to camel case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.camelCase = function camelCase(str) {\n return str.substring(0, 1)\n + str.substring(1)\n .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); });\n};\n\n/**\n * Compares reflected fields by id.\n * @param {Field} a First field\n * @param {Field} b Second field\n * @returns {number} Comparison value\n */\nutil.compareFieldsById = function compareFieldsById(a, b) {\n return a.id - b.id;\n};\n\n/**\n * Decorator helper for types (TypeScript).\n * @param {Constructor<T>} ctor Constructor function\n * @param {string} [typeName] Type name, defaults to the constructor's name\n * @returns {Type} Reflected type\n * @template T extends Message<T>\n * @property {Root} root Decorators root\n */\nutil.decorateType = function decorateType(ctor, typeName) {\n\n /* istanbul ignore if */\n if (ctor.$type) {\n if (typeName && ctor.$type.name !== typeName) {\n util.decorateRoot.remove(ctor.$type);\n ctor.$type.name = typeName;\n util.decorateRoot.add(ctor.$type);\n }\n return ctor.$type;\n }\n\n /* istanbul ignore next */\n if (!Type)\n Type = __webpack_require__(/*! ./type */ \"./node_modules/protobufjs/src/type.js\");\n\n var type = new Type(typeName || ctor.name);\n util.decorateRoot.add(type);\n type.ctor = ctor; // sets up .encode, .decode etc.\n Object.defineProperty(ctor, \"$type\", { value: type, enumerable: false });\n Object.defineProperty(ctor.prototype, \"$type\", { value: type, enumerable: false });\n return type;\n};\n\nvar decorateEnumIndex = 0;\n\n/**\n * Decorator helper for enums (TypeScript).\n * @param {Object} object Enum object\n * @returns {Enum} Reflected enum\n */\nutil.decorateEnum = function decorateEnum(object) {\n\n /* istanbul ignore if */\n if (object.$type)\n return object.$type;\n\n /* istanbul ignore next */\n if (!Enum)\n Enum = __webpack_require__(/*! ./enum */ \"./node_modules/protobufjs/src/enum.js\");\n\n var enm = new Enum(\"Enum\" + decorateEnumIndex++, object);\n util.decorateRoot.add(enm);\n Object.defineProperty(object, \"$type\", { value: enm, enumerable: false });\n return enm;\n};\n\n\n/**\n * Sets the value of a property by property path. If a value already exists, it is turned to an array\n * @param {Object.<string,*>} dst Destination object\n * @param {string} path dot '.' delimited path of the property to set\n * @param {Object} value the value to set\n * @returns {Object.<string,*>} Destination object\n */\nutil.setProperty = function setProperty(dst, path, value) {\n function setProp(dst, path, value) {\n var part = path.shift();\n if (part === \"__proto__\" || part === \"prototype\") {\n return dst;\n }\n if (path.length > 0) {\n dst[part] = setProp(dst[part] || {}, path, value);\n } else {\n var prevValue = dst[part];\n if (prevValue)\n value = [].concat(prevValue).concat(value);\n dst[part] = value;\n }\n return dst;\n }\n\n if (typeof dst !== \"object\")\n throw TypeError(\"dst must be an object\");\n if (!path)\n throw TypeError(\"path must be specified\");\n\n path = path.split(\".\");\n return setProp(dst, path, value);\n};\n\n/**\n * Decorator root (TypeScript).\n * @name util.decorateRoot\n * @type {Root}\n * @readonly\n */\nObject.defineProperty(util, \"decorateRoot\", {\n get: function() {\n return roots[\"decorated\"] || (roots[\"decorated\"] = new (__webpack_require__(/*! ./root */ \"./node_modules/protobufjs/src/root.js\"))());\n }\n});\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/util.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/util/longbits.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/util/longbits.js ***!
|
||
\******************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = LongBits;\n\nvar util = __webpack_require__(/*! ../util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/util/longbits.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/util/minimal.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/util/minimal.js ***!
|
||
\*****************************************************/
|
||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
eval("\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = __webpack_require__(/*! @protobufjs/aspromise */ \"./node_modules/@protobufjs/aspromise/index.js\");\n\n// converts to / from base64 encoded strings\nutil.base64 = __webpack_require__(/*! @protobufjs/base64 */ \"./node_modules/@protobufjs/base64/index.js\");\n\n// base class of rpc.Service\nutil.EventEmitter = __webpack_require__(/*! @protobufjs/eventemitter */ \"./node_modules/@protobufjs/eventemitter/index.js\");\n\n// float handling accross browsers\nutil.float = __webpack_require__(/*! @protobufjs/float */ \"./node_modules/@protobufjs/float/index.js\");\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = __webpack_require__(/*! @protobufjs/inquire */ \"./node_modules/@protobufjs/inquire/index.js\");\n\n// converts to / from utf8 encoded strings\nutil.utf8 = __webpack_require__(/*! @protobufjs/utf8 */ \"./node_modules/@protobufjs/utf8/index.js\");\n\n// provides a node-like buffer pool in the browser\nutil.pool = __webpack_require__(/*! @protobufjs/pool */ \"./node_modules/@protobufjs/pool/index.js\");\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = __webpack_require__(/*! ./longbits */ \"./node_modules/protobufjs/src/util/longbits.js\");\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof __webpack_require__.g !== \"undefined\"\n && __webpack_require__.g\n && __webpack_require__.g.process\n && __webpack_require__.g.process.versions\n && __webpack_require__.g.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && __webpack_require__.g\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor<Buffer>}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor<Uint8Array>}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor<Long>}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.<string,*>} dst Destination object\n * @param {Object.<string,*>} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.<string,*>} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor<Error>} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n CustomError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: CustomError,\n writable: true,\n enumerable: false,\n configurable: true,\n },\n name: {\n get: function get() { return name; },\n set: undefined,\n enumerable: false,\n // configurable: false would accurately preserve the behavior of\n // the original, but I'm guessing that was not intentional.\n // For an actual error subclass, this property would\n // be configurable.\n configurable: true,\n },\n toString: {\n value: function value() { return this.name + \": \" + this.message; },\n writable: true,\n enumerable: false,\n configurable: true,\n },\n });\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message<T>\n * @constructor\n * @param {string} message Error message\n * @param {Object.<string,*>} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message<T>}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/util/minimal.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/verifier.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/verifier.js ***!
|
||
\*************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = verifier;\n\nvar Enum = __webpack_require__(/*! ./enum */ \"./node_modules/protobufjs/src/enum.js\"),\n util = __webpack_require__(/*! ./util */ \"./node_modules/protobufjs/src/util.js\");\n\nfunction invalid(field, expected) {\n return field.name + \": \" + expected + (field.repeated && expected !== \"array\" ? \"[]\" : field.map && expected !== \"object\" ? \"{k:\"+field.keyType+\"}\" : \"\") + \" expected\";\n}\n\n/**\n * Generates a partial value verifier.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} ref Variable reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genVerifyValue(gen, field, fieldIndex, ref) {\n /* eslint-disable no-unexpected-multiline */\n if (field.resolvedType) {\n if (field.resolvedType instanceof Enum) { gen\n (\"switch(%s){\", ref)\n (\"default:\")\n (\"return%j\", invalid(field, \"enum value\"));\n for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen\n (\"case %i:\", field.resolvedType.values[keys[j]]);\n gen\n (\"break\")\n (\"}\");\n } else {\n gen\n (\"{\")\n (\"var e=types[%i].verify(%s);\", fieldIndex, ref)\n (\"if(e)\")\n (\"return%j+e\", field.name + \".\")\n (\"}\");\n }\n } else {\n switch (field.type) {\n case \"int32\":\n case \"uint32\":\n case \"sint32\":\n case \"fixed32\":\n case \"sfixed32\": gen\n (\"if(!util.isInteger(%s))\", ref)\n (\"return%j\", invalid(field, \"integer\"));\n break;\n case \"int64\":\n case \"uint64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))\", ref, ref, ref, ref)\n (\"return%j\", invalid(field, \"integer|Long\"));\n break;\n case \"float\":\n case \"double\": gen\n (\"if(typeof %s!==\\\"number\\\")\", ref)\n (\"return%j\", invalid(field, \"number\"));\n break;\n case \"bool\": gen\n (\"if(typeof %s!==\\\"boolean\\\")\", ref)\n (\"return%j\", invalid(field, \"boolean\"));\n break;\n case \"string\": gen\n (\"if(!util.isString(%s))\", ref)\n (\"return%j\", invalid(field, \"string\"));\n break;\n case \"bytes\": gen\n (\"if(!(%s&&typeof %s.length===\\\"number\\\"||util.isString(%s)))\", ref, ref, ref)\n (\"return%j\", invalid(field, \"buffer\"));\n break;\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline */\n}\n\n/**\n * Generates a partial key verifier.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {string} ref Variable reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genVerifyKey(gen, field, ref) {\n /* eslint-disable no-unexpected-multiline */\n switch (field.keyType) {\n case \"int32\":\n case \"uint32\":\n case \"sint32\":\n case \"fixed32\":\n case \"sfixed32\": gen\n (\"if(!util.key32Re.test(%s))\", ref)\n (\"return%j\", invalid(field, \"integer key\"));\n break;\n case \"int64\":\n case \"uint64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(!util.key64Re.test(%s))\", ref) // see comment above: x is ok, d is not\n (\"return%j\", invalid(field, \"integer|Long key\"));\n break;\n case \"bool\": gen\n (\"if(!util.key2Re.test(%s))\", ref)\n (\"return%j\", invalid(field, \"boolean key\"));\n break;\n }\n return gen;\n /* eslint-enable no-unexpected-multiline */\n}\n\n/**\n * Generates a verifier specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nfunction verifier(mtype) {\n /* eslint-disable no-unexpected-multiline */\n\n var gen = util.codegen([\"m\"], mtype.name + \"$verify\")\n (\"if(typeof m!==\\\"object\\\"||m===null)\")\n (\"return%j\", \"object expected\");\n var oneofs = mtype.oneofsArray,\n seenFirstField = {};\n if (oneofs.length) gen\n (\"var p={}\");\n\n for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) {\n var field = mtype._fieldsArray[i].resolve(),\n ref = \"m\" + util.safeProp(field.name);\n\n if (field.optional) gen\n (\"if(%s!=null&&m.hasOwnProperty(%j)){\", ref, field.name); // !== undefined && !== null\n\n // map fields\n if (field.map) { gen\n (\"if(!util.isObject(%s))\", ref)\n (\"return%j\", invalid(field, \"object\"))\n (\"var k=Object.keys(%s)\", ref)\n (\"for(var i=0;i<k.length;++i){\");\n genVerifyKey(gen, field, \"k[i]\");\n genVerifyValue(gen, field, i, ref + \"[k[i]]\")\n (\"}\");\n\n // repeated fields\n } else if (field.repeated) { gen\n (\"if(!Array.isArray(%s))\", ref)\n (\"return%j\", invalid(field, \"array\"))\n (\"for(var i=0;i<%s.length;++i){\", ref);\n genVerifyValue(gen, field, i, ref + \"[i]\")\n (\"}\");\n\n // required or present fields\n } else {\n if (field.partOf) {\n var oneofProp = util.safeProp(field.partOf.name);\n if (seenFirstField[field.partOf.name] === 1) gen\n (\"if(p%s===1)\", oneofProp)\n (\"return%j\", field.partOf.name + \": multiple values\");\n seenFirstField[field.partOf.name] = 1;\n gen\n (\"p%s=1\", oneofProp);\n }\n genVerifyValue(gen, field, i, ref);\n }\n if (field.optional) gen\n (\"}\");\n }\n return gen\n (\"return null\");\n /* eslint-enable no-unexpected-multiline */\n}\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/verifier.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/wrappers.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/wrappers.js ***!
|
||
\*************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\n/**\n * Wrappers for common types.\n * @type {Object.<string,IWrapper>}\n * @const\n */\nvar wrappers = exports;\n\nvar Message = __webpack_require__(/*! ./message */ \"./node_modules/protobufjs/src/message.js\");\n\n/**\n * From object converter part of an {@link IWrapper}.\n * @typedef WrapperFromObjectConverter\n * @type {function}\n * @param {Object.<string,*>} object Plain object\n * @returns {Message<{}>} Message instance\n * @this Type\n */\n\n/**\n * To object converter part of an {@link IWrapper}.\n * @typedef WrapperToObjectConverter\n * @type {function}\n * @param {Message<{}>} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.<string,*>} Plain object\n * @this Type\n */\n\n/**\n * Common type wrapper part of {@link wrappers}.\n * @interface IWrapper\n * @property {WrapperFromObjectConverter} [fromObject] From object converter\n * @property {WrapperToObjectConverter} [toObject] To object converter\n */\n\n// Custom wrapper for Any\nwrappers[\".google.protobuf.Any\"] = {\n\n fromObject: function(object) {\n\n // unwrap value type if mapped\n if (object && object[\"@type\"]) {\n // Only use fully qualified type name after the last '/'\n var name = object[\"@type\"].substring(object[\"@type\"].lastIndexOf(\"/\") + 1);\n var type = this.lookup(name);\n /* istanbul ignore else */\n if (type) {\n // type_url does not accept leading \".\"\n var type_url = object[\"@type\"].charAt(0) === \".\" ?\n object[\"@type\"].slice(1) : object[\"@type\"];\n // type_url prefix is optional, but path seperator is required\n if (type_url.indexOf(\"/\") === -1) {\n type_url = \"/\" + type_url;\n }\n return this.create({\n type_url: type_url,\n value: type.encode(type.fromObject(object)).finish()\n });\n }\n }\n\n return this.fromObject(object);\n },\n\n toObject: function(message, options) {\n\n // Default prefix\n var googleApi = \"type.googleapis.com/\";\n var prefix = \"\";\n var name = \"\";\n\n // decode value if requested and unmapped\n if (options && options.json && message.type_url && message.value) {\n // Only use fully qualified type name after the last '/'\n name = message.type_url.substring(message.type_url.lastIndexOf(\"/\") + 1);\n // Separate the prefix used\n prefix = message.type_url.substring(0, message.type_url.lastIndexOf(\"/\") + 1);\n var type = this.lookup(name);\n /* istanbul ignore else */\n if (type)\n message = type.decode(message.value);\n }\n\n // wrap value if unmapped\n if (!(message instanceof this.ctor) && message instanceof Message) {\n var object = message.$type.toObject(message, options);\n var messageName = message.$type.fullName[0] === \".\" ?\n message.$type.fullName.slice(1) : message.$type.fullName;\n // Default to type.googleapis.com prefix if no prefix is used\n if (prefix === \"\") {\n prefix = googleApi;\n }\n name = prefix + messageName;\n object[\"@type\"] = name;\n return object;\n }\n\n return this.toObject(message, options);\n }\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/wrappers.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/writer.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/protobufjs/src/writer.js ***!
|
||
\***********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = Writer;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/writer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protobufjs/src/writer_buffer.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/protobufjs/src/writer_buffer.js ***!
|
||
\******************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = __webpack_require__(/*! ./writer */ \"./node_modules/protobufjs/src/writer.js\");\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protobufjs/src/writer_buffer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/pvtsutils/build/index.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/pvtsutils/build/index.js ***!
|
||
\***********************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("/*!\n * MIT License\n * \n * Copyright (c) 2017-2022 Peculiar Ventures, LLC\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n * \n */\n\n\n\nconst ARRAY_BUFFER_NAME = \"[object ArrayBuffer]\";\nclass BufferSourceConverter {\n static isArrayBuffer(data) {\n return Object.prototype.toString.call(data) === ARRAY_BUFFER_NAME;\n }\n static toArrayBuffer(data) {\n if (this.isArrayBuffer(data)) {\n return data;\n }\n if (data.byteLength === data.buffer.byteLength) {\n return data.buffer;\n }\n if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {\n return data.buffer;\n }\n return this.toUint8Array(data.buffer)\n .slice(data.byteOffset, data.byteOffset + data.byteLength)\n .buffer;\n }\n static toUint8Array(data) {\n return this.toView(data, Uint8Array);\n }\n static toView(data, type) {\n if (data.constructor === type) {\n return data;\n }\n if (this.isArrayBuffer(data)) {\n return new type(data);\n }\n if (this.isArrayBufferView(data)) {\n return new type(data.buffer, data.byteOffset, data.byteLength);\n }\n throw new TypeError(\"The provided value is not of type '(ArrayBuffer or ArrayBufferView)'\");\n }\n static isBufferSource(data) {\n return this.isArrayBufferView(data)\n || this.isArrayBuffer(data);\n }\n static isArrayBufferView(data) {\n return ArrayBuffer.isView(data)\n || (data && this.isArrayBuffer(data.buffer));\n }\n static isEqual(a, b) {\n const aView = BufferSourceConverter.toUint8Array(a);\n const bView = BufferSourceConverter.toUint8Array(b);\n if (aView.length !== bView.byteLength) {\n return false;\n }\n for (let i = 0; i < aView.length; i++) {\n if (aView[i] !== bView[i]) {\n return false;\n }\n }\n return true;\n }\n static concat(...args) {\n let buffers;\n if (Array.isArray(args[0]) && !(args[1] instanceof Function)) {\n buffers = args[0];\n }\n else if (Array.isArray(args[0]) && args[1] instanceof Function) {\n buffers = args[0];\n }\n else {\n if (args[args.length - 1] instanceof Function) {\n buffers = args.slice(0, args.length - 1);\n }\n else {\n buffers = args;\n }\n }\n let size = 0;\n for (const buffer of buffers) {\n size += buffer.byteLength;\n }\n const res = new Uint8Array(size);\n let offset = 0;\n for (const buffer of buffers) {\n const view = this.toUint8Array(buffer);\n res.set(view, offset);\n offset += view.length;\n }\n if (args[args.length - 1] instanceof Function) {\n return this.toView(res, args[args.length - 1]);\n }\n return res.buffer;\n }\n}\n\nconst STRING_TYPE = \"string\";\nconst HEX_REGEX = /^[0-9a-f]+$/i;\nconst BASE64_REGEX = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\nconst BASE64URL_REGEX = /^[a-zA-Z0-9-_]+$/;\nclass Utf8Converter {\n static fromString(text) {\n const s = unescape(encodeURIComponent(text));\n const uintArray = new Uint8Array(s.length);\n for (let i = 0; i < s.length; i++) {\n uintArray[i] = s.charCodeAt(i);\n }\n return uintArray.buffer;\n }\n static toString(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n let encodedString = \"\";\n for (let i = 0; i < buf.length; i++) {\n encodedString += String.fromCharCode(buf[i]);\n }\n const decodedString = decodeURIComponent(escape(encodedString));\n return decodedString;\n }\n}\nclass Utf16Converter {\n static toString(buffer, littleEndian = false) {\n const arrayBuffer = BufferSourceConverter.toArrayBuffer(buffer);\n const dataView = new DataView(arrayBuffer);\n let res = \"\";\n for (let i = 0; i < arrayBuffer.byteLength; i += 2) {\n const code = dataView.getUint16(i, littleEndian);\n res += String.fromCharCode(code);\n }\n return res;\n }\n static fromString(text, littleEndian = false) {\n const res = new ArrayBuffer(text.length * 2);\n const dataView = new DataView(res);\n for (let i = 0; i < text.length; i++) {\n dataView.setUint16(i * 2, text.charCodeAt(i), littleEndian);\n }\n return res;\n }\n}\nclass Convert {\n static isHex(data) {\n return typeof data === STRING_TYPE\n && HEX_REGEX.test(data);\n }\n static isBase64(data) {\n return typeof data === STRING_TYPE\n && BASE64_REGEX.test(data);\n }\n static isBase64Url(data) {\n return typeof data === STRING_TYPE\n && BASE64URL_REGEX.test(data);\n }\n static ToString(buffer, enc = \"utf8\") {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n switch (enc.toLowerCase()) {\n case \"utf8\":\n return this.ToUtf8String(buf);\n case \"binary\":\n return this.ToBinary(buf);\n case \"hex\":\n return this.ToHex(buf);\n case \"base64\":\n return this.ToBase64(buf);\n case \"base64url\":\n return this.ToBase64Url(buf);\n case \"utf16le\":\n return Utf16Converter.toString(buf, true);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.toString(buf);\n default:\n throw new Error(`Unknown type of encoding '${enc}'`);\n }\n }\n static FromString(str, enc = \"utf8\") {\n if (!str) {\n return new ArrayBuffer(0);\n }\n switch (enc.toLowerCase()) {\n case \"utf8\":\n return this.FromUtf8String(str);\n case \"binary\":\n return this.FromBinary(str);\n case \"hex\":\n return this.FromHex(str);\n case \"base64\":\n return this.FromBase64(str);\n case \"base64url\":\n return this.FromBase64Url(str);\n case \"utf16le\":\n return Utf16Converter.fromString(str, true);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.fromString(str);\n default:\n throw new Error(`Unknown type of encoding '${enc}'`);\n }\n }\n static ToBase64(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n if (typeof btoa !== \"undefined\") {\n const binary = this.ToString(buf, \"binary\");\n return btoa(binary);\n }\n else {\n return Buffer.from(buf).toString(\"base64\");\n }\n }\n static FromBase64(base64) {\n const formatted = this.formatString(base64);\n if (!formatted) {\n return new ArrayBuffer(0);\n }\n if (!Convert.isBase64(formatted)) {\n throw new TypeError(\"Argument 'base64Text' is not Base64 encoded\");\n }\n if (typeof atob !== \"undefined\") {\n return this.FromBinary(atob(formatted));\n }\n else {\n return new Uint8Array(Buffer.from(formatted, \"base64\")).buffer;\n }\n }\n static FromBase64Url(base64url) {\n const formatted = this.formatString(base64url);\n if (!formatted) {\n return new ArrayBuffer(0);\n }\n if (!Convert.isBase64Url(formatted)) {\n throw new TypeError(\"Argument 'base64url' is not Base64Url encoded\");\n }\n return this.FromBase64(this.Base64Padding(formatted.replace(/\\-/g, \"+\").replace(/\\_/g, \"/\")));\n }\n static ToBase64Url(data) {\n return this.ToBase64(data).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/\\=/g, \"\");\n }\n static FromUtf8String(text, encoding = Convert.DEFAULT_UTF8_ENCODING) {\n switch (encoding) {\n case \"ascii\":\n return this.FromBinary(text);\n case \"utf8\":\n return Utf8Converter.fromString(text);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.fromString(text);\n case \"utf16le\":\n case \"usc2\":\n return Utf16Converter.fromString(text, true);\n default:\n throw new Error(`Unknown type of encoding '${encoding}'`);\n }\n }\n static ToUtf8String(buffer, encoding = Convert.DEFAULT_UTF8_ENCODING) {\n switch (encoding) {\n case \"ascii\":\n return this.ToBinary(buffer);\n case \"utf8\":\n return Utf8Converter.toString(buffer);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.toString(buffer);\n case \"utf16le\":\n case \"usc2\":\n return Utf16Converter.toString(buffer, true);\n default:\n throw new Error(`Unknown type of encoding '${encoding}'`);\n }\n }\n static FromBinary(text) {\n const stringLength = text.length;\n const resultView = new Uint8Array(stringLength);\n for (let i = 0; i < stringLength; i++) {\n resultView[i] = text.charCodeAt(i);\n }\n return resultView.buffer;\n }\n static ToBinary(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n let res = \"\";\n for (let i = 0; i < buf.length; i++) {\n res += String.fromCharCode(buf[i]);\n }\n return res;\n }\n static ToHex(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n let result = \"\";\n const len = buf.length;\n for (let i = 0; i < len; i++) {\n const byte = buf[i];\n if (byte < 16) {\n result += \"0\";\n }\n result += byte.toString(16);\n }\n return result;\n }\n static FromHex(hexString) {\n let formatted = this.formatString(hexString);\n if (!formatted) {\n return new ArrayBuffer(0);\n }\n if (!Convert.isHex(formatted)) {\n throw new TypeError(\"Argument 'hexString' is not HEX encoded\");\n }\n if (formatted.length % 2) {\n formatted = `0${formatted}`;\n }\n const res = new Uint8Array(formatted.length / 2);\n for (let i = 0; i < formatted.length; i = i + 2) {\n const c = formatted.slice(i, i + 2);\n res[i / 2] = parseInt(c, 16);\n }\n return res.buffer;\n }\n static ToUtf16String(buffer, littleEndian = false) {\n return Utf16Converter.toString(buffer, littleEndian);\n }\n static FromUtf16String(text, littleEndian = false) {\n return Utf16Converter.fromString(text, littleEndian);\n }\n static Base64Padding(base64) {\n const padCount = 4 - (base64.length % 4);\n if (padCount < 4) {\n for (let i = 0; i < padCount; i++) {\n base64 += \"=\";\n }\n }\n return base64;\n }\n static formatString(data) {\n return (data === null || data === void 0 ? void 0 : data.replace(/[\\n\\r\\t ]/g, \"\")) || \"\";\n }\n}\nConvert.DEFAULT_UTF8_ENCODING = \"utf8\";\n\nfunction assign(target, ...sources) {\n const res = arguments[0];\n for (let i = 1; i < arguments.length; i++) {\n const obj = arguments[i];\n for (const prop in obj) {\n res[prop] = obj[prop];\n }\n }\n return res;\n}\nfunction combine(...buf) {\n const totalByteLength = buf.map((item) => item.byteLength).reduce((prev, cur) => prev + cur);\n const res = new Uint8Array(totalByteLength);\n let currentPos = 0;\n buf.map((item) => new Uint8Array(item)).forEach((arr) => {\n for (const item2 of arr) {\n res[currentPos++] = item2;\n }\n });\n return res.buffer;\n}\nfunction isEqual(bytes1, bytes2) {\n if (!(bytes1 && bytes2)) {\n return false;\n }\n if (bytes1.byteLength !== bytes2.byteLength) {\n return false;\n }\n const b1 = new Uint8Array(bytes1);\n const b2 = new Uint8Array(bytes2);\n for (let i = 0; i < bytes1.byteLength; i++) {\n if (b1[i] !== b2[i]) {\n return false;\n }\n }\n return true;\n}\n\nexports.BufferSourceConverter = BufferSourceConverter;\nexports.Convert = Convert;\nexports.assign = assign;\nexports.combine = combine;\nexports.isEqual = isEqual;\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/pvtsutils/build/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/pvutils/build/utils.es.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/pvutils/build/utils.es.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ arrayBufferToString: () => (/* binding */ arrayBufferToString),\n/* harmony export */ bufferToHexCodes: () => (/* binding */ bufferToHexCodes),\n/* harmony export */ checkBufferParams: () => (/* binding */ checkBufferParams),\n/* harmony export */ clearProps: () => (/* binding */ clearProps),\n/* harmony export */ fromBase64: () => (/* binding */ fromBase64),\n/* harmony export */ getParametersValue: () => (/* binding */ getParametersValue),\n/* harmony export */ getUTCDate: () => (/* binding */ getUTCDate),\n/* harmony export */ isEqualBuffer: () => (/* binding */ isEqualBuffer),\n/* harmony export */ nearestPowerOf2: () => (/* binding */ nearestPowerOf2),\n/* harmony export */ padNumber: () => (/* binding */ padNumber),\n/* harmony export */ stringToArrayBuffer: () => (/* binding */ stringToArrayBuffer),\n/* harmony export */ toBase64: () => (/* binding */ toBase64),\n/* harmony export */ utilConcatBuf: () => (/* binding */ utilConcatBuf),\n/* harmony export */ utilConcatView: () => (/* binding */ utilConcatView),\n/* harmony export */ utilDecodeTC: () => (/* binding */ utilDecodeTC),\n/* harmony export */ utilEncodeTC: () => (/* binding */ utilEncodeTC),\n/* harmony export */ utilFromBase: () => (/* binding */ utilFromBase),\n/* harmony export */ utilToBase: () => (/* binding */ utilToBase)\n/* harmony export */ });\n/*!\n Copyright (c) Peculiar Ventures, LLC\n*/\n\nfunction getUTCDate(date) {\r\n return new Date(date.getTime() + (date.getTimezoneOffset() * 60000));\r\n}\r\nfunction getParametersValue(parameters, name, defaultValue) {\r\n var _a;\r\n if ((parameters instanceof Object) === false) {\r\n return defaultValue;\r\n }\r\n return (_a = parameters[name]) !== null && _a !== void 0 ? _a : defaultValue;\r\n}\r\nfunction bufferToHexCodes(inputBuffer, inputOffset = 0, inputLength = (inputBuffer.byteLength - inputOffset), insertSpace = false) {\r\n let result = \"\";\r\n for (const item of (new Uint8Array(inputBuffer, inputOffset, inputLength))) {\r\n const str = item.toString(16).toUpperCase();\r\n if (str.length === 1) {\r\n result += \"0\";\r\n }\r\n result += str;\r\n if (insertSpace) {\r\n result += \" \";\r\n }\r\n }\r\n return result.trim();\r\n}\r\nfunction checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) {\r\n if (!(inputBuffer instanceof ArrayBuffer)) {\r\n baseBlock.error = \"Wrong parameter: inputBuffer must be \\\"ArrayBuffer\\\"\";\r\n return false;\r\n }\r\n if (!inputBuffer.byteLength) {\r\n baseBlock.error = \"Wrong parameter: inputBuffer has zero length\";\r\n return false;\r\n }\r\n if (inputOffset < 0) {\r\n baseBlock.error = \"Wrong parameter: inputOffset less than zero\";\r\n return false;\r\n }\r\n if (inputLength < 0) {\r\n baseBlock.error = \"Wrong parameter: inputLength less than zero\";\r\n return false;\r\n }\r\n if ((inputBuffer.byteLength - inputOffset - inputLength) < 0) {\r\n baseBlock.error = \"End of input reached before message was fully decoded (inconsistent offset and length values)\";\r\n return false;\r\n }\r\n return true;\r\n}\r\nfunction utilFromBase(inputBuffer, inputBase) {\r\n let result = 0;\r\n if (inputBuffer.length === 1) {\r\n return inputBuffer[0];\r\n }\r\n for (let i = (inputBuffer.length - 1); i >= 0; i--) {\r\n result += inputBuffer[(inputBuffer.length - 1) - i] * Math.pow(2, inputBase * i);\r\n }\r\n return result;\r\n}\r\nfunction utilToBase(value, base, reserved = (-1)) {\r\n const internalReserved = reserved;\r\n let internalValue = value;\r\n let result = 0;\r\n let biggest = Math.pow(2, base);\r\n for (let i = 1; i < 8; i++) {\r\n if (value < biggest) {\r\n let retBuf;\r\n if (internalReserved < 0) {\r\n retBuf = new ArrayBuffer(i);\r\n result = i;\r\n }\r\n else {\r\n if (internalReserved < i) {\r\n return (new ArrayBuffer(0));\r\n }\r\n retBuf = new ArrayBuffer(internalReserved);\r\n result = internalReserved;\r\n }\r\n const retView = new Uint8Array(retBuf);\r\n for (let j = (i - 1); j >= 0; j--) {\r\n const basis = Math.pow(2, j * base);\r\n retView[result - j - 1] = Math.floor(internalValue / basis);\r\n internalValue -= (retView[result - j - 1]) * basis;\r\n }\r\n return retBuf;\r\n }\r\n biggest *= Math.pow(2, base);\r\n }\r\n return new ArrayBuffer(0);\r\n}\r\nfunction utilConcatBuf(...buffers) {\r\n let outputLength = 0;\r\n let prevLength = 0;\r\n for (const buffer of buffers) {\r\n outputLength += buffer.byteLength;\r\n }\r\n const retBuf = new ArrayBuffer(outputLength);\r\n const retView = new Uint8Array(retBuf);\r\n for (const buffer of buffers) {\r\n retView.set(new Uint8Array(buffer), prevLength);\r\n prevLength += buffer.byteLength;\r\n }\r\n return retBuf;\r\n}\r\nfunction utilConcatView(...views) {\r\n let outputLength = 0;\r\n let prevLength = 0;\r\n for (const view of views) {\r\n outputLength += view.length;\r\n }\r\n const retBuf = new ArrayBuffer(outputLength);\r\n const retView = new Uint8Array(retBuf);\r\n for (const view of views) {\r\n retView.set(view, prevLength);\r\n prevLength += view.length;\r\n }\r\n return retView;\r\n}\r\nfunction utilDecodeTC() {\r\n const buf = new Uint8Array(this.valueHex);\r\n if (this.valueHex.byteLength >= 2) {\r\n const condition1 = (buf[0] === 0xFF) && (buf[1] & 0x80);\r\n const condition2 = (buf[0] === 0x00) && ((buf[1] & 0x80) === 0x00);\r\n if (condition1 || condition2) {\r\n this.warnings.push(\"Needlessly long format\");\r\n }\r\n }\r\n const bigIntBuffer = new ArrayBuffer(this.valueHex.byteLength);\r\n const bigIntView = new Uint8Array(bigIntBuffer);\r\n for (let i = 0; i < this.valueHex.byteLength; i++) {\r\n bigIntView[i] = 0;\r\n }\r\n bigIntView[0] = (buf[0] & 0x80);\r\n const bigInt = utilFromBase(bigIntView, 8);\r\n const smallIntBuffer = new ArrayBuffer(this.valueHex.byteLength);\r\n const smallIntView = new Uint8Array(smallIntBuffer);\r\n for (let j = 0; j < this.valueHex.byteLength; j++) {\r\n smallIntView[j] = buf[j];\r\n }\r\n smallIntView[0] &= 0x7F;\r\n const smallInt = utilFromBase(smallIntView, 8);\r\n return (smallInt - bigInt);\r\n}\r\nfunction utilEncodeTC(value) {\r\n const modValue = (value < 0) ? (value * (-1)) : value;\r\n let bigInt = 128;\r\n for (let i = 1; i < 8; i++) {\r\n if (modValue <= bigInt) {\r\n if (value < 0) {\r\n const smallInt = bigInt - modValue;\r\n const retBuf = utilToBase(smallInt, 8, i);\r\n const retView = new Uint8Array(retBuf);\r\n retView[0] |= 0x80;\r\n return retBuf;\r\n }\r\n let retBuf = utilToBase(modValue, 8, i);\r\n let retView = new Uint8Array(retBuf);\r\n if (retView[0] & 0x80) {\r\n const tempBuf = retBuf.slice(0);\r\n const tempView = new Uint8Array(tempBuf);\r\n retBuf = new ArrayBuffer(retBuf.byteLength + 1);\r\n retView = new Uint8Array(retBuf);\r\n for (let k = 0; k < tempBuf.byteLength; k++) {\r\n retView[k + 1] = tempView[k];\r\n }\r\n retView[0] = 0x00;\r\n }\r\n return retBuf;\r\n }\r\n bigInt *= Math.pow(2, 8);\r\n }\r\n return (new ArrayBuffer(0));\r\n}\r\nfunction isEqualBuffer(inputBuffer1, inputBuffer2) {\r\n if (inputBuffer1.byteLength !== inputBuffer2.byteLength) {\r\n return false;\r\n }\r\n const view1 = new Uint8Array(inputBuffer1);\r\n const view2 = new Uint8Array(inputBuffer2);\r\n for (let i = 0; i < view1.length; i++) {\r\n if (view1[i] !== view2[i]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n}\r\nfunction padNumber(inputNumber, fullLength) {\r\n const str = inputNumber.toString(10);\r\n if (fullLength < str.length) {\r\n return \"\";\r\n }\r\n const dif = fullLength - str.length;\r\n const padding = new Array(dif);\r\n for (let i = 0; i < dif; i++) {\r\n padding[i] = \"0\";\r\n }\r\n const paddingString = padding.join(\"\");\r\n return paddingString.concat(str);\r\n}\r\nconst base64Template = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\nconst base64UrlTemplate = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=\";\r\nfunction toBase64(input, useUrlTemplate = false, skipPadding = false, skipLeadingZeros = false) {\r\n let i = 0;\r\n let flag1 = 0;\r\n let flag2 = 0;\r\n let output = \"\";\r\n const template = (useUrlTemplate) ? base64UrlTemplate : base64Template;\r\n if (skipLeadingZeros) {\r\n let nonZeroPosition = 0;\r\n for (let i = 0; i < input.length; i++) {\r\n if (input.charCodeAt(i) !== 0) {\r\n nonZeroPosition = i;\r\n break;\r\n }\r\n }\r\n input = input.slice(nonZeroPosition);\r\n }\r\n while (i < input.length) {\r\n const chr1 = input.charCodeAt(i++);\r\n if (i >= input.length) {\r\n flag1 = 1;\r\n }\r\n const chr2 = input.charCodeAt(i++);\r\n if (i >= input.length) {\r\n flag2 = 1;\r\n }\r\n const chr3 = input.charCodeAt(i++);\r\n const enc1 = chr1 >> 2;\r\n const enc2 = ((chr1 & 0x03) << 4) | (chr2 >> 4);\r\n let enc3 = ((chr2 & 0x0F) << 2) | (chr3 >> 6);\r\n let enc4 = chr3 & 0x3F;\r\n if (flag1 === 1) {\r\n enc3 = enc4 = 64;\r\n }\r\n else {\r\n if (flag2 === 1) {\r\n enc4 = 64;\r\n }\r\n }\r\n if (skipPadding) {\r\n if (enc3 === 64) {\r\n output += `${template.charAt(enc1)}${template.charAt(enc2)}`;\r\n }\r\n else {\r\n if (enc4 === 64) {\r\n output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}`;\r\n }\r\n else {\r\n output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`;\r\n }\r\n }\r\n }\r\n else {\r\n output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`;\r\n }\r\n }\r\n return output;\r\n}\r\nfunction fromBase64(input, useUrlTemplate = false, cutTailZeros = false) {\r\n const template = (useUrlTemplate) ? base64UrlTemplate : base64Template;\r\n function indexOf(toSearch) {\r\n for (let i = 0; i < 64; i++) {\r\n if (template.charAt(i) === toSearch)\r\n return i;\r\n }\r\n return 64;\r\n }\r\n function test(incoming) {\r\n return ((incoming === 64) ? 0x00 : incoming);\r\n }\r\n let i = 0;\r\n let output = \"\";\r\n while (i < input.length) {\r\n const enc1 = indexOf(input.charAt(i++));\r\n const enc2 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++));\r\n const enc3 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++));\r\n const enc4 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++));\r\n const chr1 = (test(enc1) << 2) | (test(enc2) >> 4);\r\n const chr2 = ((test(enc2) & 0x0F) << 4) | (test(enc3) >> 2);\r\n const chr3 = ((test(enc3) & 0x03) << 6) | test(enc4);\r\n output += String.fromCharCode(chr1);\r\n if (enc3 !== 64) {\r\n output += String.fromCharCode(chr2);\r\n }\r\n if (enc4 !== 64) {\r\n output += String.fromCharCode(chr3);\r\n }\r\n }\r\n if (cutTailZeros) {\r\n const outputLength = output.length;\r\n let nonZeroStart = (-1);\r\n for (let i = (outputLength - 1); i >= 0; i--) {\r\n if (output.charCodeAt(i) !== 0) {\r\n nonZeroStart = i;\r\n break;\r\n }\r\n }\r\n if (nonZeroStart !== (-1)) {\r\n output = output.slice(0, nonZeroStart + 1);\r\n }\r\n else {\r\n output = \"\";\r\n }\r\n }\r\n return output;\r\n}\r\nfunction arrayBufferToString(buffer) {\r\n let resultString = \"\";\r\n const view = new Uint8Array(buffer);\r\n for (const element of view) {\r\n resultString += String.fromCharCode(element);\r\n }\r\n return resultString;\r\n}\r\nfunction stringToArrayBuffer(str) {\r\n const stringLength = str.length;\r\n const resultBuffer = new ArrayBuffer(stringLength);\r\n const resultView = new Uint8Array(resultBuffer);\r\n for (let i = 0; i < stringLength; i++) {\r\n resultView[i] = str.charCodeAt(i);\r\n }\r\n return resultBuffer;\r\n}\r\nconst log2 = Math.log(2);\r\nfunction nearestPowerOf2(length) {\r\n const base = (Math.log(length) / log2);\r\n const floor = Math.floor(base);\r\n const round = Math.round(base);\r\n return ((floor === round) ? floor : round);\r\n}\r\nfunction clearProps(object, propsArray) {\r\n for (const prop of propsArray) {\r\n delete object[prop];\r\n }\r\n}\n\n\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/pvutils/build/utils.es.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/browser.js":
|
||
/*!********************************************!*\
|
||
!*** ./node_modules/qrcode/lib/browser.js ***!
|
||
\********************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("\nconst canPromise = __webpack_require__(/*! ./can-promise */ \"./node_modules/qrcode/lib/can-promise.js\")\n\nconst QRCode = __webpack_require__(/*! ./core/qrcode */ \"./node_modules/qrcode/lib/core/qrcode.js\")\nconst CanvasRenderer = __webpack_require__(/*! ./renderer/canvas */ \"./node_modules/qrcode/lib/renderer/canvas.js\")\nconst SvgRenderer = __webpack_require__(/*! ./renderer/svg-tag.js */ \"./node_modules/qrcode/lib/renderer/svg-tag.js\")\n\nfunction renderCanvas (renderFunc, canvas, text, opts, cb) {\n const args = [].slice.call(arguments, 1)\n const argsNum = args.length\n const isLastArgCb = typeof args[argsNum - 1] === 'function'\n\n if (!isLastArgCb && !canPromise()) {\n throw new Error('Callback required as last argument')\n }\n\n if (isLastArgCb) {\n if (argsNum < 2) {\n throw new Error('Too few arguments provided')\n }\n\n if (argsNum === 2) {\n cb = text\n text = canvas\n canvas = opts = undefined\n } else if (argsNum === 3) {\n if (canvas.getContext && typeof cb === 'undefined') {\n cb = opts\n opts = undefined\n } else {\n cb = opts\n opts = text\n text = canvas\n canvas = undefined\n }\n }\n } else {\n if (argsNum < 1) {\n throw new Error('Too few arguments provided')\n }\n\n if (argsNum === 1) {\n text = canvas\n canvas = opts = undefined\n } else if (argsNum === 2 && !canvas.getContext) {\n opts = text\n text = canvas\n canvas = undefined\n }\n\n return new Promise(function (resolve, reject) {\n try {\n const data = QRCode.create(text, opts)\n resolve(renderFunc(data, canvas, opts))\n } catch (e) {\n reject(e)\n }\n })\n }\n\n try {\n const data = QRCode.create(text, opts)\n cb(null, renderFunc(data, canvas, opts))\n } catch (e) {\n cb(e)\n }\n}\n\nexports.create = QRCode.create\nexports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render)\nexports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL)\n\n// only svg for now.\nexports.toString = renderCanvas.bind(null, function (data, _, opts) {\n return SvgRenderer.render(data, opts)\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/can-promise.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/can-promise.js ***!
|
||
\************************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("// can-promise has a crash in some versions of react native that dont have\n// standard global objects\n// https://github.com/soldair/node-qrcode/issues/157\n\nmodule.exports = function () {\n return typeof Promise === 'function' && Promise.prototype && Promise.prototype.then\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/can-promise.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/alignment-pattern.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/alignment-pattern.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("/**\n * Alignment pattern are fixed reference pattern in defined positions\n * in a matrix symbology, which enables the decode software to re-synchronise\n * the coordinate mapping of the image modules in the event of moderate amounts\n * of distortion of the image.\n *\n * Alignment patterns are present only in QR Code symbols of version 2 or larger\n * and their number depends on the symbol version.\n */\n\nconst getSymbolSize = (__webpack_require__(/*! ./utils */ \"./node_modules/qrcode/lib/core/utils.js\").getSymbolSize)\n\n/**\n * Calculate the row/column coordinates of the center module of each alignment pattern\n * for the specified QR Code version.\n *\n * The alignment patterns are positioned symmetrically on either side of the diagonal\n * running from the top left corner of the symbol to the bottom right corner.\n *\n * Since positions are simmetrical only half of the coordinates are returned.\n * Each item of the array will represent in turn the x and y coordinate.\n * @see {@link getPositions}\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinate\n */\nexports.getRowColCoords = function getRowColCoords (version) {\n if (version === 1) return []\n\n const posCount = Math.floor(version / 7) + 2\n const size = getSymbolSize(version)\n const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2\n const positions = [size - 7] // Last coord is always (size - 7)\n\n for (let i = 1; i < posCount - 1; i++) {\n positions[i] = positions[i - 1] - intervals\n }\n\n positions.push(6) // First coord is always 6\n\n return positions.reverse()\n}\n\n/**\n * Returns an array containing the positions of each alignment pattern.\n * Each array's element represent the center point of the pattern as (x, y) coordinates\n *\n * Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}\n * and filtering out the items that overlaps with finder pattern\n *\n * @example\n * For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.\n * The alignment patterns, therefore, are to be centered on (row, column)\n * positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).\n * Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns\n * and are not therefore used for alignment patterns.\n *\n * let pos = getPositions(7)\n * // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinates\n */\nexports.getPositions = function getPositions (version) {\n const coords = []\n const pos = exports.getRowColCoords(version)\n const posLength = pos.length\n\n for (let i = 0; i < posLength; i++) {\n for (let j = 0; j < posLength; j++) {\n // Skip if position is occupied by finder patterns\n if ((i === 0 && j === 0) || // top-left\n (i === 0 && j === posLength - 1) || // bottom-left\n (i === posLength - 1 && j === 0)) { // top-right\n continue\n }\n\n coords.push([pos[i], pos[j]])\n }\n }\n\n return coords\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/alignment-pattern.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/alphanumeric-data.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/alphanumeric-data.js ***!
|
||
\***********************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("const Mode = __webpack_require__(/*! ./mode */ \"./node_modules/qrcode/lib/core/mode.js\")\n\n/**\n * Array of characters available in alphanumeric mode\n *\n * As per QR Code specification, to each character\n * is assigned a value from 0 to 44 which in this case coincides\n * with the array index\n *\n * @type {Array}\n */\nconst ALPHA_NUM_CHARS = [\n '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',\n 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',\n ' ', '$', '%', '*', '+', '-', '.', '/', ':'\n]\n\nfunction AlphanumericData (data) {\n this.mode = Mode.ALPHANUMERIC\n this.data = data\n}\n\nAlphanumericData.getBitsLength = function getBitsLength (length) {\n return 11 * Math.floor(length / 2) + 6 * (length % 2)\n}\n\nAlphanumericData.prototype.getLength = function getLength () {\n return this.data.length\n}\n\nAlphanumericData.prototype.getBitsLength = function getBitsLength () {\n return AlphanumericData.getBitsLength(this.data.length)\n}\n\nAlphanumericData.prototype.write = function write (bitBuffer) {\n let i\n\n // Input data characters are divided into groups of two characters\n // and encoded as 11-bit binary codes.\n for (i = 0; i + 2 <= this.data.length; i += 2) {\n // The character value of the first character is multiplied by 45\n let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45\n\n // The character value of the second digit is added to the product\n value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1])\n\n // The sum is then stored as 11-bit binary number\n bitBuffer.put(value, 11)\n }\n\n // If the number of input data characters is not a multiple of two,\n // the character value of the final character is encoded as a 6-bit binary number.\n if (this.data.length % 2) {\n bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6)\n }\n}\n\nmodule.exports = AlphanumericData\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/alphanumeric-data.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/bit-buffer.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/bit-buffer.js ***!
|
||
\****************************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("function BitBuffer () {\n this.buffer = []\n this.length = 0\n}\n\nBitBuffer.prototype = {\n\n get: function (index) {\n const bufIndex = Math.floor(index / 8)\n return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) === 1\n },\n\n put: function (num, length) {\n for (let i = 0; i < length; i++) {\n this.putBit(((num >>> (length - i - 1)) & 1) === 1)\n }\n },\n\n getLengthInBits: function () {\n return this.length\n },\n\n putBit: function (bit) {\n const bufIndex = Math.floor(this.length / 8)\n if (this.buffer.length <= bufIndex) {\n this.buffer.push(0)\n }\n\n if (bit) {\n this.buffer[bufIndex] |= (0x80 >>> (this.length % 8))\n }\n\n this.length++\n }\n}\n\nmodule.exports = BitBuffer\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/bit-buffer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/bit-matrix.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/bit-matrix.js ***!
|
||
\****************************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("/**\n * Helper class to handle QR Code symbol modules\n *\n * @param {Number} size Symbol size\n */\nfunction BitMatrix (size) {\n if (!size || size < 1) {\n throw new Error('BitMatrix size must be defined and greater than 0')\n }\n\n this.size = size\n this.data = new Uint8Array(size * size)\n this.reservedBit = new Uint8Array(size * size)\n}\n\n/**\n * Set bit value at specified location\n * If reserved flag is set, this bit will be ignored during masking process\n *\n * @param {Number} row\n * @param {Number} col\n * @param {Boolean} value\n * @param {Boolean} reserved\n */\nBitMatrix.prototype.set = function (row, col, value, reserved) {\n const index = row * this.size + col\n this.data[index] = value\n if (reserved) this.reservedBit[index] = true\n}\n\n/**\n * Returns bit value at specified location\n *\n * @param {Number} row\n * @param {Number} col\n * @return {Boolean}\n */\nBitMatrix.prototype.get = function (row, col) {\n return this.data[row * this.size + col]\n}\n\n/**\n * Applies xor operator at specified location\n * (used during masking process)\n *\n * @param {Number} row\n * @param {Number} col\n * @param {Boolean} value\n */\nBitMatrix.prototype.xor = function (row, col, value) {\n this.data[row * this.size + col] ^= value\n}\n\n/**\n * Check if bit at specified location is reserved\n *\n * @param {Number} row\n * @param {Number} col\n * @return {Boolean}\n */\nBitMatrix.prototype.isReserved = function (row, col) {\n return this.reservedBit[row * this.size + col]\n}\n\nmodule.exports = BitMatrix\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/bit-matrix.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/byte-data.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/byte-data.js ***!
|
||
\***************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("const encodeUtf8 = __webpack_require__(/*! encode-utf8 */ \"./node_modules/encode-utf8/index.js\")\nconst Mode = __webpack_require__(/*! ./mode */ \"./node_modules/qrcode/lib/core/mode.js\")\n\nfunction ByteData (data) {\n this.mode = Mode.BYTE\n if (typeof (data) === 'string') {\n data = encodeUtf8(data)\n }\n this.data = new Uint8Array(data)\n}\n\nByteData.getBitsLength = function getBitsLength (length) {\n return length * 8\n}\n\nByteData.prototype.getLength = function getLength () {\n return this.data.length\n}\n\nByteData.prototype.getBitsLength = function getBitsLength () {\n return ByteData.getBitsLength(this.data.length)\n}\n\nByteData.prototype.write = function (bitBuffer) {\n for (let i = 0, l = this.data.length; i < l; i++) {\n bitBuffer.put(this.data[i], 8)\n }\n}\n\nmodule.exports = ByteData\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/byte-data.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/error-correction-code.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/error-correction-code.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("const ECLevel = __webpack_require__(/*! ./error-correction-level */ \"./node_modules/qrcode/lib/core/error-correction-level.js\")\r\n\r\nconst EC_BLOCKS_TABLE = [\r\n// L M Q H\r\n 1, 1, 1, 1,\r\n 1, 1, 1, 1,\r\n 1, 1, 2, 2,\r\n 1, 2, 2, 4,\r\n 1, 2, 4, 4,\r\n 2, 4, 4, 4,\r\n 2, 4, 6, 5,\r\n 2, 4, 6, 6,\r\n 2, 5, 8, 8,\r\n 4, 5, 8, 8,\r\n 4, 5, 8, 11,\r\n 4, 8, 10, 11,\r\n 4, 9, 12, 16,\r\n 4, 9, 16, 16,\r\n 6, 10, 12, 18,\r\n 6, 10, 17, 16,\r\n 6, 11, 16, 19,\r\n 6, 13, 18, 21,\r\n 7, 14, 21, 25,\r\n 8, 16, 20, 25,\r\n 8, 17, 23, 25,\r\n 9, 17, 23, 34,\r\n 9, 18, 25, 30,\r\n 10, 20, 27, 32,\r\n 12, 21, 29, 35,\r\n 12, 23, 34, 37,\r\n 12, 25, 34, 40,\r\n 13, 26, 35, 42,\r\n 14, 28, 38, 45,\r\n 15, 29, 40, 48,\r\n 16, 31, 43, 51,\r\n 17, 33, 45, 54,\r\n 18, 35, 48, 57,\r\n 19, 37, 51, 60,\r\n 19, 38, 53, 63,\r\n 20, 40, 56, 66,\r\n 21, 43, 59, 70,\r\n 22, 45, 62, 74,\r\n 24, 47, 65, 77,\r\n 25, 49, 68, 81\r\n]\r\n\r\nconst EC_CODEWORDS_TABLE = [\r\n// L M Q H\r\n 7, 10, 13, 17,\r\n 10, 16, 22, 28,\r\n 15, 26, 36, 44,\r\n 20, 36, 52, 64,\r\n 26, 48, 72, 88,\r\n 36, 64, 96, 112,\r\n 40, 72, 108, 130,\r\n 48, 88, 132, 156,\r\n 60, 110, 160, 192,\r\n 72, 130, 192, 224,\r\n 80, 150, 224, 264,\r\n 96, 176, 260, 308,\r\n 104, 198, 288, 352,\r\n 120, 216, 320, 384,\r\n 132, 240, 360, 432,\r\n 144, 280, 408, 480,\r\n 168, 308, 448, 532,\r\n 180, 338, 504, 588,\r\n 196, 364, 546, 650,\r\n 224, 416, 600, 700,\r\n 224, 442, 644, 750,\r\n 252, 476, 690, 816,\r\n 270, 504, 750, 900,\r\n 300, 560, 810, 960,\r\n 312, 588, 870, 1050,\r\n 336, 644, 952, 1110,\r\n 360, 700, 1020, 1200,\r\n 390, 728, 1050, 1260,\r\n 420, 784, 1140, 1350,\r\n 450, 812, 1200, 1440,\r\n 480, 868, 1290, 1530,\r\n 510, 924, 1350, 1620,\r\n 540, 980, 1440, 1710,\r\n 570, 1036, 1530, 1800,\r\n 570, 1064, 1590, 1890,\r\n 600, 1120, 1680, 1980,\r\n 630, 1204, 1770, 2100,\r\n 660, 1260, 1860, 2220,\r\n 720, 1316, 1950, 2310,\r\n 750, 1372, 2040, 2430\r\n]\r\n\r\n/**\r\n * Returns the number of error correction block that the QR Code should contain\r\n * for the specified version and error correction level.\r\n *\r\n * @param {Number} version QR Code version\r\n * @param {Number} errorCorrectionLevel Error correction level\r\n * @return {Number} Number of error correction blocks\r\n */\r\nexports.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) {\r\n switch (errorCorrectionLevel) {\r\n case ECLevel.L:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]\r\n case ECLevel.M:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]\r\n case ECLevel.Q:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]\r\n case ECLevel.H:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]\r\n default:\r\n return undefined\r\n }\r\n}\r\n\r\n/**\r\n * Returns the number of error correction codewords to use for the specified\r\n * version and error correction level.\r\n *\r\n * @param {Number} version QR Code version\r\n * @param {Number} errorCorrectionLevel Error correction level\r\n * @return {Number} Number of error correction codewords\r\n */\r\nexports.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) {\r\n switch (errorCorrectionLevel) {\r\n case ECLevel.L:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]\r\n case ECLevel.M:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]\r\n case ECLevel.Q:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]\r\n case ECLevel.H:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]\r\n default:\r\n return undefined\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/error-correction-code.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/error-correction-level.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/error-correction-level.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
eval("exports.L = { bit: 1 }\nexports.M = { bit: 0 }\nexports.Q = { bit: 3 }\nexports.H = { bit: 2 }\n\nfunction fromString (string) {\n if (typeof string !== 'string') {\n throw new Error('Param is not a string')\n }\n\n const lcStr = string.toLowerCase()\n\n switch (lcStr) {\n case 'l':\n case 'low':\n return exports.L\n\n case 'm':\n case 'medium':\n return exports.M\n\n case 'q':\n case 'quartile':\n return exports.Q\n\n case 'h':\n case 'high':\n return exports.H\n\n default:\n throw new Error('Unknown EC Level: ' + string)\n }\n}\n\nexports.isValid = function isValid (level) {\n return level && typeof level.bit !== 'undefined' &&\n level.bit >= 0 && level.bit < 4\n}\n\nexports.from = function from (value, defaultValue) {\n if (exports.isValid(value)) {\n return value\n }\n\n try {\n return fromString(value)\n } catch (e) {\n return defaultValue\n }\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/error-correction-level.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/finder-pattern.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/finder-pattern.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("const getSymbolSize = (__webpack_require__(/*! ./utils */ \"./node_modules/qrcode/lib/core/utils.js\").getSymbolSize)\nconst FINDER_PATTERN_SIZE = 7\n\n/**\n * Returns an array containing the positions of each finder pattern.\n * Each array's element represent the top-left point of the pattern as (x, y) coordinates\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinates\n */\nexports.getPositions = function getPositions (version) {\n const size = getSymbolSize(version)\n\n return [\n // top-left\n [0, 0],\n // top-right\n [size - FINDER_PATTERN_SIZE, 0],\n // bottom-left\n [0, size - FINDER_PATTERN_SIZE]\n ]\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/finder-pattern.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/format-info.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/format-info.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("const Utils = __webpack_require__(/*! ./utils */ \"./node_modules/qrcode/lib/core/utils.js\")\n\nconst G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0)\nconst G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1)\nconst G15_BCH = Utils.getBCHDigit(G15)\n\n/**\n * Returns format information with relative error correction bits\n *\n * The format information is a 15-bit sequence containing 5 data bits,\n * with 10 error correction bits calculated using the (15, 5) BCH code.\n *\n * @param {Number} errorCorrectionLevel Error correction level\n * @param {Number} mask Mask pattern\n * @return {Number} Encoded format information bits\n */\nexports.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {\n const data = ((errorCorrectionLevel.bit << 3) | mask)\n let d = data << 10\n\n while (Utils.getBCHDigit(d) - G15_BCH >= 0) {\n d ^= (G15 << (Utils.getBCHDigit(d) - G15_BCH))\n }\n\n // xor final data with mask pattern in order to ensure that\n // no combination of Error Correction Level and data mask pattern\n // will result in an all-zero data string\n return ((data << 10) | d) ^ G15_MASK\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/format-info.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/galois-field.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/galois-field.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
eval("const EXP_TABLE = new Uint8Array(512)\nconst LOG_TABLE = new Uint8Array(256)\n/**\n * Precompute the log and anti-log tables for faster computation later\n *\n * For each possible value in the galois field 2^8, we will pre-compute\n * the logarithm and anti-logarithm (exponential) of this value\n *\n * ref {@link https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Introduction_to_mathematical_fields}\n */\n;(function initTables () {\n let x = 1\n for (let i = 0; i < 255; i++) {\n EXP_TABLE[i] = x\n LOG_TABLE[x] = i\n\n x <<= 1 // multiply by 2\n\n // The QR code specification says to use byte-wise modulo 100011101 arithmetic.\n // This means that when a number is 256 or larger, it should be XORed with 0x11D.\n if (x & 0x100) { // similar to x >= 256, but a lot faster (because 0x100 == 256)\n x ^= 0x11D\n }\n }\n\n // Optimization: double the size of the anti-log table so that we don't need to mod 255 to\n // stay inside the bounds (because we will mainly use this table for the multiplication of\n // two GF numbers, no more).\n // @see {@link mul}\n for (let i = 255; i < 512; i++) {\n EXP_TABLE[i] = EXP_TABLE[i - 255]\n }\n}())\n\n/**\n * Returns log value of n inside Galois Field\n *\n * @param {Number} n\n * @return {Number}\n */\nexports.log = function log (n) {\n if (n < 1) throw new Error('log(' + n + ')')\n return LOG_TABLE[n]\n}\n\n/**\n * Returns anti-log value of n inside Galois Field\n *\n * @param {Number} n\n * @return {Number}\n */\nexports.exp = function exp (n) {\n return EXP_TABLE[n]\n}\n\n/**\n * Multiplies two number inside Galois Field\n *\n * @param {Number} x\n * @param {Number} y\n * @return {Number}\n */\nexports.mul = function mul (x, y) {\n if (x === 0 || y === 0) return 0\n\n // should be EXP_TABLE[(LOG_TABLE[x] + LOG_TABLE[y]) % 255] if EXP_TABLE wasn't oversized\n // @see {@link initTables}\n return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]]\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/galois-field.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/kanji-data.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/kanji-data.js ***!
|
||
\****************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("const Mode = __webpack_require__(/*! ./mode */ \"./node_modules/qrcode/lib/core/mode.js\")\nconst Utils = __webpack_require__(/*! ./utils */ \"./node_modules/qrcode/lib/core/utils.js\")\n\nfunction KanjiData (data) {\n this.mode = Mode.KANJI\n this.data = data\n}\n\nKanjiData.getBitsLength = function getBitsLength (length) {\n return length * 13\n}\n\nKanjiData.prototype.getLength = function getLength () {\n return this.data.length\n}\n\nKanjiData.prototype.getBitsLength = function getBitsLength () {\n return KanjiData.getBitsLength(this.data.length)\n}\n\nKanjiData.prototype.write = function (bitBuffer) {\n let i\n\n // In the Shift JIS system, Kanji characters are represented by a two byte combination.\n // These byte values are shifted from the JIS X 0208 values.\n // JIS X 0208 gives details of the shift coded representation.\n for (i = 0; i < this.data.length; i++) {\n let value = Utils.toSJIS(this.data[i])\n\n // For characters with Shift JIS values from 0x8140 to 0x9FFC:\n if (value >= 0x8140 && value <= 0x9FFC) {\n // Subtract 0x8140 from Shift JIS value\n value -= 0x8140\n\n // For characters with Shift JIS values from 0xE040 to 0xEBBF\n } else if (value >= 0xE040 && value <= 0xEBBF) {\n // Subtract 0xC140 from Shift JIS value\n value -= 0xC140\n } else {\n throw new Error(\n 'Invalid SJIS character: ' + this.data[i] + '\\n' +\n 'Make sure your charset is UTF-8')\n }\n\n // Multiply most significant byte of result by 0xC0\n // and add least significant byte to product\n value = (((value >>> 8) & 0xff) * 0xC0) + (value & 0xff)\n\n // Convert result to a 13-bit binary string\n bitBuffer.put(value, 13)\n }\n}\n\nmodule.exports = KanjiData\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/kanji-data.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/mask-pattern.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/mask-pattern.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
eval("/**\n * Data mask pattern reference\n * @type {Object}\n */\nexports.Patterns = {\n PATTERN000: 0,\n PATTERN001: 1,\n PATTERN010: 2,\n PATTERN011: 3,\n PATTERN100: 4,\n PATTERN101: 5,\n PATTERN110: 6,\n PATTERN111: 7\n}\n\n/**\n * Weighted penalty scores for the undesirable features\n * @type {Object}\n */\nconst PenaltyScores = {\n N1: 3,\n N2: 3,\n N3: 40,\n N4: 10\n}\n\n/**\n * Check if mask pattern value is valid\n *\n * @param {Number} mask Mask pattern\n * @return {Boolean} true if valid, false otherwise\n */\nexports.isValid = function isValid (mask) {\n return mask != null && mask !== '' && !isNaN(mask) && mask >= 0 && mask <= 7\n}\n\n/**\n * Returns mask pattern from a value.\n * If value is not valid, returns undefined\n *\n * @param {Number|String} value Mask pattern value\n * @return {Number} Valid mask pattern or undefined\n */\nexports.from = function from (value) {\n return exports.isValid(value) ? parseInt(value, 10) : undefined\n}\n\n/**\n* Find adjacent modules in row/column with the same color\n* and assign a penalty value.\n*\n* Points: N1 + i\n* i is the amount by which the number of adjacent modules of the same color exceeds 5\n*/\nexports.getPenaltyN1 = function getPenaltyN1 (data) {\n const size = data.size\n let points = 0\n let sameCountCol = 0\n let sameCountRow = 0\n let lastCol = null\n let lastRow = null\n\n for (let row = 0; row < size; row++) {\n sameCountCol = sameCountRow = 0\n lastCol = lastRow = null\n\n for (let col = 0; col < size; col++) {\n let module = data.get(row, col)\n if (module === lastCol) {\n sameCountCol++\n } else {\n if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)\n lastCol = module\n sameCountCol = 1\n }\n\n module = data.get(col, row)\n if (module === lastRow) {\n sameCountRow++\n } else {\n if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)\n lastRow = module\n sameCountRow = 1\n }\n }\n\n if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)\n if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)\n }\n\n return points\n}\n\n/**\n * Find 2x2 blocks with the same color and assign a penalty value\n *\n * Points: N2 * (m - 1) * (n - 1)\n */\nexports.getPenaltyN2 = function getPenaltyN2 (data) {\n const size = data.size\n let points = 0\n\n for (let row = 0; row < size - 1; row++) {\n for (let col = 0; col < size - 1; col++) {\n const last = data.get(row, col) +\n data.get(row, col + 1) +\n data.get(row + 1, col) +\n data.get(row + 1, col + 1)\n\n if (last === 4 || last === 0) points++\n }\n }\n\n return points * PenaltyScores.N2\n}\n\n/**\n * Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,\n * preceded or followed by light area 4 modules wide\n *\n * Points: N3 * number of pattern found\n */\nexports.getPenaltyN3 = function getPenaltyN3 (data) {\n const size = data.size\n let points = 0\n let bitsCol = 0\n let bitsRow = 0\n\n for (let row = 0; row < size; row++) {\n bitsCol = bitsRow = 0\n for (let col = 0; col < size; col++) {\n bitsCol = ((bitsCol << 1) & 0x7FF) | data.get(row, col)\n if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D)) points++\n\n bitsRow = ((bitsRow << 1) & 0x7FF) | data.get(col, row)\n if (col >= 10 && (bitsRow === 0x5D0 || bitsRow === 0x05D)) points++\n }\n }\n\n return points * PenaltyScores.N3\n}\n\n/**\n * Calculate proportion of dark modules in entire symbol\n *\n * Points: N4 * k\n *\n * k is the rating of the deviation of the proportion of dark modules\n * in the symbol from 50% in steps of 5%\n */\nexports.getPenaltyN4 = function getPenaltyN4 (data) {\n let darkCount = 0\n const modulesCount = data.data.length\n\n for (let i = 0; i < modulesCount; i++) darkCount += data.data[i]\n\n const k = Math.abs(Math.ceil((darkCount * 100 / modulesCount) / 5) - 10)\n\n return k * PenaltyScores.N4\n}\n\n/**\n * Return mask value at given position\n *\n * @param {Number} maskPattern Pattern reference value\n * @param {Number} i Row\n * @param {Number} j Column\n * @return {Boolean} Mask value\n */\nfunction getMaskAt (maskPattern, i, j) {\n switch (maskPattern) {\n case exports.Patterns.PATTERN000: return (i + j) % 2 === 0\n case exports.Patterns.PATTERN001: return i % 2 === 0\n case exports.Patterns.PATTERN010: return j % 3 === 0\n case exports.Patterns.PATTERN011: return (i + j) % 3 === 0\n case exports.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0\n case exports.Patterns.PATTERN101: return (i * j) % 2 + (i * j) % 3 === 0\n case exports.Patterns.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 === 0\n case exports.Patterns.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 === 0\n\n default: throw new Error('bad maskPattern:' + maskPattern)\n }\n}\n\n/**\n * Apply a mask pattern to a BitMatrix\n *\n * @param {Number} pattern Pattern reference number\n * @param {BitMatrix} data BitMatrix data\n */\nexports.applyMask = function applyMask (pattern, data) {\n const size = data.size\n\n for (let col = 0; col < size; col++) {\n for (let row = 0; row < size; row++) {\n if (data.isReserved(row, col)) continue\n data.xor(row, col, getMaskAt(pattern, row, col))\n }\n }\n}\n\n/**\n * Returns the best mask pattern for data\n *\n * @param {BitMatrix} data\n * @return {Number} Mask pattern reference number\n */\nexports.getBestMask = function getBestMask (data, setupFormatFunc) {\n const numPatterns = Object.keys(exports.Patterns).length\n let bestPattern = 0\n let lowerPenalty = Infinity\n\n for (let p = 0; p < numPatterns; p++) {\n setupFormatFunc(p)\n exports.applyMask(p, data)\n\n // Calculate penalty\n const penalty =\n exports.getPenaltyN1(data) +\n exports.getPenaltyN2(data) +\n exports.getPenaltyN3(data) +\n exports.getPenaltyN4(data)\n\n // Undo previously applied mask\n exports.applyMask(p, data)\n\n if (penalty < lowerPenalty) {\n lowerPenalty = penalty\n bestPattern = p\n }\n }\n\n return bestPattern\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/mask-pattern.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/mode.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/mode.js ***!
|
||
\**********************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("const VersionCheck = __webpack_require__(/*! ./version-check */ \"./node_modules/qrcode/lib/core/version-check.js\")\nconst Regex = __webpack_require__(/*! ./regex */ \"./node_modules/qrcode/lib/core/regex.js\")\n\n/**\n * Numeric mode encodes data from the decimal digit set (0 - 9)\n * (byte values 30HEX to 39HEX).\n * Normally, 3 data characters are represented by 10 bits.\n *\n * @type {Object}\n */\nexports.NUMERIC = {\n id: 'Numeric',\n bit: 1 << 0,\n ccBits: [10, 12, 14]\n}\n\n/**\n * Alphanumeric mode encodes data from a set of 45 characters,\n * i.e. 10 numeric digits (0 - 9),\n * 26 alphabetic characters (A - Z),\n * and 9 symbols (SP, $, %, *, +, -, ., /, :).\n * Normally, two input characters are represented by 11 bits.\n *\n * @type {Object}\n */\nexports.ALPHANUMERIC = {\n id: 'Alphanumeric',\n bit: 1 << 1,\n ccBits: [9, 11, 13]\n}\n\n/**\n * In byte mode, data is encoded at 8 bits per character.\n *\n * @type {Object}\n */\nexports.BYTE = {\n id: 'Byte',\n bit: 1 << 2,\n ccBits: [8, 16, 16]\n}\n\n/**\n * The Kanji mode efficiently encodes Kanji characters in accordance with\n * the Shift JIS system based on JIS X 0208.\n * The Shift JIS values are shifted from the JIS X 0208 values.\n * JIS X 0208 gives details of the shift coded representation.\n * Each two-byte character value is compacted to a 13-bit binary codeword.\n *\n * @type {Object}\n */\nexports.KANJI = {\n id: 'Kanji',\n bit: 1 << 3,\n ccBits: [8, 10, 12]\n}\n\n/**\n * Mixed mode will contain a sequences of data in a combination of any of\n * the modes described above\n *\n * @type {Object}\n */\nexports.MIXED = {\n bit: -1\n}\n\n/**\n * Returns the number of bits needed to store the data length\n * according to QR Code specifications.\n *\n * @param {Mode} mode Data mode\n * @param {Number} version QR Code version\n * @return {Number} Number of bits\n */\nexports.getCharCountIndicator = function getCharCountIndicator (mode, version) {\n if (!mode.ccBits) throw new Error('Invalid mode: ' + mode)\n\n if (!VersionCheck.isValid(version)) {\n throw new Error('Invalid version: ' + version)\n }\n\n if (version >= 1 && version < 10) return mode.ccBits[0]\n else if (version < 27) return mode.ccBits[1]\n return mode.ccBits[2]\n}\n\n/**\n * Returns the most efficient mode to store the specified data\n *\n * @param {String} dataStr Input data string\n * @return {Mode} Best mode\n */\nexports.getBestModeForData = function getBestModeForData (dataStr) {\n if (Regex.testNumeric(dataStr)) return exports.NUMERIC\n else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC\n else if (Regex.testKanji(dataStr)) return exports.KANJI\n else return exports.BYTE\n}\n\n/**\n * Return mode name as string\n *\n * @param {Mode} mode Mode object\n * @returns {String} Mode name\n */\nexports.toString = function toString (mode) {\n if (mode && mode.id) return mode.id\n throw new Error('Invalid mode')\n}\n\n/**\n * Check if input param is a valid mode object\n *\n * @param {Mode} mode Mode object\n * @returns {Boolean} True if valid mode, false otherwise\n */\nexports.isValid = function isValid (mode) {\n return mode && mode.bit && mode.ccBits\n}\n\n/**\n * Get mode object from its name\n *\n * @param {String} string Mode name\n * @returns {Mode} Mode object\n */\nfunction fromString (string) {\n if (typeof string !== 'string') {\n throw new Error('Param is not a string')\n }\n\n const lcStr = string.toLowerCase()\n\n switch (lcStr) {\n case 'numeric':\n return exports.NUMERIC\n case 'alphanumeric':\n return exports.ALPHANUMERIC\n case 'kanji':\n return exports.KANJI\n case 'byte':\n return exports.BYTE\n default:\n throw new Error('Unknown mode: ' + string)\n }\n}\n\n/**\n * Returns mode from a value.\n * If value is not a valid mode, returns defaultValue\n *\n * @param {Mode|String} value Encoding mode\n * @param {Mode} defaultValue Fallback value\n * @return {Mode} Encoding mode\n */\nexports.from = function from (value, defaultValue) {\n if (exports.isValid(value)) {\n return value\n }\n\n try {\n return fromString(value)\n } catch (e) {\n return defaultValue\n }\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/mode.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/numeric-data.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/numeric-data.js ***!
|
||
\******************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("const Mode = __webpack_require__(/*! ./mode */ \"./node_modules/qrcode/lib/core/mode.js\")\n\nfunction NumericData (data) {\n this.mode = Mode.NUMERIC\n this.data = data.toString()\n}\n\nNumericData.getBitsLength = function getBitsLength (length) {\n return 10 * Math.floor(length / 3) + ((length % 3) ? ((length % 3) * 3 + 1) : 0)\n}\n\nNumericData.prototype.getLength = function getLength () {\n return this.data.length\n}\n\nNumericData.prototype.getBitsLength = function getBitsLength () {\n return NumericData.getBitsLength(this.data.length)\n}\n\nNumericData.prototype.write = function write (bitBuffer) {\n let i, group, value\n\n // The input data string is divided into groups of three digits,\n // and each group is converted to its 10-bit binary equivalent.\n for (i = 0; i + 3 <= this.data.length; i += 3) {\n group = this.data.substr(i, 3)\n value = parseInt(group, 10)\n\n bitBuffer.put(value, 10)\n }\n\n // If the number of input digits is not an exact multiple of three,\n // the final one or two digits are converted to 4 or 7 bits respectively.\n const remainingNum = this.data.length - i\n if (remainingNum > 0) {\n group = this.data.substr(i)\n value = parseInt(group, 10)\n\n bitBuffer.put(value, remainingNum * 3 + 1)\n }\n}\n\nmodule.exports = NumericData\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/numeric-data.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/polynomial.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/polynomial.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("const GF = __webpack_require__(/*! ./galois-field */ \"./node_modules/qrcode/lib/core/galois-field.js\")\n\n/**\n * Multiplies two polynomials inside Galois Field\n *\n * @param {Uint8Array} p1 Polynomial\n * @param {Uint8Array} p2 Polynomial\n * @return {Uint8Array} Product of p1 and p2\n */\nexports.mul = function mul (p1, p2) {\n const coeff = new Uint8Array(p1.length + p2.length - 1)\n\n for (let i = 0; i < p1.length; i++) {\n for (let j = 0; j < p2.length; j++) {\n coeff[i + j] ^= GF.mul(p1[i], p2[j])\n }\n }\n\n return coeff\n}\n\n/**\n * Calculate the remainder of polynomials division\n *\n * @param {Uint8Array} divident Polynomial\n * @param {Uint8Array} divisor Polynomial\n * @return {Uint8Array} Remainder\n */\nexports.mod = function mod (divident, divisor) {\n let result = new Uint8Array(divident)\n\n while ((result.length - divisor.length) >= 0) {\n const coeff = result[0]\n\n for (let i = 0; i < divisor.length; i++) {\n result[i] ^= GF.mul(divisor[i], coeff)\n }\n\n // remove all zeros from buffer head\n let offset = 0\n while (offset < result.length && result[offset] === 0) offset++\n result = result.slice(offset)\n }\n\n return result\n}\n\n/**\n * Generate an irreducible generator polynomial of specified degree\n * (used by Reed-Solomon encoder)\n *\n * @param {Number} degree Degree of the generator polynomial\n * @return {Uint8Array} Buffer containing polynomial coefficients\n */\nexports.generateECPolynomial = function generateECPolynomial (degree) {\n let poly = new Uint8Array([1])\n for (let i = 0; i < degree; i++) {\n poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]))\n }\n\n return poly\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/polynomial.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/qrcode.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/qrcode.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("const Utils = __webpack_require__(/*! ./utils */ \"./node_modules/qrcode/lib/core/utils.js\")\nconst ECLevel = __webpack_require__(/*! ./error-correction-level */ \"./node_modules/qrcode/lib/core/error-correction-level.js\")\nconst BitBuffer = __webpack_require__(/*! ./bit-buffer */ \"./node_modules/qrcode/lib/core/bit-buffer.js\")\nconst BitMatrix = __webpack_require__(/*! ./bit-matrix */ \"./node_modules/qrcode/lib/core/bit-matrix.js\")\nconst AlignmentPattern = __webpack_require__(/*! ./alignment-pattern */ \"./node_modules/qrcode/lib/core/alignment-pattern.js\")\nconst FinderPattern = __webpack_require__(/*! ./finder-pattern */ \"./node_modules/qrcode/lib/core/finder-pattern.js\")\nconst MaskPattern = __webpack_require__(/*! ./mask-pattern */ \"./node_modules/qrcode/lib/core/mask-pattern.js\")\nconst ECCode = __webpack_require__(/*! ./error-correction-code */ \"./node_modules/qrcode/lib/core/error-correction-code.js\")\nconst ReedSolomonEncoder = __webpack_require__(/*! ./reed-solomon-encoder */ \"./node_modules/qrcode/lib/core/reed-solomon-encoder.js\")\nconst Version = __webpack_require__(/*! ./version */ \"./node_modules/qrcode/lib/core/version.js\")\nconst FormatInfo = __webpack_require__(/*! ./format-info */ \"./node_modules/qrcode/lib/core/format-info.js\")\nconst Mode = __webpack_require__(/*! ./mode */ \"./node_modules/qrcode/lib/core/mode.js\")\nconst Segments = __webpack_require__(/*! ./segments */ \"./node_modules/qrcode/lib/core/segments.js\")\n\n/**\n * QRCode for JavaScript\n *\n * modified by Ryan Day for nodejs support\n * Copyright (c) 2011 Ryan Day\n *\n * Licensed under the MIT license:\n * http://www.opensource.org/licenses/mit-license.php\n *\n//---------------------------------------------------------------------\n// QRCode for JavaScript\n//\n// Copyright (c) 2009 Kazuhiko Arase\n//\n// URL: http://www.d-project.com/\n//\n// Licensed under the MIT license:\n// http://www.opensource.org/licenses/mit-license.php\n//\n// The word \"QR Code\" is registered trademark of\n// DENSO WAVE INCORPORATED\n// http://www.denso-wave.com/qrcode/faqpatent-e.html\n//\n//---------------------------------------------------------------------\n*/\n\n/**\n * Add finder patterns bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupFinderPattern (matrix, version) {\n const size = matrix.size\n const pos = FinderPattern.getPositions(version)\n\n for (let i = 0; i < pos.length; i++) {\n const row = pos[i][0]\n const col = pos[i][1]\n\n for (let r = -1; r <= 7; r++) {\n if (row + r <= -1 || size <= row + r) continue\n\n for (let c = -1; c <= 7; c++) {\n if (col + c <= -1 || size <= col + c) continue\n\n if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||\n (c >= 0 && c <= 6 && (r === 0 || r === 6)) ||\n (r >= 2 && r <= 4 && c >= 2 && c <= 4)) {\n matrix.set(row + r, col + c, true, true)\n } else {\n matrix.set(row + r, col + c, false, true)\n }\n }\n }\n }\n}\n\n/**\n * Add timing pattern bits to matrix\n *\n * Note: this function must be called before {@link setupAlignmentPattern}\n *\n * @param {BitMatrix} matrix Modules matrix\n */\nfunction setupTimingPattern (matrix) {\n const size = matrix.size\n\n for (let r = 8; r < size - 8; r++) {\n const value = r % 2 === 0\n matrix.set(r, 6, value, true)\n matrix.set(6, r, value, true)\n }\n}\n\n/**\n * Add alignment patterns bits to matrix\n *\n * Note: this function must be called after {@link setupTimingPattern}\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupAlignmentPattern (matrix, version) {\n const pos = AlignmentPattern.getPositions(version)\n\n for (let i = 0; i < pos.length; i++) {\n const row = pos[i][0]\n const col = pos[i][1]\n\n for (let r = -2; r <= 2; r++) {\n for (let c = -2; c <= 2; c++) {\n if (r === -2 || r === 2 || c === -2 || c === 2 ||\n (r === 0 && c === 0)) {\n matrix.set(row + r, col + c, true, true)\n } else {\n matrix.set(row + r, col + c, false, true)\n }\n }\n }\n }\n}\n\n/**\n * Add version info bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupVersionInfo (matrix, version) {\n const size = matrix.size\n const bits = Version.getEncodedBits(version)\n let row, col, mod\n\n for (let i = 0; i < 18; i++) {\n row = Math.floor(i / 3)\n col = i % 3 + size - 8 - 3\n mod = ((bits >> i) & 1) === 1\n\n matrix.set(row, col, mod, true)\n matrix.set(col, row, mod, true)\n }\n}\n\n/**\n * Add format info bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @param {Number} maskPattern Mask pattern reference value\n */\nfunction setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {\n const size = matrix.size\n const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern)\n let i, mod\n\n for (i = 0; i < 15; i++) {\n mod = ((bits >> i) & 1) === 1\n\n // vertical\n if (i < 6) {\n matrix.set(i, 8, mod, true)\n } else if (i < 8) {\n matrix.set(i + 1, 8, mod, true)\n } else {\n matrix.set(size - 15 + i, 8, mod, true)\n }\n\n // horizontal\n if (i < 8) {\n matrix.set(8, size - i - 1, mod, true)\n } else if (i < 9) {\n matrix.set(8, 15 - i - 1 + 1, mod, true)\n } else {\n matrix.set(8, 15 - i - 1, mod, true)\n }\n }\n\n // fixed module\n matrix.set(size - 8, 8, 1, true)\n}\n\n/**\n * Add encoded data bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Uint8Array} data Data codewords\n */\nfunction setupData (matrix, data) {\n const size = matrix.size\n let inc = -1\n let row = size - 1\n let bitIndex = 7\n let byteIndex = 0\n\n for (let col = size - 1; col > 0; col -= 2) {\n if (col === 6) col--\n\n while (true) {\n for (let c = 0; c < 2; c++) {\n if (!matrix.isReserved(row, col - c)) {\n let dark = false\n\n if (byteIndex < data.length) {\n dark = (((data[byteIndex] >>> bitIndex) & 1) === 1)\n }\n\n matrix.set(row, col - c, dark)\n bitIndex--\n\n if (bitIndex === -1) {\n byteIndex++\n bitIndex = 7\n }\n }\n }\n\n row += inc\n\n if (row < 0 || size <= row) {\n row -= inc\n inc = -inc\n break\n }\n }\n }\n}\n\n/**\n * Create encoded codewords from data input\n *\n * @param {Number} version QR Code version\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @param {ByteData} data Data input\n * @return {Uint8Array} Buffer containing encoded codewords\n */\nfunction createData (version, errorCorrectionLevel, segments) {\n // Prepare data buffer\n const buffer = new BitBuffer()\n\n segments.forEach(function (data) {\n // prefix data with mode indicator (4 bits)\n buffer.put(data.mode.bit, 4)\n\n // Prefix data with character count indicator.\n // The character count indicator is a string of bits that represents the\n // number of characters that are being encoded.\n // The character count indicator must be placed after the mode indicator\n // and must be a certain number of bits long, depending on the QR version\n // and data mode\n // @see {@link Mode.getCharCountIndicator}.\n buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version))\n\n // add binary data sequence to buffer\n data.write(buffer)\n })\n\n // Calculate required number of bits\n const totalCodewords = Utils.getSymbolTotalCodewords(version)\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)\n const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8\n\n // Add a terminator.\n // If the bit string is shorter than the total number of required bits,\n // a terminator of up to four 0s must be added to the right side of the string.\n // If the bit string is more than four bits shorter than the required number of bits,\n // add four 0s to the end.\n if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {\n buffer.put(0, 4)\n }\n\n // If the bit string is fewer than four bits shorter, add only the number of 0s that\n // are needed to reach the required number of bits.\n\n // After adding the terminator, if the number of bits in the string is not a multiple of 8,\n // pad the string on the right with 0s to make the string's length a multiple of 8.\n while (buffer.getLengthInBits() % 8 !== 0) {\n buffer.putBit(0)\n }\n\n // Add pad bytes if the string is still shorter than the total number of required bits.\n // Extend the buffer to fill the data capacity of the symbol corresponding to\n // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)\n // and 00010001 (0x11) alternately.\n const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8\n for (let i = 0; i < remainingByte; i++) {\n buffer.put(i % 2 ? 0x11 : 0xEC, 8)\n }\n\n return createCodewords(buffer, version, errorCorrectionLevel)\n}\n\n/**\n * Encode input data with Reed-Solomon and return codewords with\n * relative error correction bits\n *\n * @param {BitBuffer} bitBuffer Data to encode\n * @param {Number} version QR Code version\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @return {Uint8Array} Buffer containing encoded codewords\n */\nfunction createCodewords (bitBuffer, version, errorCorrectionLevel) {\n // Total codewords for this QR code version (Data + Error correction)\n const totalCodewords = Utils.getSymbolTotalCodewords(version)\n\n // Total number of error correction codewords\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)\n\n // Total number of data codewords\n const dataTotalCodewords = totalCodewords - ecTotalCodewords\n\n // Total number of blocks\n const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel)\n\n // Calculate how many blocks each group should contain\n const blocksInGroup2 = totalCodewords % ecTotalBlocks\n const blocksInGroup1 = ecTotalBlocks - blocksInGroup2\n\n const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks)\n\n const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks)\n const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1\n\n // Number of EC codewords is the same for both groups\n const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1\n\n // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount\n const rs = new ReedSolomonEncoder(ecCount)\n\n let offset = 0\n const dcData = new Array(ecTotalBlocks)\n const ecData = new Array(ecTotalBlocks)\n let maxDataSize = 0\n const buffer = new Uint8Array(bitBuffer.buffer)\n\n // Divide the buffer into the required number of blocks\n for (let b = 0; b < ecTotalBlocks; b++) {\n const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2\n\n // extract a block of data from buffer\n dcData[b] = buffer.slice(offset, offset + dataSize)\n\n // Calculate EC codewords for this data block\n ecData[b] = rs.encode(dcData[b])\n\n offset += dataSize\n maxDataSize = Math.max(maxDataSize, dataSize)\n }\n\n // Create final data\n // Interleave the data and error correction codewords from each block\n const data = new Uint8Array(totalCodewords)\n let index = 0\n let i, r\n\n // Add data codewords\n for (i = 0; i < maxDataSize; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n if (i < dcData[r].length) {\n data[index++] = dcData[r][i]\n }\n }\n }\n\n // Apped EC codewords\n for (i = 0; i < ecCount; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n data[index++] = ecData[r][i]\n }\n }\n\n return data\n}\n\n/**\n * Build QR Code symbol\n *\n * @param {String} data Input string\n * @param {Number} version QR Code version\n * @param {ErrorCorretionLevel} errorCorrectionLevel Error level\n * @param {MaskPattern} maskPattern Mask pattern\n * @return {Object} Object containing symbol data\n */\nfunction createSymbol (data, version, errorCorrectionLevel, maskPattern) {\n let segments\n\n if (Array.isArray(data)) {\n segments = Segments.fromArray(data)\n } else if (typeof data === 'string') {\n let estimatedVersion = version\n\n if (!estimatedVersion) {\n const rawSegments = Segments.rawSplit(data)\n\n // Estimate best version that can contain raw splitted segments\n estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel)\n }\n\n // Build optimized segments\n // If estimated version is undefined, try with the highest version\n segments = Segments.fromString(data, estimatedVersion || 40)\n } else {\n throw new Error('Invalid data')\n }\n\n // Get the min version that can contain data\n const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel)\n\n // If no version is found, data cannot be stored\n if (!bestVersion) {\n throw new Error('The amount of data is too big to be stored in a QR Code')\n }\n\n // If not specified, use min version as default\n if (!version) {\n version = bestVersion\n\n // Check if the specified version can contain the data\n } else if (version < bestVersion) {\n throw new Error('\\n' +\n 'The chosen QR Code version cannot contain this amount of data.\\n' +\n 'Minimum version required to store current data is: ' + bestVersion + '.\\n'\n )\n }\n\n const dataBits = createData(version, errorCorrectionLevel, segments)\n\n // Allocate matrix buffer\n const moduleCount = Utils.getSymbolSize(version)\n const modules = new BitMatrix(moduleCount)\n\n // Add function modules\n setupFinderPattern(modules, version)\n setupTimingPattern(modules)\n setupAlignmentPattern(modules, version)\n\n // Add temporary dummy bits for format info just to set them as reserved.\n // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask}\n // since the masking operation must be performed only on the encoding region.\n // These blocks will be replaced with correct values later in code.\n setupFormatInfo(modules, errorCorrectionLevel, 0)\n\n if (version >= 7) {\n setupVersionInfo(modules, version)\n }\n\n // Add data codewords\n setupData(modules, dataBits)\n\n if (isNaN(maskPattern)) {\n // Find best mask pattern\n maskPattern = MaskPattern.getBestMask(modules,\n setupFormatInfo.bind(null, modules, errorCorrectionLevel))\n }\n\n // Apply mask pattern\n MaskPattern.applyMask(maskPattern, modules)\n\n // Replace format info bits with correct values\n setupFormatInfo(modules, errorCorrectionLevel, maskPattern)\n\n return {\n modules: modules,\n version: version,\n errorCorrectionLevel: errorCorrectionLevel,\n maskPattern: maskPattern,\n segments: segments\n }\n}\n\n/**\n * QR Code\n *\n * @param {String | Array} data Input data\n * @param {Object} options Optional configurations\n * @param {Number} options.version QR Code version\n * @param {String} options.errorCorrectionLevel Error correction level\n * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis\n */\nexports.create = function create (data, options) {\n if (typeof data === 'undefined' || data === '') {\n throw new Error('No input text')\n }\n\n let errorCorrectionLevel = ECLevel.M\n let version\n let mask\n\n if (typeof options !== 'undefined') {\n // Use higher error correction level as default\n errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M)\n version = Version.from(options.version)\n mask = MaskPattern.from(options.maskPattern)\n\n if (options.toSJISFunc) {\n Utils.setToSJISFunction(options.toSJISFunc)\n }\n }\n\n return createSymbol(data, version, errorCorrectionLevel, mask)\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/qrcode.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/reed-solomon-encoder.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/reed-solomon-encoder.js ***!
|
||
\**************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("const Polynomial = __webpack_require__(/*! ./polynomial */ \"./node_modules/qrcode/lib/core/polynomial.js\")\n\nfunction ReedSolomonEncoder (degree) {\n this.genPoly = undefined\n this.degree = degree\n\n if (this.degree) this.initialize(this.degree)\n}\n\n/**\n * Initialize the encoder.\n * The input param should correspond to the number of error correction codewords.\n *\n * @param {Number} degree\n */\nReedSolomonEncoder.prototype.initialize = function initialize (degree) {\n // create an irreducible generator polynomial\n this.degree = degree\n this.genPoly = Polynomial.generateECPolynomial(this.degree)\n}\n\n/**\n * Encodes a chunk of data\n *\n * @param {Uint8Array} data Buffer containing input data\n * @return {Uint8Array} Buffer containing encoded data\n */\nReedSolomonEncoder.prototype.encode = function encode (data) {\n if (!this.genPoly) {\n throw new Error('Encoder not initialized')\n }\n\n // Calculate EC for this data block\n // extends data size to data+genPoly size\n const paddedData = new Uint8Array(data.length + this.degree)\n paddedData.set(data)\n\n // The error correction codewords are the remainder after dividing the data codewords\n // by a generator polynomial\n const remainder = Polynomial.mod(paddedData, this.genPoly)\n\n // return EC data blocks (last n byte, where n is the degree of genPoly)\n // If coefficients number in remainder are less than genPoly degree,\n // pad with 0s to the left to reach the needed number of coefficients\n const start = this.degree - remainder.length\n if (start > 0) {\n const buff = new Uint8Array(this.degree)\n buff.set(remainder, start)\n\n return buff\n }\n\n return remainder\n}\n\nmodule.exports = ReedSolomonEncoder\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/reed-solomon-encoder.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/regex.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/regex.js ***!
|
||
\***********************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
eval("const numeric = '[0-9]+'\nconst alphanumeric = '[A-Z $%*+\\\\-./:]+'\nlet kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +\n '[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +\n '[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +\n '[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+'\nkanji = kanji.replace(/u/g, '\\\\u')\n\nconst byte = '(?:(?![A-Z0-9 $%*+\\\\-./:]|' + kanji + ')(?:.|[\\r\\n]))+'\n\nexports.KANJI = new RegExp(kanji, 'g')\nexports.BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\\\-./:]+', 'g')\nexports.BYTE = new RegExp(byte, 'g')\nexports.NUMERIC = new RegExp(numeric, 'g')\nexports.ALPHANUMERIC = new RegExp(alphanumeric, 'g')\n\nconst TEST_KANJI = new RegExp('^' + kanji + '$')\nconst TEST_NUMERIC = new RegExp('^' + numeric + '$')\nconst TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\\\-./:]+$')\n\nexports.testKanji = function testKanji (str) {\n return TEST_KANJI.test(str)\n}\n\nexports.testNumeric = function testNumeric (str) {\n return TEST_NUMERIC.test(str)\n}\n\nexports.testAlphanumeric = function testAlphanumeric (str) {\n return TEST_ALPHANUMERIC.test(str)\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/regex.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/segments.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/segments.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("const Mode = __webpack_require__(/*! ./mode */ \"./node_modules/qrcode/lib/core/mode.js\")\nconst NumericData = __webpack_require__(/*! ./numeric-data */ \"./node_modules/qrcode/lib/core/numeric-data.js\")\nconst AlphanumericData = __webpack_require__(/*! ./alphanumeric-data */ \"./node_modules/qrcode/lib/core/alphanumeric-data.js\")\nconst ByteData = __webpack_require__(/*! ./byte-data */ \"./node_modules/qrcode/lib/core/byte-data.js\")\nconst KanjiData = __webpack_require__(/*! ./kanji-data */ \"./node_modules/qrcode/lib/core/kanji-data.js\")\nconst Regex = __webpack_require__(/*! ./regex */ \"./node_modules/qrcode/lib/core/regex.js\")\nconst Utils = __webpack_require__(/*! ./utils */ \"./node_modules/qrcode/lib/core/utils.js\")\nconst dijkstra = __webpack_require__(/*! dijkstrajs */ \"./node_modules/dijkstrajs/dijkstra.js\")\n\n/**\n * Returns UTF8 byte length\n *\n * @param {String} str Input string\n * @return {Number} Number of byte\n */\nfunction getStringByteLength (str) {\n return unescape(encodeURIComponent(str)).length\n}\n\n/**\n * Get a list of segments of the specified mode\n * from a string\n *\n * @param {Mode} mode Segment mode\n * @param {String} str String to process\n * @return {Array} Array of object with segments data\n */\nfunction getSegments (regex, mode, str) {\n const segments = []\n let result\n\n while ((result = regex.exec(str)) !== null) {\n segments.push({\n data: result[0],\n index: result.index,\n mode: mode,\n length: result[0].length\n })\n }\n\n return segments\n}\n\n/**\n * Extracts a series of segments with the appropriate\n * modes from a string\n *\n * @param {String} dataStr Input string\n * @return {Array} Array of object with segments data\n */\nfunction getSegmentsFromString (dataStr) {\n const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr)\n const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr)\n let byteSegs\n let kanjiSegs\n\n if (Utils.isKanjiModeEnabled()) {\n byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr)\n kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr)\n } else {\n byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr)\n kanjiSegs = []\n }\n\n const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs)\n\n return segs\n .sort(function (s1, s2) {\n return s1.index - s2.index\n })\n .map(function (obj) {\n return {\n data: obj.data,\n mode: obj.mode,\n length: obj.length\n }\n })\n}\n\n/**\n * Returns how many bits are needed to encode a string of\n * specified length with the specified mode\n *\n * @param {Number} length String length\n * @param {Mode} mode Segment mode\n * @return {Number} Bit length\n */\nfunction getSegmentBitsLength (length, mode) {\n switch (mode) {\n case Mode.NUMERIC:\n return NumericData.getBitsLength(length)\n case Mode.ALPHANUMERIC:\n return AlphanumericData.getBitsLength(length)\n case Mode.KANJI:\n return KanjiData.getBitsLength(length)\n case Mode.BYTE:\n return ByteData.getBitsLength(length)\n }\n}\n\n/**\n * Merges adjacent segments which have the same mode\n *\n * @param {Array} segs Array of object with segments data\n * @return {Array} Array of object with segments data\n */\nfunction mergeSegments (segs) {\n return segs.reduce(function (acc, curr) {\n const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null\n if (prevSeg && prevSeg.mode === curr.mode) {\n acc[acc.length - 1].data += curr.data\n return acc\n }\n\n acc.push(curr)\n return acc\n }, [])\n}\n\n/**\n * Generates a list of all possible nodes combination which\n * will be used to build a segments graph.\n *\n * Nodes are divided by groups. Each group will contain a list of all the modes\n * in which is possible to encode the given text.\n *\n * For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte.\n * The group for '12345' will contain then 3 objects, one for each\n * possible encoding mode.\n *\n * Each node represents a possible segment.\n *\n * @param {Array} segs Array of object with segments data\n * @return {Array} Array of object with segments data\n */\nfunction buildNodes (segs) {\n const nodes = []\n for (let i = 0; i < segs.length; i++) {\n const seg = segs[i]\n\n switch (seg.mode) {\n case Mode.NUMERIC:\n nodes.push([seg,\n { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },\n { data: seg.data, mode: Mode.BYTE, length: seg.length }\n ])\n break\n case Mode.ALPHANUMERIC:\n nodes.push([seg,\n { data: seg.data, mode: Mode.BYTE, length: seg.length }\n ])\n break\n case Mode.KANJI:\n nodes.push([seg,\n { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }\n ])\n break\n case Mode.BYTE:\n nodes.push([\n { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }\n ])\n }\n }\n\n return nodes\n}\n\n/**\n * Builds a graph from a list of nodes.\n * All segments in each node group will be connected with all the segments of\n * the next group and so on.\n *\n * At each connection will be assigned a weight depending on the\n * segment's byte length.\n *\n * @param {Array} nodes Array of object with segments data\n * @param {Number} version QR Code version\n * @return {Object} Graph of all possible segments\n */\nfunction buildGraph (nodes, version) {\n const table = {}\n const graph = { start: {} }\n let prevNodeIds = ['start']\n\n for (let i = 0; i < nodes.length; i++) {\n const nodeGroup = nodes[i]\n const currentNodeIds = []\n\n for (let j = 0; j < nodeGroup.length; j++) {\n const node = nodeGroup[j]\n const key = '' + i + j\n\n currentNodeIds.push(key)\n table[key] = { node: node, lastCount: 0 }\n graph[key] = {}\n\n for (let n = 0; n < prevNodeIds.length; n++) {\n const prevNodeId = prevNodeIds[n]\n\n if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {\n graph[prevNodeId][key] =\n getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) -\n getSegmentBitsLength(table[prevNodeId].lastCount, node.mode)\n\n table[prevNodeId].lastCount += node.length\n } else {\n if (table[prevNodeId]) table[prevNodeId].lastCount = node.length\n\n graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) +\n 4 + Mode.getCharCountIndicator(node.mode, version) // switch cost\n }\n }\n }\n\n prevNodeIds = currentNodeIds\n }\n\n for (let n = 0; n < prevNodeIds.length; n++) {\n graph[prevNodeIds[n]].end = 0\n }\n\n return { map: graph, table: table }\n}\n\n/**\n * Builds a segment from a specified data and mode.\n * If a mode is not specified, the more suitable will be used.\n *\n * @param {String} data Input data\n * @param {Mode | String} modesHint Data mode\n * @return {Segment} Segment\n */\nfunction buildSingleSegment (data, modesHint) {\n let mode\n const bestMode = Mode.getBestModeForData(data)\n\n mode = Mode.from(modesHint, bestMode)\n\n // Make sure data can be encoded\n if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {\n throw new Error('\"' + data + '\"' +\n ' cannot be encoded with mode ' + Mode.toString(mode) +\n '.\\n Suggested mode is: ' + Mode.toString(bestMode))\n }\n\n // Use Mode.BYTE if Kanji support is disabled\n if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {\n mode = Mode.BYTE\n }\n\n switch (mode) {\n case Mode.NUMERIC:\n return new NumericData(data)\n\n case Mode.ALPHANUMERIC:\n return new AlphanumericData(data)\n\n case Mode.KANJI:\n return new KanjiData(data)\n\n case Mode.BYTE:\n return new ByteData(data)\n }\n}\n\n/**\n * Builds a list of segments from an array.\n * Array can contain Strings or Objects with segment's info.\n *\n * For each item which is a string, will be generated a segment with the given\n * string and the more appropriate encoding mode.\n *\n * For each item which is an object, will be generated a segment with the given\n * data and mode.\n * Objects must contain at least the property \"data\".\n * If property \"mode\" is not present, the more suitable mode will be used.\n *\n * @param {Array} array Array of objects with segments data\n * @return {Array} Array of Segments\n */\nexports.fromArray = function fromArray (array) {\n return array.reduce(function (acc, seg) {\n if (typeof seg === 'string') {\n acc.push(buildSingleSegment(seg, null))\n } else if (seg.data) {\n acc.push(buildSingleSegment(seg.data, seg.mode))\n }\n\n return acc\n }, [])\n}\n\n/**\n * Builds an optimized sequence of segments from a string,\n * which will produce the shortest possible bitstream.\n *\n * @param {String} data Input string\n * @param {Number} version QR Code version\n * @return {Array} Array of segments\n */\nexports.fromString = function fromString (data, version) {\n const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled())\n\n const nodes = buildNodes(segs)\n const graph = buildGraph(nodes, version)\n const path = dijkstra.find_path(graph.map, 'start', 'end')\n\n const optimizedSegs = []\n for (let i = 1; i < path.length - 1; i++) {\n optimizedSegs.push(graph.table[path[i]].node)\n }\n\n return exports.fromArray(mergeSegments(optimizedSegs))\n}\n\n/**\n * Splits a string in various segments with the modes which\n * best represent their content.\n * The produced segments are far from being optimized.\n * The output of this function is only used to estimate a QR Code version\n * which may contain the data.\n *\n * @param {string} data Input string\n * @return {Array} Array of segments\n */\nexports.rawSplit = function rawSplit (data) {\n return exports.fromArray(\n getSegmentsFromString(data, Utils.isKanjiModeEnabled())\n )\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/segments.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/utils.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/utils.js ***!
|
||
\***********************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
eval("let toSJISFunction\nconst CODEWORDS_COUNT = [\n 0, // Not used\n 26, 44, 70, 100, 134, 172, 196, 242, 292, 346,\n 404, 466, 532, 581, 655, 733, 815, 901, 991, 1085,\n 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185,\n 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706\n]\n\n/**\n * Returns the QR Code size for the specified version\n *\n * @param {Number} version QR Code version\n * @return {Number} size of QR code\n */\nexports.getSymbolSize = function getSymbolSize (version) {\n if (!version) throw new Error('\"version\" cannot be null or undefined')\n if (version < 1 || version > 40) throw new Error('\"version\" should be in range from 1 to 40')\n return version * 4 + 17\n}\n\n/**\n * Returns the total number of codewords used to store data and EC information.\n *\n * @param {Number} version QR Code version\n * @return {Number} Data length in bits\n */\nexports.getSymbolTotalCodewords = function getSymbolTotalCodewords (version) {\n return CODEWORDS_COUNT[version]\n}\n\n/**\n * Encode data with Bose-Chaudhuri-Hocquenghem\n *\n * @param {Number} data Value to encode\n * @return {Number} Encoded value\n */\nexports.getBCHDigit = function (data) {\n let digit = 0\n\n while (data !== 0) {\n digit++\n data >>>= 1\n }\n\n return digit\n}\n\nexports.setToSJISFunction = function setToSJISFunction (f) {\n if (typeof f !== 'function') {\n throw new Error('\"toSJISFunc\" is not a valid function.')\n }\n\n toSJISFunction = f\n}\n\nexports.isKanjiModeEnabled = function () {\n return typeof toSJISFunction !== 'undefined'\n}\n\nexports.toSJIS = function toSJIS (kanji) {\n return toSJISFunction(kanji)\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/version-check.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/version-check.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
eval("/**\n * Check if QR Code version is valid\n *\n * @param {Number} version QR Code version\n * @return {Boolean} true if valid version, false otherwise\n */\nexports.isValid = function isValid (version) {\n return !isNaN(version) && version >= 1 && version <= 40\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/version-check.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/core/version.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/core/version.js ***!
|
||
\*************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("const Utils = __webpack_require__(/*! ./utils */ \"./node_modules/qrcode/lib/core/utils.js\")\nconst ECCode = __webpack_require__(/*! ./error-correction-code */ \"./node_modules/qrcode/lib/core/error-correction-code.js\")\nconst ECLevel = __webpack_require__(/*! ./error-correction-level */ \"./node_modules/qrcode/lib/core/error-correction-level.js\")\nconst Mode = __webpack_require__(/*! ./mode */ \"./node_modules/qrcode/lib/core/mode.js\")\nconst VersionCheck = __webpack_require__(/*! ./version-check */ \"./node_modules/qrcode/lib/core/version-check.js\")\n\n// Generator polynomial used to encode version information\nconst G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)\nconst G18_BCH = Utils.getBCHDigit(G18)\n\nfunction getBestVersionForDataLength (mode, length, errorCorrectionLevel) {\n for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {\n return currentVersion\n }\n }\n\n return undefined\n}\n\nfunction getReservedBitsCount (mode, version) {\n // Character count indicator + mode indicator bits\n return Mode.getCharCountIndicator(mode, version) + 4\n}\n\nfunction getTotalBitsFromDataArray (segments, version) {\n let totalBits = 0\n\n segments.forEach(function (data) {\n const reservedBits = getReservedBitsCount(data.mode, version)\n totalBits += reservedBits + data.getBitsLength()\n })\n\n return totalBits\n}\n\nfunction getBestVersionForMixedData (segments, errorCorrectionLevel) {\n for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {\n const length = getTotalBitsFromDataArray(segments, currentVersion)\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {\n return currentVersion\n }\n }\n\n return undefined\n}\n\n/**\n * Returns version number from a value.\n * If value is not a valid version, returns defaultValue\n *\n * @param {Number|String} value QR Code version\n * @param {Number} defaultValue Fallback value\n * @return {Number} QR Code version number\n */\nexports.from = function from (value, defaultValue) {\n if (VersionCheck.isValid(value)) {\n return parseInt(value, 10)\n }\n\n return defaultValue\n}\n\n/**\n * Returns how much data can be stored with the specified QR code version\n * and error correction level\n *\n * @param {Number} version QR Code version (1-40)\n * @param {Number} errorCorrectionLevel Error correction level\n * @param {Mode} mode Data mode\n * @return {Number} Quantity of storable data\n */\nexports.getCapacity = function getCapacity (version, errorCorrectionLevel, mode) {\n if (!VersionCheck.isValid(version)) {\n throw new Error('Invalid QR Code version')\n }\n\n // Use Byte mode as default\n if (typeof mode === 'undefined') mode = Mode.BYTE\n\n // Total codewords for this QR code version (Data + Error correction)\n const totalCodewords = Utils.getSymbolTotalCodewords(version)\n\n // Total number of error correction codewords\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)\n\n // Total number of data codewords\n const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8\n\n if (mode === Mode.MIXED) return dataTotalCodewordsBits\n\n const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version)\n\n // Return max number of storable codewords\n switch (mode) {\n case Mode.NUMERIC:\n return Math.floor((usableBits / 10) * 3)\n\n case Mode.ALPHANUMERIC:\n return Math.floor((usableBits / 11) * 2)\n\n case Mode.KANJI:\n return Math.floor(usableBits / 13)\n\n case Mode.BYTE:\n default:\n return Math.floor(usableBits / 8)\n }\n}\n\n/**\n * Returns the minimum version needed to contain the amount of data\n *\n * @param {Segment} data Segment of data\n * @param {Number} [errorCorrectionLevel=H] Error correction level\n * @param {Mode} mode Data mode\n * @return {Number} QR Code version\n */\nexports.getBestVersionForData = function getBestVersionForData (data, errorCorrectionLevel) {\n let seg\n\n const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M)\n\n if (Array.isArray(data)) {\n if (data.length > 1) {\n return getBestVersionForMixedData(data, ecl)\n }\n\n if (data.length === 0) {\n return 1\n }\n\n seg = data[0]\n } else {\n seg = data\n }\n\n return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl)\n}\n\n/**\n * Returns version information with relative error correction bits\n *\n * The version information is included in QR Code symbols of version 7 or larger.\n * It consists of an 18-bit sequence containing 6 data bits,\n * with 12 error correction bits calculated using the (18, 6) Golay code.\n *\n * @param {Number} version QR Code version\n * @return {Number} Encoded version info bits\n */\nexports.getEncodedBits = function getEncodedBits (version) {\n if (!VersionCheck.isValid(version) || version < 7) {\n throw new Error('Invalid QR Code version')\n }\n\n let d = version << 12\n\n while (Utils.getBCHDigit(d) - G18_BCH >= 0) {\n d ^= (G18 << (Utils.getBCHDigit(d) - G18_BCH))\n }\n\n return (version << 12) | d\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/core/version.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/renderer/canvas.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/renderer/canvas.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("const Utils = __webpack_require__(/*! ./utils */ \"./node_modules/qrcode/lib/renderer/utils.js\")\n\nfunction clearCanvas (ctx, canvas, size) {\n ctx.clearRect(0, 0, canvas.width, canvas.height)\n\n if (!canvas.style) canvas.style = {}\n canvas.height = size\n canvas.width = size\n canvas.style.height = size + 'px'\n canvas.style.width = size + 'px'\n}\n\nfunction getCanvasElement () {\n try {\n return document.createElement('canvas')\n } catch (e) {\n throw new Error('You need to specify a canvas element')\n }\n}\n\nexports.render = function render (qrData, canvas, options) {\n let opts = options\n let canvasEl = canvas\n\n if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {\n opts = canvas\n canvas = undefined\n }\n\n if (!canvas) {\n canvasEl = getCanvasElement()\n }\n\n opts = Utils.getOptions(opts)\n const size = Utils.getImageWidth(qrData.modules.size, opts)\n\n const ctx = canvasEl.getContext('2d')\n const image = ctx.createImageData(size, size)\n Utils.qrToImageData(image.data, qrData, opts)\n\n clearCanvas(ctx, canvasEl, size)\n ctx.putImageData(image, 0, 0)\n\n return canvasEl\n}\n\nexports.renderToDataURL = function renderToDataURL (qrData, canvas, options) {\n let opts = options\n\n if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {\n opts = canvas\n canvas = undefined\n }\n\n if (!opts) opts = {}\n\n const canvasEl = exports.render(qrData, canvas, opts)\n\n const type = opts.type || 'image/png'\n const rendererOpts = opts.rendererOpts || {}\n\n return canvasEl.toDataURL(type, rendererOpts.quality)\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/renderer/canvas.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/renderer/svg-tag.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/renderer/svg-tag.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
eval("const Utils = __webpack_require__(/*! ./utils */ \"./node_modules/qrcode/lib/renderer/utils.js\")\n\nfunction getColorAttrib (color, attrib) {\n const alpha = color.a / 255\n const str = attrib + '=\"' + color.hex + '\"'\n\n return alpha < 1\n ? str + ' ' + attrib + '-opacity=\"' + alpha.toFixed(2).slice(1) + '\"'\n : str\n}\n\nfunction svgCmd (cmd, x, y) {\n let str = cmd + x\n if (typeof y !== 'undefined') str += ' ' + y\n\n return str\n}\n\nfunction qrToPath (data, size, margin) {\n let path = ''\n let moveBy = 0\n let newRow = false\n let lineLength = 0\n\n for (let i = 0; i < data.length; i++) {\n const col = Math.floor(i % size)\n const row = Math.floor(i / size)\n\n if (!col && !newRow) newRow = true\n\n if (data[i]) {\n lineLength++\n\n if (!(i > 0 && col > 0 && data[i - 1])) {\n path += newRow\n ? svgCmd('M', col + margin, 0.5 + row + margin)\n : svgCmd('m', moveBy, 0)\n\n moveBy = 0\n newRow = false\n }\n\n if (!(col + 1 < size && data[i + 1])) {\n path += svgCmd('h', lineLength)\n lineLength = 0\n }\n } else {\n moveBy++\n }\n }\n\n return path\n}\n\nexports.render = function render (qrData, options, cb) {\n const opts = Utils.getOptions(options)\n const size = qrData.modules.size\n const data = qrData.modules.data\n const qrcodesize = size + opts.margin * 2\n\n const bg = !opts.color.light.a\n ? ''\n : '<path ' + getColorAttrib(opts.color.light, 'fill') +\n ' d=\"M0 0h' + qrcodesize + 'v' + qrcodesize + 'H0z\"/>'\n\n const path =\n '<path ' + getColorAttrib(opts.color.dark, 'stroke') +\n ' d=\"' + qrToPath(data, size, opts.margin) + '\"/>'\n\n const viewBox = 'viewBox=\"' + '0 0 ' + qrcodesize + ' ' + qrcodesize + '\"'\n\n const width = !opts.width ? '' : 'width=\"' + opts.width + '\" height=\"' + opts.width + '\" '\n\n const svgTag = '<svg xmlns=\"http://www.w3.org/2000/svg\" ' + width + viewBox + ' shape-rendering=\"crispEdges\">' + bg + path + '</svg>\\n'\n\n if (typeof cb === 'function') {\n cb(null, svgTag)\n }\n\n return svgTag\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/renderer/svg-tag.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/qrcode/lib/renderer/utils.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/qrcode/lib/renderer/utils.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
eval("function hex2rgba (hex) {\n if (typeof hex === 'number') {\n hex = hex.toString()\n }\n\n if (typeof hex !== 'string') {\n throw new Error('Color should be defined as hex string')\n }\n\n let hexCode = hex.slice().replace('#', '').split('')\n if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {\n throw new Error('Invalid hex color: ' + hex)\n }\n\n // Convert from short to long form (fff -> ffffff)\n if (hexCode.length === 3 || hexCode.length === 4) {\n hexCode = Array.prototype.concat.apply([], hexCode.map(function (c) {\n return [c, c]\n }))\n }\n\n // Add default alpha value\n if (hexCode.length === 6) hexCode.push('F', 'F')\n\n const hexValue = parseInt(hexCode.join(''), 16)\n\n return {\n r: (hexValue >> 24) & 255,\n g: (hexValue >> 16) & 255,\n b: (hexValue >> 8) & 255,\n a: hexValue & 255,\n hex: '#' + hexCode.slice(0, 6).join('')\n }\n}\n\nexports.getOptions = function getOptions (options) {\n if (!options) options = {}\n if (!options.color) options.color = {}\n\n const margin = typeof options.margin === 'undefined' ||\n options.margin === null ||\n options.margin < 0\n ? 4\n : options.margin\n\n const width = options.width && options.width >= 21 ? options.width : undefined\n const scale = options.scale || 4\n\n return {\n width: width,\n scale: width ? 4 : scale,\n margin: margin,\n color: {\n dark: hex2rgba(options.color.dark || '#000000ff'),\n light: hex2rgba(options.color.light || '#ffffffff')\n },\n type: options.type,\n rendererOpts: options.rendererOpts || {}\n }\n}\n\nexports.getScale = function getScale (qrSize, opts) {\n return opts.width && opts.width >= qrSize + opts.margin * 2\n ? opts.width / (qrSize + opts.margin * 2)\n : opts.scale\n}\n\nexports.getImageWidth = function getImageWidth (qrSize, opts) {\n const scale = exports.getScale(qrSize, opts)\n return Math.floor((qrSize + opts.margin * 2) * scale)\n}\n\nexports.qrToImageData = function qrToImageData (imgData, qr, opts) {\n const size = qr.modules.size\n const data = qr.modules.data\n const scale = exports.getScale(size, opts)\n const symbolSize = Math.floor((size + opts.margin * 2) * scale)\n const scaledMargin = opts.margin * scale\n const palette = [opts.color.light, opts.color.dark]\n\n for (let i = 0; i < symbolSize; i++) {\n for (let j = 0; j < symbolSize; j++) {\n let posDst = (i * symbolSize + j) * 4\n let pxColor = opts.color.light\n\n if (i >= scaledMargin && j >= scaledMargin &&\n i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {\n const iSrc = Math.floor((i - scaledMargin) / scale)\n const jSrc = Math.floor((j - scaledMargin) / scale)\n pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0]\n }\n\n imgData[posDst++] = pxColor.r\n imgData[posDst++] = pxColor.g\n imgData[posDst++] = pxColor.b\n imgData[posDst] = pxColor.a\n }\n }\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/qrcode/lib/renderer/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uuid/dist/esm-browser/native.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/uuid/dist/esm-browser/native.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nconst randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n randomUUID\n});\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uuid/dist/esm-browser/native.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uuid/dist/esm-browser/regex.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/uuid/dist/esm-browser/regex.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uuid/dist/esm-browser/regex.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uuid/dist/esm-browser/rng.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/uuid/dist/esm-browser/rng.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ rng)\n/* harmony export */ });\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nfunction rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uuid/dist/esm-browser/rng.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uuid/dist/esm-browser/stringify.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/uuid/dist/esm-browser/stringify.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ unsafeStringify: () => (/* binding */ unsafeStringify)\n/* harmony export */ });\n/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ \"./node_modules/uuid/dist/esm-browser/validate.js\");\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nfunction unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (stringify);\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uuid/dist/esm-browser/stringify.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uuid/dist/esm-browser/v4.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/uuid/dist/esm-browser/v4.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _native_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./native.js */ \"./node_modules/uuid/dist/esm-browser/native.js\");\n/* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rng.js */ \"./node_modules/uuid/dist/esm-browser/rng.js\");\n/* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stringify.js */ \"./node_modules/uuid/dist/esm-browser/stringify.js\");\n\n\n\n\nfunction v4(options, buf, offset) {\n if (_native_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].randomUUID && !buf && !options) {\n return _native_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return (0,_stringify_js__WEBPACK_IMPORTED_MODULE_2__.unsafeStringify)(rnds);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v4);\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uuid/dist/esm-browser/v4.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uuid/dist/esm-browser/validate.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/uuid/dist/esm-browser/validate.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regex.js */ \"./node_modules/uuid/dist/esm-browser/regex.js\");\n\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && _regex_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].test(uuid);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validate);\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uuid/dist/esm-browser/validate.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "?ce41":
|
||
/*!************************!*\
|
||
!*** crypto (ignored) ***!
|
||
\************************/
|
||
/***/ (() => {
|
||
|
||
eval("/* (ignored) */\n\n//# sourceURL=webpack://@waku/noise-rtc/crypto_(ignored)?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "?25ed":
|
||
/*!************************!*\
|
||
!*** crypto (ignored) ***!
|
||
\************************/
|
||
/***/ (() => {
|
||
|
||
eval("/* (ignored) */\n\n//# sourceURL=webpack://@waku/noise-rtc/crypto_(ignored)?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "?8131":
|
||
/*!************************!*\
|
||
!*** buffer (ignored) ***!
|
||
\************************/
|
||
/***/ (() => {
|
||
|
||
eval("/* (ignored) */\n\n//# sourceURL=webpack://@waku/noise-rtc/buffer_(ignored)?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "?b254":
|
||
/*!************************!*\
|
||
!*** crypto (ignored) ***!
|
||
\************************/
|
||
/***/ (() => {
|
||
|
||
eval("/* (ignored) */\n\n//# sourceURL=webpack://@waku/noise-rtc/crypto_(ignored)?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/is-ip/lib/is-ip.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/@chainsafe/is-ip/lib/is-ip.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ipVersion: () => (/* binding */ ipVersion),\n/* harmony export */ isIP: () => (/* binding */ isIP),\n/* harmony export */ isIPv4: () => (/* binding */ isIPv4),\n/* harmony export */ isIPv6: () => (/* binding */ isIPv6)\n/* harmony export */ });\n/* harmony import */ var _parse_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parse.js */ \"./node_modules/@chainsafe/is-ip/lib/parse.js\");\n\n/** Check if `input` is IPv4. */\nfunction isIPv4(input) {\n return Boolean((0,_parse_js__WEBPACK_IMPORTED_MODULE_0__.parseIPv4)(input));\n}\n/** Check if `input` is IPv6. */\nfunction isIPv6(input) {\n return Boolean((0,_parse_js__WEBPACK_IMPORTED_MODULE_0__.parseIPv6)(input));\n}\n/** Check if `input` is IPv4 or IPv6. */\nfunction isIP(input) {\n return Boolean((0,_parse_js__WEBPACK_IMPORTED_MODULE_0__.parseIP)(input));\n}\n/**\n * @returns `6` if `input` is IPv6, `4` if `input` is IPv4, or `undefined` if `input` is neither.\n */\nfunction ipVersion(input) {\n if (isIPv4(input)) {\n return 4;\n }\n else if (isIPv6(input)) {\n return 6;\n }\n else {\n return undefined;\n }\n}\n//# sourceMappingURL=is-ip.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/is-ip/lib/is-ip.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/is-ip/lib/parse.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/@chainsafe/is-ip/lib/parse.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parseIP: () => (/* binding */ parseIP),\n/* harmony export */ parseIPv4: () => (/* binding */ parseIPv4),\n/* harmony export */ parseIPv6: () => (/* binding */ parseIPv6)\n/* harmony export */ });\n/* harmony import */ var _parser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parser.js */ \"./node_modules/@chainsafe/is-ip/lib/parser.js\");\n\n// See https://stackoverflow.com/questions/166132/maximum-length-of-the-textual-representation-of-an-ipv6-address\nconst MAX_IPV6_LENGTH = 45;\nconst MAX_IPV4_LENGTH = 15;\nconst parser = new _parser_js__WEBPACK_IMPORTED_MODULE_0__.Parser();\n/** Parse `input` into IPv4 bytes. */\nfunction parseIPv4(input) {\n if (input.length > MAX_IPV4_LENGTH) {\n return undefined;\n }\n return parser.new(input).parseWith(() => parser.readIPv4Addr());\n}\n/** Parse `input` into IPv6 bytes. */\nfunction parseIPv6(input) {\n // strip zone index if it is present\n if (input.includes(\"%\")) {\n input = input.split(\"%\")[0];\n }\n if (input.length > MAX_IPV6_LENGTH) {\n return undefined;\n }\n return parser.new(input).parseWith(() => parser.readIPv6Addr());\n}\n/** Parse `input` into IPv4 or IPv6 bytes. */\nfunction parseIP(input) {\n // strip zone index if it is present\n if (input.includes(\"%\")) {\n input = input.split(\"%\")[0];\n }\n if (input.length > MAX_IPV6_LENGTH) {\n return undefined;\n }\n return parser.new(input).parseWith(() => parser.readIPAddr());\n}\n//# sourceMappingURL=parse.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/is-ip/lib/parse.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/is-ip/lib/parser.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/@chainsafe/is-ip/lib/parser.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Parser: () => (/* binding */ Parser)\n/* harmony export */ });\n/* eslint-disable @typescript-eslint/no-unsafe-return */\nclass Parser {\n index = 0;\n input = \"\";\n new(input) {\n this.index = 0;\n this.input = input;\n return this;\n }\n /** Run a parser, and restore the pre-parse state if it fails. */\n readAtomically(fn) {\n const index = this.index;\n const result = fn();\n if (result === undefined) {\n this.index = index;\n }\n return result;\n }\n /** Run a parser, but fail if the entire input wasn't consumed. Doesn't run atomically. */\n parseWith(fn) {\n const result = fn();\n if (this.index !== this.input.length) {\n return undefined;\n }\n return result;\n }\n /** Peek the next character from the input */\n peekChar() {\n if (this.index >= this.input.length) {\n return undefined;\n }\n return this.input[this.index];\n }\n /** Read the next character from the input */\n readChar() {\n if (this.index >= this.input.length) {\n return undefined;\n }\n return this.input[this.index++];\n }\n /** Read the next character from the input if it matches the target. */\n readGivenChar(target) {\n return this.readAtomically(() => {\n const char = this.readChar();\n if (char !== target) {\n return undefined;\n }\n return char;\n });\n }\n /**\n * Helper for reading separators in an indexed loop. Reads the separator\n * character iff index > 0, then runs the parser. When used in a loop,\n * the separator character will only be read on index > 0 (see\n * readIPv4Addr for an example)\n */\n readSeparator(sep, index, inner) {\n return this.readAtomically(() => {\n if (index > 0) {\n if (this.readGivenChar(sep) === undefined) {\n return undefined;\n }\n }\n return inner();\n });\n }\n /**\n * Read a number off the front of the input in the given radix, stopping\n * at the first non-digit character or eof. Fails if the number has more\n * digits than max_digits or if there is no number.\n */\n readNumber(radix, maxDigits, allowZeroPrefix, maxBytes) {\n return this.readAtomically(() => {\n let result = 0;\n let digitCount = 0;\n const leadingChar = this.peekChar();\n if (leadingChar === undefined) {\n return undefined;\n }\n const hasLeadingZero = leadingChar === \"0\";\n const maxValue = 2 ** (8 * maxBytes) - 1;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const digit = this.readAtomically(() => {\n const char = this.readChar();\n if (char === undefined) {\n return undefined;\n }\n const num = Number.parseInt(char, radix);\n if (Number.isNaN(num)) {\n return undefined;\n }\n return num;\n });\n if (digit === undefined) {\n break;\n }\n result *= radix;\n result += digit;\n if (result > maxValue) {\n return undefined;\n }\n digitCount += 1;\n if (maxDigits !== undefined) {\n if (digitCount > maxDigits) {\n return undefined;\n }\n }\n }\n if (digitCount === 0) {\n return undefined;\n }\n else if (!allowZeroPrefix && hasLeadingZero && digitCount > 1) {\n return undefined;\n }\n else {\n return result;\n }\n });\n }\n /** Read an IPv4 address. */\n readIPv4Addr() {\n return this.readAtomically(() => {\n const out = new Uint8Array(4);\n for (let i = 0; i < out.length; i++) {\n const ix = this.readSeparator(\".\", i, () => this.readNumber(10, 3, false, 1));\n if (ix === undefined) {\n return undefined;\n }\n out[i] = ix;\n }\n return out;\n });\n }\n /** Read an IPv6 Address. */\n readIPv6Addr() {\n /**\n * Read a chunk of an IPv6 address into `groups`. Returns the number\n * of groups read, along with a bool indicating if an embedded\n * trailing IPv4 address was read. Specifically, read a series of\n * colon-separated IPv6 groups (0x0000 - 0xFFFF), with an optional\n * trailing embedded IPv4 address.\n */\n const readGroups = (groups) => {\n for (let i = 0; i < groups.length / 2; i++) {\n const ix = i * 2;\n // Try to read a trailing embedded IPv4 address. There must be at least 4 groups left.\n if (i < groups.length - 3) {\n const ipv4 = this.readSeparator(\":\", i, () => this.readIPv4Addr());\n if (ipv4 !== undefined) {\n groups[ix] = ipv4[0];\n groups[ix + 1] = ipv4[1];\n groups[ix + 2] = ipv4[2];\n groups[ix + 3] = ipv4[3];\n return [ix + 4, true];\n }\n }\n const group = this.readSeparator(\":\", i, () => this.readNumber(16, 4, true, 2));\n if (group === undefined) {\n return [ix, false];\n }\n groups[ix] = group >> 8;\n groups[ix + 1] = group & 255;\n }\n return [groups.length, false];\n };\n return this.readAtomically(() => {\n // Read the front part of the address; either the whole thing, or up to the first ::\n const head = new Uint8Array(16);\n const [headSize, headIp4] = readGroups(head);\n if (headSize === 16) {\n return head;\n }\n // IPv4 part is not allowed before `::`\n if (headIp4) {\n return undefined;\n }\n // Read `::` if previous code parsed less than 8 groups.\n // `::` indicates one or more groups of 16 bits of zeros.\n if (this.readGivenChar(\":\") === undefined) {\n return undefined;\n }\n if (this.readGivenChar(\":\") === undefined) {\n return undefined;\n }\n // Read the back part of the address. The :: must contain at least one\n // set of zeroes, so our max length is 7.\n const tail = new Uint8Array(14);\n const limit = 16 - (headSize + 2);\n const [tailSize] = readGroups(tail.subarray(0, limit));\n // Concat the head and tail of the IP address\n head.set(tail.subarray(0, tailSize), 16 - tailSize);\n return head;\n });\n }\n /** Read an IP Address, either IPv4 or IPv6. */\n readIPAddr() {\n return this.readIPv4Addr() ?? this.readIPv6Addr();\n }\n}\n//# sourceMappingURL=parser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/is-ip/lib/parser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/constants.js":
|
||
/*!************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/constants.js ***!
|
||
\************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ACCEPT_FROM_WHITELIST_DURATION_MS: () => (/* binding */ ACCEPT_FROM_WHITELIST_DURATION_MS),\n/* harmony export */ ACCEPT_FROM_WHITELIST_MAX_MESSAGES: () => (/* binding */ ACCEPT_FROM_WHITELIST_MAX_MESSAGES),\n/* harmony export */ ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE: () => (/* binding */ ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE),\n/* harmony export */ BACKOFF_SLACK: () => (/* binding */ BACKOFF_SLACK),\n/* harmony export */ DEFAULT_METRIC_MESH_MESSAGE_DELIVERIES_WINDOWS: () => (/* binding */ DEFAULT_METRIC_MESH_MESSAGE_DELIVERIES_WINDOWS),\n/* harmony export */ ERR_TOPIC_VALIDATOR_IGNORE: () => (/* binding */ ERR_TOPIC_VALIDATOR_IGNORE),\n/* harmony export */ ERR_TOPIC_VALIDATOR_REJECT: () => (/* binding */ ERR_TOPIC_VALIDATOR_REJECT),\n/* harmony export */ FloodsubID: () => (/* binding */ FloodsubID),\n/* harmony export */ GossipsubConnectionTimeout: () => (/* binding */ GossipsubConnectionTimeout),\n/* harmony export */ GossipsubConnectors: () => (/* binding */ GossipsubConnectors),\n/* harmony export */ GossipsubD: () => (/* binding */ GossipsubD),\n/* harmony export */ GossipsubDhi: () => (/* binding */ GossipsubDhi),\n/* harmony export */ GossipsubDirectConnectInitialDelay: () => (/* binding */ GossipsubDirectConnectInitialDelay),\n/* harmony export */ GossipsubDirectConnectTicks: () => (/* binding */ GossipsubDirectConnectTicks),\n/* harmony export */ GossipsubDlazy: () => (/* binding */ GossipsubDlazy),\n/* harmony export */ GossipsubDlo: () => (/* binding */ GossipsubDlo),\n/* harmony export */ GossipsubDout: () => (/* binding */ GossipsubDout),\n/* harmony export */ GossipsubDscore: () => (/* binding */ GossipsubDscore),\n/* harmony export */ GossipsubFanoutTTL: () => (/* binding */ GossipsubFanoutTTL),\n/* harmony export */ GossipsubGossipFactor: () => (/* binding */ GossipsubGossipFactor),\n/* harmony export */ GossipsubGossipRetransmission: () => (/* binding */ GossipsubGossipRetransmission),\n/* harmony export */ GossipsubGraftFloodThreshold: () => (/* binding */ GossipsubGraftFloodThreshold),\n/* harmony export */ GossipsubHeartbeatInitialDelay: () => (/* binding */ GossipsubHeartbeatInitialDelay),\n/* harmony export */ GossipsubHeartbeatInterval: () => (/* binding */ GossipsubHeartbeatInterval),\n/* harmony export */ GossipsubHistoryGossip: () => (/* binding */ GossipsubHistoryGossip),\n/* harmony export */ GossipsubHistoryLength: () => (/* binding */ GossipsubHistoryLength),\n/* harmony export */ GossipsubIDv10: () => (/* binding */ GossipsubIDv10),\n/* harmony export */ GossipsubIDv11: () => (/* binding */ GossipsubIDv11),\n/* harmony export */ GossipsubIWantFollowupTime: () => (/* binding */ GossipsubIWantFollowupTime),\n/* harmony export */ GossipsubMaxIHaveLength: () => (/* binding */ GossipsubMaxIHaveLength),\n/* harmony export */ GossipsubMaxIHaveMessages: () => (/* binding */ GossipsubMaxIHaveMessages),\n/* harmony export */ GossipsubMaxPendingConnections: () => (/* binding */ GossipsubMaxPendingConnections),\n/* harmony export */ GossipsubOpportunisticGraftPeers: () => (/* binding */ GossipsubOpportunisticGraftPeers),\n/* harmony export */ GossipsubOpportunisticGraftTicks: () => (/* binding */ GossipsubOpportunisticGraftTicks),\n/* harmony export */ GossipsubPruneBackoff: () => (/* binding */ GossipsubPruneBackoff),\n/* harmony export */ GossipsubPruneBackoffTicks: () => (/* binding */ GossipsubPruneBackoffTicks),\n/* harmony export */ GossipsubPrunePeers: () => (/* binding */ GossipsubPrunePeers),\n/* harmony export */ GossipsubSeenTTL: () => (/* binding */ GossipsubSeenTTL),\n/* harmony export */ GossipsubUnsubscribeBackoff: () => (/* binding */ GossipsubUnsubscribeBackoff),\n/* harmony export */ TimeCacheDuration: () => (/* binding */ TimeCacheDuration),\n/* harmony export */ minute: () => (/* binding */ minute),\n/* harmony export */ second: () => (/* binding */ second)\n/* harmony export */ });\nconst second = 1000;\nconst minute = 60 * second;\n// Protocol identifiers\nconst FloodsubID = '/floodsub/1.0.0';\n/**\n * The protocol ID for version 1.0.0 of the Gossipsub protocol\n * It is advertised along with GossipsubIDv11 for backwards compatability\n */\nconst GossipsubIDv10 = '/meshsub/1.0.0';\n/**\n * The protocol ID for version 1.1.0 of the Gossipsub protocol\n * See the spec for details about how v1.1.0 compares to v1.0.0:\n * https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md\n */\nconst GossipsubIDv11 = '/meshsub/1.1.0';\n// Overlay parameters\n/**\n * GossipsubD sets the optimal degree for a Gossipsub topic mesh. For example, if GossipsubD == 6,\n * each peer will want to have about six peers in their mesh for each topic they're subscribed to.\n * GossipsubD should be set somewhere between GossipsubDlo and GossipsubDhi.\n */\nconst GossipsubD = 6;\n/**\n * GossipsubDlo sets the lower bound on the number of peers we keep in a Gossipsub topic mesh.\n * If we have fewer than GossipsubDlo peers, we will attempt to graft some more into the mesh at\n * the next heartbeat.\n */\nconst GossipsubDlo = 4;\n/**\n * GossipsubDhi sets the upper bound on the number of peers we keep in a Gossipsub topic mesh.\n * If we have more than GossipsubDhi peers, we will select some to prune from the mesh at the next heartbeat.\n */\nconst GossipsubDhi = 12;\n/**\n * GossipsubDscore affects how peers are selected when pruning a mesh due to over subscription.\n * At least GossipsubDscore of the retained peers will be high-scoring, while the remainder are\n * chosen randomly.\n */\nconst GossipsubDscore = 4;\n/**\n * GossipsubDout sets the quota for the number of outbound connections to maintain in a topic mesh.\n * When the mesh is pruned due to over subscription, we make sure that we have outbound connections\n * to at least GossipsubDout of the survivor peers. This prevents sybil attackers from overwhelming\n * our mesh with incoming connections.\n *\n * GossipsubDout must be set below GossipsubDlo, and must not exceed GossipsubD / 2.\n */\nconst GossipsubDout = 2;\n// Gossip parameters\n/**\n * GossipsubHistoryLength controls the size of the message cache used for gossip.\n * The message cache will remember messages for GossipsubHistoryLength heartbeats.\n */\nconst GossipsubHistoryLength = 5;\n/**\n * GossipsubHistoryGossip controls how many cached message ids we will advertise in\n * IHAVE gossip messages. When asked for our seen message IDs, we will return\n * only those from the most recent GossipsubHistoryGossip heartbeats. The slack between\n * GossipsubHistoryGossip and GossipsubHistoryLength allows us to avoid advertising messages\n * that will be expired by the time they're requested.\n *\n * GossipsubHistoryGossip must be less than or equal to GossipsubHistoryLength to\n * avoid a runtime panic.\n */\nconst GossipsubHistoryGossip = 3;\n/**\n * GossipsubDlazy affects how many peers we will emit gossip to at each heartbeat.\n * We will send gossip to at least GossipsubDlazy peers outside our mesh. The actual\n * number may be more, depending on GossipsubGossipFactor and how many peers we're\n * connected to.\n */\nconst GossipsubDlazy = 6;\n/**\n * GossipsubGossipFactor affects how many peers we will emit gossip to at each heartbeat.\n * We will send gossip to GossipsubGossipFactor * (total number of non-mesh peers), or\n * GossipsubDlazy, whichever is greater.\n */\nconst GossipsubGossipFactor = 0.25;\n/**\n * GossipsubGossipRetransmission controls how many times we will allow a peer to request\n * the same message id through IWANT gossip before we start ignoring them. This is designed\n * to prevent peers from spamming us with requests and wasting our resources.\n */\nconst GossipsubGossipRetransmission = 3;\n// Heartbeat interval\n/**\n * GossipsubHeartbeatInitialDelay is the short delay before the heartbeat timer begins\n * after the router is initialized.\n */\nconst GossipsubHeartbeatInitialDelay = 100;\n/**\n * GossipsubHeartbeatInterval controls the time between heartbeats.\n */\nconst GossipsubHeartbeatInterval = second;\n/**\n * GossipsubFanoutTTL controls how long we keep track of the fanout state. If it's been\n * GossipsubFanoutTTL since we've published to a topic that we're not subscribed to,\n * we'll delete the fanout map for that topic.\n */\nconst GossipsubFanoutTTL = minute;\n/**\n * GossipsubPrunePeers controls the number of peers to include in prune Peer eXchange.\n * When we prune a peer that's eligible for PX (has a good score, etc), we will try to\n * send them signed peer records for up to GossipsubPrunePeers other peers that we\n * know of.\n */\nconst GossipsubPrunePeers = 16;\n/**\n * GossipsubPruneBackoff controls the backoff time for pruned peers. This is how long\n * a peer must wait before attempting to graft into our mesh again after being pruned.\n * When pruning a peer, we send them our value of GossipsubPruneBackoff so they know\n * the minimum time to wait. Peers running older versions may not send a backoff time,\n * so if we receive a prune message without one, we will wait at least GossipsubPruneBackoff\n * before attempting to re-graft.\n */\nconst GossipsubPruneBackoff = minute;\n/**\n * Backoff to use when unsuscribing from a topic. Should not resubscribe to this topic before it expired.\n */\nconst GossipsubUnsubscribeBackoff = 10 * second;\n/**\n * GossipsubPruneBackoffTicks is the number of heartbeat ticks for attempting to prune expired\n * backoff timers.\n */\nconst GossipsubPruneBackoffTicks = 15;\n/**\n * GossipsubConnectors controls the number of active connection attempts for peers obtained through PX.\n */\nconst GossipsubConnectors = 8;\n/**\n * GossipsubMaxPendingConnections sets the maximum number of pending connections for peers attempted through px.\n */\nconst GossipsubMaxPendingConnections = 128;\n/**\n * GossipsubConnectionTimeout controls the timeout for connection attempts.\n */\nconst GossipsubConnectionTimeout = 30 * second;\n/**\n * GossipsubDirectConnectTicks is the number of heartbeat ticks for attempting to reconnect direct peers\n * that are not currently connected.\n */\nconst GossipsubDirectConnectTicks = 300;\n/**\n * GossipsubDirectConnectInitialDelay is the initial delay before opening connections to direct peers\n */\nconst GossipsubDirectConnectInitialDelay = second;\n/**\n * GossipsubOpportunisticGraftTicks is the number of heartbeat ticks for attempting to improve the mesh\n * with opportunistic grafting. Every GossipsubOpportunisticGraftTicks we will attempt to select some\n * high-scoring mesh peers to replace lower-scoring ones, if the median score of our mesh peers falls\n * below a threshold\n */\nconst GossipsubOpportunisticGraftTicks = 60;\n/**\n * GossipsubOpportunisticGraftPeers is the number of peers to opportunistically graft.\n */\nconst GossipsubOpportunisticGraftPeers = 2;\n/**\n * If a GRAFT comes before GossipsubGraftFloodThreshold has elapsed since the last PRUNE,\n * then there is an extra score penalty applied to the peer through P7.\n */\nconst GossipsubGraftFloodThreshold = 10 * second;\n/**\n * GossipsubMaxIHaveLength is the maximum number of messages to include in an IHAVE message.\n * Also controls the maximum number of IHAVE ids we will accept and request with IWANT from a\n * peer within a heartbeat, to protect from IHAVE floods. You should adjust this value from the\n * default if your system is pushing more than 5000 messages in GossipsubHistoryGossip heartbeats;\n * with the defaults this is 1666 messages/s.\n */\nconst GossipsubMaxIHaveLength = 5000;\n/**\n * GossipsubMaxIHaveMessages is the maximum number of IHAVE messages to accept from a peer within a heartbeat.\n */\nconst GossipsubMaxIHaveMessages = 10;\n/**\n * Time to wait for a message requested through IWANT following an IHAVE advertisement.\n * If the message is not received within this window, a broken promise is declared and\n * the router may apply bahavioural penalties.\n */\nconst GossipsubIWantFollowupTime = 3 * second;\n/**\n * Time in milliseconds to keep message ids in the seen cache\n */\nconst GossipsubSeenTTL = 2 * minute;\nconst TimeCacheDuration = 120 * 1000;\nconst ERR_TOPIC_VALIDATOR_REJECT = 'ERR_TOPIC_VALIDATOR_REJECT';\nconst ERR_TOPIC_VALIDATOR_IGNORE = 'ERR_TOPIC_VALIDATOR_IGNORE';\n/**\n * If peer score is better than this, we accept messages from this peer\n * within ACCEPT_FROM_WHITELIST_DURATION_MS from the last time computing score.\n **/\nconst ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE = 0;\n/**\n * If peer score >= ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE, accept up to this\n * number of messages from that peer.\n */\nconst ACCEPT_FROM_WHITELIST_MAX_MESSAGES = 128;\n/**\n * If peer score >= ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE, accept messages from\n * this peer up to this time duration.\n */\nconst ACCEPT_FROM_WHITELIST_DURATION_MS = 1000;\n/**\n * The default MeshMessageDeliveriesWindow to be used in metrics.\n */\nconst DEFAULT_METRIC_MESH_MESSAGE_DELIVERIES_WINDOWS = 1000;\n/** Wait for 1 more heartbeats before clearing a backoff */\nconst BACKOFF_SLACK = 1;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/index.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/index.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GossipSub: () => (/* binding */ GossipSub),\n/* harmony export */ gossipsub: () => (/* binding */ gossipsub),\n/* harmony export */ multicodec: () => (/* binding */ multicodec)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/event-target.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/pubsub/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/constants.js\");\n/* harmony import */ var _message_decodeRpc_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./message/decodeRpc.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/decodeRpc.js\");\n/* harmony import */ var _message_rpc_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./message/rpc.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.js\");\n/* harmony import */ var _message_cache_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./message-cache.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message-cache.js\");\n/* harmony import */ var _metrics_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./metrics.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/metrics.js\");\n/* harmony import */ var _score_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./score/index.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-params.js\");\n/* harmony import */ var _score_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./score/index.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-thresholds.js\");\n/* harmony import */ var _score_index_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./score/index.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js\");\n/* harmony import */ var _score_scoreMetrics_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./score/scoreMetrics.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/scoreMetrics.js\");\n/* harmony import */ var _stream_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./stream.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/stream.js\");\n/* harmony import */ var _tracer_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./tracer.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/tracer.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n/* harmony import */ var _utils_buildRawMessage_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./utils/buildRawMessage.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/buildRawMessage.js\");\n/* harmony import */ var _utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./utils/create-gossip-rpc.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/create-gossip-rpc.js\");\n/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/index.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/messageIdToString.js\");\n/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./utils/index.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/shuffle.js\");\n/* harmony import */ var _utils_msgIdFn_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/msgIdFn.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/msgIdFn.js\");\n/* harmony import */ var _utils_multiaddr_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./utils/multiaddr.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/multiaddr.js\");\n/* harmony import */ var _utils_publishConfig_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./utils/publishConfig.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/publishConfig.js\");\n/* harmony import */ var _utils_set_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./utils/set.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/set.js\");\n/* harmony import */ var _utils_time_cache_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/time-cache.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/time-cache.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst multicodec = _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubIDv11;\nvar GossipStatusCode;\n(function (GossipStatusCode) {\n GossipStatusCode[GossipStatusCode[\"started\"] = 0] = \"started\";\n GossipStatusCode[GossipStatusCode[\"stopped\"] = 1] = \"stopped\";\n})(GossipStatusCode || (GossipStatusCode = {}));\nclass GossipSub extends _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.TypedEventEmitter {\n /**\n * The signature policy to follow by default\n */\n globalSignaturePolicy;\n multicodecs = [_constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubIDv11, _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubIDv10];\n publishConfig;\n dataTransform;\n // State\n peers = new Set();\n streamsInbound = new Map();\n streamsOutbound = new Map();\n /** Ensures outbound streams are created sequentially */\n outboundInflightQueue = (0,it_pushable__WEBPACK_IMPORTED_MODULE_2__.pushable)({ objectMode: true });\n /** Direct peers */\n direct = new Set();\n /** Floodsub peers */\n floodsubPeers = new Set();\n /** Cache of seen messages */\n seenCache;\n /**\n * Map of peer id and AcceptRequestWhileListEntry\n */\n acceptFromWhitelist = new Map();\n /**\n * Map of topics to which peers are subscribed to\n */\n topics = new Map();\n /**\n * List of our subscriptions\n */\n subscriptions = new Set();\n /**\n * Map of topic meshes\n * topic => peer id set\n */\n mesh = new Map();\n /**\n * Map of topics to set of peers. These mesh peers are the ones to which we are publishing without a topic membership\n * topic => peer id set\n */\n fanout = new Map();\n /**\n * Map of last publish time for fanout topics\n * topic => last publish time\n */\n fanoutLastpub = new Map();\n /**\n * Map of pending messages to gossip\n * peer id => control messages\n */\n gossip = new Map();\n /**\n * Map of control messages\n * peer id => control message\n */\n control = new Map();\n /**\n * Number of IHAVEs received from peer in the last heartbeat\n */\n peerhave = new Map();\n /** Number of messages we have asked from peer in the last heartbeat */\n iasked = new Map();\n /** Prune backoff map */\n backoff = new Map();\n /**\n * Connection direction cache, marks peers with outbound connections\n * peer id => direction\n */\n outbound = new Map();\n msgIdFn;\n /**\n * A fast message id function used for internal message de-duplication\n */\n fastMsgIdFn;\n msgIdToStrFn;\n /** Maps fast message-id to canonical message-id */\n fastMsgIdCache;\n /**\n * Short term cache for published message ids. This is used for penalizing peers sending\n * our own messages back if the messages are anonymous or use a random author.\n */\n publishedMessageIds;\n /**\n * A message cache that contains the messages for last few heartbeat ticks\n */\n mcache;\n /** Peer score tracking */\n score;\n /**\n * Custom validator function per topic.\n * Must return or resolve quickly (< 100ms) to prevent causing penalties for late messages.\n * If you need to apply validation that may require longer times use `asyncValidation` option and callback the\n * validation result through `Gossipsub.reportValidationResult`\n */\n topicValidators = new Map();\n /**\n * Make this protected so child class may want to redirect to its own log.\n */\n log;\n /**\n * Number of heartbeats since the beginning of time\n * This allows us to amortize some resource cleanup -- eg: backoff cleanup\n */\n heartbeatTicks = 0;\n /**\n * Tracks IHAVE/IWANT promises broken by peers\n */\n gossipTracer;\n components;\n directPeerInitial = null;\n static multicodec = _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubIDv11;\n // Options\n opts;\n decodeRpcLimits;\n metrics;\n status = { code: GossipStatusCode.stopped };\n maxInboundStreams;\n maxOutboundStreams;\n runOnTransientConnection;\n allowedTopics;\n heartbeatTimer = null;\n constructor(components, options = {}) {\n super();\n const opts = {\n fallbackToFloodsub: true,\n floodPublish: true,\n batchPublish: false,\n doPX: false,\n directPeers: [],\n D: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubD,\n Dlo: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubDlo,\n Dhi: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubDhi,\n Dscore: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubDscore,\n Dout: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubDout,\n Dlazy: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubDlazy,\n heartbeatInterval: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubHeartbeatInterval,\n fanoutTTL: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubFanoutTTL,\n mcacheLength: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubHistoryLength,\n mcacheGossip: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubHistoryGossip,\n seenTTL: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubSeenTTL,\n gossipsubIWantFollowupMs: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubIWantFollowupTime,\n prunePeers: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubPrunePeers,\n pruneBackoff: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubPruneBackoff,\n unsubcribeBackoff: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubUnsubscribeBackoff,\n graftFloodThreshold: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubGraftFloodThreshold,\n opportunisticGraftPeers: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubOpportunisticGraftPeers,\n opportunisticGraftTicks: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubOpportunisticGraftTicks,\n directConnectTicks: _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubDirectConnectTicks,\n ...options,\n scoreParams: (0,_score_index_js__WEBPACK_IMPORTED_MODULE_5__.createPeerScoreParams)(options.scoreParams),\n scoreThresholds: (0,_score_index_js__WEBPACK_IMPORTED_MODULE_6__.createPeerScoreThresholds)(options.scoreThresholds)\n };\n this.components = components;\n this.decodeRpcLimits = opts.decodeRpcLimits ?? _message_decodeRpc_js__WEBPACK_IMPORTED_MODULE_7__.defaultDecodeRpcLimits;\n this.globalSignaturePolicy = opts.globalSignaturePolicy ?? _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.StrictSign;\n // Also wants to get notified of peers connected using floodsub\n if (opts.fallbackToFloodsub) {\n this.multicodecs.push(_constants_js__WEBPACK_IMPORTED_MODULE_3__.FloodsubID);\n }\n // From pubsub\n this.log = components.logger.forComponent(opts.debugName ?? 'libp2p:gossipsub');\n // Gossipsub\n this.opts = opts;\n this.direct = new Set(opts.directPeers.map((p) => p.id.toString()));\n this.seenCache = new _utils_time_cache_js__WEBPACK_IMPORTED_MODULE_9__.SimpleTimeCache({ validityMs: opts.seenTTL });\n this.publishedMessageIds = new _utils_time_cache_js__WEBPACK_IMPORTED_MODULE_9__.SimpleTimeCache({ validityMs: opts.seenTTL });\n if (options.msgIdFn != null) {\n // Use custom function\n this.msgIdFn = options.msgIdFn;\n }\n else {\n switch (this.globalSignaturePolicy) {\n case _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.StrictSign:\n this.msgIdFn = _utils_msgIdFn_js__WEBPACK_IMPORTED_MODULE_10__.msgIdFnStrictSign;\n break;\n case _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.StrictNoSign:\n this.msgIdFn = _utils_msgIdFn_js__WEBPACK_IMPORTED_MODULE_10__.msgIdFnStrictNoSign;\n break;\n default:\n throw new Error(`Invalid globalSignaturePolicy: ${this.globalSignaturePolicy}`);\n }\n }\n if (options.fastMsgIdFn != null) {\n this.fastMsgIdFn = options.fastMsgIdFn;\n this.fastMsgIdCache = new _utils_time_cache_js__WEBPACK_IMPORTED_MODULE_9__.SimpleTimeCache({ validityMs: opts.seenTTL });\n }\n // By default, gossipsub only provide a browser friendly function to convert Uint8Array message id to string.\n this.msgIdToStrFn = options.msgIdToStrFn ?? _utils_index_js__WEBPACK_IMPORTED_MODULE_11__.messageIdToString;\n this.mcache = options.messageCache ?? new _message_cache_js__WEBPACK_IMPORTED_MODULE_12__.MessageCache(opts.mcacheGossip, opts.mcacheLength, this.msgIdToStrFn);\n if (options.dataTransform != null) {\n this.dataTransform = options.dataTransform;\n }\n if (options.metricsRegister != null) {\n if (options.metricsTopicStrToLabel == null) {\n throw Error('Must set metricsTopicStrToLabel with metrics');\n }\n // in theory, each topic has its own meshMessageDeliveriesWindow param\n // however in lodestar, we configure it mostly the same so just pick the max of positive ones\n // (some topics have meshMessageDeliveriesWindow as 0)\n const maxMeshMessageDeliveriesWindowMs = Math.max(...Object.values(opts.scoreParams.topics).map((topicParam) => topicParam.meshMessageDeliveriesWindow), _constants_js__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_METRIC_MESH_MESSAGE_DELIVERIES_WINDOWS);\n const metrics = (0,_metrics_js__WEBPACK_IMPORTED_MODULE_13__.getMetrics)(options.metricsRegister, options.metricsTopicStrToLabel, {\n gossipPromiseExpireSec: this.opts.gossipsubIWantFollowupMs / 1000,\n behaviourPenaltyThreshold: opts.scoreParams.behaviourPenaltyThreshold,\n maxMeshMessageDeliveriesWindowSec: maxMeshMessageDeliveriesWindowMs / 1000\n });\n metrics.mcacheSize.addCollect(() => { this.onScrapeMetrics(metrics); });\n for (const protocol of this.multicodecs) {\n metrics.protocolsEnabled.set({ protocol }, 1);\n }\n this.metrics = metrics;\n }\n else {\n this.metrics = null;\n }\n this.gossipTracer = new _tracer_js__WEBPACK_IMPORTED_MODULE_14__.IWantTracer(this.opts.gossipsubIWantFollowupMs, this.msgIdToStrFn, this.metrics);\n /**\n * libp2p\n */\n this.score = new _score_index_js__WEBPACK_IMPORTED_MODULE_15__.PeerScore(this.opts.scoreParams, this.metrics, this.components.logger, {\n scoreCacheValidityMs: opts.heartbeatInterval\n });\n this.maxInboundStreams = options.maxInboundStreams;\n this.maxOutboundStreams = options.maxOutboundStreams;\n this.runOnTransientConnection = options.runOnTransientConnection;\n this.allowedTopics = (opts.allowedTopics != null) ? new Set(opts.allowedTopics) : null;\n }\n getPeers() {\n return [...this.peers.keys()].map((str) => (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_16__.peerIdFromString)(str));\n }\n isStarted() {\n return this.status.code === GossipStatusCode.started;\n }\n // LIFECYCLE METHODS\n /**\n * Mounts the gossipsub protocol onto the libp2p node and sends our\n * our subscriptions to every peer connected\n */\n async start() {\n // From pubsub\n if (this.isStarted()) {\n return;\n }\n this.log('starting');\n this.publishConfig = await (0,_utils_publishConfig_js__WEBPACK_IMPORTED_MODULE_17__.getPublishConfigFromPeerId)(this.globalSignaturePolicy, this.components.peerId);\n // Create the outbound inflight queue\n // This ensures that outbound stream creation happens sequentially\n this.outboundInflightQueue = (0,it_pushable__WEBPACK_IMPORTED_MODULE_2__.pushable)({ objectMode: true });\n (0,it_pipe__WEBPACK_IMPORTED_MODULE_1__.pipe)(this.outboundInflightQueue, async (source) => {\n for await (const { peerId, connection } of source) {\n await this.createOutboundStream(peerId, connection);\n }\n }).catch((e) => { this.log.error('outbound inflight queue error', e); });\n // set direct peer addresses in the address book\n await Promise.all(this.opts.directPeers.map(async (p) => {\n await this.components.peerStore.merge(p.id, {\n multiaddrs: p.addrs\n });\n }));\n const registrar = this.components.registrar;\n // Incoming streams\n // Called after a peer dials us\n await Promise.all(this.multicodecs.map(async (multicodec) => registrar.handle(multicodec, this.onIncomingStream.bind(this), {\n maxInboundStreams: this.maxInboundStreams,\n maxOutboundStreams: this.maxOutboundStreams,\n runOnTransientConnection: this.runOnTransientConnection\n })));\n // # How does Gossipsub interact with libp2p? Rough guide from Mar 2022\n //\n // ## Setup:\n // Gossipsub requests libp2p to callback, TBD\n //\n // `this.libp2p.handle()` registers a handler for `/meshsub/1.1.0` and other Gossipsub protocols\n // The handler callback is registered in libp2p Upgrader.protocols map.\n //\n // Upgrader receives an inbound connection from some transport and (`Upgrader.upgradeInbound`):\n // - Adds encryption (NOISE in our case)\n // - Multiplex stream\n // - Create a muxer and register that for each new stream call Upgrader.protocols handler\n //\n // ## Topology\n // - new instance of Topology (unlinked to libp2p) with handlers\n // - registar.register(topology)\n // register protocol with topology\n // Topology callbacks called on connection manager changes\n const topology = {\n onConnect: this.onPeerConnected.bind(this),\n onDisconnect: this.onPeerDisconnected.bind(this),\n notifyOnTransient: this.runOnTransientConnection\n };\n const registrarTopologyIds = await Promise.all(this.multicodecs.map(async (multicodec) => registrar.register(multicodec, topology)));\n // Schedule to start heartbeat after `GossipsubHeartbeatInitialDelay`\n const heartbeatTimeout = setTimeout(this.runHeartbeat, _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubHeartbeatInitialDelay);\n // Then, run heartbeat every `heartbeatInterval` offset by `GossipsubHeartbeatInitialDelay`\n this.status = {\n code: GossipStatusCode.started,\n registrarTopologyIds,\n heartbeatTimeout,\n hearbeatStartMs: Date.now() + _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubHeartbeatInitialDelay\n };\n this.score.start();\n // connect to direct peers\n this.directPeerInitial = setTimeout(() => {\n Promise.resolve()\n .then(async () => {\n await Promise.all(Array.from(this.direct).map(async (id) => this.connect(id)));\n })\n .catch((err) => {\n this.log(err);\n });\n }, _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubDirectConnectInitialDelay);\n this.log('started');\n }\n /**\n * Unmounts the gossipsub protocol and shuts down every connection\n */\n async stop() {\n this.log('stopping');\n // From pubsub\n if (this.status.code !== GossipStatusCode.started) {\n return;\n }\n const { registrarTopologyIds } = this.status;\n this.status = { code: GossipStatusCode.stopped };\n // unregister protocol and handlers\n const registrar = this.components.registrar;\n await Promise.all(this.multicodecs.map(async (multicodec) => registrar.unhandle(multicodec)));\n registrarTopologyIds.forEach((id) => { registrar.unregister(id); });\n this.outboundInflightQueue.end();\n const closePromises = [];\n for (const outboundStream of this.streamsOutbound.values()) {\n closePromises.push(outboundStream.close());\n }\n this.streamsOutbound.clear();\n for (const inboundStream of this.streamsInbound.values()) {\n closePromises.push(inboundStream.close());\n }\n this.streamsInbound.clear();\n await Promise.all(closePromises);\n this.peers.clear();\n this.subscriptions.clear();\n // Gossipsub\n if (this.heartbeatTimer != null) {\n this.heartbeatTimer.cancel();\n this.heartbeatTimer = null;\n }\n this.score.stop();\n this.mesh.clear();\n this.fanout.clear();\n this.fanoutLastpub.clear();\n this.gossip.clear();\n this.control.clear();\n this.peerhave.clear();\n this.iasked.clear();\n this.backoff.clear();\n this.outbound.clear();\n this.gossipTracer.clear();\n this.seenCache.clear();\n if (this.fastMsgIdCache != null)\n this.fastMsgIdCache.clear();\n if (this.directPeerInitial != null)\n clearTimeout(this.directPeerInitial);\n this.log('stopped');\n }\n /** FOR DEBUG ONLY - Dump peer stats for all peers. Data is cloned, safe to mutate */\n dumpPeerScoreStats() {\n return this.score.dumpPeerScoreStats();\n }\n /**\n * On an inbound stream opened\n */\n onIncomingStream({ stream, connection }) {\n if (!this.isStarted()) {\n return;\n }\n const peerId = connection.remotePeer;\n // add peer to router\n this.addPeer(peerId, connection.direction, connection.remoteAddr);\n // create inbound stream\n this.createInboundStream(peerId, stream);\n // attempt to create outbound stream\n this.outboundInflightQueue.push({ peerId, connection });\n }\n /**\n * Registrar notifies an established connection with pubsub protocol\n */\n onPeerConnected(peerId, connection) {\n this.metrics?.newConnectionCount.inc({ status: connection.status });\n // libp2p may emit a closed connection and never issue peer:disconnect event\n // see https://github.com/ChainSafe/js-libp2p-gossipsub/issues/398\n if (!this.isStarted() || connection.status !== 'open') {\n return;\n }\n this.addPeer(peerId, connection.direction, connection.remoteAddr);\n this.outboundInflightQueue.push({ peerId, connection });\n }\n /**\n * Registrar notifies a closing connection with pubsub protocol\n */\n onPeerDisconnected(peerId) {\n this.log('connection ended %p', peerId);\n this.removePeer(peerId);\n }\n async createOutboundStream(peerId, connection) {\n if (!this.isStarted()) {\n return;\n }\n const id = peerId.toString();\n if (!this.peers.has(id)) {\n return;\n }\n // TODO make this behavior more robust\n // This behavior is different than for inbound streams\n // If an outbound stream already exists, don't create a new stream\n if (this.streamsOutbound.has(id)) {\n return;\n }\n try {\n const stream = new _stream_js__WEBPACK_IMPORTED_MODULE_18__.OutboundStream(await connection.newStream(this.multicodecs, {\n runOnTransientConnection: this.runOnTransientConnection\n }), (e) => { this.log.error('outbound pipe error', e); }, { maxBufferSize: this.opts.maxOutboundBufferSize });\n this.log('create outbound stream %p', peerId);\n this.streamsOutbound.set(id, stream);\n const protocol = stream.protocol;\n if (protocol === _constants_js__WEBPACK_IMPORTED_MODULE_3__.FloodsubID) {\n this.floodsubPeers.add(id);\n }\n this.metrics?.peersPerProtocol.inc({ protocol }, 1);\n // Immediately send own subscriptions via the newly attached stream\n if (this.subscriptions.size > 0) {\n this.log('send subscriptions to', id);\n this.sendSubscriptions(id, Array.from(this.subscriptions), true);\n }\n }\n catch (e) {\n this.log.error('createOutboundStream error', e);\n }\n }\n createInboundStream(peerId, stream) {\n if (!this.isStarted()) {\n return;\n }\n const id = peerId.toString();\n if (!this.peers.has(id)) {\n return;\n }\n // TODO make this behavior more robust\n // This behavior is different than for outbound streams\n // If a peer initiates a new inbound connection\n // we assume that one is the new canonical inbound stream\n const priorInboundStream = this.streamsInbound.get(id);\n if (priorInboundStream !== undefined) {\n this.log('replacing existing inbound steam %s', id);\n priorInboundStream.close().catch((err) => { this.log.error(err); });\n }\n this.log('create inbound stream %s', id);\n const inboundStream = new _stream_js__WEBPACK_IMPORTED_MODULE_18__.InboundStream(stream, { maxDataLength: this.opts.maxInboundDataLength });\n this.streamsInbound.set(id, inboundStream);\n this.pipePeerReadStream(peerId, inboundStream.source).catch((err) => { this.log(err); });\n }\n /**\n * Add a peer to the router\n */\n addPeer(peerId, direction, addr) {\n const id = peerId.toString();\n if (!this.peers.has(id)) {\n this.log('new peer %p', peerId);\n this.peers.add(id);\n // Add to peer scoring\n this.score.addPeer(id);\n const currentIP = (0,_utils_multiaddr_js__WEBPACK_IMPORTED_MODULE_19__.multiaddrToIPStr)(addr);\n if (currentIP !== null) {\n this.score.addIP(id, currentIP);\n }\n else {\n this.log('Added peer has no IP in current address %s %s', id, addr.toString());\n }\n // track the connection direction. Don't allow to unset outbound\n if (!this.outbound.has(id)) {\n this.outbound.set(id, direction === 'outbound');\n }\n }\n }\n /**\n * Removes a peer from the router\n */\n removePeer(peerId) {\n const id = peerId.toString();\n if (!this.peers.has(id)) {\n return;\n }\n // delete peer\n this.log('delete peer %p', peerId);\n this.peers.delete(id);\n const outboundStream = this.streamsOutbound.get(id);\n const inboundStream = this.streamsInbound.get(id);\n if (outboundStream != null) {\n this.metrics?.peersPerProtocol.inc({ protocol: outboundStream.protocol }, -1);\n }\n // close streams\n outboundStream?.close().catch((err) => { this.log.error(err); });\n inboundStream?.close().catch((err) => { this.log.error(err); });\n // remove streams\n this.streamsOutbound.delete(id);\n this.streamsInbound.delete(id);\n // remove peer from topics map\n for (const peers of this.topics.values()) {\n peers.delete(id);\n }\n // Remove this peer from the mesh\n for (const [topicStr, peers] of this.mesh) {\n if (peers.delete(id)) {\n this.metrics?.onRemoveFromMesh(topicStr, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.ChurnReason.Dc, 1);\n }\n }\n // Remove this peer from the fanout\n for (const peers of this.fanout.values()) {\n peers.delete(id);\n }\n // Remove from floodsubPeers\n this.floodsubPeers.delete(id);\n // Remove from gossip mapping\n this.gossip.delete(id);\n // Remove from control mapping\n this.control.delete(id);\n // Remove from backoff mapping\n this.outbound.delete(id);\n // Remove from peer scoring\n this.score.removePeer(id);\n this.acceptFromWhitelist.delete(id);\n }\n // API METHODS\n get started() {\n return this.status.code === GossipStatusCode.started;\n }\n /**\n * Get a the peer-ids in a topic mesh\n */\n getMeshPeers(topic) {\n const peersInTopic = this.mesh.get(topic);\n return (peersInTopic != null) ? Array.from(peersInTopic) : [];\n }\n /**\n * Get a list of the peer-ids that are subscribed to one topic.\n */\n getSubscribers(topic) {\n const peersInTopic = this.topics.get(topic);\n return ((peersInTopic != null) ? Array.from(peersInTopic) : []).map((str) => (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_16__.peerIdFromString)(str));\n }\n /**\n * Get the list of topics which the peer is subscribed to.\n */\n getTopics() {\n return Array.from(this.subscriptions);\n }\n // TODO: Reviewing Pubsub API\n // MESSAGE METHODS\n /**\n * Responsible for processing each RPC message received by other peers.\n */\n async pipePeerReadStream(peerId, stream) {\n try {\n await (0,it_pipe__WEBPACK_IMPORTED_MODULE_1__.pipe)(stream, async (source) => {\n for await (const data of source) {\n try {\n // TODO: Check max gossip message size, before decodeRpc()\n const rpcBytes = data.subarray();\n // Note: This function may throw, it must be wrapped in a try {} catch {} to prevent closing the stream.\n // TODO: What should we do if the entire RPC is invalid?\n const rpc = _message_rpc_js__WEBPACK_IMPORTED_MODULE_20__.RPC.decode(rpcBytes, {\n limits: {\n subscriptions: this.decodeRpcLimits.maxSubscriptions,\n messages: this.decodeRpcLimits.maxMessages,\n control$: {\n ihave: this.decodeRpcLimits.maxIhaveMessageIDs,\n iwant: this.decodeRpcLimits.maxIwantMessageIDs,\n graft: this.decodeRpcLimits.maxControlMessages,\n prune: this.decodeRpcLimits.maxControlMessages,\n prune$: {\n peers: this.decodeRpcLimits.maxPeerInfos\n }\n }\n }\n });\n this.metrics?.onRpcRecv(rpc, rpcBytes.length);\n // Since processRpc may be overridden entirely in unsafe ways,\n // the simplest/safest option here is to wrap in a function and capture all errors\n // to prevent a top-level unhandled exception\n // This processing of rpc messages should happen without awaiting full validation/execution of prior messages\n if (this.opts.awaitRpcHandler) {\n try {\n await this.handleReceivedRpc(peerId, rpc);\n }\n catch (err) {\n this.metrics?.onRpcRecvError();\n this.log(err);\n }\n }\n else {\n this.handleReceivedRpc(peerId, rpc).catch((err) => {\n this.metrics?.onRpcRecvError();\n this.log(err);\n });\n }\n }\n catch (e) {\n this.metrics?.onRpcDataError();\n this.log(e);\n }\n }\n });\n }\n catch (err) {\n this.metrics?.onPeerReadStreamError();\n this.handlePeerReadStreamError(err, peerId);\n }\n }\n /**\n * Handle error when read stream pipe throws, less of the functional use but more\n * to for testing purposes to spy on the error handling\n * */\n handlePeerReadStreamError(err, peerId) {\n this.log.error(err);\n this.onPeerDisconnected(peerId);\n }\n /**\n * Handles an rpc request from a peer\n */\n async handleReceivedRpc(from, rpc) {\n // Check if peer is graylisted in which case we ignore the event\n if (!this.acceptFrom(from.toString())) {\n this.log('received message from unacceptable peer %p', from);\n this.metrics?.rpcRecvNotAccepted.inc();\n return;\n }\n const subscriptions = (rpc.subscriptions != null) ? rpc.subscriptions.length : 0;\n const messages = (rpc.messages != null) ? rpc.messages.length : 0;\n let ihave = 0;\n let iwant = 0;\n let graft = 0;\n let prune = 0;\n if (rpc.control != null) {\n if (rpc.control.ihave != null)\n ihave = rpc.control.ihave.length;\n if (rpc.control.iwant != null)\n iwant = rpc.control.iwant.length;\n if (rpc.control.graft != null)\n graft = rpc.control.graft.length;\n if (rpc.control.prune != null)\n prune = rpc.control.prune.length;\n }\n this.log(`rpc.from ${from.toString()} subscriptions ${subscriptions} messages ${messages} ihave ${ihave} iwant ${iwant} graft ${graft} prune ${prune}`);\n // Handle received subscriptions\n if ((rpc.subscriptions != null) && rpc.subscriptions.length > 0) {\n // update peer subscriptions\n const subscriptions = [];\n rpc.subscriptions.forEach((subOpt) => {\n const topic = subOpt.topic;\n const subscribe = subOpt.subscribe === true;\n if (topic != null) {\n if ((this.allowedTopics != null) && !this.allowedTopics.has(topic)) {\n // Not allowed: subscription data-structures are not bounded by topic count\n // TODO: Should apply behaviour penalties?\n return;\n }\n this.handleReceivedSubscription(from, topic, subscribe);\n subscriptions.push({ topic, subscribe });\n }\n });\n this.safeDispatchEvent('subscription-change', {\n detail: { peerId: from, subscriptions }\n });\n }\n // Handle messages\n // TODO: (up to limit)\n for (const message of rpc.messages) {\n if ((this.allowedTopics != null) && !this.allowedTopics.has(message.topic)) {\n // Not allowed: message cache data-structures are not bounded by topic count\n // TODO: Should apply behaviour penalties?\n continue;\n }\n const handleReceivedMessagePromise = this.handleReceivedMessage(from, message)\n // Should never throw, but handle just in case\n .catch((err) => {\n this.metrics?.onMsgRecvError(message.topic);\n this.log(err);\n });\n if (this.opts.awaitRpcMessageHandler) {\n await handleReceivedMessagePromise;\n }\n }\n // Handle control messages\n if (rpc.control != null) {\n await this.handleControlMessage(from.toString(), rpc.control);\n }\n }\n /**\n * Handles a subscription change from a peer\n */\n handleReceivedSubscription(from, topic, subscribe) {\n this.log('subscription update from %p topic %s', from, topic);\n let topicSet = this.topics.get(topic);\n if (topicSet == null) {\n topicSet = new Set();\n this.topics.set(topic, topicSet);\n }\n if (subscribe) {\n // subscribe peer to new topic\n topicSet.add(from.toString());\n }\n else {\n // unsubscribe from existing topic\n topicSet.delete(from.toString());\n }\n // TODO: rust-libp2p has A LOT more logic here\n }\n /**\n * Handles a newly received message from an RPC.\n * May forward to all peers in the mesh.\n */\n async handleReceivedMessage(from, rpcMsg) {\n this.metrics?.onMsgRecvPreValidation(rpcMsg.topic);\n const validationResult = await this.validateReceivedMessage(from, rpcMsg);\n this.metrics?.onPrevalidationResult(rpcMsg.topic, validationResult.code);\n const validationCode = validationResult.code;\n switch (validationCode) {\n case _types_js__WEBPACK_IMPORTED_MODULE_21__.MessageStatus.duplicate:\n // Report the duplicate\n this.score.duplicateMessage(from.toString(), validationResult.msgIdStr, rpcMsg.topic);\n // due to the collision of fastMsgIdFn, 2 different messages may end up the same fastMsgId\n // so we need to also mark the duplicate message as delivered or the promise is not resolved\n // and peer gets penalized. See https://github.com/ChainSafe/js-libp2p-gossipsub/pull/385\n this.gossipTracer.deliverMessage(validationResult.msgIdStr, true);\n this.mcache.observeDuplicate(validationResult.msgIdStr, from.toString());\n return;\n case _types_js__WEBPACK_IMPORTED_MODULE_21__.MessageStatus.invalid:\n // invalid messages received\n // metrics.register_invalid_message(&raw_message.topic)\n // Tell peer_score about reject\n // Reject the original source, and any duplicates we've seen from other peers.\n if (validationResult.msgIdStr != null) {\n const msgIdStr = validationResult.msgIdStr;\n this.score.rejectMessage(from.toString(), msgIdStr, rpcMsg.topic, validationResult.reason);\n this.gossipTracer.rejectMessage(msgIdStr, validationResult.reason);\n }\n else {\n this.score.rejectInvalidMessage(from.toString(), rpcMsg.topic);\n }\n this.metrics?.onMsgRecvInvalid(rpcMsg.topic, validationResult);\n return;\n case _types_js__WEBPACK_IMPORTED_MODULE_21__.MessageStatus.valid:\n // Tells score that message arrived (but is maybe not fully validated yet).\n // Consider the message as delivered for gossip promises.\n this.score.validateMessage(validationResult.messageId.msgIdStr);\n this.gossipTracer.deliverMessage(validationResult.messageId.msgIdStr);\n // Add the message to our memcache\n // if no validation is required, mark the message as validated\n this.mcache.put(validationResult.messageId, rpcMsg, !this.opts.asyncValidation);\n // Dispatch the message to the user if we are subscribed to the topic\n if (this.subscriptions.has(rpcMsg.topic)) {\n const isFromSelf = this.components.peerId.equals(from);\n if (!isFromSelf || this.opts.emitSelf) {\n super.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CustomEvent('gossipsub:message', {\n detail: {\n propagationSource: from,\n msgId: validationResult.messageId.msgIdStr,\n msg: validationResult.msg\n }\n }));\n // TODO: Add option to switch between emit per topic or all messages in one\n super.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CustomEvent('message', { detail: validationResult.msg }));\n }\n }\n // Forward the message to mesh peers, if no validation is required\n // If asyncValidation is ON, expect the app layer to call reportMessageValidationResult(), then forward\n if (!this.opts.asyncValidation) {\n // TODO: in rust-libp2p\n // .forward_msg(&msg_id, raw_message, Some(propagation_source))\n this.forwardMessage(validationResult.messageId.msgIdStr, rpcMsg, from.toString());\n }\n break;\n default:\n throw new Error(`Invalid validation result: ${validationCode}`);\n }\n }\n /**\n * Handles a newly received message from an RPC.\n * May forward to all peers in the mesh.\n */\n async validateReceivedMessage(propagationSource, rpcMsg) {\n // Fast message ID stuff\n const fastMsgIdStr = this.fastMsgIdFn?.(rpcMsg);\n const msgIdCached = fastMsgIdStr !== undefined ? this.fastMsgIdCache?.get(fastMsgIdStr) : undefined;\n if (msgIdCached != null) {\n // This message has been seen previously. Ignore it\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_21__.MessageStatus.duplicate, msgIdStr: msgIdCached };\n }\n // Perform basic validation on message and convert to RawGossipsubMessage for fastMsgIdFn()\n const validationResult = await (0,_utils_buildRawMessage_js__WEBPACK_IMPORTED_MODULE_22__.validateToRawMessage)(this.globalSignaturePolicy, rpcMsg);\n if (!validationResult.valid) {\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_21__.MessageStatus.invalid, reason: _types_js__WEBPACK_IMPORTED_MODULE_21__.RejectReason.Error, error: validationResult.error };\n }\n const msg = validationResult.message;\n // Try and perform the data transform to the message. If it fails, consider it invalid.\n try {\n if (this.dataTransform != null) {\n msg.data = this.dataTransform.inboundTransform(rpcMsg.topic, msg.data);\n }\n }\n catch (e) {\n this.log('Invalid message, transform failed', e);\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_21__.MessageStatus.invalid, reason: _types_js__WEBPACK_IMPORTED_MODULE_21__.RejectReason.Error, error: _types_js__WEBPACK_IMPORTED_MODULE_21__.ValidateError.TransformFailed };\n }\n // TODO: Check if message is from a blacklisted source or propagation origin\n // - Reject any message from a blacklisted peer\n // - Also reject any message that originated from a blacklisted peer\n // - reject messages claiming to be from ourselves but not locally published\n // Calculate the message id on the transformed data.\n const msgId = await this.msgIdFn(msg);\n const msgIdStr = this.msgIdToStrFn(msgId);\n const messageId = { msgId, msgIdStr };\n // Add the message to the duplicate caches\n if (fastMsgIdStr !== undefined && (this.fastMsgIdCache != null)) {\n const collision = this.fastMsgIdCache.put(fastMsgIdStr, msgIdStr);\n if (collision) {\n this.metrics?.fastMsgIdCacheCollision.inc();\n }\n }\n if (this.seenCache.has(msgIdStr)) {\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_21__.MessageStatus.duplicate, msgIdStr };\n }\n else {\n this.seenCache.put(msgIdStr);\n }\n // (Optional) Provide custom validation here with dynamic validators per topic\n // NOTE: This custom topicValidator() must resolve fast (< 100ms) to allow scores\n // to not penalize peers for long validation times.\n const topicValidator = this.topicValidators.get(rpcMsg.topic);\n if (topicValidator != null) {\n let acceptance;\n // Use try {} catch {} in case topicValidator() is synchronous\n try {\n acceptance = await topicValidator(propagationSource, msg);\n }\n catch (e) {\n const errCode = e.code;\n if (errCode === _constants_js__WEBPACK_IMPORTED_MODULE_3__.ERR_TOPIC_VALIDATOR_IGNORE)\n acceptance = _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.TopicValidatorResult.Ignore;\n if (errCode === _constants_js__WEBPACK_IMPORTED_MODULE_3__.ERR_TOPIC_VALIDATOR_REJECT)\n acceptance = _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.TopicValidatorResult.Reject;\n else\n acceptance = _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.TopicValidatorResult.Ignore;\n }\n if (acceptance !== _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.TopicValidatorResult.Accept) {\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_21__.MessageStatus.invalid, reason: (0,_types_js__WEBPACK_IMPORTED_MODULE_21__.rejectReasonFromAcceptance)(acceptance), msgIdStr };\n }\n }\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_21__.MessageStatus.valid, messageId, msg };\n }\n /**\n * Return score of a peer.\n */\n getScore(peerId) {\n return this.score.score(peerId);\n }\n /**\n * Send an rpc object to a peer with subscriptions\n */\n sendSubscriptions(toPeer, topics, subscribe) {\n this.sendRpc(toPeer, {\n subscriptions: topics.map((topic) => ({ topic, subscribe })),\n messages: []\n });\n }\n /**\n * Handles an rpc control message from a peer\n */\n async handleControlMessage(id, controlMsg) {\n if (controlMsg === undefined) {\n return;\n }\n const iwant = (controlMsg.ihave != null) ? this.handleIHave(id, controlMsg.ihave) : [];\n const ihave = (controlMsg.iwant != null) ? this.handleIWant(id, controlMsg.iwant) : [];\n const prune = (controlMsg.graft != null) ? await this.handleGraft(id, controlMsg.graft) : [];\n (controlMsg.prune != null) && (await this.handlePrune(id, controlMsg.prune));\n if ((iwant.length === 0) && (ihave.length === 0) && (prune.length === 0)) {\n return;\n }\n const sent = this.sendRpc(id, (0,_utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__.createGossipRpc)(ihave, { iwant, prune }));\n const iwantMessageIds = iwant[0]?.messageIDs;\n if (iwantMessageIds != null) {\n if (sent) {\n this.gossipTracer.addPromise(id, iwantMessageIds);\n }\n else {\n this.metrics?.iwantPromiseUntracked.inc(1);\n }\n }\n }\n /**\n * Whether to accept a message from a peer\n */\n acceptFrom(id) {\n if (this.direct.has(id)) {\n return true;\n }\n const now = Date.now();\n const entry = this.acceptFromWhitelist.get(id);\n if ((entry != null) && entry.messagesAccepted < _constants_js__WEBPACK_IMPORTED_MODULE_3__.ACCEPT_FROM_WHITELIST_MAX_MESSAGES && entry.acceptUntil >= now) {\n entry.messagesAccepted += 1;\n return true;\n }\n const score = this.score.score(id);\n if (score >= _constants_js__WEBPACK_IMPORTED_MODULE_3__.ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE) {\n // peer is unlikely to be able to drop its score to `graylistThreshold`\n // after 128 messages or 1s\n this.acceptFromWhitelist.set(id, {\n messagesAccepted: 0,\n acceptUntil: now + _constants_js__WEBPACK_IMPORTED_MODULE_3__.ACCEPT_FROM_WHITELIST_DURATION_MS\n });\n }\n else {\n this.acceptFromWhitelist.delete(id);\n }\n return score >= this.opts.scoreThresholds.graylistThreshold;\n }\n /**\n * Handles IHAVE messages\n */\n handleIHave(id, ihave) {\n if (ihave.length === 0) {\n return [];\n }\n // we ignore IHAVE gossip from any peer whose score is below the gossips threshold\n const score = this.score.score(id);\n if (score < this.opts.scoreThresholds.gossipThreshold) {\n this.log('IHAVE: ignoring peer %s with score below threshold [ score = %d ]', id, score);\n this.metrics?.ihaveRcvIgnored.inc({ reason: _metrics_js__WEBPACK_IMPORTED_MODULE_13__.IHaveIgnoreReason.LowScore });\n return [];\n }\n // IHAVE flood protection\n const peerhave = (this.peerhave.get(id) ?? 0) + 1;\n this.peerhave.set(id, peerhave);\n if (peerhave > _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubMaxIHaveMessages) {\n this.log('IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring', id, peerhave);\n this.metrics?.ihaveRcvIgnored.inc({ reason: _metrics_js__WEBPACK_IMPORTED_MODULE_13__.IHaveIgnoreReason.MaxIhave });\n return [];\n }\n const iasked = this.iasked.get(id) ?? 0;\n if (iasked >= _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubMaxIHaveLength) {\n this.log('IHAVE: peer %s has already advertised too many messages (%d); ignoring', id, iasked);\n this.metrics?.ihaveRcvIgnored.inc({ reason: _metrics_js__WEBPACK_IMPORTED_MODULE_13__.IHaveIgnoreReason.MaxIasked });\n return [];\n }\n // string msgId => msgId\n const iwant = new Map();\n ihave.forEach(({ topicID, messageIDs }) => {\n if (topicID == null || (messageIDs == null) || !this.mesh.has(topicID)) {\n return;\n }\n let idonthave = 0;\n messageIDs.forEach((msgId) => {\n const msgIdStr = this.msgIdToStrFn(msgId);\n if (!this.seenCache.has(msgIdStr)) {\n iwant.set(msgIdStr, msgId);\n idonthave++;\n }\n });\n this.metrics?.onIhaveRcv(topicID, messageIDs.length, idonthave);\n });\n if (iwant.size === 0) {\n return [];\n }\n let iask = iwant.size;\n if (iask + iasked > _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubMaxIHaveLength) {\n iask = _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubMaxIHaveLength - iasked;\n }\n this.log('IHAVE: Asking for %d out of %d messages from %s', iask, iwant.size, id);\n let iwantList = Array.from(iwant.values());\n // ask in random order\n (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_24__.shuffle)(iwantList);\n // truncate to the messages we are actually asking for and update the iasked counter\n iwantList = iwantList.slice(0, iask);\n this.iasked.set(id, iasked + iask);\n // do not add gossipTracer promise here until a successful sendRpc()\n return [\n {\n messageIDs: iwantList\n }\n ];\n }\n /**\n * Handles IWANT messages\n * Returns messages to send back to peer\n */\n handleIWant(id, iwant) {\n if (iwant.length === 0) {\n return [];\n }\n // we don't respond to IWANT requests from any per whose score is below the gossip threshold\n const score = this.score.score(id);\n if (score < this.opts.scoreThresholds.gossipThreshold) {\n this.log('IWANT: ignoring peer %s with score below threshold [score = %d]', id, score);\n return [];\n }\n const ihave = new Map();\n const iwantByTopic = new Map();\n let iwantDonthave = 0;\n iwant.forEach(({ messageIDs }) => {\n messageIDs?.forEach((msgId) => {\n const msgIdStr = this.msgIdToStrFn(msgId);\n const entry = this.mcache.getWithIWantCount(msgIdStr, id);\n if (entry == null) {\n iwantDonthave++;\n return;\n }\n iwantByTopic.set(entry.msg.topic, 1 + (iwantByTopic.get(entry.msg.topic) ?? 0));\n if (entry.count > _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubGossipRetransmission) {\n this.log('IWANT: Peer %s has asked for message %s too many times: ignoring request', id, msgId);\n return;\n }\n ihave.set(msgIdStr, entry.msg);\n });\n });\n this.metrics?.onIwantRcv(iwantByTopic, iwantDonthave);\n if (ihave.size === 0) {\n this.log('IWANT: Could not provide any wanted messages to %s', id);\n return [];\n }\n this.log('IWANT: Sending %d messages to %s', ihave.size, id);\n return Array.from(ihave.values());\n }\n /**\n * Handles Graft messages\n */\n async handleGraft(id, graft) {\n const prune = [];\n const score = this.score.score(id);\n const now = Date.now();\n let doPX = this.opts.doPX;\n graft.forEach(({ topicID }) => {\n if (topicID == null) {\n return;\n }\n const peersInMesh = this.mesh.get(topicID);\n if (peersInMesh == null) {\n // don't do PX when there is an unknown topic to avoid leaking our peers\n doPX = false;\n // spam hardening: ignore GRAFTs for unknown topics\n return;\n }\n // check if peer is already in the mesh; if so do nothing\n if (peersInMesh.has(id)) {\n return;\n }\n // we don't GRAFT to/from direct peers; complain loudly if this happens\n if (this.direct.has(id)) {\n this.log('GRAFT: ignoring request from direct peer %s', id);\n // this is possibly a bug from a non-reciprical configuration; send a PRUNE\n prune.push(topicID);\n // but don't px\n doPX = false;\n return;\n }\n // make sure we are not backing off that peer\n const expire = this.backoff.get(topicID)?.get(id);\n if (typeof expire === 'number' && now < expire) {\n this.log('GRAFT: ignoring backed off peer %s', id);\n // add behavioral penalty\n this.score.addPenalty(id, 1, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.ScorePenalty.GraftBackoff);\n // no PX\n doPX = false;\n // check the flood cutoff -- is the GRAFT coming too fast?\n const floodCutoff = expire + this.opts.graftFloodThreshold - this.opts.pruneBackoff;\n if (now < floodCutoff) {\n // extra penalty\n this.score.addPenalty(id, 1, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.ScorePenalty.GraftBackoff);\n }\n // refresh the backoff\n this.addBackoff(id, topicID);\n prune.push(topicID);\n return;\n }\n // check the score\n if (score < 0) {\n // we don't GRAFT peers with negative score\n this.log('GRAFT: ignoring peer %s with negative score: score=%d, topic=%s', id, score, topicID);\n // we do send them PRUNE however, because it's a matter of protocol correctness\n prune.push(topicID);\n // but we won't PX to them\n doPX = false;\n // add/refresh backoff so that we don't reGRAFT too early even if the score decays\n this.addBackoff(id, topicID);\n return;\n }\n // check the number of mesh peers; if it is at (or over) Dhi, we only accept grafts\n // from peers with outbound connections; this is a defensive check to restrict potential\n // mesh takeover attacks combined with love bombing\n if (peersInMesh.size >= this.opts.Dhi && !(this.outbound.get(id) ?? false)) {\n prune.push(topicID);\n this.addBackoff(id, topicID);\n return;\n }\n this.log('GRAFT: Add mesh link from %s in %s', id, topicID);\n this.score.graft(id, topicID);\n peersInMesh.add(id);\n this.metrics?.onAddToMesh(topicID, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.InclusionReason.Subscribed, 1);\n });\n if (prune.length === 0) {\n return [];\n }\n const onUnsubscribe = false;\n return Promise.all(prune.map(async (topic) => this.makePrune(id, topic, doPX, onUnsubscribe)));\n }\n /**\n * Handles Prune messages\n */\n async handlePrune(id, prune) {\n const score = this.score.score(id);\n for (const { topicID, backoff, peers } of prune) {\n if (topicID == null) {\n continue;\n }\n const peersInMesh = this.mesh.get(topicID);\n if (peersInMesh == null) {\n return;\n }\n this.log('PRUNE: Remove mesh link to %s in %s', id, topicID);\n this.score.prune(id, topicID);\n if (peersInMesh.has(id)) {\n peersInMesh.delete(id);\n this.metrics?.onRemoveFromMesh(topicID, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.ChurnReason.Prune, 1);\n }\n // is there a backoff specified by the peer? if so obey it\n if (typeof backoff === 'number' && backoff > 0) {\n this.doAddBackoff(id, topicID, backoff * 1000);\n }\n else {\n this.addBackoff(id, topicID);\n }\n // PX\n if ((peers != null) && (peers.length > 0)) {\n // we ignore PX from peers with insufficient scores\n if (score < this.opts.scoreThresholds.acceptPXThreshold) {\n this.log('PRUNE: ignoring PX from peer %s with insufficient score [score = %d, topic = %s]', id, score, topicID);\n continue;\n }\n await this.pxConnect(peers);\n }\n }\n }\n /**\n * Add standard backoff log for a peer in a topic\n */\n addBackoff(id, topic) {\n this.doAddBackoff(id, topic, this.opts.pruneBackoff);\n }\n /**\n * Add backoff expiry interval for a peer in a topic\n *\n * @param id\n * @param topic\n * @param intervalMs - backoff duration in milliseconds\n */\n doAddBackoff(id, topic, intervalMs) {\n let backoff = this.backoff.get(topic);\n if (backoff == null) {\n backoff = new Map();\n this.backoff.set(topic, backoff);\n }\n const expire = Date.now() + intervalMs;\n const existingExpire = backoff.get(id) ?? 0;\n if (existingExpire < expire) {\n backoff.set(id, expire);\n }\n }\n /**\n * Apply penalties from broken IHAVE/IWANT promises\n */\n applyIwantPenalties() {\n this.gossipTracer.getBrokenPromises().forEach((count, p) => {\n this.log(\"peer %s didn't follow up in %d IWANT requests; adding penalty\", p, count);\n this.score.addPenalty(p, count, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.ScorePenalty.BrokenPromise);\n });\n }\n /**\n * Clear expired backoff expiries\n */\n clearBackoff() {\n // we only clear once every GossipsubPruneBackoffTicks ticks to avoid iterating over the maps too much\n if (this.heartbeatTicks % _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubPruneBackoffTicks !== 0) {\n return;\n }\n const now = Date.now();\n this.backoff.forEach((backoff, topic) => {\n backoff.forEach((expire, id) => {\n // add some slack time to the expiration, see https://github.com/libp2p/specs/pull/289\n if (expire + _constants_js__WEBPACK_IMPORTED_MODULE_3__.BACKOFF_SLACK * this.opts.heartbeatInterval < now) {\n backoff.delete(id);\n }\n });\n if (backoff.size === 0) {\n this.backoff.delete(topic);\n }\n });\n }\n /**\n * Maybe reconnect to direct peers\n */\n async directConnect() {\n const toconnect = [];\n this.direct.forEach((id) => {\n if (!this.streamsOutbound.has(id)) {\n toconnect.push(id);\n }\n });\n await Promise.all(toconnect.map(async (id) => this.connect(id)));\n }\n /**\n * Maybe attempt connection given signed peer records\n */\n async pxConnect(peers) {\n if (peers.length > this.opts.prunePeers) {\n (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_24__.shuffle)(peers);\n peers = peers.slice(0, this.opts.prunePeers);\n }\n const toconnect = [];\n await Promise.all(peers.map(async (pi) => {\n if (pi.peerID == null) {\n return;\n }\n const peer = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_16__.peerIdFromBytes)(pi.peerID);\n const p = peer.toString();\n if (this.peers.has(p)) {\n return;\n }\n if (pi.signedPeerRecord == null) {\n toconnect.push(p);\n return;\n }\n // The peer sent us a signed record\n // This is not a record from the peer who sent the record, but another peer who is connected with it\n // Ensure that it is valid\n try {\n if (!(await this.components.peerStore.consumePeerRecord(pi.signedPeerRecord, peer))) {\n this.log('bogus peer record obtained through px: could not add peer record to address book');\n return;\n }\n toconnect.push(p);\n }\n catch (e) {\n this.log('bogus peer record obtained through px: invalid signature or not a peer record');\n }\n }));\n if (toconnect.length === 0) {\n return;\n }\n await Promise.all(toconnect.map(async (id) => this.connect(id)));\n }\n /**\n * Connect to a peer using the gossipsub protocol\n */\n async connect(id) {\n this.log('Initiating connection with %s', id);\n const peerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_16__.peerIdFromString)(id);\n const connection = await this.components.connectionManager.openConnection(peerId);\n for (const multicodec of this.multicodecs) {\n for (const topology of this.components.registrar.getTopologies(multicodec)) {\n topology.onConnect?.(peerId, connection);\n }\n }\n }\n /**\n * Subscribes to a topic\n */\n subscribe(topic) {\n if (this.status.code !== GossipStatusCode.started) {\n throw new Error('Pubsub has not started');\n }\n if (!this.subscriptions.has(topic)) {\n this.subscriptions.add(topic);\n for (const peerId of this.peers.keys()) {\n this.sendSubscriptions(peerId, [topic], true);\n }\n }\n this.join(topic);\n }\n /**\n * Unsubscribe to a topic\n */\n unsubscribe(topic) {\n if (this.status.code !== GossipStatusCode.started) {\n throw new Error('Pubsub is not started');\n }\n const wasSubscribed = this.subscriptions.delete(topic);\n this.log('unsubscribe from %s - am subscribed %s', topic, wasSubscribed);\n if (wasSubscribed) {\n for (const peerId of this.peers.keys()) {\n this.sendSubscriptions(peerId, [topic], false);\n }\n }\n this.leave(topic);\n }\n /**\n * Join topic\n */\n join(topic) {\n if (this.status.code !== GossipStatusCode.started) {\n throw new Error('Gossipsub has not started');\n }\n // if we are already in the mesh, return\n if (this.mesh.has(topic)) {\n return;\n }\n this.log('JOIN %s', topic);\n this.metrics?.onJoin(topic);\n const toAdd = new Set();\n const backoff = this.backoff.get(topic);\n // check if we have mesh_n peers in fanout[topic] and add them to the mesh if we do,\n // removing the fanout entry.\n const fanoutPeers = this.fanout.get(topic);\n if (fanoutPeers != null) {\n // Remove fanout entry and the last published time\n this.fanout.delete(topic);\n this.fanoutLastpub.delete(topic);\n // remove explicit peers, peers with negative scores, and backoffed peers\n fanoutPeers.forEach((id) => {\n if (!this.direct.has(id) && this.score.score(id) >= 0 && ((backoff == null) || !backoff.has(id))) {\n toAdd.add(id);\n }\n });\n this.metrics?.onAddToMesh(topic, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.InclusionReason.Fanout, toAdd.size);\n }\n // check if we need to get more peers, which we randomly select\n if (toAdd.size < this.opts.D) {\n const fanoutCount = toAdd.size;\n const newPeers = this.getRandomGossipPeers(topic, this.opts.D, (id) => \n // filter direct peers and peers with negative score\n !toAdd.has(id) && !this.direct.has(id) && this.score.score(id) >= 0 && ((backoff == null) || !backoff.has(id)));\n newPeers.forEach((peer) => {\n toAdd.add(peer);\n });\n this.metrics?.onAddToMesh(topic, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.InclusionReason.Random, toAdd.size - fanoutCount);\n }\n this.mesh.set(topic, toAdd);\n toAdd.forEach((id) => {\n this.log('JOIN: Add mesh link to %s in %s', id, topic);\n this.sendGraft(id, topic);\n // rust-libp2p\n // - peer_score.graft()\n // - Self::control_pool_add()\n // - peer_added_to_mesh()\n });\n }\n /**\n * Leave topic\n */\n leave(topic) {\n if (this.status.code !== GossipStatusCode.started) {\n throw new Error('Gossipsub has not started');\n }\n this.log('LEAVE %s', topic);\n this.metrics?.onLeave(topic);\n // Send PRUNE to mesh peers\n const meshPeers = this.mesh.get(topic);\n if (meshPeers != null) {\n Promise.all(Array.from(meshPeers).map(async (id) => {\n this.log('LEAVE: Remove mesh link to %s in %s', id, topic);\n await this.sendPrune(id, topic);\n })).catch((err) => {\n this.log('Error sending prunes to mesh peers', err);\n });\n this.mesh.delete(topic);\n }\n }\n selectPeersToForward(topic, propagationSource, excludePeers) {\n const tosend = new Set();\n // Add explicit peers\n const peersInTopic = this.topics.get(topic);\n if (peersInTopic != null) {\n this.direct.forEach((peer) => {\n if (peersInTopic.has(peer) && propagationSource !== peer && !(excludePeers?.has(peer) ?? false)) {\n tosend.add(peer);\n }\n });\n // As of Mar 2022, spec + golang-libp2p include this while rust-libp2p does not\n // rust-libp2p: https://github.com/libp2p/rust-libp2p/blob/6cc3b4ec52c922bfcf562a29b5805c3150e37c75/protocols/gossipsub/src/behaviour.rs#L2693\n // spec: https://github.com/libp2p/specs/blob/10712c55ab309086a52eec7d25f294df4fa96528/pubsub/gossipsub/gossipsub-v1.0.md?plain=1#L361\n this.floodsubPeers.forEach((peer) => {\n if (peersInTopic.has(peer) &&\n propagationSource !== peer &&\n !(excludePeers?.has(peer) ?? false) &&\n this.score.score(peer) >= this.opts.scoreThresholds.publishThreshold) {\n tosend.add(peer);\n }\n });\n }\n // add mesh peers\n const meshPeers = this.mesh.get(topic);\n if ((meshPeers != null) && meshPeers.size > 0) {\n meshPeers.forEach((peer) => {\n if (propagationSource !== peer && !(excludePeers?.has(peer) ?? false)) {\n tosend.add(peer);\n }\n });\n }\n return tosend;\n }\n selectPeersToPublish(topic) {\n const tosend = new Set();\n const tosendCount = {\n direct: 0,\n floodsub: 0,\n mesh: 0,\n fanout: 0\n };\n const peersInTopic = this.topics.get(topic);\n if (peersInTopic != null) {\n // flood-publish behavior\n // send to direct peers and _all_ peers meeting the publishThreshold\n if (this.opts.floodPublish) {\n peersInTopic.forEach((id) => {\n if (this.direct.has(id)) {\n tosend.add(id);\n tosendCount.direct++;\n }\n else if (this.score.score(id) >= this.opts.scoreThresholds.publishThreshold) {\n tosend.add(id);\n tosendCount.floodsub++;\n }\n });\n }\n else {\n // non-flood-publish behavior\n // send to direct peers, subscribed floodsub peers\n // and some mesh peers above publishThreshold\n // direct peers (if subscribed)\n this.direct.forEach((id) => {\n if (peersInTopic.has(id)) {\n tosend.add(id);\n tosendCount.direct++;\n }\n });\n // floodsub peers\n // Note: if there are no floodsub peers, we save a loop through peersInTopic Map\n this.floodsubPeers.forEach((id) => {\n if (peersInTopic.has(id) && this.score.score(id) >= this.opts.scoreThresholds.publishThreshold) {\n tosend.add(id);\n tosendCount.floodsub++;\n }\n });\n // Gossipsub peers handling\n const meshPeers = this.mesh.get(topic);\n if ((meshPeers != null) && meshPeers.size > 0) {\n meshPeers.forEach((peer) => {\n tosend.add(peer);\n tosendCount.mesh++;\n });\n // eslint-disable-next-line @typescript-eslint/brace-style\n }\n // We are not in the mesh for topic, use fanout peers\n else {\n const fanoutPeers = this.fanout.get(topic);\n if ((fanoutPeers != null) && fanoutPeers.size > 0) {\n fanoutPeers.forEach((peer) => {\n tosend.add(peer);\n tosendCount.fanout++;\n });\n // eslint-disable-next-line @typescript-eslint/brace-style\n }\n // We have no fanout peers, select mesh_n of them and add them to the fanout\n else {\n // If we are not in the fanout, then pick peers in topic above the publishThreshold\n const newFanoutPeers = this.getRandomGossipPeers(topic, this.opts.D, (id) => {\n return this.score.score(id) >= this.opts.scoreThresholds.publishThreshold;\n });\n // eslint-disable-next-line max-depth\n if (newFanoutPeers.size > 0) {\n this.fanout.set(topic, newFanoutPeers);\n newFanoutPeers.forEach((peer) => {\n tosend.add(peer);\n tosendCount.fanout++;\n });\n }\n }\n // We are publishing to fanout peers - update the time we published\n this.fanoutLastpub.set(topic, Date.now());\n }\n }\n }\n return { tosend, tosendCount };\n }\n /**\n * Forwards a message from our peers.\n *\n * For messages published by us (the app layer), this class uses `publish`\n */\n forwardMessage(msgIdStr, rawMsg, propagationSource, excludePeers) {\n // message is fully validated inform peer_score\n if (propagationSource != null) {\n this.score.deliverMessage(propagationSource, msgIdStr, rawMsg.topic);\n }\n const tosend = this.selectPeersToForward(rawMsg.topic, propagationSource, excludePeers);\n // Note: Don't throw if tosend is empty, we can have a mesh with a single peer\n // forward the message to peers\n tosend.forEach((id) => {\n // sendRpc may mutate RPC message on piggyback, create a new message for each peer\n this.sendRpc(id, (0,_utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__.createGossipRpc)([rawMsg]));\n });\n this.metrics?.onForwardMsg(rawMsg.topic, tosend.size);\n }\n /**\n * App layer publishes a message to peers, return number of peers this message is published to\n * Note: `async` due to crypto only if `StrictSign`, otherwise it's a sync fn.\n *\n * For messages not from us, this class uses `forwardMessage`.\n */\n async publish(topic, data, opts) {\n const startMs = Date.now();\n const transformedData = (this.dataTransform != null) ? this.dataTransform.outboundTransform(topic, data) : data;\n if (this.publishConfig == null) {\n throw Error('PublishError.Uninitialized');\n }\n // Prepare raw message with user's publishConfig\n const { raw: rawMsg, msg } = await (0,_utils_buildRawMessage_js__WEBPACK_IMPORTED_MODULE_22__.buildRawMessage)(this.publishConfig, topic, data, transformedData);\n // calculate the message id from the un-transformed data\n const msgId = await this.msgIdFn(msg);\n const msgIdStr = this.msgIdToStrFn(msgId);\n // Current publish opt takes precedence global opts, while preserving false value\n const ignoreDuplicatePublishError = opts?.ignoreDuplicatePublishError ?? this.opts.ignoreDuplicatePublishError;\n if (this.seenCache.has(msgIdStr)) {\n // This message has already been seen. We don't re-publish messages that have already\n // been published on the network.\n if (ignoreDuplicatePublishError) {\n this.metrics?.onPublishDuplicateMsg(topic);\n return { recipients: [] };\n }\n throw Error('PublishError.Duplicate');\n }\n const { tosend, tosendCount } = this.selectPeersToPublish(topic);\n const willSendToSelf = this.opts.emitSelf && this.subscriptions.has(topic);\n // Current publish opt takes precedence global opts, while preserving false value\n const allowPublishToZeroPeers = opts?.allowPublishToZeroPeers ?? this.opts.allowPublishToZeroPeers;\n if (tosend.size === 0 && !allowPublishToZeroPeers && !willSendToSelf) {\n throw Error('PublishError.InsufficientPeers');\n }\n // If the message isn't a duplicate and we have sent it to some peers add it to the\n // duplicate cache and memcache.\n this.seenCache.put(msgIdStr);\n // all published messages are valid\n this.mcache.put({ msgId, msgIdStr }, rawMsg, true);\n // If the message is anonymous or has a random author add it to the published message ids cache.\n this.publishedMessageIds.put(msgIdStr);\n const batchPublish = opts?.batchPublish ?? this.opts.batchPublish;\n const rpc = (0,_utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__.createGossipRpc)([rawMsg]);\n if (batchPublish) {\n this.sendRpcInBatch(tosend, rpc);\n }\n else {\n // Send to set of peers aggregated from direct, mesh, fanout\n for (const id of tosend) {\n // sendRpc may mutate RPC message on piggyback, create a new message for each peer\n const sent = this.sendRpc(id, rpc);\n // did not actually send the message\n if (!sent) {\n tosend.delete(id);\n }\n }\n }\n const durationMs = Date.now() - startMs;\n this.metrics?.onPublishMsg(topic, tosendCount, tosend.size, rawMsg.data != null ? rawMsg.data.length : 0, durationMs);\n // Dispatch the message to the user if we are subscribed to the topic\n if (willSendToSelf) {\n tosend.add(this.components.peerId.toString());\n super.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CustomEvent('gossipsub:message', {\n detail: {\n propagationSource: this.components.peerId,\n msgId: msgIdStr,\n msg\n }\n }));\n // TODO: Add option to switch between emit per topic or all messages in one\n super.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CustomEvent('message', { detail: msg }));\n }\n return {\n recipients: Array.from(tosend.values()).map((str) => (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_16__.peerIdFromString)(str))\n };\n }\n /**\n * Send the same data in batch to tosend list without considering cached control messages\n * This is not only faster but also avoid allocating memory for each peer\n * see https://github.com/ChainSafe/js-libp2p-gossipsub/issues/344\n */\n sendRpcInBatch(tosend, rpc) {\n const rpcBytes = _message_rpc_js__WEBPACK_IMPORTED_MODULE_20__.RPC.encode(rpc);\n const prefixedData = it_length_prefixed__WEBPACK_IMPORTED_MODULE_0__.encode.single(rpcBytes);\n for (const id of tosend) {\n const outboundStream = this.streamsOutbound.get(id);\n if (outboundStream == null) {\n this.log(`Cannot send RPC to ${id} as there is no open stream to it available`);\n tosend.delete(id);\n continue;\n }\n try {\n outboundStream.pushPrefixed(prefixedData);\n }\n catch (e) {\n tosend.delete(id);\n this.log.error(`Cannot send rpc to ${id}`, e);\n }\n this.metrics?.onRpcSent(rpc, rpcBytes.length);\n }\n }\n /**\n * This function should be called when `asyncValidation` is `true` after\n * the message got validated by the caller. Messages are stored in the `mcache` and\n * validation is expected to be fast enough that the messages should still exist in the cache.\n * There are three possible validation outcomes and the outcome is given in acceptance.\n *\n * If acceptance = `MessageAcceptance.Accept` the message will get propagated to the\n * network. The `propagation_source` parameter indicates who the message was received by and\n * will not be forwarded back to that peer.\n *\n * If acceptance = `MessageAcceptance.Reject` the message will be deleted from the memcache\n * and the P₄ penalty will be applied to the `propagationSource`.\n *\n * If acceptance = `MessageAcceptance.Ignore` the message will be deleted from the memcache\n * but no P₄ penalty will be applied.\n *\n * This function will return true if the message was found in the cache and false if was not\n * in the cache anymore.\n *\n * This should only be called once per message.\n */\n reportMessageValidationResult(msgId, propagationSource, acceptance) {\n let cacheEntry;\n if (acceptance === _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.TopicValidatorResult.Accept) {\n cacheEntry = this.mcache.validate(msgId);\n if (cacheEntry != null) {\n const { message: rawMsg, originatingPeers } = cacheEntry;\n // message is fully validated inform peer_score\n this.score.deliverMessage(propagationSource, msgId, rawMsg.topic);\n this.forwardMessage(msgId, cacheEntry.message, propagationSource, originatingPeers);\n }\n // else, Message not in cache. Ignoring forwarding\n // eslint-disable-next-line @typescript-eslint/brace-style\n }\n // Not valid\n else {\n cacheEntry = this.mcache.remove(msgId);\n if (cacheEntry != null) {\n const rejectReason = (0,_types_js__WEBPACK_IMPORTED_MODULE_21__.rejectReasonFromAcceptance)(acceptance);\n const { message: rawMsg, originatingPeers } = cacheEntry;\n // Tell peer_score about reject\n // Reject the original source, and any duplicates we've seen from other peers.\n this.score.rejectMessage(propagationSource, msgId, rawMsg.topic, rejectReason);\n for (const peer of originatingPeers) {\n this.score.rejectMessage(peer, msgId, rawMsg.topic, rejectReason);\n }\n }\n // else, Message not in cache. Ignoring forwarding\n }\n const firstSeenTimestampMs = this.score.messageFirstSeenTimestampMs(msgId);\n this.metrics?.onReportValidation(cacheEntry, acceptance, firstSeenTimestampMs);\n }\n /**\n * Sends a GRAFT message to a peer\n */\n sendGraft(id, topic) {\n const graft = [\n {\n topicID: topic\n }\n ];\n const out = (0,_utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__.createGossipRpc)([], { graft });\n this.sendRpc(id, out);\n }\n /**\n * Sends a PRUNE message to a peer\n */\n async sendPrune(id, topic) {\n // this is only called from leave() function\n const onUnsubscribe = true;\n const prune = [await this.makePrune(id, topic, this.opts.doPX, onUnsubscribe)];\n const out = (0,_utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__.createGossipRpc)([], { prune });\n this.sendRpc(id, out);\n }\n /**\n * Send an rpc object to a peer\n */\n sendRpc(id, rpc) {\n const outboundStream = this.streamsOutbound.get(id);\n if (outboundStream == null) {\n this.log(`Cannot send RPC to ${id} as there is no open stream to it available`);\n return false;\n }\n // piggyback control message retries\n const ctrl = this.control.get(id);\n if (ctrl != null) {\n this.piggybackControl(id, rpc, ctrl);\n this.control.delete(id);\n }\n // piggyback gossip\n const ihave = this.gossip.get(id);\n if (ihave != null) {\n this.piggybackGossip(id, rpc, ihave);\n this.gossip.delete(id);\n }\n const rpcBytes = _message_rpc_js__WEBPACK_IMPORTED_MODULE_20__.RPC.encode(rpc);\n try {\n outboundStream.push(rpcBytes);\n }\n catch (e) {\n this.log.error(`Cannot send rpc to ${id}`, e);\n // if the peer had control messages or gossip, re-attach\n if (ctrl != null) {\n this.control.set(id, ctrl);\n }\n if (ihave != null) {\n this.gossip.set(id, ihave);\n }\n return false;\n }\n this.metrics?.onRpcSent(rpc, rpcBytes.length);\n return true;\n }\n /** Mutates `outRpc` adding graft and prune control messages */\n piggybackControl(id, outRpc, ctrl) {\n const rpc = (0,_utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__.ensureControl)(outRpc);\n for (const graft of ctrl.graft) {\n if (graft.topicID != null && (this.mesh.get(graft.topicID)?.has(id) ?? false)) {\n rpc.control.graft.push(graft);\n }\n }\n for (const prune of ctrl.prune) {\n if (prune.topicID != null && !(this.mesh.get(prune.topicID)?.has(id) ?? false)) {\n rpc.control.prune.push(prune);\n }\n }\n }\n /** Mutates `outRpc` adding ihave control messages */\n piggybackGossip(id, outRpc, ihave) {\n const rpc = (0,_utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__.ensureControl)(outRpc);\n rpc.control.ihave = ihave;\n }\n /**\n * Send graft and prune messages\n *\n * @param tograft - peer id => topic[]\n * @param toprune - peer id => topic[]\n */\n async sendGraftPrune(tograft, toprune, noPX) {\n const doPX = this.opts.doPX;\n const onUnsubscribe = false;\n for (const [id, topics] of tograft) {\n const graft = topics.map((topicID) => ({ topicID }));\n let prune = [];\n // If a peer also has prunes, process them now\n const pruning = toprune.get(id);\n if (pruning != null) {\n prune = await Promise.all(pruning.map(async (topicID) => this.makePrune(id, topicID, doPX && !(noPX.get(id) ?? false), onUnsubscribe)));\n toprune.delete(id);\n }\n this.sendRpc(id, (0,_utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__.createGossipRpc)([], { graft, prune }));\n }\n for (const [id, topics] of toprune) {\n const prune = await Promise.all(topics.map(async (topicID) => this.makePrune(id, topicID, doPX && !(noPX.get(id) ?? false), onUnsubscribe)));\n this.sendRpc(id, (0,_utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__.createGossipRpc)([], { prune }));\n }\n }\n /**\n * Emits gossip - Send IHAVE messages to a random set of gossip peers\n */\n emitGossip(peersToGossipByTopic) {\n const gossipIDsByTopic = this.mcache.getGossipIDs(new Set(peersToGossipByTopic.keys()));\n for (const [topic, peersToGossip] of peersToGossipByTopic) {\n this.doEmitGossip(topic, peersToGossip, gossipIDsByTopic.get(topic) ?? []);\n }\n }\n /**\n * Send gossip messages to GossipFactor peers above threshold with a minimum of D_lazy\n * Peers are randomly selected from the heartbeat which exclude mesh + fanout peers\n * We also exclude direct peers, as there is no reason to emit gossip to them\n *\n * @param topic\n * @param candidateToGossip - peers to gossip\n * @param messageIDs - message ids to gossip\n */\n doEmitGossip(topic, candidateToGossip, messageIDs) {\n if (messageIDs.length === 0) {\n return;\n }\n // shuffle to emit in random order\n (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_24__.shuffle)(messageIDs);\n // if we are emitting more than GossipsubMaxIHaveLength ids, truncate the list\n if (messageIDs.length > _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubMaxIHaveLength) {\n // we do the truncation (with shuffling) per peer below\n this.log('too many messages for gossip; will truncate IHAVE list (%d messages)', messageIDs.length);\n }\n if (candidateToGossip.size === 0)\n return;\n let target = this.opts.Dlazy;\n const factor = _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubGossipFactor * candidateToGossip.size;\n let peersToGossip = candidateToGossip;\n if (factor > target) {\n target = factor;\n }\n if (target > peersToGossip.size) {\n target = peersToGossip.size;\n }\n else {\n // only shuffle if needed\n peersToGossip = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_24__.shuffle)(Array.from(peersToGossip)).slice(0, target);\n }\n // Emit the IHAVE gossip to the selected peers up to the target\n peersToGossip.forEach((id) => {\n let peerMessageIDs = messageIDs;\n if (messageIDs.length > _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubMaxIHaveLength) {\n // shuffle and slice message IDs per peer so that we emit a different set for each peer\n // we have enough reduncancy in the system that this will significantly increase the message\n // coverage when we do truncate\n peerMessageIDs = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_24__.shuffle)(peerMessageIDs.slice()).slice(0, _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubMaxIHaveLength);\n }\n this.pushGossip(id, {\n topicID: topic,\n messageIDs: peerMessageIDs\n });\n });\n }\n /**\n * Flush gossip and control messages\n */\n flush() {\n // send gossip first, which will also piggyback control\n for (const [peer, ihave] of this.gossip.entries()) {\n this.gossip.delete(peer);\n this.sendRpc(peer, (0,_utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__.createGossipRpc)([], { ihave }));\n }\n // send the remaining control messages\n for (const [peer, control] of this.control.entries()) {\n this.control.delete(peer);\n const out = (0,_utils_create_gossip_rpc_js__WEBPACK_IMPORTED_MODULE_23__.createGossipRpc)([], { graft: control.graft, prune: control.prune });\n this.sendRpc(peer, out);\n }\n }\n /**\n * Adds new IHAVE messages to pending gossip\n */\n pushGossip(id, controlIHaveMsgs) {\n this.log('Add gossip to %s', id);\n const gossip = this.gossip.get(id) ?? [];\n this.gossip.set(id, gossip.concat(controlIHaveMsgs));\n }\n /**\n * Make a PRUNE control message for a peer in a topic\n */\n async makePrune(id, topic, doPX, onUnsubscribe) {\n this.score.prune(id, topic);\n if (this.streamsOutbound.get(id)?.protocol === _constants_js__WEBPACK_IMPORTED_MODULE_3__.GossipsubIDv10) {\n // Gossipsub v1.0 -- no backoff, the peer won't be able to parse it anyway\n return {\n topicID: topic,\n peers: []\n };\n }\n // backoff is measured in seconds\n // GossipsubPruneBackoff and GossipsubUnsubscribeBackoff are measured in milliseconds\n // The protobuf has it as a uint64\n const backoffMs = onUnsubscribe ? this.opts.unsubcribeBackoff : this.opts.pruneBackoff;\n const backoff = backoffMs / 1000;\n this.doAddBackoff(id, topic, backoffMs);\n if (!doPX) {\n return {\n topicID: topic,\n peers: [],\n backoff\n };\n }\n // select peers for Peer eXchange\n const peers = this.getRandomGossipPeers(topic, this.opts.prunePeers, (xid) => {\n return xid !== id && this.score.score(xid) >= 0;\n });\n const px = await Promise.all(Array.from(peers).map(async (peerId) => {\n // see if we have a signed record to send back; if we don't, just send\n // the peer ID and let the pruned peer find them in the DHT -- we can't trust\n // unsigned address records through PX anyways\n // Finding signed records in the DHT is not supported at the time of writing in js-libp2p\n const id = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_16__.peerIdFromString)(peerId);\n let peerInfo;\n try {\n peerInfo = await this.components.peerStore.get(id);\n }\n catch (err) {\n if (err.code !== 'ERR_NOT_FOUND') {\n throw err;\n }\n }\n return {\n peerID: id.toBytes(),\n signedPeerRecord: peerInfo?.peerRecordEnvelope\n };\n }));\n return {\n topicID: topic,\n peers: px,\n backoff\n };\n }\n runHeartbeat = () => {\n const timer = this.metrics?.heartbeatDuration.startTimer();\n this.heartbeat()\n .catch((err) => {\n this.log('Error running heartbeat', err);\n })\n .finally(() => {\n if (timer != null) {\n timer();\n }\n // Schedule the next run if still in started status\n if (this.status.code === GossipStatusCode.started) {\n // Clear previous timeout before overwriting `status.heartbeatTimeout`, it should be completed tho.\n clearTimeout(this.status.heartbeatTimeout);\n // NodeJS setInterval function is innexact, calls drift by a few miliseconds on each call.\n // To run the heartbeat precisely setTimeout() must be used recomputing the delay on every loop.\n let msToNextHeartbeat = this.opts.heartbeatInterval - ((Date.now() - this.status.hearbeatStartMs) % this.opts.heartbeatInterval);\n // If too close to next heartbeat, skip one\n if (msToNextHeartbeat < this.opts.heartbeatInterval * 0.25) {\n msToNextHeartbeat += this.opts.heartbeatInterval;\n this.metrics?.heartbeatSkipped.inc();\n }\n this.status.heartbeatTimeout = setTimeout(this.runHeartbeat, msToNextHeartbeat);\n }\n });\n };\n /**\n * Maintains the mesh and fanout maps in gossipsub.\n */\n async heartbeat() {\n const { D, Dlo, Dhi, Dscore, Dout, fanoutTTL } = this.opts;\n this.heartbeatTicks++;\n // cache scores throught the heartbeat\n const scores = new Map();\n const getScore = (id) => {\n let s = scores.get(id);\n if (s === undefined) {\n s = this.score.score(id);\n scores.set(id, s);\n }\n return s;\n };\n // peer id => topic[]\n const tograft = new Map();\n // peer id => topic[]\n const toprune = new Map();\n // peer id => don't px\n const noPX = new Map();\n // clean up expired backoffs\n this.clearBackoff();\n // clean up peerhave/iasked counters\n this.peerhave.clear();\n this.metrics?.cacheSize.set({ cache: 'iasked' }, this.iasked.size);\n this.iasked.clear();\n // apply IWANT request penalties\n this.applyIwantPenalties();\n // ensure direct peers are connected\n if (this.heartbeatTicks % this.opts.directConnectTicks === 0) {\n // we only do this every few ticks to allow pending connections to complete and account for restarts/downtime\n await this.directConnect();\n }\n // EXTRA: Prune caches\n this.fastMsgIdCache?.prune();\n this.seenCache.prune();\n this.gossipTracer.prune();\n this.publishedMessageIds.prune();\n /**\n * Instead of calling getRandomGossipPeers multiple times to:\n * + get more mesh peers\n * + more outbound peers\n * + oppportunistic grafting\n * + emitGossip\n *\n * We want to loop through the topic peers only a single time and prepare gossip peers for all topics to improve the performance\n */\n const peersToGossipByTopic = new Map();\n // maintain the mesh for topics we have joined\n // eslint-disable-next-line complexity\n this.mesh.forEach((peers, topic) => {\n const peersInTopic = this.topics.get(topic);\n const candidateMeshPeers = new Set();\n const peersToGossip = new Set();\n peersToGossipByTopic.set(topic, peersToGossip);\n if (peersInTopic != null) {\n const shuffledPeers = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_24__.shuffle)(Array.from(peersInTopic));\n const backoff = this.backoff.get(topic);\n for (const id of shuffledPeers) {\n const peerStreams = this.streamsOutbound.get(id);\n if ((peerStreams != null) &&\n this.multicodecs.includes(peerStreams.protocol) &&\n !peers.has(id) &&\n !this.direct.has(id)) {\n const score = getScore(id);\n if (((backoff == null) || !backoff.has(id)) && score >= 0)\n candidateMeshPeers.add(id);\n // instead of having to find gossip peers after heartbeat which require another loop\n // we prepare peers to gossip in a topic within heartbeat to improve performance\n if (score >= this.opts.scoreThresholds.gossipThreshold)\n peersToGossip.add(id);\n }\n }\n }\n // prune/graft helper functions (defined per topic)\n const prunePeer = (id, reason) => {\n this.log('HEARTBEAT: Remove mesh link to %s in %s', id, topic);\n // no need to update peer score here as we do it in makePrune\n // add prune backoff record\n this.addBackoff(id, topic);\n // remove peer from mesh\n peers.delete(id);\n // after pruning a peer from mesh, we want to gossip topic to it if its score meet the gossip threshold\n if (getScore(id) >= this.opts.scoreThresholds.gossipThreshold)\n peersToGossip.add(id);\n this.metrics?.onRemoveFromMesh(topic, reason, 1);\n // add to toprune\n const topics = toprune.get(id);\n if (topics == null) {\n toprune.set(id, [topic]);\n }\n else {\n topics.push(topic);\n }\n };\n const graftPeer = (id, reason) => {\n this.log('HEARTBEAT: Add mesh link to %s in %s', id, topic);\n // update peer score\n this.score.graft(id, topic);\n // add peer to mesh\n peers.add(id);\n // when we add a new mesh peer, we don't want to gossip messages to it\n peersToGossip.delete(id);\n this.metrics?.onAddToMesh(topic, reason, 1);\n // add to tograft\n const topics = tograft.get(id);\n if (topics == null) {\n tograft.set(id, [topic]);\n }\n else {\n topics.push(topic);\n }\n };\n // drop all peers with negative score, without PX\n peers.forEach((id) => {\n const score = getScore(id);\n // Record the score\n if (score < 0) {\n this.log('HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s', id, score, topic);\n prunePeer(id, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.ChurnReason.BadScore);\n noPX.set(id, true);\n }\n });\n // do we have enough peers?\n if (peers.size < Dlo) {\n const ineed = D - peers.size;\n // slice up to first `ineed` items and remove them from candidateMeshPeers\n // same to `const newMeshPeers = candidateMeshPeers.slice(0, ineed)`\n const newMeshPeers = (0,_utils_set_js__WEBPACK_IMPORTED_MODULE_25__.removeFirstNItemsFromSet)(candidateMeshPeers, ineed);\n newMeshPeers.forEach((p) => {\n graftPeer(p, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.InclusionReason.NotEnough);\n });\n }\n // do we have to many peers?\n if (peers.size > Dhi) {\n let peersArray = Array.from(peers);\n // sort by score\n peersArray.sort((a, b) => getScore(b) - getScore(a));\n // We keep the first D_score peers by score and the remaining up to D randomly\n // under the constraint that we keep D_out peers in the mesh (if we have that many)\n peersArray = peersArray.slice(0, Dscore).concat((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_24__.shuffle)(peersArray.slice(Dscore)));\n // count the outbound peers we are keeping\n let outbound = 0;\n peersArray.slice(0, D).forEach((p) => {\n if (this.outbound.get(p) ?? false) {\n outbound++;\n }\n });\n // if it's less than D_out, bubble up some outbound peers from the random selection\n if (outbound < Dout) {\n const rotate = (i) => {\n // rotate the peersArray to the right and put the ith peer in the front\n const p = peersArray[i];\n for (let j = i; j > 0; j--) {\n peersArray[j] = peersArray[j - 1];\n }\n peersArray[0] = p;\n };\n // first bubble up all outbound peers already in the selection to the front\n if (outbound > 0) {\n let ihave = outbound;\n for (let i = 1; i < D && ihave > 0; i++) {\n // eslint-disable-next-line max-depth\n if (this.outbound.get(peersArray[i]) ?? false) {\n rotate(i);\n ihave--;\n }\n }\n }\n // now bubble up enough outbound peers outside the selection to the front\n let ineed = D - outbound;\n for (let i = D; i < peersArray.length && ineed > 0; i++) {\n if (this.outbound.get(peersArray[i]) ?? false) {\n rotate(i);\n ineed--;\n }\n }\n }\n // prune the excess peers\n peersArray.slice(D).forEach((p) => {\n prunePeer(p, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.ChurnReason.Excess);\n });\n }\n // do we have enough outbound peers?\n if (peers.size >= Dlo) {\n // count the outbound peers we have\n let outbound = 0;\n peers.forEach((p) => {\n if (this.outbound.get(p) ?? false) {\n outbound++;\n }\n });\n // if it's less than D_out, select some peers with outbound connections and graft them\n if (outbound < Dout) {\n const ineed = Dout - outbound;\n const newMeshPeers = (0,_utils_set_js__WEBPACK_IMPORTED_MODULE_25__.removeItemsFromSet)(candidateMeshPeers, ineed, (id) => this.outbound.get(id) === true);\n newMeshPeers.forEach((p) => {\n graftPeer(p, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.InclusionReason.Outbound);\n });\n }\n }\n // should we try to improve the mesh with opportunistic grafting?\n if (this.heartbeatTicks % this.opts.opportunisticGraftTicks === 0 && peers.size > 1) {\n // Opportunistic grafting works as follows: we check the median score of peers in the\n // mesh; if this score is below the opportunisticGraftThreshold, we select a few peers at\n // random with score over the median.\n // The intention is to (slowly) improve an underperforming mesh by introducing good\n // scoring peers that may have been gossiping at us. This allows us to get out of sticky\n // situations where we are stuck with poor peers and also recover from churn of good peers.\n // now compute the median peer score in the mesh\n const peersList = Array.from(peers).sort((a, b) => getScore(a) - getScore(b));\n const medianIndex = Math.floor(peers.size / 2);\n const medianScore = getScore(peersList[medianIndex]);\n // if the median score is below the threshold, select a better peer (if any) and GRAFT\n if (medianScore < this.opts.scoreThresholds.opportunisticGraftThreshold) {\n const ineed = this.opts.opportunisticGraftPeers;\n const newMeshPeers = (0,_utils_set_js__WEBPACK_IMPORTED_MODULE_25__.removeItemsFromSet)(candidateMeshPeers, ineed, (id) => getScore(id) > medianScore);\n for (const id of newMeshPeers) {\n this.log('HEARTBEAT: Opportunistically graft peer %s on topic %s', id, topic);\n graftPeer(id, _metrics_js__WEBPACK_IMPORTED_MODULE_13__.InclusionReason.Opportunistic);\n }\n }\n }\n });\n // expire fanout for topics we haven't published to in a while\n const now = Date.now();\n this.fanoutLastpub.forEach((lastpb, topic) => {\n if (lastpb + fanoutTTL < now) {\n this.fanout.delete(topic);\n this.fanoutLastpub.delete(topic);\n }\n });\n // maintain our fanout for topics we are publishing but we have not joined\n this.fanout.forEach((fanoutPeers, topic) => {\n // checks whether our peers are still in the topic and have a score above the publish threshold\n const topicPeers = this.topics.get(topic);\n fanoutPeers.forEach((id) => {\n if (!(topicPeers?.has(id) ?? false) || getScore(id) < this.opts.scoreThresholds.publishThreshold) {\n fanoutPeers.delete(id);\n }\n });\n const peersInTopic = this.topics.get(topic);\n const candidateFanoutPeers = [];\n // the fanout map contains topics to which we are not subscribed.\n const peersToGossip = new Set();\n peersToGossipByTopic.set(topic, peersToGossip);\n if (peersInTopic != null) {\n const shuffledPeers = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_24__.shuffle)(Array.from(peersInTopic));\n for (const id of shuffledPeers) {\n const peerStreams = this.streamsOutbound.get(id);\n if ((peerStreams != null) &&\n this.multicodecs.includes(peerStreams.protocol) &&\n !fanoutPeers.has(id) &&\n !this.direct.has(id)) {\n const score = getScore(id);\n if (score >= this.opts.scoreThresholds.publishThreshold)\n candidateFanoutPeers.push(id);\n // instead of having to find gossip peers after heartbeat which require another loop\n // we prepare peers to gossip in a topic within heartbeat to improve performance\n if (score >= this.opts.scoreThresholds.gossipThreshold)\n peersToGossip.add(id);\n }\n }\n }\n // do we need more peers?\n if (fanoutPeers.size < D) {\n const ineed = D - fanoutPeers.size;\n candidateFanoutPeers.slice(0, ineed).forEach((id) => {\n fanoutPeers.add(id);\n peersToGossip?.delete(id);\n });\n }\n });\n this.emitGossip(peersToGossipByTopic);\n // send coalesced GRAFT/PRUNE messages (will piggyback gossip)\n await this.sendGraftPrune(tograft, toprune, noPX);\n // flush pending gossip that wasn't piggybacked above\n this.flush();\n // advance the message history window\n this.mcache.shift();\n this.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CustomEvent('gossipsub:heartbeat'));\n }\n /**\n * Given a topic, returns up to count peers subscribed to that topic\n * that pass an optional filter function\n *\n * @param topic\n * @param count\n * @param filter - a function to filter acceptable peers\n */\n getRandomGossipPeers(topic, count, filter = () => true) {\n const peersInTopic = this.topics.get(topic);\n if (peersInTopic == null) {\n return new Set();\n }\n // Adds all peers using our protocol\n // that also pass the filter function\n let peers = [];\n peersInTopic.forEach((id) => {\n const peerStreams = this.streamsOutbound.get(id);\n if (peerStreams == null) {\n return;\n }\n if (this.multicodecs.includes(peerStreams.protocol) && filter(id)) {\n peers.push(id);\n }\n });\n // Pseudo-randomly shuffles peers\n peers = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_24__.shuffle)(peers);\n if (count > 0 && peers.length > count) {\n peers = peers.slice(0, count);\n }\n return new Set(peers);\n }\n onScrapeMetrics(metrics) {\n /* Data structure sizes */\n metrics.mcacheSize.set(this.mcache.size);\n metrics.mcacheNotValidatedCount.set(this.mcache.notValidatedCount);\n // Arbitrary size\n metrics.cacheSize.set({ cache: 'direct' }, this.direct.size);\n metrics.cacheSize.set({ cache: 'seenCache' }, this.seenCache.size);\n metrics.cacheSize.set({ cache: 'fastMsgIdCache' }, this.fastMsgIdCache?.size ?? 0);\n metrics.cacheSize.set({ cache: 'publishedMessageIds' }, this.publishedMessageIds.size);\n metrics.cacheSize.set({ cache: 'mcache' }, this.mcache.size);\n metrics.cacheSize.set({ cache: 'score' }, this.score.size);\n metrics.cacheSize.set({ cache: 'gossipTracer.promises' }, this.gossipTracer.size);\n metrics.cacheSize.set({ cache: 'gossipTracer.requests' }, this.gossipTracer.requestMsByMsgSize);\n // Bounded by topic\n metrics.cacheSize.set({ cache: 'topics' }, this.topics.size);\n metrics.cacheSize.set({ cache: 'subscriptions' }, this.subscriptions.size);\n metrics.cacheSize.set({ cache: 'mesh' }, this.mesh.size);\n metrics.cacheSize.set({ cache: 'fanout' }, this.fanout.size);\n // Bounded by peer\n metrics.cacheSize.set({ cache: 'peers' }, this.peers.size);\n metrics.cacheSize.set({ cache: 'streamsOutbound' }, this.streamsOutbound.size);\n metrics.cacheSize.set({ cache: 'streamsInbound' }, this.streamsInbound.size);\n metrics.cacheSize.set({ cache: 'acceptFromWhitelist' }, this.acceptFromWhitelist.size);\n metrics.cacheSize.set({ cache: 'gossip' }, this.gossip.size);\n metrics.cacheSize.set({ cache: 'control' }, this.control.size);\n metrics.cacheSize.set({ cache: 'peerhave' }, this.peerhave.size);\n metrics.cacheSize.set({ cache: 'outbound' }, this.outbound.size);\n // 2D nested data structure\n let backoffSize = 0;\n const now = Date.now();\n metrics.connectedPeersBackoffSec.reset();\n for (const backoff of this.backoff.values()) {\n backoffSize += backoff.size;\n for (const [peer, expiredMs] of backoff.entries()) {\n if (this.peers.has(peer)) {\n metrics.connectedPeersBackoffSec.observe(Math.max(0, expiredMs - now) / 1000);\n }\n }\n }\n metrics.cacheSize.set({ cache: 'backoff' }, backoffSize);\n // Peer counts\n for (const [topicStr, peers] of this.topics) {\n metrics.topicPeersCount.set({ topicStr }, peers.size);\n }\n for (const [topicStr, peers] of this.mesh) {\n metrics.meshPeerCounts.set({ topicStr }, peers.size);\n }\n // Peer scores\n const scores = [];\n const scoreByPeer = new Map();\n metrics.behaviourPenalty.reset();\n for (const peerIdStr of this.peers.keys()) {\n const score = this.score.score(peerIdStr);\n scores.push(score);\n scoreByPeer.set(peerIdStr, score);\n metrics.behaviourPenalty.observe(this.score.peerStats.get(peerIdStr)?.behaviourPenalty ?? 0);\n }\n metrics.registerScores(scores, this.opts.scoreThresholds);\n // Breakdown score per mesh topicLabel\n metrics.registerScorePerMesh(this.mesh, scoreByPeer);\n // Breakdown on each score weight\n const sw = (0,_score_scoreMetrics_js__WEBPACK_IMPORTED_MODULE_26__.computeAllPeersScoreWeights)(this.peers.keys(), this.score.peerStats, this.score.params, this.score.peerIPs, metrics.topicStrToLabel);\n metrics.registerScoreWeights(sw);\n }\n}\nfunction gossipsub(init = {}) {\n return (components) => new GossipSub(components, init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message-cache.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message-cache.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MessageCache: () => (/* binding */ MessageCache)\n/* harmony export */ });\nclass MessageCache {\n gossip;\n msgs = new Map();\n msgIdToStrFn;\n history = [];\n /** Track with accounting of messages in the mcache that are not yet validated */\n notValidatedCount = 0;\n /**\n * Holds history of messages in timebounded history arrays\n */\n constructor(\n /**\n * The number of indices in the cache history used for gossiping. That means that a message\n * won't get gossiped anymore when shift got called `gossip` many times after inserting the\n * message in the cache.\n */\n gossip, historyCapacity, msgIdToStrFn) {\n this.gossip = gossip;\n this.msgIdToStrFn = msgIdToStrFn;\n for (let i = 0; i < historyCapacity; i++) {\n this.history[i] = [];\n }\n }\n get size() {\n return this.msgs.size;\n }\n /**\n * Adds a message to the current window and the cache\n * Returns true if the message is not known and is inserted in the cache\n */\n put(messageId, msg, validated = false) {\n const { msgIdStr } = messageId;\n // Don't add duplicate entries to the cache.\n if (this.msgs.has(msgIdStr)) {\n return false;\n }\n this.msgs.set(msgIdStr, {\n message: msg,\n validated,\n originatingPeers: new Set(),\n iwantCounts: new Map()\n });\n this.history[0].push({ ...messageId, topic: msg.topic });\n if (!validated) {\n this.notValidatedCount++;\n }\n return true;\n }\n observeDuplicate(msgId, fromPeerIdStr) {\n const entry = this.msgs.get(msgId);\n if ((entry != null) &&\n // if the message is already validated, we don't need to store extra peers sending us\n // duplicates as the message has already been forwarded\n !entry.validated) {\n entry.originatingPeers.add(fromPeerIdStr);\n }\n }\n /**\n * Retrieves a message from the cache by its ID, if it is still present\n */\n get(msgId) {\n return this.msgs.get(this.msgIdToStrFn(msgId))?.message;\n }\n /**\n * Increases the iwant count for the given message by one and returns the message together\n * with the iwant if the message exists.\n */\n getWithIWantCount(msgIdStr, p) {\n const msg = this.msgs.get(msgIdStr);\n if (msg == null) {\n return null;\n }\n const count = (msg.iwantCounts.get(p) ?? 0) + 1;\n msg.iwantCounts.set(p, count);\n return { msg: msg.message, count };\n }\n /**\n * Retrieves a list of message IDs for a set of topics\n */\n getGossipIDs(topics) {\n const msgIdsByTopic = new Map();\n for (let i = 0; i < this.gossip; i++) {\n this.history[i].forEach((entry) => {\n const msg = this.msgs.get(entry.msgIdStr);\n if ((msg?.validated ?? false) && topics.has(entry.topic)) {\n let msgIds = msgIdsByTopic.get(entry.topic);\n if (msgIds == null) {\n msgIds = [];\n msgIdsByTopic.set(entry.topic, msgIds);\n }\n msgIds.push(entry.msgId);\n }\n });\n }\n return msgIdsByTopic;\n }\n /**\n * Gets a message with msgId and tags it as validated.\n * This function also returns the known peers that have sent us this message. This is used to\n * prevent us sending redundant messages to peers who have already propagated it.\n */\n validate(msgId) {\n const entry = this.msgs.get(msgId);\n if (entry == null) {\n return null;\n }\n if (!entry.validated) {\n this.notValidatedCount--;\n }\n const { message, originatingPeers } = entry;\n entry.validated = true;\n // Clear the known peers list (after a message is validated, it is forwarded and we no\n // longer need to store the originating peers).\n entry.originatingPeers = new Set();\n return { message, originatingPeers };\n }\n /**\n * Shifts the current window, discarding messages older than this.history.length of the cache\n */\n shift() {\n const lastCacheEntries = this.history[this.history.length - 1];\n lastCacheEntries.forEach((cacheEntry) => {\n const entry = this.msgs.get(cacheEntry.msgIdStr);\n if (entry != null) {\n this.msgs.delete(cacheEntry.msgIdStr);\n if (!entry.validated) {\n this.notValidatedCount--;\n }\n }\n });\n this.history.pop();\n this.history.unshift([]);\n }\n remove(msgId) {\n const entry = this.msgs.get(msgId);\n if (entry == null) {\n return null;\n }\n // Keep the message on the history vector, it will be dropped on a shift()\n this.msgs.delete(msgId);\n return entry;\n }\n}\n//# sourceMappingURL=message-cache.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message-cache.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/decodeRpc.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/decodeRpc.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ defaultDecodeRpcLimits: () => (/* binding */ defaultDecodeRpcLimits)\n/* harmony export */ });\nconst defaultDecodeRpcLimits = {\n maxSubscriptions: Infinity,\n maxMessages: Infinity,\n maxIhaveMessageIDs: Infinity,\n maxIwantMessageIDs: Infinity,\n maxControlMessages: Infinity,\n maxPeerInfos: Infinity\n};\n//# sourceMappingURL=decodeRpc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/decodeRpc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.js":
|
||
/*!**************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.js ***!
|
||
\**************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RPC: () => (/* binding */ RPC)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar RPC;\n(function (RPC) {\n let SubOpts;\n (function (SubOpts) {\n let _codec;\n SubOpts.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.subscribe != null) {\n w.uint32(8);\n w.bool(obj.subscribe);\n }\n if (obj.topic != null) {\n w.uint32(18);\n w.string(obj.topic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.subscribe = reader.bool();\n break;\n }\n case 2: {\n obj.topic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n SubOpts.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, SubOpts.codec());\n };\n SubOpts.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, SubOpts.codec(), opts);\n };\n })(SubOpts = RPC.SubOpts || (RPC.SubOpts = {}));\n let Message;\n (function (Message) {\n let _codec;\n Message.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.from != null) {\n w.uint32(10);\n w.bytes(obj.from);\n }\n if (obj.data != null) {\n w.uint32(18);\n w.bytes(obj.data);\n }\n if (obj.seqno != null) {\n w.uint32(26);\n w.bytes(obj.seqno);\n }\n if ((obj.topic != null && obj.topic !== '')) {\n w.uint32(34);\n w.string(obj.topic);\n }\n if (obj.signature != null) {\n w.uint32(42);\n w.bytes(obj.signature);\n }\n if (obj.key != null) {\n w.uint32(50);\n w.bytes(obj.key);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n topic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.from = reader.bytes();\n break;\n }\n case 2: {\n obj.data = reader.bytes();\n break;\n }\n case 3: {\n obj.seqno = reader.bytes();\n break;\n }\n case 4: {\n obj.topic = reader.string();\n break;\n }\n case 5: {\n obj.signature = reader.bytes();\n break;\n }\n case 6: {\n obj.key = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Message.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Message.codec());\n };\n Message.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Message.codec(), opts);\n };\n })(Message = RPC.Message || (RPC.Message = {}));\n let ControlMessage;\n (function (ControlMessage) {\n let _codec;\n ControlMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.ihave != null) {\n for (const value of obj.ihave) {\n w.uint32(10);\n RPC.ControlIHave.codec().encode(value, w);\n }\n }\n if (obj.iwant != null) {\n for (const value of obj.iwant) {\n w.uint32(18);\n RPC.ControlIWant.codec().encode(value, w);\n }\n }\n if (obj.graft != null) {\n for (const value of obj.graft) {\n w.uint32(26);\n RPC.ControlGraft.codec().encode(value, w);\n }\n }\n if (obj.prune != null) {\n for (const value of obj.prune) {\n w.uint32(34);\n RPC.ControlPrune.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n ihave: [],\n iwant: [],\n graft: [],\n prune: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (opts.limits?.ihave != null && obj.ihave.length === opts.limits.ihave) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"ihave\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.ihave.push(RPC.ControlIHave.codec().decode(reader, reader.uint32()));\n break;\n }\n case 2: {\n if (opts.limits?.iwant != null && obj.iwant.length === opts.limits.iwant) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"iwant\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.iwant.push(RPC.ControlIWant.codec().decode(reader, reader.uint32()));\n break;\n }\n case 3: {\n if (opts.limits?.graft != null && obj.graft.length === opts.limits.graft) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"graft\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.graft.push(RPC.ControlGraft.codec().decode(reader, reader.uint32()));\n break;\n }\n case 4: {\n if (opts.limits?.prune != null && obj.prune.length === opts.limits.prune) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"prune\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.prune.push(RPC.ControlPrune.codec().decode(reader, reader.uint32()));\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ControlMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ControlMessage.codec());\n };\n ControlMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ControlMessage.codec(), opts);\n };\n })(ControlMessage = RPC.ControlMessage || (RPC.ControlMessage = {}));\n let ControlIHave;\n (function (ControlIHave) {\n let _codec;\n ControlIHave.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.topicID != null) {\n w.uint32(10);\n w.string(obj.topicID);\n }\n if (obj.messageIDs != null) {\n for (const value of obj.messageIDs) {\n w.uint32(18);\n w.bytes(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n messageIDs: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.topicID = reader.string();\n break;\n }\n case 2: {\n if (opts.limits?.messageIDs != null && obj.messageIDs.length === opts.limits.messageIDs) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"messageIDs\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.messageIDs.push(reader.bytes());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ControlIHave.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ControlIHave.codec());\n };\n ControlIHave.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ControlIHave.codec(), opts);\n };\n })(ControlIHave = RPC.ControlIHave || (RPC.ControlIHave = {}));\n let ControlIWant;\n (function (ControlIWant) {\n let _codec;\n ControlIWant.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.messageIDs != null) {\n for (const value of obj.messageIDs) {\n w.uint32(10);\n w.bytes(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n messageIDs: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (opts.limits?.messageIDs != null && obj.messageIDs.length === opts.limits.messageIDs) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"messageIDs\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.messageIDs.push(reader.bytes());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ControlIWant.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ControlIWant.codec());\n };\n ControlIWant.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ControlIWant.codec(), opts);\n };\n })(ControlIWant = RPC.ControlIWant || (RPC.ControlIWant = {}));\n let ControlGraft;\n (function (ControlGraft) {\n let _codec;\n ControlGraft.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.topicID != null) {\n w.uint32(10);\n w.string(obj.topicID);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.topicID = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ControlGraft.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ControlGraft.codec());\n };\n ControlGraft.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ControlGraft.codec(), opts);\n };\n })(ControlGraft = RPC.ControlGraft || (RPC.ControlGraft = {}));\n let ControlPrune;\n (function (ControlPrune) {\n let _codec;\n ControlPrune.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.topicID != null) {\n w.uint32(10);\n w.string(obj.topicID);\n }\n if (obj.peers != null) {\n for (const value of obj.peers) {\n w.uint32(18);\n RPC.PeerInfo.codec().encode(value, w);\n }\n }\n if (obj.backoff != null) {\n w.uint32(24);\n w.uint64Number(obj.backoff);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n peers: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.topicID = reader.string();\n break;\n }\n case 2: {\n if (opts.limits?.peers != null && obj.peers.length === opts.limits.peers) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"peers\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.peers.push(RPC.PeerInfo.codec().decode(reader, reader.uint32()));\n break;\n }\n case 3: {\n obj.backoff = reader.uint64Number();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ControlPrune.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ControlPrune.codec());\n };\n ControlPrune.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ControlPrune.codec(), opts);\n };\n })(ControlPrune = RPC.ControlPrune || (RPC.ControlPrune = {}));\n let PeerInfo;\n (function (PeerInfo) {\n let _codec;\n PeerInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.peerID != null) {\n w.uint32(10);\n w.bytes(obj.peerID);\n }\n if (obj.signedPeerRecord != null) {\n w.uint32(18);\n w.bytes(obj.signedPeerRecord);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.peerID = reader.bytes();\n break;\n }\n case 2: {\n obj.signedPeerRecord = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerInfo.codec());\n };\n PeerInfo.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerInfo.codec(), opts);\n };\n })(PeerInfo = RPC.PeerInfo || (RPC.PeerInfo = {}));\n let _codec;\n RPC.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.subscriptions != null) {\n for (const value of obj.subscriptions) {\n w.uint32(10);\n RPC.SubOpts.codec().encode(value, w);\n }\n }\n if (obj.messages != null) {\n for (const value of obj.messages) {\n w.uint32(18);\n RPC.Message.codec().encode(value, w);\n }\n }\n if (obj.control != null) {\n w.uint32(26);\n RPC.ControlMessage.codec().encode(obj.control, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n subscriptions: [],\n messages: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (opts.limits?.subscriptions != null && obj.subscriptions.length === opts.limits.subscriptions) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"subscriptions\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.subscriptions.push(RPC.SubOpts.codec().decode(reader, reader.uint32()));\n break;\n }\n case 2: {\n if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"messages\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.messages.push(RPC.Message.codec().decode(reader, reader.uint32()));\n break;\n }\n case 3: {\n obj.control = RPC.ControlMessage.codec().decode(reader, reader.uint32());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RPC.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RPC.codec());\n };\n RPC.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RPC.codec(), opts);\n };\n})(RPC || (RPC = {}));\n//# sourceMappingURL=rpc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/metrics.js":
|
||
/*!**********************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/metrics.js ***!
|
||
\**********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ChurnReason: () => (/* binding */ ChurnReason),\n/* harmony export */ IHaveIgnoreReason: () => (/* binding */ IHaveIgnoreReason),\n/* harmony export */ InclusionReason: () => (/* binding */ InclusionReason),\n/* harmony export */ MessageSource: () => (/* binding */ MessageSource),\n/* harmony export */ ScorePenalty: () => (/* binding */ ScorePenalty),\n/* harmony export */ ScoreThreshold: () => (/* binding */ ScoreThreshold),\n/* harmony export */ getMetrics: () => (/* binding */ getMetrics)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/pubsub/index.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n\n\nvar MessageSource;\n(function (MessageSource) {\n MessageSource[\"forward\"] = \"forward\";\n MessageSource[\"publish\"] = \"publish\";\n})(MessageSource || (MessageSource = {}));\nvar InclusionReason;\n(function (InclusionReason) {\n /** Peer was a fanaout peer. */\n InclusionReason[\"Fanout\"] = \"fanout\";\n /** Included from random selection. */\n InclusionReason[\"Random\"] = \"random\";\n /** Peer subscribed. */\n InclusionReason[\"Subscribed\"] = \"subscribed\";\n /** On heartbeat, peer was included to fill the outbound quota. */\n InclusionReason[\"Outbound\"] = \"outbound\";\n /** On heartbeat, not enough peers in mesh */\n InclusionReason[\"NotEnough\"] = \"not_enough\";\n /** On heartbeat opportunistic grafting due to low mesh score */\n InclusionReason[\"Opportunistic\"] = \"opportunistic\";\n})(InclusionReason || (InclusionReason = {}));\n/// Reasons why a peer was removed from the mesh.\nvar ChurnReason;\n(function (ChurnReason) {\n /// Peer disconnected.\n ChurnReason[\"Dc\"] = \"disconnected\";\n /// Peer had a bad score.\n ChurnReason[\"BadScore\"] = \"bad_score\";\n /// Peer sent a PRUNE.\n ChurnReason[\"Prune\"] = \"prune\";\n /// Too many peers.\n ChurnReason[\"Excess\"] = \"excess\";\n})(ChurnReason || (ChurnReason = {}));\n/// Kinds of reasons a peer's score has been penalized\nvar ScorePenalty;\n(function (ScorePenalty) {\n /// A peer grafted before waiting the back-off time.\n ScorePenalty[\"GraftBackoff\"] = \"graft_backoff\";\n /// A Peer did not respond to an IWANT request in time.\n ScorePenalty[\"BrokenPromise\"] = \"broken_promise\";\n /// A Peer did not send enough messages as expected.\n ScorePenalty[\"MessageDeficit\"] = \"message_deficit\";\n /// Too many peers under one IP address.\n ScorePenalty[\"IPColocation\"] = \"IP_colocation\";\n})(ScorePenalty || (ScorePenalty = {}));\nvar IHaveIgnoreReason;\n(function (IHaveIgnoreReason) {\n IHaveIgnoreReason[\"LowScore\"] = \"low_score\";\n IHaveIgnoreReason[\"MaxIhave\"] = \"max_ihave\";\n IHaveIgnoreReason[\"MaxIasked\"] = \"max_iasked\";\n})(IHaveIgnoreReason || (IHaveIgnoreReason = {}));\nvar ScoreThreshold;\n(function (ScoreThreshold) {\n ScoreThreshold[\"graylist\"] = \"graylist\";\n ScoreThreshold[\"publish\"] = \"publish\";\n ScoreThreshold[\"gossip\"] = \"gossip\";\n ScoreThreshold[\"mesh\"] = \"mesh\";\n})(ScoreThreshold || (ScoreThreshold = {}));\n/**\n * A collection of metrics used throughout the Gossipsub behaviour.\n * NOTE: except for special reasons, do not add more than 1 label for frequent metrics,\n * there's a performance penalty as of June 2023.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\nfunction getMetrics(register, topicStrToLabel, opts) {\n // Using function style instead of class to prevent having to re-declare all MetricsPrometheus types.\n return {\n /* Metrics for static config */\n protocolsEnabled: register.gauge({\n name: 'gossipsub_protocol',\n help: 'Status of enabled protocols',\n labelNames: ['protocol']\n }),\n /* Metrics per known topic */\n /**\n * Status of our subscription to this topic. This metric allows analyzing other topic metrics\n * filtered by our current subscription status.\n * = rust-libp2p `topic_subscription_status` */\n topicSubscriptionStatus: register.gauge({\n name: 'gossipsub_topic_subscription_status',\n help: 'Status of our subscription to this topic',\n labelNames: ['topicStr']\n }),\n /** Number of peers subscribed to each topic. This allows us to analyze a topic's behaviour\n * regardless of our subscription status. */\n topicPeersCount: register.gauge({\n name: 'gossipsub_topic_peer_count',\n help: 'Number of peers subscribed to each topic',\n labelNames: ['topicStr']\n }),\n /* Metrics regarding mesh state */\n /**\n * Number of peers in our mesh. This metric should be updated with the count of peers for a\n * topic in the mesh regardless of inclusion and churn events.\n * = rust-libp2p `mesh_peer_counts` */\n meshPeerCounts: register.gauge({\n name: 'gossipsub_mesh_peer_count',\n help: 'Number of peers in our mesh',\n labelNames: ['topicStr']\n }),\n /**\n * Number of times we include peers in a topic mesh for different reasons.\n * = rust-libp2p `mesh_peer_inclusion_events` */\n meshPeerInclusionEventsFanout: register.gauge({\n name: 'gossipsub_mesh_peer_inclusion_events_fanout_total',\n help: 'Number of times we include peers in a topic mesh for fanout reasons',\n labelNames: ['topic']\n }),\n meshPeerInclusionEventsRandom: register.gauge({\n name: 'gossipsub_mesh_peer_inclusion_events_random_total',\n help: 'Number of times we include peers in a topic mesh for random reasons',\n labelNames: ['topic']\n }),\n meshPeerInclusionEventsSubscribed: register.gauge({\n name: 'gossipsub_mesh_peer_inclusion_events_subscribed_total',\n help: 'Number of times we include peers in a topic mesh for subscribed reasons',\n labelNames: ['topic']\n }),\n meshPeerInclusionEventsOutbound: register.gauge({\n name: 'gossipsub_mesh_peer_inclusion_events_outbound_total',\n help: 'Number of times we include peers in a topic mesh for outbound reasons',\n labelNames: ['topic']\n }),\n meshPeerInclusionEventsNotEnough: register.gauge({\n name: 'gossipsub_mesh_peer_inclusion_events_not_enough_total',\n help: 'Number of times we include peers in a topic mesh for not_enough reasons',\n labelNames: ['topic']\n }),\n meshPeerInclusionEventsOpportunistic: register.gauge({\n name: 'gossipsub_mesh_peer_inclusion_events_opportunistic_total',\n help: 'Number of times we include peers in a topic mesh for opportunistic reasons',\n labelNames: ['topic']\n }),\n meshPeerInclusionEventsUnknown: register.gauge({\n name: 'gossipsub_mesh_peer_inclusion_events_unknown_total',\n help: 'Number of times we include peers in a topic mesh for unknown reasons',\n labelNames: ['topic']\n }),\n /**\n * Number of times we remove peers in a topic mesh for different reasons.\n * = rust-libp2p `mesh_peer_churn_events` */\n meshPeerChurnEventsDisconnected: register.gauge({\n name: 'gossipsub_peer_churn_events_disconnected_total',\n help: 'Number of times we remove peers in a topic mesh for disconnected reasons',\n labelNames: ['topic']\n }),\n meshPeerChurnEventsBadScore: register.gauge({\n name: 'gossipsub_peer_churn_events_bad_score_total',\n help: 'Number of times we remove peers in a topic mesh for bad_score reasons',\n labelNames: ['topic']\n }),\n meshPeerChurnEventsPrune: register.gauge({\n name: 'gossipsub_peer_churn_events_prune_total',\n help: 'Number of times we remove peers in a topic mesh for prune reasons',\n labelNames: ['topic']\n }),\n meshPeerChurnEventsExcess: register.gauge({\n name: 'gossipsub_peer_churn_events_excess_total',\n help: 'Number of times we remove peers in a topic mesh for excess reasons',\n labelNames: ['topic']\n }),\n meshPeerChurnEventsUnknown: register.gauge({\n name: 'gossipsub_peer_churn_events_unknown_total',\n help: 'Number of times we remove peers in a topic mesh for unknown reasons',\n labelNames: ['topic']\n }),\n /* General Metrics */\n /**\n * Gossipsub supports floodsub, gossipsub v1.0 and gossipsub v1.1. Peers are classified based\n * on which protocol they support. This metric keeps track of the number of peers that are\n * connected of each type. */\n peersPerProtocol: register.gauge({\n name: 'gossipsub_peers_per_protocol_count',\n help: 'Peers connected for each topic',\n labelNames: ['protocol']\n }),\n /** The time it takes to complete one iteration of the heartbeat. */\n heartbeatDuration: register.histogram({\n name: 'gossipsub_heartbeat_duration_seconds',\n help: 'The time it takes to complete one iteration of the heartbeat',\n // Should take <10ms, over 1s it's a huge issue that needs debugging, since a heartbeat will be cancelled\n buckets: [0.01, 0.1, 1]\n }),\n /** Heartbeat run took longer than heartbeat interval so next is skipped */\n heartbeatSkipped: register.gauge({\n name: 'gossipsub_heartbeat_skipped',\n help: 'Heartbeat run took longer than heartbeat interval so next is skipped'\n }),\n /**\n * Message validation results for each topic.\n * Invalid == Reject?\n * = rust-libp2p `invalid_messages`, `accepted_messages`, `ignored_messages`, `rejected_messages` */\n acceptedMessagesTotal: register.gauge({\n name: 'gossipsub_accepted_messages_total',\n help: 'Total accepted messages for each topic',\n labelNames: ['topic']\n }),\n ignoredMessagesTotal: register.gauge({\n name: 'gossipsub_ignored_messages_total',\n help: 'Total ignored messages for each topic',\n labelNames: ['topic']\n }),\n rejectedMessagesTotal: register.gauge({\n name: 'gossipsub_rejected_messages_total',\n help: 'Total rejected messages for each topic',\n labelNames: ['topic']\n }),\n unknownValidationResultsTotal: register.gauge({\n name: 'gossipsub_unknown_validation_results_total',\n help: 'Total unknown validation results for each topic',\n labelNames: ['topic']\n }),\n /**\n * When the user validates a message, it tries to re propagate it to its mesh peers. If the\n * message expires from the memcache before it can be validated, we count this a cache miss\n * and it is an indicator that the memcache size should be increased.\n * = rust-libp2p `mcache_misses` */\n asyncValidationMcacheHit: register.gauge({\n name: 'gossipsub_async_validation_mcache_hit_total',\n help: 'Async validation result reported by the user layer',\n labelNames: ['hit']\n }),\n asyncValidationDelayFromFirstSeenSec: register.histogram({\n name: 'gossipsub_async_validation_delay_from_first_seen',\n help: 'Async validation report delay from first seen in second',\n buckets: [0.01, 0.03, 0.1, 0.3, 1, 3, 10]\n }),\n asyncValidationUnknownFirstSeen: register.gauge({\n name: 'gossipsub_async_validation_unknown_first_seen_count_total',\n help: 'Async validation report unknown first seen value for message'\n }),\n // peer stream\n peerReadStreamError: register.gauge({\n name: 'gossipsub_peer_read_stream_err_count_total',\n help: 'Peer read stream error'\n }),\n // RPC outgoing. Track byte length + data structure sizes\n rpcRecvBytes: register.gauge({ name: 'gossipsub_rpc_recv_bytes_total', help: 'RPC recv' }),\n rpcRecvCount: register.gauge({ name: 'gossipsub_rpc_recv_count_total', help: 'RPC recv' }),\n rpcRecvSubscription: register.gauge({ name: 'gossipsub_rpc_recv_subscription_total', help: 'RPC recv' }),\n rpcRecvMessage: register.gauge({ name: 'gossipsub_rpc_recv_message_total', help: 'RPC recv' }),\n rpcRecvControl: register.gauge({ name: 'gossipsub_rpc_recv_control_total', help: 'RPC recv' }),\n rpcRecvIHave: register.gauge({ name: 'gossipsub_rpc_recv_ihave_total', help: 'RPC recv' }),\n rpcRecvIWant: register.gauge({ name: 'gossipsub_rpc_recv_iwant_total', help: 'RPC recv' }),\n rpcRecvGraft: register.gauge({ name: 'gossipsub_rpc_recv_graft_total', help: 'RPC recv' }),\n rpcRecvPrune: register.gauge({ name: 'gossipsub_rpc_recv_prune_total', help: 'RPC recv' }),\n rpcDataError: register.gauge({ name: 'gossipsub_rpc_data_err_count_total', help: 'RPC data error' }),\n rpcRecvError: register.gauge({ name: 'gossipsub_rpc_recv_err_count_total', help: 'RPC recv error' }),\n /** Total count of RPC dropped because acceptFrom() == false */\n rpcRecvNotAccepted: register.gauge({\n name: 'gossipsub_rpc_rcv_not_accepted_total',\n help: 'Total count of RPC dropped because acceptFrom() == false'\n }),\n // RPC incoming. Track byte length + data structure sizes\n rpcSentBytes: register.gauge({ name: 'gossipsub_rpc_sent_bytes_total', help: 'RPC sent' }),\n rpcSentCount: register.gauge({ name: 'gossipsub_rpc_sent_count_total', help: 'RPC sent' }),\n rpcSentSubscription: register.gauge({ name: 'gossipsub_rpc_sent_subscription_total', help: 'RPC sent' }),\n rpcSentMessage: register.gauge({ name: 'gossipsub_rpc_sent_message_total', help: 'RPC sent' }),\n rpcSentControl: register.gauge({ name: 'gossipsub_rpc_sent_control_total', help: 'RPC sent' }),\n rpcSentIHave: register.gauge({ name: 'gossipsub_rpc_sent_ihave_total', help: 'RPC sent' }),\n rpcSentIWant: register.gauge({ name: 'gossipsub_rpc_sent_iwant_total', help: 'RPC sent' }),\n rpcSentGraft: register.gauge({ name: 'gossipsub_rpc_sent_graft_total', help: 'RPC sent' }),\n rpcSentPrune: register.gauge({ name: 'gossipsub_rpc_sent_prune_total', help: 'RPC sent' }),\n // publish message. Track peers sent to and bytes\n /** Total count of msg published by topic */\n msgPublishCount: register.gauge({\n name: 'gossipsub_msg_publish_count_total',\n help: 'Total count of msg published by topic',\n labelNames: ['topic']\n }),\n /** Total count of peers that we publish a msg to */\n msgPublishPeersByTopic: register.gauge({\n name: 'gossipsub_msg_publish_peers_total',\n help: 'Total count of peers that we publish a msg to',\n labelNames: ['topic']\n }),\n /** Total count of peers (by group) that we publish a msg to */\n directPeersPublishedTotal: register.gauge({\n name: 'gossipsub_direct_peers_published_total',\n help: 'Total direct peers that we publish a msg to',\n labelNames: ['topic']\n }),\n floodsubPeersPublishedTotal: register.gauge({\n name: 'gossipsub_floodsub_peers_published_total',\n help: 'Total floodsub peers that we publish a msg to',\n labelNames: ['topic']\n }),\n meshPeersPublishedTotal: register.gauge({\n name: 'gossipsub_mesh_peers_published_total',\n help: 'Total mesh peers that we publish a msg to',\n labelNames: ['topic']\n }),\n fanoutPeersPublishedTotal: register.gauge({\n name: 'gossipsub_fanout_peers_published_total',\n help: 'Total fanout peers that we publish a msg to',\n labelNames: ['topic']\n }),\n /** Total count of msg publish data.length bytes */\n msgPublishBytes: register.gauge({\n name: 'gossipsub_msg_publish_bytes_total',\n help: 'Total count of msg publish data.length bytes',\n labelNames: ['topic']\n }),\n /** Total time in seconds to publish a message */\n msgPublishTime: register.histogram({\n name: 'gossipsub_msg_publish_seconds',\n help: 'Total time in seconds to publish a message',\n buckets: [0.001, 0.002, 0.005, 0.01, 0.1, 0.5, 1],\n labelNames: ['topic']\n }),\n /** Total count of msg forwarded by topic */\n msgForwardCount: register.gauge({\n name: 'gossipsub_msg_forward_count_total',\n help: 'Total count of msg forwarded by topic',\n labelNames: ['topic']\n }),\n /** Total count of peers that we forward a msg to */\n msgForwardPeers: register.gauge({\n name: 'gossipsub_msg_forward_peers_total',\n help: 'Total count of peers that we forward a msg to',\n labelNames: ['topic']\n }),\n /** Total count of recv msgs before any validation */\n msgReceivedPreValidation: register.gauge({\n name: 'gossipsub_msg_received_prevalidation_total',\n help: 'Total count of recv msgs before any validation',\n labelNames: ['topic']\n }),\n /** Total count of recv msgs error */\n msgReceivedError: register.gauge({\n name: 'gossipsub_msg_received_error_total',\n help: 'Total count of recv msgs error',\n labelNames: ['topic']\n }),\n /** Tracks distribution of recv msgs by duplicate, invalid, valid */\n prevalidationInvalidTotal: register.gauge({\n name: 'gossipsub_pre_validation_invalid_total',\n help: 'Total count of invalid messages received',\n labelNames: ['topic']\n }),\n prevalidationValidTotal: register.gauge({\n name: 'gossipsub_pre_validation_valid_total',\n help: 'Total count of valid messages received',\n labelNames: ['topic']\n }),\n prevalidationDuplicateTotal: register.gauge({\n name: 'gossipsub_pre_validation_duplicate_total',\n help: 'Total count of duplicate messages received',\n labelNames: ['topic']\n }),\n prevalidationUnknownTotal: register.gauge({\n name: 'gossipsub_pre_validation_unknown_status_total',\n help: 'Total count of unknown_status messages received',\n labelNames: ['topic']\n }),\n /** Tracks specific reason of invalid */\n msgReceivedInvalid: register.gauge({\n name: 'gossipsub_msg_received_invalid_total',\n help: 'Tracks specific reason of invalid',\n labelNames: ['error']\n }),\n msgReceivedInvalidByTopic: register.gauge({\n name: 'gossipsub_msg_received_invalid_by_topic_total',\n help: 'Tracks specific invalid message by topic',\n labelNames: ['topic']\n }),\n /** Track duplicate message delivery time */\n duplicateMsgDeliveryDelay: register.histogram({\n name: 'gossisub_duplicate_msg_delivery_delay_seconds',\n help: 'Time since the 1st duplicated message validated',\n labelNames: ['topic'],\n buckets: [\n 0.25 * opts.maxMeshMessageDeliveriesWindowSec,\n 0.5 * opts.maxMeshMessageDeliveriesWindowSec,\n Number(opts.maxMeshMessageDeliveriesWindowSec),\n 2 * opts.maxMeshMessageDeliveriesWindowSec,\n 4 * opts.maxMeshMessageDeliveriesWindowSec\n ]\n }),\n /** Total count of late msg delivery total by topic */\n duplicateMsgLateDelivery: register.gauge({\n name: 'gossisub_duplicate_msg_late_delivery_total',\n help: 'Total count of late duplicate message delivery by topic, which triggers P3 penalty',\n labelNames: ['topic']\n }),\n duplicateMsgIgnored: register.gauge({\n name: 'gossisub_ignored_published_duplicate_msgs_total',\n help: 'Total count of published duplicate message ignored by topic',\n labelNames: ['topic']\n }),\n /* Metrics related to scoring */\n /** Total times score() is called */\n scoreFnCalls: register.gauge({\n name: 'gossipsub_score_fn_calls_total',\n help: 'Total times score() is called'\n }),\n /** Total times score() call actually computed computeScore(), no cache */\n scoreFnRuns: register.gauge({\n name: 'gossipsub_score_fn_runs_total',\n help: 'Total times score() call actually computed computeScore(), no cache'\n }),\n scoreCachedDelta: register.histogram({\n name: 'gossipsub_score_cache_delta',\n help: 'Delta of score between cached values that expired',\n buckets: [10, 100, 1000]\n }),\n /** Current count of peers by score threshold */\n peersByScoreThreshold: register.gauge({\n name: 'gossipsub_peers_by_score_threshold_count',\n help: 'Current count of peers by score threshold',\n labelNames: ['threshold']\n }),\n score: register.avgMinMax({\n name: 'gossipsub_score',\n help: 'Avg min max of gossip scores'\n }),\n /**\n * Separate score weights\n * Need to use 2-label metrics in this case to debug the score weights\n **/\n scoreWeights: register.avgMinMax({\n name: 'gossipsub_score_weights',\n help: 'Separate score weights',\n labelNames: ['topic', 'p']\n }),\n /** Histogram of the scores for each mesh topic. */\n // TODO: Not implemented\n scorePerMesh: register.avgMinMax({\n name: 'gossipsub_score_per_mesh',\n help: 'Histogram of the scores for each mesh topic',\n labelNames: ['topic']\n }),\n /** A counter of the kind of penalties being applied to peers. */\n // TODO: Not fully implemented\n scoringPenalties: register.gauge({\n name: 'gossipsub_scoring_penalties_total',\n help: 'A counter of the kind of penalties being applied to peers',\n labelNames: ['penalty']\n }),\n behaviourPenalty: register.histogram({\n name: 'gossipsub_peer_stat_behaviour_penalty',\n help: 'Current peer stat behaviour_penalty at each scrape',\n buckets: [\n 0.25 * opts.behaviourPenaltyThreshold,\n 0.5 * opts.behaviourPenaltyThreshold,\n Number(opts.behaviourPenaltyThreshold),\n 2 * opts.behaviourPenaltyThreshold,\n 4 * opts.behaviourPenaltyThreshold\n ]\n }),\n // TODO:\n // - iasked per peer (on heartbeat)\n // - when promise is resolved, track messages from promises\n /** Total received IHAVE messages that we ignore for some reason */\n ihaveRcvIgnored: register.gauge({\n name: 'gossipsub_ihave_rcv_ignored_total',\n help: 'Total received IHAVE messages that we ignore for some reason',\n labelNames: ['reason']\n }),\n /** Total received IHAVE messages by topic */\n ihaveRcvMsgids: register.gauge({\n name: 'gossipsub_ihave_rcv_msgids_total',\n help: 'Total received IHAVE messages by topic',\n labelNames: ['topic']\n }),\n /**\n * Total messages per topic we don't have. Not actual requests.\n * The number of times we have decided that an IWANT control message is required for this\n * topic. A very high metric might indicate an underperforming network.\n * = rust-libp2p `topic_iwant_msgs` */\n ihaveRcvNotSeenMsgids: register.gauge({\n name: 'gossipsub_ihave_rcv_not_seen_msgids_total',\n help: 'Total messages per topic we do not have, not actual requests',\n labelNames: ['topic']\n }),\n /** Total received IWANT messages by topic */\n iwantRcvMsgids: register.gauge({\n name: 'gossipsub_iwant_rcv_msgids_total',\n help: 'Total received IWANT messages by topic',\n labelNames: ['topic']\n }),\n /** Total requested messageIDs that we don't have */\n iwantRcvDonthaveMsgids: register.gauge({\n name: 'gossipsub_iwant_rcv_dont_have_msgids_total',\n help: 'Total requested messageIDs that we do not have'\n }),\n iwantPromiseStarted: register.gauge({\n name: 'gossipsub_iwant_promise_sent_total',\n help: 'Total count of started IWANT promises'\n }),\n /** Total count of resolved IWANT promises */\n iwantPromiseResolved: register.gauge({\n name: 'gossipsub_iwant_promise_resolved_total',\n help: 'Total count of resolved IWANT promises'\n }),\n /** Total count of resolved IWANT promises from duplicate messages */\n iwantPromiseResolvedFromDuplicate: register.gauge({\n name: 'gossipsub_iwant_promise_resolved_from_duplicate_total',\n help: 'Total count of resolved IWANT promises from duplicate messages'\n }),\n /** Total count of peers we have asked IWANT promises that are resolved */\n iwantPromiseResolvedPeers: register.gauge({\n name: 'gossipsub_iwant_promise_resolved_peers',\n help: 'Total count of peers we have asked IWANT promises that are resolved'\n }),\n iwantPromiseBroken: register.gauge({\n name: 'gossipsub_iwant_promise_broken',\n help: 'Total count of broken IWANT promises'\n }),\n iwantMessagePruned: register.gauge({\n name: 'gossipsub_iwant_message_pruned',\n help: 'Total count of pruned IWANT messages'\n }),\n /** Histogram of delivery time of resolved IWANT promises */\n iwantPromiseDeliveryTime: register.histogram({\n name: 'gossipsub_iwant_promise_delivery_seconds',\n help: 'Histogram of delivery time of resolved IWANT promises',\n buckets: [\n 0.5 * opts.gossipPromiseExpireSec,\n Number(opts.gossipPromiseExpireSec),\n 2 * opts.gossipPromiseExpireSec,\n 4 * opts.gossipPromiseExpireSec\n ]\n }),\n iwantPromiseUntracked: register.gauge({\n name: 'gossip_iwant_promise_untracked',\n help: 'Total count of untracked IWANT promise'\n }),\n /** Backoff time */\n connectedPeersBackoffSec: register.histogram({\n name: 'gossipsub_connected_peers_backoff_seconds',\n help: 'Backoff time in seconds',\n // Using 1 seconds as minimum as that's close to the heartbeat duration, no need for more resolution.\n // As per spec, backoff times are 10 seconds for UnsubscribeBackoff and 60 seconds for PruneBackoff.\n // Higher values of 60 seconds should not occur, but we add 120 seconds just in case\n // https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md#overview-of-new-parameters\n buckets: [1, 2, 4, 10, 20, 60, 120]\n }),\n /* Data structure sizes */\n /** Unbounded cache sizes */\n cacheSize: register.gauge({\n name: 'gossipsub_cache_size',\n help: 'Unbounded cache sizes',\n labelNames: ['cache']\n }),\n /** Current mcache msg count */\n mcacheSize: register.gauge({\n name: 'gossipsub_mcache_size',\n help: 'Current mcache msg count'\n }),\n mcacheNotValidatedCount: register.gauge({\n name: 'gossipsub_mcache_not_validated_count',\n help: 'Current mcache msg count not validated'\n }),\n fastMsgIdCacheCollision: register.gauge({\n name: 'gossipsub_fastmsgid_cache_collision_total',\n help: 'Total count of key collisions on fastmsgid cache put'\n }),\n newConnectionCount: register.gauge({\n name: 'gossipsub_new_connection_total',\n help: 'Total new connection by status',\n labelNames: ['status']\n }),\n topicStrToLabel,\n toTopic(topicStr) {\n return this.topicStrToLabel.get(topicStr) ?? topicStr;\n },\n /** We joined a topic */\n onJoin(topicStr) {\n this.topicSubscriptionStatus.set({ topicStr }, 1);\n this.meshPeerCounts.set({ topicStr }, 0); // Reset count\n },\n /** We left a topic */\n onLeave(topicStr) {\n this.topicSubscriptionStatus.set({ topicStr }, 0);\n this.meshPeerCounts.set({ topicStr }, 0); // Reset count\n },\n /** Register the inclusion of peers in our mesh due to some reason. */\n onAddToMesh(topicStr, reason, count) {\n const topic = this.toTopic(topicStr);\n switch (reason) {\n case InclusionReason.Fanout:\n this.meshPeerInclusionEventsFanout.inc({ topic }, count);\n break;\n case InclusionReason.Random:\n this.meshPeerInclusionEventsRandom.inc({ topic }, count);\n break;\n case InclusionReason.Subscribed:\n this.meshPeerInclusionEventsSubscribed.inc({ topic }, count);\n break;\n case InclusionReason.Outbound:\n this.meshPeerInclusionEventsOutbound.inc({ topic }, count);\n break;\n case InclusionReason.NotEnough:\n this.meshPeerInclusionEventsNotEnough.inc({ topic }, count);\n break;\n case InclusionReason.Opportunistic:\n this.meshPeerInclusionEventsOpportunistic.inc({ topic }, count);\n break;\n default:\n this.meshPeerInclusionEventsUnknown.inc({ topic }, count);\n break;\n }\n },\n /** Register the removal of peers in our mesh due to some reason */\n // - remove_peer_from_mesh()\n // - heartbeat() Churn::BadScore\n // - heartbeat() Churn::Excess\n // - on_disconnect() Churn::Ds\n onRemoveFromMesh(topicStr, reason, count) {\n const topic = this.toTopic(topicStr);\n switch (reason) {\n case ChurnReason.Dc:\n this.meshPeerChurnEventsDisconnected.inc({ topic }, count);\n break;\n case ChurnReason.BadScore:\n this.meshPeerChurnEventsBadScore.inc({ topic }, count);\n break;\n case ChurnReason.Prune:\n this.meshPeerChurnEventsPrune.inc({ topic }, count);\n break;\n case ChurnReason.Excess:\n this.meshPeerChurnEventsExcess.inc({ topic }, count);\n break;\n default:\n this.meshPeerChurnEventsUnknown.inc({ topic }, count);\n break;\n }\n },\n /**\n * Update validation result to metrics\n *\n * @param messageRecord - null means the message's mcache record was not known at the time of acceptance report\n */\n onReportValidation(messageRecord, acceptance, firstSeenTimestampMs) {\n this.asyncValidationMcacheHit.inc({ hit: messageRecord != null ? 'hit' : 'miss' });\n if (messageRecord != null) {\n const topic = this.toTopic(messageRecord.message.topic);\n switch (acceptance) {\n case _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.TopicValidatorResult.Accept:\n this.acceptedMessagesTotal.inc({ topic });\n break;\n case _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.TopicValidatorResult.Ignore:\n this.ignoredMessagesTotal.inc({ topic });\n break;\n case _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.TopicValidatorResult.Reject:\n this.rejectedMessagesTotal.inc({ topic });\n break;\n default:\n this.unknownValidationResultsTotal.inc({ topic });\n break;\n }\n }\n if (firstSeenTimestampMs != null) {\n this.asyncValidationDelayFromFirstSeenSec.observe((Date.now() - firstSeenTimestampMs) / 1000);\n }\n else {\n this.asyncValidationUnknownFirstSeen.inc();\n }\n },\n /**\n * - in handle_graft() Penalty::GraftBackoff\n * - in apply_iwant_penalties() Penalty::BrokenPromise\n * - in metric_score() P3 Penalty::MessageDeficit\n * - in metric_score() P6 Penalty::IPColocation\n */\n onScorePenalty(penalty) {\n // Can this be labeled by topic too?\n this.scoringPenalties.inc({ penalty }, 1);\n },\n onIhaveRcv(topicStr, ihave, idonthave) {\n const topic = this.toTopic(topicStr);\n this.ihaveRcvMsgids.inc({ topic }, ihave);\n this.ihaveRcvNotSeenMsgids.inc({ topic }, idonthave);\n },\n onIwantRcv(iwantByTopic, iwantDonthave) {\n for (const [topicStr, iwant] of iwantByTopic) {\n const topic = this.toTopic(topicStr);\n this.iwantRcvMsgids.inc({ topic }, iwant);\n }\n this.iwantRcvDonthaveMsgids.inc(iwantDonthave);\n },\n onForwardMsg(topicStr, tosendCount) {\n const topic = this.toTopic(topicStr);\n this.msgForwardCount.inc({ topic }, 1);\n this.msgForwardPeers.inc({ topic }, tosendCount);\n },\n onPublishMsg(topicStr, tosendGroupCount, tosendCount, dataLen, ms) {\n const topic = this.toTopic(topicStr);\n this.msgPublishCount.inc({ topic }, 1);\n this.msgPublishBytes.inc({ topic }, tosendCount * dataLen);\n this.msgPublishPeersByTopic.inc({ topic }, tosendCount);\n this.directPeersPublishedTotal.inc({ topic }, tosendGroupCount.direct);\n this.floodsubPeersPublishedTotal.inc({ topic }, tosendGroupCount.floodsub);\n this.meshPeersPublishedTotal.inc({ topic }, tosendGroupCount.mesh);\n this.fanoutPeersPublishedTotal.inc({ topic }, tosendGroupCount.fanout);\n this.msgPublishTime.observe({ topic }, ms / 1000);\n },\n onMsgRecvPreValidation(topicStr) {\n const topic = this.toTopic(topicStr);\n this.msgReceivedPreValidation.inc({ topic }, 1);\n },\n onMsgRecvError(topicStr) {\n const topic = this.toTopic(topicStr);\n this.msgReceivedError.inc({ topic }, 1);\n },\n onPrevalidationResult(topicStr, status) {\n const topic = this.toTopic(topicStr);\n switch (status) {\n case _types_js__WEBPACK_IMPORTED_MODULE_1__.MessageStatus.duplicate:\n this.prevalidationDuplicateTotal.inc({ topic });\n break;\n case _types_js__WEBPACK_IMPORTED_MODULE_1__.MessageStatus.invalid:\n this.prevalidationInvalidTotal.inc({ topic });\n break;\n case _types_js__WEBPACK_IMPORTED_MODULE_1__.MessageStatus.valid:\n this.prevalidationValidTotal.inc({ topic });\n break;\n default:\n this.prevalidationUnknownTotal.inc({ topic });\n break;\n }\n },\n onMsgRecvInvalid(topicStr, reason) {\n const topic = this.toTopic(topicStr);\n const error = reason.reason === _types_js__WEBPACK_IMPORTED_MODULE_1__.RejectReason.Error ? reason.error : reason.reason;\n this.msgReceivedInvalid.inc({ error }, 1);\n this.msgReceivedInvalidByTopic.inc({ topic }, 1);\n },\n onDuplicateMsgDelivery(topicStr, deliveryDelayMs, isLateDelivery) {\n const topic = this.toTopic(topicStr);\n this.duplicateMsgDeliveryDelay.observe({ topic }, deliveryDelayMs / 1000);\n if (isLateDelivery) {\n this.duplicateMsgLateDelivery.inc({ topic }, 1);\n }\n },\n onPublishDuplicateMsg(topicStr) {\n const topic = this.toTopic(topicStr);\n this.duplicateMsgIgnored.inc({ topic }, 1);\n },\n onPeerReadStreamError() {\n this.peerReadStreamError.inc(1);\n },\n onRpcRecvError() {\n this.rpcRecvError.inc(1);\n },\n onRpcDataError() {\n this.rpcDataError.inc(1);\n },\n onRpcRecv(rpc, rpcBytes) {\n this.rpcRecvBytes.inc(rpcBytes);\n this.rpcRecvCount.inc(1);\n if (rpc.subscriptions != null)\n this.rpcRecvSubscription.inc(rpc.subscriptions.length);\n if (rpc.messages != null)\n this.rpcRecvMessage.inc(rpc.messages.length);\n if (rpc.control != null) {\n this.rpcRecvControl.inc(1);\n if (rpc.control.ihave != null)\n this.rpcRecvIHave.inc(rpc.control.ihave.length);\n if (rpc.control.iwant != null)\n this.rpcRecvIWant.inc(rpc.control.iwant.length);\n if (rpc.control.graft != null)\n this.rpcRecvGraft.inc(rpc.control.graft.length);\n if (rpc.control.prune != null)\n this.rpcRecvPrune.inc(rpc.control.prune.length);\n }\n },\n onRpcSent(rpc, rpcBytes) {\n this.rpcSentBytes.inc(rpcBytes);\n this.rpcSentCount.inc(1);\n if (rpc.subscriptions != null)\n this.rpcSentSubscription.inc(rpc.subscriptions.length);\n if (rpc.messages != null)\n this.rpcSentMessage.inc(rpc.messages.length);\n if (rpc.control != null) {\n const ihave = rpc.control.ihave?.length ?? 0;\n const iwant = rpc.control.iwant?.length ?? 0;\n const graft = rpc.control.graft?.length ?? 0;\n const prune = rpc.control.prune?.length ?? 0;\n if (ihave > 0)\n this.rpcSentIHave.inc(ihave);\n if (iwant > 0)\n this.rpcSentIWant.inc(iwant);\n if (graft > 0)\n this.rpcSentGraft.inc(graft);\n if (prune > 0)\n this.rpcSentPrune.inc(prune);\n if (ihave > 0 || iwant > 0 || graft > 0 || prune > 0)\n this.rpcSentControl.inc(1);\n }\n },\n registerScores(scores, scoreThresholds) {\n let graylist = 0;\n let publish = 0;\n let gossip = 0;\n let mesh = 0;\n for (const score of scores) {\n if (score >= scoreThresholds.graylistThreshold)\n graylist++;\n if (score >= scoreThresholds.publishThreshold)\n publish++;\n if (score >= scoreThresholds.gossipThreshold)\n gossip++;\n if (score >= 0)\n mesh++;\n }\n this.peersByScoreThreshold.set({ threshold: ScoreThreshold.graylist }, graylist);\n this.peersByScoreThreshold.set({ threshold: ScoreThreshold.publish }, publish);\n this.peersByScoreThreshold.set({ threshold: ScoreThreshold.gossip }, gossip);\n this.peersByScoreThreshold.set({ threshold: ScoreThreshold.mesh }, mesh);\n // Register full score too\n this.score.set(scores);\n },\n registerScoreWeights(sw) {\n for (const [topic, wsTopic] of sw.byTopic) {\n this.scoreWeights.set({ topic, p: 'p1' }, wsTopic.p1w);\n this.scoreWeights.set({ topic, p: 'p2' }, wsTopic.p2w);\n this.scoreWeights.set({ topic, p: 'p3' }, wsTopic.p3w);\n this.scoreWeights.set({ topic, p: 'p3b' }, wsTopic.p3bw);\n this.scoreWeights.set({ topic, p: 'p4' }, wsTopic.p4w);\n }\n this.scoreWeights.set({ p: 'p5' }, sw.p5w);\n this.scoreWeights.set({ p: 'p6' }, sw.p6w);\n this.scoreWeights.set({ p: 'p7' }, sw.p7w);\n },\n registerScorePerMesh(mesh, scoreByPeer) {\n const peersPerTopicLabel = new Map();\n mesh.forEach((peers, topicStr) => {\n // Aggregate by known topicLabel or throw to 'unknown'. This prevent too high cardinality\n const topicLabel = this.topicStrToLabel.get(topicStr) ?? 'unknown';\n let peersInMesh = peersPerTopicLabel.get(topicLabel);\n if (peersInMesh == null) {\n peersInMesh = new Set();\n peersPerTopicLabel.set(topicLabel, peersInMesh);\n }\n peers.forEach((p) => peersInMesh?.add(p));\n });\n for (const [topic, peers] of peersPerTopicLabel) {\n const meshScores = [];\n peers.forEach((peer) => {\n meshScores.push(scoreByPeer.get(peer) ?? 0);\n });\n this.scorePerMesh.set({ topic }, meshScores);\n }\n }\n };\n}\n//# sourceMappingURL=metrics.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/metrics.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/compute-score.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/compute-score.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ computeScore: () => (/* binding */ computeScore)\n/* harmony export */ });\nfunction computeScore(peer, pstats, params, peerIPs) {\n let score = 0;\n // topic stores\n Object.entries(pstats.topics).forEach(([topic, tstats]) => {\n // the topic parameters\n const topicParams = params.topics[topic];\n if (topicParams === undefined) {\n // we are not scoring this topic\n return;\n }\n let topicScore = 0;\n // P1: time in Mesh\n if (tstats.inMesh) {\n let p1 = tstats.meshTime / topicParams.timeInMeshQuantum;\n if (p1 > topicParams.timeInMeshCap) {\n p1 = topicParams.timeInMeshCap;\n }\n topicScore += p1 * topicParams.timeInMeshWeight;\n }\n // P2: first message deliveries\n let p2 = tstats.firstMessageDeliveries;\n if (p2 > topicParams.firstMessageDeliveriesCap) {\n p2 = topicParams.firstMessageDeliveriesCap;\n }\n topicScore += p2 * topicParams.firstMessageDeliveriesWeight;\n // P3: mesh message deliveries\n if (tstats.meshMessageDeliveriesActive &&\n tstats.meshMessageDeliveries < topicParams.meshMessageDeliveriesThreshold) {\n const deficit = topicParams.meshMessageDeliveriesThreshold - tstats.meshMessageDeliveries;\n const p3 = deficit * deficit;\n topicScore += p3 * topicParams.meshMessageDeliveriesWeight;\n }\n // P3b:\n // NOTE: the weight of P3b is negative (validated in validateTopicScoreParams) so this detracts\n const p3b = tstats.meshFailurePenalty;\n topicScore += p3b * topicParams.meshFailurePenaltyWeight;\n // P4: invalid messages\n // NOTE: the weight of P4 is negative (validated in validateTopicScoreParams) so this detracts\n const p4 = tstats.invalidMessageDeliveries * tstats.invalidMessageDeliveries;\n topicScore += p4 * topicParams.invalidMessageDeliveriesWeight;\n // update score, mixing with topic weight\n score += topicScore * topicParams.topicWeight;\n });\n // apply the topic score cap, if any\n if (params.topicScoreCap > 0 && score > params.topicScoreCap) {\n score = params.topicScoreCap;\n }\n // P5: application-specific score\n const p5 = params.appSpecificScore(peer);\n score += p5 * params.appSpecificWeight;\n // P6: IP colocation factor\n pstats.knownIPs.forEach((ip) => {\n if (params.IPColocationFactorWhitelist.has(ip)) {\n return;\n }\n // P6 has a cliff (IPColocationFactorThreshold)\n // It's only applied if at least that many peers are connected to us from that source IP addr.\n // It is quadratic, and the weight is negative (validated in validatePeerScoreParams)\n const peersInIP = peerIPs.get(ip);\n const numPeersInIP = (peersInIP != null) ? peersInIP.size : 0;\n if (numPeersInIP > params.IPColocationFactorThreshold) {\n const surplus = numPeersInIP - params.IPColocationFactorThreshold;\n const p6 = surplus * surplus;\n score += p6 * params.IPColocationFactorWeight;\n }\n });\n // P7: behavioural pattern penalty\n if (pstats.behaviourPenalty > params.behaviourPenaltyThreshold) {\n const excess = pstats.behaviourPenalty - params.behaviourPenaltyThreshold;\n const p7 = excess * excess;\n score += p7 * params.behaviourPenaltyWeight;\n }\n return score;\n}\n//# sourceMappingURL=compute-score.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/compute-score.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/constants.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/constants.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ERR_INVALID_PEER_SCORE_PARAMS: () => (/* binding */ ERR_INVALID_PEER_SCORE_PARAMS),\n/* harmony export */ ERR_INVALID_PEER_SCORE_THRESHOLDS: () => (/* binding */ ERR_INVALID_PEER_SCORE_THRESHOLDS)\n/* harmony export */ });\nconst ERR_INVALID_PEER_SCORE_PARAMS = 'ERR_INVALID_PEER_SCORE_PARAMS';\nconst ERR_INVALID_PEER_SCORE_THRESHOLDS = 'ERR_INVALID_PEER_SCORE_THRESHOLDS';\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/message-deliveries.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/message-deliveries.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DeliveryRecordStatus: () => (/* binding */ DeliveryRecordStatus),\n/* harmony export */ MessageDeliveries: () => (/* binding */ MessageDeliveries)\n/* harmony export */ });\n/* harmony import */ var denque__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! denque */ \"./node_modules/denque/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/constants.js\");\n\n\nvar DeliveryRecordStatus;\n(function (DeliveryRecordStatus) {\n /**\n * we don't know (yet) if the message is valid\n */\n DeliveryRecordStatus[DeliveryRecordStatus[\"unknown\"] = 0] = \"unknown\";\n /**\n * we know the message is valid\n */\n DeliveryRecordStatus[DeliveryRecordStatus[\"valid\"] = 1] = \"valid\";\n /**\n * we know the message is invalid\n */\n DeliveryRecordStatus[DeliveryRecordStatus[\"invalid\"] = 2] = \"invalid\";\n /**\n * we were instructed by the validator to ignore the message\n */\n DeliveryRecordStatus[DeliveryRecordStatus[\"ignored\"] = 3] = \"ignored\";\n})(DeliveryRecordStatus || (DeliveryRecordStatus = {}));\n/**\n * Map of canonical message ID to DeliveryRecord\n *\n * Maintains an internal queue for efficient gc of old messages\n */\nclass MessageDeliveries {\n records;\n queue;\n constructor() {\n this.records = new Map();\n this.queue = new denque__WEBPACK_IMPORTED_MODULE_0__();\n }\n getRecord(msgIdStr) {\n return this.records.get(msgIdStr);\n }\n ensureRecord(msgIdStr) {\n let drec = this.records.get(msgIdStr);\n if (drec != null) {\n return drec;\n }\n // record doesn't exist yet\n // create record\n drec = {\n status: DeliveryRecordStatus.unknown,\n firstSeenTsMs: Date.now(),\n validated: 0,\n peers: new Set()\n };\n this.records.set(msgIdStr, drec);\n // and add msgId to the queue\n const entry = {\n msgId: msgIdStr,\n expire: Date.now() + _constants_js__WEBPACK_IMPORTED_MODULE_1__.TimeCacheDuration\n };\n this.queue.push(entry);\n return drec;\n }\n gc() {\n const now = Date.now();\n // queue is sorted by expiry time\n // remove expired messages, remove from queue until first un-expired message found\n let head = this.queue.peekFront();\n while ((head != null) && head.expire < now) {\n this.records.delete(head.msgId);\n this.queue.shift();\n head = this.queue.peekFront();\n }\n }\n clear() {\n this.records.clear();\n this.queue.clear();\n }\n}\n//# sourceMappingURL=message-deliveries.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/message-deliveries.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-params.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-params.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createPeerScoreParams: () => (/* binding */ createPeerScoreParams),\n/* harmony export */ createTopicScoreParams: () => (/* binding */ createTopicScoreParams),\n/* harmony export */ defaultPeerScoreParams: () => (/* binding */ defaultPeerScoreParams),\n/* harmony export */ defaultTopicScoreParams: () => (/* binding */ defaultTopicScoreParams),\n/* harmony export */ validatePeerScoreParams: () => (/* binding */ validatePeerScoreParams),\n/* harmony export */ validateTopicScoreParams: () => (/* binding */ validateTopicScoreParams)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/constants.js\");\n\n\nconst defaultPeerScoreParams = {\n topics: {},\n topicScoreCap: 10.0,\n appSpecificScore: () => 0.0,\n appSpecificWeight: 10.0,\n IPColocationFactorWeight: -5.0,\n IPColocationFactorThreshold: 10.0,\n IPColocationFactorWhitelist: new Set(),\n behaviourPenaltyWeight: -10.0,\n behaviourPenaltyThreshold: 0.0,\n behaviourPenaltyDecay: 0.2,\n decayInterval: 1000.0,\n decayToZero: 0.1,\n retainScore: 3600 * 1000\n};\nconst defaultTopicScoreParams = {\n topicWeight: 0.5,\n timeInMeshWeight: 1,\n timeInMeshQuantum: 1,\n timeInMeshCap: 3600,\n firstMessageDeliveriesWeight: 1,\n firstMessageDeliveriesDecay: 0.5,\n firstMessageDeliveriesCap: 2000,\n meshMessageDeliveriesWeight: -1,\n meshMessageDeliveriesDecay: 0.5,\n meshMessageDeliveriesCap: 100,\n meshMessageDeliveriesThreshold: 20,\n meshMessageDeliveriesWindow: 10,\n meshMessageDeliveriesActivation: 5000,\n meshFailurePenaltyWeight: -1,\n meshFailurePenaltyDecay: 0.5,\n invalidMessageDeliveriesWeight: -1,\n invalidMessageDeliveriesDecay: 0.3\n};\nfunction createPeerScoreParams(p = {}) {\n return {\n ...defaultPeerScoreParams,\n ...p,\n topics: (p.topics != null)\n ? Object.entries(p.topics).reduce((topics, [topic, topicScoreParams]) => {\n topics[topic] = createTopicScoreParams(topicScoreParams);\n return topics;\n }, {})\n : {}\n };\n}\nfunction createTopicScoreParams(p = {}) {\n return {\n ...defaultTopicScoreParams,\n ...p\n };\n}\n// peer score parameter validation\nfunction validatePeerScoreParams(p) {\n for (const [topic, params] of Object.entries(p.topics)) {\n try {\n validateTopicScoreParams(params);\n }\n catch (e) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError(`invalid score parameters for topic ${topic}: ${e.message}`, _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n }\n // check that the topic score is 0 or something positive\n if (p.topicScoreCap < 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid topic score cap; must be positive (or 0 for no cap)', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check that we have an app specific score; the weight can be anything (but expected positive)\n if (p.appSpecificScore === null || p.appSpecificScore === undefined) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('missing application specific score function', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check the IP colocation factor\n if (p.IPColocationFactorWeight > 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid IPColocationFactorWeight; must be negative (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.IPColocationFactorWeight !== 0 && p.IPColocationFactorThreshold < 1) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid IPColocationFactorThreshold; must be at least 1', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check the behaviour penalty\n if (p.behaviourPenaltyWeight > 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.behaviourPenaltyWeight !== 0 && (p.behaviourPenaltyDecay <= 0 || p.behaviourPenaltyDecay >= 1)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid BehaviourPenaltyDecay; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check the decay parameters\n if (p.decayInterval < 1000) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid DecayInterval; must be at least 1s', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.decayToZero <= 0 || p.decayToZero >= 1) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid DecayToZero; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // no need to check the score retention; a value of 0 means that we don't retain scores\n}\n// eslint-disable-next-line complexity\nfunction validateTopicScoreParams(p) {\n // make sure we have a sane topic weight\n if (p.topicWeight < 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid topic weight; must be >= 0', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check P1\n if (p.timeInMeshQuantum === 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid TimeInMeshQuantum; must be non zero', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.timeInMeshWeight < 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid TimeInMeshWeight; must be positive (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.timeInMeshWeight !== 0 && p.timeInMeshQuantum <= 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid TimeInMeshQuantum; must be positive', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.timeInMeshWeight !== 0 && p.timeInMeshCap <= 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid TimeInMeshCap; must be positive', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check P2\n if (p.firstMessageDeliveriesWeight < 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.firstMessageDeliveriesWeight !== 0 &&\n (p.firstMessageDeliveriesDecay <= 0 || p.firstMessageDeliveriesDecay >= 1)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid FirstMessageDeliveriesDecay; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.firstMessageDeliveriesWeight !== 0 && p.firstMessageDeliveriesCap <= 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid FirstMessageDeliveriesCap; must be positive', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check P3\n if (p.meshMessageDeliveriesWeight > 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshMessageDeliveriesWeight !== 0 && (p.meshMessageDeliveriesDecay <= 0 || p.meshMessageDeliveriesDecay >= 1)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid MeshMessageDeliveriesDecay; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshMessageDeliveriesWeight !== 0 && p.meshMessageDeliveriesCap <= 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid MeshMessageDeliveriesCap; must be positive', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshMessageDeliveriesWeight !== 0 && p.meshMessageDeliveriesThreshold <= 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid MeshMessageDeliveriesThreshold; must be positive', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshMessageDeliveriesWindow < 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid MeshMessageDeliveriesWindow; must be non-negative', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshMessageDeliveriesWeight !== 0 && p.meshMessageDeliveriesActivation < 1000) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid MeshMessageDeliveriesActivation; must be at least 1s', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check P3b\n if (p.meshFailurePenaltyWeight > 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshFailurePenaltyWeight !== 0 && (p.meshFailurePenaltyDecay <= 0 || p.meshFailurePenaltyDecay >= 1)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid MeshFailurePenaltyDecay; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check P4\n if (p.invalidMessageDeliveriesWeight > 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.invalidMessageDeliveriesDecay <= 0 || p.invalidMessageDeliveriesDecay >= 1) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid InvalidMessageDeliveriesDecay; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n}\n//# sourceMappingURL=peer-score-params.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-params.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-thresholds.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-thresholds.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createPeerScoreThresholds: () => (/* binding */ createPeerScoreThresholds),\n/* harmony export */ defaultPeerScoreThresholds: () => (/* binding */ defaultPeerScoreThresholds),\n/* harmony export */ validatePeerScoreThresholds: () => (/* binding */ validatePeerScoreThresholds)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/constants.js\");\n\n\nconst defaultPeerScoreThresholds = {\n gossipThreshold: -10,\n publishThreshold: -50,\n graylistThreshold: -80,\n acceptPXThreshold: 10,\n opportunisticGraftThreshold: 20\n};\nfunction createPeerScoreThresholds(p = {}) {\n return {\n ...defaultPeerScoreThresholds,\n ...p\n };\n}\nfunction validatePeerScoreThresholds(p) {\n if (p.gossipThreshold > 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid gossip threshold; it must be <= 0', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_THRESHOLDS);\n }\n if (p.publishThreshold > 0 || p.publishThreshold > p.gossipThreshold) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid publish threshold; it must be <= 0 and <= gossip threshold', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_THRESHOLDS);\n }\n if (p.graylistThreshold > 0 || p.graylistThreshold > p.publishThreshold) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid graylist threshold; it must be <= 0 and <= publish threshold', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_THRESHOLDS);\n }\n if (p.acceptPXThreshold < 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid accept PX threshold; it must be >= 0', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_THRESHOLDS);\n }\n if (p.opportunisticGraftThreshold < 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('invalid opportunistic grafting threshold; it must be >= 0', _constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_PEER_SCORE_THRESHOLDS);\n }\n}\n//# sourceMappingURL=peer-score-thresholds.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-thresholds.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerScore: () => (/* binding */ PeerScore)\n/* harmony export */ });\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n/* harmony import */ var _utils_set_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/set.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/set.js\");\n/* harmony import */ var _compute_score_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./compute-score.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/compute-score.js\");\n/* harmony import */ var _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message-deliveries.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/message-deliveries.js\");\n/* harmony import */ var _peer_score_params_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./peer-score-params.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-params.js\");\n\n\n\n\n\nclass PeerScore {\n params;\n metrics;\n /**\n * Per-peer stats for score calculation\n */\n peerStats = new Map();\n /**\n * IP colocation tracking; maps IP => set of peers.\n */\n peerIPs = new _utils_set_js__WEBPACK_IMPORTED_MODULE_0__.MapDef(() => new Set());\n /**\n * Cache score up to decayInterval if topic stats are unchanged.\n */\n scoreCache = new Map();\n /**\n * Recent message delivery timing/participants\n */\n deliveryRecords = new _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.MessageDeliveries();\n _backgroundInterval;\n scoreCacheValidityMs;\n computeScore;\n log;\n constructor(params, metrics, componentLogger, opts) {\n this.params = params;\n this.metrics = metrics;\n (0,_peer_score_params_js__WEBPACK_IMPORTED_MODULE_2__.validatePeerScoreParams)(params);\n this.scoreCacheValidityMs = opts.scoreCacheValidityMs;\n this.computeScore = opts.computeScore ?? _compute_score_js__WEBPACK_IMPORTED_MODULE_3__.computeScore;\n this.log = componentLogger.forComponent('libp2p:gossipsub:score');\n }\n get size() {\n return this.peerStats.size;\n }\n /**\n * Start PeerScore instance\n */\n start() {\n if (this._backgroundInterval != null) {\n this.log('Peer score already running');\n return;\n }\n this._backgroundInterval = setInterval(() => { this.background(); }, this.params.decayInterval);\n this.log('started');\n }\n /**\n * Stop PeerScore instance\n */\n stop() {\n if (this._backgroundInterval == null) {\n this.log('Peer score already stopped');\n return;\n }\n clearInterval(this._backgroundInterval);\n delete this._backgroundInterval;\n this.peerIPs.clear();\n this.peerStats.clear();\n this.deliveryRecords.clear();\n this.log('stopped');\n }\n /**\n * Periodic maintenance\n */\n background() {\n this.refreshScores();\n this.deliveryRecords.gc();\n }\n dumpPeerScoreStats() {\n return Object.fromEntries(Array.from(this.peerStats.entries()).map(([peer, stats]) => [peer, stats]));\n }\n messageFirstSeenTimestampMs(msgIdStr) {\n const drec = this.deliveryRecords.getRecord(msgIdStr);\n return (drec != null) ? drec.firstSeenTsMs : null;\n }\n /**\n * Decays scores, and purges score records for disconnected peers once their expiry has elapsed.\n */\n refreshScores() {\n const now = Date.now();\n const decayToZero = this.params.decayToZero;\n this.peerStats.forEach((pstats, id) => {\n if (!pstats.connected) {\n // has the retention period expired?\n if (now > pstats.expire) {\n // yes, throw it away (but clean up the IP tracking first)\n this.removeIPsForPeer(id, pstats.knownIPs);\n this.peerStats.delete(id);\n this.scoreCache.delete(id);\n }\n // we don't decay retained scores, as the peer is not active.\n // this way the peer cannot reset a negative score by simply disconnecting and reconnecting,\n // unless the retention period has elapsed.\n // similarly, a well behaved peer does not lose its score by getting disconnected.\n return;\n }\n Object.entries(pstats.topics).forEach(([topic, tstats]) => {\n const tparams = this.params.topics[topic];\n if (tparams === undefined) {\n // we are not scoring this topic\n // should be unreachable, we only add scored topics to pstats\n return;\n }\n // decay counters\n tstats.firstMessageDeliveries *= tparams.firstMessageDeliveriesDecay;\n if (tstats.firstMessageDeliveries < decayToZero) {\n tstats.firstMessageDeliveries = 0;\n }\n tstats.meshMessageDeliveries *= tparams.meshMessageDeliveriesDecay;\n if (tstats.meshMessageDeliveries < decayToZero) {\n tstats.meshMessageDeliveries = 0;\n }\n tstats.meshFailurePenalty *= tparams.meshFailurePenaltyDecay;\n if (tstats.meshFailurePenalty < decayToZero) {\n tstats.meshFailurePenalty = 0;\n }\n tstats.invalidMessageDeliveries *= tparams.invalidMessageDeliveriesDecay;\n if (tstats.invalidMessageDeliveries < decayToZero) {\n tstats.invalidMessageDeliveries = 0;\n }\n // update mesh time and activate mesh message delivery parameter if need be\n if (tstats.inMesh) {\n tstats.meshTime = now - tstats.graftTime;\n if (tstats.meshTime > tparams.meshMessageDeliveriesActivation) {\n tstats.meshMessageDeliveriesActive = true;\n }\n }\n });\n // decay P7 counter\n pstats.behaviourPenalty *= this.params.behaviourPenaltyDecay;\n if (pstats.behaviourPenalty < decayToZero) {\n pstats.behaviourPenalty = 0;\n }\n });\n }\n /**\n * Return the score for a peer\n */\n score(id) {\n this.metrics?.scoreFnCalls.inc();\n const pstats = this.peerStats.get(id);\n if (pstats == null) {\n return 0;\n }\n const now = Date.now();\n const cacheEntry = this.scoreCache.get(id);\n // Found cached score within validity period\n if ((cacheEntry != null) && cacheEntry.cacheUntil > now) {\n return cacheEntry.score;\n }\n this.metrics?.scoreFnRuns.inc();\n const score = this.computeScore(id, pstats, this.params, this.peerIPs);\n const cacheUntil = now + this.scoreCacheValidityMs;\n if (cacheEntry != null) {\n this.metrics?.scoreCachedDelta.observe(Math.abs(score - cacheEntry.score));\n cacheEntry.score = score;\n cacheEntry.cacheUntil = cacheUntil;\n }\n else {\n this.scoreCache.set(id, { score, cacheUntil });\n }\n return score;\n }\n /**\n * Apply a behavioural penalty to a peer\n */\n addPenalty(id, penalty, penaltyLabel) {\n const pstats = this.peerStats.get(id);\n if (pstats != null) {\n pstats.behaviourPenalty += penalty;\n this.metrics?.onScorePenalty(penaltyLabel);\n }\n }\n addPeer(id) {\n // create peer stats (not including topic stats for each topic to be scored)\n // topic stats will be added as needed\n const pstats = {\n connected: true,\n expire: 0,\n topics: {},\n knownIPs: new Set(),\n behaviourPenalty: 0\n };\n this.peerStats.set(id, pstats);\n }\n /** Adds a new IP to a peer, if the peer is not known the update is ignored */\n addIP(id, ip) {\n const pstats = this.peerStats.get(id);\n if (pstats != null) {\n pstats.knownIPs.add(ip);\n }\n this.peerIPs.getOrDefault(ip).add(id);\n }\n /** Remove peer association with IP */\n removeIP(id, ip) {\n const pstats = this.peerStats.get(id);\n if (pstats != null) {\n pstats.knownIPs.delete(ip);\n }\n const peersWithIP = this.peerIPs.get(ip);\n if (peersWithIP != null) {\n peersWithIP.delete(id);\n if (peersWithIP.size === 0) {\n this.peerIPs.delete(ip);\n }\n }\n }\n removePeer(id) {\n const pstats = this.peerStats.get(id);\n if (pstats == null) {\n return;\n }\n // decide whether to retain the score; this currently only retains non-positive scores\n // to dissuade attacks on the score function.\n if (this.score(id) > 0) {\n this.removeIPsForPeer(id, pstats.knownIPs);\n this.peerStats.delete(id);\n return;\n }\n // furthermore, when we decide to retain the score, the firstMessageDelivery counters are\n // reset to 0 and mesh delivery penalties applied.\n Object.entries(pstats.topics).forEach(([topic, tstats]) => {\n tstats.firstMessageDeliveries = 0;\n const threshold = this.params.topics[topic].meshMessageDeliveriesThreshold;\n if (tstats.inMesh && tstats.meshMessageDeliveriesActive && tstats.meshMessageDeliveries < threshold) {\n const deficit = threshold - tstats.meshMessageDeliveries;\n tstats.meshFailurePenalty += deficit * deficit;\n }\n tstats.inMesh = false;\n tstats.meshMessageDeliveriesActive = false;\n });\n pstats.connected = false;\n pstats.expire = Date.now() + this.params.retainScore;\n }\n /** Handles scoring functionality as a peer GRAFTs to a topic. */\n graft(id, topic) {\n const pstats = this.peerStats.get(id);\n if (pstats != null) {\n const tstats = this.getPtopicStats(pstats, topic);\n if (tstats != null) {\n // if we are scoring the topic, update the mesh status.\n tstats.inMesh = true;\n tstats.graftTime = Date.now();\n tstats.meshTime = 0;\n tstats.meshMessageDeliveriesActive = false;\n }\n }\n }\n /** Handles scoring functionality as a peer PRUNEs from a topic. */\n prune(id, topic) {\n const pstats = this.peerStats.get(id);\n if (pstats != null) {\n const tstats = this.getPtopicStats(pstats, topic);\n if (tstats != null) {\n // sticky mesh delivery rate failure penalty\n const threshold = this.params.topics[topic].meshMessageDeliveriesThreshold;\n if (tstats.meshMessageDeliveriesActive && tstats.meshMessageDeliveries < threshold) {\n const deficit = threshold - tstats.meshMessageDeliveries;\n tstats.meshFailurePenalty += deficit * deficit;\n }\n tstats.meshMessageDeliveriesActive = false;\n tstats.inMesh = false;\n // TODO: Consider clearing score cache on important penalties\n // this.scoreCache.delete(id)\n }\n }\n }\n validateMessage(msgIdStr) {\n this.deliveryRecords.ensureRecord(msgIdStr);\n }\n deliverMessage(from, msgIdStr, topic) {\n this.markFirstMessageDelivery(from, topic);\n const drec = this.deliveryRecords.ensureRecord(msgIdStr);\n const now = Date.now();\n // defensive check that this is the first delivery trace -- delivery status should be unknown\n if (drec.status !== _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.DeliveryRecordStatus.unknown) {\n this.log('unexpected delivery: message from %s was first seen %s ago and has delivery status %s', from, now - drec.firstSeenTsMs, _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.DeliveryRecordStatus[drec.status]);\n return;\n }\n // mark the message as valid and reward mesh peers that have already forwarded it to us\n drec.status = _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.DeliveryRecordStatus.valid;\n drec.validated = now;\n drec.peers.forEach((p) => {\n // this check is to make sure a peer can't send us a message twice and get a double count\n // if it is a first delivery.\n if (p !== from.toString()) {\n this.markDuplicateMessageDelivery(p, topic);\n }\n });\n }\n /**\n * Similar to `rejectMessage` except does not require the message id or reason for an invalid message.\n */\n rejectInvalidMessage(from, topic) {\n this.markInvalidMessageDelivery(from, topic);\n }\n rejectMessage(from, msgIdStr, topic, reason) {\n // eslint-disable-next-line default-case\n switch (reason) {\n // these messages are not tracked, but the peer is penalized as they are invalid\n case _types_js__WEBPACK_IMPORTED_MODULE_4__.RejectReason.Error:\n this.markInvalidMessageDelivery(from, topic);\n return;\n // we ignore those messages, so do nothing.\n case _types_js__WEBPACK_IMPORTED_MODULE_4__.RejectReason.Blacklisted:\n return;\n // the rest are handled after record creation\n }\n const drec = this.deliveryRecords.ensureRecord(msgIdStr);\n // defensive check that this is the first rejection -- delivery status should be unknown\n if (drec.status !== _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.DeliveryRecordStatus.unknown) {\n this.log('unexpected rejection: message from %s was first seen %s ago and has delivery status %d', from, Date.now() - drec.firstSeenTsMs, _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.DeliveryRecordStatus[drec.status]);\n return;\n }\n if (reason === _types_js__WEBPACK_IMPORTED_MODULE_4__.RejectReason.Ignore) {\n // we were explicitly instructed by the validator to ignore the message but not penalize the peer\n drec.status = _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.DeliveryRecordStatus.ignored;\n drec.peers.clear();\n return;\n }\n // mark the message as invalid and penalize peers that have already forwarded it.\n drec.status = _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.DeliveryRecordStatus.invalid;\n this.markInvalidMessageDelivery(from, topic);\n drec.peers.forEach((p) => {\n this.markInvalidMessageDelivery(p, topic);\n });\n // release the delivery time tracking map to free some memory early\n drec.peers.clear();\n }\n duplicateMessage(from, msgIdStr, topic) {\n const drec = this.deliveryRecords.ensureRecord(msgIdStr);\n if (drec.peers.has(from)) {\n // we have already seen this duplicate\n return;\n }\n // eslint-disable-next-line default-case\n switch (drec.status) {\n case _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.DeliveryRecordStatus.unknown:\n // the message is being validated; track the peer delivery and wait for\n // the Deliver/Reject/Ignore notification.\n drec.peers.add(from);\n break;\n case _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.DeliveryRecordStatus.valid:\n // mark the peer delivery time to only count a duplicate delivery once.\n drec.peers.add(from);\n this.markDuplicateMessageDelivery(from, topic, drec.validated);\n break;\n case _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.DeliveryRecordStatus.invalid:\n // we no longer track delivery time\n this.markInvalidMessageDelivery(from, topic);\n break;\n case _message_deliveries_js__WEBPACK_IMPORTED_MODULE_1__.DeliveryRecordStatus.ignored:\n // the message was ignored; do nothing (we don't know if it was valid)\n break;\n }\n }\n /**\n * Increments the \"invalid message deliveries\" counter for all scored topics the message is published in.\n */\n markInvalidMessageDelivery(from, topic) {\n const pstats = this.peerStats.get(from);\n if (pstats != null) {\n const tstats = this.getPtopicStats(pstats, topic);\n if (tstats != null) {\n tstats.invalidMessageDeliveries += 1;\n }\n }\n }\n /**\n * Increments the \"first message deliveries\" counter for all scored topics the message is published in,\n * as well as the \"mesh message deliveries\" counter, if the peer is in the mesh for the topic.\n * Messages already known (with the seenCache) are counted with markDuplicateMessageDelivery()\n */\n markFirstMessageDelivery(from, topic) {\n const pstats = this.peerStats.get(from);\n if (pstats != null) {\n const tstats = this.getPtopicStats(pstats, topic);\n if (tstats != null) {\n let cap = this.params.topics[topic].firstMessageDeliveriesCap;\n tstats.firstMessageDeliveries = Math.min(cap, tstats.firstMessageDeliveries + 1);\n if (tstats.inMesh) {\n cap = this.params.topics[topic].meshMessageDeliveriesCap;\n tstats.meshMessageDeliveries = Math.min(cap, tstats.meshMessageDeliveries + 1);\n }\n }\n }\n }\n /**\n * Increments the \"mesh message deliveries\" counter for messages we've seen before,\n * as long the message was received within the P3 window.\n */\n markDuplicateMessageDelivery(from, topic, validatedTime) {\n const pstats = this.peerStats.get(from);\n if (pstats != null) {\n const now = validatedTime !== undefined ? Date.now() : 0;\n const tstats = this.getPtopicStats(pstats, topic);\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n if (tstats != null && tstats.inMesh) {\n const tparams = this.params.topics[topic];\n // check against the mesh delivery window -- if the validated time is passed as 0, then\n // the message was received before we finished validation and thus falls within the mesh\n // delivery window.\n if (validatedTime !== undefined) {\n const deliveryDelayMs = now - validatedTime;\n const isLateDelivery = deliveryDelayMs > tparams.meshMessageDeliveriesWindow;\n this.metrics?.onDuplicateMsgDelivery(topic, deliveryDelayMs, isLateDelivery);\n if (isLateDelivery) {\n return;\n }\n }\n const cap = tparams.meshMessageDeliveriesCap;\n tstats.meshMessageDeliveries = Math.min(cap, tstats.meshMessageDeliveries + 1);\n }\n }\n }\n /**\n * Removes an IP list from the tracking list for a peer.\n */\n removeIPsForPeer(id, ipsToRemove) {\n for (const ipToRemove of ipsToRemove) {\n const peerSet = this.peerIPs.get(ipToRemove);\n if (peerSet != null) {\n peerSet.delete(id);\n if (peerSet.size === 0) {\n this.peerIPs.delete(ipToRemove);\n }\n }\n }\n }\n /**\n * Returns topic stats if they exist, otherwise if the supplied parameters score the\n * topic, inserts the default stats and returns a reference to those. If neither apply, returns None.\n */\n getPtopicStats(pstats, topic) {\n let topicStats = pstats.topics[topic];\n if (topicStats !== undefined) {\n return topicStats;\n }\n if (this.params.topics[topic] !== undefined) {\n topicStats = {\n inMesh: false,\n graftTime: 0,\n meshTime: 0,\n firstMessageDeliveries: 0,\n meshMessageDeliveries: 0,\n meshMessageDeliveriesActive: false,\n meshFailurePenalty: 0,\n invalidMessageDeliveries: 0\n };\n pstats.topics[topic] = topicStats;\n return topicStats;\n }\n return null;\n }\n}\n//# sourceMappingURL=peer-score.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/scoreMetrics.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/scoreMetrics.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ computeAllPeersScoreWeights: () => (/* binding */ computeAllPeersScoreWeights),\n/* harmony export */ computeScoreWeights: () => (/* binding */ computeScoreWeights)\n/* harmony export */ });\nfunction computeScoreWeights(peer, pstats, params, peerIPs, topicStrToLabel) {\n let score = 0;\n const byTopic = new Map();\n // topic stores\n Object.entries(pstats.topics).forEach(([topic, tstats]) => {\n // the topic parameters\n // Aggregate by known topicLabel or throw to 'unknown'. This prevent too high cardinality\n const topicLabel = topicStrToLabel.get(topic) ?? 'unknown';\n const topicParams = params.topics[topic];\n if (topicParams === undefined) {\n // we are not scoring this topic\n return;\n }\n let topicScores = byTopic.get(topicLabel);\n if (topicScores == null) {\n topicScores = {\n p1w: 0,\n p2w: 0,\n p3w: 0,\n p3bw: 0,\n p4w: 0\n };\n byTopic.set(topicLabel, topicScores);\n }\n let p1w = 0;\n let p2w = 0;\n let p3w = 0;\n let p3bw = 0;\n let p4w = 0;\n // P1: time in Mesh\n if (tstats.inMesh) {\n const p1 = Math.max(tstats.meshTime / topicParams.timeInMeshQuantum, topicParams.timeInMeshCap);\n p1w += p1 * topicParams.timeInMeshWeight;\n }\n // P2: first message deliveries\n let p2 = tstats.firstMessageDeliveries;\n if (p2 > topicParams.firstMessageDeliveriesCap) {\n p2 = topicParams.firstMessageDeliveriesCap;\n }\n p2w += p2 * topicParams.firstMessageDeliveriesWeight;\n // P3: mesh message deliveries\n if (tstats.meshMessageDeliveriesActive &&\n tstats.meshMessageDeliveries < topicParams.meshMessageDeliveriesThreshold) {\n const deficit = topicParams.meshMessageDeliveriesThreshold - tstats.meshMessageDeliveries;\n const p3 = deficit * deficit;\n p3w += p3 * topicParams.meshMessageDeliveriesWeight;\n }\n // P3b:\n // NOTE: the weight of P3b is negative (validated in validateTopicScoreParams) so this detracts\n const p3b = tstats.meshFailurePenalty;\n p3bw += p3b * topicParams.meshFailurePenaltyWeight;\n // P4: invalid messages\n // NOTE: the weight of P4 is negative (validated in validateTopicScoreParams) so this detracts\n const p4 = tstats.invalidMessageDeliveries * tstats.invalidMessageDeliveries;\n p4w += p4 * topicParams.invalidMessageDeliveriesWeight;\n // update score, mixing with topic weight\n score += (p1w + p2w + p3w + p3bw + p4w) * topicParams.topicWeight;\n topicScores.p1w += p1w;\n topicScores.p2w += p2w;\n topicScores.p3w += p3w;\n topicScores.p3bw += p3bw;\n topicScores.p4w += p4w;\n });\n // apply the topic score cap, if any\n if (params.topicScoreCap > 0 && score > params.topicScoreCap) {\n score = params.topicScoreCap;\n // Proportionally apply cap to all individual contributions\n const capF = params.topicScoreCap / score;\n for (const ws of byTopic.values()) {\n ws.p1w *= capF;\n ws.p2w *= capF;\n ws.p3w *= capF;\n ws.p3bw *= capF;\n ws.p4w *= capF;\n }\n }\n let p5w = 0;\n let p6w = 0;\n let p7w = 0;\n // P5: application-specific score\n const p5 = params.appSpecificScore(peer);\n p5w += p5 * params.appSpecificWeight;\n // P6: IP colocation factor\n pstats.knownIPs.forEach((ip) => {\n if (params.IPColocationFactorWhitelist.has(ip)) {\n return;\n }\n // P6 has a cliff (IPColocationFactorThreshold)\n // It's only applied if at least that many peers are connected to us from that source IP addr.\n // It is quadratic, and the weight is negative (validated in validatePeerScoreParams)\n const peersInIP = peerIPs.get(ip);\n const numPeersInIP = (peersInIP != null) ? peersInIP.size : 0;\n if (numPeersInIP > params.IPColocationFactorThreshold) {\n const surplus = numPeersInIP - params.IPColocationFactorThreshold;\n const p6 = surplus * surplus;\n p6w += p6 * params.IPColocationFactorWeight;\n }\n });\n // P7: behavioural pattern penalty\n const p7 = pstats.behaviourPenalty * pstats.behaviourPenalty;\n p7w += p7 * params.behaviourPenaltyWeight;\n score += p5w + p6w + p7w;\n return {\n byTopic,\n p5w,\n p6w,\n p7w,\n score\n };\n}\nfunction computeAllPeersScoreWeights(peerIdStrs, peerStats, params, peerIPs, topicStrToLabel) {\n const sw = {\n byTopic: new Map(),\n p5w: [],\n p6w: [],\n p7w: [],\n score: []\n };\n for (const peerIdStr of peerIdStrs) {\n const pstats = peerStats.get(peerIdStr);\n if (pstats != null) {\n const swPeer = computeScoreWeights(peerIdStr, pstats, params, peerIPs, topicStrToLabel);\n for (const [topic, swPeerTopic] of swPeer.byTopic) {\n let swTopic = sw.byTopic.get(topic);\n if (swTopic == null) {\n swTopic = {\n p1w: [],\n p2w: [],\n p3w: [],\n p3bw: [],\n p4w: []\n };\n sw.byTopic.set(topic, swTopic);\n }\n swTopic.p1w.push(swPeerTopic.p1w);\n swTopic.p2w.push(swPeerTopic.p2w);\n swTopic.p3w.push(swPeerTopic.p3w);\n swTopic.p3bw.push(swPeerTopic.p3bw);\n swTopic.p4w.push(swPeerTopic.p4w);\n }\n sw.p5w.push(swPeer.p5w);\n sw.p6w.push(swPeer.p6w);\n sw.p7w.push(swPeer.p7w);\n sw.score.push(swPeer.score);\n }\n else {\n sw.p5w.push(0);\n sw.p6w.push(0);\n sw.p7w.push(0);\n sw.score.push(0);\n }\n }\n return sw;\n}\n//# sourceMappingURL=scoreMetrics.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/scoreMetrics.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/stream.js":
|
||
/*!*********************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/stream.js ***!
|
||
\*********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InboundStream: () => (/* binding */ InboundStream),\n/* harmony export */ OutboundStream: () => (/* binding */ OutboundStream)\n/* harmony export */ });\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n\n\n\nclass OutboundStream {\n rawStream;\n pushable;\n closeController;\n maxBufferSize;\n constructor(rawStream, errCallback, opts) {\n this.rawStream = rawStream;\n this.pushable = (0,it_pushable__WEBPACK_IMPORTED_MODULE_2__.pushable)();\n this.closeController = new AbortController();\n this.maxBufferSize = opts.maxBufferSize ?? Infinity;\n this.closeController.signal.addEventListener('abort', () => {\n rawStream.close()\n .catch(err => {\n rawStream.abort(err);\n });\n });\n (0,it_pipe__WEBPACK_IMPORTED_MODULE_1__.pipe)(this.pushable, this.rawStream).catch(errCallback);\n }\n get protocol() {\n // TODO remove this non-nullish assertion after https://github.com/libp2p/js-libp2p-interfaces/pull/265 is incorporated\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.rawStream.protocol;\n }\n push(data) {\n if (this.pushable.readableLength > this.maxBufferSize) {\n throw Error(`OutboundStream buffer full, size > ${this.maxBufferSize}`);\n }\n this.pushable.push(it_length_prefixed__WEBPACK_IMPORTED_MODULE_0__.encode.single(data));\n }\n /**\n * Same to push() but this is prefixed data so no need to encode length prefixed again\n */\n pushPrefixed(data) {\n if (this.pushable.readableLength > this.maxBufferSize) {\n throw Error(`OutboundStream buffer full, size > ${this.maxBufferSize}`);\n }\n this.pushable.push(data);\n }\n async close() {\n this.closeController.abort();\n // similar to pushable.end() but clear the internal buffer\n await this.pushable.return();\n }\n}\nclass InboundStream {\n source;\n rawStream;\n closeController;\n constructor(rawStream, opts = {}) {\n this.rawStream = rawStream;\n this.closeController = new AbortController();\n this.closeController.signal.addEventListener('abort', () => {\n rawStream.close()\n .catch(err => {\n rawStream.abort(err);\n });\n });\n this.source = (0,it_pipe__WEBPACK_IMPORTED_MODULE_1__.pipe)(this.rawStream, (source) => (0,it_length_prefixed__WEBPACK_IMPORTED_MODULE_0__.decode)(source, opts));\n }\n async close() {\n this.closeController.abort();\n }\n}\n//# sourceMappingURL=stream.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/stream.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/tracer.js":
|
||
/*!*********************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/tracer.js ***!
|
||
\*********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IWantTracer: () => (/* binding */ IWantTracer)\n/* harmony export */ });\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n\n/**\n * IWantTracer is an internal tracer that tracks IWANT requests in order to penalize\n * peers who don't follow up on IWANT requests after an IHAVE advertisement.\n * The tracking of promises is probabilistic to avoid using too much memory.\n *\n * Note: Do not confuse these 'promises' with JS Promise objects.\n * These 'promises' are merely expectations of a peer's behavior.\n */\nclass IWantTracer {\n gossipsubIWantFollowupMs;\n msgIdToStrFn;\n metrics;\n /**\n * Promises to deliver a message\n * Map per message id, per peer, promise expiration time\n */\n promises = new Map();\n /**\n * First request time by msgId. Used for metrics to track expire times.\n * Necessary to know if peers are actually breaking promises or simply sending them a bit later\n */\n requestMsByMsg = new Map();\n requestMsByMsgExpire;\n constructor(gossipsubIWantFollowupMs, msgIdToStrFn, metrics) {\n this.gossipsubIWantFollowupMs = gossipsubIWantFollowupMs;\n this.msgIdToStrFn = msgIdToStrFn;\n this.metrics = metrics;\n this.requestMsByMsgExpire = 10 * gossipsubIWantFollowupMs;\n }\n get size() {\n return this.promises.size;\n }\n get requestMsByMsgSize() {\n return this.requestMsByMsg.size;\n }\n /**\n * Track a promise to deliver a message from a list of msgIds we are requesting\n */\n addPromise(from, msgIds) {\n // pick msgId randomly from the list\n const ix = Math.floor(Math.random() * msgIds.length);\n const msgId = msgIds[ix];\n const msgIdStr = this.msgIdToStrFn(msgId);\n let expireByPeer = this.promises.get(msgIdStr);\n if (expireByPeer == null) {\n expireByPeer = new Map();\n this.promises.set(msgIdStr, expireByPeer);\n }\n const now = Date.now();\n // If a promise for this message id and peer already exists we don't update the expiry\n if (!expireByPeer.has(from)) {\n expireByPeer.set(from, now + this.gossipsubIWantFollowupMs);\n if (this.metrics != null) {\n this.metrics.iwantPromiseStarted.inc(1);\n if (!this.requestMsByMsg.has(msgIdStr)) {\n this.requestMsByMsg.set(msgIdStr, now);\n }\n }\n }\n }\n /**\n * Returns the number of broken promises for each peer who didn't follow up on an IWANT request.\n *\n * This should be called not too often relative to the expire times, since it iterates over the whole data.\n */\n getBrokenPromises() {\n const now = Date.now();\n const result = new Map();\n let brokenPromises = 0;\n this.promises.forEach((expireByPeer, msgId) => {\n expireByPeer.forEach((expire, p) => {\n // the promise has been broken\n if (expire < now) {\n // add 1 to result\n result.set(p, (result.get(p) ?? 0) + 1);\n // delete from tracked promises\n expireByPeer.delete(p);\n // for metrics\n brokenPromises++;\n }\n });\n // clean up empty promises for a msgId\n if (expireByPeer.size === 0) {\n this.promises.delete(msgId);\n }\n });\n this.metrics?.iwantPromiseBroken.inc(brokenPromises);\n return result;\n }\n /**\n * Someone delivered a message, stop tracking promises for it\n */\n deliverMessage(msgIdStr, isDuplicate = false) {\n this.trackMessage(msgIdStr);\n const expireByPeer = this.promises.get(msgIdStr);\n // Expired promise, check requestMsByMsg\n if (expireByPeer != null) {\n this.promises.delete(msgIdStr);\n if (this.metrics != null) {\n this.metrics.iwantPromiseResolved.inc(1);\n if (isDuplicate)\n this.metrics.iwantPromiseResolvedFromDuplicate.inc(1);\n this.metrics.iwantPromiseResolvedPeers.inc(expireByPeer.size);\n }\n }\n }\n /**\n * A message got rejected, so we can stop tracking promises and let the score penalty apply from invalid message delivery,\n * unless its an obviously invalid message.\n */\n rejectMessage(msgIdStr, reason) {\n this.trackMessage(msgIdStr);\n // A message got rejected, so we can stop tracking promises and let the score penalty apply.\n // With the expection of obvious invalid messages\n switch (reason) {\n case _types_js__WEBPACK_IMPORTED_MODULE_0__.RejectReason.Error:\n return;\n default:\n break;\n }\n this.promises.delete(msgIdStr);\n }\n clear() {\n this.promises.clear();\n }\n prune() {\n const maxMs = Date.now() - this.requestMsByMsgExpire;\n let count = 0;\n for (const [k, v] of this.requestMsByMsg.entries()) {\n if (v < maxMs) {\n // messages that stay too long in the requestMsByMsg map, delete\n this.requestMsByMsg.delete(k);\n count++;\n }\n else {\n // recent messages, keep them\n // sort by insertion order\n break;\n }\n }\n this.metrics?.iwantMessagePruned.inc(count);\n }\n trackMessage(msgIdStr) {\n if (this.metrics != null) {\n const requestMs = this.requestMsByMsg.get(msgIdStr);\n if (requestMs !== undefined) {\n this.metrics.iwantPromiseDeliveryTime.observe((Date.now() - requestMs) / 1000);\n this.requestMsByMsg.delete(msgIdStr);\n }\n }\n }\n}\n//# sourceMappingURL=tracer.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/tracer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MessageStatus: () => (/* binding */ MessageStatus),\n/* harmony export */ PublishConfigType: () => (/* binding */ PublishConfigType),\n/* harmony export */ RejectReason: () => (/* binding */ RejectReason),\n/* harmony export */ SignaturePolicy: () => (/* binding */ SignaturePolicy),\n/* harmony export */ ValidateError: () => (/* binding */ ValidateError),\n/* harmony export */ rejectReasonFromAcceptance: () => (/* binding */ rejectReasonFromAcceptance)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/pubsub/index.js\");\n\nvar SignaturePolicy;\n(function (SignaturePolicy) {\n /**\n * On the producing side:\n * - Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields.\n *\n * On the consuming side:\n * - Enforce the fields to be present, reject otherwise.\n * - Propagate only if the fields are valid and signature can be verified, reject otherwise.\n */\n SignaturePolicy[\"StrictSign\"] = \"StrictSign\";\n /**\n * On the producing side:\n * - Build messages without the signature, key, from and seqno fields.\n * - The corresponding protobuf key-value pairs are absent from the marshalled message, not just empty.\n *\n * On the consuming side:\n * - Enforce the fields to be absent, reject otherwise.\n * - Propagate only if the fields are absent, reject otherwise.\n * - A message_id function will not be able to use the above fields, and should instead rely on the data field. A commonplace strategy is to calculate a hash.\n */\n SignaturePolicy[\"StrictNoSign\"] = \"StrictNoSign\";\n})(SignaturePolicy || (SignaturePolicy = {}));\nvar PublishConfigType;\n(function (PublishConfigType) {\n PublishConfigType[PublishConfigType[\"Signing\"] = 0] = \"Signing\";\n PublishConfigType[PublishConfigType[\"Anonymous\"] = 1] = \"Anonymous\";\n})(PublishConfigType || (PublishConfigType = {}));\nvar RejectReason;\n(function (RejectReason) {\n /**\n * The message failed the configured validation during decoding.\n * SelfOrigin is considered a ValidationError\n */\n RejectReason[\"Error\"] = \"error\";\n /**\n * Custom validator fn reported status IGNORE.\n */\n RejectReason[\"Ignore\"] = \"ignore\";\n /**\n * Custom validator fn reported status REJECT.\n */\n RejectReason[\"Reject\"] = \"reject\";\n /**\n * The peer that sent the message OR the source from field is blacklisted.\n * Causes messages to be ignored, not penalized, neither do score record creation.\n */\n RejectReason[\"Blacklisted\"] = \"blacklisted\";\n})(RejectReason || (RejectReason = {}));\nvar ValidateError;\n(function (ValidateError) {\n /// The message has an invalid signature,\n ValidateError[\"InvalidSignature\"] = \"invalid_signature\";\n /// The sequence number was the incorrect size\n ValidateError[\"InvalidSeqno\"] = \"invalid_seqno\";\n /// The PeerId was invalid\n ValidateError[\"InvalidPeerId\"] = \"invalid_peerid\";\n /// Signature existed when validation has been sent to\n /// [`crate::behaviour::MessageAuthenticity::Anonymous`].\n ValidateError[\"SignaturePresent\"] = \"signature_present\";\n /// Sequence number existed when validation has been sent to\n /// [`crate::behaviour::MessageAuthenticity::Anonymous`].\n ValidateError[\"SeqnoPresent\"] = \"seqno_present\";\n /// Message source existed when validation has been sent to\n /// [`crate::behaviour::MessageAuthenticity::Anonymous`].\n ValidateError[\"FromPresent\"] = \"from_present\";\n /// The data transformation failed.\n ValidateError[\"TransformFailed\"] = \"transform_failed\";\n})(ValidateError || (ValidateError = {}));\nvar MessageStatus;\n(function (MessageStatus) {\n MessageStatus[\"duplicate\"] = \"duplicate\";\n MessageStatus[\"invalid\"] = \"invalid\";\n MessageStatus[\"valid\"] = \"valid\";\n})(MessageStatus || (MessageStatus = {}));\n/**\n * Typesafe conversion of MessageAcceptance -> RejectReason. TS ensures all values covered\n */\nfunction rejectReasonFromAcceptance(acceptance) {\n switch (acceptance) {\n case _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.TopicValidatorResult.Ignore:\n return RejectReason.Ignore;\n case _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.TopicValidatorResult.Reject:\n return RejectReason.Reject;\n default:\n throw new Error('Unreachable');\n }\n}\n//# sourceMappingURL=types.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/buildRawMessage.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/buildRawMessage.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SignPrefix: () => (/* binding */ SignPrefix),\n/* harmony export */ buildRawMessage: () => (/* binding */ buildRawMessage),\n/* harmony export */ validateToRawMessage: () => (/* binding */ validateToRawMessage)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/crypto */ \"./node_modules/@libp2p/crypto/dist/src/random-bytes.js\");\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/pubsub/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _message_rpc_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../message/rpc.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n\n\n\n\n\n\n\n\n\n\nconst SignPrefix = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)('libp2p-pubsub:');\nasync function buildRawMessage(publishConfig, topic, originalData, transformedData) {\n switch (publishConfig.type) {\n case _types_js__WEBPACK_IMPORTED_MODULE_4__.PublishConfigType.Signing: {\n const rpcMsg = {\n from: publishConfig.author.toBytes(),\n data: transformedData,\n seqno: (0,_libp2p_crypto__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(8),\n topic,\n signature: undefined, // Exclude signature field for signing\n key: undefined // Exclude key field for signing\n };\n // Get the message in bytes, and prepend with the pubsub prefix\n // the signature is over the bytes \"libp2p-pubsub:<protobuf-message>\"\n const bytes = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([SignPrefix, _message_rpc_js__WEBPACK_IMPORTED_MODULE_6__.RPC.Message.encode(rpcMsg)]);\n rpcMsg.signature = await publishConfig.privateKey.sign(bytes);\n rpcMsg.key = publishConfig.key;\n const msg = {\n type: 'signed',\n from: publishConfig.author,\n data: originalData,\n sequenceNumber: BigInt(`0x${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(rpcMsg.seqno, 'base16')}`),\n topic,\n signature: rpcMsg.signature,\n key: rpcMsg.key\n };\n return {\n raw: rpcMsg,\n msg\n };\n }\n case _types_js__WEBPACK_IMPORTED_MODULE_4__.PublishConfigType.Anonymous: {\n return {\n raw: {\n from: undefined,\n data: transformedData,\n seqno: undefined,\n topic,\n signature: undefined,\n key: undefined\n },\n msg: {\n type: 'unsigned',\n data: originalData,\n topic\n }\n };\n }\n default:\n throw new Error('Unreachable');\n }\n}\nasync function validateToRawMessage(signaturePolicy, msg) {\n // If strict-sign, verify all\n // If anonymous (no-sign), ensure no preven\n switch (signaturePolicy) {\n case _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__.StrictNoSign:\n if (msg.signature != null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_4__.ValidateError.SignaturePresent };\n if (msg.seqno != null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_4__.ValidateError.SeqnoPresent };\n if (msg.key != null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_4__.ValidateError.FromPresent };\n return { valid: true, message: { type: 'unsigned', topic: msg.topic, data: msg.data ?? new Uint8Array(0) } };\n case _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__.StrictSign: {\n // Verify seqno\n if (msg.seqno == null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_4__.ValidateError.InvalidSeqno };\n if (msg.seqno.length !== 8) {\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_4__.ValidateError.InvalidSeqno };\n }\n if (msg.signature == null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_4__.ValidateError.InvalidSignature };\n if (msg.from == null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_4__.ValidateError.InvalidPeerId };\n let fromPeerId;\n try {\n // TODO: Fix PeerId types\n fromPeerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_8__.peerIdFromBytes)(msg.from);\n }\n catch (e) {\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_4__.ValidateError.InvalidPeerId };\n }\n // - check from defined\n // - transform source to PeerId\n // - parse signature\n // - get .key, else from source\n // - check key == source if present\n // - verify sig\n let publicKey;\n if (msg.key != null) {\n publicKey = (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_9__.unmarshalPublicKey)(msg.key);\n // TODO: Should `fromPeerId.pubKey` be optional?\n if (fromPeerId.publicKey !== undefined && !(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(publicKey.bytes, fromPeerId.publicKey)) {\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_4__.ValidateError.InvalidPeerId };\n }\n }\n else {\n if (fromPeerId.publicKey == null) {\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_4__.ValidateError.InvalidPeerId };\n }\n publicKey = (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_9__.unmarshalPublicKey)(fromPeerId.publicKey);\n }\n const rpcMsgPreSign = {\n from: msg.from,\n data: msg.data,\n seqno: msg.seqno,\n topic: msg.topic,\n signature: undefined, // Exclude signature field for signing\n key: undefined // Exclude key field for signing\n };\n // Get the message in bytes, and prepend with the pubsub prefix\n // the signature is over the bytes \"libp2p-pubsub:<protobuf-message>\"\n const bytes = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([SignPrefix, _message_rpc_js__WEBPACK_IMPORTED_MODULE_6__.RPC.Message.encode(rpcMsgPreSign)]);\n if (!(await publicKey.verify(bytes, msg.signature))) {\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_4__.ValidateError.InvalidSignature };\n }\n return {\n valid: true,\n message: {\n type: 'signed',\n from: fromPeerId,\n data: msg.data ?? new Uint8Array(0),\n sequenceNumber: BigInt(`0x${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(msg.seqno, 'base16')}`),\n topic: msg.topic,\n signature: msg.signature,\n key: msg.key ?? (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_9__.marshalPublicKey)(publicKey)\n }\n };\n }\n default:\n throw new Error('Unreachable');\n }\n}\n//# sourceMappingURL=buildRawMessage.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/buildRawMessage.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/create-gossip-rpc.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/create-gossip-rpc.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createGossipRpc: () => (/* binding */ createGossipRpc),\n/* harmony export */ ensureControl: () => (/* binding */ ensureControl)\n/* harmony export */ });\n/**\n * Create a gossipsub RPC object\n */\nfunction createGossipRpc(messages = [], control) {\n return {\n subscriptions: [],\n messages,\n control: control !== undefined\n ? {\n graft: control.graft ?? [],\n prune: control.prune ?? [],\n ihave: control.ihave ?? [],\n iwant: control.iwant ?? []\n }\n : undefined\n };\n}\nfunction ensureControl(rpc) {\n if (rpc.control === undefined) {\n rpc.control = {\n graft: [],\n prune: [],\n ihave: [],\n iwant: []\n };\n }\n return rpc;\n}\n//# sourceMappingURL=create-gossip-rpc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/create-gossip-rpc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/messageIdToString.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/messageIdToString.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ messageIdToString: () => (/* binding */ messageIdToString)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/to-string.js\");\n\n/**\n * Browser friendly function to convert Uint8Array message id to base64 string.\n */\nfunction messageIdToString(msgId) {\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(msgId, 'base64');\n}\n//# sourceMappingURL=messageIdToString.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/messageIdToString.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/msgIdFn.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/msgIdFn.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ msgIdFnStrictNoSign: () => (/* binding */ msgIdFnStrictNoSign),\n/* harmony export */ msgIdFnStrictSign: () => (/* binding */ msgIdFnStrictSign)\n/* harmony export */ });\n/* harmony import */ var _libp2p_pubsub_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/pubsub/utils */ \"./node_modules/@libp2p/pubsub/dist/src/utils.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n\n\n/**\n * Generate a message id, based on the `key` and `seqno`\n */\nfunction msgIdFnStrictSign(msg) {\n if (msg.type !== 'signed') {\n throw new Error('expected signed message type');\n }\n // Should never happen\n if (msg.sequenceNumber == null)\n throw Error('missing seqno field');\n // TODO: Should use .from here or key?\n return (0,_libp2p_pubsub_utils__WEBPACK_IMPORTED_MODULE_1__.msgId)(msg.from.toBytes(), msg.sequenceNumber);\n}\n/**\n * Generate a message id, based on message `data`\n */\nasync function msgIdFnStrictNoSign(msg) {\n return multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.encode(msg.data);\n}\n//# sourceMappingURL=msgIdFn.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/msgIdFn.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/multiaddr.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/multiaddr.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ multiaddrToIPStr: () => (/* binding */ multiaddrToIPStr)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr/convert */ \"./node_modules/@multiformats/multiaddr/dist/src/convert.js\");\n\n// Protocols https://github.com/multiformats/multiaddr/blob/master/protocols.csv\n// code size name\n// 4 32 ip4\n// 41 128 ip6\nvar Protocol;\n(function (Protocol) {\n Protocol[Protocol[\"ip4\"] = 4] = \"ip4\";\n Protocol[Protocol[\"ip6\"] = 41] = \"ip6\";\n})(Protocol || (Protocol = {}));\nfunction multiaddrToIPStr(multiaddr) {\n for (const tuple of multiaddr.tuples()) {\n switch (tuple[0]) {\n case Protocol.ip4:\n case Protocol.ip6:\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return (0,_multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__.convertToString)(tuple[0], tuple[1]);\n default:\n break;\n }\n }\n return null;\n}\n//# sourceMappingURL=multiaddr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/multiaddr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/publishConfig.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/publishConfig.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getPublishConfigFromPeerId: () => (/* binding */ getPublishConfigFromPeerId)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/pubsub/index.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n\n\n\n/**\n * Prepare a PublishConfig object from a PeerId.\n */\nasync function getPublishConfigFromPeerId(signaturePolicy, peerId) {\n switch (signaturePolicy) {\n case _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.StrictSign: {\n if (peerId == null) {\n throw Error('Must provide PeerId');\n }\n if (peerId.privateKey == null) {\n throw Error('Cannot sign message, no private key present');\n }\n if (peerId.publicKey == null) {\n throw Error('Cannot sign message, no public key present');\n }\n // Transform privateKey once at initialization time instead of once per message\n const privateKey = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.unmarshalPrivateKey)(peerId.privateKey);\n return {\n type: _types_js__WEBPACK_IMPORTED_MODULE_2__.PublishConfigType.Signing,\n author: peerId,\n key: peerId.publicKey,\n privateKey\n };\n }\n case _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.StrictNoSign:\n return {\n type: _types_js__WEBPACK_IMPORTED_MODULE_2__.PublishConfigType.Anonymous\n };\n default:\n throw new Error(`Unknown signature policy \"${signaturePolicy}\"`);\n }\n}\n//# sourceMappingURL=publishConfig.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/publishConfig.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/set.js":
|
||
/*!************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/set.js ***!
|
||
\************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MapDef: () => (/* binding */ MapDef),\n/* harmony export */ removeFirstNItemsFromSet: () => (/* binding */ removeFirstNItemsFromSet),\n/* harmony export */ removeItemsFromSet: () => (/* binding */ removeItemsFromSet)\n/* harmony export */ });\n/**\n * Exclude up to `ineed` items from a set if item meets condition `cond`\n */\nfunction removeItemsFromSet(superSet, ineed, cond = () => true) {\n const subset = new Set();\n if (ineed <= 0)\n return subset;\n for (const id of superSet) {\n if (subset.size >= ineed)\n break;\n if (cond(id)) {\n subset.add(id);\n superSet.delete(id);\n }\n }\n return subset;\n}\n/**\n * Exclude up to `ineed` items from a set\n */\nfunction removeFirstNItemsFromSet(superSet, ineed) {\n return removeItemsFromSet(superSet, ineed, () => true);\n}\nclass MapDef extends Map {\n getDefault;\n constructor(getDefault) {\n super();\n this.getDefault = getDefault;\n }\n getOrDefault(key) {\n let value = super.get(key);\n if (value === undefined) {\n value = this.getDefault();\n this.set(key, value);\n }\n return value;\n }\n}\n//# sourceMappingURL=set.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/set.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/shuffle.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/shuffle.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ shuffle: () => (/* binding */ shuffle)\n/* harmony export */ });\n/**\n * Pseudo-randomly shuffles an array\n *\n * Mutates the input array\n */\nfunction shuffle(arr) {\n if (arr.length <= 1) {\n return arr;\n }\n const randInt = () => {\n return Math.floor(Math.random() * Math.floor(arr.length));\n };\n for (let i = 0; i < arr.length; i++) {\n const j = randInt();\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n return arr;\n}\n//# sourceMappingURL=shuffle.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/shuffle.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/time-cache.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/time-cache.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SimpleTimeCache: () => (/* binding */ SimpleTimeCache)\n/* harmony export */ });\n/**\n * This is similar to https://github.com/daviddias/time-cache/blob/master/src/index.js\n * for our own need, we don't use lodash throttle to improve performance.\n * This gives 4x - 5x performance gain compared to npm TimeCache\n */\nclass SimpleTimeCache {\n entries = new Map();\n validityMs;\n constructor(opts) {\n this.validityMs = opts.validityMs;\n // allow negative validityMs so that this does not cache anything, spec test compliance.spec.js\n // sends duplicate messages and expect peer to receive all. Application likely uses positive validityMs\n }\n get size() {\n return this.entries.size;\n }\n /** Returns true if there was a key collision and the entry is dropped */\n put(key, value) {\n if (this.entries.has(key)) {\n // Key collisions break insertion order in the entries cache, which break prune logic.\n // prune relies on each iterated entry to have strictly ascending validUntilMs, else it\n // won't prune expired entries and SimpleTimeCache will grow unexpectedly.\n // As of Oct 2022 NodeJS v16, inserting the same key twice with different value does not\n // change the key position in the iterator stream. A unit test asserts this behaviour.\n return true;\n }\n this.entries.set(key, { value, validUntilMs: Date.now() + this.validityMs });\n return false;\n }\n prune() {\n const now = Date.now();\n for (const [k, v] of this.entries.entries()) {\n if (v.validUntilMs < now) {\n this.entries.delete(k);\n }\n else {\n // Entries are inserted with strictly ascending validUntilMs.\n // Stop early to save iterations\n break;\n }\n }\n }\n has(key) {\n return this.entries.has(key);\n }\n get(key) {\n const value = this.entries.get(key);\n return (value != null) && value.validUntilMs >= Date.now() ? value.value : undefined;\n }\n clear() {\n this.entries.clear();\n }\n}\n//# sourceMappingURL=time-cache.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/time-cache.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!*********************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\*********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/concat.js":
|
||
/*!**********************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/concat.js ***!
|
||
\**********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ concat: () => (/* binding */ concat)\n/* harmony export */ });\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #alloc */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #util/as-uint8array */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Uint8Arrays\n */\nfunction concat(arrays, length) {\n if (length == null) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n const output = (0,_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(length);\n let offset = 0;\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n return (0,_util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(output);\n}\n//# sourceMappingURL=concat.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/concat.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/equals.js":
|
||
/*!**********************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/equals.js ***!
|
||
\**********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!***************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\***************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!*************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\*************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/util/as-uint8array.js":
|
||
/*!**********************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/util/as-uint8array.js ***!
|
||
\**********************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asUint8Array: () => (/* binding */ asUint8Array)\n/* harmony export */ });\n/**\n * To guarantee Uint8Array semantics, convert nodejs Buffers\n * into vanilla Uint8Arrays\n */\nfunction asUint8Array(buf) {\n return buf;\n}\n//# sourceMappingURL=as-uint8array.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/util/as-uint8array.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!**************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\**************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DUMP_SESSION_KEYS: () => (/* binding */ DUMP_SESSION_KEYS),\n/* harmony export */ NOISE_MSG_MAX_LENGTH_BYTES: () => (/* binding */ NOISE_MSG_MAX_LENGTH_BYTES),\n/* harmony export */ NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG: () => (/* binding */ NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG)\n/* harmony export */ });\nconst NOISE_MSG_MAX_LENGTH_BYTES = 65535;\nconst NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG = NOISE_MSG_MAX_LENGTH_BYTES - 16;\nconst DUMP_SESSION_KEYS = Boolean(globalThis.process?.env?.DUMP_SESSION_KEYS);\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/index.browser.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/index.browser.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ defaultCrypto: () => (/* binding */ defaultCrypto)\n/* harmony export */ });\n/* harmony import */ var _js_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./js.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/js.js\");\n\nconst defaultCrypto = _js_js__WEBPACK_IMPORTED_MODULE_0__.pureJsCrypto;\n//# sourceMappingURL=index.browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/index.browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/js.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/js.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pureJsCrypto: () => (/* binding */ pureJsCrypto)\n/* harmony export */ });\n/* harmony import */ var _noble_ciphers_chacha__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/ciphers/chacha */ \"./node_modules/@noble/ciphers/esm/chacha.js\");\n/* harmony import */ var _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @noble/curves/ed25519 */ \"./node_modules/@noble/curves/esm/ed25519.js\");\n/* harmony import */ var _noble_hashes_hkdf__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @noble/hashes/hkdf */ \"./node_modules/@noble/hashes/esm/hkdf.js\");\n/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/@noble/hashes/esm/sha256.js\");\n\n\n\n\nconst pureJsCrypto = {\n hashSHA256(data) {\n return (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_1__.sha256)(data.subarray());\n },\n getHKDF(ck, ikm) {\n const prk = (0,_noble_hashes_hkdf__WEBPACK_IMPORTED_MODULE_2__.extract)(_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_1__.sha256, ikm, ck);\n const okmU8Array = (0,_noble_hashes_hkdf__WEBPACK_IMPORTED_MODULE_2__.expand)(_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_1__.sha256, prk, undefined, 96);\n const okm = okmU8Array;\n const k1 = okm.subarray(0, 32);\n const k2 = okm.subarray(32, 64);\n const k3 = okm.subarray(64, 96);\n return [k1, k2, k3];\n },\n generateX25519KeyPair() {\n const secretKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_3__.x25519.utils.randomPrivateKey();\n const publicKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_3__.x25519.getPublicKey(secretKey);\n return {\n publicKey,\n privateKey: secretKey\n };\n },\n generateX25519KeyPairFromSeed(seed) {\n const publicKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_3__.x25519.getPublicKey(seed);\n return {\n publicKey,\n privateKey: seed\n };\n },\n generateX25519SharedKey(privateKey, publicKey) {\n return _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_3__.x25519.getSharedSecret(privateKey.subarray(), publicKey.subarray());\n },\n chaCha20Poly1305Encrypt(plaintext, nonce, ad, k) {\n return (0,_noble_ciphers_chacha__WEBPACK_IMPORTED_MODULE_0__.chacha20poly1305)(k, nonce, ad).encrypt(plaintext.subarray());\n },\n chaCha20Poly1305Decrypt(ciphertext, nonce, ad, k, dst) {\n return (0,_noble_ciphers_chacha__WEBPACK_IMPORTED_MODULE_0__.chacha20poly1305)(k, nonce, ad).decrypt(ciphertext.subarray(), dst);\n }\n};\n//# sourceMappingURL=js.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/js.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/streaming.js":
|
||
/*!***************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/streaming.js ***!
|
||
\***************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decryptStream: () => (/* binding */ decryptStream),\n/* harmony export */ encryptStream: () => (/* binding */ encryptStream)\n/* harmony export */ });\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js\");\n/* harmony import */ var _encoder_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoder.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js\");\n\n\n\nconst CHACHA_TAG_LENGTH = 16;\n// Returns generator that encrypts payload from the user\nfunction encryptStream(handshake, metrics) {\n return async function* (source) {\n for await (const chunk of source) {\n for (let i = 0; i < chunk.length; i += _constants_js__WEBPACK_IMPORTED_MODULE_1__.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG) {\n let end = i + _constants_js__WEBPACK_IMPORTED_MODULE_1__.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG;\n if (end > chunk.length) {\n end = chunk.length;\n }\n let data;\n if (chunk instanceof Uint8Array) {\n data = handshake.encrypt(chunk.subarray(i, end), handshake.session);\n }\n else {\n data = handshake.encrypt(chunk.sublist(i, end), handshake.session);\n }\n metrics?.encryptedPackets.increment();\n yield new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList((0,_encoder_js__WEBPACK_IMPORTED_MODULE_2__.uint16BEEncode)(data.byteLength), data);\n }\n }\n };\n}\n// Decrypt received payload to the user\nfunction decryptStream(handshake, metrics) {\n return async function* (source) {\n for await (const chunk of source) {\n for (let i = 0; i < chunk.length; i += _constants_js__WEBPACK_IMPORTED_MODULE_1__.NOISE_MSG_MAX_LENGTH_BYTES) {\n let end = i + _constants_js__WEBPACK_IMPORTED_MODULE_1__.NOISE_MSG_MAX_LENGTH_BYTES;\n if (end > chunk.length) {\n end = chunk.length;\n }\n if (end - CHACHA_TAG_LENGTH < i) {\n throw new Error('Invalid chunk');\n }\n const encrypted = chunk.sublist(i, end);\n // memory allocation is not cheap so reuse the encrypted Uint8Array\n // see https://github.com/ChainSafe/js-libp2p-noise/pull/242#issue-1422126164\n // this is ok because chacha20 reads bytes one by one and don't reread after that\n // it's also tested in https://github.com/ChainSafe/as-chacha20poly1305/pull/1/files#diff-25252846b58979dcaf4e41d47b3eadd7e4f335e7fb98da6c049b1f9cd011f381R48\n const dst = chunk.subarray(i, end - CHACHA_TAG_LENGTH);\n const { plaintext: decrypted, valid } = handshake.decrypt(encrypted, handshake.session, dst);\n if (!valid) {\n metrics?.decryptErrors.increment();\n throw new Error('Failed to validate decrypted chunk');\n }\n metrics?.decryptedPackets.increment();\n yield decrypted;\n }\n }\n };\n}\n//# sourceMappingURL=streaming.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/streaming.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js":
|
||
/*!******************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js ***!
|
||
\******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode0: () => (/* binding */ decode0),\n/* harmony export */ decode1: () => (/* binding */ decode1),\n/* harmony export */ decode2: () => (/* binding */ decode2),\n/* harmony export */ encode0: () => (/* binding */ encode0),\n/* harmony export */ encode1: () => (/* binding */ encode1),\n/* harmony export */ encode2: () => (/* binding */ encode2),\n/* harmony export */ uint16BEDecode: () => (/* binding */ uint16BEDecode),\n/* harmony export */ uint16BEEncode: () => (/* binding */ uint16BEEncode)\n/* harmony export */ });\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nconst uint16BEEncode = (value) => {\n const target = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(2);\n new DataView(target.buffer, target.byteOffset, target.byteLength).setUint16(0, value, false);\n return target;\n};\nuint16BEEncode.bytes = 2;\nconst uint16BEDecode = (data) => {\n if (data.length < 2)\n throw RangeError('Could not decode int16BE');\n if (data instanceof Uint8Array) {\n return new DataView(data.buffer, data.byteOffset, data.byteLength).getUint16(0, false);\n }\n return data.getUint16(0);\n};\nuint16BEDecode.bytes = 2;\n// Note: IK and XX encoder usage is opposite (XX uses in stages encode0 where IK uses encode1)\nfunction encode0(message) {\n return new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList(message.ne, message.ciphertext);\n}\nfunction encode1(message) {\n return new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList(message.ne, message.ns, message.ciphertext);\n}\nfunction encode2(message) {\n return new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList(message.ns, message.ciphertext);\n}\nfunction decode0(input) {\n if (input.length < 32) {\n throw new Error('Cannot decode stage 0 MessageBuffer: length less than 32 bytes.');\n }\n return {\n ne: input.subarray(0, 32),\n ciphertext: input.subarray(32, input.length),\n ns: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n}\nfunction decode1(input) {\n if (input.length < 80) {\n throw new Error('Cannot decode stage 1 MessageBuffer: length less than 80 bytes.');\n }\n return {\n ne: input.subarray(0, 32),\n ns: input.subarray(32, 80),\n ciphertext: input.subarray(80, input.length)\n };\n}\nfunction decode2(input) {\n if (input.length < 48) {\n throw new Error('Cannot decode stage 2 MessageBuffer: length less than 48 bytes.');\n }\n return {\n ne: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n ns: input.subarray(0, 48),\n ciphertext: input.subarray(48, input.length)\n };\n}\n//# sourceMappingURL=encoder.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/errors.js":
|
||
/*!*****************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/errors.js ***!
|
||
\*****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InvalidCryptoExchangeError: () => (/* binding */ InvalidCryptoExchangeError),\n/* harmony export */ UnexpectedPeerError: () => (/* binding */ UnexpectedPeerError)\n/* harmony export */ });\nclass UnexpectedPeerError extends Error {\n code;\n constructor(message = 'Unexpected Peer') {\n super(message);\n this.code = UnexpectedPeerError.code;\n }\n static code = 'ERR_UNEXPECTED_PEER';\n}\nclass InvalidCryptoExchangeError extends Error {\n code;\n constructor(message = 'Invalid crypto exchange') {\n super(message);\n this.code = InvalidCryptoExchangeError.code;\n }\n static code = 'ERR_INVALID_CRYPTO_EXCHANGE';\n}\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/errors.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/handshake-xx.js":
|
||
/*!***********************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/handshake-xx.js ***!
|
||
\***********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ XXHandshake: () => (/* binding */ XXHandshake)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _encoder_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./encoder.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/errors.js\");\n/* harmony import */ var _handshakes_xx_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./handshakes/xx.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/xx.js\");\n/* harmony import */ var _logger_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./logger.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/logger.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js\");\n\n\n\n\n\n\nclass XXHandshake {\n isInitiator;\n session;\n remotePeer;\n remoteExtensions = { webtransportCerthashes: [] };\n payload;\n connection;\n xx;\n staticKeypair;\n prologue;\n log;\n constructor(components, isInitiator, payload, prologue, crypto, staticKeypair, connection, remotePeer, handshake) {\n this.log = components.logger.forComponent('libp2p:noise:xxhandshake');\n this.isInitiator = isInitiator;\n this.payload = payload;\n this.prologue = prologue;\n this.staticKeypair = staticKeypair;\n this.connection = connection;\n if (remotePeer) {\n this.remotePeer = remotePeer;\n }\n this.xx = handshake ?? new _handshakes_xx_js__WEBPACK_IMPORTED_MODULE_3__.XX(components, crypto);\n this.session = this.xx.initSession(this.isInitiator, this.prologue, this.staticKeypair);\n }\n // stage 0\n async propose() {\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_4__.logLocalStaticKeys)(this.session.hs.s, this.log);\n if (this.isInitiator) {\n this.log.trace('Stage 0 - Initiator starting to send first message.');\n const messageBuffer = this.xx.sendMessage(this.session, (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(0));\n await this.connection.write((0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.encode0)(messageBuffer));\n this.log.trace('Stage 0 - Initiator finished sending first message.');\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_4__.logLocalEphemeralKeys)(this.session.hs.e, this.log);\n }\n else {\n this.log.trace('Stage 0 - Responder waiting to receive first message...');\n const receivedMessageBuffer = (0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.decode0)((await this.connection.read()).subarray());\n const { valid } = this.xx.recvMessage(this.session, receivedMessageBuffer);\n if (!valid) {\n throw new _errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidCryptoExchangeError('xx handshake stage 0 validation fail');\n }\n this.log.trace('Stage 0 - Responder received first message.');\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_4__.logRemoteEphemeralKey)(this.session.hs.re, this.log);\n }\n }\n // stage 1\n async exchange() {\n if (this.isInitiator) {\n this.log.trace('Stage 1 - Initiator waiting to receive first message from responder...');\n const receivedMessageBuffer = (0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.decode1)((await this.connection.read()).subarray());\n const { plaintext, valid } = this.xx.recvMessage(this.session, receivedMessageBuffer);\n if (!valid) {\n throw new _errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidCryptoExchangeError('xx handshake stage 1 validation fail');\n }\n this.log.trace('Stage 1 - Initiator received the message.');\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_4__.logRemoteEphemeralKey)(this.session.hs.re, this.log);\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_4__.logRemoteStaticKey)(this.session.hs.rs, this.log);\n this.log.trace(\"Initiator going to check remote's signature...\");\n try {\n const decodedPayload = (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.decodePayload)(plaintext);\n this.remotePeer = this.remotePeer || await (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.getPeerIdFromPayload)(decodedPayload);\n await (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.verifySignedPayload)(this.session.hs.rs, decodedPayload, this.remotePeer);\n this.setRemoteNoiseExtension(decodedPayload.extensions);\n }\n catch (e) {\n const err = e;\n throw new _errors_js__WEBPACK_IMPORTED_MODULE_2__.UnexpectedPeerError(`Error occurred while verifying signed payload: ${err.message}`);\n }\n this.log.trace('All good with the signature!');\n }\n else {\n this.log.trace('Stage 1 - Responder sending out first message with signed payload and static key.');\n const messageBuffer = this.xx.sendMessage(this.session, this.payload);\n await this.connection.write((0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.encode1)(messageBuffer));\n this.log.trace('Stage 1 - Responder sent the second handshake message with signed payload.');\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_4__.logLocalEphemeralKeys)(this.session.hs.e, this.log);\n }\n }\n // stage 2\n async finish() {\n if (this.isInitiator) {\n this.log.trace('Stage 2 - Initiator sending third handshake message.');\n const messageBuffer = this.xx.sendMessage(this.session, this.payload);\n await this.connection.write((0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.encode2)(messageBuffer));\n this.log.trace('Stage 2 - Initiator sent message with signed payload.');\n }\n else {\n this.log.trace('Stage 2 - Responder waiting for third handshake message...');\n const receivedMessageBuffer = (0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.decode2)((await this.connection.read()).subarray());\n const { plaintext, valid } = this.xx.recvMessage(this.session, receivedMessageBuffer);\n if (!valid) {\n throw new _errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidCryptoExchangeError('xx handshake stage 2 validation fail');\n }\n this.log.trace('Stage 2 - Responder received the message, finished handshake.');\n try {\n const decodedPayload = (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.decodePayload)(plaintext);\n this.remotePeer = this.remotePeer || await (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.getPeerIdFromPayload)(decodedPayload);\n await (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.verifySignedPayload)(this.session.hs.rs, decodedPayload, this.remotePeer);\n this.setRemoteNoiseExtension(decodedPayload.extensions);\n }\n catch (e) {\n const err = e;\n throw new _errors_js__WEBPACK_IMPORTED_MODULE_2__.UnexpectedPeerError(`Error occurred while verifying signed payload: ${err.message}`);\n }\n }\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_4__.logCipherState)(this.session, this.log);\n }\n encrypt(plaintext, session) {\n const cs = this.getCS(session);\n return this.xx.encryptWithAd(cs, (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(0), plaintext);\n }\n decrypt(ciphertext, session, dst) {\n const cs = this.getCS(session, false);\n return this.xx.decryptWithAd(cs, (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(0), ciphertext, dst);\n }\n getRemoteStaticKey() {\n return this.session.hs.rs;\n }\n getCS(session, encryption = true) {\n if (!session.cs1 || !session.cs2) {\n throw new _errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidCryptoExchangeError('Handshake not completed properly, cipher state does not exist.');\n }\n if (this.isInitiator) {\n return encryption ? session.cs1 : session.cs2;\n }\n else {\n return encryption ? session.cs2 : session.cs1;\n }\n }\n setRemoteNoiseExtension(e) {\n if (e) {\n this.remoteExtensions = e;\n }\n }\n}\n//# sourceMappingURL=handshake-xx.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/handshake-xx.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/abstract-handshake.js":
|
||
/*!****************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/abstract-handshake.js ***!
|
||
\****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbstractHandshake: () => (/* binding */ AbstractHandshake)\n/* harmony export */ });\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _nonce_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../nonce.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/nonce.js\");\n\n\n\n\n\nclass AbstractHandshake {\n crypto;\n log;\n constructor(components, crypto) {\n this.log = components.logger.forComponent('libp2p:noise:abstract-handshake');\n this.crypto = crypto;\n }\n encryptWithAd(cs, ad, plaintext) {\n const e = this.encrypt(cs.k, cs.n, ad, plaintext);\n cs.n.increment();\n return e;\n }\n decryptWithAd(cs, ad, ciphertext, dst) {\n const { plaintext, valid } = this.decrypt(cs.k, cs.n, ad, ciphertext, dst);\n if (valid)\n cs.n.increment();\n return { plaintext, valid };\n }\n // Cipher state related\n hasKey(cs) {\n return !this.isEmptyKey(cs.k);\n }\n createEmptyKey() {\n return (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(32);\n }\n isEmptyKey(k) {\n const emptyKey = this.createEmptyKey();\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(emptyKey, k);\n }\n encrypt(k, n, ad, plaintext) {\n n.assertValue();\n return this.crypto.chaCha20Poly1305Encrypt(plaintext, n.getBytes(), ad, k);\n }\n encryptAndHash(ss, plaintext) {\n let ciphertext;\n if (this.hasKey(ss.cs)) {\n ciphertext = this.encryptWithAd(ss.cs, ss.h, plaintext);\n }\n else {\n ciphertext = plaintext;\n }\n this.mixHash(ss, ciphertext);\n return ciphertext;\n }\n decrypt(k, n, ad, ciphertext, dst) {\n n.assertValue();\n const encryptedMessage = this.crypto.chaCha20Poly1305Decrypt(ciphertext, n.getBytes(), ad, k, dst);\n if (encryptedMessage) {\n return {\n plaintext: encryptedMessage,\n valid: true\n };\n }\n else {\n return {\n plaintext: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(0),\n valid: false\n };\n }\n }\n decryptAndHash(ss, ciphertext) {\n let plaintext;\n let valid = true;\n if (this.hasKey(ss.cs)) {\n ({ plaintext, valid } = this.decryptWithAd(ss.cs, ss.h, ciphertext));\n }\n else {\n plaintext = ciphertext;\n }\n this.mixHash(ss, ciphertext);\n return { plaintext, valid };\n }\n dh(privateKey, publicKey) {\n try {\n const derivedU8 = this.crypto.generateX25519SharedKey(privateKey, publicKey);\n if (derivedU8.length === 32) {\n return derivedU8;\n }\n return derivedU8.subarray(0, 32);\n }\n catch (e) {\n const err = e;\n this.log.error('error deriving shared key', err);\n return (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(32);\n }\n }\n mixHash(ss, data) {\n ss.h = this.getHash(ss.h, data);\n }\n getHash(a, b) {\n const u = this.crypto.hashSHA256(new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList(a, b));\n return u;\n }\n mixKey(ss, ikm) {\n const [ck, tempK] = this.crypto.getHKDF(ss.ck, ikm);\n ss.cs = this.initializeKey(tempK);\n ss.ck = ck;\n }\n initializeKey(k) {\n return { k, n: new _nonce_js__WEBPACK_IMPORTED_MODULE_4__.Nonce() };\n }\n // Symmetric state related\n initializeSymmetric(protocolName) {\n const protocolNameBytes = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_1__.fromString)(protocolName, 'utf-8');\n const h = this.hashProtocolName(protocolNameBytes);\n const ck = h;\n const key = this.createEmptyKey();\n const cs = this.initializeKey(key);\n return { cs, ck, h };\n }\n hashProtocolName(protocolName) {\n if (protocolName.length <= 32) {\n const h = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(32);\n h.set(protocolName);\n return h;\n }\n else {\n return this.getHash(protocolName, (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(0));\n }\n }\n split(ss) {\n const [tempk1, tempk2] = this.crypto.getHKDF(ss.ck, (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(0));\n const cs1 = this.initializeKey(tempk1);\n const cs2 = this.initializeKey(tempk2);\n return { cs1, cs2 };\n }\n writeMessageRegular(cs, payload) {\n const ciphertext = this.encryptWithAd(cs, (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(0), payload);\n const ne = this.createEmptyKey();\n const ns = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(0);\n return { ne, ns, ciphertext };\n }\n readMessageRegular(cs, message) {\n return this.decryptWithAd(cs, (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(0), message.ciphertext);\n }\n}\n//# sourceMappingURL=abstract-handshake.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/abstract-handshake.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/xx.js":
|
||
/*!************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/xx.js ***!
|
||
\************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ XX: () => (/* binding */ XX)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js\");\n/* harmony import */ var _abstract_handshake_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract-handshake.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/abstract-handshake.js\");\n\n\n\nclass XX extends _abstract_handshake_js__WEBPACK_IMPORTED_MODULE_2__.AbstractHandshake {\n initializeInitiator(prologue, s, rs, psk) {\n const name = 'Noise_XX_25519_ChaChaPoly_SHA256';\n const ss = this.initializeSymmetric(name);\n this.mixHash(ss, prologue);\n const re = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(32);\n return { ss, s, rs, psk, re };\n }\n initializeResponder(prologue, s, rs, psk) {\n const name = 'Noise_XX_25519_ChaChaPoly_SHA256';\n const ss = this.initializeSymmetric(name);\n this.mixHash(ss, prologue);\n const re = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(32);\n return { ss, s, rs, psk, re };\n }\n writeMessageA(hs, payload, e) {\n const ns = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(0);\n if (e !== undefined) {\n hs.e = e;\n }\n else {\n hs.e = this.crypto.generateX25519KeyPair();\n }\n const ne = hs.e.publicKey;\n this.mixHash(hs.ss, ne);\n const ciphertext = this.encryptAndHash(hs.ss, payload);\n return { ne, ns, ciphertext };\n }\n writeMessageB(hs, payload) {\n hs.e = this.crypto.generateX25519KeyPair();\n const ne = hs.e.publicKey;\n this.mixHash(hs.ss, ne);\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.re));\n const spk = hs.s.publicKey;\n const ns = this.encryptAndHash(hs.ss, spk);\n this.mixKey(hs.ss, this.dh(hs.s.privateKey, hs.re));\n const ciphertext = this.encryptAndHash(hs.ss, payload);\n return { ne, ns, ciphertext };\n }\n writeMessageC(hs, payload) {\n const spk = hs.s.publicKey;\n const ns = this.encryptAndHash(hs.ss, spk);\n this.mixKey(hs.ss, this.dh(hs.s.privateKey, hs.re));\n const ciphertext = this.encryptAndHash(hs.ss, payload);\n const ne = this.createEmptyKey();\n const messageBuffer = { ne, ns, ciphertext };\n const { cs1, cs2 } = this.split(hs.ss);\n return { h: hs.ss.h, messageBuffer, cs1, cs2 };\n }\n readMessageA(hs, message) {\n if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.isValidPublicKey)(message.ne)) {\n hs.re = message.ne;\n }\n this.mixHash(hs.ss, hs.re);\n return this.decryptAndHash(hs.ss, message.ciphertext);\n }\n readMessageB(hs, message) {\n if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.isValidPublicKey)(message.ne)) {\n hs.re = message.ne;\n }\n this.mixHash(hs.ss, hs.re);\n if (!hs.e) {\n throw new Error('Handshake state `e` param is missing.');\n }\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.re));\n const { plaintext: ns, valid: valid1 } = this.decryptAndHash(hs.ss, message.ns);\n if (valid1 && (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.isValidPublicKey)(ns)) {\n hs.rs = ns;\n }\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.rs));\n const { plaintext, valid: valid2 } = this.decryptAndHash(hs.ss, message.ciphertext);\n return { plaintext, valid: (valid1 && valid2) };\n }\n readMessageC(hs, message) {\n const { plaintext: ns, valid: valid1 } = this.decryptAndHash(hs.ss, message.ns);\n if (valid1 && (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.isValidPublicKey)(ns)) {\n hs.rs = ns;\n }\n if (!hs.e) {\n throw new Error('Handshake state `e` param is missing.');\n }\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.rs));\n const { plaintext, valid: valid2 } = this.decryptAndHash(hs.ss, message.ciphertext);\n const { cs1, cs2 } = this.split(hs.ss);\n return { h: hs.ss.h, plaintext, valid: (valid1 && valid2), cs1, cs2 };\n }\n initSession(initiator, prologue, s) {\n const psk = this.createEmptyKey();\n const rs = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(32); // no static key yet\n let hs;\n if (initiator) {\n hs = this.initializeInitiator(prologue, s, rs, psk);\n }\n else {\n hs = this.initializeResponder(prologue, s, rs, psk);\n }\n return {\n hs,\n i: initiator,\n mc: 0\n };\n }\n sendMessage(session, message, ephemeral) {\n let messageBuffer;\n if (session.mc === 0) {\n messageBuffer = this.writeMessageA(session.hs, message, ephemeral);\n }\n else if (session.mc === 1) {\n messageBuffer = this.writeMessageB(session.hs, message);\n }\n else if (session.mc === 2) {\n const { h, messageBuffer: resultingBuffer, cs1, cs2 } = this.writeMessageC(session.hs, message);\n messageBuffer = resultingBuffer;\n session.h = h;\n session.cs1 = cs1;\n session.cs2 = cs2;\n }\n else if (session.mc > 2) {\n if (session.i) {\n if (!session.cs1) {\n throw new Error('CS1 (cipher state) is not defined');\n }\n messageBuffer = this.writeMessageRegular(session.cs1, message);\n }\n else {\n if (!session.cs2) {\n throw new Error('CS2 (cipher state) is not defined');\n }\n messageBuffer = this.writeMessageRegular(session.cs2, message);\n }\n }\n else {\n throw new Error('Session invalid.');\n }\n session.mc++;\n return messageBuffer;\n }\n recvMessage(session, message) {\n let plaintext = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(0);\n let valid = false;\n if (session.mc === 0) {\n ({ plaintext, valid } = this.readMessageA(session.hs, message));\n }\n else if (session.mc === 1) {\n ({ plaintext, valid } = this.readMessageB(session.hs, message));\n }\n else if (session.mc === 2) {\n const { h, plaintext: resultingPlaintext, valid: resultingValid, cs1, cs2 } = this.readMessageC(session.hs, message);\n plaintext = resultingPlaintext;\n valid = resultingValid;\n session.h = h;\n session.cs1 = cs1;\n session.cs2 = cs2;\n }\n session.mc++;\n return { plaintext, valid };\n }\n}\n//# sourceMappingURL=xx.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/xx.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/index.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/index.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ noise: () => (/* binding */ noise),\n/* harmony export */ pureJsCrypto: () => (/* reexport safe */ _crypto_js_js__WEBPACK_IMPORTED_MODULE_1__.pureJsCrypto)\n/* harmony export */ });\n/* harmony import */ var _noise_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./noise.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/noise.js\");\n/* harmony import */ var _crypto_js_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./crypto/js.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/js.js\");\n\n\nfunction noise(init = {}) {\n return (components) => new _noise_js__WEBPACK_IMPORTED_MODULE_0__.Noise(components, init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/logger.js":
|
||
/*!*****************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/logger.js ***!
|
||
\*****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ logCipherState: () => (/* binding */ logCipherState),\n/* harmony export */ logLocalEphemeralKeys: () => (/* binding */ logLocalEphemeralKeys),\n/* harmony export */ logLocalStaticKeys: () => (/* binding */ logLocalStaticKeys),\n/* harmony export */ logRemoteEphemeralKey: () => (/* binding */ logRemoteEphemeralKey),\n/* harmony export */ logRemoteStaticKey: () => (/* binding */ logRemoteStaticKey)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js\");\n\n\nfunction logLocalStaticKeys(s, keyLogger) {\n if (!keyLogger.enabled || !_constants_js__WEBPACK_IMPORTED_MODULE_1__.DUMP_SESSION_KEYS) {\n return;\n }\n keyLogger(`LOCAL_STATIC_PUBLIC_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(s.publicKey, 'hex')}`);\n keyLogger(`LOCAL_STATIC_PRIVATE_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(s.privateKey, 'hex')}`);\n}\nfunction logLocalEphemeralKeys(e, keyLogger) {\n if (!keyLogger.enabled || !_constants_js__WEBPACK_IMPORTED_MODULE_1__.DUMP_SESSION_KEYS) {\n return;\n }\n if (e) {\n keyLogger(`LOCAL_PUBLIC_EPHEMERAL_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(e.publicKey, 'hex')}`);\n keyLogger(`LOCAL_PRIVATE_EPHEMERAL_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(e.privateKey, 'hex')}`);\n }\n else {\n keyLogger('Missing local ephemeral keys.');\n }\n}\nfunction logRemoteStaticKey(rs, keyLogger) {\n if (!keyLogger.enabled || !_constants_js__WEBPACK_IMPORTED_MODULE_1__.DUMP_SESSION_KEYS) {\n return;\n }\n keyLogger(`REMOTE_STATIC_PUBLIC_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(rs.subarray(), 'hex')}`);\n}\nfunction logRemoteEphemeralKey(re, keyLogger) {\n if (!keyLogger.enabled || !_constants_js__WEBPACK_IMPORTED_MODULE_1__.DUMP_SESSION_KEYS) {\n return;\n }\n keyLogger(`REMOTE_EPHEMERAL_PUBLIC_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(re.subarray(), 'hex')}`);\n}\nfunction logCipherState(session, keyLogger) {\n if (!keyLogger.enabled || !_constants_js__WEBPACK_IMPORTED_MODULE_1__.DUMP_SESSION_KEYS) {\n return;\n }\n if (session.cs1 && session.cs2) {\n keyLogger(`CIPHER_STATE_1 ${session.cs1.n.getUint64()} ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(session.cs1.k, 'hex')}`);\n keyLogger(`CIPHER_STATE_2 ${session.cs2.n.getUint64()} ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(session.cs2.k, 'hex')}`);\n }\n else {\n keyLogger('Missing cipher state.');\n }\n}\n//# sourceMappingURL=logger.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/logger.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/metrics.js":
|
||
/*!******************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/metrics.js ***!
|
||
\******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ registerMetrics: () => (/* binding */ registerMetrics)\n/* harmony export */ });\nfunction registerMetrics(metrics) {\n return {\n xxHandshakeSuccesses: metrics.registerCounter('libp2p_noise_xxhandshake_successes_total', {\n help: 'Total count of noise xxHandshakes successes_'\n }),\n xxHandshakeErrors: metrics.registerCounter('libp2p_noise_xxhandshake_error_total', {\n help: 'Total count of noise xxHandshakes errors'\n }),\n encryptedPackets: metrics.registerCounter('libp2p_noise_encrypted_packets_total', {\n help: 'Total count of noise encrypted packets successfully'\n }),\n decryptedPackets: metrics.registerCounter('libp2p_noise_decrypted_packets_total', {\n help: 'Total count of noise decrypted packets'\n }),\n decryptErrors: metrics.registerCounter('libp2p_noise_decrypt_errors_total', {\n help: 'Total count of noise decrypt errors'\n })\n };\n}\n//# sourceMappingURL=metrics.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/metrics.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/noise.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/noise.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Noise: () => (/* binding */ Noise)\n/* harmony export */ });\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed_stream__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-length-prefixed-stream */ \"./node_modules/it-length-prefixed-stream/dist/src/index.js\");\n/* harmony import */ var it_pair_duplex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-pair/duplex */ \"./node_modules/it-pair/dist/src/duplex.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js\");\n/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./crypto/index.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/index.browser.js\");\n/* harmony import */ var _crypto_streaming_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./crypto/streaming.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/streaming.js\");\n/* harmony import */ var _encoder_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./encoder.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js\");\n/* harmony import */ var _handshake_xx_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./handshake-xx.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/handshake-xx.js\");\n/* harmony import */ var _metrics_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./metrics.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/metrics.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js\");\n\n\n\n\n\n\n\n\n\n\n\n\nclass Noise {\n protocol = '/noise';\n crypto;\n prologue;\n staticKeys;\n extensions;\n metrics;\n components;\n constructor(components, init = {}) {\n const { staticNoiseKey, extensions, crypto, prologueBytes } = init;\n const { metrics } = components;\n this.components = components;\n this.crypto = crypto ?? _crypto_index_js__WEBPACK_IMPORTED_MODULE_6__.defaultCrypto;\n this.extensions = extensions;\n this.metrics = metrics ? (0,_metrics_js__WEBPACK_IMPORTED_MODULE_10__.registerMetrics)(metrics) : undefined;\n if (staticNoiseKey) {\n // accepts x25519 private key of length 32\n this.staticKeys = this.crypto.generateX25519KeyPairFromSeed(staticNoiseKey);\n }\n else {\n this.staticKeys = this.crypto.generateX25519KeyPair();\n }\n this.prologue = prologueBytes ?? (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_4__.alloc)(0);\n }\n /**\n * Encrypt outgoing data to the remote party (handshake as initiator)\n *\n * @param {PeerId} localPeer - PeerId of the receiving peer\n * @param {Stream} connection - streaming iterable duplex that will be encrypted\n * @param {PeerId} remotePeer - PeerId of the remote peer. Used to validate the integrity of the remote peer.\n * @returns {Promise<SecuredConnection<Stream, NoiseExtensions>>}\n */\n async secureOutbound(localPeer, connection, remotePeer) {\n const wrappedConnection = (0,it_length_prefixed_stream__WEBPACK_IMPORTED_MODULE_1__.lpStream)(connection, {\n lengthEncoder: _encoder_js__WEBPACK_IMPORTED_MODULE_8__.uint16BEEncode,\n lengthDecoder: _encoder_js__WEBPACK_IMPORTED_MODULE_8__.uint16BEDecode,\n maxDataLength: _constants_js__WEBPACK_IMPORTED_MODULE_5__.NOISE_MSG_MAX_LENGTH_BYTES\n });\n const handshake = await this.performHandshake({\n connection: wrappedConnection,\n isInitiator: true,\n localPeer,\n remotePeer\n });\n const conn = await this.createSecureConnection(wrappedConnection, handshake);\n connection.source = conn.source;\n connection.sink = conn.sink;\n return {\n conn: connection,\n remoteExtensions: handshake.remoteExtensions,\n remotePeer: handshake.remotePeer\n };\n }\n /**\n * Decrypt incoming data (handshake as responder).\n *\n * @param {PeerId} localPeer - PeerId of the receiving peer.\n * @param {Stream} connection - streaming iterable duplex that will be encrypted.\n * @param {PeerId} remotePeer - optional PeerId of the initiating peer, if known. This may only exist during transport upgrades.\n * @returns {Promise<SecuredConnection<Stream, NoiseExtensions>>}\n */\n async secureInbound(localPeer, connection, remotePeer) {\n const wrappedConnection = (0,it_length_prefixed_stream__WEBPACK_IMPORTED_MODULE_1__.lpStream)(connection, {\n lengthEncoder: _encoder_js__WEBPACK_IMPORTED_MODULE_8__.uint16BEEncode,\n lengthDecoder: _encoder_js__WEBPACK_IMPORTED_MODULE_8__.uint16BEDecode,\n maxDataLength: _constants_js__WEBPACK_IMPORTED_MODULE_5__.NOISE_MSG_MAX_LENGTH_BYTES\n });\n const handshake = await this.performHandshake({\n connection: wrappedConnection,\n isInitiator: false,\n localPeer,\n remotePeer\n });\n const conn = await this.createSecureConnection(wrappedConnection, handshake);\n connection.source = conn.source;\n connection.sink = conn.sink;\n return {\n conn: connection,\n remotePeer: handshake.remotePeer,\n remoteExtensions: handshake.remoteExtensions\n };\n }\n /**\n * If Noise pipes supported, tries IK handshake first with XX as fallback if it fails.\n * If noise pipes disabled or remote peer static key is unknown, use XX.\n *\n * @param {HandshakeParams} params\n */\n async performHandshake(params) {\n const payload = await (0,_utils_js__WEBPACK_IMPORTED_MODULE_11__.getPayload)(params.localPeer, this.staticKeys.publicKey, this.extensions);\n // run XX handshake\n return this.performXXHandshake(params, payload);\n }\n async performXXHandshake(params, payload) {\n const { isInitiator, remotePeer, connection } = params;\n const handshake = new _handshake_xx_js__WEBPACK_IMPORTED_MODULE_9__.XXHandshake(this.components, isInitiator, payload, this.prologue, this.crypto, this.staticKeys, connection, remotePeer);\n try {\n await handshake.propose();\n await handshake.exchange();\n await handshake.finish();\n this.metrics?.xxHandshakeSuccesses.increment();\n }\n catch (e) {\n this.metrics?.xxHandshakeErrors.increment();\n if (e instanceof Error) {\n e.message = `Error occurred during XX handshake: ${e.message}`;\n throw e;\n }\n }\n return handshake;\n }\n async createSecureConnection(connection, handshake) {\n // Create encryption box/unbox wrapper\n const [secure, user] = (0,it_pair_duplex__WEBPACK_IMPORTED_MODULE_2__.duplexPair)();\n const network = connection.unwrap();\n await (0,it_pipe__WEBPACK_IMPORTED_MODULE_3__.pipe)(secure, // write to wrapper\n (0,_crypto_streaming_js__WEBPACK_IMPORTED_MODULE_7__.encryptStream)(handshake, this.metrics), // encrypt data + prefix with message length\n network, // send to the remote peer\n (source) => (0,it_length_prefixed__WEBPACK_IMPORTED_MODULE_0__.decode)(source, { lengthDecoder: _encoder_js__WEBPACK_IMPORTED_MODULE_8__.uint16BEDecode }), // read message length prefix\n (0,_crypto_streaming_js__WEBPACK_IMPORTED_MODULE_7__.decryptStream)(handshake, this.metrics), // decrypt the incoming data\n secure // pipe to the wrapper\n );\n return user;\n }\n}\n//# sourceMappingURL=noise.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/noise.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/nonce.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/nonce.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MAX_NONCE: () => (/* binding */ MAX_NONCE),\n/* harmony export */ MIN_NONCE: () => (/* binding */ MIN_NONCE),\n/* harmony export */ Nonce: () => (/* binding */ Nonce)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js\");\n\nconst MIN_NONCE = 0;\n// For performance reasons, the nonce is represented as a JS `number`\n// Although JS `number` can safely represent integers up to 2 ** 53 - 1, we choose to only use\n// 4 bytes to store the data for performance reason.\n// This is a slight deviation from the noise spec, which describes the max nonce as 2 ** 64 - 2\n// The effect is that this implementation will need a new handshake to be performed after fewer messages are exchanged than other implementations with full uint64 nonces.\n// this MAX_NONCE is still a large number of messages, so the practical effect of this is negligible.\nconst MAX_NONCE = 0xffffffff;\nconst ERR_MAX_NONCE = 'Cipherstate has reached maximum n, a new handshake must be performed';\n/**\n * The nonce is an uint that's increased over time.\n * Maintaining different representations help improve performance.\n */\nclass Nonce {\n n;\n bytes;\n view;\n constructor(n = MIN_NONCE) {\n this.n = n;\n this.bytes = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(12);\n this.view = new DataView(this.bytes.buffer, this.bytes.byteOffset, this.bytes.byteLength);\n this.view.setUint32(4, n, true);\n }\n increment() {\n this.n++;\n // Even though we're treating the nonce as 8 bytes, RFC7539 specifies 12 bytes for a nonce.\n this.view.setUint32(4, this.n, true);\n }\n getBytes() {\n return this.bytes;\n }\n getUint64() {\n return this.n;\n }\n assertValue() {\n if (this.n > MAX_NONCE) {\n throw new Error(ERR_MAX_NONCE);\n }\n }\n}\n//# sourceMappingURL=nonce.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/nonce.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/proto/payload.js":
|
||
/*!************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/proto/payload.js ***!
|
||
\************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ NoiseExtensions: () => (/* binding */ NoiseExtensions),\n/* harmony export */ NoiseHandshakePayload: () => (/* binding */ NoiseHandshakePayload)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar NoiseExtensions;\n(function (NoiseExtensions) {\n let _codec;\n NoiseExtensions.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.webtransportCerthashes != null) {\n for (const value of obj.webtransportCerthashes) {\n w.uint32(10);\n w.bytes(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n webtransportCerthashes: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.webtransportCerthashes.push(reader.bytes());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n NoiseExtensions.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, NoiseExtensions.codec());\n };\n NoiseExtensions.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, NoiseExtensions.codec());\n };\n})(NoiseExtensions || (NoiseExtensions = {}));\nvar NoiseHandshakePayload;\n(function (NoiseHandshakePayload) {\n let _codec;\n NoiseHandshakePayload.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.identityKey != null && obj.identityKey.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.identityKey);\n }\n if ((obj.identitySig != null && obj.identitySig.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.identitySig);\n }\n if (obj.extensions != null) {\n w.uint32(34);\n NoiseExtensions.codec().encode(obj.extensions, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n identityKey: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n identitySig: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.identityKey = reader.bytes();\n break;\n }\n case 2: {\n obj.identitySig = reader.bytes();\n break;\n }\n case 4: {\n obj.extensions = NoiseExtensions.codec().decode(reader, reader.uint32());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n NoiseHandshakePayload.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, NoiseHandshakePayload.codec());\n };\n NoiseHandshakePayload.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, NoiseHandshakePayload.codec());\n };\n})(NoiseHandshakePayload || (NoiseHandshakePayload = {}));\n//# sourceMappingURL=payload.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/proto/payload.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createHandshakePayload: () => (/* binding */ createHandshakePayload),\n/* harmony export */ decodePayload: () => (/* binding */ decodePayload),\n/* harmony export */ getHandshakePayload: () => (/* binding */ getHandshakePayload),\n/* harmony export */ getPayload: () => (/* binding */ getPayload),\n/* harmony export */ getPeerIdFromPayload: () => (/* binding */ getPeerIdFromPayload),\n/* harmony export */ isValidPublicKey: () => (/* binding */ isValidPublicKey),\n/* harmony export */ signPayload: () => (/* binding */ signPayload),\n/* harmony export */ verifySignedPayload: () => (/* binding */ verifySignedPayload)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _proto_payload_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./proto/payload.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/proto/payload.js\");\n\n\n\n\n\n\nasync function getPayload(localPeer, staticPublicKey, extensions) {\n const signedPayload = await signPayload(localPeer, getHandshakePayload(staticPublicKey));\n if (localPeer.publicKey == null) {\n throw new Error('PublicKey was missing from local PeerId');\n }\n return createHandshakePayload(localPeer.publicKey, signedPayload, extensions);\n}\nfunction createHandshakePayload(libp2pPublicKey, signedPayload, extensions) {\n return _proto_payload_js__WEBPACK_IMPORTED_MODULE_4__.NoiseHandshakePayload.encode({\n identityKey: libp2pPublicKey,\n identitySig: signedPayload,\n extensions: extensions ?? { webtransportCerthashes: [] }\n }).subarray();\n}\nasync function signPayload(peerId, payload) {\n if (peerId.privateKey == null) {\n throw new Error('PrivateKey was missing from PeerId');\n }\n const privateKey = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPrivateKey)(peerId.privateKey);\n return privateKey.sign(payload);\n}\nasync function getPeerIdFromPayload(payload) {\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_5__.peerIdFromKeys)(payload.identityKey);\n}\nfunction decodePayload(payload) {\n return _proto_payload_js__WEBPACK_IMPORTED_MODULE_4__.NoiseHandshakePayload.decode(payload);\n}\nfunction getHandshakePayload(publicKey) {\n const prefix = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)('noise-libp2p-static-key:');\n if (publicKey instanceof Uint8Array) {\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_2__.concat)([prefix, publicKey], prefix.length + publicKey.length);\n }\n publicKey.prepend(prefix);\n return publicKey;\n}\n/**\n * Verifies signed payload, throws on any irregularities.\n *\n * @param {bytes} noiseStaticKey - owner's noise static key\n * @param {bytes} payload - decoded payload\n * @param {PeerId} remotePeer - owner's libp2p peer ID\n * @returns {Promise<PeerId>} - peer ID of payload owner\n */\nasync function verifySignedPayload(noiseStaticKey, payload, remotePeer) {\n // Unmarshaling from PublicKey protobuf\n const payloadPeerId = await (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_5__.peerIdFromKeys)(payload.identityKey);\n if (!payloadPeerId.equals(remotePeer)) {\n throw new Error(`Payload identity key ${payloadPeerId.toString()} does not match expected remote peer ${remotePeer.toString()}`);\n }\n const generatedPayload = getHandshakePayload(noiseStaticKey);\n if (payloadPeerId.publicKey == null) {\n throw new Error('PublicKey was missing from PeerId');\n }\n if (payload.identitySig == null) {\n throw new Error('Signature was missing from message');\n }\n const publicKey = (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPublicKey)(payloadPeerId.publicKey);\n const valid = await publicKey.verify(generatedPayload, payload.identitySig);\n if (!valid) {\n throw new Error(\"Static key doesn't match to peer that signed payload!\");\n }\n return payloadPeerId;\n}\nfunction isValidPublicKey(pk) {\n if (!(pk instanceof Uint8Array) && !((0,uint8arraylist__WEBPACK_IMPORTED_MODULE_1__.isUint8ArrayList)(pk))) {\n return false;\n }\n if (pk.byteLength !== 32) {\n return false;\n }\n return true;\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js":
|
||
/*!**************************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js ***!
|
||
\**************************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ create: () => (/* binding */ create),\n/* harmony export */ derivedEmptyPasswordKey: () => (/* binding */ derivedEmptyPasswordKey)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/webcrypto.js\");\n\n\n\n// WebKit on Linux does not support deriving a key from an empty PBKDF2 key.\n// So, as a workaround, we provide the generated key as a constant. We test that\n// this generated key is accurate in test/workaround.spec.ts\n// Generated via:\n// await crypto.subtle.exportKey('jwk',\n// await crypto.subtle.deriveKey(\n// { name: 'PBKDF2', salt: new Uint8Array(16), iterations: 32767, hash: { name: 'SHA-256' } },\n// await crypto.subtle.importKey('raw', new Uint8Array(0), { name: 'PBKDF2' }, false, ['deriveKey']),\n// { name: 'AES-GCM', length: 128 }, true, ['encrypt', 'decrypt'])\n// )\nconst derivedEmptyPasswordKey = { alg: 'A128GCM', ext: true, k: 'scm9jmO_4BJAgdwWGVulLg', key_ops: ['encrypt', 'decrypt'], kty: 'oct' };\n// Based off of code from https://github.com/luke-park/SecureCompatibleEncryptionExamples\nfunction create(opts) {\n const algorithm = opts?.algorithm ?? 'AES-GCM';\n let keyLength = opts?.keyLength ?? 16;\n const nonceLength = opts?.nonceLength ?? 12;\n const digest = opts?.digest ?? 'SHA-256';\n const saltLength = opts?.saltLength ?? 16;\n const iterations = opts?.iterations ?? 32767;\n const crypto = _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get();\n keyLength *= 8; // Browser crypto uses bits instead of bytes\n /**\n * Uses the provided password to derive a pbkdf2 key. The key\n * will then be used to encrypt the data.\n */\n async function encrypt(data, password) {\n const salt = crypto.getRandomValues(new Uint8Array(saltLength));\n const nonce = crypto.getRandomValues(new Uint8Array(nonceLength));\n const aesGcm = { name: algorithm, iv: nonce };\n if (typeof password === 'string') {\n password = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(password);\n }\n let cryptoKey;\n if (password.length === 0) {\n cryptoKey = await crypto.subtle.importKey('jwk', derivedEmptyPasswordKey, { name: 'AES-GCM' }, true, ['encrypt']);\n try {\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, runtimeDerivedEmptyPassword, { name: algorithm, length: keyLength }, true, ['encrypt']);\n }\n catch {\n cryptoKey = await crypto.subtle.importKey('jwk', derivedEmptyPasswordKey, { name: 'AES-GCM' }, true, ['encrypt']);\n }\n }\n else {\n // Derive a key using PBKDF2.\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const rawKey = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, rawKey, { name: algorithm, length: keyLength }, true, ['encrypt']);\n }\n // Encrypt the string.\n const ciphertext = await crypto.subtle.encrypt(aesGcm, cryptoKey, data);\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([salt, aesGcm.iv, new Uint8Array(ciphertext)]);\n }\n /**\n * Uses the provided password to derive a pbkdf2 key. The key\n * will then be used to decrypt the data. The options used to create\n * this decryption cipher must be the same as those used to create\n * the encryption cipher.\n */\n async function decrypt(data, password) {\n const salt = data.subarray(0, saltLength);\n const nonce = data.subarray(saltLength, saltLength + nonceLength);\n const ciphertext = data.subarray(saltLength + nonceLength);\n const aesGcm = { name: algorithm, iv: nonce };\n if (typeof password === 'string') {\n password = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(password);\n }\n let cryptoKey;\n if (password.length === 0) {\n try {\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, runtimeDerivedEmptyPassword, { name: algorithm, length: keyLength }, true, ['decrypt']);\n }\n catch {\n cryptoKey = await crypto.subtle.importKey('jwk', derivedEmptyPasswordKey, { name: 'AES-GCM' }, true, ['decrypt']);\n }\n }\n else {\n // Derive the key using PBKDF2.\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const rawKey = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, rawKey, { name: algorithm, length: keyLength }, true, ['decrypt']);\n }\n // Decrypt the string.\n const plaintext = await crypto.subtle.decrypt(aesGcm, cryptoKey, ciphertext);\n return new Uint8Array(plaintext);\n }\n const cipher = {\n encrypt,\n decrypt\n };\n return cipher;\n}\n//# sourceMappingURL=aes-gcm.browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js":
|
||
/*!*********************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js ***!
|
||
\*********************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ create: () => (/* binding */ create)\n/* harmony export */ });\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/webcrypto.js\");\n/* harmony import */ var _lengths_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lengths.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/hmac/lengths.js\");\n\n\nconst hashTypes = {\n SHA1: 'SHA-1',\n SHA256: 'SHA-256',\n SHA512: 'SHA-512'\n};\nconst sign = async (key, data) => {\n const buf = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().subtle.sign({ name: 'HMAC' }, key, data);\n return new Uint8Array(buf, 0, buf.byteLength);\n};\nasync function create(hashType, secret) {\n const hash = hashTypes[hashType];\n const key = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().subtle.importKey('raw', secret, {\n name: 'HMAC',\n hash: { name: hash }\n }, false, ['sign']);\n return {\n async digest(data) {\n return sign(key, data);\n },\n length: _lengths_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"][hashType]\n };\n}\n//# sourceMappingURL=index-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/hmac/lengths.js":
|
||
/*!***************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/hmac/lengths.js ***!
|
||
\***************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n SHA1: 20,\n SHA256: 32,\n SHA512: 64\n});\n//# sourceMappingURL=lengths.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/hmac/lengths.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js":
|
||
/*!********************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js ***!
|
||
\********************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ generateEphmeralKeyPair: () => (/* binding */ generateEphmeralKeyPair)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/util.js\");\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/webcrypto.js\");\n\n\n\n\n\n\nconst bits = {\n 'P-256': 256,\n 'P-384': 384,\n 'P-521': 521\n};\nconst curveTypes = Object.keys(bits);\nconst names = curveTypes.join(' / ');\nasync function generateEphmeralKeyPair(curve) {\n if (curve !== 'P-256' && curve !== 'P-384' && curve !== 'P-521') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.CodeError(`Unknown curve: ${curve}. Must be ${names}`, 'ERR_INVALID_CURVE');\n }\n const pair = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.generateKey({\n name: 'ECDH',\n namedCurve: curve\n }, true, ['deriveBits']);\n // forcePrivate is used for testing only\n const genSharedKey = async (theirPub, forcePrivate) => {\n let privateKey;\n if (forcePrivate != null) {\n privateKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.importKey('jwk', unmarshalPrivateKey(curve, forcePrivate), {\n name: 'ECDH',\n namedCurve: curve\n }, false, ['deriveBits']);\n }\n else {\n privateKey = pair.privateKey;\n }\n const key = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.importKey('jwk', unmarshalPublicKey(curve, theirPub), {\n name: 'ECDH',\n namedCurve: curve\n }, false, []);\n const buffer = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.deriveBits({\n name: 'ECDH',\n // @ts-expect-error namedCurve is missing from the types\n namedCurve: curve,\n public: key\n }, privateKey, bits[curve]);\n return new Uint8Array(buffer, 0, buffer.byteLength);\n };\n const publicKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.exportKey('jwk', pair.publicKey);\n const ecdhKey = {\n key: marshalPublicKey(publicKey),\n genSharedKey\n };\n return ecdhKey;\n}\nconst curveLengths = {\n 'P-256': 32,\n 'P-384': 48,\n 'P-521': 66\n};\n// Marshal converts a jwk encoded ECDH public key into the\n// form specified in section 4.3.6 of ANSI X9.62. (This is the format\n// go-ipfs uses)\nfunction marshalPublicKey(jwk) {\n if (jwk.crv == null || jwk.x == null || jwk.y == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.CodeError('JWK was missing components', 'ERR_INVALID_PARAMETERS');\n }\n if (jwk.crv !== 'P-256' && jwk.crv !== 'P-384' && jwk.crv !== 'P-521') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.CodeError(`Unknown curve: ${jwk.crv}. Must be ${names}`, 'ERR_INVALID_CURVE');\n }\n const byteLen = curveLengths[jwk.crv];\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([\n Uint8Array.from([4]), // uncompressed point\n (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.base64urlToBuffer)(jwk.x, byteLen),\n (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.base64urlToBuffer)(jwk.y, byteLen)\n ], 1 + byteLen * 2);\n}\n// Unmarshal converts a point, serialized by Marshal, into an jwk encoded key\nfunction unmarshalPublicKey(curve, key) {\n if (curve !== 'P-256' && curve !== 'P-384' && curve !== 'P-521') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.CodeError(`Unknown curve: ${curve}. Must be ${names}`, 'ERR_INVALID_CURVE');\n }\n const byteLen = curveLengths[curve];\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(key.subarray(0, 1), Uint8Array.from([4]))) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.CodeError('Cannot unmarshal public key - invalid key format', 'ERR_INVALID_KEY_FORMAT');\n }\n return {\n kty: 'EC',\n crv: curve,\n x: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(key.subarray(1, byteLen + 1), 'base64url'),\n y: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(key.subarray(1 + byteLen), 'base64url'),\n ext: true\n };\n}\nconst unmarshalPrivateKey = (curve, key) => ({\n ...unmarshalPublicKey(curve, key.public),\n d: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(key.private, 'base64url')\n});\n//# sourceMappingURL=ecdh-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js":
|
||
/*!***********************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js ***!
|
||
\***********************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ generateKey: () => (/* binding */ generateKey),\n/* harmony export */ generateKeyFromSeed: () => (/* binding */ generateKeyFromSeed),\n/* harmony export */ hashAndSign: () => (/* binding */ hashAndSign),\n/* harmony export */ hashAndVerify: () => (/* binding */ hashAndVerify),\n/* harmony export */ privateKeyLength: () => (/* binding */ PRIVATE_KEY_BYTE_LENGTH),\n/* harmony export */ publicKeyLength: () => (/* binding */ PUBLIC_KEY_BYTE_LENGTH)\n/* harmony export */ });\n/* harmony import */ var _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/curves/ed25519 */ \"./node_modules/@noble/curves/esm/ed25519.js\");\n\nconst PUBLIC_KEY_BYTE_LENGTH = 32;\nconst PRIVATE_KEY_BYTE_LENGTH = 64; // private key is actually 32 bytes but for historical reasons we concat private and public keys\nconst KEYS_BYTE_LENGTH = 32;\n\n\nfunction generateKey() {\n // the actual private key (32 bytes)\n const privateKeyRaw = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__.ed25519.utils.randomPrivateKey();\n const publicKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__.ed25519.getPublicKey(privateKeyRaw);\n // concatenated the public key to the private key\n const privateKey = concatKeys(privateKeyRaw, publicKey);\n return {\n privateKey,\n publicKey\n };\n}\n/**\n * Generate keypair from a 32 byte uint8array\n */\nfunction generateKeyFromSeed(seed) {\n if (seed.length !== KEYS_BYTE_LENGTH) {\n throw new TypeError('\"seed\" must be 32 bytes in length.');\n }\n else if (!(seed instanceof Uint8Array)) {\n throw new TypeError('\"seed\" must be a node.js Buffer, or Uint8Array.');\n }\n // based on node forges algorithm, the seed is used directly as private key\n const privateKeyRaw = seed;\n const publicKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__.ed25519.getPublicKey(privateKeyRaw);\n const privateKey = concatKeys(privateKeyRaw, publicKey);\n return {\n privateKey,\n publicKey\n };\n}\nfunction hashAndSign(privateKey, msg) {\n const privateKeyRaw = privateKey.subarray(0, KEYS_BYTE_LENGTH);\n return _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__.ed25519.sign(msg instanceof Uint8Array ? msg : msg.subarray(), privateKeyRaw);\n}\nfunction hashAndVerify(publicKey, sig, msg) {\n return _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__.ed25519.verify(sig, msg instanceof Uint8Array ? msg : msg.subarray(), publicKey);\n}\nfunction concatKeys(privateKeyRaw, publicKey) {\n const privateKey = new Uint8Array(PRIVATE_KEY_BYTE_LENGTH);\n for (let i = 0; i < KEYS_BYTE_LENGTH; i++) {\n privateKey[i] = privateKeyRaw[i];\n privateKey[KEYS_BYTE_LENGTH + i] = publicKey[i];\n }\n return privateKey;\n}\n//# sourceMappingURL=ed25519-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js":
|
||
/*!*********************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js ***!
|
||
\*********************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Ed25519PrivateKey: () => (/* binding */ Ed25519PrivateKey),\n/* harmony export */ Ed25519PublicKey: () => (/* binding */ Ed25519PublicKey),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ generateKeyPairFromSeed: () => (/* binding */ generateKeyPairFromSeed),\n/* harmony export */ unmarshalEd25519PrivateKey: () => (/* binding */ unmarshalEd25519PrivateKey),\n/* harmony export */ unmarshalEd25519PublicKey: () => (/* binding */ unmarshalEd25519PublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/dist/src/bases/base58.js\");\n/* harmony import */ var multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/hashes/identity */ \"./node_modules/multiformats/dist/src/hashes/identity.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/util.js\");\n/* harmony import */ var _ed25519_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ed25519.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js\");\n/* harmony import */ var _exporter_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./exporter.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/exporter.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n\n\n\n\n\n\n\n\n\nclass Ed25519PublicKey {\n _key;\n constructor(key) {\n this._key = ensureKey(key, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.publicKeyLength);\n }\n verify(data, sig) {\n return _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.hashAndVerify(this._key, sig, data);\n }\n marshal() {\n return this._key;\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_7__.PublicKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_7__.KeyType.Ed25519,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(this.bytes, key.bytes);\n }\n hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__.sha256.digest(this.bytes);\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_4__.isPromise)(p)) {\n return p.then(({ bytes }) => bytes);\n }\n return p.bytes;\n }\n}\nclass Ed25519PrivateKey {\n _key;\n _publicKey;\n // key - 64 byte Uint8Array containing private key\n // publicKey - 32 byte Uint8Array containing public key\n constructor(key, publicKey) {\n this._key = ensureKey(key, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength);\n this._publicKey = ensureKey(publicKey, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.publicKeyLength);\n }\n sign(message) {\n return _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.hashAndSign(this._key, message);\n }\n get public() {\n return new Ed25519PublicKey(this._publicKey);\n }\n marshal() {\n return this._key;\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_7__.PrivateKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_7__.KeyType.Ed25519,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(this.bytes, key.bytes);\n }\n async hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__.sha256.digest(this.bytes);\n let bytes;\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_4__.isPromise)(p)) {\n ({ bytes } = await p);\n }\n else {\n bytes = p.bytes;\n }\n return bytes;\n }\n /**\n * Gets the ID of the key.\n *\n * The key id is the base58 encoding of the identity multihash containing its public key.\n * The public key is a protobuf encoding containing a type and the DER encoding\n * of the PKCS SubjectPublicKeyInfo.\n *\n * @returns {Promise<string>}\n */\n async id() {\n const encoding = multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_1__.identity.digest(this.public.bytes);\n return multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_0__.base58btc.encode(encoding.bytes).substring(1);\n }\n /**\n * Exports the key into a password protected `format`\n */\n async export(password, format = 'libp2p-key') {\n if (format === 'libp2p-key') {\n return (0,_exporter_js__WEBPACK_IMPORTED_MODULE_6__.exporter)(this.bytes, password);\n }\n else {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError(`export format '${format}' is not supported`, 'ERR_INVALID_EXPORT_FORMAT');\n }\n }\n}\nfunction unmarshalEd25519PrivateKey(bytes) {\n // Try the old, redundant public key version\n if (bytes.length > _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength) {\n bytes = ensureKey(bytes, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength + _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.publicKeyLength);\n const privateKeyBytes = bytes.subarray(0, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength);\n const publicKeyBytes = bytes.subarray(_ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength, bytes.length);\n return new Ed25519PrivateKey(privateKeyBytes, publicKeyBytes);\n }\n bytes = ensureKey(bytes, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength);\n const privateKeyBytes = bytes.subarray(0, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength);\n const publicKeyBytes = bytes.subarray(_ed25519_js__WEBPACK_IMPORTED_MODULE_5__.publicKeyLength);\n return new Ed25519PrivateKey(privateKeyBytes, publicKeyBytes);\n}\nfunction unmarshalEd25519PublicKey(bytes) {\n bytes = ensureKey(bytes, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.publicKeyLength);\n return new Ed25519PublicKey(bytes);\n}\nasync function generateKeyPair() {\n const { privateKey, publicKey } = _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.generateKey();\n return new Ed25519PrivateKey(privateKey, publicKey);\n}\nasync function generateKeyPairFromSeed(seed) {\n const { privateKey, publicKey } = _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.generateKeyFromSeed(seed);\n return new Ed25519PrivateKey(privateKey, publicKey);\n}\nfunction ensureKey(key, length) {\n key = Uint8Array.from(key ?? []);\n if (key.length !== length) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError(`Key must be a Uint8Array of length ${length}, got ${key.length}`, 'ERR_INVALID_KEY_TYPE');\n }\n return key;\n}\n//# sourceMappingURL=ed25519-class.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js":
|
||
/*!**********************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js ***!
|
||
\**********************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _ecdh_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ecdh.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js\");\n\n/**\n * Generates an ephemeral public key and returns a function that will compute\n * the shared secret key.\n *\n * Focuses only on ECDH now, but can be made more general in the future.\n */\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_ecdh_js__WEBPACK_IMPORTED_MODULE_0__.generateEphmeralKeyPair);\n//# sourceMappingURL=ephemeral-keys.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/exporter.js":
|
||
/*!****************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/exporter.js ***!
|
||
\****************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ exporter: () => (/* binding */ exporter)\n/* harmony export */ });\n/* harmony import */ var multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/bases/base64 */ \"./node_modules/multiformats/dist/src/bases/base64.js\");\n/* harmony import */ var _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ciphers/aes-gcm.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js\");\n\n\n/**\n * Exports the given PrivateKey as a base64 encoded string.\n * The PrivateKey is encrypted via a password derived PBKDF2 key\n * leveraging the aes-gcm cipher algorithm.\n */\nasync function exporter(privateKey, password) {\n const cipher = _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__.create();\n const encryptedKey = await cipher.encrypt(privateKey, password);\n return multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__.base64.encode(encryptedKey);\n}\n//# sourceMappingURL=exporter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/exporter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/importer.js":
|
||
/*!****************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/importer.js ***!
|
||
\****************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ importer: () => (/* binding */ importer)\n/* harmony export */ });\n/* harmony import */ var multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/bases/base64 */ \"./node_modules/multiformats/dist/src/bases/base64.js\");\n/* harmony import */ var _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ciphers/aes-gcm.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js\");\n\n\n/**\n * Attempts to decrypt a base64 encoded PrivateKey string\n * with the given password. The privateKey must have been exported\n * using the same password and underlying cipher (aes-gcm)\n */\nasync function importer(privateKey, password) {\n const encryptedKey = multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__.base64.decode(privateKey);\n const cipher = _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__.create();\n return cipher.decrypt(encryptedKey, password);\n}\n//# sourceMappingURL=importer.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/importer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/index.js":
|
||
/*!*************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/index.js ***!
|
||
\*************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ generateEphemeralKeyPair: () => (/* reexport safe */ _ephemeral_keys_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ generateKeyPairFromSeed: () => (/* binding */ generateKeyPairFromSeed),\n/* harmony export */ importKey: () => (/* binding */ importKey),\n/* harmony export */ keyStretcher: () => (/* reexport safe */ _key_stretcher_js__WEBPACK_IMPORTED_MODULE_7__.keyStretcher),\n/* harmony export */ keysPBM: () => (/* reexport module object */ _keys_js__WEBPACK_IMPORTED_MODULE_8__),\n/* harmony export */ marshalPrivateKey: () => (/* binding */ marshalPrivateKey),\n/* harmony export */ marshalPublicKey: () => (/* binding */ marshalPublicKey),\n/* harmony export */ supportedKeys: () => (/* binding */ supportedKeys),\n/* harmony export */ unmarshalPrivateKey: () => (/* binding */ unmarshalPrivateKey),\n/* harmony export */ unmarshalPublicKey: () => (/* binding */ unmarshalPublicKey)\n/* harmony export */ });\n/* harmony import */ var node_forge_lib_asn1_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node-forge/lib/asn1.js */ \"./node_modules/node-forge/lib/asn1.js\");\n/* harmony import */ var node_forge_lib_pbe_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-forge/lib/pbe.js */ \"./node_modules/node-forge/lib/pbe.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! node-forge/lib/forge.js */ \"./node_modules/node-forge/lib/forge.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _ed25519_class_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ed25519-class.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js\");\n/* harmony import */ var _ephemeral_keys_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ephemeral-keys.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js\");\n/* harmony import */ var _importer_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./importer.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/importer.js\");\n/* harmony import */ var _key_stretcher_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./key-stretcher.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n/* harmony import */ var _rsa_class_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./rsa-class.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js\");\n/* harmony import */ var _secp256k1_class_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./secp256k1-class.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js\");\n/**\n * @packageDocumentation\n *\n * **Supported Key Types**\n *\n * The {@link generateKeyPair}, {@link marshalPublicKey}, and {@link marshalPrivateKey} functions accept a string `type` argument.\n *\n * Currently the `'RSA'`, `'ed25519'`, and `secp256k1` types are supported, although ed25519 and secp256k1 keys support only signing and verification of messages.\n *\n * For encryption / decryption support, RSA keys should be used.\n */\n\n\n\n// @ts-expect-error types are missing\n\n\n\n\n\n\n\n\n\n\n\n\nconst supportedKeys = {\n rsa: _rsa_class_js__WEBPACK_IMPORTED_MODULE_9__,\n ed25519: _ed25519_class_js__WEBPACK_IMPORTED_MODULE_4__,\n secp256k1: _secp256k1_class_js__WEBPACK_IMPORTED_MODULE_10__\n};\nfunction unsupportedKey(type) {\n const supported = Object.keys(supportedKeys).join(' / ');\n return new _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__.CodeError(`invalid or unsupported key type ${type}. Must be ${supported}`, 'ERR_UNSUPPORTED_KEY_TYPE');\n}\nfunction typeToKey(type) {\n type = type.toLowerCase();\n if (type === 'rsa' || type === 'ed25519' || type === 'secp256k1') {\n return supportedKeys[type];\n }\n throw unsupportedKey(type);\n}\n/**\n * Generates a keypair of the given type and bitsize\n *\n * @param type\n * @param bits - Minimum of 1024\n */\nasync function generateKeyPair(type, bits) {\n return typeToKey(type).generateKeyPair(bits ?? 2048);\n}\n/**\n * Generates a keypair of the given type and bitsize.\n *\n * Seed is a 32 byte uint8array\n */\nasync function generateKeyPairFromSeed(type, seed, bits) {\n if (type.toLowerCase() !== 'ed25519') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__.CodeError('Seed key derivation is unimplemented for RSA or secp256k1', 'ERR_UNSUPPORTED_KEY_DERIVATION_TYPE');\n }\n return _ed25519_class_js__WEBPACK_IMPORTED_MODULE_4__.generateKeyPairFromSeed(seed);\n}\n/**\n * Converts a protobuf serialized public key into its representative object\n */\nfunction unmarshalPublicKey(buf) {\n const decoded = _keys_js__WEBPACK_IMPORTED_MODULE_8__.PublicKey.decode(buf);\n const data = decoded.Data ?? new Uint8Array();\n switch (decoded.Type) {\n case _keys_js__WEBPACK_IMPORTED_MODULE_8__.KeyType.RSA:\n return supportedKeys.rsa.unmarshalRsaPublicKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_8__.KeyType.Ed25519:\n return supportedKeys.ed25519.unmarshalEd25519PublicKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_8__.KeyType.Secp256k1:\n return supportedKeys.secp256k1.unmarshalSecp256k1PublicKey(data);\n default:\n throw unsupportedKey(decoded.Type ?? 'unknown');\n }\n}\n/**\n * Converts a public key object into a protobuf serialized public key\n */\nfunction marshalPublicKey(key, type) {\n type = (type ?? 'rsa').toLowerCase();\n typeToKey(type); // check type\n return key.bytes;\n}\n/**\n * Converts a protobuf serialized private key into its representative object\n */\nasync function unmarshalPrivateKey(buf) {\n const decoded = _keys_js__WEBPACK_IMPORTED_MODULE_8__.PrivateKey.decode(buf);\n const data = decoded.Data ?? new Uint8Array();\n switch (decoded.Type) {\n case _keys_js__WEBPACK_IMPORTED_MODULE_8__.KeyType.RSA:\n return supportedKeys.rsa.unmarshalRsaPrivateKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_8__.KeyType.Ed25519:\n return supportedKeys.ed25519.unmarshalEd25519PrivateKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_8__.KeyType.Secp256k1:\n return supportedKeys.secp256k1.unmarshalSecp256k1PrivateKey(data);\n default:\n throw unsupportedKey(decoded.Type ?? 'RSA');\n }\n}\n/**\n * Converts a private key object into a protobuf serialized private key\n */\nfunction marshalPrivateKey(key, type) {\n type = (type ?? 'rsa').toLowerCase();\n typeToKey(type); // check type\n return key.bytes;\n}\n/**\n * Converts an exported private key into its representative object.\n *\n * Supported formats are 'pem' (RSA only) and 'libp2p-key'.\n */\nasync function importKey(encryptedKey, password) {\n try {\n const key = await (0,_importer_js__WEBPACK_IMPORTED_MODULE_6__.importer)(encryptedKey, password);\n return await unmarshalPrivateKey(key);\n }\n catch (_) {\n // Ignore and try the old pem decrypt\n }\n // Only rsa supports pem right now\n const key = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.pki.decryptRsaPrivateKey(encryptedKey, password);\n if (key === null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__.CodeError('Cannot read the key, most likely the password is wrong or not a RSA key', 'ERR_CANNOT_DECRYPT_PEM');\n }\n let der = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.asn1.toDer(node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.pki.privateKeyToAsn1(key));\n der = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(der.getBytes(), 'ascii');\n return supportedKeys.rsa.unmarshalRsaPrivateKey(der);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/jwk2pem.js":
|
||
/*!***************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/jwk2pem.js ***!
|
||
\***************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ jwk2priv: () => (/* binding */ jwk2priv),\n/* harmony export */ jwk2pub: () => (/* binding */ jwk2pub)\n/* harmony export */ });\n/* harmony import */ var node_forge_lib_rsa_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node-forge/lib/rsa.js */ \"./node_modules/node-forge/lib/rsa.js\");\n/* harmony import */ var node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-forge/lib/forge.js */ \"./node_modules/node-forge/lib/forge.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/util.js\");\n\n// @ts-expect-error types are missing\n\n\nfunction convert(key, types) {\n return types.map(t => (0,_util_js__WEBPACK_IMPORTED_MODULE_2__.base64urlToBigInteger)(key[t]));\n}\nfunction jwk2priv(key) {\n return node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.pki.setRsaPrivateKey(...convert(key, ['n', 'e', 'd', 'p', 'q', 'dp', 'dq', 'qi']));\n}\nfunction jwk2pub(key) {\n return node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.pki.setRsaPublicKey(...convert(key, ['n', 'e']));\n}\n//# sourceMappingURL=jwk2pem.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/jwk2pem.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js":
|
||
/*!*********************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js ***!
|
||
\*********************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ keyStretcher: () => (/* binding */ keyStretcher)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _hmac_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../hmac/index.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js\");\n\n\n\n\nconst cipherMap = {\n 'AES-128': {\n ivSize: 16,\n keySize: 16\n },\n 'AES-256': {\n ivSize: 16,\n keySize: 32\n },\n Blowfish: {\n ivSize: 8,\n keySize: 32\n }\n};\n/**\n * Generates a set of keys for each party by stretching the shared key.\n * (myIV, theirIV, myCipherKey, theirCipherKey, myMACKey, theirMACKey)\n */\nasync function keyStretcher(cipherType, hash, secret) {\n const cipher = cipherMap[cipherType];\n if (cipher == null) {\n const allowed = Object.keys(cipherMap).join(' / ');\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(`unknown cipher type '${cipherType}'. Must be ${allowed}`, 'ERR_INVALID_CIPHER_TYPE');\n }\n if (hash == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('missing hash type', 'ERR_MISSING_HASH_TYPE');\n }\n const cipherKeySize = cipher.keySize;\n const ivSize = cipher.ivSize;\n const hmacKeySize = 20;\n const seed = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)('key expansion');\n const resultLength = 2 * (ivSize + cipherKeySize + hmacKeySize);\n const m = await _hmac_index_js__WEBPACK_IMPORTED_MODULE_2__.create(hash, secret);\n let a = await m.digest(seed);\n const result = [];\n let j = 0;\n while (j < resultLength) {\n const b = await m.digest((0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([a, seed]));\n let todo = b.length;\n if (j + todo > resultLength) {\n todo = resultLength - j;\n }\n result.push(b);\n j += todo;\n a = await m.digest(a);\n }\n const half = resultLength / 2;\n const resultBuffer = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)(result);\n const r1 = resultBuffer.subarray(0, half);\n const r2 = resultBuffer.subarray(half, resultLength);\n const createKey = (res) => ({\n iv: res.subarray(0, ivSize),\n cipherKey: res.subarray(ivSize, ivSize + cipherKeySize),\n macKey: res.subarray(ivSize + cipherKeySize)\n });\n return {\n k1: createKey(r1),\n k2: createKey(r2)\n };\n}\n//# sourceMappingURL=key-stretcher.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/keys.js":
|
||
/*!************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/keys.js ***!
|
||
\************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ KeyType: () => (/* binding */ KeyType),\n/* harmony export */ PrivateKey: () => (/* binding */ PrivateKey),\n/* harmony export */ PublicKey: () => (/* binding */ PublicKey)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar KeyType;\n(function (KeyType) {\n KeyType[\"RSA\"] = \"RSA\";\n KeyType[\"Ed25519\"] = \"Ed25519\";\n KeyType[\"Secp256k1\"] = \"Secp256k1\";\n})(KeyType || (KeyType = {}));\nvar __KeyTypeValues;\n(function (__KeyTypeValues) {\n __KeyTypeValues[__KeyTypeValues[\"RSA\"] = 0] = \"RSA\";\n __KeyTypeValues[__KeyTypeValues[\"Ed25519\"] = 1] = \"Ed25519\";\n __KeyTypeValues[__KeyTypeValues[\"Secp256k1\"] = 2] = \"Secp256k1\";\n})(__KeyTypeValues || (__KeyTypeValues = {}));\n(function (KeyType) {\n KeyType.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__KeyTypeValues);\n };\n})(KeyType || (KeyType = {}));\nvar PublicKey;\n(function (PublicKey) {\n let _codec;\n PublicKey.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.Type != null) {\n w.uint32(8);\n KeyType.codec().encode(obj.Type, w);\n }\n if (obj.Data != null) {\n w.uint32(18);\n w.bytes(obj.Data);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.Type = KeyType.codec().decode(reader);\n break;\n case 2:\n obj.Data = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PublicKey.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PublicKey.codec());\n };\n PublicKey.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PublicKey.codec());\n };\n})(PublicKey || (PublicKey = {}));\nvar PrivateKey;\n(function (PrivateKey) {\n let _codec;\n PrivateKey.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.Type != null) {\n w.uint32(8);\n KeyType.codec().encode(obj.Type, w);\n }\n if (obj.Data != null) {\n w.uint32(18);\n w.bytes(obj.Data);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.Type = KeyType.codec().decode(reader);\n break;\n case 2:\n obj.Data = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PrivateKey.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PrivateKey.codec());\n };\n PrivateKey.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PrivateKey.codec());\n };\n})(PrivateKey || (PrivateKey = {}));\n//# sourceMappingURL=keys.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/keys.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js":
|
||
/*!*******************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js ***!
|
||
\*******************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decrypt: () => (/* binding */ decrypt),\n/* harmony export */ encrypt: () => (/* binding */ encrypt),\n/* harmony export */ generateKey: () => (/* binding */ generateKey),\n/* harmony export */ getRandomValues: () => (/* reexport safe */ _random_bytes_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]),\n/* harmony export */ hashAndSign: () => (/* binding */ hashAndSign),\n/* harmony export */ hashAndVerify: () => (/* binding */ hashAndVerify),\n/* harmony export */ keySize: () => (/* binding */ keySize),\n/* harmony export */ unmarshalPrivateKey: () => (/* binding */ unmarshalPrivateKey),\n/* harmony export */ utils: () => (/* reexport module object */ _rsa_utils_js__WEBPACK_IMPORTED_MODULE_5__)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _random_bytes_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../random-bytes.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/random-bytes.js\");\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/webcrypto.js\");\n/* harmony import */ var _jwk2pem_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./jwk2pem.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/jwk2pem.js\");\n/* harmony import */ var _rsa_utils_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./rsa-utils.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js\");\n\n\n\n\n\n\n\n\nasync function generateKey(bits) {\n const pair = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].get().subtle.generateKey({\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: bits,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n hash: { name: 'SHA-256' }\n }, true, ['sign', 'verify']);\n const keys = await exportKey(pair);\n return {\n privateKey: keys[0],\n publicKey: keys[1]\n };\n}\n// Takes a jwk key\nasync function unmarshalPrivateKey(key) {\n const privateKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].get().subtle.importKey('jwk', key, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, true, ['sign']);\n const pair = [\n privateKey,\n await derivePublicFromPrivate(key)\n ];\n const keys = await exportKey({\n privateKey: pair[0],\n publicKey: pair[1]\n });\n return {\n privateKey: keys[0],\n publicKey: keys[1]\n };\n}\n\nasync function hashAndSign(key, msg) {\n const privateKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].get().subtle.importKey('jwk', key, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, false, ['sign']);\n const sig = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].get().subtle.sign({ name: 'RSASSA-PKCS1-v1_5' }, privateKey, msg instanceof Uint8Array ? msg : msg.subarray());\n return new Uint8Array(sig, 0, sig.byteLength);\n}\nasync function hashAndVerify(key, sig, msg) {\n const publicKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].get().subtle.importKey('jwk', key, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, false, ['verify']);\n return _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].get().subtle.verify({ name: 'RSASSA-PKCS1-v1_5' }, publicKey, sig, msg instanceof Uint8Array ? msg : msg.subarray());\n}\nasync function exportKey(pair) {\n if (pair.privateKey == null || pair.publicKey == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__.CodeError('Private and public key are required', 'ERR_INVALID_PARAMETERS');\n }\n return Promise.all([\n _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].get().subtle.exportKey('jwk', pair.privateKey),\n _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].get().subtle.exportKey('jwk', pair.publicKey)\n ]);\n}\nasync function derivePublicFromPrivate(jwKey) {\n return _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].get().subtle.importKey('jwk', {\n kty: jwKey.kty,\n n: jwKey.n,\n e: jwKey.e\n }, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, true, ['verify']);\n}\n/*\n\nRSA encryption/decryption for the browser with webcrypto workaround\n\"bloody dark magic. webcrypto's why.\"\n\nExplanation:\n - Convert JWK to nodeForge\n - Convert msg Uint8Array to nodeForge buffer: ByteBuffer is a \"binary-string backed buffer\", so let's make our Uint8Array a binary string\n - Convert resulting nodeForge buffer to Uint8Array: it returns a binary string, turn that into a Uint8Array\n\n*/\nfunction convertKey(key, pub, msg, handle) {\n const fkey = pub ? (0,_jwk2pem_js__WEBPACK_IMPORTED_MODULE_4__.jwk2pub)(key) : (0,_jwk2pem_js__WEBPACK_IMPORTED_MODULE_4__.jwk2priv)(key);\n const fmsg = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(msg instanceof Uint8Array ? msg : msg.subarray(), 'ascii');\n const fomsg = handle(fmsg, fkey);\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(fomsg, 'ascii');\n}\nfunction encrypt(key, msg) {\n return convertKey(key, true, msg, (msg, key) => key.encrypt(msg));\n}\nfunction decrypt(key, msg) {\n return convertKey(key, false, msg, (msg, key) => key.decrypt(msg));\n}\nfunction keySize(jwk) {\n if (jwk.kty !== 'RSA') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__.CodeError('invalid key type', 'ERR_INVALID_KEY_TYPE');\n }\n else if (jwk.n == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__.CodeError('invalid key modulus', 'ERR_INVALID_KEY_MODULUS');\n }\n const bytes = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(jwk.n, 'base64url');\n return bytes.length * 8;\n}\n//# sourceMappingURL=rsa-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js":
|
||
/*!*****************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js ***!
|
||
\*****************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MAX_KEY_SIZE: () => (/* binding */ MAX_KEY_SIZE),\n/* harmony export */ RsaPrivateKey: () => (/* binding */ RsaPrivateKey),\n/* harmony export */ RsaPublicKey: () => (/* binding */ RsaPublicKey),\n/* harmony export */ fromJwk: () => (/* binding */ fromJwk),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ unmarshalRsaPrivateKey: () => (/* binding */ unmarshalRsaPrivateKey),\n/* harmony export */ unmarshalRsaPublicKey: () => (/* binding */ unmarshalRsaPublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n/* harmony import */ var node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-forge/lib/forge.js */ \"./node_modules/node-forge/lib/forge.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var node_forge_lib_sha512_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! node-forge/lib/sha512.js */ \"./node_modules/node-forge/lib/sha512.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/util.js\");\n/* harmony import */ var _exporter_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./exporter.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/exporter.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n/* harmony import */ var _rsa_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./rsa.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js\");\n\n\n// @ts-expect-error types are missing\n\n\n\n\n\n\n\n\nconst MAX_KEY_SIZE = 8192;\nclass RsaPublicKey {\n _key;\n constructor(key) {\n this._key = key;\n }\n verify(data, sig) {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.hashAndVerify(this._key, sig, data);\n }\n marshal() {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.utils.jwkToPkix(this._key);\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_7__.PublicKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_7__.KeyType.RSA,\n Data: this.marshal()\n }).subarray();\n }\n encrypt(bytes) {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.encrypt(this._key, bytes);\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.bytes, key.bytes);\n }\n hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(this.bytes);\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_5__.isPromise)(p)) {\n return p.then(({ bytes }) => bytes);\n }\n return p.bytes;\n }\n}\nclass RsaPrivateKey {\n _key;\n _publicKey;\n constructor(key, publicKey) {\n this._key = key;\n this._publicKey = publicKey;\n }\n genSecret() {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.getRandomValues(16);\n }\n sign(message) {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.hashAndSign(this._key, message);\n }\n get public() {\n if (this._publicKey == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.CodeError('public key not provided', 'ERR_PUBKEY_NOT_PROVIDED');\n }\n return new RsaPublicKey(this._publicKey);\n }\n decrypt(bytes) {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.decrypt(this._key, bytes);\n }\n marshal() {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.utils.jwkToPkcs1(this._key);\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_7__.PrivateKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_7__.KeyType.RSA,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.bytes, key.bytes);\n }\n hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(this.bytes);\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_5__.isPromise)(p)) {\n return p.then(({ bytes }) => bytes);\n }\n return p.bytes;\n }\n /**\n * Gets the ID of the key.\n *\n * The key id is the base58 encoding of the SHA-256 multihash of its public key.\n * The public key is a protobuf encoding containing a type and the DER encoding\n * of the PKCS SubjectPublicKeyInfo.\n */\n async id() {\n const hash = await this.public.hash();\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_4__.toString)(hash, 'base58btc');\n }\n /**\n * Exports the key into a password protected PEM format\n */\n async export(password, format = 'pkcs-8') {\n if (format === 'pkcs-8') {\n const buffer = new node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.util.ByteBuffer(this.marshal());\n const asn1 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.asn1.fromDer(buffer);\n const privateKey = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.pki.privateKeyFromAsn1(asn1);\n const options = {\n algorithm: 'aes256',\n count: 10000,\n saltSize: 128 / 8,\n prfAlgorithm: 'sha512'\n };\n return node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.pki.encryptRsaPrivateKey(privateKey, password, options);\n }\n else if (format === 'libp2p-key') {\n return (0,_exporter_js__WEBPACK_IMPORTED_MODULE_6__.exporter)(this.bytes, password);\n }\n else {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.CodeError(`export format '${format}' is not supported`, 'ERR_INVALID_EXPORT_FORMAT');\n }\n }\n}\nasync function unmarshalRsaPrivateKey(bytes) {\n const jwk = _rsa_js__WEBPACK_IMPORTED_MODULE_8__.utils.pkcs1ToJwk(bytes);\n if (_rsa_js__WEBPACK_IMPORTED_MODULE_8__.keySize(jwk) > MAX_KEY_SIZE) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.CodeError('key size is too large', 'ERR_KEY_SIZE_TOO_LARGE');\n }\n const keys = await _rsa_js__WEBPACK_IMPORTED_MODULE_8__.unmarshalPrivateKey(jwk);\n return new RsaPrivateKey(keys.privateKey, keys.publicKey);\n}\nfunction unmarshalRsaPublicKey(bytes) {\n const jwk = _rsa_js__WEBPACK_IMPORTED_MODULE_8__.utils.pkixToJwk(bytes);\n if (_rsa_js__WEBPACK_IMPORTED_MODULE_8__.keySize(jwk) > MAX_KEY_SIZE) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.CodeError('key size is too large', 'ERR_KEY_SIZE_TOO_LARGE');\n }\n return new RsaPublicKey(jwk);\n}\nasync function fromJwk(jwk) {\n if (_rsa_js__WEBPACK_IMPORTED_MODULE_8__.keySize(jwk) > MAX_KEY_SIZE) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.CodeError('key size is too large', 'ERR_KEY_SIZE_TOO_LARGE');\n }\n const keys = await _rsa_js__WEBPACK_IMPORTED_MODULE_8__.unmarshalPrivateKey(jwk);\n return new RsaPrivateKey(keys.privateKey, keys.publicKey);\n}\nasync function generateKeyPair(bits) {\n if (bits > MAX_KEY_SIZE) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.CodeError('key size is too large', 'ERR_KEY_SIZE_TOO_LARGE');\n }\n const keys = await _rsa_js__WEBPACK_IMPORTED_MODULE_8__.generateKey(bits);\n return new RsaPrivateKey(keys.privateKey, keys.publicKey);\n}\n//# sourceMappingURL=rsa-class.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js":
|
||
/*!*****************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js ***!
|
||
\*****************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ jwkToPkcs1: () => (/* binding */ jwkToPkcs1),\n/* harmony export */ jwkToPkix: () => (/* binding */ jwkToPkix),\n/* harmony export */ pkcs1ToJwk: () => (/* binding */ pkcs1ToJwk),\n/* harmony export */ pkixToJwk: () => (/* binding */ pkixToJwk)\n/* harmony export */ });\n/* harmony import */ var node_forge_lib_asn1_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node-forge/lib/asn1.js */ \"./node_modules/node-forge/lib/asn1.js\");\n/* harmony import */ var node_forge_lib_rsa_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-forge/lib/rsa.js */ \"./node_modules/node-forge/lib/rsa.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! node-forge/lib/forge.js */ \"./node_modules/node-forge/lib/forge.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../util.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/util.js\");\n\n\n\n// @ts-expect-error types are missing\n\n\n\n\n// Convert a PKCS#1 in ASN1 DER format to a JWK key\nfunction pkcs1ToJwk(bytes) {\n const asn1 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.asn1.fromDer((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_4__.toString)(bytes, 'ascii'));\n const privateKey = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.pki.privateKeyFromAsn1(asn1);\n // https://tools.ietf.org/html/rfc7518#section-6.3.1\n return {\n kty: 'RSA',\n n: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.bigIntegerToUintBase64url)(privateKey.n),\n e: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.bigIntegerToUintBase64url)(privateKey.e),\n d: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.bigIntegerToUintBase64url)(privateKey.d),\n p: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.bigIntegerToUintBase64url)(privateKey.p),\n q: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.bigIntegerToUintBase64url)(privateKey.q),\n dp: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.bigIntegerToUintBase64url)(privateKey.dP),\n dq: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.bigIntegerToUintBase64url)(privateKey.dQ),\n qi: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.bigIntegerToUintBase64url)(privateKey.qInv),\n alg: 'RS256'\n };\n}\n// Convert a JWK key into PKCS#1 in ASN1 DER format\nfunction jwkToPkcs1(jwk) {\n if (jwk.n == null || jwk.e == null || jwk.d == null || jwk.p == null || jwk.q == null || jwk.dp == null || jwk.dq == null || jwk.qi == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__.CodeError('JWK was missing components', 'ERR_INVALID_PARAMETERS');\n }\n const asn1 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.pki.privateKeyToAsn1({\n n: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBigInteger)(jwk.n),\n e: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBigInteger)(jwk.e),\n d: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBigInteger)(jwk.d),\n p: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBigInteger)(jwk.p),\n q: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBigInteger)(jwk.q),\n dP: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBigInteger)(jwk.dp),\n dQ: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBigInteger)(jwk.dq),\n qInv: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBigInteger)(jwk.qi)\n });\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.asn1.toDer(asn1).getBytes(), 'ascii');\n}\n// Convert a PKCIX in ASN1 DER format to a JWK key\nfunction pkixToJwk(bytes) {\n const asn1 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.asn1.fromDer((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_4__.toString)(bytes, 'ascii'));\n const publicKey = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.pki.publicKeyFromAsn1(asn1);\n return {\n kty: 'RSA',\n n: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.bigIntegerToUintBase64url)(publicKey.n),\n e: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.bigIntegerToUintBase64url)(publicKey.e)\n };\n}\n// Convert a JWK key to PKCIX in ASN1 DER format\nfunction jwkToPkix(jwk) {\n if (jwk.n == null || jwk.e == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__.CodeError('JWK was missing components', 'ERR_INVALID_PARAMETERS');\n }\n const asn1 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.pki.publicKeyToAsn1({\n n: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBigInteger)(jwk.n),\n e: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBigInteger)(jwk.e)\n });\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.asn1.toDer(asn1).getBytes(), 'ascii');\n}\n//# sourceMappingURL=rsa-utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/secp256k1-browser.js":
|
||
/*!*************************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/secp256k1-browser.js ***!
|
||
\*************************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compressPublicKey: () => (/* binding */ compressPublicKey),\n/* harmony export */ computePublicKey: () => (/* binding */ computePublicKey),\n/* harmony export */ decompressPublicKey: () => (/* binding */ decompressPublicKey),\n/* harmony export */ generateKey: () => (/* binding */ generateKey),\n/* harmony export */ hashAndSign: () => (/* binding */ hashAndSign),\n/* harmony export */ hashAndVerify: () => (/* binding */ hashAndVerify),\n/* harmony export */ privateKeyLength: () => (/* binding */ PRIVATE_KEY_BYTE_LENGTH),\n/* harmony export */ validatePrivateKey: () => (/* binding */ validatePrivateKey),\n/* harmony export */ validatePublicKey: () => (/* binding */ validatePublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @noble/curves/secp256k1 */ \"./node_modules/@noble/curves/esm/secp256k1.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/util.js\");\n\n\n\n\nconst PRIVATE_KEY_BYTE_LENGTH = 32;\n\nfunction generateKey() {\n return _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_2__.secp256k1.utils.randomPrivateKey();\n}\n/**\n * Hash and sign message with private key\n */\nfunction hashAndSign(key, msg) {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(msg instanceof Uint8Array ? msg : msg.subarray());\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_1__.isPromise)(p)) {\n return p.then(({ digest }) => _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_2__.secp256k1.sign(digest, key).toDERRawBytes())\n .catch(err => {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_INPUT');\n });\n }\n try {\n return _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_2__.secp256k1.sign(p.digest, key).toDERRawBytes();\n }\n catch (err) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_INPUT');\n }\n}\n/**\n * Hash message and verify signature with public key\n */\nfunction hashAndVerify(key, sig, msg) {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(msg instanceof Uint8Array ? msg : msg.subarray());\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_1__.isPromise)(p)) {\n return p.then(({ digest }) => _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_2__.secp256k1.verify(sig, digest, key))\n .catch(err => {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_INPUT');\n });\n }\n try {\n return _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_2__.secp256k1.verify(sig, p.digest, key);\n }\n catch (err) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_INPUT');\n }\n}\nfunction compressPublicKey(key) {\n const point = _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_2__.secp256k1.ProjectivePoint.fromHex(key).toRawBytes(true);\n return point;\n}\nfunction decompressPublicKey(key) {\n const point = _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_2__.secp256k1.ProjectivePoint.fromHex(key).toRawBytes(false);\n return point;\n}\nfunction validatePrivateKey(key) {\n try {\n _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_2__.secp256k1.getPublicKey(key, true);\n }\n catch (err) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_PRIVATE_KEY');\n }\n}\nfunction validatePublicKey(key) {\n try {\n _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_2__.secp256k1.ProjectivePoint.fromHex(key);\n }\n catch (err) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_PUBLIC_KEY');\n }\n}\nfunction computePublicKey(privateKey) {\n try {\n return _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_2__.secp256k1.getPublicKey(privateKey, true);\n }\n catch (err) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_PRIVATE_KEY');\n }\n}\n//# sourceMappingURL=secp256k1-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/secp256k1-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js":
|
||
/*!***********************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js ***!
|
||
\***********************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Secp256k1PrivateKey: () => (/* binding */ Secp256k1PrivateKey),\n/* harmony export */ Secp256k1PublicKey: () => (/* binding */ Secp256k1PublicKey),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ unmarshalSecp256k1PrivateKey: () => (/* binding */ unmarshalSecp256k1PrivateKey),\n/* harmony export */ unmarshalSecp256k1PublicKey: () => (/* binding */ unmarshalSecp256k1PublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/util.js\");\n/* harmony import */ var _exporter_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./exporter.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/exporter.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n/* harmony import */ var _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./secp256k1.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/secp256k1-browser.js\");\n\n\n\n\n\n\n\n\nclass Secp256k1PublicKey {\n _key;\n constructor(key) {\n _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.validatePublicKey(key);\n this._key = key;\n }\n verify(data, sig) {\n return _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.hashAndVerify(this._key, sig, data);\n }\n marshal() {\n return _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.compressPublicKey(this._key);\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_5__.PublicKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_5__.KeyType.Secp256k1,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(this.bytes, key.bytes);\n }\n async hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(this.bytes);\n let bytes;\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_3__.isPromise)(p)) {\n ({ bytes } = await p);\n }\n else {\n bytes = p.bytes;\n }\n return bytes;\n }\n}\nclass Secp256k1PrivateKey {\n _key;\n _publicKey;\n constructor(key, publicKey) {\n this._key = key;\n this._publicKey = publicKey ?? _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.computePublicKey(key);\n _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.validatePrivateKey(this._key);\n _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.validatePublicKey(this._publicKey);\n }\n sign(message) {\n return _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.hashAndSign(this._key, message);\n }\n get public() {\n return new Secp256k1PublicKey(this._publicKey);\n }\n marshal() {\n return this._key;\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_5__.PrivateKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_5__.KeyType.Secp256k1,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(this.bytes, key.bytes);\n }\n hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(this.bytes);\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_3__.isPromise)(p)) {\n return p.then(({ bytes }) => bytes);\n }\n return p.bytes;\n }\n /**\n * Gets the ID of the key.\n *\n * The key id is the base58 encoding of the SHA-256 multihash of its public key.\n * The public key is a protobuf encoding containing a type and the DER encoding\n * of the PKCS SubjectPublicKeyInfo.\n */\n async id() {\n const hash = await this.public.hash();\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(hash, 'base58btc');\n }\n /**\n * Exports the key into a password protected `format`\n */\n async export(password, format = 'libp2p-key') {\n if (format === 'libp2p-key') {\n return (0,_exporter_js__WEBPACK_IMPORTED_MODULE_4__.exporter)(this.bytes, password);\n }\n else {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__.CodeError(`export format '${format}' is not supported`, 'ERR_INVALID_EXPORT_FORMAT');\n }\n }\n}\nfunction unmarshalSecp256k1PrivateKey(bytes) {\n return new Secp256k1PrivateKey(bytes);\n}\nfunction unmarshalSecp256k1PublicKey(bytes) {\n return new Secp256k1PublicKey(bytes);\n}\nasync function generateKeyPair() {\n const privateKeyBytes = _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.generateKey();\n return new Secp256k1PrivateKey(privateKeyBytes);\n}\n//# sourceMappingURL=secp256k1-class.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/random-bytes.js":
|
||
/*!***************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/random-bytes.js ***!
|
||
\***************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ randomBytes)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/hashes/utils */ \"./node_modules/@noble/hashes/esm/utils.js\");\n\n\n/**\n * Generates a Uint8Array with length `number` populated by random bytes\n */\nfunction randomBytes(length) {\n if (isNaN(length) || length <= 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('random bytes length must be a Number bigger than 0', 'ERR_INVALID_LENGTH');\n }\n return (0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__.randomBytes)(length);\n}\n//# sourceMappingURL=random-bytes.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/random-bytes.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/util.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/util.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base64urlToBigInteger: () => (/* binding */ base64urlToBigInteger),\n/* harmony export */ base64urlToBuffer: () => (/* binding */ base64urlToBuffer),\n/* harmony export */ bigIntegerToUintBase64url: () => (/* binding */ bigIntegerToUintBase64url),\n/* harmony export */ isPromise: () => (/* binding */ isPromise)\n/* harmony export */ });\n/* harmony import */ var node_forge_lib_util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node-forge/lib/util.js */ \"./node_modules/node-forge/lib/util.js\");\n/* harmony import */ var node_forge_lib_jsbn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-forge/lib/jsbn.js */ \"./node_modules/node-forge/lib/jsbn.js\");\n/* harmony import */ var node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! node-forge/lib/forge.js */ \"./node_modules/node-forge/lib/forge.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/to-string.js\");\n\n\n// @ts-expect-error types are missing\n\n\n\n\nfunction bigIntegerToUintBase64url(num, len) {\n // Call `.abs()` to convert to unsigned\n let buf = Uint8Array.from(num.abs().toByteArray()); // toByteArray converts to big endian\n // toByteArray() gives us back a signed array, which will include a leading 0\n // byte if the most significant bit of the number is 1:\n // https://docs.microsoft.com/en-us/windows/win32/seccertenroll/about-integer\n // Our number will always be positive so we should remove the leading padding.\n buf = buf[0] === 0 ? buf.subarray(1) : buf;\n if (len != null) {\n if (buf.length > len)\n throw new Error('byte array longer than desired length');\n buf = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_3__.concat)([new Uint8Array(len - buf.length), buf]);\n }\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__.toString)(buf, 'base64url');\n}\n// Convert a base64url encoded string to a BigInteger\nfunction base64urlToBigInteger(str) {\n const buf = base64urlToBuffer(str);\n return new node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.jsbn.BigInteger((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__.toString)(buf, 'base16'), 16);\n}\nfunction base64urlToBuffer(str, len) {\n let buf = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(str, 'base64urlpad');\n if (len != null) {\n if (buf.length > len)\n throw new Error('byte array longer than desired length');\n buf = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_3__.concat)([new Uint8Array(len - buf.length), buf]);\n }\n return buf;\n}\nfunction isPromise(thing) {\n if (thing == null) {\n return false;\n }\n return typeof thing.then === 'function' &&\n typeof thing.catch === 'function' &&\n typeof thing.finally === 'function';\n}\n//# sourceMappingURL=util.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/util.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/webcrypto.js":
|
||
/*!************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/webcrypto.js ***!
|
||
\************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* eslint-env browser */\n// Check native crypto exists and is enabled (In insecure context `self.crypto`\n// exists but `self.crypto.subtle` does not).\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n get(win = globalThis) {\n const nativeCrypto = win.crypto;\n if (nativeCrypto == null || nativeCrypto.subtle == null) {\n throw Object.assign(new Error('Missing Web Crypto API. ' +\n 'The most likely cause of this error is that this page is being accessed ' +\n 'from an insecure context (i.e. not HTTPS). For more information and ' +\n 'possible resolutions see ' +\n 'https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api'), { code: 'ERR_MISSING_WEB_CRYPTO' });\n }\n return nativeCrypto;\n }\n});\n//# sourceMappingURL=webcrypto.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto/dist/src/webcrypto.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/compare.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/compare.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compare: () => (/* binding */ compare)\n/* harmony export */ });\n/**\n * Can be used with Array.sort to sort and array with Uint8Array entries\n */\nfunction compare(a, b) {\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] < b[i]) {\n return -1;\n }\n if (a[i] > b[i]) {\n return 1;\n }\n }\n if (a.byteLength > b.byteLength) {\n return 1;\n }\n if (a.byteLength < b.byteLength) {\n return -1;\n }\n return 0;\n}\n//# sourceMappingURL=compare.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/compare.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/concat.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/concat.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ concat: () => (/* binding */ concat)\n/* harmony export */ });\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #alloc */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #util/as-uint8array */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Uint8Arrays\n */\nfunction concat(arrays, length) {\n if (length == null) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n const output = (0,_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(length);\n let offset = 0;\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n return (0,_util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(output);\n}\n//# sourceMappingURL=concat.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/concat.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/equals.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/equals.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!***********************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\***********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/index.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/index.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compare: () => (/* reexport safe */ _compare__WEBPACK_IMPORTED_MODULE_2__.compare),\n/* harmony export */ concat: () => (/* reexport safe */ _concat__WEBPACK_IMPORTED_MODULE_3__.concat),\n/* harmony export */ equals: () => (/* reexport safe */ _equals_js__WEBPACK_IMPORTED_MODULE_0__.equals),\n/* harmony export */ fromString: () => (/* reexport safe */ _from_string__WEBPACK_IMPORTED_MODULE_4__.fromString),\n/* harmony export */ toString: () => (/* reexport safe */ _to_string__WEBPACK_IMPORTED_MODULE_5__.toString),\n/* harmony export */ xor: () => (/* reexport safe */ _xor_js__WEBPACK_IMPORTED_MODULE_1__.xor)\n/* harmony export */ });\n/* harmony import */ var _equals_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./equals.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _xor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./xor.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/xor.js\");\n/* harmony import */ var _compare__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #compare */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/compare.js\");\n/* harmony import */ var _concat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #concat */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var _from_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #from-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _to_string__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #to-string */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/to-string.js\");\n/**\n * @packageDocumentation\n *\n * `Uint8Array`s bring memory-efficient(ish) byte handling to browsers - they are similar to Node.js `Buffer`s but lack a lot of the utility methods present on that class.\n *\n * This module exports a number of function that let you do common operations - joining Uint8Arrays together, seeing if they have the same contents etc.\n *\n * Since Node.js `Buffer`s are also `Uint8Array`s, it falls back to `Buffer` internally where it makes sense for performance reasons.\n *\n * ## alloc(size)\n *\n * Create a new `Uint8Array`. When running under Node.js, `Buffer` will be used in preference to `Uint8Array`.\n *\n * ### Example\n *\n * ```js\n * import { alloc } from 'uint8arrays/alloc'\n *\n * const buf = alloc(100)\n * ```\n *\n * ## allocUnsafe(size)\n *\n * Create a new `Uint8Array`. When running under Node.js, `Buffer` will be used in preference to `Uint8Array`.\n *\n * On platforms that support it, memory referenced by the returned `Uint8Array` will not be initialized.\n *\n * ### Example\n *\n * ```js\n * import { allocUnsafe } from 'uint8arrays/alloc'\n *\n * const buf = allocUnsafe(100)\n * ```\n *\n * ## compare(a, b)\n *\n * Compare two `Uint8Arrays`\n *\n * ### Example\n *\n * ```js\n * import { compare } from 'uint8arrays/compare'\n *\n * const arrays = [\n * Uint8Array.from([3, 4, 5]),\n * Uint8Array.from([0, 1, 2])\n * ]\n *\n * const sorted = arrays.sort(compare)\n *\n * console.info(sorted)\n * // [\n * // Uint8Array[0, 1, 2]\n * // Uint8Array[3, 4, 5]\n * // ]\n * ```\n *\n * ## concat(arrays, \\[length])\n *\n * Concatenate one or more `Uint8Array`s and return a `Uint8Array` with their contents.\n *\n * If you know the length of the arrays, pass it as a second parameter, otherwise it will be calculated by traversing the list of arrays.\n *\n * ### Example\n *\n * ```js\n * import { concat } from 'uint8arrays/concat'\n *\n * const arrays = [\n * Uint8Array.from([0, 1, 2]),\n * Uint8Array.from([3, 4, 5])\n * ]\n *\n * const all = concat(arrays, 6)\n *\n * console.info(all)\n * // Uint8Array[0, 1, 2, 3, 4, 5]\n * ```\n *\n * ## equals(a, b)\n *\n * Returns true if the two arrays are the same array or if they have the same length and contents.\n *\n * ### Example\n *\n * ```js\n * import { equals } from 'uint8arrays/equals'\n *\n * const a = Uint8Array.from([0, 1, 2])\n * const b = Uint8Array.from([3, 4, 5])\n * const c = Uint8Array.from([0, 1, 2])\n *\n * console.info(equals(a, b)) // false\n * console.info(equals(a, c)) // true\n * console.info(equals(a, a)) // true\n * ```\n *\n * ## fromString(string, encoding = 'utf8')\n *\n * Returns a new `Uint8Array` created from the passed string and interpreted as the passed encoding.\n *\n * Supports `utf8` and any of the [multibase encodings](https://github.com/multiformats/multibase/blob/master/multibase.csv) as implemented by the [multiformats module](https://www.npmjs.com/package/multiformats).\n *\n * ### Example\n *\n * ```js\n * import { fromString } from 'uint8arrays/from-string'\n *\n * console.info(fromString('hello world')) // Uint8Array[104, 101 ...\n * console.info(fromString('00010203aabbcc', 'base16')) // Uint8Array[0, 1 ...\n * console.info(fromString('AAECA6q7zA', 'base64')) // Uint8Array[0, 1 ...\n * console.info(fromString('01234', 'ascii')) // Uint8Array[48, 49 ...\n * ```\n *\n * ## toString(array, encoding = 'utf8')\n *\n * Returns a string created from the passed `Uint8Array` in the passed encoding.\n *\n * Supports `utf8` and any of the [multibase encodings](https://github.com/multiformats/multibase/blob/master/multibase.csv) as implemented by the [multiformats module](https://www.npmjs.com/package/multiformats).\n *\n * ### Example\n *\n * ```js\n * import { toString } from 'uint8arrays/to-string'\n *\n * console.info(toString(Uint8Array.from([104, 101...]))) // 'hello world'\n * console.info(toString(Uint8Array.from([0, 1, 2...]), 'base16')) // '00010203aabbcc'\n * console.info(toString(Uint8Array.from([0, 1, 2...]), 'base64')) // 'AAECA6q7zA'\n * console.info(toString(Uint8Array.from([48, 49, 50...]), 'ascii')) // '01234'\n * ```\n *\n * ## xor(a, b)\n *\n * Returns a `Uint8Array` containing `a` and `b` xored together.\n *\n * ### Example\n *\n * ```js\n * import { xor } from 'uint8arrays/xor'\n *\n * console.info(xor(Uint8Array.from([1, 0]), Uint8Array.from([0, 1]))) // Uint8Array[1, 1]\n * ```\n */\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!*********************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\*********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/util/as-uint8array.js":
|
||
/*!******************************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/util/as-uint8array.js ***!
|
||
\******************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asUint8Array: () => (/* binding */ asUint8Array)\n/* harmony export */ });\n/**\n * To guarantee Uint8Array semantics, convert nodejs Buffers\n * into vanilla Uint8Arrays\n */\nfunction asUint8Array(buf) {\n return buf;\n}\n//# sourceMappingURL=as-uint8array.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/util/as-uint8array.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!**********************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\**********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/xor.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/xor.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ xor: () => (/* binding */ xor)\n/* harmony export */ });\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #alloc */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #util/as-uint8array */ \"./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns the xor distance between two arrays\n */\nfunction xor(a, b) {\n if (a.length !== b.length) {\n throw new Error('Inputs should have the same length');\n }\n const result = (0,_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(a.length);\n for (let i = 0; i < a.length; i++) {\n result[i] = a[i] ^ b[i];\n }\n return (0,_util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(result);\n}\n//# sourceMappingURL=xor.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/libp2p-noise/node_modules/uint8arrays/dist/src/xor.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/netmask/dist/src/cidr.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@chainsafe/netmask/dist/src/cidr.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cidrMask: () => (/* binding */ cidrMask),\n/* harmony export */ parseCidr: () => (/* binding */ parseCidr)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/is-ip/parse */ \"./node_modules/@chainsafe/is-ip/lib/parse.js\");\n/* harmony import */ var _ip_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ip.js */ \"./node_modules/@chainsafe/netmask/dist/src/ip.js\");\n\n\nfunction parseCidr(s) {\n const [address, maskString] = s.split(\"/\");\n if (!address || !maskString)\n throw new Error(\"Failed to parse given CIDR: \" + s);\n let ipLength = _ip_js__WEBPACK_IMPORTED_MODULE_1__.IPv4Len;\n let ip = (0,_chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__.parseIPv4)(address);\n if (ip == null) {\n ipLength = _ip_js__WEBPACK_IMPORTED_MODULE_1__.IPv6Len;\n ip = (0,_chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__.parseIPv6)(address);\n if (ip == null)\n throw new Error(\"Failed to parse given CIDR: \" + s);\n }\n const m = parseInt(maskString, 10);\n if (Number.isNaN(m) ||\n String(m).length !== maskString.length ||\n m < 0 ||\n m > ipLength * 8) {\n throw new Error(\"Failed to parse given CIDR: \" + s);\n }\n const mask = cidrMask(m, 8 * ipLength);\n return {\n network: (0,_ip_js__WEBPACK_IMPORTED_MODULE_1__.maskIp)(ip, mask),\n mask,\n };\n}\nfunction cidrMask(ones, bits) {\n if (bits !== 8 * _ip_js__WEBPACK_IMPORTED_MODULE_1__.IPv4Len && bits !== 8 * _ip_js__WEBPACK_IMPORTED_MODULE_1__.IPv6Len)\n throw new Error(\"Invalid CIDR mask\");\n if (ones < 0 || ones > bits)\n throw new Error(\"Invalid CIDR mask\");\n const l = bits / 8;\n const m = new Uint8Array(l);\n for (let i = 0; i < l; i++) {\n if (ones >= 8) {\n m[i] = 0xff;\n ones -= 8;\n continue;\n }\n m[i] = 255 - (0xff >> ones);\n ones = 0;\n }\n return m;\n}\n//# sourceMappingURL=cidr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/netmask/dist/src/cidr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/netmask/dist/src/index.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@chainsafe/netmask/dist/src/index.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IpNet: () => (/* reexport safe */ _ipnet_js__WEBPACK_IMPORTED_MODULE_0__.IpNet),\n/* harmony export */ cidrContains: () => (/* binding */ cidrContains),\n/* harmony export */ iPv4FromIPv6: () => (/* reexport safe */ _ip_js__WEBPACK_IMPORTED_MODULE_2__.iPv4FromIPv6),\n/* harmony export */ ipToString: () => (/* reexport safe */ _util_js__WEBPACK_IMPORTED_MODULE_1__.ipToString),\n/* harmony export */ isIPv4mappedIPv6: () => (/* reexport safe */ _ip_js__WEBPACK_IMPORTED_MODULE_2__.isIPv4mappedIPv6),\n/* harmony export */ maskIp: () => (/* reexport safe */ _ip_js__WEBPACK_IMPORTED_MODULE_2__.maskIp),\n/* harmony export */ parseCidr: () => (/* reexport safe */ _cidr_js__WEBPACK_IMPORTED_MODULE_3__.parseCidr)\n/* harmony export */ });\n/* harmony import */ var _ipnet_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ipnet.js */ \"./node_modules/@chainsafe/netmask/dist/src/ipnet.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@chainsafe/netmask/dist/src/util.js\");\n/* harmony import */ var _ip_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ip.js */ \"./node_modules/@chainsafe/netmask/dist/src/ip.js\");\n/* harmony import */ var _cidr_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./cidr.js */ \"./node_modules/@chainsafe/netmask/dist/src/cidr.js\");\n\n\n\n\n\n/**\n * Checks if cidr block contains ip address\n * @param cidr ipv4 or ipv6 formatted cidr . Example 198.51.100.14/24 or 2001:db8::/48\n * @param ip ipv4 or ipv6 address Example 198.51.100.14 or 2001:db8::\n *\n */\nfunction cidrContains(cidr, ip) {\n const ipnet = new _ipnet_js__WEBPACK_IMPORTED_MODULE_0__.IpNet(cidr);\n return ipnet.contains(ip);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/netmask/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/netmask/dist/src/ip.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/@chainsafe/netmask/dist/src/ip.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IPv4Len: () => (/* binding */ IPv4Len),\n/* harmony export */ IPv6Len: () => (/* binding */ IPv6Len),\n/* harmony export */ containsIp: () => (/* binding */ containsIp),\n/* harmony export */ iPv4FromIPv6: () => (/* binding */ iPv4FromIPv6),\n/* harmony export */ ipv4Prefix: () => (/* binding */ ipv4Prefix),\n/* harmony export */ isIPv4mappedIPv6: () => (/* binding */ isIPv4mappedIPv6),\n/* harmony export */ maskIp: () => (/* binding */ maskIp),\n/* harmony export */ maxIPv6Octet: () => (/* binding */ maxIPv6Octet)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/is-ip/parse */ \"./node_modules/@chainsafe/is-ip/lib/parse.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@chainsafe/netmask/dist/src/util.js\");\n\n\nconst IPv4Len = 4;\nconst IPv6Len = 16;\nconst maxIPv6Octet = parseInt(\"0xFFFF\", 16);\nconst ipv4Prefix = new Uint8Array([\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255,\n]);\nfunction maskIp(ip, mask) {\n if (mask.length === IPv6Len && ip.length === IPv4Len && (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.allFF)(mask, 0, 11)) {\n mask = mask.slice(12);\n }\n if (mask.length === IPv4Len &&\n ip.length === IPv6Len &&\n (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.deepEqual)(ip, ipv4Prefix, 0, 11)) {\n ip = ip.slice(12);\n }\n const n = ip.length;\n if (n != mask.length) {\n throw new Error(\"Failed to mask ip\");\n }\n const out = new Uint8Array(n);\n for (let i = 0; i < n; i++) {\n out[i] = ip[i] & mask[i];\n }\n return out;\n}\nfunction containsIp(net, ip) {\n if (typeof ip === \"string\") {\n ip = (0,_chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__.parseIP)(ip);\n }\n if (ip == null)\n throw new Error(\"Invalid ip\");\n if (ip.length !== net.network.length) {\n return false;\n }\n for (let i = 0; i < ip.length; i++) {\n if ((net.network[i] & net.mask[i]) !== (ip[i] & net.mask[i])) {\n return false;\n }\n }\n return true;\n}\nfunction iPv4FromIPv6(ip) {\n if (!isIPv4mappedIPv6(ip)) {\n throw new Error(\"Must have 0xffff prefix\");\n }\n return ip.slice(12);\n}\nfunction isIPv4mappedIPv6(ip) {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.deepEqual)(ip, ipv4Prefix, 0, 11);\n}\n//# sourceMappingURL=ip.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/netmask/dist/src/ip.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/netmask/dist/src/ipnet.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@chainsafe/netmask/dist/src/ipnet.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IpNet: () => (/* binding */ IpNet)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/is-ip/parse */ \"./node_modules/@chainsafe/is-ip/lib/parse.js\");\n/* harmony import */ var _cidr_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cidr.js */ \"./node_modules/@chainsafe/netmask/dist/src/cidr.js\");\n/* harmony import */ var _ip_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ip.js */ \"./node_modules/@chainsafe/netmask/dist/src/ip.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@chainsafe/netmask/dist/src/util.js\");\n\n\n\n\nclass IpNet {\n /**\n *\n * @param ipOrCidr either network ip or full cidr address\n * @param mask in case ipOrCidr is network this can be either mask in decimal format or as ip address\n */\n constructor(ipOrCidr, mask) {\n if (mask == null) {\n ({ network: this.network, mask: this.mask } = (0,_cidr_js__WEBPACK_IMPORTED_MODULE_1__.parseCidr)(ipOrCidr));\n }\n else {\n const ipResult = (0,_chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__.parseIP)(ipOrCidr);\n if (ipResult == null) {\n throw new Error(\"Failed to parse network\");\n }\n mask = String(mask);\n const m = parseInt(mask, 10);\n if (Number.isNaN(m) ||\n String(m).length !== mask.length ||\n m < 0 ||\n m > ipResult.length * 8) {\n const maskResult = (0,_chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__.parseIP)(mask);\n if (maskResult == null) {\n throw new Error(\"Failed to parse mask\");\n }\n this.mask = maskResult;\n }\n else {\n this.mask = (0,_cidr_js__WEBPACK_IMPORTED_MODULE_1__.cidrMask)(m, 8 * ipResult.length);\n }\n this.network = (0,_ip_js__WEBPACK_IMPORTED_MODULE_2__.maskIp)(ipResult, this.mask);\n }\n }\n /**\n * Checks if netmask contains ip address\n * @param ip\n * @returns\n */\n contains(ip) {\n return (0,_ip_js__WEBPACK_IMPORTED_MODULE_2__.containsIp)({ network: this.network, mask: this.mask }, ip);\n }\n /**Serializes back to string format */\n toString() {\n const l = (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.simpleMaskLength)(this.mask);\n const mask = l !== -1 ? String(l) : (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.maskToHex)(this.mask);\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.ipToString)(this.network) + \"/\" + mask;\n }\n}\n//# sourceMappingURL=ipnet.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/netmask/dist/src/ipnet.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@chainsafe/netmask/dist/src/util.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@chainsafe/netmask/dist/src/util.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ allFF: () => (/* binding */ allFF),\n/* harmony export */ deepEqual: () => (/* binding */ deepEqual),\n/* harmony export */ ipToString: () => (/* binding */ ipToString),\n/* harmony export */ maskToHex: () => (/* binding */ maskToHex),\n/* harmony export */ simpleMaskLength: () => (/* binding */ simpleMaskLength)\n/* harmony export */ });\n/* harmony import */ var _ip_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ip.js */ \"./node_modules/@chainsafe/netmask/dist/src/ip.js\");\n\nfunction allFF(a, from, to) {\n let i = 0;\n for (const e of a) {\n if (i < from)\n continue;\n if (i > to)\n break;\n if (e !== 0xff)\n return false;\n i++;\n }\n return true;\n}\nfunction deepEqual(a, b, from, to) {\n let i = 0;\n for (const e of a) {\n if (i < from)\n continue;\n if (i > to)\n break;\n if (e !== b[i])\n return false;\n i++;\n }\n return true;\n}\n/***\n * Returns long ip format\n */\nfunction ipToString(ip) {\n switch (ip.length) {\n case _ip_js__WEBPACK_IMPORTED_MODULE_0__.IPv4Len: {\n return ip.join(\".\");\n }\n case _ip_js__WEBPACK_IMPORTED_MODULE_0__.IPv6Len: {\n const result = [];\n for (let i = 0; i < ip.length; i++) {\n if (i % 2 === 0) {\n result.push(ip[i].toString(16).padStart(2, \"0\") +\n ip[i + 1].toString(16).padStart(2, \"0\"));\n }\n }\n return result.join(\":\");\n }\n default: {\n throw new Error(\"Invalid ip length\");\n }\n }\n}\n/**\n * If mask is a sequence of 1 bits followed by 0 bits, return number of 1 bits else -1\n */\nfunction simpleMaskLength(mask) {\n let ones = 0;\n // eslint-disable-next-line prefer-const\n for (let [index, byte] of mask.entries()) {\n if (byte === 0xff) {\n ones += 8;\n continue;\n }\n while ((byte & 0x80) != 0) {\n ones++;\n byte = byte << 1;\n }\n if ((byte & 0x80) != 0) {\n return -1;\n }\n for (let i = index + 1; i < mask.length; i++) {\n if (mask[i] != 0) {\n return -1;\n }\n }\n break;\n }\n return ones;\n}\nfunction maskToHex(mask) {\n let hex = \"0x\";\n for (const byte of mask) {\n hex += (byte >> 4).toString(16) + (byte & 0x0f).toString(16);\n }\n return hex;\n}\n//# sourceMappingURL=util.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@chainsafe/netmask/dist/src/util.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@leichtgewicht/base64-codec/index.mjs":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@leichtgewicht/base64-codec/index.mjs ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PREFERS_NO_PADDING: () => (/* binding */ PREFERS_NO_PADDING),\n/* harmony export */ PREFERS_PADDING: () => (/* binding */ PREFERS_PADDING),\n/* harmony export */ base64: () => (/* binding */ base64),\n/* harmony export */ base64URL: () => (/* binding */ base64URL),\n/* harmony export */ make: () => (/* binding */ make)\n/* harmony export */ });\nconst PREFERS_PADDING = 1\nconst PREFERS_NO_PADDING = 2\n\nfunction make (name, charset, padding, paddingMode) {\n if (charset.length !== 64) {\n throw new Error(`Charset needs to be 64 characters long! (${charset.length})`)\n }\n const byCharCode = new Uint8Array(256)\n const byNum = new Uint8Array(64)\n for (let i = 0; i < 64; i += 1) {\n const code = charset.charCodeAt(i)\n if (code > 255) {\n throw new Error(`Character #${i} in charset [code=${code}, char=${charset.charAt(i)}] is too high! (max=255)`)\n }\n if (byCharCode[code] !== 0) {\n throw new Error(`Character [code=${code}, char=${charset.charAt(i)}] is more than once in the charset!`)\n }\n byCharCode[code] = i\n byNum[i] = code\n }\n const padCode = padding.charCodeAt(0)\n const codec = {\n name,\n encodingLength (str) {\n const strLen = str.length\n const len = strLen * 0.75 | 0\n if (str.charCodeAt(strLen - 1) === padCode) {\n if (str.charCodeAt(strLen - 2) === padCode) {\n return len - 2\n }\n return len - 1\n }\n return len\n },\n encode (str, buffer, offset) {\n if (buffer === null || buffer === undefined) {\n buffer = new Uint8Array(codec.encodingLength(str))\n }\n if (offset === null || offset === undefined) {\n offset = 0\n }\n\n let strLen = str.length\n if (str.charCodeAt(strLen - 1) === padCode) {\n if (str.charCodeAt(strLen - 2) === padCode) {\n strLen -= 2\n } else {\n strLen -= 1\n }\n }\n\n const padding = strLen % 4\n const safeLen = strLen - padding\n\n let off = offset\n let i = 0\n while (i < safeLen) {\n const code =\n (byCharCode[str.charCodeAt(i)] << 18) |\n (byCharCode[str.charCodeAt(i + 1)] << 12) |\n (byCharCode[str.charCodeAt(i + 2)] << 6) |\n byCharCode[str.charCodeAt(i + 3)]\n buffer[off++] = code >> 16\n buffer[off++] = code >> 8\n buffer[off++] = code\n i += 4\n }\n\n if (padding === 3) {\n const code =\n (byCharCode[str.charCodeAt(i)] << 10) |\n (byCharCode[str.charCodeAt(i + 1)] << 4) |\n (byCharCode[str.charCodeAt(i + 2)] >> 2)\n buffer[off++] = code >> 8\n buffer[off++] = code\n } else if (padding === 2) {\n buffer[off++] = (byCharCode[str.charCodeAt(i)] << 2) |\n (byCharCode[str.charCodeAt(i + 1)] >> 4)\n }\n\n codec.encode.bytes = off - offset\n return buffer\n },\n decode (buffer, start, end) {\n if (start === null || start === undefined) {\n start = 0\n }\n if (end === null || end === undefined) {\n end = buffer.length\n }\n\n const length = end - start\n const pad = length % 3\n const safeEnd = start + length - pad\n const codes = []\n for (let off = start; off < safeEnd; off += 3) {\n const num = (buffer[off] << 16) | ((buffer[off + 1] << 8)) | buffer[off + 2]\n codes.push(\n byNum[num >> 18 & 0x3F],\n byNum[num >> 12 & 0x3F],\n byNum[num >> 6 & 0x3F],\n byNum[num & 0x3F]\n )\n }\n\n if (pad === 2) {\n const num = (buffer[end - 2] << 8) + buffer[end - 1]\n codes.push(\n byNum[num >> 10],\n byNum[(num >> 4) & 0x3F],\n byNum[(num << 2) & 0x3F]\n )\n if (paddingMode === PREFERS_PADDING) {\n codes.push(padCode)\n }\n } else if (pad === 1) {\n const num = buffer[end - 1]\n codes.push(\n byNum[num >> 2],\n byNum[(num << 4) & 0x3F]\n )\n if (paddingMode === PREFERS_PADDING) {\n codes.push(padCode, padCode)\n }\n }\n\n codec.decode.bytes = length\n return String.fromCharCode.apply(String, codes)\n }\n }\n return codec\n}\n\nconst base64 = make('base64', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', '=', PREFERS_PADDING)\n// https://datatracker.ietf.org/doc/html/rfc4648#section-5\nconst base64URL = make('base64-url', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', '=', PREFERS_NO_PADDING)\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@leichtgewicht/base64-codec/index.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@leichtgewicht/dns-packet/buffer_utils.mjs":
|
||
/*!*****************************************************************!*\
|
||
!*** ./node_modules/@leichtgewicht/dns-packet/buffer_utils.mjs ***!
|
||
\*****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bytelength: () => (/* binding */ bytelength),\n/* harmony export */ copy: () => (/* binding */ copy),\n/* harmony export */ from: () => (/* binding */ from),\n/* harmony export */ isU8Arr: () => (/* binding */ isU8Arr),\n/* harmony export */ readUInt16BE: () => (/* binding */ readUInt16BE),\n/* harmony export */ readUInt32BE: () => (/* binding */ readUInt32BE),\n/* harmony export */ toHex: () => (/* binding */ toHex),\n/* harmony export */ write: () => (/* binding */ write),\n/* harmony export */ writeUInt16BE: () => (/* binding */ writeUInt16BE),\n/* harmony export */ writeUInt32BE: () => (/* binding */ writeUInt32BE)\n/* harmony export */ });\n/* harmony import */ var utf8_codec__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! utf8-codec */ \"./node_modules/utf8-codec/index.mjs\");\n\n\nconst isU8Arr = input => input instanceof Uint8Array\n\nfunction bytelength (input) {\n return typeof input === 'string' ? utf8_codec__WEBPACK_IMPORTED_MODULE_0__.encodingLength(input) : input.byteLength\n}\n\nfunction from (input) {\n if (input instanceof Uint8Array) {\n return input\n }\n if (Array.isArray(input)) {\n return new Uint8Array(input)\n }\n return utf8_codec__WEBPACK_IMPORTED_MODULE_0__.encode(input)\n}\n\nfunction write (arr, str, start) {\n if (typeof str !== 'string') {\n throw new Error('unknown input type')\n }\n utf8_codec__WEBPACK_IMPORTED_MODULE_0__.encode(str, arr, start)\n return utf8_codec__WEBPACK_IMPORTED_MODULE_0__.encode.bytes\n}\n\nfunction toHex (buf, start, end) {\n let result = ''\n for (let offset = start; offset < end;) {\n const num = buf[offset++]\n const str = num.toString(16)\n result += (str.length === 1) ? '0' + str : str\n }\n return result\n}\n\nconst P_24 = Math.pow(2, 24)\nconst P_16 = Math.pow(2, 16)\nconst P_8 = Math.pow(2, 8)\nconst readUInt32BE = (buf, offset) => buf[offset] * P_24 +\n buf[offset + 1] * P_16 +\n buf[offset + 2] * P_8 +\n buf[offset + 3]\n\nconst readUInt16BE = (buf, offset) => (buf[offset] << 8) | buf[offset + 1]\nconst writeUInt32BE = (buf, value, offset) => {\n value = +value\n buf[offset + 3] = value\n value = value >>> 8\n buf[offset + 2] = value\n value = value >>> 8\n buf[offset + 1] = value\n value = value >>> 8\n buf[offset] = value\n return offset + 4\n}\nconst writeUInt16BE = (buf, value, offset) => {\n buf[offset] = value >> 8\n buf[offset + 1] = value & 0xFF\n return offset + 2\n}\n\nfunction copy (source, target, targetStart, sourceStart, sourceEnd) {\n if (targetStart < 0) {\n sourceStart -= targetStart\n targetStart = 0\n }\n\n if (sourceStart < 0) {\n sourceStart = 0\n }\n\n if (sourceEnd < 0) {\n return new Uint8Array(0)\n }\n\n if (targetStart >= target.length || sourceStart >= sourceEnd) {\n return 0\n }\n\n return _copyActual(source, target, targetStart, sourceStart, sourceEnd)\n}\n\nfunction _copyActual (source, target, targetStart, sourceStart, sourceEnd) {\n if (sourceEnd - sourceStart > target.length - targetStart) {\n sourceEnd = sourceStart + target.length - targetStart\n }\n\n let nb = sourceEnd - sourceStart\n const sourceLen = source.length - sourceStart\n if (nb > sourceLen) {\n nb = sourceLen\n }\n\n if (sourceStart !== 0 || sourceEnd < source.length) {\n source = new Uint8Array(source.buffer, source.byteOffset + sourceStart, nb)\n }\n\n target.set(source, targetStart)\n\n return nb\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@leichtgewicht/dns-packet/buffer_utils.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@leichtgewicht/dns-packet/classes.mjs":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@leichtgewicht/dns-packet/classes.mjs ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toClass: () => (/* binding */ toClass),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\nfunction toString (klass) {\n switch (klass) {\n case 1: return 'IN'\n case 2: return 'CS'\n case 3: return 'CH'\n case 4: return 'HS'\n case 255: return 'ANY'\n }\n return 'UNKNOWN_' + klass\n}\n\nfunction toClass (name) {\n switch (name.toUpperCase()) {\n case 'IN': return 1\n case 'CS': return 2\n case 'CH': return 3\n case 'HS': return 4\n case 'ANY': return 255\n }\n return 0\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@leichtgewicht/dns-packet/classes.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@leichtgewicht/dns-packet/index.mjs":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@leichtgewicht/dns-packet/index.mjs ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AUTHENTIC_DATA: () => (/* binding */ AUTHENTIC_DATA),\n/* harmony export */ AUTHORITATIVE_ANSWER: () => (/* binding */ AUTHORITATIVE_ANSWER),\n/* harmony export */ CHECKING_DISABLED: () => (/* binding */ CHECKING_DISABLED),\n/* harmony export */ DNSSEC_OK: () => (/* binding */ DNSSEC_OK),\n/* harmony export */ RECURSION_AVAILABLE: () => (/* binding */ RECURSION_AVAILABLE),\n/* harmony export */ RECURSION_DESIRED: () => (/* binding */ RECURSION_DESIRED),\n/* harmony export */ TRUNCATED_RESPONSE: () => (/* binding */ TRUNCATED_RESPONSE),\n/* harmony export */ a: () => (/* binding */ ra),\n/* harmony export */ aaaa: () => (/* binding */ raaaa),\n/* harmony export */ answer: () => (/* binding */ answer),\n/* harmony export */ caa: () => (/* binding */ rcaa),\n/* harmony export */ cname: () => (/* binding */ rptr),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ decodeList: () => (/* binding */ decodeList),\n/* harmony export */ dname: () => (/* binding */ rptr),\n/* harmony export */ dnskey: () => (/* binding */ rdnskey),\n/* harmony export */ ds: () => (/* binding */ rds),\n/* harmony export */ enc: () => (/* binding */ renc),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ encodeList: () => (/* binding */ encodeList),\n/* harmony export */ encodingLength: () => (/* binding */ encodingLength),\n/* harmony export */ encodingLengthList: () => (/* binding */ encodingLengthList),\n/* harmony export */ hinfo: () => (/* binding */ rhinfo),\n/* harmony export */ mx: () => (/* binding */ rmx),\n/* harmony export */ name: () => (/* binding */ name),\n/* harmony export */ ns: () => (/* binding */ rns),\n/* harmony export */ nsec: () => (/* binding */ rnsec),\n/* harmony export */ nsec3: () => (/* binding */ rnsec3),\n/* harmony export */ \"null\": () => (/* binding */ rnull),\n/* harmony export */ opt: () => (/* binding */ ropt),\n/* harmony export */ option: () => (/* binding */ roption),\n/* harmony export */ packet: () => (/* binding */ packet),\n/* harmony export */ ptr: () => (/* binding */ rptr),\n/* harmony export */ query: () => (/* binding */ query),\n/* harmony export */ question: () => (/* binding */ question),\n/* harmony export */ response: () => (/* binding */ response),\n/* harmony export */ rp: () => (/* binding */ rrp),\n/* harmony export */ rrsig: () => (/* binding */ rrrsig),\n/* harmony export */ soa: () => (/* binding */ rsoa),\n/* harmony export */ srv: () => (/* binding */ rsrv),\n/* harmony export */ streamDecode: () => (/* binding */ streamDecode),\n/* harmony export */ streamEncode: () => (/* binding */ streamEncode),\n/* harmony export */ txt: () => (/* binding */ rtxt),\n/* harmony export */ unknown: () => (/* binding */ runknown)\n/* harmony export */ });\n/* harmony import */ var _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @leichtgewicht/ip-codec */ \"./node_modules/@leichtgewicht/ip-codec/index.mjs\");\n/* harmony import */ var _types_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types.mjs */ \"./node_modules/@leichtgewicht/dns-packet/types.mjs\");\n/* harmony import */ var _rcodes_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./rcodes.mjs */ \"./node_modules/@leichtgewicht/dns-packet/rcodes.mjs\");\n/* harmony import */ var _opcodes_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./opcodes.mjs */ \"./node_modules/@leichtgewicht/dns-packet/opcodes.mjs\");\n/* harmony import */ var _classes_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classes.mjs */ \"./node_modules/@leichtgewicht/dns-packet/classes.mjs\");\n/* harmony import */ var _optioncodes_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./optioncodes.mjs */ \"./node_modules/@leichtgewicht/dns-packet/optioncodes.mjs\");\n/* harmony import */ var _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./buffer_utils.mjs */ \"./node_modules/@leichtgewicht/dns-packet/buffer_utils.mjs\");\n/* harmony import */ var utf8_codec__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! utf8-codec */ \"./node_modules/utf8-codec/index.mjs\");\n\n\n\n\n\n\n\n\n\nconst QUERY_FLAG = 0\nconst RESPONSE_FLAG = 1 << 15\nconst FLUSH_MASK = 1 << 15\nconst NOT_FLUSH_MASK = ~FLUSH_MASK\nconst QU_MASK = 1 << 15\nconst NOT_QU_MASK = ~QU_MASK\n\nfunction codec ({ bytes = 0, encode, decode, encodingLength }) {\n encode.bytes = bytes\n decode.bytes = bytes\n return {\n encode,\n decode,\n encodingLength: encodingLength || (() => bytes)\n }\n}\n\nconst name = codec({\n encode (str, buf, offset) {\n if (!buf) buf = new Uint8Array(name.encodingLength(str))\n if (!offset) offset = 0\n const oldOffset = offset\n\n // strip leading and trailing .\n const n = str.replace(/^\\.|\\.$/gm, '')\n if (n.length) {\n const list = n.split('.')\n\n for (let i = 0; i < list.length; i++) {\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.write(buf, list[i], offset + 1)\n buf[offset] = len\n offset += len + 1\n }\n }\n\n buf[offset++] = 0\n\n name.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const list = []\n let oldOffset = offset\n let totalLength = 0\n let consumedBytes = 0\n let jumped = false\n\n while (true) {\n if (offset >= buf.length) {\n throw new Error('Cannot decode name (buffer overflow)')\n }\n const len = buf[offset++]\n consumedBytes += jumped ? 0 : 1\n\n if (len === 0) {\n break\n } else if ((len & 0xc0) === 0) {\n if (offset + len > buf.length) {\n throw new Error('Cannot decode name (buffer overflow)')\n }\n totalLength += len + 1\n if (totalLength > 254) {\n throw new Error('Cannot decode name (name too long)')\n }\n list.push((0,utf8_codec__WEBPACK_IMPORTED_MODULE_7__.decode)(buf, offset, offset + len))\n offset += len\n consumedBytes += jumped ? 0 : len\n } else if ((len & 0xc0) === 0xc0) {\n if (offset + 1 > buf.length) {\n throw new Error('Cannot decode name (buffer overflow)')\n }\n const jumpOffset = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset - 1) - 0xc000\n if (jumpOffset >= oldOffset) {\n // Allow only pointers to prior data. RFC 1035, section 4.1.4 states:\n // \"[...] an entire domain name or a list of labels at the end of a domain name\n // is replaced with a pointer to a prior occurance (sic) of the same name.\"\n throw new Error('Cannot decode name (bad pointer)')\n }\n offset = jumpOffset\n oldOffset = jumpOffset\n consumedBytes += jumped ? 0 : 1\n jumped = true\n } else {\n throw new Error('Cannot decode name (bad label)')\n }\n }\n\n name.decode.bytes = consumedBytes\n return list.length === 0 ? '.' : list.join('.')\n },\n encodingLength (n) {\n if (n === '.' || n === '..') return 1\n return _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(n.replace(/^\\.|\\.$/gm, '')) + 2\n }\n})\n\nconst string = codec({\n encode (s, buf, offset) {\n if (!buf) buf = new Uint8Array(string.encodingLength(s))\n if (!offset) offset = 0\n\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.write(buf, s, offset + 1)\n buf[offset] = len\n string.encode.bytes = len + 1\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const len = buf[offset]\n const s = (0,utf8_codec__WEBPACK_IMPORTED_MODULE_7__.decode)(buf, offset + 1, offset + 1 + len)\n string.decode.bytes = len + 1\n return s\n },\n encodingLength (s) {\n return _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(s) + 1\n }\n})\n\nconst header = codec({\n bytes: 12,\n encode (h, buf, offset) {\n if (!buf) buf = new Uint8Array(header.encodingLength(h))\n if (!offset) offset = 0\n\n const flags = (h.flags || 0) & 32767\n const type = h.type === 'response' ? RESPONSE_FLAG : QUERY_FLAG\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, h.id || 0, offset)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, flags | type, offset + 2)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, h.questions.length, offset + 4)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, h.answers.length, offset + 6)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, h.authorities.length, offset + 8)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, h.additionals.length, offset + 10)\n\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n if (buf.length < 12) throw new Error('Header must be 12 bytes')\n const flags = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 2)\n\n return {\n id: _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset),\n type: flags & RESPONSE_FLAG ? 'response' : 'query',\n flags: flags & 32767,\n flag_qr: ((flags >> 15) & 0x1) === 1,\n opcode: _opcodes_mjs__WEBPACK_IMPORTED_MODULE_3__.toString((flags >> 11) & 0xf),\n flag_aa: ((flags >> 10) & 0x1) === 1,\n flag_tc: ((flags >> 9) & 0x1) === 1,\n flag_rd: ((flags >> 8) & 0x1) === 1,\n flag_ra: ((flags >> 7) & 0x1) === 1,\n flag_z: ((flags >> 6) & 0x1) === 1,\n flag_ad: ((flags >> 5) & 0x1) === 1,\n flag_cd: ((flags >> 4) & 0x1) === 1,\n rcode: _rcodes_mjs__WEBPACK_IMPORTED_MODULE_2__.toString(flags & 0xf),\n questions: new Array(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 4)),\n answers: new Array(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 6)),\n authorities: new Array(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 8)),\n additionals: new Array(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 10))\n }\n },\n encodingLength () {\n return 12\n }\n})\n\nconst runknown = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(runknown.encodingLength(data))\n if (!offset) offset = 0\n\n const dLen = data.length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, dLen, offset)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(data, buf, offset + 2, 0, dLen)\n\n runknown.encode.bytes = dLen + 2\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n const data = buf.slice(offset + 2, offset + 2 + len)\n runknown.decode.bytes = len + 2\n return data\n },\n encodingLength (data) {\n return data.length + 2\n }\n})\n\nconst rns = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rns.encodingLength(data))\n if (!offset) offset = 0\n\n name.encode(data, buf, offset + 2)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, name.encode.bytes, offset)\n rns.encode.bytes = name.encode.bytes + 2\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n const dd = name.decode(buf, offset + 2)\n\n rns.decode.bytes = len + 2\n return dd\n },\n encodingLength (data) {\n return name.encodingLength(data) + 2\n }\n})\n\nconst rsoa = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rsoa.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n name.encode(data.mname, buf, offset)\n offset += name.encode.bytes\n name.encode(data.rname, buf, offset)\n offset += name.encode.bytes\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, data.serial || 0, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, data.refresh || 0, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, data.retry || 0, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, data.expire || 0, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, data.minimum || 0, offset)\n offset += 4\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, offset - oldOffset - 2, oldOffset)\n rsoa.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.mname = name.decode(buf, offset)\n offset += name.decode.bytes\n data.rname = name.decode(buf, offset)\n offset += name.decode.bytes\n data.serial = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n data.refresh = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n data.retry = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n data.expire = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n data.minimum = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n\n rsoa.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n return 22 + name.encodingLength(data.mname) + name.encodingLength(data.rname)\n }\n})\n\nconst rtxt = codec({\n encode (data, buf, offset) {\n if (!Array.isArray(data)) data = [data]\n for (let i = 0; i < data.length; i++) {\n if (typeof data[i] === 'string') {\n data[i] = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.from(data[i])\n }\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(data[i])) {\n throw new Error('Must be a Buffer')\n }\n }\n\n if (!buf) buf = new Uint8Array(rtxt.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n\n data.forEach(function (d) {\n buf[offset++] = d.length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(d, buf, offset, 0, d.length)\n offset += d.length\n })\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, offset - oldOffset - 2, oldOffset)\n rtxt.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n let remaining = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n\n const data = []\n while (remaining > 0) {\n const len = buf[offset++]\n --remaining\n if (remaining < len) {\n throw new Error('Buffer overflow')\n }\n data.push(buf.slice(offset, offset + len))\n offset += len\n remaining -= len\n }\n\n rtxt.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n if (!Array.isArray(data)) data = [data]\n let length = 2\n data.forEach(function (buf) {\n if (typeof buf === 'string') {\n length += _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(buf) + 1\n } else {\n length += buf.length + 1\n }\n })\n return length\n }\n})\n\nconst rnull = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rnull.encodingLength(data))\n if (!offset) offset = 0\n\n if (typeof data === 'string') data = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.from(data)\n if (!data) data = new Uint8Array(0)\n\n const oldOffset = offset\n offset += 2\n\n const len = data.length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(data, buf, offset, 0, len)\n offset += len\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, offset - oldOffset - 2, oldOffset)\n rnull.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n\n offset += 2\n\n const data = buf.slice(offset, offset + len)\n offset += len\n\n rnull.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n if (!data) return 2\n return (_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(data) ? data.length : _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(data)) + 2\n }\n})\n\nconst rhinfo = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rhinfo.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n string.encode(data.cpu, buf, offset)\n offset += string.encode.bytes\n string.encode(data.os, buf, offset)\n offset += string.encode.bytes\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, offset - oldOffset - 2, oldOffset)\n rhinfo.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.cpu = string.decode(buf, offset)\n offset += string.decode.bytes\n data.os = string.decode(buf, offset)\n offset += string.decode.bytes\n rhinfo.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n return string.encodingLength(data.cpu) + string.encodingLength(data.os) + 2\n }\n})\n\nconst rptr = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rptr.encodingLength(data))\n if (!offset) offset = 0\n\n name.encode(data, buf, offset + 2)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, name.encode.bytes, offset)\n rptr.encode.bytes = name.encode.bytes + 2\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const data = name.decode(buf, offset + 2)\n rptr.decode.bytes = name.decode.bytes + 2\n return data\n },\n encodingLength (data) {\n return name.encodingLength(data) + 2\n }\n})\n\nconst rsrv = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rsrv.encodingLength(data))\n if (!offset) offset = 0\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, data.priority || 0, offset + 2)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, data.weight || 0, offset + 4)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, data.port || 0, offset + 6)\n name.encode(data.target, buf, offset + 8)\n\n const len = name.encode.bytes + 6\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, len, offset)\n\n rsrv.encode.bytes = len + 2\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n\n const data = {}\n data.priority = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 2)\n data.weight = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 4)\n data.port = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 6)\n data.target = name.decode(buf, offset + 8)\n\n rsrv.decode.bytes = len + 2\n return data\n },\n encodingLength (data) {\n return 8 + name.encodingLength(data.target)\n }\n})\n\nconst rcaa = codec({\n encode (data, buf, offset) {\n const len = rcaa.encodingLength(data)\n\n if (!buf) buf = new Uint8Array(rcaa.encodingLength(data))\n if (!offset) offset = 0\n\n if (data.issuerCritical) {\n data.flags = rcaa.ISSUER_CRITICAL\n }\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, len - 2, offset)\n offset += 2\n buf[offset] = data.flags || 0\n offset += 1\n string.encode(data.tag, buf, offset)\n offset += string.encode.bytes\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.write(buf, data.value, offset)\n offset += _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(data.value)\n\n rcaa.encode.bytes = len\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n\n const oldOffset = offset\n const data = {}\n data.flags = buf[offset]\n offset += 1\n data.tag = string.decode(buf, offset)\n offset += string.decode.bytes\n data.value = (0,utf8_codec__WEBPACK_IMPORTED_MODULE_7__.decode)(buf, offset, oldOffset + len)\n\n data.issuerCritical = !!(data.flags & rcaa.ISSUER_CRITICAL)\n\n rcaa.decode.bytes = len + 2\n\n return data\n },\n encodingLength (data) {\n return string.encodingLength(data.tag) + string.encodingLength(data.value) + 2\n }\n})\n\nrcaa.ISSUER_CRITICAL = 1 << 7\n\nconst rmx = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rmx.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, data.preference || 0, offset)\n offset += 2\n name.encode(data.exchange, buf, offset)\n offset += name.encode.bytes\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, offset - oldOffset - 2, oldOffset)\n rmx.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.preference = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n data.exchange = name.decode(buf, offset)\n offset += name.decode.bytes\n\n rmx.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n return 4 + name.encodingLength(data.exchange)\n }\n})\n\nconst ra = codec({\n encode (host, buf, offset) {\n if (!buf) buf = new Uint8Array(ra.encodingLength(host))\n if (!offset) offset = 0\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, 4, offset)\n offset += 2\n _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.v4.encode(host, buf, offset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n offset += 2\n const host = _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.v4.decode(buf, offset)\n return host\n },\n bytes: 6\n})\n\nconst raaaa = codec({\n encode (host, buf, offset) {\n if (!buf) buf = new Uint8Array(raaaa.encodingLength(host))\n if (!offset) offset = 0\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, 16, offset)\n offset += 2\n _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.v6.encode(host, buf, offset)\n raaaa.encode.bytes = 18\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n offset += 2\n const host = _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.v6.decode(buf, offset)\n raaaa.decode.bytes = 18\n return host\n },\n bytes: 18\n})\n\nconst alloc = size => new Uint8Array(size)\n\nconst roption = codec({\n encode (option, buf, offset) {\n if (!buf) buf = new Uint8Array(roption.encodingLength(option))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const code = _optioncodes_mjs__WEBPACK_IMPORTED_MODULE_5__.toCode(option.code)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, code, offset)\n offset += 2\n if (option.data) {\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, option.data.length, offset)\n offset += 2\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(option.data, buf, offset)\n offset += option.data.length\n } else {\n switch (code) {\n // case 3: NSID. No encode makes sense.\n // case 5,6,7: Not implementable\n case 8: // ECS\n {\n // note: do IP math before calling\n const spl = option.sourcePrefixLength || 0\n const fam = option.family || _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.familyOf(option.ip, alloc)\n const ipBuf = _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.encode(option.ip, alloc)\n const ipLen = Math.ceil(spl / 8)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, ipLen + 4, offset)\n offset += 2\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, fam, offset)\n offset += 2\n buf[offset++] = spl\n buf[offset++] = option.scopePrefixLength || 0\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(ipBuf, buf, offset, 0, ipLen)\n offset += ipLen\n }\n break\n // case 9: EXPIRE (experimental)\n // case 10: COOKIE. No encode makes sense.\n case 11: // KEEP-ALIVE\n if (option.timeout) {\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, 2, offset)\n offset += 2\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, option.timeout, offset)\n offset += 2\n } else {\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, 0, offset)\n offset += 2\n }\n break\n case 12: // PADDING\n {\n const len = option.length || 0\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, len, offset)\n offset += 2\n buf.fill(0, offset, offset + len)\n offset += len\n }\n break\n // case 13: CHAIN. Experimental.\n case 14: // KEY-TAG\n {\n const tagsLen = option.tags.length * 2\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, tagsLen, offset)\n offset += 2\n for (const tag of option.tags) {\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, tag, offset)\n offset += 2\n }\n }\n break\n default:\n throw new Error(`Unknown roption code: ${option.code}`)\n }\n }\n\n roption.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const option = {}\n option.code = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n option.type = _optioncodes_mjs__WEBPACK_IMPORTED_MODULE_5__.toString(option.code)\n offset += 2\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n option.data = buf.slice(offset, offset + len)\n switch (option.code) {\n // case 3: NSID. No decode makes sense.\n case 8: // ECS\n option.family = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n option.sourcePrefixLength = buf[offset++]\n option.scopePrefixLength = buf[offset++]\n {\n const padded = new Uint8Array((option.family === 1) ? 4 : 16)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(buf, padded, 0, offset, offset + len - 4)\n option.ip = _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.decode(padded)\n }\n break\n // case 12: Padding. No decode makes sense.\n case 11: // KEEP-ALIVE\n if (len > 0) {\n option.timeout = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n }\n break\n case 14:\n option.tags = []\n for (let i = 0; i < len; i += 2) {\n option.tags.push(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset))\n offset += 2\n }\n // don't worry about default. caller will use data if desired\n }\n\n roption.decode.bytes = len + 4\n return option\n },\n encodingLength (option) {\n if (option.data) {\n return option.data.length + 4\n }\n const code = _optioncodes_mjs__WEBPACK_IMPORTED_MODULE_5__.toCode(option.code)\n switch (code) {\n case 8: // ECS\n {\n const spl = option.sourcePrefixLength || 0\n return Math.ceil(spl / 8) + 8\n }\n case 11: // KEEP-ALIVE\n return (typeof option.timeout === 'number') ? 6 : 4\n case 12: // PADDING\n return option.length + 4\n case 14: // KEY-TAG\n return 4 + (option.tags.length * 2)\n }\n throw new Error(`Unknown roption code: ${option.code}`)\n }\n})\n\nconst ropt = codec({\n encode (options, buf, offset) {\n if (!buf) buf = new Uint8Array(ropt.encodingLength(options))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const rdlen = encodingLengthList(options, roption)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rdlen, offset)\n offset = encodeList(options, roption, buf, offset + 2)\n\n ropt.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const options = []\n let rdlen = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n let o = 0\n while (rdlen > 0) {\n options[o++] = roption.decode(buf, offset)\n offset += roption.decode.bytes\n rdlen -= roption.decode.bytes\n }\n ropt.decode.bytes = offset - oldOffset\n return options\n },\n encodingLength (options) {\n return 2 + encodingLengthList(options || [], roption)\n }\n})\n\nconst rdnskey = codec({\n encode (key, buf, offset) {\n if (!buf) buf = new Uint8Array(rdnskey.encodingLength(key))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const keydata = key.key\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(keydata)) {\n throw new Error('Key must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, key.flags, offset)\n offset += 2\n buf[offset] = rdnskey.PROTOCOL_DNSSEC\n offset += 1\n buf[offset] = key.algorithm\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(keydata, buf, offset, 0, keydata.length)\n offset += keydata.length\n\n rdnskey.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rdnskey.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const key = {}\n const length = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n key.flags = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n if (buf[offset] !== rdnskey.PROTOCOL_DNSSEC) {\n throw new Error('Protocol must be 3')\n }\n offset += 1\n key.algorithm = buf[offset]\n offset += 1\n key.key = buf.slice(offset, oldOffset + length + 2)\n offset += key.key.length\n rdnskey.decode.bytes = offset - oldOffset\n return key\n },\n encodingLength (key) {\n return 6 + _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(key.key)\n }\n})\n\nrdnskey.PROTOCOL_DNSSEC = 3\nrdnskey.ZONE_KEY = 0x80\nrdnskey.SECURE_ENTRYPOINT = 0x8000\n\nconst rrrsig = codec({\n encode (sig, buf, offset) {\n if (!buf) buf = new Uint8Array(rrrsig.encodingLength(sig))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const signature = sig.signature\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(signature)) {\n throw new Error('Signature must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toType(sig.typeCovered), offset)\n offset += 2\n buf[offset] = sig.algorithm\n offset += 1\n buf[offset] = sig.labels\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, sig.originalTTL, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, sig.expiration, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, sig.inception, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, sig.keyTag, offset)\n offset += 2\n name.encode(sig.signersName, buf, offset)\n offset += name.encode.bytes\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(signature, buf, offset, 0, signature.length)\n offset += signature.length\n\n rrrsig.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rrrsig.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const sig = {}\n const length = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n sig.typeCovered = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toString(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset))\n offset += 2\n sig.algorithm = buf[offset]\n offset += 1\n sig.labels = buf[offset]\n offset += 1\n sig.originalTTL = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n sig.expiration = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n sig.inception = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n sig.keyTag = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n sig.signersName = name.decode(buf, offset)\n offset += name.decode.bytes\n sig.signature = buf.slice(offset, oldOffset + length + 2)\n offset += sig.signature.length\n rrrsig.decode.bytes = offset - oldOffset\n return sig\n },\n encodingLength (sig) {\n return 20 +\n name.encodingLength(sig.signersName) +\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(sig.signature)\n }\n})\nconst rrp = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rrp.encodingLength(data))\n if (!offset) offset = 0\n const oldOffset = offset\n\n offset += 2 // Leave space for length\n name.encode(data.mbox || '.', buf, offset)\n offset += name.encode.bytes\n name.encode(data.txt || '.', buf, offset)\n offset += name.encode.bytes\n rrp.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rrp.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.mbox = name.decode(buf, offset) || '.'\n offset += name.decode.bytes\n data.txt = name.decode(buf, offset) || '.'\n offset += name.decode.bytes\n rrp.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n return 2 + name.encodingLength(data.mbox || '.') + name.encodingLength(data.txt || '.')\n }\n})\n\nconst typebitmap = codec({\n encode (typelist, buf, offset) {\n if (!buf) buf = new Uint8Array(typebitmap.encodingLength(typelist))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const typesByWindow = []\n for (let i = 0; i < typelist.length; i++) {\n const typeid = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toType(typelist[i])\n if (typesByWindow[typeid >> 8] === undefined) {\n typesByWindow[typeid >> 8] = []\n }\n typesByWindow[typeid >> 8][(typeid >> 3) & 0x1F] |= 1 << (7 - (typeid & 0x7))\n }\n\n for (let i = 0; i < typesByWindow.length; i++) {\n if (typesByWindow[i] !== undefined) {\n const windowBuf = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.from(typesByWindow[i])\n buf[offset] = i\n offset += 1\n buf[offset] = windowBuf.length\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(windowBuf, buf, offset, 0, windowBuf.length)\n offset += windowBuf.length\n }\n }\n\n typebitmap.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset, length) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const typelist = []\n while (offset - oldOffset < length) {\n const window = buf[offset]\n offset += 1\n const windowLength = buf[offset]\n offset += 1\n for (let i = 0; i < windowLength; i++) {\n const b = buf[offset + i]\n for (let j = 0; j < 8; j++) {\n if (b & (1 << (7 - j))) {\n const typeid = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toString((window << 8) | (i << 3) | j)\n typelist.push(typeid)\n }\n }\n }\n offset += windowLength\n }\n\n typebitmap.decode.bytes = offset - oldOffset\n return typelist\n },\n encodingLength (typelist) {\n const extents = []\n for (let i = 0; i < typelist.length; i++) {\n const typeid = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toType(typelist[i])\n extents[typeid >> 8] = Math.max(extents[typeid >> 8] || 0, typeid & 0xFF)\n }\n\n let len = 0\n for (let i = 0; i < extents.length; i++) {\n if (extents[i] !== undefined) {\n len += 2 + Math.ceil((extents[i] + 1) / 8)\n }\n }\n\n return len\n }\n})\n\nconst rnsec = codec({\n encode (record, buf, offset) {\n if (!buf) buf = new Uint8Array(rnsec.encodingLength(record))\n if (!offset) offset = 0\n const oldOffset = offset\n\n offset += 2 // Leave space for length\n name.encode(record.nextDomain, buf, offset)\n offset += name.encode.bytes\n typebitmap.encode(record.rrtypes, buf, offset)\n offset += typebitmap.encode.bytes\n\n rnsec.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rnsec.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const record = {}\n const length = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n record.nextDomain = name.decode(buf, offset)\n offset += name.decode.bytes\n record.rrtypes = typebitmap.decode(buf, offset, length - (offset - oldOffset))\n offset += typebitmap.decode.bytes\n\n rnsec.decode.bytes = offset - oldOffset\n return record\n },\n encodingLength (record) {\n return 2 +\n name.encodingLength(record.nextDomain) +\n typebitmap.encodingLength(record.rrtypes)\n }\n})\n\nconst rnsec3 = codec({\n encode (record, buf, offset) {\n if (!buf) buf = new Uint8Array(rnsec3.encodingLength(record))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const salt = record.salt\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(salt)) {\n throw new Error('salt must be a Buffer')\n }\n\n const nextDomain = record.nextDomain\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(nextDomain)) {\n throw new Error('nextDomain must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n buf[offset] = record.algorithm\n offset += 1\n buf[offset] = record.flags\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, record.iterations, offset)\n offset += 2\n buf[offset] = salt.length\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(salt, buf, offset, 0, salt.length)\n offset += salt.length\n buf[offset] = nextDomain.length\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(nextDomain, buf, offset, 0, nextDomain.length)\n offset += nextDomain.length\n typebitmap.encode(record.rrtypes, buf, offset)\n offset += typebitmap.encode.bytes\n\n rnsec3.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rnsec3.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const record = {}\n const length = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n record.algorithm = buf[offset]\n offset += 1\n record.flags = buf[offset]\n offset += 1\n record.iterations = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n const saltLength = buf[offset]\n offset += 1\n record.salt = buf.slice(offset, offset + saltLength)\n offset += saltLength\n const hashLength = buf[offset]\n offset += 1\n record.nextDomain = buf.slice(offset, offset + hashLength)\n offset += hashLength\n record.rrtypes = typebitmap.decode(buf, offset, length - (offset - oldOffset))\n offset += typebitmap.decode.bytes\n\n rnsec3.decode.bytes = offset - oldOffset\n return record\n },\n encodingLength (record) {\n return 8 +\n record.salt.length +\n record.nextDomain.length +\n typebitmap.encodingLength(record.rrtypes)\n }\n})\n\nconst rds = codec({\n encode (digest, buf, offset) {\n if (!buf) buf = new Uint8Array(rds.encodingLength(digest))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const digestdata = digest.digest\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(digestdata)) {\n throw new Error('Digest must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, digest.keyTag, offset)\n offset += 2\n buf[offset] = digest.algorithm\n offset += 1\n buf[offset] = digest.digestType\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(digestdata, buf, offset, 0, digestdata.length)\n offset += digestdata.length\n\n rds.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rds.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const digest = {}\n const length = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n digest.keyTag = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n digest.algorithm = buf[offset]\n offset += 1\n digest.digestType = buf[offset]\n offset += 1\n digest.digest = buf.slice(offset, oldOffset + length + 2)\n offset += digest.digest.length\n rds.decode.bytes = offset - oldOffset\n return digest\n },\n encodingLength (digest) {\n return 6 + _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(digest.digest)\n }\n})\n\nfunction renc (type) {\n switch (type.toUpperCase()) {\n case 'A': return ra\n case 'PTR': return rptr\n case 'CNAME': return rptr\n case 'DNAME': return rptr\n case 'TXT': return rtxt\n case 'NULL': return rnull\n case 'AAAA': return raaaa\n case 'SRV': return rsrv\n case 'HINFO': return rhinfo\n case 'CAA': return rcaa\n case 'NS': return rns\n case 'SOA': return rsoa\n case 'MX': return rmx\n case 'OPT': return ropt\n case 'DNSKEY': return rdnskey\n case 'RRSIG': return rrrsig\n case 'RP': return rrp\n case 'NSEC': return rnsec\n case 'NSEC3': return rnsec3\n case 'DS': return rds\n }\n return runknown\n}\n\nconst answer = codec({\n encode (a, buf, offset) {\n if (!buf) buf = new Uint8Array(answer.encodingLength(a))\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n name.encode(a.name, buf, offset)\n offset += name.encode.bytes\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toType(a.type), offset)\n\n if (a.type.toUpperCase() === 'OPT') {\n if (a.name !== '.') {\n throw new Error('OPT name must be root.')\n }\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, a.udpPayloadSize || 4096, offset + 2)\n buf[offset + 4] = a.extendedRcode || 0\n buf[offset + 5] = a.ednsVersion || 0\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, a.flags || 0, offset + 6)\n\n offset += 8\n ropt.encode(a.options || [], buf, offset)\n offset += ropt.encode.bytes\n } else {\n let klass = _classes_mjs__WEBPACK_IMPORTED_MODULE_4__.toClass(a.class === undefined ? 'IN' : a.class)\n if (a.flush) klass |= FLUSH_MASK // the 1st bit of the class is the flush bit\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, klass, offset + 2)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, a.ttl || 0, offset + 4)\n\n offset += 8\n const enc = renc(a.type)\n enc.encode(a.data, buf, offset)\n offset += enc.encode.bytes\n }\n\n answer.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const a = {}\n const oldOffset = offset\n\n a.name = name.decode(buf, offset)\n offset += name.decode.bytes\n a.type = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toString(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset))\n if (a.type === 'OPT') {\n a.udpPayloadSize = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 2)\n a.extendedRcode = buf[offset + 4]\n a.ednsVersion = buf[offset + 5]\n a.flags = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 6)\n a.flag_do = ((a.flags >> 15) & 0x1) === 1\n a.options = ropt.decode(buf, offset + 8)\n offset += 8 + ropt.decode.bytes\n } else {\n const klass = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 2)\n a.ttl = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset + 4)\n\n a.class = _classes_mjs__WEBPACK_IMPORTED_MODULE_4__.toString(klass & NOT_FLUSH_MASK)\n a.flush = !!(klass & FLUSH_MASK)\n\n const enc = renc(a.type)\n a.data = enc.decode(buf, offset + 8)\n offset += 8 + enc.decode.bytes\n }\n\n answer.decode.bytes = offset - oldOffset\n return a\n },\n encodingLength (a) {\n const data = (a.data !== null && a.data !== undefined) ? a.data : a.options\n return name.encodingLength(a.name) + 8 + renc(a.type).encodingLength(data)\n }\n})\n\nconst question = codec({\n encode (q, buf, offset) {\n if (!buf) buf = new Uint8Array(question.encodingLength(q))\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n name.encode(q.name, buf, offset)\n offset += name.encode.bytes\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toType(q.type), offset)\n offset += 2\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, _classes_mjs__WEBPACK_IMPORTED_MODULE_4__.toClass(q.class === undefined ? 'IN' : q.class), offset)\n offset += 2\n\n question.encode.bytes = offset - oldOffset\n return q\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n const q = {}\n\n q.name = name.decode(buf, offset)\n offset += name.decode.bytes\n\n q.type = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toString(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset))\n offset += 2\n\n q.class = _classes_mjs__WEBPACK_IMPORTED_MODULE_4__.toString(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset))\n offset += 2\n\n const qu = !!(q.class & QU_MASK)\n if (qu) q.class &= NOT_QU_MASK\n\n question.decode.bytes = offset - oldOffset\n return q\n },\n encodingLength (q) {\n return name.encodingLength(q.name) + 4\n }\n})\n\n\n\nconst AUTHORITATIVE_ANSWER = 1 << 10\nconst TRUNCATED_RESPONSE = 1 << 9\nconst RECURSION_DESIRED = 1 << 8\nconst RECURSION_AVAILABLE = 1 << 7\nconst AUTHENTIC_DATA = 1 << 5\nconst CHECKING_DISABLED = 1 << 4\nconst DNSSEC_OK = 1 << 15\n\nconst packet = {\n encode: function (result, buf, offset) {\n const allocing = !buf\n\n if (allocing) buf = new Uint8Array(encodingLength(result))\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n if (!result.questions) result.questions = []\n if (!result.answers) result.answers = []\n if (!result.authorities) result.authorities = []\n if (!result.additionals) result.additionals = []\n\n header.encode(result, buf, offset)\n offset += header.encode.bytes\n\n offset = encodeList(result.questions, question, buf, offset)\n offset = encodeList(result.answers, answer, buf, offset)\n offset = encodeList(result.authorities, answer, buf, offset)\n offset = encodeList(result.additionals, answer, buf, offset)\n\n packet.encode.bytes = offset - oldOffset\n\n // just a quick sanity check\n if (allocing && encode.bytes !== buf.length) {\n return buf.slice(0, encode.bytes)\n }\n\n return buf\n },\n decode: function (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n const result = header.decode(buf, offset)\n offset += header.decode.bytes\n\n offset = decodeList(result.questions, question, buf, offset)\n offset = decodeList(result.answers, answer, buf, offset)\n offset = decodeList(result.authorities, answer, buf, offset)\n offset = decodeList(result.additionals, answer, buf, offset)\n\n packet.decode.bytes = offset - oldOffset\n\n return result\n },\n encodingLength: function (result) {\n return header.encodingLength(result) +\n encodingLengthList(result.questions || [], question) +\n encodingLengthList(result.answers || [], answer) +\n encodingLengthList(result.authorities || [], answer) +\n encodingLengthList(result.additionals || [], answer)\n }\n}\npacket.encode.bytes = 0\npacket.decode.bytes = 0\n\nfunction sanitizeSingle (input, type) {\n if (input.questions) {\n throw new Error('Only one .question object expected instead of a .questions array!')\n }\n const sanitized = Object.assign({\n type\n }, input)\n if (sanitized.question) {\n sanitized.questions = [sanitized.question]\n delete sanitized.question\n }\n return sanitized\n}\n\nconst query = {\n encode: function (result, buf, offset) {\n buf = packet.encode(sanitizeSingle(result, 'query'), buf, offset)\n query.encode.bytes = packet.encode.bytes\n return buf\n },\n decode: function (buf, offset) {\n const res = packet.decode(buf, offset)\n query.decode.bytes = packet.decode.bytes\n if (res.questions) {\n res.question = res.questions[0]\n delete res.questions\n }\n return res\n },\n encodingLength: function (result) {\n return packet.encodingLength(sanitizeSingle(result, 'query'))\n }\n}\nquery.encode.bytes = 0\nquery.decode.bytes = 0\n\nconst response = {\n encode: function (result, buf, offset) {\n buf = packet.encode(sanitizeSingle(result, 'response'), buf, offset)\n response.encode.bytes = packet.encode.bytes\n return buf\n },\n decode: function (buf, offset) {\n const res = packet.decode(buf, offset)\n response.decode.bytes = packet.decode.bytes\n if (res.questions) {\n res.question = res.questions[0]\n delete res.questions\n }\n return res\n },\n encodingLength: function (result) {\n return packet.encodingLength(sanitizeSingle(result, 'response'))\n }\n}\nresponse.encode.bytes = 0\nresponse.decode.bytes = 0\n\nconst encode = packet.encode\nconst decode = packet.decode\nconst encodingLength = packet.encodingLength\n\nfunction streamEncode (result) {\n const buf = encode(result)\n const combine = new Uint8Array(2 + buf.byteLength)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(combine, buf.byteLength)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(buf, combine, 2, 0, buf.length)\n streamEncode.bytes = combine.byteLength\n return combine\n}\nstreamEncode.bytes = 0\n\nfunction streamDecode (sbuf) {\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(sbuf, 0)\n if (sbuf.byteLength < len + 2) {\n // not enough data\n return null\n }\n const result = decode(sbuf.slice(2))\n streamDecode.bytes = decode.bytes\n return result\n}\nstreamDecode.bytes = 0\n\nfunction encodingLengthList (list, enc) {\n let len = 0\n for (let i = 0; i < list.length; i++) len += enc.encodingLength(list[i])\n return len\n}\n\nfunction encodeList (list, enc, buf, offset) {\n for (let i = 0; i < list.length; i++) {\n enc.encode(list[i], buf, offset)\n offset += enc.encode.bytes\n }\n return offset\n}\n\nfunction decodeList (list, enc, buf, offset) {\n for (let i = 0; i < list.length; i++) {\n list[i] = enc.decode(buf, offset)\n offset += enc.decode.bytes\n }\n return offset\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@leichtgewicht/dns-packet/index.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@leichtgewicht/dns-packet/opcodes.mjs":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@leichtgewicht/dns-packet/opcodes.mjs ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toOpcode: () => (/* binding */ toOpcode),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/*\n * Traditional DNS header OPCODEs (4-bits) defined by IANA in\n * https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-5\n */\n\nfunction toString (opcode) {\n switch (opcode) {\n case 0: return 'QUERY'\n case 1: return 'IQUERY'\n case 2: return 'STATUS'\n case 3: return 'OPCODE_3'\n case 4: return 'NOTIFY'\n case 5: return 'UPDATE'\n case 6: return 'OPCODE_6'\n case 7: return 'OPCODE_7'\n case 8: return 'OPCODE_8'\n case 9: return 'OPCODE_9'\n case 10: return 'OPCODE_10'\n case 11: return 'OPCODE_11'\n case 12: return 'OPCODE_12'\n case 13: return 'OPCODE_13'\n case 14: return 'OPCODE_14'\n case 15: return 'OPCODE_15'\n }\n return 'OPCODE_' + opcode\n}\n\nfunction toOpcode (code) {\n switch (code.toUpperCase()) {\n case 'QUERY': return 0\n case 'IQUERY': return 1\n case 'STATUS': return 2\n case 'OPCODE_3': return 3\n case 'NOTIFY': return 4\n case 'UPDATE': return 5\n case 'OPCODE_6': return 6\n case 'OPCODE_7': return 7\n case 'OPCODE_8': return 8\n case 'OPCODE_9': return 9\n case 'OPCODE_10': return 10\n case 'OPCODE_11': return 11\n case 'OPCODE_12': return 12\n case 'OPCODE_13': return 13\n case 'OPCODE_14': return 14\n case 'OPCODE_15': return 15\n }\n return 0\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@leichtgewicht/dns-packet/opcodes.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@leichtgewicht/dns-packet/optioncodes.mjs":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@leichtgewicht/dns-packet/optioncodes.mjs ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toCode: () => (/* binding */ toCode),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\nfunction toString (type) {\n switch (type) {\n // list at\n // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-11\n case 1: return 'LLQ'\n case 2: return 'UL'\n case 3: return 'NSID'\n case 5: return 'DAU'\n case 6: return 'DHU'\n case 7: return 'N3U'\n case 8: return 'CLIENT_SUBNET'\n case 9: return 'EXPIRE'\n case 10: return 'COOKIE'\n case 11: return 'TCP_KEEPALIVE'\n case 12: return 'PADDING'\n case 13: return 'CHAIN'\n case 14: return 'KEY_TAG'\n case 26946: return 'DEVICEID'\n }\n if (type < 0) {\n return null\n }\n return `OPTION_${type}`\n}\n\nfunction toCode (name) {\n if (typeof name === 'number') {\n return name\n }\n if (!name) {\n return -1\n }\n switch (name.toUpperCase()) {\n case 'OPTION_0': return 0\n case 'LLQ': return 1\n case 'UL': return 2\n case 'NSID': return 3\n case 'OPTION_4': return 4\n case 'DAU': return 5\n case 'DHU': return 6\n case 'N3U': return 7\n case 'CLIENT_SUBNET': return 8\n case 'EXPIRE': return 9\n case 'COOKIE': return 10\n case 'TCP_KEEPALIVE': return 11\n case 'PADDING': return 12\n case 'CHAIN': return 13\n case 'KEY_TAG': return 14\n case 'DEVICEID': return 26946\n case 'OPTION_65535': return 65535\n }\n const m = name.match(/_(\\d+)$/)\n if (m) {\n return parseInt(m[1], 10)\n }\n return -1\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@leichtgewicht/dns-packet/optioncodes.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@leichtgewicht/dns-packet/rcodes.mjs":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@leichtgewicht/dns-packet/rcodes.mjs ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toRcode: () => (/* binding */ toRcode),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/*\n * Traditional DNS header RCODEs (4-bits) defined by IANA in\n * https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml\n */\n\nfunction toString (rcode) {\n switch (rcode) {\n case 0: return 'NOERROR'\n case 1: return 'FORMERR'\n case 2: return 'SERVFAIL'\n case 3: return 'NXDOMAIN'\n case 4: return 'NOTIMP'\n case 5: return 'REFUSED'\n case 6: return 'YXDOMAIN'\n case 7: return 'YXRRSET'\n case 8: return 'NXRRSET'\n case 9: return 'NOTAUTH'\n case 10: return 'NOTZONE'\n case 11: return 'RCODE_11'\n case 12: return 'RCODE_12'\n case 13: return 'RCODE_13'\n case 14: return 'RCODE_14'\n case 15: return 'RCODE_15'\n }\n return 'RCODE_' + rcode\n}\n\nfunction toRcode (code) {\n switch (code.toUpperCase()) {\n case 'NOERROR': return 0\n case 'FORMERR': return 1\n case 'SERVFAIL': return 2\n case 'NXDOMAIN': return 3\n case 'NOTIMP': return 4\n case 'REFUSED': return 5\n case 'YXDOMAIN': return 6\n case 'YXRRSET': return 7\n case 'NXRRSET': return 8\n case 'NOTAUTH': return 9\n case 'NOTZONE': return 10\n case 'RCODE_11': return 11\n case 'RCODE_12': return 12\n case 'RCODE_13': return 13\n case 'RCODE_14': return 14\n case 'RCODE_15': return 15\n }\n return 0\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@leichtgewicht/dns-packet/rcodes.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@leichtgewicht/dns-packet/types.mjs":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@leichtgewicht/dns-packet/types.mjs ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString),\n/* harmony export */ toType: () => (/* binding */ toType)\n/* harmony export */ });\nfunction toString (type) {\n switch (type) {\n case 1: return 'A'\n case 10: return 'NULL'\n case 28: return 'AAAA'\n case 18: return 'AFSDB'\n case 42: return 'APL'\n case 257: return 'CAA'\n case 60: return 'CDNSKEY'\n case 59: return 'CDS'\n case 37: return 'CERT'\n case 5: return 'CNAME'\n case 49: return 'DHCID'\n case 32769: return 'DLV'\n case 39: return 'DNAME'\n case 48: return 'DNSKEY'\n case 43: return 'DS'\n case 55: return 'HIP'\n case 13: return 'HINFO'\n case 45: return 'IPSECKEY'\n case 25: return 'KEY'\n case 36: return 'KX'\n case 29: return 'LOC'\n case 15: return 'MX'\n case 35: return 'NAPTR'\n case 2: return 'NS'\n case 47: return 'NSEC'\n case 50: return 'NSEC3'\n case 51: return 'NSEC3PARAM'\n case 12: return 'PTR'\n case 46: return 'RRSIG'\n case 17: return 'RP'\n case 24: return 'SIG'\n case 6: return 'SOA'\n case 99: return 'SPF'\n case 33: return 'SRV'\n case 44: return 'SSHFP'\n case 32768: return 'TA'\n case 249: return 'TKEY'\n case 52: return 'TLSA'\n case 250: return 'TSIG'\n case 16: return 'TXT'\n case 252: return 'AXFR'\n case 251: return 'IXFR'\n case 41: return 'OPT'\n case 255: return 'ANY'\n }\n return 'UNKNOWN_' + type\n}\n\nfunction toType (name) {\n switch (name.toUpperCase()) {\n case 'A': return 1\n case 'NULL': return 10\n case 'AAAA': return 28\n case 'AFSDB': return 18\n case 'APL': return 42\n case 'CAA': return 257\n case 'CDNSKEY': return 60\n case 'CDS': return 59\n case 'CERT': return 37\n case 'CNAME': return 5\n case 'DHCID': return 49\n case 'DLV': return 32769\n case 'DNAME': return 39\n case 'DNSKEY': return 48\n case 'DS': return 43\n case 'HIP': return 55\n case 'HINFO': return 13\n case 'IPSECKEY': return 45\n case 'KEY': return 25\n case 'KX': return 36\n case 'LOC': return 29\n case 'MX': return 15\n case 'NAPTR': return 35\n case 'NS': return 2\n case 'NSEC': return 47\n case 'NSEC3': return 50\n case 'NSEC3PARAM': return 51\n case 'PTR': return 12\n case 'RRSIG': return 46\n case 'RP': return 17\n case 'SIG': return 24\n case 'SOA': return 6\n case 'SPF': return 99\n case 'SRV': return 33\n case 'SSHFP': return 44\n case 'TA': return 32768\n case 'TKEY': return 249\n case 'TLSA': return 52\n case 'TSIG': return 250\n case 'TXT': return 16\n case 'AXFR': return 252\n case 'IXFR': return 251\n case 'OPT': return 41\n case 'ANY': return 255\n case '*': return 255\n }\n if (name.toUpperCase().startsWith('UNKNOWN_')) return parseInt(name.slice(8))\n return 0\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@leichtgewicht/dns-packet/types.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@leichtgewicht/ip-codec/index.mjs":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/@leichtgewicht/ip-codec/index.mjs ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ familyOf: () => (/* binding */ familyOf),\n/* harmony export */ name: () => (/* binding */ name),\n/* harmony export */ sizeOf: () => (/* binding */ sizeOf),\n/* harmony export */ v4: () => (/* binding */ v4),\n/* harmony export */ v6: () => (/* binding */ v6)\n/* harmony export */ });\nconst v4Regex = /^(\\d{1,3}\\.){3,3}\\d{1,3}$/\nconst v4Size = 4\nconst v6Regex = /^(::)?(((\\d{1,3}\\.){3}(\\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i\nconst v6Size = 16\n\nconst v4 = {\n name: 'v4',\n size: v4Size,\n isFormat: ip => v4Regex.test(ip),\n encode (ip, buff, offset) {\n offset = ~~offset\n buff = buff || new Uint8Array(offset + v4Size)\n const max = ip.length\n let n = 0\n for (let i = 0; i < max;) {\n const c = ip.charCodeAt(i++)\n if (c === 46) { // \".\"\n buff[offset++] = n\n n = 0\n } else {\n n = n * 10 + (c - 48)\n }\n }\n buff[offset] = n\n return buff\n },\n decode (buff, offset) {\n offset = ~~offset\n return `${buff[offset++]}.${buff[offset++]}.${buff[offset++]}.${buff[offset]}`\n }\n}\n\nconst v6 = {\n name: 'v6',\n size: v6Size,\n isFormat: ip => ip.length > 0 && v6Regex.test(ip),\n encode (ip, buff, offset) {\n offset = ~~offset\n let end = offset + v6Size\n let fill = -1\n let hexN = 0\n let decN = 0\n let prevColon = true\n let useDec = false\n buff = buff || new Uint8Array(offset + v6Size)\n // Note: This algorithm needs to check if the offset\n // could exceed the buffer boundaries as it supports\n // non-standard compliant encodings that may go beyond\n // the boundary limits. if (offset < end) checks should\n // not be necessary...\n for (let i = 0; i < ip.length; i++) {\n let c = ip.charCodeAt(i)\n if (c === 58) { // :\n if (prevColon) {\n if (fill !== -1) {\n // Not Standard! (standard doesn't allow multiple ::)\n // We need to treat\n if (offset < end) buff[offset] = 0\n if (offset < end - 1) buff[offset + 1] = 0\n offset += 2\n } else if (offset < end) {\n // :: in the middle\n fill = offset\n }\n } else {\n // : ends the previous number\n if (useDec === true) {\n // Non-standard! (ipv4 should be at end only)\n // A ipv4 address should not be found anywhere else but at\n // the end. This codec also support putting characters\n // after the ipv4 address..\n if (offset < end) buff[offset] = decN\n offset++\n } else {\n if (offset < end) buff[offset] = hexN >> 8\n if (offset < end - 1) buff[offset + 1] = hexN & 0xff\n offset += 2\n }\n hexN = 0\n decN = 0\n }\n prevColon = true\n useDec = false\n } else if (c === 46) { // . indicates IPV4 notation\n if (offset < end) buff[offset] = decN\n offset++\n decN = 0\n hexN = 0\n prevColon = false\n useDec = true\n } else {\n prevColon = false\n if (c >= 97) {\n c -= 87 // a-f ... 97~102 -87 => 10~15\n } else if (c >= 65) {\n c -= 55 // A-F ... 65~70 -55 => 10~15\n } else {\n c -= 48 // 0-9 ... starting from charCode 48\n decN = decN * 10 + c\n }\n // We don't know yet if its a dec or hex number\n hexN = (hexN << 4) + c\n }\n }\n if (prevColon === false) {\n // Commiting last number\n if (useDec === true) {\n if (offset < end) buff[offset] = decN\n offset++\n } else {\n if (offset < end) buff[offset] = hexN >> 8\n if (offset < end - 1) buff[offset + 1] = hexN & 0xff\n offset += 2\n }\n } else if (fill === 0) {\n // Not Standard! (standard doesn't allow multiple ::)\n // This means that a : was found at the start AND end which means the\n // end needs to be treated as 0 entry...\n if (offset < end) buff[offset] = 0\n if (offset < end - 1) buff[offset + 1] = 0\n offset += 2\n } else if (fill !== -1) {\n // Non-standard! (standard doens't allow multiple ::)\n // Here we find that there has been a :: somewhere in the middle\n // and the end. To treat the end with priority we need to move all\n // written data two bytes to the right.\n offset += 2\n for (let i = Math.min(offset - 1, end - 1); i >= fill + 2; i--) {\n buff[i] = buff[i - 2]\n }\n buff[fill] = 0\n buff[fill + 1] = 0\n fill = offset\n }\n if (fill !== offset && fill !== -1) {\n // Move the written numbers to the end while filling the everything\n // \"fill\" to the bytes with zeros.\n if (offset > end - 2) {\n // Non Standard support, when the cursor exceeds bounds.\n offset = end - 2\n }\n while (end > fill) {\n buff[--end] = offset < end && offset > fill ? buff[--offset] : 0\n }\n } else {\n // Fill the rest with zeros\n while (offset < end) {\n buff[offset++] = 0\n }\n }\n return buff\n },\n decode (buff, offset) {\n offset = ~~offset\n let result = ''\n for (let i = 0; i < v6Size; i += 2) {\n if (i !== 0) {\n result += ':'\n }\n result += (buff[offset + i] << 8 | buff[offset + i + 1]).toString(16)\n }\n return result\n .replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3')\n .replace(/:{3,4}/, '::')\n }\n}\n\nconst name = 'ip'\nfunction sizeOf (ip) {\n if (v4.isFormat(ip)) return v4.size\n if (v6.isFormat(ip)) return v6.size\n throw Error(`Invalid ip address: ${ip}`)\n}\n\nfunction familyOf (string) {\n return sizeOf(string) === v4.size ? 1 : 2\n}\n\nfunction encode (ip, buff, offset) {\n offset = ~~offset\n const size = sizeOf(ip)\n if (typeof buff === 'function') {\n buff = buff(offset + size)\n }\n if (size === v4.size) {\n return v4.encode(ip, buff, offset)\n }\n return v6.encode(ip, buff, offset)\n}\n\nfunction decode (buff, offset, length) {\n offset = ~~offset\n length = length || (buff.length - offset)\n if (length === v4.size) {\n return v4.decode(buff, offset, length)\n }\n if (length === v6.size) {\n return v6.decode(buff, offset, length)\n }\n throw Error(`Invalid buffer size needs to be ${v4.size} for v4 or ${v6.size} for v6.`)\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@leichtgewicht/ip-codec/index.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/bootstrap/dist/src/index.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@libp2p/bootstrap/dist/src/index.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bootstrap: () => (/* binding */ bootstrap)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/event-target.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/peer-discovery/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/mafmt */ \"./node_modules/@multiformats/mafmt/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/**\n * @packageDocumentation\n *\n * The configured bootstrap peers will be discovered after the configured timeout. This will ensure there are some peers in the peer store for the node to use to discover other peers.\n *\n * They will be tagged with a tag with the name `'bootstrap'` tag, the value `50` and it will expire after two minutes which means the nodes connections may be closed if the maximum number of connections is reached.\n *\n * Clients that need constant connections to bootstrap nodes (e.g. browsers) can set the TTL to `Infinity`.\n *\n * @example Configuring a list of bootstrap nodes\n *\n * ```TypeScript\n * import { createLibp2p } from 'libp2p'\n * import { bootstrap } from '@libp2p/bootstrap'\n *\n * const libp2p = await createLibp2p({\n * peerDiscovery: [\n * bootstrap({\n * list: [\n * // a list of bootstrap peer multiaddrs to connect to on node startup\n * '/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ',\n * '/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN',\n * '/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa'\n * ]\n * })\n * ]\n * })\n *\n * libp2p.addEventListener('peer:discovery', (evt) => {\n * console.log('found peer: ', evt.detail.toString())\n * })\n * ```\n */\n\n\n\n\nconst DEFAULT_BOOTSTRAP_TAG_NAME = 'bootstrap';\nconst DEFAULT_BOOTSTRAP_TAG_VALUE = 50;\nconst DEFAULT_BOOTSTRAP_TAG_TTL = 120000;\nconst DEFAULT_BOOTSTRAP_DISCOVERY_TIMEOUT = 1000;\n/**\n * Emits 'peer' events on a regular interval for each peer in the provided list.\n */\nclass Bootstrap extends _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.TypedEventEmitter {\n static tag = 'bootstrap';\n log;\n timer;\n list;\n timeout;\n components;\n _init;\n constructor(components, options = { list: [] }) {\n if (options.list == null || options.list.length === 0) {\n throw new Error('Bootstrap requires a list of peer addresses');\n }\n super();\n this.components = components;\n this.log = components.logger.forComponent('libp2p:bootstrap');\n this.timeout = options.timeout ?? DEFAULT_BOOTSTRAP_DISCOVERY_TIMEOUT;\n this.list = [];\n for (const candidate of options.list) {\n if (!_multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.P2P.matches(candidate)) {\n this.log.error('Invalid multiaddr');\n continue;\n }\n const ma = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_1__.multiaddr)(candidate);\n const peerIdStr = ma.getPeerId();\n if (peerIdStr == null) {\n this.log.error('Invalid bootstrap multiaddr without peer id');\n continue;\n }\n const peerData = {\n id: (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__.peerIdFromString)(peerIdStr),\n multiaddrs: [ma]\n };\n this.list.push(peerData);\n }\n this._init = options;\n }\n [_libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.peerDiscoverySymbol] = this;\n [Symbol.toStringTag] = '@libp2p/bootstrap';\n isStarted() {\n return Boolean(this.timer);\n }\n /**\n * Start emitting events\n */\n start() {\n if (this.isStarted()) {\n return;\n }\n this.log('Starting bootstrap node discovery, discovering peers after %s ms', this.timeout);\n this.timer = setTimeout(() => {\n void this._discoverBootstrapPeers()\n .catch(err => {\n this.log.error(err);\n });\n }, this.timeout);\n }\n /**\n * Emit each address in the list as a PeerInfo\n */\n async _discoverBootstrapPeers() {\n if (this.timer == null) {\n return;\n }\n for (const peerData of this.list) {\n await this.components.peerStore.merge(peerData.id, {\n tags: {\n [this._init.tagName ?? DEFAULT_BOOTSTRAP_TAG_NAME]: {\n value: this._init.tagValue ?? DEFAULT_BOOTSTRAP_TAG_VALUE,\n ttl: this._init.tagTTL ?? DEFAULT_BOOTSTRAP_TAG_TTL\n }\n }\n });\n // check we are still running\n if (this.timer == null) {\n return;\n }\n this.safeDispatchEvent('peer', { detail: peerData });\n }\n }\n /**\n * Stop emitting events\n */\n stop() {\n if (this.timer != null) {\n clearTimeout(this.timer);\n }\n this.timer = undefined;\n }\n}\nfunction bootstrap(init) {\n return (components) => new Bootstrap(components, init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/bootstrap/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js":
|
||
/*!*************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js ***!
|
||
\*************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ create: () => (/* binding */ create),\n/* harmony export */ derivedEmptyPasswordKey: () => (/* binding */ derivedEmptyPasswordKey)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@libp2p/crypto/dist/src/webcrypto-browser.js\");\n\n\n\n// WebKit on Linux does not support deriving a key from an empty PBKDF2 key.\n// So, as a workaround, we provide the generated key as a constant. We test that\n// this generated key is accurate in test/workaround.spec.ts\n// Generated via:\n// await crypto.subtle.exportKey('jwk',\n// await crypto.subtle.deriveKey(\n// { name: 'PBKDF2', salt: new Uint8Array(16), iterations: 32767, hash: { name: 'SHA-256' } },\n// await crypto.subtle.importKey('raw', new Uint8Array(0), { name: 'PBKDF2' }, false, ['deriveKey']),\n// { name: 'AES-GCM', length: 128 }, true, ['encrypt', 'decrypt'])\n// )\nconst derivedEmptyPasswordKey = { alg: 'A128GCM', ext: true, k: 'scm9jmO_4BJAgdwWGVulLg', key_ops: ['encrypt', 'decrypt'], kty: 'oct' };\n// Based off of code from https://github.com/luke-park/SecureCompatibleEncryptionExamples\nfunction create(opts) {\n const algorithm = opts?.algorithm ?? 'AES-GCM';\n let keyLength = opts?.keyLength ?? 16;\n const nonceLength = opts?.nonceLength ?? 12;\n const digest = opts?.digest ?? 'SHA-256';\n const saltLength = opts?.saltLength ?? 16;\n const iterations = opts?.iterations ?? 32767;\n const crypto = _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get();\n keyLength *= 8; // Browser crypto uses bits instead of bytes\n /**\n * Uses the provided password to derive a pbkdf2 key. The key\n * will then be used to encrypt the data.\n */\n async function encrypt(data, password) {\n const salt = crypto.getRandomValues(new Uint8Array(saltLength));\n const nonce = crypto.getRandomValues(new Uint8Array(nonceLength));\n const aesGcm = { name: algorithm, iv: nonce };\n if (typeof password === 'string') {\n password = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(password);\n }\n let cryptoKey;\n if (password.length === 0) {\n cryptoKey = await crypto.subtle.importKey('jwk', derivedEmptyPasswordKey, { name: 'AES-GCM' }, true, ['encrypt']);\n try {\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, runtimeDerivedEmptyPassword, { name: algorithm, length: keyLength }, true, ['encrypt']);\n }\n catch {\n cryptoKey = await crypto.subtle.importKey('jwk', derivedEmptyPasswordKey, { name: 'AES-GCM' }, true, ['encrypt']);\n }\n }\n else {\n // Derive a key using PBKDF2.\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const rawKey = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, rawKey, { name: algorithm, length: keyLength }, true, ['encrypt']);\n }\n // Encrypt the string.\n const ciphertext = await crypto.subtle.encrypt(aesGcm, cryptoKey, data);\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([salt, aesGcm.iv, new Uint8Array(ciphertext)]);\n }\n /**\n * Uses the provided password to derive a pbkdf2 key. The key\n * will then be used to decrypt the data. The options used to create\n * this decryption cipher must be the same as those used to create\n * the encryption cipher.\n */\n async function decrypt(data, password) {\n const salt = data.subarray(0, saltLength);\n const nonce = data.subarray(saltLength, saltLength + nonceLength);\n const ciphertext = data.subarray(saltLength + nonceLength);\n const aesGcm = { name: algorithm, iv: nonce };\n if (typeof password === 'string') {\n password = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(password);\n }\n let cryptoKey;\n if (password.length === 0) {\n try {\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, runtimeDerivedEmptyPassword, { name: algorithm, length: keyLength }, true, ['decrypt']);\n }\n catch {\n cryptoKey = await crypto.subtle.importKey('jwk', derivedEmptyPasswordKey, { name: 'AES-GCM' }, true, ['decrypt']);\n }\n }\n else {\n // Derive the key using PBKDF2.\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const rawKey = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, rawKey, { name: algorithm, length: keyLength }, true, ['decrypt']);\n }\n // Decrypt the string.\n const plaintext = await crypto.subtle.decrypt(aesGcm, cryptoKey, ciphertext);\n return new Uint8Array(plaintext);\n }\n const cipher = {\n encrypt,\n decrypt\n };\n return cipher;\n}\n//# sourceMappingURL=aes-gcm.browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ create: () => (/* binding */ create)\n/* harmony export */ });\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@libp2p/crypto/dist/src/webcrypto-browser.js\");\n/* harmony import */ var _lengths_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lengths.js */ \"./node_modules/@libp2p/crypto/dist/src/hmac/lengths.js\");\n\n\nconst hashTypes = {\n SHA1: 'SHA-1',\n SHA256: 'SHA-256',\n SHA512: 'SHA-512'\n};\nconst sign = async (key, data) => {\n const buf = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().subtle.sign({ name: 'HMAC' }, key, data);\n return new Uint8Array(buf, 0, buf.byteLength);\n};\nasync function create(hashType, secret) {\n const hash = hashTypes[hashType];\n const key = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().subtle.importKey('raw', secret, {\n name: 'HMAC',\n hash: { name: hash }\n }, false, ['sign']);\n return {\n async digest(data) {\n return sign(key, data);\n },\n length: _lengths_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"][hashType]\n };\n}\n//# sourceMappingURL=index-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/hmac/lengths.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/hmac/lengths.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n SHA1: 20,\n SHA256: 32,\n SHA512: 64\n});\n//# sourceMappingURL=lengths.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/hmac/lengths.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js":
|
||
/*!*******************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js ***!
|
||
\*******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ generateEphmeralKeyPair: () => (/* binding */ generateEphmeralKeyPair)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@libp2p/crypto/dist/src/util.js\");\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@libp2p/crypto/dist/src/webcrypto-browser.js\");\n\n\n\n\n\n\nconst bits = {\n 'P-256': 256,\n 'P-384': 384,\n 'P-521': 521\n};\nconst curveTypes = Object.keys(bits);\nconst names = curveTypes.join(' / ');\nasync function generateEphmeralKeyPair(curve) {\n if (curve !== 'P-256' && curve !== 'P-384' && curve !== 'P-521') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(`Unknown curve: ${curve}. Must be ${names}`, 'ERR_INVALID_CURVE');\n }\n const pair = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.generateKey({\n name: 'ECDH',\n namedCurve: curve\n }, true, ['deriveBits']);\n // forcePrivate is used for testing only\n const genSharedKey = async (theirPub, forcePrivate) => {\n let privateKey;\n if (forcePrivate != null) {\n privateKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.importKey('jwk', unmarshalPrivateKey(curve, forcePrivate), {\n name: 'ECDH',\n namedCurve: curve\n }, false, ['deriveBits']);\n }\n else {\n privateKey = pair.privateKey;\n }\n const key = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.importKey('jwk', unmarshalPublicKey(curve, theirPub), {\n name: 'ECDH',\n namedCurve: curve\n }, false, []);\n const buffer = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.deriveBits({\n name: 'ECDH',\n // @ts-expect-error namedCurve is missing from the types\n namedCurve: curve,\n public: key\n }, privateKey, bits[curve]);\n return new Uint8Array(buffer, 0, buffer.byteLength);\n };\n const publicKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.exportKey('jwk', pair.publicKey);\n const ecdhKey = {\n key: marshalPublicKey(publicKey),\n genSharedKey\n };\n return ecdhKey;\n}\nconst curveLengths = {\n 'P-256': 32,\n 'P-384': 48,\n 'P-521': 66\n};\n// Marshal converts a jwk encoded ECDH public key into the\n// form specified in section 4.3.6 of ANSI X9.62. (This is the format\n// go-ipfs uses)\nfunction marshalPublicKey(jwk) {\n if (jwk.crv == null || jwk.x == null || jwk.y == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('JWK was missing components', 'ERR_INVALID_PARAMETERS');\n }\n if (jwk.crv !== 'P-256' && jwk.crv !== 'P-384' && jwk.crv !== 'P-521') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(`Unknown curve: ${jwk.crv}. Must be ${names}`, 'ERR_INVALID_CURVE');\n }\n const byteLen = curveLengths[jwk.crv];\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([\n Uint8Array.from([4]), // uncompressed point\n (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBuffer)(jwk.x, byteLen),\n (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.base64urlToBuffer)(jwk.y, byteLen)\n ], 1 + byteLen * 2);\n}\n// Unmarshal converts a point, serialized by Marshal, into an jwk encoded key\nfunction unmarshalPublicKey(curve, key) {\n if (curve !== 'P-256' && curve !== 'P-384' && curve !== 'P-521') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(`Unknown curve: ${curve}. Must be ${names}`, 'ERR_INVALID_CURVE');\n }\n const byteLen = curveLengths[curve];\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(key.subarray(0, 1), Uint8Array.from([4]))) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Cannot unmarshal public key - invalid key format', 'ERR_INVALID_KEY_FORMAT');\n }\n return {\n kty: 'EC',\n crv: curve,\n x: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(key.subarray(1, byteLen + 1), 'base64url'),\n y: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(key.subarray(1 + byteLen), 'base64url'),\n ext: true\n };\n}\nconst unmarshalPrivateKey = (curve, key) => ({\n ...unmarshalPublicKey(curve, key.public),\n d: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(key.private, 'base64url')\n});\n//# sourceMappingURL=ecdh-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js":
|
||
/*!**********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js ***!
|
||
\**********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ generateKey: () => (/* binding */ generateKey),\n/* harmony export */ generateKeyFromSeed: () => (/* binding */ generateKeyFromSeed),\n/* harmony export */ hashAndSign: () => (/* binding */ hashAndSign),\n/* harmony export */ hashAndVerify: () => (/* binding */ hashAndVerify),\n/* harmony export */ privateKeyLength: () => (/* binding */ PRIVATE_KEY_BYTE_LENGTH),\n/* harmony export */ publicKeyLength: () => (/* binding */ PUBLIC_KEY_BYTE_LENGTH)\n/* harmony export */ });\n/* harmony import */ var _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/curves/ed25519 */ \"./node_modules/@noble/curves/esm/ed25519.js\");\n\nconst PUBLIC_KEY_BYTE_LENGTH = 32;\nconst PRIVATE_KEY_BYTE_LENGTH = 64; // private key is actually 32 bytes but for historical reasons we concat private and public keys\nconst KEYS_BYTE_LENGTH = 32;\n\n\nfunction generateKey() {\n // the actual private key (32 bytes)\n const privateKeyRaw = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__.ed25519.utils.randomPrivateKey();\n const publicKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__.ed25519.getPublicKey(privateKeyRaw);\n // concatenated the public key to the private key\n const privateKey = concatKeys(privateKeyRaw, publicKey);\n return {\n privateKey,\n publicKey\n };\n}\n/**\n * Generate keypair from a 32 byte uint8array\n */\nfunction generateKeyFromSeed(seed) {\n if (seed.length !== KEYS_BYTE_LENGTH) {\n throw new TypeError('\"seed\" must be 32 bytes in length.');\n }\n else if (!(seed instanceof Uint8Array)) {\n throw new TypeError('\"seed\" must be a node.js Buffer, or Uint8Array.');\n }\n // based on node forges algorithm, the seed is used directly as private key\n const privateKeyRaw = seed;\n const publicKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__.ed25519.getPublicKey(privateKeyRaw);\n const privateKey = concatKeys(privateKeyRaw, publicKey);\n return {\n privateKey,\n publicKey\n };\n}\nfunction hashAndSign(privateKey, msg) {\n const privateKeyRaw = privateKey.subarray(0, KEYS_BYTE_LENGTH);\n return _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__.ed25519.sign(msg instanceof Uint8Array ? msg : msg.subarray(), privateKeyRaw);\n}\nfunction hashAndVerify(publicKey, sig, msg) {\n return _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_0__.ed25519.verify(sig, msg instanceof Uint8Array ? msg : msg.subarray(), publicKey);\n}\nfunction concatKeys(privateKeyRaw, publicKey) {\n const privateKey = new Uint8Array(PRIVATE_KEY_BYTE_LENGTH);\n for (let i = 0; i < KEYS_BYTE_LENGTH; i++) {\n privateKey[i] = privateKeyRaw[i];\n privateKey[KEYS_BYTE_LENGTH + i] = publicKey[i];\n }\n return privateKey;\n}\n//# sourceMappingURL=ed25519-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Ed25519PrivateKey: () => (/* binding */ Ed25519PrivateKey),\n/* harmony export */ Ed25519PublicKey: () => (/* binding */ Ed25519PublicKey),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ generateKeyPairFromSeed: () => (/* binding */ generateKeyPairFromSeed),\n/* harmony export */ unmarshalEd25519PrivateKey: () => (/* binding */ unmarshalEd25519PrivateKey),\n/* harmony export */ unmarshalEd25519PublicKey: () => (/* binding */ unmarshalEd25519PublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/dist/src/bases/base58.js\");\n/* harmony import */ var multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/hashes/identity */ \"./node_modules/multiformats/dist/src/hashes/identity.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@libp2p/crypto/dist/src/util.js\");\n/* harmony import */ var _ed25519_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ed25519.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js\");\n/* harmony import */ var _exporter_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./exporter.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/exporter.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n\n\n\n\n\n\n\n\n\nclass Ed25519PublicKey {\n _key;\n constructor(key) {\n this._key = ensureKey(key, _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.publicKeyLength);\n }\n verify(data, sig) {\n return _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.hashAndVerify(this._key, sig, data);\n }\n marshal() {\n return this._key;\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_5__.PublicKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_5__.KeyType.Ed25519,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(this.bytes, key.bytes);\n }\n hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__.sha256.digest(this.bytes);\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_6__.isPromise)(p)) {\n return p.then(({ bytes }) => bytes);\n }\n return p.bytes;\n }\n}\nclass Ed25519PrivateKey {\n _key;\n _publicKey;\n // key - 64 byte Uint8Array containing private key\n // publicKey - 32 byte Uint8Array containing public key\n constructor(key, publicKey) {\n this._key = ensureKey(key, _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.privateKeyLength);\n this._publicKey = ensureKey(publicKey, _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.publicKeyLength);\n }\n sign(message) {\n return _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.hashAndSign(this._key, message);\n }\n get public() {\n return new Ed25519PublicKey(this._publicKey);\n }\n marshal() {\n return this._key;\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_5__.PrivateKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_5__.KeyType.Ed25519,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(this.bytes, key.bytes);\n }\n async hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__.sha256.digest(this.bytes);\n let bytes;\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_6__.isPromise)(p)) {\n ({ bytes } = await p);\n }\n else {\n bytes = p.bytes;\n }\n return bytes;\n }\n /**\n * Gets the ID of the key.\n *\n * The key id is the base58 encoding of the identity multihash containing its public key.\n * The public key is a protobuf encoding containing a type and the DER encoding\n * of the PKCS SubjectPublicKeyInfo.\n *\n * @returns {Promise<string>}\n */\n async id() {\n const encoding = multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_1__.identity.digest(this.public.bytes);\n return multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_0__.base58btc.encode(encoding.bytes).substring(1);\n }\n /**\n * Exports the key into a password protected `format`\n */\n async export(password, format = 'libp2p-key') {\n if (format === 'libp2p-key') {\n return (0,_exporter_js__WEBPACK_IMPORTED_MODULE_7__.exporter)(this.bytes, password);\n }\n else {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError(`export format '${format}' is not supported`, 'ERR_INVALID_EXPORT_FORMAT');\n }\n }\n}\nfunction unmarshalEd25519PrivateKey(bytes) {\n // Try the old, redundant public key version\n if (bytes.length > _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.privateKeyLength) {\n bytes = ensureKey(bytes, _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.privateKeyLength + _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.publicKeyLength);\n const privateKeyBytes = bytes.subarray(0, _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.privateKeyLength);\n const publicKeyBytes = bytes.subarray(_ed25519_js__WEBPACK_IMPORTED_MODULE_4__.privateKeyLength, bytes.length);\n return new Ed25519PrivateKey(privateKeyBytes, publicKeyBytes);\n }\n bytes = ensureKey(bytes, _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.privateKeyLength);\n const privateKeyBytes = bytes.subarray(0, _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.privateKeyLength);\n const publicKeyBytes = bytes.subarray(_ed25519_js__WEBPACK_IMPORTED_MODULE_4__.publicKeyLength);\n return new Ed25519PrivateKey(privateKeyBytes, publicKeyBytes);\n}\nfunction unmarshalEd25519PublicKey(bytes) {\n bytes = ensureKey(bytes, _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.publicKeyLength);\n return new Ed25519PublicKey(bytes);\n}\nasync function generateKeyPair() {\n const { privateKey, publicKey } = _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.generateKey();\n return new Ed25519PrivateKey(privateKey, publicKey);\n}\nasync function generateKeyPairFromSeed(seed) {\n const { privateKey, publicKey } = _ed25519_js__WEBPACK_IMPORTED_MODULE_4__.generateKeyFromSeed(seed);\n return new Ed25519PrivateKey(privateKey, publicKey);\n}\nfunction ensureKey(key, length) {\n key = Uint8Array.from(key ?? []);\n if (key.length !== length) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError(`Key must be a Uint8Array of length ${length}, got ${key.length}`, 'ERR_INVALID_KEY_TYPE');\n }\n return key;\n}\n//# sourceMappingURL=ed25519-class.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js":
|
||
/*!*********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js ***!
|
||
\*********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _ecdh_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ecdh.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js\");\n\n/**\n * Generates an ephemeral public key and returns a function that will compute\n * the shared secret key.\n *\n * Focuses only on ECDH now, but can be made more general in the future.\n */\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_ecdh_js__WEBPACK_IMPORTED_MODULE_0__.generateEphmeralKeyPair);\n//# sourceMappingURL=ephemeral-keys.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/exporter.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/exporter.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ exporter: () => (/* binding */ exporter)\n/* harmony export */ });\n/* harmony import */ var multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/bases/base64 */ \"./node_modules/multiformats/dist/src/bases/base64.js\");\n/* harmony import */ var _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ciphers/aes-gcm.js */ \"./node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js\");\n\n\n/**\n * Exports the given PrivateKey as a base64 encoded string.\n * The PrivateKey is encrypted via a password derived PBKDF2 key\n * leveraging the aes-gcm cipher algorithm.\n */\nasync function exporter(privateKey, password) {\n const cipher = _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__.create();\n const encryptedKey = await cipher.encrypt(privateKey, password);\n return multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__.base64.encode(encryptedKey);\n}\n//# sourceMappingURL=exporter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/exporter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/importer.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/importer.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ importer: () => (/* binding */ importer)\n/* harmony export */ });\n/* harmony import */ var multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/bases/base64 */ \"./node_modules/multiformats/dist/src/bases/base64.js\");\n/* harmony import */ var _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ciphers/aes-gcm.js */ \"./node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js\");\n\n\n/**\n * Attempts to decrypt a base64 encoded PrivateKey string\n * with the given password. The privateKey must have been exported\n * using the same password and underlying cipher (aes-gcm)\n */\nasync function importer(privateKey, password) {\n const encryptedKey = multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__.base64.decode(privateKey);\n const cipher = _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__.create();\n return cipher.decrypt(encryptedKey, password);\n}\n//# sourceMappingURL=importer.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/importer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/index.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/index.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Ed25519PrivateKey: () => (/* reexport safe */ _ed25519_class_js__WEBPACK_IMPORTED_MODULE_4__.Ed25519PrivateKey),\n/* harmony export */ Ed25519PublicKey: () => (/* reexport safe */ _ed25519_class_js__WEBPACK_IMPORTED_MODULE_4__.Ed25519PublicKey),\n/* harmony export */ MAX_RSA_KEY_SIZE: () => (/* reexport safe */ _rsa_class_js__WEBPACK_IMPORTED_MODULE_3__.MAX_RSA_KEY_SIZE),\n/* harmony export */ RsaPrivateKey: () => (/* reexport safe */ _rsa_class_js__WEBPACK_IMPORTED_MODULE_3__.RsaPrivateKey),\n/* harmony export */ RsaPublicKey: () => (/* reexport safe */ _rsa_class_js__WEBPACK_IMPORTED_MODULE_3__.RsaPublicKey),\n/* harmony export */ Secp256k1PrivateKey: () => (/* reexport safe */ _secp256k1_class_js__WEBPACK_IMPORTED_MODULE_5__.Secp256k1PrivateKey),\n/* harmony export */ Secp256k1PublicKey: () => (/* reexport safe */ _secp256k1_class_js__WEBPACK_IMPORTED_MODULE_5__.Secp256k1PublicKey),\n/* harmony export */ generateEphemeralKeyPair: () => (/* reexport safe */ _ephemeral_keys_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ generateKeyPairFromSeed: () => (/* binding */ generateKeyPairFromSeed),\n/* harmony export */ importKey: () => (/* binding */ importKey),\n/* harmony export */ keyStretcher: () => (/* reexport safe */ _key_stretcher_js__WEBPACK_IMPORTED_MODULE_0__.keyStretcher),\n/* harmony export */ keysPBM: () => (/* reexport module object */ _keys_js__WEBPACK_IMPORTED_MODULE_2__),\n/* harmony export */ marshalPrivateKey: () => (/* binding */ marshalPrivateKey),\n/* harmony export */ marshalPublicKey: () => (/* binding */ marshalPublicKey),\n/* harmony export */ supportedKeys: () => (/* binding */ supportedKeys),\n/* harmony export */ unmarshalPrivateKey: () => (/* binding */ unmarshalPrivateKey),\n/* harmony export */ unmarshalPublicKey: () => (/* binding */ unmarshalPublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _ed25519_class_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ed25519-class.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js\");\n/* harmony import */ var _ephemeral_keys_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ephemeral-keys.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js\");\n/* harmony import */ var _importer_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./importer.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/importer.js\");\n/* harmony import */ var _key_stretcher_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./key-stretcher.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n/* harmony import */ var _rsa_class_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./rsa-class.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js\");\n/* harmony import */ var _rsa_utils_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./rsa-utils.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js\");\n/* harmony import */ var _secp256k1_class_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./secp256k1-class.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js\");\n/**\n * @packageDocumentation\n *\n * **Supported Key Types**\n *\n * The {@link generateKeyPair}, {@link marshalPublicKey}, and {@link marshalPrivateKey} functions accept a string `type` argument.\n *\n * Currently the `'RSA'`, `'ed25519'`, and `secp256k1` types are supported, although ed25519 and secp256k1 keys support only signing and verification of messages.\n *\n * For encryption / decryption support, RSA keys should be used.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst supportedKeys = {\n rsa: _rsa_class_js__WEBPACK_IMPORTED_MODULE_3__,\n ed25519: _ed25519_class_js__WEBPACK_IMPORTED_MODULE_4__,\n secp256k1: _secp256k1_class_js__WEBPACK_IMPORTED_MODULE_5__\n};\nfunction unsupportedKey(type) {\n const supported = Object.keys(supportedKeys).join(' / ');\n return new _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__.CodeError(`invalid or unsupported key type ${type}. Must be ${supported}`, 'ERR_UNSUPPORTED_KEY_TYPE');\n}\nfunction typeToKey(type) {\n type = type.toLowerCase();\n if (type === 'rsa' || type === 'ed25519' || type === 'secp256k1') {\n return supportedKeys[type];\n }\n throw unsupportedKey(type);\n}\n/**\n * Generates a keypair of the given type and bitsize\n *\n * @param type\n * @param bits - Minimum of 1024\n */\nasync function generateKeyPair(type, bits) {\n return typeToKey(type).generateKeyPair(bits ?? 2048);\n}\n/**\n * Generates a keypair of the given type and bitsize.\n *\n * Seed is a 32 byte uint8array\n */\nasync function generateKeyPairFromSeed(type, seed, bits) {\n if (type.toLowerCase() !== 'ed25519') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__.CodeError('Seed key derivation is unimplemented for RSA or secp256k1', 'ERR_UNSUPPORTED_KEY_DERIVATION_TYPE');\n }\n return _ed25519_class_js__WEBPACK_IMPORTED_MODULE_4__.generateKeyPairFromSeed(seed);\n}\n/**\n * Converts a protobuf serialized public key into its representative object\n */\nfunction unmarshalPublicKey(buf) {\n const decoded = _keys_js__WEBPACK_IMPORTED_MODULE_2__.PublicKey.decode(buf);\n const data = decoded.Data ?? new Uint8Array();\n switch (decoded.Type) {\n case _keys_js__WEBPACK_IMPORTED_MODULE_2__.KeyType.RSA:\n return supportedKeys.rsa.unmarshalRsaPublicKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_2__.KeyType.Ed25519:\n return supportedKeys.ed25519.unmarshalEd25519PublicKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_2__.KeyType.Secp256k1:\n return supportedKeys.secp256k1.unmarshalSecp256k1PublicKey(data);\n default:\n throw unsupportedKey(decoded.Type ?? 'unknown');\n }\n}\n/**\n * Converts a public key object into a protobuf serialized public key\n */\nfunction marshalPublicKey(key, type) {\n type = (type ?? 'rsa').toLowerCase();\n typeToKey(type); // check type\n return key.bytes;\n}\n/**\n * Converts a protobuf serialized private key into its representative object\n */\nasync function unmarshalPrivateKey(buf) {\n const decoded = _keys_js__WEBPACK_IMPORTED_MODULE_2__.PrivateKey.decode(buf);\n const data = decoded.Data ?? new Uint8Array();\n switch (decoded.Type) {\n case _keys_js__WEBPACK_IMPORTED_MODULE_2__.KeyType.RSA:\n return supportedKeys.rsa.unmarshalRsaPrivateKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_2__.KeyType.Ed25519:\n return supportedKeys.ed25519.unmarshalEd25519PrivateKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_2__.KeyType.Secp256k1:\n return supportedKeys.secp256k1.unmarshalSecp256k1PrivateKey(data);\n default:\n throw unsupportedKey(decoded.Type ?? 'RSA');\n }\n}\n/**\n * Converts a private key object into a protobuf serialized private key\n */\nfunction marshalPrivateKey(key, type) {\n type = (type ?? 'rsa').toLowerCase();\n typeToKey(type); // check type\n return key.bytes;\n}\n/**\n * Converts an exported private key into its representative object.\n *\n * Supported formats are 'pem' (RSA only) and 'libp2p-key'.\n */\nasync function importKey(encryptedKey, password) {\n try {\n const key = await (0,_importer_js__WEBPACK_IMPORTED_MODULE_7__.importer)(encryptedKey, password);\n return await unmarshalPrivateKey(key);\n }\n catch (_) {\n // Ignore and try the old pem decrypt\n }\n if (!encryptedKey.includes('BEGIN')) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__.CodeError('Encrypted key was not a libp2p-key or a PEM file', 'ERR_INVALID_IMPORT_FORMAT');\n }\n return (0,_rsa_utils_js__WEBPACK_IMPORTED_MODULE_8__.importFromPem)(encryptedKey, password);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ keyStretcher: () => (/* binding */ keyStretcher)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _hmac_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hmac/index.js */ \"./node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js\");\n\n\n\n\nconst cipherMap = {\n 'AES-128': {\n ivSize: 16,\n keySize: 16\n },\n 'AES-256': {\n ivSize: 16,\n keySize: 32\n },\n Blowfish: {\n ivSize: 8,\n keySize: 32\n }\n};\n/**\n * Generates a set of keys for each party by stretching the shared key.\n * (myIV, theirIV, myCipherKey, theirCipherKey, myMACKey, theirMACKey)\n */\nasync function keyStretcher(cipherType, hash, secret) {\n const cipher = cipherMap[cipherType];\n if (cipher == null) {\n const allowed = Object.keys(cipherMap).join(' / ');\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError(`unknown cipher type '${cipherType}'. Must be ${allowed}`, 'ERR_INVALID_CIPHER_TYPE');\n }\n if (hash == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError('missing hash type', 'ERR_MISSING_HASH_TYPE');\n }\n const cipherKeySize = cipher.keySize;\n const ivSize = cipher.ivSize;\n const hmacKeySize = 20;\n const seed = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)('key expansion');\n const resultLength = 2 * (ivSize + cipherKeySize + hmacKeySize);\n const m = await _hmac_index_js__WEBPACK_IMPORTED_MODULE_3__.create(hash, secret);\n let a = await m.digest(seed);\n const result = [];\n let j = 0;\n while (j < resultLength) {\n const b = await m.digest((0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([a, seed]));\n let todo = b.length;\n if (j + todo > resultLength) {\n todo = resultLength - j;\n }\n result.push(b);\n j += todo;\n a = await m.digest(a);\n }\n const half = resultLength / 2;\n const resultBuffer = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)(result);\n const r1 = resultBuffer.subarray(0, half);\n const r2 = resultBuffer.subarray(half, resultLength);\n const createKey = (res) => ({\n iv: res.subarray(0, ivSize),\n cipherKey: res.subarray(ivSize, ivSize + cipherKeySize),\n macKey: res.subarray(ivSize + cipherKeySize)\n });\n return {\n k1: createKey(r1),\n k2: createKey(r2)\n };\n}\n//# sourceMappingURL=key-stretcher.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/keys.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/keys.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ KeyType: () => (/* binding */ KeyType),\n/* harmony export */ PrivateKey: () => (/* binding */ PrivateKey),\n/* harmony export */ PublicKey: () => (/* binding */ PublicKey)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar KeyType;\n(function (KeyType) {\n KeyType[\"RSA\"] = \"RSA\";\n KeyType[\"Ed25519\"] = \"Ed25519\";\n KeyType[\"Secp256k1\"] = \"Secp256k1\";\n})(KeyType || (KeyType = {}));\nvar __KeyTypeValues;\n(function (__KeyTypeValues) {\n __KeyTypeValues[__KeyTypeValues[\"RSA\"] = 0] = \"RSA\";\n __KeyTypeValues[__KeyTypeValues[\"Ed25519\"] = 1] = \"Ed25519\";\n __KeyTypeValues[__KeyTypeValues[\"Secp256k1\"] = 2] = \"Secp256k1\";\n})(__KeyTypeValues || (__KeyTypeValues = {}));\n(function (KeyType) {\n KeyType.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__KeyTypeValues);\n };\n})(KeyType || (KeyType = {}));\nvar PublicKey;\n(function (PublicKey) {\n let _codec;\n PublicKey.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.Type != null) {\n w.uint32(8);\n KeyType.codec().encode(obj.Type, w);\n }\n if (obj.Data != null) {\n w.uint32(18);\n w.bytes(obj.Data);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.Type = KeyType.codec().decode(reader);\n break;\n case 2:\n obj.Data = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PublicKey.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PublicKey.codec());\n };\n PublicKey.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PublicKey.codec());\n };\n})(PublicKey || (PublicKey = {}));\nvar PrivateKey;\n(function (PrivateKey) {\n let _codec;\n PrivateKey.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.Type != null) {\n w.uint32(8);\n KeyType.codec().encode(obj.Type, w);\n }\n if (obj.Data != null) {\n w.uint32(18);\n w.bytes(obj.Data);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.Type = KeyType.codec().decode(reader);\n break;\n case 2:\n obj.Data = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PrivateKey.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PrivateKey.codec());\n };\n PrivateKey.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PrivateKey.codec());\n };\n})(PrivateKey || (PrivateKey = {}));\n//# sourceMappingURL=keys.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/keys.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js":
|
||
/*!******************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js ***!
|
||
\******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ generateKey: () => (/* binding */ generateKey),\n/* harmony export */ getRandomValues: () => (/* reexport safe */ _random_bytes_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]),\n/* harmony export */ hashAndSign: () => (/* binding */ hashAndSign),\n/* harmony export */ hashAndVerify: () => (/* binding */ hashAndVerify),\n/* harmony export */ keySize: () => (/* binding */ keySize),\n/* harmony export */ unmarshalPrivateKey: () => (/* binding */ unmarshalPrivateKey),\n/* harmony export */ utils: () => (/* reexport module object */ _rsa_utils_js__WEBPACK_IMPORTED_MODULE_1__)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _random_bytes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../random-bytes.js */ \"./node_modules/@libp2p/crypto/dist/src/random-bytes.js\");\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@libp2p/crypto/dist/src/webcrypto-browser.js\");\n/* harmony import */ var _rsa_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rsa-utils.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js\");\n\n\n\n\n\n\nasync function generateKey(bits) {\n const pair = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get().subtle.generateKey({\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: bits,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n hash: { name: 'SHA-256' }\n }, true, ['sign', 'verify']);\n const keys = await exportKey(pair);\n return {\n privateKey: keys[0],\n publicKey: keys[1]\n };\n}\n// Takes a jwk key\nasync function unmarshalPrivateKey(key) {\n const privateKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get().subtle.importKey('jwk', key, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, true, ['sign']);\n const pair = [\n privateKey,\n await derivePublicFromPrivate(key)\n ];\n const keys = await exportKey({\n privateKey: pair[0],\n publicKey: pair[1]\n });\n return {\n privateKey: keys[0],\n publicKey: keys[1]\n };\n}\n\nasync function hashAndSign(key, msg) {\n const privateKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get().subtle.importKey('jwk', key, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, false, ['sign']);\n const sig = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get().subtle.sign({ name: 'RSASSA-PKCS1-v1_5' }, privateKey, msg instanceof Uint8Array ? msg : msg.subarray());\n return new Uint8Array(sig, 0, sig.byteLength);\n}\nasync function hashAndVerify(key, sig, msg) {\n const publicKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get().subtle.importKey('jwk', key, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, false, ['verify']);\n return _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get().subtle.verify({ name: 'RSASSA-PKCS1-v1_5' }, publicKey, sig, msg instanceof Uint8Array ? msg : msg.subarray());\n}\nasync function exportKey(pair) {\n if (pair.privateKey == null || pair.publicKey == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CodeError('Private and public key are required', 'ERR_INVALID_PARAMETERS');\n }\n return Promise.all([\n _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get().subtle.exportKey('jwk', pair.privateKey),\n _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get().subtle.exportKey('jwk', pair.publicKey)\n ]);\n}\nasync function derivePublicFromPrivate(jwKey) {\n return _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get().subtle.importKey('jwk', {\n kty: jwKey.kty,\n n: jwKey.n,\n e: jwKey.e\n }, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, true, ['verify']);\n}\nfunction keySize(jwk) {\n if (jwk.kty !== 'RSA') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CodeError('invalid key type', 'ERR_INVALID_KEY_TYPE');\n }\n else if (jwk.n == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CodeError('invalid key modulus', 'ERR_INVALID_KEY_MODULUS');\n }\n const bytes = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(jwk.n, 'base64url');\n return bytes.length * 8;\n}\n//# sourceMappingURL=rsa-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MAX_RSA_KEY_SIZE: () => (/* binding */ MAX_RSA_KEY_SIZE),\n/* harmony export */ RsaPrivateKey: () => (/* binding */ RsaPrivateKey),\n/* harmony export */ RsaPublicKey: () => (/* binding */ RsaPublicKey),\n/* harmony export */ fromJwk: () => (/* binding */ fromJwk),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ unmarshalRsaPrivateKey: () => (/* binding */ unmarshalRsaPrivateKey),\n/* harmony export */ unmarshalRsaPublicKey: () => (/* binding */ unmarshalRsaPublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@libp2p/crypto/dist/src/util.js\");\n/* harmony import */ var _exporter_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./exporter.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/exporter.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n/* harmony import */ var _rsa_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./rsa.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js\");\n/* harmony import */ var _rsa_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./rsa.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js\");\n/* harmony import */ var _rsa_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./rsa.js */ \"./node_modules/@libp2p/crypto/dist/src/random-bytes.js\");\n\n\n\n\n\n\n\n\nconst MAX_RSA_KEY_SIZE = 8192;\nclass RsaPublicKey {\n _key;\n constructor(key) {\n this._key = key;\n }\n verify(data, sig) {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_3__.hashAndVerify(this._key, sig, data);\n }\n marshal() {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_4__.jwkToPkix(this._key);\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_5__.PublicKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_5__.KeyType.RSA,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(this.bytes, key.bytes);\n }\n hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(this.bytes);\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_6__.isPromise)(p)) {\n return p.then(({ bytes }) => bytes);\n }\n return p.bytes;\n }\n}\nclass RsaPrivateKey {\n _key;\n _publicKey;\n constructor(key, publicKey) {\n this._key = key;\n this._publicKey = publicKey;\n }\n genSecret() {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"](16);\n }\n sign(message) {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_3__.hashAndSign(this._key, message);\n }\n get public() {\n if (this._publicKey == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError('public key not provided', 'ERR_PUBKEY_NOT_PROVIDED');\n }\n return new RsaPublicKey(this._publicKey);\n }\n marshal() {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_4__.jwkToPkcs1(this._key);\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_5__.PrivateKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_5__.KeyType.RSA,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(this.bytes, key.bytes);\n }\n hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(this.bytes);\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_6__.isPromise)(p)) {\n return p.then(({ bytes }) => bytes);\n }\n return p.bytes;\n }\n /**\n * Gets the ID of the key.\n *\n * The key id is the base58 encoding of the SHA-256 multihash of its public key.\n * The public key is a protobuf encoding containing a type and the DER encoding\n * of the PKCS SubjectPublicKeyInfo.\n */\n async id() {\n const hash = await this.public.hash();\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(hash, 'base58btc');\n }\n /**\n * Exports the key as libp2p-key - a aes-gcm encrypted value with the key\n * derived from the password.\n *\n * To export it as a password protected PEM file, please use the `exportPEM`\n * function from `@libp2p/rsa`.\n */\n async export(password, format = 'pkcs-8') {\n if (format === 'pkcs-8') {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_4__.exportToPem(this, password);\n }\n else if (format === 'libp2p-key') {\n return (0,_exporter_js__WEBPACK_IMPORTED_MODULE_9__.exporter)(this.bytes, password);\n }\n else {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError(`export format '${format}' is not supported`, 'ERR_INVALID_EXPORT_FORMAT');\n }\n }\n}\nasync function unmarshalRsaPrivateKey(bytes) {\n const jwk = _rsa_js__WEBPACK_IMPORTED_MODULE_4__.pkcs1ToJwk(bytes);\n if (_rsa_js__WEBPACK_IMPORTED_MODULE_3__.keySize(jwk) > MAX_RSA_KEY_SIZE) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError('key size is too large', 'ERR_KEY_SIZE_TOO_LARGE');\n }\n const keys = await _rsa_js__WEBPACK_IMPORTED_MODULE_3__.unmarshalPrivateKey(jwk);\n return new RsaPrivateKey(keys.privateKey, keys.publicKey);\n}\nfunction unmarshalRsaPublicKey(bytes) {\n const jwk = _rsa_js__WEBPACK_IMPORTED_MODULE_4__.pkixToJwk(bytes);\n if (_rsa_js__WEBPACK_IMPORTED_MODULE_3__.keySize(jwk) > MAX_RSA_KEY_SIZE) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError('key size is too large', 'ERR_KEY_SIZE_TOO_LARGE');\n }\n return new RsaPublicKey(jwk);\n}\nasync function fromJwk(jwk) {\n if (_rsa_js__WEBPACK_IMPORTED_MODULE_3__.keySize(jwk) > MAX_RSA_KEY_SIZE) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError('key size is too large', 'ERR_KEY_SIZE_TOO_LARGE');\n }\n const keys = await _rsa_js__WEBPACK_IMPORTED_MODULE_3__.unmarshalPrivateKey(jwk);\n return new RsaPrivateKey(keys.privateKey, keys.publicKey);\n}\nasync function generateKeyPair(bits) {\n if (bits > MAX_RSA_KEY_SIZE) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError('key size is too large', 'ERR_KEY_SIZE_TOO_LARGE');\n }\n const keys = await _rsa_js__WEBPACK_IMPORTED_MODULE_3__.generateKey(bits);\n return new RsaPrivateKey(keys.privateKey, keys.publicKey);\n}\n//# sourceMappingURL=rsa-class.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ exportToPem: () => (/* binding */ exportToPem),\n/* harmony export */ importFromPem: () => (/* binding */ importFromPem),\n/* harmony export */ jwkToPkcs1: () => (/* binding */ jwkToPkcs1),\n/* harmony export */ jwkToPkix: () => (/* binding */ jwkToPkix),\n/* harmony export */ pkcs1ToJwk: () => (/* binding */ pkcs1ToJwk),\n/* harmony export */ pkixToJwk: () => (/* binding */ pkixToJwk)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _noble_hashes_pbkdf2__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @noble/hashes/pbkdf2 */ \"./node_modules/@noble/hashes/esm/pbkdf2.js\");\n/* harmony import */ var _noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @noble/hashes/sha512 */ \"./node_modules/@noble/hashes/esm/sha512.js\");\n/* harmony import */ var asn1js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! asn1js */ \"./node_modules/asn1js/build/index.es.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _random_bytes_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../random-bytes.js */ \"./node_modules/@libp2p/crypto/dist/src/random-bytes.js\");\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@libp2p/crypto/dist/src/webcrypto-browser.js\");\n/* harmony import */ var _rsa_class_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./rsa-class.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js\");\n\n\n\n\n\n\n\n\n\n/**\n * Convert a PKCS#1 in ASN1 DER format to a JWK key\n */\nfunction pkcs1ToJwk(bytes) {\n const { result } = asn1js__WEBPACK_IMPORTED_MODULE_0__.fromBER(bytes);\n // @ts-expect-error this looks fragile but DER is a canonical format so we are\n // safe to have deeply property chains like this\n const values = result.valueBlock.value;\n const key = {\n n: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(bnToBuf(values[1].toBigInt()), 'base64url'),\n e: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(bnToBuf(values[2].toBigInt()), 'base64url'),\n d: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(bnToBuf(values[3].toBigInt()), 'base64url'),\n p: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(bnToBuf(values[4].toBigInt()), 'base64url'),\n q: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(bnToBuf(values[5].toBigInt()), 'base64url'),\n dp: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(bnToBuf(values[6].toBigInt()), 'base64url'),\n dq: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(bnToBuf(values[7].toBigInt()), 'base64url'),\n qi: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(bnToBuf(values[8].toBigInt()), 'base64url'),\n kty: 'RSA',\n alg: 'RS256'\n };\n return key;\n}\n/**\n * Convert a JWK key into PKCS#1 in ASN1 DER format\n */\nfunction jwkToPkcs1(jwk) {\n if (jwk.n == null || jwk.e == null || jwk.d == null || jwk.p == null || jwk.q == null || jwk.dp == null || jwk.dq == null || jwk.qi == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('JWK was missing components', 'ERR_INVALID_PARAMETERS');\n }\n const root = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer({ value: 0 }),\n asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer.fromBigInt(bufToBn((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(jwk.n, 'base64url'))),\n asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer.fromBigInt(bufToBn((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(jwk.e, 'base64url'))),\n asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer.fromBigInt(bufToBn((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(jwk.d, 'base64url'))),\n asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer.fromBigInt(bufToBn((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(jwk.p, 'base64url'))),\n asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer.fromBigInt(bufToBn((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(jwk.q, 'base64url'))),\n asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer.fromBigInt(bufToBn((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(jwk.dp, 'base64url'))),\n asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer.fromBigInt(bufToBn((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(jwk.dq, 'base64url'))),\n asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer.fromBigInt(bufToBn((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(jwk.qi, 'base64url')))\n ]\n });\n const der = root.toBER();\n return new Uint8Array(der, 0, der.byteLength);\n}\n/**\n * Convert a PKCIX in ASN1 DER format to a JWK key\n */\nfunction pkixToJwk(bytes) {\n const { result } = asn1js__WEBPACK_IMPORTED_MODULE_0__.fromBER(bytes);\n // @ts-expect-error this looks fragile but DER is a canonical format so we are\n // safe to have deeply property chains like this\n const values = result.valueBlock.value[1].valueBlock.value[0].valueBlock.value;\n return {\n kty: 'RSA',\n n: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(bnToBuf(values[0].toBigInt()), 'base64url'),\n e: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(bnToBuf(values[1].toBigInt()), 'base64url')\n };\n}\n/**\n * Convert a JWK key to PKCIX in ASN1 DER format\n */\nfunction jwkToPkix(jwk) {\n if (jwk.n == null || jwk.e == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('JWK was missing components', 'ERR_INVALID_PARAMETERS');\n }\n const root = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n // rsaEncryption\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.ObjectIdentifier({\n value: '1.2.840.113549.1.1.1'\n }),\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Null()\n ]\n }),\n // this appears to be a bug in asn1js.js - this should really be a Sequence\n // and not a BitString but it generates the same bytes as node-forge so 🤷♂️\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.BitString({\n valueHex: new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer.fromBigInt(bufToBn((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(jwk.n, 'base64url'))),\n asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer.fromBigInt(bufToBn((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(jwk.e, 'base64url')))\n ]\n }).toBER()\n })\n ]\n });\n const der = root.toBER();\n return new Uint8Array(der, 0, der.byteLength);\n}\nfunction bnToBuf(bn) {\n let hex = bn.toString(16);\n if (hex.length % 2 > 0) {\n hex = `0${hex}`;\n }\n const len = hex.length / 2;\n const u8 = new Uint8Array(len);\n let i = 0;\n let j = 0;\n while (i < len) {\n u8[i] = parseInt(hex.slice(j, j + 2), 16);\n i += 1;\n j += 2;\n }\n return u8;\n}\nfunction bufToBn(u8) {\n const hex = [];\n u8.forEach(function (i) {\n let h = i.toString(16);\n if (h.length % 2 > 0) {\n h = `0${h}`;\n }\n hex.push(h);\n });\n return BigInt('0x' + hex.join(''));\n}\nconst SALT_LENGTH = 16;\nconst KEY_SIZE = 32;\nconst ITERATIONS = 10000;\nasync function exportToPem(privateKey, password) {\n const crypto = _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get();\n // PrivateKeyInfo\n const keyWrapper = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n // version (0)\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer({ value: 0 }),\n // privateKeyAlgorithm\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n // rsaEncryption OID\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.ObjectIdentifier({\n value: '1.2.840.113549.1.1.1'\n }),\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Null()\n ]\n }),\n // PrivateKey\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.OctetString({\n valueHex: privateKey.marshal()\n })\n ]\n });\n const keyBuf = keyWrapper.toBER();\n const keyArr = new Uint8Array(keyBuf, 0, keyBuf.byteLength);\n const salt = (0,_random_bytes_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(SALT_LENGTH);\n const encryptionKey = await (0,_noble_hashes_pbkdf2__WEBPACK_IMPORTED_MODULE_6__.pbkdf2Async)(_noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_7__.sha512, password, salt, {\n c: ITERATIONS,\n dkLen: KEY_SIZE\n });\n const iv = (0,_random_bytes_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(16);\n const cryptoKey = await crypto.subtle.importKey('raw', encryptionKey, 'AES-CBC', false, ['encrypt']);\n const encrypted = await crypto.subtle.encrypt({\n name: 'AES-CBC',\n iv\n }, cryptoKey, keyArr);\n const pbkdf2Params = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n // salt\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.OctetString({ valueHex: salt }),\n // iteration count\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer({ value: ITERATIONS }),\n // key length\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Integer({ value: KEY_SIZE }),\n // AlgorithmIdentifier\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n // hmacWithSHA512\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.ObjectIdentifier({ value: '1.2.840.113549.2.11' }),\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Null()\n ]\n })\n ]\n });\n const encryptionAlgorithm = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n // pkcs5PBES2\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.ObjectIdentifier({\n value: '1.2.840.113549.1.5.13'\n }),\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n // keyDerivationFunc\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n // pkcs5PBKDF2\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.ObjectIdentifier({\n value: '1.2.840.113549.1.5.12'\n }),\n // PBKDF2-params\n pbkdf2Params\n ]\n }),\n // encryptionScheme\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n // aes256-CBC\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.ObjectIdentifier({\n value: '2.16.840.1.101.3.4.1.42'\n }),\n // iv\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.OctetString({\n valueHex: iv\n })\n ]\n })\n ]\n })\n ]\n });\n const finalWrapper = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({\n value: [\n encryptionAlgorithm,\n new asn1js__WEBPACK_IMPORTED_MODULE_0__.OctetString({ valueHex: encrypted })\n ]\n });\n const finalWrapperBuf = finalWrapper.toBER();\n const finalWrapperArr = new Uint8Array(finalWrapperBuf, 0, finalWrapperBuf.byteLength);\n return [\n '-----BEGIN ENCRYPTED PRIVATE KEY-----',\n ...(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(finalWrapperArr, 'base64pad').split(/(.{64})/).filter(Boolean),\n '-----END ENCRYPTED PRIVATE KEY-----'\n ].join('\\n');\n}\nasync function importFromPem(pem, password) {\n const crypto = _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get();\n let plaintext;\n if (pem.includes('-----BEGIN ENCRYPTED PRIVATE KEY-----')) {\n const key = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(pem\n .replace('-----BEGIN ENCRYPTED PRIVATE KEY-----', '')\n .replace('-----END ENCRYPTED PRIVATE KEY-----', '')\n .replace(/\\n/g, '')\n .trim(), 'base64pad');\n const { result } = asn1js__WEBPACK_IMPORTED_MODULE_0__.fromBER(key);\n const { iv, salt, iterations, keySize, cipherText } = findEncryptedPEMData(result);\n const encryptionKey = await (0,_noble_hashes_pbkdf2__WEBPACK_IMPORTED_MODULE_6__.pbkdf2Async)(_noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_7__.sha512, password, salt, {\n c: iterations,\n dkLen: keySize\n });\n const cryptoKey = await crypto.subtle.importKey('raw', encryptionKey, 'AES-CBC', false, ['decrypt']);\n const decrypted = toUint8Array(await crypto.subtle.decrypt({\n name: 'AES-CBC',\n iv\n }, cryptoKey, cipherText));\n const { result: decryptedResult } = asn1js__WEBPACK_IMPORTED_MODULE_0__.fromBER(decrypted);\n plaintext = findPEMData(decryptedResult);\n }\n else if (pem.includes('-----BEGIN PRIVATE KEY-----')) {\n const key = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(pem\n .replace('-----BEGIN PRIVATE KEY-----', '')\n .replace('-----END PRIVATE KEY-----', '')\n .replace(/\\n/g, '')\n .trim(), 'base64pad');\n const { result } = asn1js__WEBPACK_IMPORTED_MODULE_0__.fromBER(key);\n plaintext = findPEMData(result);\n }\n else {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Could not parse private key from PEM data', 'ERR_INVALID_PARAMETERS');\n }\n return (0,_rsa_class_js__WEBPACK_IMPORTED_MODULE_8__.unmarshalRsaPrivateKey)(plaintext);\n}\nfunction findEncryptedPEMData(root) {\n const encryptionAlgorithm = root.valueBlock.value[0];\n const scheme = encryptionAlgorithm.valueBlock.value[0].toString();\n if (scheme !== 'OBJECT IDENTIFIER : 1.2.840.113549.1.5.13') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Only pkcs5PBES2 encrypted private keys are supported', 'ERR_INVALID_PARAMS');\n }\n const keyDerivationFunc = encryptionAlgorithm.valueBlock.value[1].valueBlock.value[0];\n const keyDerivationFuncName = keyDerivationFunc.valueBlock.value[0].toString();\n if (keyDerivationFuncName !== 'OBJECT IDENTIFIER : 1.2.840.113549.1.5.12') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Only pkcs5PBKDF2 key derivation functions are supported', 'ERR_INVALID_PARAMS');\n }\n const pbkdf2Params = keyDerivationFunc.valueBlock.value[1];\n const salt = toUint8Array(pbkdf2Params.valueBlock.value[0].getValue());\n let iterations = ITERATIONS;\n let keySize = KEY_SIZE;\n if (pbkdf2Params.valueBlock.value.length === 3) {\n iterations = Number(pbkdf2Params.valueBlock.value[1].toBigInt());\n keySize = Number((pbkdf2Params.valueBlock.value[2]).toBigInt());\n }\n else if (pbkdf2Params.valueBlock.value.length === 2) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Could not derive key size and iterations from PEM file - please use @libp2p/rsa to re-import your key', 'ERR_INVALID_PARAMS');\n }\n const encryptionScheme = encryptionAlgorithm.valueBlock.value[1].valueBlock.value[1];\n const encryptionSchemeName = encryptionScheme.valueBlock.value[0].toString();\n if (encryptionSchemeName === 'OBJECT IDENTIFIER : 1.2.840.113549.3.7') {\n // des-EDE3-CBC\n }\n else if (encryptionSchemeName === 'OBJECT IDENTIFIER : 1.3.14.3.2.7') {\n // des-CBC\n }\n else if (encryptionSchemeName === 'OBJECT IDENTIFIER : 2.16.840.1.101.3.4.1.2') {\n // aes128-CBC\n }\n else if (encryptionSchemeName === 'OBJECT IDENTIFIER : 2.16.840.1.101.3.4.1.22') {\n // aes192-CBC\n }\n else if (encryptionSchemeName === 'OBJECT IDENTIFIER : 2.16.840.1.101.3.4.1.42') {\n // aes256-CBC\n }\n else {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Only AES-CBC encryption schemes are supported', 'ERR_INVALID_PARAMS');\n }\n const iv = toUint8Array(encryptionScheme.valueBlock.value[1].getValue());\n return {\n cipherText: toUint8Array(root.valueBlock.value[1].getValue()),\n salt,\n iterations,\n keySize,\n iv\n };\n}\nfunction findPEMData(seq) {\n return toUint8Array(seq.valueBlock.value[2].getValue());\n}\nfunction toUint8Array(buf) {\n return new Uint8Array(buf, 0, buf.byteLength);\n}\n//# sourceMappingURL=rsa-utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-browser.js":
|
||
/*!************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-browser.js ***!
|
||
\************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compressPublicKey: () => (/* binding */ compressPublicKey),\n/* harmony export */ computePublicKey: () => (/* binding */ computePublicKey),\n/* harmony export */ decompressPublicKey: () => (/* binding */ decompressPublicKey),\n/* harmony export */ generateKey: () => (/* binding */ generateKey),\n/* harmony export */ hashAndSign: () => (/* binding */ hashAndSign),\n/* harmony export */ hashAndVerify: () => (/* binding */ hashAndVerify),\n/* harmony export */ privateKeyLength: () => (/* binding */ PRIVATE_KEY_BYTE_LENGTH),\n/* harmony export */ validatePrivateKey: () => (/* binding */ validatePrivateKey),\n/* harmony export */ validatePublicKey: () => (/* binding */ validatePublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/curves/secp256k1 */ \"./node_modules/@noble/curves/esm/secp256k1.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@libp2p/crypto/dist/src/util.js\");\n\n\n\n\nconst PRIVATE_KEY_BYTE_LENGTH = 32;\n\nfunction generateKey() {\n return _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_1__.secp256k1.utils.randomPrivateKey();\n}\n/**\n * Hash and sign message with private key\n */\nfunction hashAndSign(key, msg) {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(msg instanceof Uint8Array ? msg : msg.subarray());\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_2__.isPromise)(p)) {\n return p.then(({ digest }) => _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_1__.secp256k1.sign(digest, key).toDERRawBytes())\n .catch(err => {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_INPUT');\n });\n }\n try {\n return _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_1__.secp256k1.sign(p.digest, key).toDERRawBytes();\n }\n catch (err) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_INPUT');\n }\n}\n/**\n * Hash message and verify signature with public key\n */\nfunction hashAndVerify(key, sig, msg) {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(msg instanceof Uint8Array ? msg : msg.subarray());\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_2__.isPromise)(p)) {\n return p.then(({ digest }) => _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_1__.secp256k1.verify(sig, digest, key))\n .catch(err => {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_INPUT');\n });\n }\n try {\n return _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_1__.secp256k1.verify(sig, p.digest, key);\n }\n catch (err) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_INPUT');\n }\n}\nfunction compressPublicKey(key) {\n const point = _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_1__.secp256k1.ProjectivePoint.fromHex(key).toRawBytes(true);\n return point;\n}\nfunction decompressPublicKey(key) {\n const point = _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_1__.secp256k1.ProjectivePoint.fromHex(key).toRawBytes(false);\n return point;\n}\nfunction validatePrivateKey(key) {\n try {\n _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_1__.secp256k1.getPublicKey(key, true);\n }\n catch (err) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_PRIVATE_KEY');\n }\n}\nfunction validatePublicKey(key) {\n try {\n _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_1__.secp256k1.ProjectivePoint.fromHex(key);\n }\n catch (err) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_PUBLIC_KEY');\n }\n}\nfunction computePublicKey(privateKey) {\n try {\n return _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_1__.secp256k1.getPublicKey(privateKey, true);\n }\n catch (err) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), 'ERR_INVALID_PRIVATE_KEY');\n }\n}\n//# sourceMappingURL=secp256k1-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js":
|
||
/*!**********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js ***!
|
||
\**********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Secp256k1PrivateKey: () => (/* binding */ Secp256k1PrivateKey),\n/* harmony export */ Secp256k1PublicKey: () => (/* binding */ Secp256k1PublicKey),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ unmarshalSecp256k1PrivateKey: () => (/* binding */ unmarshalSecp256k1PrivateKey),\n/* harmony export */ unmarshalSecp256k1PublicKey: () => (/* binding */ unmarshalSecp256k1PublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@libp2p/crypto/dist/src/util.js\");\n/* harmony import */ var _exporter_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./exporter.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/exporter.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n/* harmony import */ var _secp256k1_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./secp256k1.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-browser.js\");\n\n\n\n\n\n\n\n\nclass Secp256k1PublicKey {\n _key;\n constructor(key) {\n _secp256k1_js__WEBPACK_IMPORTED_MODULE_3__.validatePublicKey(key);\n this._key = key;\n }\n verify(data, sig) {\n return _secp256k1_js__WEBPACK_IMPORTED_MODULE_3__.hashAndVerify(this._key, sig, data);\n }\n marshal() {\n return _secp256k1_js__WEBPACK_IMPORTED_MODULE_3__.compressPublicKey(this._key);\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_4__.PublicKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_4__.KeyType.Secp256k1,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(this.bytes, key.bytes);\n }\n async hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(this.bytes);\n let bytes;\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_5__.isPromise)(p)) {\n ({ bytes } = await p);\n }\n else {\n bytes = p.bytes;\n }\n return bytes;\n }\n}\nclass Secp256k1PrivateKey {\n _key;\n _publicKey;\n constructor(key, publicKey) {\n this._key = key;\n this._publicKey = publicKey ?? _secp256k1_js__WEBPACK_IMPORTED_MODULE_3__.computePublicKey(key);\n _secp256k1_js__WEBPACK_IMPORTED_MODULE_3__.validatePrivateKey(this._key);\n _secp256k1_js__WEBPACK_IMPORTED_MODULE_3__.validatePublicKey(this._publicKey);\n }\n sign(message) {\n return _secp256k1_js__WEBPACK_IMPORTED_MODULE_3__.hashAndSign(this._key, message);\n }\n get public() {\n return new Secp256k1PublicKey(this._publicKey);\n }\n marshal() {\n return this._key;\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_4__.PrivateKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_4__.KeyType.Secp256k1,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(this.bytes, key.bytes);\n }\n hash() {\n const p = multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.digest(this.bytes);\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_5__.isPromise)(p)) {\n return p.then(({ bytes }) => bytes);\n }\n return p.bytes;\n }\n /**\n * Gets the ID of the key.\n *\n * The key id is the base58 encoding of the SHA-256 multihash of its public key.\n * The public key is a protobuf encoding containing a type and the DER encoding\n * of the PKCS SubjectPublicKeyInfo.\n */\n async id() {\n const hash = await this.public.hash();\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(hash, 'base58btc');\n }\n /**\n * Exports the key into a password protected `format`\n */\n async export(password, format = 'libp2p-key') {\n if (format === 'libp2p-key') {\n return (0,_exporter_js__WEBPACK_IMPORTED_MODULE_6__.exporter)(this.bytes, password);\n }\n else {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__.CodeError(`export format '${format}' is not supported`, 'ERR_INVALID_EXPORT_FORMAT');\n }\n }\n}\nfunction unmarshalSecp256k1PrivateKey(bytes) {\n return new Secp256k1PrivateKey(bytes);\n}\nfunction unmarshalSecp256k1PublicKey(bytes) {\n return new Secp256k1PublicKey(bytes);\n}\nasync function generateKeyPair() {\n const privateKeyBytes = _secp256k1_js__WEBPACK_IMPORTED_MODULE_3__.generateKey();\n return new Secp256k1PrivateKey(privateKeyBytes);\n}\n//# sourceMappingURL=secp256k1-class.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/random-bytes.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/random-bytes.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ randomBytes)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/hashes/utils */ \"./node_modules/@noble/hashes/esm/utils.js\");\n\n\n/**\n * Generates a Uint8Array with length `number` populated by random bytes\n */\nfunction randomBytes(length) {\n if (isNaN(length) || length <= 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.CodeError('random bytes length must be a Number bigger than 0', 'ERR_INVALID_LENGTH');\n }\n return (0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__.randomBytes)(length);\n}\n//# sourceMappingURL=random-bytes.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/random-bytes.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/util.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/util.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base64urlToBuffer: () => (/* binding */ base64urlToBuffer),\n/* harmony export */ isPromise: () => (/* binding */ isPromise)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/from-string.js\");\n\n\nfunction base64urlToBuffer(str, len) {\n let buf = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(str, 'base64urlpad');\n if (len != null) {\n if (buf.length > len)\n throw new Error('byte array longer than desired length');\n buf = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([new Uint8Array(len - buf.length), buf]);\n }\n return buf;\n}\nfunction isPromise(thing) {\n if (thing == null) {\n return false;\n }\n return typeof thing.then === 'function' &&\n typeof thing.catch === 'function' &&\n typeof thing.finally === 'function';\n}\n//# sourceMappingURL=util.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/util.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/dist/src/webcrypto-browser.js":
|
||
/*!*******************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/dist/src/webcrypto-browser.js ***!
|
||
\*******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* eslint-env browser */\n// Check native crypto exists and is enabled (In insecure context `self.crypto`\n// exists but `self.crypto.subtle` does not).\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n get(win = globalThis) {\n const nativeCrypto = win.crypto;\n if (nativeCrypto == null || nativeCrypto.subtle == null) {\n throw Object.assign(new Error('Missing Web Crypto API. ' +\n 'The most likely cause of this error is that this page is being accessed ' +\n 'from an insecure context (i.e. not HTTPS). For more information and ' +\n 'possible resolutions see ' +\n 'https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api'), { code: 'ERR_MISSING_WEB_CRYPTO' });\n }\n return nativeCrypto;\n }\n});\n//# sourceMappingURL=webcrypto-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/dist/src/webcrypto-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/concat.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/concat.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ concat: () => (/* binding */ concat)\n/* harmony export */ });\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #alloc */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #util/as-uint8array */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Uint8Arrays\n */\nfunction concat(arrays, length) {\n if (length == null) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n const output = (0,_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(length);\n let offset = 0;\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n return (0,_util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(output);\n}\n//# sourceMappingURL=concat.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/concat.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/equals.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/equals.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/util/as-uint8array.js":
|
||
/*!*********************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/util/as-uint8array.js ***!
|
||
\*********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asUint8Array: () => (/* binding */ asUint8Array)\n/* harmony export */ });\n/**\n * To guarantee Uint8Array semantics, convert nodejs Buffers\n * into vanilla Uint8Arrays\n */\nfunction asUint8Array(buf) {\n return buf;\n}\n//# sourceMappingURL=as-uint8array.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/util/as-uint8array.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/crypto/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/identify/dist/src/consts.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@libp2p/identify/dist/src/consts.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IDENTIFY_PROTOCOL_VERSION: () => (/* binding */ IDENTIFY_PROTOCOL_VERSION),\n/* harmony export */ MULTICODEC_IDENTIFY: () => (/* binding */ MULTICODEC_IDENTIFY),\n/* harmony export */ MULTICODEC_IDENTIFY_PROTOCOL_NAME: () => (/* binding */ MULTICODEC_IDENTIFY_PROTOCOL_NAME),\n/* harmony export */ MULTICODEC_IDENTIFY_PROTOCOL_VERSION: () => (/* binding */ MULTICODEC_IDENTIFY_PROTOCOL_VERSION),\n/* harmony export */ MULTICODEC_IDENTIFY_PUSH: () => (/* binding */ MULTICODEC_IDENTIFY_PUSH),\n/* harmony export */ MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME: () => (/* binding */ MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME),\n/* harmony export */ MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION: () => (/* binding */ MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION),\n/* harmony export */ PROTOCOL_VERSION: () => (/* binding */ PROTOCOL_VERSION)\n/* harmony export */ });\nconst PROTOCOL_VERSION = 'ipfs/0.1.0'; // deprecated\nconst MULTICODEC_IDENTIFY = '/ipfs/id/1.0.0'; // deprecated\nconst MULTICODEC_IDENTIFY_PUSH = '/ipfs/id/push/1.0.0'; // deprecated\nconst IDENTIFY_PROTOCOL_VERSION = '0.1.0';\nconst MULTICODEC_IDENTIFY_PROTOCOL_NAME = 'id';\nconst MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME = 'id/push';\nconst MULTICODEC_IDENTIFY_PROTOCOL_VERSION = '1.0.0';\nconst MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION = '1.0.0';\n//# sourceMappingURL=consts.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/identify/dist/src/consts.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/identify/dist/src/identify.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@libp2p/identify/dist/src/identify.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Identify: () => (/* binding */ Identify)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/events.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @libp2p/peer-record */ \"./node_modules/@libp2p/peer-record/dist/src/peer-record/index.js\");\n/* harmony import */ var _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/peer-record */ \"./node_modules/@libp2p/peer-record/dist/src/envelope/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr_matcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiformats/multiaddr-matcher */ \"./node_modules/@multiformats/multiaddr-matcher/dist/src/index.js\");\n/* harmony import */ var it_protobuf_stream__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-protobuf-stream */ \"./node_modules/it-protobuf-stream/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var wherearewe__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! wherearewe */ \"./node_modules/wherearewe/src/index.js\");\n/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./consts.js */ \"./node_modules/@libp2p/identify/dist/src/consts.js\");\n/* harmony import */ var _pb_message_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./pb/message.js */ \"./node_modules/@libp2p/identify/dist/src/pb/message.js\");\n/* eslint-disable complexity */\n\n\n\n\n\n\n\n\n\n\n\n// https://github.com/libp2p/go-libp2p/blob/8d2e54e1637041d5cf4fac1e531287560bd1f4ac/p2p/protocol/identify/id.go#L52\nconst MAX_IDENTIFY_MESSAGE_SIZE = 1024 * 8;\nconst defaultValues = {\n protocolPrefix: 'ipfs',\n // https://github.com/libp2p/go-libp2p/blob/8d2e54e1637041d5cf4fac1e531287560bd1f4ac/p2p/protocol/identify/id.go#L48\n timeout: 60000,\n maxInboundStreams: 1,\n maxOutboundStreams: 1,\n maxPushIncomingStreams: 1,\n maxPushOutgoingStreams: 1,\n maxObservedAddresses: 10,\n maxIdentifyMessageSize: 8192,\n runOnConnectionOpen: true,\n runOnTransientConnection: true\n};\nclass Identify {\n identifyProtocolStr;\n identifyPushProtocolStr;\n host;\n started;\n timeout;\n peerId;\n peerStore;\n registrar;\n connectionManager;\n addressManager;\n maxInboundStreams;\n maxOutboundStreams;\n maxPushIncomingStreams;\n maxPushOutgoingStreams;\n maxIdentifyMessageSize;\n maxObservedAddresses;\n events;\n runOnTransientConnection;\n log;\n constructor(components, init = {}) {\n this.started = false;\n this.peerId = components.peerId;\n this.peerStore = components.peerStore;\n this.registrar = components.registrar;\n this.addressManager = components.addressManager;\n this.connectionManager = components.connectionManager;\n this.events = components.events;\n this.log = components.logger.forComponent('libp2p:identify');\n this.identifyProtocolStr = `/${init.protocolPrefix ?? defaultValues.protocolPrefix}/${_consts_js__WEBPACK_IMPORTED_MODULE_6__.MULTICODEC_IDENTIFY_PROTOCOL_NAME}/${_consts_js__WEBPACK_IMPORTED_MODULE_6__.MULTICODEC_IDENTIFY_PROTOCOL_VERSION}`;\n this.identifyPushProtocolStr = `/${init.protocolPrefix ?? defaultValues.protocolPrefix}/${_consts_js__WEBPACK_IMPORTED_MODULE_6__.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME}/${_consts_js__WEBPACK_IMPORTED_MODULE_6__.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION}`;\n this.timeout = init.timeout ?? defaultValues.timeout;\n this.maxInboundStreams = init.maxInboundStreams ?? defaultValues.maxInboundStreams;\n this.maxOutboundStreams = init.maxOutboundStreams ?? defaultValues.maxOutboundStreams;\n this.maxPushIncomingStreams = init.maxPushIncomingStreams ?? defaultValues.maxPushIncomingStreams;\n this.maxPushOutgoingStreams = init.maxPushOutgoingStreams ?? defaultValues.maxPushOutgoingStreams;\n this.maxIdentifyMessageSize = init.maxIdentifyMessageSize ?? defaultValues.maxIdentifyMessageSize;\n this.maxObservedAddresses = init.maxObservedAddresses ?? defaultValues.maxObservedAddresses;\n this.runOnTransientConnection = init.runOnTransientConnection ?? defaultValues.runOnTransientConnection;\n // Store self host metadata\n this.host = {\n protocolVersion: `${init.protocolPrefix ?? defaultValues.protocolPrefix}/${_consts_js__WEBPACK_IMPORTED_MODULE_6__.IDENTIFY_PROTOCOL_VERSION}`,\n agentVersion: init.agentVersion ?? `${components.nodeInfo.name}/${components.nodeInfo.version}`\n };\n if (init.runOnConnectionOpen ?? defaultValues.runOnConnectionOpen) {\n // When a new connection happens, trigger identify\n components.events.addEventListener('connection:open', (evt) => {\n const connection = evt.detail;\n this.identify(connection).catch(err => { this.log.error('error during identify trigged by connection:open', err); });\n });\n }\n // When self peer record changes, trigger identify-push\n components.events.addEventListener('self:peer:update', (evt) => {\n void this.push().catch(err => { this.log.error(err); });\n });\n // Append user agent version to default AGENT_VERSION depending on the environment\n if (this.host.agentVersion === `${components.nodeInfo.name}/${components.nodeInfo.version}`) {\n if (wherearewe__WEBPACK_IMPORTED_MODULE_5__.isNode || wherearewe__WEBPACK_IMPORTED_MODULE_5__.isElectronMain) {\n this.host.agentVersion += ` UserAgent=${globalThis.process.version}`;\n }\n else if (wherearewe__WEBPACK_IMPORTED_MODULE_5__.isBrowser || wherearewe__WEBPACK_IMPORTED_MODULE_5__.isWebWorker || wherearewe__WEBPACK_IMPORTED_MODULE_5__.isElectronRenderer || wherearewe__WEBPACK_IMPORTED_MODULE_5__.isReactNative) {\n this.host.agentVersion += ` UserAgent=${globalThis.navigator.userAgent}`;\n }\n }\n }\n isStarted() {\n return this.started;\n }\n async start() {\n if (this.started) {\n return;\n }\n await this.peerStore.merge(this.peerId, {\n metadata: {\n AgentVersion: (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(this.host.agentVersion),\n ProtocolVersion: (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(this.host.protocolVersion)\n }\n });\n await this.registrar.handle(this.identifyProtocolStr, (data) => {\n void this._handleIdentify(data).catch(err => {\n this.log.error(err);\n });\n }, {\n maxInboundStreams: this.maxInboundStreams,\n maxOutboundStreams: this.maxOutboundStreams,\n runOnTransientConnection: this.runOnTransientConnection\n });\n await this.registrar.handle(this.identifyPushProtocolStr, (data) => {\n void this._handlePush(data).catch(err => {\n this.log.error(err);\n });\n }, {\n maxInboundStreams: this.maxPushIncomingStreams,\n maxOutboundStreams: this.maxPushOutgoingStreams,\n runOnTransientConnection: this.runOnTransientConnection\n });\n this.started = true;\n }\n async stop() {\n await this.registrar.unhandle(this.identifyProtocolStr);\n await this.registrar.unhandle(this.identifyPushProtocolStr);\n this.started = false;\n }\n /**\n * Send an Identify Push update to the list of connections\n */\n async pushToConnections(connections) {\n const listenAddresses = this.addressManager.getAddresses().map(ma => ma.decapsulateCode((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('p2p').code));\n const peerRecord = new _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_7__.PeerRecord({\n peerId: this.peerId,\n multiaddrs: listenAddresses\n });\n const signedPeerRecord = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_8__.RecordEnvelope.seal(peerRecord, this.peerId);\n const supportedProtocols = this.registrar.getProtocols();\n const peer = await this.peerStore.get(this.peerId);\n const agentVersion = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_4__.toString)(peer.metadata.get('AgentVersion') ?? (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(this.host.agentVersion));\n const protocolVersion = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_4__.toString)(peer.metadata.get('ProtocolVersion') ?? (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(this.host.protocolVersion));\n const pushes = connections.map(async (connection) => {\n let stream;\n const signal = AbortSignal.timeout(this.timeout);\n (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.setMaxListeners)(Infinity, signal);\n try {\n stream = await connection.newStream(this.identifyPushProtocolStr, {\n signal,\n runOnTransientConnection: this.runOnTransientConnection\n });\n const pb = (0,it_protobuf_stream__WEBPACK_IMPORTED_MODULE_2__.pbStream)(stream, {\n maxDataLength: this.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE\n }).pb(_pb_message_js__WEBPACK_IMPORTED_MODULE_10__.Identify);\n await pb.write({\n listenAddrs: listenAddresses.map(ma => ma.bytes),\n signedPeerRecord: signedPeerRecord.marshal(),\n protocols: supportedProtocols,\n agentVersion,\n protocolVersion\n }, {\n signal\n });\n await stream.close({\n signal\n });\n }\n catch (err) {\n // Just log errors\n this.log.error('could not push identify update to peer', err);\n stream?.abort(err);\n }\n });\n await Promise.all(pushes);\n }\n /**\n * Calls `push` on all peer connections\n */\n async push() {\n // Do not try to push if we are not running\n if (!this.isStarted()) {\n return;\n }\n const connections = [];\n await Promise.all(this.connectionManager.getConnections().map(async (conn) => {\n try {\n const peer = await this.peerStore.get(conn.remotePeer);\n if (!peer.protocols.includes(this.identifyPushProtocolStr)) {\n return;\n }\n connections.push(conn);\n }\n catch (err) {\n if (err.code !== _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__.ERR_NOT_FOUND) {\n throw err;\n }\n }\n }));\n await this.pushToConnections(connections);\n }\n async _identify(connection, options = {}) {\n let stream;\n if (options.signal == null) {\n const signal = AbortSignal.timeout(this.timeout);\n (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.setMaxListeners)(Infinity, signal);\n options = {\n ...options,\n signal\n };\n }\n try {\n stream = await connection.newStream(this.identifyProtocolStr, {\n ...options,\n runOnTransientConnection: this.runOnTransientConnection\n });\n const pb = (0,it_protobuf_stream__WEBPACK_IMPORTED_MODULE_2__.pbStream)(stream, {\n maxDataLength: this.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE\n }).pb(_pb_message_js__WEBPACK_IMPORTED_MODULE_10__.Identify);\n const message = await pb.read(options);\n await stream.close(options);\n return message;\n }\n catch (err) {\n this.log.error('error while reading identify message', err);\n stream?.abort(err);\n throw err;\n }\n }\n async identify(connection, options = {}) {\n const message = await this._identify(connection, options);\n const { publicKey, protocols, observedAddr } = message;\n if (publicKey == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__.CodeError('public key was missing from identify message', 'ERR_MISSING_PUBLIC_KEY');\n }\n const id = await (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_12__.peerIdFromKeys)(publicKey);\n if (!connection.remotePeer.equals(id)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__.CodeError('identified peer does not match the expected peer', 'ERR_INVALID_PEER');\n }\n if (this.peerId.equals(id)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__.CodeError('identified peer is our own peer id?', 'ERR_INVALID_PEER');\n }\n // Get the observedAddr if there is one\n const cleanObservedAddr = getCleanMultiaddr(observedAddr);\n this.log('identify completed for peer %p and protocols %o', id, protocols);\n this.log('our observed address is %a', cleanObservedAddr);\n if (cleanObservedAddr != null &&\n this.addressManager.getObservedAddrs().length < (this.maxObservedAddresses ?? Infinity)) {\n this.log('storing our observed address %a', cleanObservedAddr);\n this.addressManager.addObservedAddr(cleanObservedAddr);\n }\n return this.#consumeIdentifyMessage(connection, message);\n }\n /**\n * Sends the `Identify` response with the Signed Peer Record\n * to the requesting peer over the given `connection`\n */\n async _handleIdentify(data) {\n const { connection, stream } = data;\n const signal = AbortSignal.timeout(this.timeout);\n (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.setMaxListeners)(Infinity, signal);\n try {\n const publicKey = this.peerId.publicKey ?? new Uint8Array(0);\n const peerData = await this.peerStore.get(this.peerId);\n const multiaddrs = this.addressManager.getAddresses().map(ma => ma.decapsulateCode((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('p2p').code));\n let signedPeerRecord = peerData.peerRecordEnvelope;\n if (multiaddrs.length > 0 && signedPeerRecord == null) {\n const peerRecord = new _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_7__.PeerRecord({\n peerId: this.peerId,\n multiaddrs\n });\n const envelope = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_8__.RecordEnvelope.seal(peerRecord, this.peerId);\n signedPeerRecord = envelope.marshal().subarray();\n }\n let observedAddr = connection.remoteAddr.bytes;\n if (!_multiformats_multiaddr_matcher__WEBPACK_IMPORTED_MODULE_1__.IP_OR_DOMAIN.matches(connection.remoteAddr)) {\n observedAddr = undefined;\n }\n const pb = (0,it_protobuf_stream__WEBPACK_IMPORTED_MODULE_2__.pbStream)(stream).pb(_pb_message_js__WEBPACK_IMPORTED_MODULE_10__.Identify);\n await pb.write({\n protocolVersion: this.host.protocolVersion,\n agentVersion: this.host.agentVersion,\n publicKey,\n listenAddrs: multiaddrs.map(addr => addr.bytes),\n signedPeerRecord,\n observedAddr,\n protocols: peerData.protocols\n }, {\n signal\n });\n await stream.close({\n signal\n });\n }\n catch (err) {\n this.log.error('could not respond to identify request', err);\n stream.abort(err);\n }\n }\n /**\n * Reads the Identify Push message from the given `connection`\n */\n async _handlePush(data) {\n const { connection, stream } = data;\n try {\n if (this.peerId.equals(connection.remotePeer)) {\n throw new Error('received push from ourselves?');\n }\n const options = {\n signal: AbortSignal.timeout(this.timeout)\n };\n const pb = (0,it_protobuf_stream__WEBPACK_IMPORTED_MODULE_2__.pbStream)(stream, {\n maxDataLength: this.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE\n }).pb(_pb_message_js__WEBPACK_IMPORTED_MODULE_10__.Identify);\n const message = await pb.read(options);\n await stream.close(options);\n await this.#consumeIdentifyMessage(connection, message);\n }\n catch (err) {\n this.log.error('received invalid message', err);\n stream.abort(err);\n return;\n }\n this.log('handled push from %p', connection.remotePeer);\n }\n async #consumeIdentifyMessage(connection, message) {\n this.log('received identify from %p', connection.remotePeer);\n if (message == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__.CodeError('message was null or undefined', 'ERR_INVALID_MESSAGE');\n }\n const peer = {};\n if (message.listenAddrs.length > 0) {\n peer.addresses = message.listenAddrs.map(buf => ({\n isCertified: false,\n multiaddr: (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(buf)\n }));\n }\n if (message.protocols.length > 0) {\n peer.protocols = message.protocols;\n }\n if (message.publicKey != null) {\n peer.publicKey = message.publicKey;\n const peerId = await (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_12__.peerIdFromKeys)(message.publicKey);\n if (!peerId.equals(connection.remotePeer)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__.CodeError('public key did not match remote PeerId', 'ERR_INVALID_PUBLIC_KEY');\n }\n }\n let output;\n // if the peer record has been sent, prefer the addresses in the record as they are signed by the remote peer\n if (message.signedPeerRecord != null) {\n this.log('received signedPeerRecord from %p', connection.remotePeer);\n let peerRecordEnvelope = message.signedPeerRecord;\n const envelope = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_8__.RecordEnvelope.openAndCertify(peerRecordEnvelope, _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_7__.PeerRecord.DOMAIN);\n let peerRecord = _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_7__.PeerRecord.createFromProtobuf(envelope.payload);\n // Verify peerId\n if (!peerRecord.peerId.equals(envelope.peerId)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__.CodeError('signing key does not match PeerId in the PeerRecord', 'ERR_INVALID_SIGNING_KEY');\n }\n // Make sure remote peer is the one sending the record\n if (!connection.remotePeer.equals(peerRecord.peerId)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_11__.CodeError('signing key does not match remote PeerId', 'ERR_INVALID_PEER_RECORD_KEY');\n }\n let existingPeer;\n try {\n existingPeer = await this.peerStore.get(peerRecord.peerId);\n }\n catch (err) {\n if (err.code !== 'ERR_NOT_FOUND') {\n throw err;\n }\n }\n if (existingPeer != null) {\n // don't lose any existing metadata\n peer.metadata = existingPeer.metadata;\n // if we have previously received a signed record for this peer, compare it to the incoming one\n if (existingPeer.peerRecordEnvelope != null) {\n const storedEnvelope = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_8__.RecordEnvelope.createFromProtobuf(existingPeer.peerRecordEnvelope);\n const storedRecord = _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_7__.PeerRecord.createFromProtobuf(storedEnvelope.payload);\n // ensure seq is greater than, or equal to, the last received\n if (storedRecord.seqNumber >= peerRecord.seqNumber) {\n this.log('sequence number was lower or equal to existing sequence number - stored: %d received: %d', storedRecord.seqNumber, peerRecord.seqNumber);\n peerRecord = storedRecord;\n peerRecordEnvelope = existingPeer.peerRecordEnvelope;\n }\n }\n }\n // store the signed record for next time\n peer.peerRecordEnvelope = peerRecordEnvelope;\n // override the stored addresses with the signed multiaddrs\n peer.addresses = peerRecord.multiaddrs.map(multiaddr => ({\n isCertified: true,\n multiaddr\n }));\n output = {\n seq: peerRecord.seqNumber,\n addresses: peerRecord.multiaddrs\n };\n }\n else {\n this.log('%p did not send a signed peer record', connection.remotePeer);\n }\n this.log('patching %p with', connection.remotePeer, peer);\n await this.peerStore.patch(connection.remotePeer, peer);\n if (message.agentVersion != null || message.protocolVersion != null) {\n const metadata = {};\n if (message.agentVersion != null) {\n metadata.AgentVersion = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(message.agentVersion);\n }\n if (message.protocolVersion != null) {\n metadata.ProtocolVersion = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(message.protocolVersion);\n }\n this.log('merging %p metadata', connection.remotePeer, metadata);\n await this.peerStore.merge(connection.remotePeer, {\n metadata\n });\n }\n const result = {\n peerId: connection.remotePeer,\n protocolVersion: message.protocolVersion,\n agentVersion: message.agentVersion,\n publicKey: message.publicKey,\n listenAddrs: message.listenAddrs.map(buf => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(buf)),\n observedAddr: message.observedAddr == null ? undefined : (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(message.observedAddr),\n protocols: message.protocols,\n signedPeerRecord: output,\n connection\n };\n this.events.safeDispatchEvent('peer:identify', { detail: result });\n return result;\n }\n}\n/**\n * Takes the `addr` and converts it to a Multiaddr if possible\n */\nfunction getCleanMultiaddr(addr) {\n if (addr != null && addr.length > 0) {\n try {\n return (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(addr);\n }\n catch {\n }\n }\n}\n//# sourceMappingURL=identify.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/identify/dist/src/identify.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/identify/dist/src/index.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/@libp2p/identify/dist/src/index.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ identify: () => (/* binding */ identify),\n/* harmony export */ multicodecs: () => (/* binding */ multicodecs)\n/* harmony export */ });\n/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./consts.js */ \"./node_modules/@libp2p/identify/dist/src/consts.js\");\n/* harmony import */ var _identify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./identify.js */ \"./node_modules/@libp2p/identify/dist/src/identify.js\");\n/**\n * @packageDocumentation\n *\n * Use the `identify` function to add support for the [Identify protocol](https://github.com/libp2p/specs/blob/master/identify/README.md) to libp2p.\n *\n * @example\n *\n * ```typescript\n * import { createLibp2p } from 'libp2p'\n * import { identify } from '@libp2p/identify'\n *\n * const node = await createLibp2p({\n * // ...other options\n * services: {\n * identify: identify()\n * }\n * })\n * ```\n */\n\n\n/**\n * The protocols the Identify service supports\n */\nconst multicodecs = {\n IDENTIFY: _consts_js__WEBPACK_IMPORTED_MODULE_0__.MULTICODEC_IDENTIFY,\n IDENTIFY_PUSH: _consts_js__WEBPACK_IMPORTED_MODULE_0__.MULTICODEC_IDENTIFY_PUSH\n};\nfunction identify(init = {}) {\n return (components) => new _identify_js__WEBPACK_IMPORTED_MODULE_1__.Identify(components, init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/identify/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/identify/dist/src/pb/message.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/@libp2p/identify/dist/src/pb/message.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Identify: () => (/* binding */ Identify)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar Identify;\n(function (Identify) {\n let _codec;\n Identify.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.protocolVersion != null) {\n w.uint32(42);\n w.string(obj.protocolVersion);\n }\n if (obj.agentVersion != null) {\n w.uint32(50);\n w.string(obj.agentVersion);\n }\n if (obj.publicKey != null) {\n w.uint32(10);\n w.bytes(obj.publicKey);\n }\n if (obj.listenAddrs != null) {\n for (const value of obj.listenAddrs) {\n w.uint32(18);\n w.bytes(value);\n }\n }\n if (obj.observedAddr != null) {\n w.uint32(34);\n w.bytes(obj.observedAddr);\n }\n if (obj.protocols != null) {\n for (const value of obj.protocols) {\n w.uint32(26);\n w.string(value);\n }\n }\n if (obj.signedPeerRecord != null) {\n w.uint32(66);\n w.bytes(obj.signedPeerRecord);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n listenAddrs: [],\n protocols: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 5:\n obj.protocolVersion = reader.string();\n break;\n case 6:\n obj.agentVersion = reader.string();\n break;\n case 1:\n obj.publicKey = reader.bytes();\n break;\n case 2:\n obj.listenAddrs.push(reader.bytes());\n break;\n case 4:\n obj.observedAddr = reader.bytes();\n break;\n case 3:\n obj.protocols.push(reader.string());\n break;\n case 8:\n obj.signedPeerRecord = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Identify.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Identify.codec());\n };\n Identify.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Identify.codec());\n };\n})(Identify || (Identify = {}));\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/identify/dist/src/pb/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!****************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/identify/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/connection/index.js":
|
||
/*!*********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/connection/index.js ***!
|
||
\*********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ connectionSymbol: () => (/* binding */ connectionSymbol),\n/* harmony export */ isConnection: () => (/* binding */ isConnection)\n/* harmony export */ });\nconst connectionSymbol = Symbol.for('@libp2p/connection');\nfunction isConnection(other) {\n return other != null && Boolean(other[connectionSymbol]);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/connection/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/content-routing/index.js":
|
||
/*!**************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/content-routing/index.js ***!
|
||
\**************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ contentRoutingSymbol: () => (/* binding */ contentRoutingSymbol)\n/* harmony export */ });\n/**\n * Any object that implements this Symbol as a property should return a\n * ContentRouting instance as the property value, similar to how\n * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.\n *\n * @example\n *\n * ```TypeScript\n * import { contentRoutingSymbol, ContentRouting } from '@libp2p/content-routing'\n *\n * class MyContentRouter implements ContentRouting {\n * get [contentRoutingSymbol] () {\n * return this\n * }\n *\n * // ...other methods\n * }\n * ```\n */\nconst contentRoutingSymbol = Symbol.for('@libp2p/content-routing');\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/content-routing/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/errors.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/errors.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ AggregateCodeError: () => (/* binding */ AggregateCodeError),\n/* harmony export */ CodeError: () => (/* binding */ CodeError),\n/* harmony export */ ERR_INVALID_MESSAGE: () => (/* binding */ ERR_INVALID_MESSAGE),\n/* harmony export */ ERR_INVALID_PARAMETERS: () => (/* binding */ ERR_INVALID_PARAMETERS),\n/* harmony export */ ERR_NOT_FOUND: () => (/* binding */ ERR_NOT_FOUND),\n/* harmony export */ ERR_TIMEOUT: () => (/* binding */ ERR_TIMEOUT),\n/* harmony export */ InvalidCryptoExchangeError: () => (/* binding */ InvalidCryptoExchangeError),\n/* harmony export */ InvalidCryptoTransmissionError: () => (/* binding */ InvalidCryptoTransmissionError),\n/* harmony export */ UnexpectedPeerError: () => (/* binding */ UnexpectedPeerError)\n/* harmony export */ });\n/**\n * When this error is thrown it means an operation was aborted,\n * usually in response to the `abort` event being emitted by an\n * AbortSignal.\n */\nclass AbortError extends Error {\n code;\n type;\n constructor(message = 'The operation was aborted') {\n super(message);\n this.name = 'AbortError';\n this.code = AbortError.code;\n this.type = AbortError.type;\n }\n static code = 'ABORT_ERR';\n static type = 'aborted';\n}\nclass CodeError extends Error {\n code;\n props;\n constructor(message, code, props) {\n super(message);\n this.code = code;\n this.name = props?.name ?? 'CodeError';\n this.props = props ?? {}; // eslint-disable-line @typescript-eslint/consistent-type-assertions\n }\n}\nclass AggregateCodeError extends AggregateError {\n code;\n props;\n constructor(errors, message, code, props) {\n super(errors, message);\n this.code = code;\n this.name = props?.name ?? 'AggregateCodeError';\n this.props = props ?? {}; // eslint-disable-line @typescript-eslint/consistent-type-assertions\n }\n}\nclass UnexpectedPeerError extends Error {\n code;\n constructor(message = 'Unexpected Peer') {\n super(message);\n this.name = 'UnexpectedPeerError';\n this.code = UnexpectedPeerError.code;\n }\n static code = 'ERR_UNEXPECTED_PEER';\n}\nclass InvalidCryptoExchangeError extends Error {\n code;\n constructor(message = 'Invalid crypto exchange') {\n super(message);\n this.name = 'InvalidCryptoExchangeError';\n this.code = InvalidCryptoExchangeError.code;\n }\n static code = 'ERR_INVALID_CRYPTO_EXCHANGE';\n}\nclass InvalidCryptoTransmissionError extends Error {\n code;\n constructor(message = 'Invalid crypto transmission') {\n super(message);\n this.name = 'InvalidCryptoTransmissionError';\n this.code = InvalidCryptoTransmissionError.code;\n }\n static code = 'ERR_INVALID_CRYPTO_TRANSMISSION';\n}\n// Error codes\nconst ERR_TIMEOUT = 'ERR_TIMEOUT';\nconst ERR_INVALID_PARAMETERS = 'ERR_INVALID_PARAMETERS';\nconst ERR_NOT_FOUND = 'ERR_NOT_FOUND';\nconst ERR_INVALID_MESSAGE = 'ERR_INVALID_MESSAGE';\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/errors.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/event-target.js":
|
||
/*!*****************************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/event-target.js ***!
|
||
\*****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CustomEvent: () => (/* binding */ CustomEvent),\n/* harmony export */ TypedEventEmitter: () => (/* binding */ TypedEventEmitter)\n/* harmony export */ });\n/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./events.js */ \"./node_modules/@libp2p/interface/dist/src/events.js\");\n\n/**\n * An implementation of a typed event target\n * etc\n */\nclass TypedEventEmitter extends EventTarget {\n #listeners = new Map();\n constructor() {\n super();\n // silence MaxListenersExceededWarning warning on Node.js, this is a red\n // herring almost all of the time\n (0,_events_js__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)(Infinity, this);\n }\n listenerCount(type) {\n const listeners = this.#listeners.get(type);\n if (listeners == null) {\n return 0;\n }\n return listeners.length;\n }\n addEventListener(type, listener, options) {\n super.addEventListener(type, listener, options);\n let list = this.#listeners.get(type);\n if (list == null) {\n list = [];\n this.#listeners.set(type, list);\n }\n list.push({\n callback: listener,\n once: (options !== true && options !== false && options?.once) ?? false\n });\n }\n removeEventListener(type, listener, options) {\n super.removeEventListener(type.toString(), listener ?? null, options);\n let list = this.#listeners.get(type);\n if (list == null) {\n return;\n }\n list = list.filter(({ callback }) => callback !== listener);\n this.#listeners.set(type, list);\n }\n dispatchEvent(event) {\n const result = super.dispatchEvent(event);\n let list = this.#listeners.get(event.type);\n if (list == null) {\n return result;\n }\n list = list.filter(({ once }) => !once);\n this.#listeners.set(event.type, list);\n return result;\n }\n safeDispatchEvent(type, detail = {}) {\n return this.dispatchEvent(new CustomEvent(type, detail));\n }\n}\n/**\n * CustomEvent is a standard event but it's not supported by node.\n *\n * Remove this when https://github.com/nodejs/node/issues/40678 is closed.\n *\n * Ref: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent\n */\nclass CustomEventPolyfill extends Event {\n /** Returns any custom data event was created with. Typically used for synthetic events. */\n detail;\n constructor(message, data) {\n super(message, data);\n // @ts-expect-error could be undefined\n this.detail = data?.detail;\n }\n}\nconst CustomEvent = globalThis.CustomEvent ?? CustomEventPolyfill;\n//# sourceMappingURL=event-target.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/event-target.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/events.browser.js":
|
||
/*!*******************************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/events.browser.js ***!
|
||
\*******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ setMaxListeners: () => (/* binding */ setMaxListeners)\n/* harmony export */ });\n/** Noop for browser compatibility */\nfunction setMaxListeners() { }\n//# sourceMappingURL=events.browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/events.browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/events.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/events.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ setMaxListeners: () => (/* binding */ setMaxListeners)\n/* harmony export */ });\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ \"./node_modules/@libp2p/interface/dist/src/events.browser.js\");\n\n// create a setMaxListeners that doesn't break browser usage\nconst setMaxListeners = (n, ...eventTargets) => {\n try {\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)(n, ...eventTargets);\n }\n catch {\n // swallow error, gulp\n }\n};\n//# sourceMappingURL=events.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/events.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/peer-discovery/index.js":
|
||
/*!*************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/peer-discovery/index.js ***!
|
||
\*************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ peerDiscoverySymbol: () => (/* binding */ peerDiscoverySymbol)\n/* harmony export */ });\n/**\n * Any object that implements this Symbol as a property should return a\n * PeerDiscovery instance as the property value, similar to how\n * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.\n *\n * @example\n *\n * ```TypeScript\n * import { peerDiscovery, PeerDiscovery } from '@libp2p/peer-discovery'\n *\n * class MyPeerDiscoverer implements PeerDiscovery {\n * get [peerDiscovery] () {\n * return this\n * }\n *\n * // ...other methods\n * }\n * ```\n */\nconst peerDiscoverySymbol = Symbol.for('@libp2p/peer-discovery');\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/peer-discovery/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/peer-id/index.js":
|
||
/*!******************************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/peer-id/index.js ***!
|
||
\******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isPeerId: () => (/* binding */ isPeerId),\n/* harmony export */ peerIdSymbol: () => (/* binding */ peerIdSymbol)\n/* harmony export */ });\nconst peerIdSymbol = Symbol.for('@libp2p/peer-id');\nfunction isPeerId(other) {\n return other != null && Boolean(other[peerIdSymbol]);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/peer-id/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/peer-routing/index.js":
|
||
/*!***********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/peer-routing/index.js ***!
|
||
\***********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ peerRoutingSymbol: () => (/* binding */ peerRoutingSymbol)\n/* harmony export */ });\n/**\n * Any object that implements this Symbol as a property should return a\n * PeerRouting instance as the property value, similar to how\n * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.\n *\n * @example\n *\n * ```TypeScript\n * import { peerRouting, PeerRouting } from '@libp2p/peer-routing'\n *\n * class MyPeerRouter implements PeerRouting {\n * get [peerRouting] () {\n * return this\n * }\n *\n * // ...other methods\n * }\n * ```\n */\nconst peerRoutingSymbol = Symbol.for('@libp2p/peer-routing');\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/peer-routing/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/peer-store/tags.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/peer-store/tags.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ KEEP_ALIVE: () => (/* binding */ KEEP_ALIVE)\n/* harmony export */ });\nconst KEEP_ALIVE = 'keep-alive';\n//# sourceMappingURL=tags.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/peer-store/tags.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/pubsub/index.js":
|
||
/*!*****************************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/pubsub/index.js ***!
|
||
\*****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ StrictNoSign: () => (/* binding */ StrictNoSign),\n/* harmony export */ StrictSign: () => (/* binding */ StrictSign),\n/* harmony export */ TopicValidatorResult: () => (/* binding */ TopicValidatorResult)\n/* harmony export */ });\n/**\n * On the producing side:\n * * Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields.\n *\n * On the consuming side:\n * * Enforce the fields to be present, reject otherwise.\n * * Propagate only if the fields are valid and signature can be verified, reject otherwise.\n */\nconst StrictSign = 'StrictSign';\n/**\n * On the producing side:\n * * Build messages without the signature, key, from and seqno fields.\n * * The corresponding protobuf key-value pairs are absent from the marshalled message, not just empty.\n *\n * On the consuming side:\n * * Enforce the fields to be absent, reject otherwise.\n * * Propagate only if the fields are absent, reject otherwise.\n * * A message_id function will not be able to use the above fields, and should instead rely on the data field. A commonplace strategy is to calculate a hash.\n */\nconst StrictNoSign = 'StrictNoSign';\nvar TopicValidatorResult;\n(function (TopicValidatorResult) {\n /**\n * The message is considered valid, and it should be delivered and forwarded to the network\n */\n TopicValidatorResult[\"Accept\"] = \"accept\";\n /**\n * The message is neither delivered nor forwarded to the network\n */\n TopicValidatorResult[\"Ignore\"] = \"ignore\";\n /**\n * The message is considered invalid, and it should be rejected\n */\n TopicValidatorResult[\"Reject\"] = \"reject\";\n})(TopicValidatorResult || (TopicValidatorResult = {}));\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/pubsub/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/startable.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/startable.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isStartable: () => (/* binding */ isStartable),\n/* harmony export */ start: () => (/* binding */ start),\n/* harmony export */ stop: () => (/* binding */ stop)\n/* harmony export */ });\nfunction isStartable(obj) {\n return obj != null && typeof obj.start === 'function' && typeof obj.stop === 'function';\n}\nasync function start(...objs) {\n const startables = [];\n for (const obj of objs) {\n if (isStartable(obj)) {\n startables.push(obj);\n }\n }\n await Promise.all(startables.map(async (s) => {\n if (s.beforeStart != null) {\n await s.beforeStart();\n }\n }));\n await Promise.all(startables.map(async (s) => {\n await s.start();\n }));\n await Promise.all(startables.map(async (s) => {\n if (s.afterStart != null) {\n await s.afterStart();\n }\n }));\n}\nasync function stop(...objs) {\n const startables = [];\n for (const obj of objs) {\n if (isStartable(obj)) {\n startables.push(obj);\n }\n }\n await Promise.all(startables.map(async (s) => {\n if (s.beforeStop != null) {\n await s.beforeStop();\n }\n }));\n await Promise.all(startables.map(async (s) => {\n await s.stop();\n }));\n await Promise.all(startables.map(async (s) => {\n if (s.afterStop != null) {\n await s.afterStop();\n }\n }));\n}\n//# sourceMappingURL=startable.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/startable.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/interface/dist/src/transport/index.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/interface/dist/src/transport/index.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FaultTolerance: () => (/* binding */ FaultTolerance),\n/* harmony export */ isTransport: () => (/* binding */ isTransport),\n/* harmony export */ transportSymbol: () => (/* binding */ transportSymbol)\n/* harmony export */ });\nconst transportSymbol = Symbol.for('@libp2p/transport');\nfunction isTransport(other) {\n return other != null && Boolean(other[transportSymbol]);\n}\n/**\n * Enum Transport Manager Fault Tolerance values\n */\nvar FaultTolerance;\n(function (FaultTolerance) {\n /**\n * should be used for failing in any listen circumstance\n */\n FaultTolerance[FaultTolerance[\"FATAL_ALL\"] = 0] = \"FATAL_ALL\";\n /**\n * should be used for not failing when not listening\n */\n FaultTolerance[FaultTolerance[\"NO_FATAL\"] = 1] = \"NO_FATAL\";\n})(FaultTolerance || (FaultTolerance = {}));\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/interface/dist/src/transport/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/logger/dist/src/index.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@libp2p/logger/dist/src/index.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ defaultLogger: () => (/* binding */ defaultLogger),\n/* harmony export */ disable: () => (/* binding */ disable),\n/* harmony export */ enable: () => (/* binding */ enable),\n/* harmony export */ enabled: () => (/* binding */ enabled),\n/* harmony export */ logger: () => (/* binding */ logger),\n/* harmony export */ peerLogger: () => (/* binding */ peerLogger),\n/* harmony export */ prefixLogger: () => (/* binding */ prefixLogger)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/bases/base32 */ \"./node_modules/multiformats/dist/src/bases/base32.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/dist/src/bases/base58.js\");\n/* harmony import */ var multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multiformats/bases/base64 */ \"./node_modules/multiformats/dist/src/bases/base64.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@libp2p/logger/dist/src/utils.js\");\n/**\n * @packageDocumentation\n *\n * A logger for libp2p based on the venerable [debug](https://www.npmjs.com/package/debug) module.\n *\n * @example\n *\n * ```TypeScript\n * import { logger } from '@libp2p/logger'\n *\n * const log = logger('libp2p:my:component:name')\n *\n * try {\n * // an operation\n * log('something happened: %s', 'it was ok')\n * } catch (err) {\n * log.error('something bad happened: %o', err)\n * }\n *\n * log('with this peer: %p', {})\n * log('and this base58btc: %b', Uint8Array.from([0, 1, 2, 3]))\n * log('and this base32: %t', Uint8Array.from([4, 5, 6, 7]))\n * ```\n *\n * ```console\n * $ DEBUG=libp2p:* node index.js\n * something happened: it was ok\n * something bad happened: <stack trace>\n * with this peer: 12D3Foo\n * with this base58btc: Qmfoo\n * with this base32: bafyfoo\n * ```\n */\n\n\n\n\n\n// Add a formatter for converting to a base58 string\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.b = (v) => {\n return v == null ? 'undefined' : multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_2__.base58btc.baseEncode(v);\n};\n// Add a formatter for converting to a base32 string\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.t = (v) => {\n return v == null ? 'undefined' : multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_1__.base32.baseEncode(v);\n};\n// Add a formatter for converting to a base64 string\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.m = (v) => {\n return v == null ? 'undefined' : multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_3__.base64.baseEncode(v);\n};\n// Add a formatter for stringifying peer ids\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.p = (v) => {\n return v == null ? 'undefined' : v.toString();\n};\n// Add a formatter for stringifying CIDs\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.c = (v) => {\n return v == null ? 'undefined' : v.toString();\n};\n// Add a formatter for stringifying Datastore keys\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.k = (v) => {\n return v == null ? 'undefined' : v.toString();\n};\n// Add a formatter for stringifying Multiaddrs\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.a = (v) => {\n return v == null ? 'undefined' : v.toString();\n};\nfunction createDisabledLogger(namespace) {\n const logger = () => { };\n logger.enabled = false;\n logger.color = '';\n logger.diff = 0;\n logger.log = () => { };\n logger.namespace = namespace;\n logger.destroy = () => true;\n logger.extend = () => logger;\n return logger;\n}\n/**\n * Create a component logger that will prefix any log messages with a truncated\n * peer id.\n *\n * @example\n *\n * ```TypeScript\n * import { peerLogger } from '@libp2p/logger'\n * import { peerIdFromString } from '@libp2p/peer-id'\n *\n * const peerId = peerIdFromString('12D3FooBar')\n * const logger = peerLogger(peerId)\n *\n * const log = logger.forComponent('my-component')\n * log.info('hello world')\n * // logs \"12…oBar:my-component hello world\"\n * ```\n */\nfunction peerLogger(peerId, options = {}) {\n return prefixLogger((0,_utils_js__WEBPACK_IMPORTED_MODULE_4__.truncatePeerId)(peerId, options));\n}\n/**\n * Create a component logger that will prefix any log messages with the passed\n * string.\n *\n * @example\n *\n * ```TypeScript\n * import { prefixLogger } from '@libp2p/logger'\n *\n * const logger = prefixLogger('my-node')\n *\n * const log = logger.forComponent('my-component')\n * log.info('hello world')\n * // logs \"my-node:my-component hello world\"\n * ```\n */\nfunction prefixLogger(prefix) {\n return {\n forComponent(name) {\n return logger(`${prefix}:${name}`);\n }\n };\n}\n/**\n * Create a component logger\n *\n * @example\n *\n * ```TypeScript\n * import { defaultLogger } from '@libp2p/logger'\n * import { peerIdFromString } from '@libp2p/peer-id'\n *\n * const logger = defaultLogger()\n *\n * const log = logger.forComponent('my-component')\n * log.info('hello world')\n * // logs \"my-component hello world\"\n * ```\n */\nfunction defaultLogger() {\n return {\n forComponent(name) {\n return logger(name);\n }\n };\n}\n/**\n * Creates a logger for the passed component name.\n *\n * @example\n *\n * ```TypeScript\n * import { logger } from '@libp2p/logger'\n *\n * const log = logger('my-component')\n * log.info('hello world')\n * // logs \"my-component hello world\"\n * ```\n */\nfunction logger(name) {\n // trace logging is a no-op by default\n let trace = createDisabledLogger(`${name}:trace`);\n // look at all the debug names and see if trace logging has explicitly been enabled\n if (debug__WEBPACK_IMPORTED_MODULE_0__.enabled(`${name}:trace`) && debug__WEBPACK_IMPORTED_MODULE_0__.names.map(r => r.toString()).find(n => n.includes(':trace')) != null) {\n trace = debug__WEBPACK_IMPORTED_MODULE_0__(`${name}:trace`);\n }\n return Object.assign(debug__WEBPACK_IMPORTED_MODULE_0__(name), {\n error: debug__WEBPACK_IMPORTED_MODULE_0__(`${name}:error`),\n trace\n });\n}\nfunction disable() {\n debug__WEBPACK_IMPORTED_MODULE_0__.disable();\n}\nfunction enable(namespaces) {\n debug__WEBPACK_IMPORTED_MODULE_0__.enable(namespaces);\n}\nfunction enabled(namespaces) {\n return debug__WEBPACK_IMPORTED_MODULE_0__.enabled(namespaces);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/logger/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/logger/dist/src/utils.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@libp2p/logger/dist/src/utils.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ truncatePeerId: () => (/* binding */ truncatePeerId)\n/* harmony export */ });\nfunction truncatePeerId(peerId, options = {}) {\n const prefixLength = options.prefixLength ?? 2;\n const suffixLength = options.suffixLength ?? 4;\n const peerIdString = peerId.toString();\n return `${peerIdString.substring(0, prefixLength)}…${peerIdString.substring(peerIdString.length, peerIdString.length - suffixLength)}`;\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/logger/dist/src/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/dist/src/decode.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/dist/src/decode.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Decoder: () => (/* binding */ Decoder),\n/* harmony export */ MAX_MSG_QUEUE_SIZE: () => (/* binding */ MAX_MSG_QUEUE_SIZE),\n/* harmony export */ MAX_MSG_SIZE: () => (/* binding */ MAX_MSG_SIZE)\n/* harmony export */ });\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _message_types_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message-types.js */ \"./node_modules/@libp2p/mplex/dist/src/message-types.js\");\n\n\nconst MAX_MSG_SIZE = 1 << 20; // 1MB\nconst MAX_MSG_QUEUE_SIZE = 4 << 20; // 4MB\nclass Decoder {\n _buffer;\n _headerInfo;\n _maxMessageSize;\n _maxUnprocessedMessageQueueSize;\n constructor(maxMessageSize = MAX_MSG_SIZE, maxUnprocessedMessageQueueSize = MAX_MSG_QUEUE_SIZE) {\n this._buffer = new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList();\n this._headerInfo = null;\n this._maxMessageSize = maxMessageSize;\n this._maxUnprocessedMessageQueueSize = maxUnprocessedMessageQueueSize;\n }\n write(chunk) {\n if (chunk == null || chunk.length === 0) {\n return [];\n }\n this._buffer.append(chunk);\n if (this._buffer.byteLength > this._maxUnprocessedMessageQueueSize) {\n throw Object.assign(new Error('unprocessed message queue size too large!'), { code: 'ERR_MSG_QUEUE_TOO_BIG' });\n }\n const msgs = [];\n while (this._buffer.length !== 0) {\n if (this._headerInfo == null) {\n try {\n this._headerInfo = this._decodeHeader(this._buffer);\n }\n catch (err) {\n if (err.code === 'ERR_MSG_TOO_BIG') {\n throw err;\n }\n break; // We haven't received enough data yet\n }\n }\n const { id, type, length, offset } = this._headerInfo;\n const bufferedDataLength = this._buffer.length - offset;\n if (bufferedDataLength < length) {\n break; // not enough data yet\n }\n const msg = {\n id,\n type\n };\n if (type === _message_types_js__WEBPACK_IMPORTED_MODULE_1__.MessageTypes.NEW_STREAM || type === _message_types_js__WEBPACK_IMPORTED_MODULE_1__.MessageTypes.MESSAGE_INITIATOR || type === _message_types_js__WEBPACK_IMPORTED_MODULE_1__.MessageTypes.MESSAGE_RECEIVER) {\n msg.data = this._buffer.sublist(offset, offset + length);\n }\n msgs.push(msg);\n this._buffer.consume(offset + length);\n this._headerInfo = null;\n }\n return msgs;\n }\n /**\n * Attempts to decode the message header from the buffer\n */\n _decodeHeader(data) {\n const { value: h, offset } = readVarInt(data);\n const { value: length, offset: end } = readVarInt(data, offset);\n const type = h & 7;\n // @ts-expect-error h is a number not a CODE\n if (_message_types_js__WEBPACK_IMPORTED_MODULE_1__.MessageTypeNames[type] == null) {\n throw new Error(`Invalid type received: ${type}`);\n }\n // test message type varint + data length\n if (length > this._maxMessageSize) {\n throw Object.assign(new Error('message size too large!'), { code: 'ERR_MSG_TOO_BIG' });\n }\n // @ts-expect-error h is a number not a CODE\n return { id: h >> 3, type, offset: offset + end, length };\n }\n}\nconst MSB = 0x80;\nconst REST = 0x7F;\nfunction readVarInt(buf, offset = 0) {\n let res = 0;\n let shift = 0;\n let counter = offset;\n let b;\n const l = buf.length;\n do {\n if (counter >= l || shift > 49) {\n offset = 0;\n throw new RangeError('Could not decode varint');\n }\n b = buf.get(counter++);\n res += shift < 28\n ? (b & REST) << shift\n : (b & REST) * Math.pow(2, shift);\n shift += 7;\n } while (b >= MSB);\n offset = counter - offset;\n return {\n value: res,\n offset\n };\n}\n//# sourceMappingURL=decode.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/dist/src/decode.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/dist/src/encode.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/dist/src/encode.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _message_types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message-types.js */ \"./node_modules/@libp2p/mplex/dist/src/message-types.js\");\n\n\n\n\nconst POOL_SIZE = 10 * 1024;\nclass Encoder {\n _pool;\n _poolOffset;\n constructor() {\n this._pool = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.allocUnsafe)(POOL_SIZE);\n this._poolOffset = 0;\n }\n /**\n * Encodes the given message and adds it to the passed list\n */\n write(msg, list) {\n const pool = this._pool;\n let offset = this._poolOffset;\n uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encode(msg.id << 3 | msg.type, pool, offset);\n offset += uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encodingLength(msg.id << 3 | msg.type);\n if ((msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.NEW_STREAM || msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.MESSAGE_INITIATOR || msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.MESSAGE_RECEIVER) && msg.data != null) {\n uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encode(msg.data.length, pool, offset);\n offset += uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encodingLength(msg.data.length);\n }\n else {\n uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encode(0, pool, offset);\n offset += uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encodingLength(0);\n }\n const header = pool.subarray(this._poolOffset, offset);\n if (POOL_SIZE - offset < 100) {\n this._pool = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.allocUnsafe)(POOL_SIZE);\n this._poolOffset = 0;\n }\n else {\n this._poolOffset = offset;\n }\n list.append(header);\n if ((msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.NEW_STREAM || msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.MESSAGE_INITIATOR || msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.MESSAGE_RECEIVER) && msg.data != null) {\n list.append(msg.data);\n }\n }\n}\nconst encoder = new Encoder();\n/**\n * Encode and yield one or more messages\n */\nasync function* encode(source) {\n for await (const message of source) {\n const list = new uint8arraylist__WEBPACK_IMPORTED_MODULE_1__.Uint8ArrayList();\n encoder.write(message, list);\n yield list;\n }\n}\n//# sourceMappingURL=encode.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/dist/src/encode.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/dist/src/index.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/dist/src/index.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ mplex: () => (/* binding */ mplex)\n/* harmony export */ });\n/* harmony import */ var _mplex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mplex.js */ \"./node_modules/@libp2p/mplex/dist/src/mplex.js\");\n/**\n * @packageDocumentation\n *\n * This is a [simple stream multiplexer(https://docs.libp2p.io/concepts/multiplex/mplex/) that has been deprecated.\n *\n * Please use [@chainsafe/libp2p-yamux](https://www.npmjs.com/package/@chainsafe/libp2p-yamux) instead.\n *\n * @example\n *\n * ```TypeScript\n * import { mplex } from '@libp2p/mplex'\n * import { pipe } from 'it-pipe'\n *\n * const factory = mplex()\n *\n * const muxer = factory.createStreamMuxer(components, {\n * onStream: stream => { // Receive a duplex stream from the remote\n * // ...receive data from the remote and optionally send data back\n * },\n * onStreamEnd: stream => {\n * // ...handle any tracking you may need of stream closures\n * }\n * })\n *\n * pipe(conn, muxer, conn) // conn is duplex connection to another peer\n *\n * const stream = muxer.newStream() // Create a new duplex stream to the remote\n *\n * // Use the duplex stream to send some data to the remote...\n * pipe([1, 2, 3], stream)\n * ```\n */\n\nclass Mplex {\n protocol = '/mplex/6.7.0';\n _init;\n components;\n constructor(components, init = {}) {\n this.components = components;\n this._init = init;\n }\n createStreamMuxer(init = {}) {\n return new _mplex_js__WEBPACK_IMPORTED_MODULE_0__.MplexStreamMuxer(this.components, {\n ...init,\n ...this._init\n });\n }\n}\nfunction mplex(init = {}) {\n return (components) => new Mplex(components, init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/dist/src/message-types.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/dist/src/message-types.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InitiatorMessageTypes: () => (/* binding */ InitiatorMessageTypes),\n/* harmony export */ MessageTypeNames: () => (/* binding */ MessageTypeNames),\n/* harmony export */ MessageTypes: () => (/* binding */ MessageTypes),\n/* harmony export */ ReceiverMessageTypes: () => (/* binding */ ReceiverMessageTypes)\n/* harmony export */ });\nvar MessageTypes;\n(function (MessageTypes) {\n MessageTypes[MessageTypes[\"NEW_STREAM\"] = 0] = \"NEW_STREAM\";\n MessageTypes[MessageTypes[\"MESSAGE_RECEIVER\"] = 1] = \"MESSAGE_RECEIVER\";\n MessageTypes[MessageTypes[\"MESSAGE_INITIATOR\"] = 2] = \"MESSAGE_INITIATOR\";\n MessageTypes[MessageTypes[\"CLOSE_RECEIVER\"] = 3] = \"CLOSE_RECEIVER\";\n MessageTypes[MessageTypes[\"CLOSE_INITIATOR\"] = 4] = \"CLOSE_INITIATOR\";\n MessageTypes[MessageTypes[\"RESET_RECEIVER\"] = 5] = \"RESET_RECEIVER\";\n MessageTypes[MessageTypes[\"RESET_INITIATOR\"] = 6] = \"RESET_INITIATOR\";\n})(MessageTypes || (MessageTypes = {}));\nconst MessageTypeNames = Object.freeze({\n 0: 'NEW_STREAM',\n 1: 'MESSAGE_RECEIVER',\n 2: 'MESSAGE_INITIATOR',\n 3: 'CLOSE_RECEIVER',\n 4: 'CLOSE_INITIATOR',\n 5: 'RESET_RECEIVER',\n 6: 'RESET_INITIATOR'\n});\nconst InitiatorMessageTypes = Object.freeze({\n NEW_STREAM: MessageTypes.NEW_STREAM,\n MESSAGE: MessageTypes.MESSAGE_INITIATOR,\n CLOSE: MessageTypes.CLOSE_INITIATOR,\n RESET: MessageTypes.RESET_INITIATOR\n});\nconst ReceiverMessageTypes = Object.freeze({\n MESSAGE: MessageTypes.MESSAGE_RECEIVER,\n CLOSE: MessageTypes.CLOSE_RECEIVER,\n RESET: MessageTypes.RESET_RECEIVER\n});\n//# sourceMappingURL=message-types.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/dist/src/message-types.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/dist/src/mplex.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/dist/src/mplex.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MplexStreamMuxer: () => (/* binding */ MplexStreamMuxer)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_utils_close_source__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/utils/close-source */ \"./node_modules/@libp2p/utils/dist/src/close-source.js\");\n/* harmony import */ var _libp2p_utils_rate_limiter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/utils/rate-limiter */ \"./node_modules/@libp2p/utils/dist/src/rate-limiter.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var uint8arrays__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/index.js\");\n/* harmony import */ var _decode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./decode.js */ \"./node_modules/@libp2p/mplex/dist/src/decode.js\");\n/* harmony import */ var _encode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./encode.js */ \"./node_modules/@libp2p/mplex/dist/src/encode.js\");\n/* harmony import */ var _message_types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message-types.js */ \"./node_modules/@libp2p/mplex/dist/src/message-types.js\");\n/* harmony import */ var _stream_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stream.js */ \"./node_modules/@libp2p/mplex/dist/src/stream.js\");\n\n\n\n\n\n\n\n\n\n\nconst MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION = 1024;\nconst MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION = 1024;\nconst MAX_STREAM_BUFFER_SIZE = 1024 * 1024 * 4; // 4MB\nconst DISCONNECT_THRESHOLD = 5;\nconst CLOSE_TIMEOUT = 500;\nfunction printMessage(msg) {\n const output = {\n ...msg,\n type: `${_message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypeNames[msg.type]} (${msg.type})`\n };\n if (msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.NEW_STREAM) {\n output.data = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_2__.toString)(msg.data instanceof Uint8Array ? msg.data : msg.data.subarray());\n }\n if (msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.MESSAGE_INITIATOR || msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.MESSAGE_RECEIVER) {\n output.data = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_2__.toString)(msg.data instanceof Uint8Array ? msg.data : msg.data.subarray(), 'base16');\n }\n return output;\n}\nclass MplexStreamMuxer {\n protocol = '/mplex/6.7.0';\n sink;\n source;\n log;\n _streamId;\n _streams;\n _init;\n _source;\n closeController;\n rateLimiter;\n closeTimeout;\n logger;\n constructor(components, init) {\n init = init ?? {};\n this.log = components.logger.forComponent('libp2p:mplex');\n this.logger = components.logger;\n this._streamId = 0;\n this._streams = {\n /**\n * Stream to ids map\n */\n initiators: new Map(),\n /**\n * Stream to ids map\n */\n receivers: new Map()\n };\n this._init = init;\n this.closeTimeout = init.closeTimeout ?? CLOSE_TIMEOUT;\n /**\n * An iterable sink\n */\n this.sink = this._createSink();\n /**\n * An iterable source\n */\n this._source = (0,it_pushable__WEBPACK_IMPORTED_MODULE_1__.pushable)({\n objectMode: true,\n onEnd: () => {\n // the source has ended, we can't write any more messages to gracefully\n // close streams so all we can do is destroy them\n for (const stream of this._streams.initiators.values()) {\n stream.destroy();\n }\n for (const stream of this._streams.receivers.values()) {\n stream.destroy();\n }\n }\n });\n this.source = (0,it_pipe__WEBPACK_IMPORTED_MODULE_0__.pipe)(this._source, source => (0,_encode_js__WEBPACK_IMPORTED_MODULE_4__.encode)(source));\n /**\n * Close controller\n */\n this.closeController = new AbortController();\n this.rateLimiter = new _libp2p_utils_rate_limiter__WEBPACK_IMPORTED_MODULE_5__.RateLimiter({\n points: init.disconnectThreshold ?? DISCONNECT_THRESHOLD,\n duration: 1\n });\n }\n /**\n * Returns a Map of streams and their ids\n */\n get streams() {\n // Inbound and Outbound streams may have the same ids, so we need to make those unique\n const streams = [];\n for (const stream of this._streams.initiators.values()) {\n streams.push(stream);\n }\n for (const stream of this._streams.receivers.values()) {\n streams.push(stream);\n }\n return streams;\n }\n /**\n * Initiate a new stream with the given name. If no name is\n * provided, the id of the stream will be used.\n */\n newStream(name) {\n if (this.closeController.signal.aborted) {\n throw new Error('Muxer already closed');\n }\n const id = this._streamId++;\n name = name == null ? id.toString() : name.toString();\n const registry = this._streams.initiators;\n return this._newStream({ id, name, type: 'initiator', registry });\n }\n /**\n * Close or abort all tracked streams and stop the muxer\n */\n async close(options) {\n if (this.closeController.signal.aborted) {\n return;\n }\n const signal = options?.signal ?? AbortSignal.timeout(this.closeTimeout);\n try {\n // try to gracefully close all streams\n await Promise.all(this.streams.map(async (s) => s.close({\n signal\n })));\n this._source.end();\n // try to gracefully close the muxer\n await this._source.onEmpty({\n signal\n });\n this.closeController.abort();\n }\n catch (err) {\n this.abort(err);\n }\n }\n abort(err) {\n if (this.closeController.signal.aborted) {\n return;\n }\n this.streams.forEach(s => { s.abort(err); });\n this.closeController.abort(err);\n }\n /**\n * Called whenever an inbound stream is created\n */\n _newReceiverStream(options) {\n const { id, name } = options;\n const registry = this._streams.receivers;\n return this._newStream({ id, name, type: 'receiver', registry });\n }\n _newStream(options) {\n const { id, name, type, registry } = options;\n this.log('new %s stream %s', type, id);\n if (type === 'initiator' && this._streams.initiators.size === (this._init.maxOutboundStreams ?? MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__.CodeError('Too many outbound streams open', 'ERR_TOO_MANY_OUTBOUND_STREAMS');\n }\n if (registry.has(id)) {\n throw new Error(`${type} stream ${id} already exists!`);\n }\n const send = async (msg) => {\n if (this.log.enabled) {\n this.log.trace('%s stream %s send', type, id, printMessage(msg));\n }\n this._source.push(msg);\n };\n const onEnd = () => {\n this.log('%s stream with id %s and protocol %s ended', type, id, stream.protocol);\n registry.delete(id);\n if (this._init.onStreamEnd != null) {\n this._init.onStreamEnd(stream);\n }\n };\n const stream = (0,_stream_js__WEBPACK_IMPORTED_MODULE_7__.createStream)({ id, name, send, type, onEnd, maxMsgSize: this._init.maxMsgSize, logger: this.logger });\n registry.set(id, stream);\n return stream;\n }\n /**\n * Creates a sink with an abortable source. Incoming messages will\n * also have their size restricted. All messages will be varint decoded.\n */\n _createSink() {\n const sink = async (source) => {\n const abortListener = () => {\n (0,_libp2p_utils_close_source__WEBPACK_IMPORTED_MODULE_8__.closeSource)(source, this.log);\n };\n this.closeController.signal.addEventListener('abort', abortListener);\n try {\n const decoder = new _decode_js__WEBPACK_IMPORTED_MODULE_9__.Decoder(this._init.maxMsgSize, this._init.maxUnprocessedMessageQueueSize);\n for await (const chunk of source) {\n for (const msg of decoder.write(chunk)) {\n await this._handleIncoming(msg);\n }\n }\n this._source.end();\n }\n catch (err) {\n this.log('error in sink', err);\n this._source.end(err); // End the source with an error\n }\n finally {\n this.closeController.signal.removeEventListener('abort', abortListener);\n }\n };\n return sink;\n }\n async _handleIncoming(message) {\n const { id, type } = message;\n if (this.log.enabled) {\n this.log.trace('incoming message', printMessage(message));\n }\n // Create a new stream?\n if (message.type === _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.NEW_STREAM) {\n if (this._streams.receivers.size === (this._init.maxInboundStreams ?? MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION)) {\n this.log('too many inbound streams open');\n // not going to allow this stream, send the reset message manually\n // instead of setting it up just to tear it down\n this._source.push({\n id,\n type: _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.RESET_RECEIVER\n });\n // if we've hit our stream limit, and the remote keeps trying to open\n // more new streams, if they are doing this very quickly maybe they\n // are attacking us and we should close the connection\n try {\n await this.rateLimiter.consume('new-stream', 1);\n }\n catch {\n this.log('rate limit hit when opening too many new streams over the inbound stream limit - closing remote connection');\n // since there's no backpressure in mplex, the only thing we can really do to protect ourselves is close the connection\n this.abort(new Error('Too many open streams'));\n return;\n }\n return;\n }\n const stream = this._newReceiverStream({ id, name: (0,uint8arrays__WEBPACK_IMPORTED_MODULE_2__.toString)(message.data instanceof Uint8Array ? message.data : message.data.subarray()) });\n if (this._init.onIncomingStream != null) {\n this._init.onIncomingStream(stream);\n }\n return;\n }\n const list = (type & 1) === 1 ? this._streams.initiators : this._streams.receivers;\n const stream = list.get(id);\n if (stream == null) {\n this.log('missing stream %s for message type %s', id, _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypeNames[type]);\n // if the remote keeps sending us messages for streams that have been\n // closed or were never opened they may be attacking us so if they do\n // this very quickly all we can do is close the connection\n try {\n await this.rateLimiter.consume('missing-stream', 1);\n }\n catch {\n this.log('rate limit hit when receiving messages for streams that do not exist - closing remote connection');\n // since there's no backpressure in mplex, the only thing we can really do to protect ourselves is close the connection\n this.abort(new Error('Too many messages for missing streams'));\n return;\n }\n return;\n }\n const maxBufferSize = this._init.maxStreamBufferSize ?? MAX_STREAM_BUFFER_SIZE;\n try {\n switch (type) {\n case _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.MESSAGE_INITIATOR:\n case _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.MESSAGE_RECEIVER:\n if (stream.sourceReadableLength() > maxBufferSize) {\n // Stream buffer has got too large, reset the stream\n this._source.push({\n id: message.id,\n type: type === _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.MESSAGE_INITIATOR ? _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.RESET_RECEIVER : _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.RESET_INITIATOR\n });\n // Inform the stream consumer they are not fast enough\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__.CodeError('Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers', 'ERR_STREAM_INPUT_BUFFER_FULL');\n }\n // We got data from the remote, push it into our local stream\n stream.sourcePush(message.data);\n break;\n case _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.CLOSE_INITIATOR:\n case _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.CLOSE_RECEIVER:\n // The remote has stopped writing, so we can stop reading\n stream.remoteCloseWrite();\n break;\n case _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.RESET_INITIATOR:\n case _message_types_js__WEBPACK_IMPORTED_MODULE_3__.MessageTypes.RESET_RECEIVER:\n // The remote has errored, stop reading and writing to the stream immediately\n stream.reset();\n break;\n default:\n this.log('unknown message type %s', type);\n }\n }\n catch (err) {\n this.log.error('error while processing message', err);\n stream.abort(err);\n }\n }\n}\n//# sourceMappingURL=mplex.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/dist/src/mplex.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/dist/src/stream.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/dist/src/stream.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MplexStream: () => (/* binding */ MplexStream),\n/* harmony export */ createStream: () => (/* binding */ createStream)\n/* harmony export */ });\n/* harmony import */ var _libp2p_utils_abstract_stream__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/utils/abstract-stream */ \"./node_modules/@libp2p/utils/dist/src/abstract-stream.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _decode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./decode.js */ \"./node_modules/@libp2p/mplex/dist/src/decode.js\");\n/* harmony import */ var _message_types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message-types.js */ \"./node_modules/@libp2p/mplex/dist/src/message-types.js\");\n\n\n\n\n\nclass MplexStream extends _libp2p_utils_abstract_stream__WEBPACK_IMPORTED_MODULE_2__.AbstractStream {\n name;\n streamId;\n send;\n types;\n maxDataSize;\n constructor(init) {\n super(init);\n this.types = init.direction === 'outbound' ? _message_types_js__WEBPACK_IMPORTED_MODULE_3__.InitiatorMessageTypes : _message_types_js__WEBPACK_IMPORTED_MODULE_3__.ReceiverMessageTypes;\n this.send = init.send;\n this.name = init.name;\n this.streamId = init.streamId;\n this.maxDataSize = init.maxDataSize;\n }\n async sendNewStream() {\n await this.send({ id: this.streamId, type: _message_types_js__WEBPACK_IMPORTED_MODULE_3__.InitiatorMessageTypes.NEW_STREAM, data: new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(this.name)) });\n }\n async sendData(data) {\n data = data.sublist();\n while (data.byteLength > 0) {\n const toSend = Math.min(data.byteLength, this.maxDataSize);\n await this.send({\n id: this.streamId,\n type: this.types.MESSAGE,\n data: data.sublist(0, toSend)\n });\n data.consume(toSend);\n }\n }\n async sendReset() {\n await this.send({ id: this.streamId, type: this.types.RESET });\n }\n async sendCloseWrite() {\n await this.send({ id: this.streamId, type: this.types.CLOSE });\n }\n async sendCloseRead() {\n // mplex does not support close read, only close write\n }\n}\nfunction createStream(options) {\n const { id, name, send, onEnd, type = 'initiator', maxMsgSize = _decode_js__WEBPACK_IMPORTED_MODULE_4__.MAX_MSG_SIZE } = options;\n return new MplexStream({\n id: type === 'initiator' ? (`i${id}`) : `r${id}`,\n streamId: id,\n name: `${name == null ? id : name}`,\n direction: type === 'initiator' ? 'outbound' : 'inbound',\n maxDataSize: maxMsgSize,\n onEnd,\n send,\n log: options.logger.forComponent(`libp2p:mplex:stream:${type}:${id}`)\n });\n}\n//# sourceMappingURL=stream.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/dist/src/stream.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/compare.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/compare.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compare: () => (/* binding */ compare)\n/* harmony export */ });\n/**\n * Can be used with Array.sort to sort and array with Uint8Array entries\n */\nfunction compare(a, b) {\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] < b[i]) {\n return -1;\n }\n if (a[i] > b[i]) {\n return 1;\n }\n }\n if (a.byteLength > b.byteLength) {\n return 1;\n }\n if (a.byteLength < b.byteLength) {\n return -1;\n }\n return 0;\n}\n//# sourceMappingURL=compare.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/compare.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/concat.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/concat.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ concat: () => (/* binding */ concat)\n/* harmony export */ });\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #alloc */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #util/as-uint8array */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Uint8Arrays\n */\nfunction concat(arrays, length) {\n if (length == null) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n const output = (0,_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(length);\n let offset = 0;\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n return (0,_util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(output);\n}\n//# sourceMappingURL=concat.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/concat.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/equals.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/equals.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/index.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/index.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compare: () => (/* reexport safe */ _compare__WEBPACK_IMPORTED_MODULE_2__.compare),\n/* harmony export */ concat: () => (/* reexport safe */ _concat__WEBPACK_IMPORTED_MODULE_3__.concat),\n/* harmony export */ equals: () => (/* reexport safe */ _equals_js__WEBPACK_IMPORTED_MODULE_0__.equals),\n/* harmony export */ fromString: () => (/* reexport safe */ _from_string__WEBPACK_IMPORTED_MODULE_4__.fromString),\n/* harmony export */ toString: () => (/* reexport safe */ _to_string__WEBPACK_IMPORTED_MODULE_5__.toString),\n/* harmony export */ xor: () => (/* reexport safe */ _xor_js__WEBPACK_IMPORTED_MODULE_1__.xor)\n/* harmony export */ });\n/* harmony import */ var _equals_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./equals.js */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _xor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./xor.js */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/xor.js\");\n/* harmony import */ var _compare__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! #compare */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/compare.js\");\n/* harmony import */ var _concat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #concat */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var _from_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! #from-string */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _to_string__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #to-string */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/to-string.js\");\n/**\n * @packageDocumentation\n *\n * `Uint8Array`s bring memory-efficient(ish) byte handling to browsers - they are similar to Node.js `Buffer`s but lack a lot of the utility methods present on that class.\n *\n * This module exports a number of function that let you do common operations - joining Uint8Arrays together, seeing if they have the same contents etc.\n *\n * Since Node.js `Buffer`s are also `Uint8Array`s, it falls back to `Buffer` internally where it makes sense for performance reasons.\n *\n * ## alloc(size)\n *\n * Create a new `Uint8Array`. When running under Node.js, `Buffer` will be used in preference to `Uint8Array`.\n *\n * ### Example\n *\n * ```js\n * import { alloc } from 'uint8arrays/alloc'\n *\n * const buf = alloc(100)\n * ```\n *\n * ## allocUnsafe(size)\n *\n * Create a new `Uint8Array`. When running under Node.js, `Buffer` will be used in preference to `Uint8Array`.\n *\n * On platforms that support it, memory referenced by the returned `Uint8Array` will not be initialized.\n *\n * ### Example\n *\n * ```js\n * import { allocUnsafe } from 'uint8arrays/alloc'\n *\n * const buf = allocUnsafe(100)\n * ```\n *\n * ## compare(a, b)\n *\n * Compare two `Uint8Arrays`\n *\n * ### Example\n *\n * ```js\n * import { compare } from 'uint8arrays/compare'\n *\n * const arrays = [\n * Uint8Array.from([3, 4, 5]),\n * Uint8Array.from([0, 1, 2])\n * ]\n *\n * const sorted = arrays.sort(compare)\n *\n * console.info(sorted)\n * // [\n * // Uint8Array[0, 1, 2]\n * // Uint8Array[3, 4, 5]\n * // ]\n * ```\n *\n * ## concat(arrays, \\[length])\n *\n * Concatenate one or more `Uint8Array`s and return a `Uint8Array` with their contents.\n *\n * If you know the length of the arrays, pass it as a second parameter, otherwise it will be calculated by traversing the list of arrays.\n *\n * ### Example\n *\n * ```js\n * import { concat } from 'uint8arrays/concat'\n *\n * const arrays = [\n * Uint8Array.from([0, 1, 2]),\n * Uint8Array.from([3, 4, 5])\n * ]\n *\n * const all = concat(arrays, 6)\n *\n * console.info(all)\n * // Uint8Array[0, 1, 2, 3, 4, 5]\n * ```\n *\n * ## equals(a, b)\n *\n * Returns true if the two arrays are the same array or if they have the same length and contents.\n *\n * ### Example\n *\n * ```js\n * import { equals } from 'uint8arrays/equals'\n *\n * const a = Uint8Array.from([0, 1, 2])\n * const b = Uint8Array.from([3, 4, 5])\n * const c = Uint8Array.from([0, 1, 2])\n *\n * console.info(equals(a, b)) // false\n * console.info(equals(a, c)) // true\n * console.info(equals(a, a)) // true\n * ```\n *\n * ## fromString(string, encoding = 'utf8')\n *\n * Returns a new `Uint8Array` created from the passed string and interpreted as the passed encoding.\n *\n * Supports `utf8` and any of the [multibase encodings](https://github.com/multiformats/multibase/blob/master/multibase.csv) as implemented by the [multiformats module](https://www.npmjs.com/package/multiformats).\n *\n * ### Example\n *\n * ```js\n * import { fromString } from 'uint8arrays/from-string'\n *\n * console.info(fromString('hello world')) // Uint8Array[104, 101 ...\n * console.info(fromString('00010203aabbcc', 'base16')) // Uint8Array[0, 1 ...\n * console.info(fromString('AAECA6q7zA', 'base64')) // Uint8Array[0, 1 ...\n * console.info(fromString('01234', 'ascii')) // Uint8Array[48, 49 ...\n * ```\n *\n * ## toString(array, encoding = 'utf8')\n *\n * Returns a string created from the passed `Uint8Array` in the passed encoding.\n *\n * Supports `utf8` and any of the [multibase encodings](https://github.com/multiformats/multibase/blob/master/multibase.csv) as implemented by the [multiformats module](https://www.npmjs.com/package/multiformats).\n *\n * ### Example\n *\n * ```js\n * import { toString } from 'uint8arrays/to-string'\n *\n * console.info(toString(Uint8Array.from([104, 101...]))) // 'hello world'\n * console.info(toString(Uint8Array.from([0, 1, 2...]), 'base16')) // '00010203aabbcc'\n * console.info(toString(Uint8Array.from([0, 1, 2...]), 'base64')) // 'AAECA6q7zA'\n * console.info(toString(Uint8Array.from([48, 49, 50...]), 'ascii')) // '01234'\n * ```\n *\n * ## xor(a, b)\n *\n * Returns a `Uint8Array` containing `a` and `b` xored together.\n *\n * ### Example\n *\n * ```js\n * import { xor } from 'uint8arrays/xor'\n *\n * console.info(xor(Uint8Array.from([1, 0]), Uint8Array.from([0, 1]))) // Uint8Array[1, 1]\n * ```\n */\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/util/as-uint8array.js":
|
||
/*!********************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/util/as-uint8array.js ***!
|
||
\********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asUint8Array: () => (/* binding */ asUint8Array)\n/* harmony export */ });\n/**\n * To guarantee Uint8Array semantics, convert nodejs Buffers\n * into vanilla Uint8Arrays\n */\nfunction asUint8Array(buf) {\n return buf;\n}\n//# sourceMappingURL=as-uint8array.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/util/as-uint8array.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/xor.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/xor.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ xor: () => (/* binding */ xor)\n/* harmony export */ });\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #alloc */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #util/as-uint8array */ \"./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns the xor distance between two arrays\n */\nfunction xor(a, b) {\n if (a.length !== b.length) {\n throw new Error('Inputs should have the same length');\n }\n const result = (0,_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(a.length);\n for (let i = 0; i < a.length; i++) {\n result[i] = a[i] ^ b[i];\n }\n return (0,_util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(result);\n}\n//# sourceMappingURL=xor.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/mplex/node_modules/uint8arrays/dist/src/xor.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/multistream-select/dist/src/constants.js":
|
||
/*!***********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/multistream-select/dist/src/constants.js ***!
|
||
\***********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MAX_PROTOCOL_LENGTH: () => (/* binding */ MAX_PROTOCOL_LENGTH),\n/* harmony export */ PROTOCOL_ID: () => (/* binding */ PROTOCOL_ID)\n/* harmony export */ });\nconst PROTOCOL_ID = '/multistream/1.0.0';\n// Conforming to go-libp2p\n// See https://github.com/multiformats/go-multistream/blob/master/multistream.go#L297\nconst MAX_PROTOCOL_LENGTH = 1024;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/multistream-select/dist/src/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/multistream-select/dist/src/handle.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/multistream-select/dist/src/handle.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ handle: () => (/* binding */ handle)\n/* harmony export */ });\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed_stream__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-length-prefixed-stream */ \"./node_modules/it-length-prefixed-stream/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@libp2p/multistream-select/dist/src/constants.js\");\n/* harmony import */ var _multistream_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./multistream.js */ \"./node_modules/@libp2p/multistream-select/dist/src/multistream.js\");\n\n\n\n\n\n\n/**\n * Handle multistream protocol selections for the given list of protocols.\n *\n * Note that after a protocol is handled `listener` can no longer be used.\n *\n * @param stream - A duplex iterable stream to listen on\n * @param protocols - A list of protocols (or single protocol) that this listener is able to speak.\n * @param options - an options object containing an AbortSignal and an optional boolean `writeBytes` - if this is true, `Uint8Array`s will be written into `duplex`, otherwise `Uint8ArrayList`s will\n * @returns A stream for the selected protocol and the protocol that was selected from the list of protocols provided to `select`\n * @example\n *\n * ```TypeScript\n * import { pipe } from 'it-pipe'\n * import * as mss from '@libp2p/multistream-select'\n * import { Mplex } from '@libp2p/mplex'\n *\n * const muxer = new Mplex({\n * async onStream (muxedStream) {\n * // mss.handle(handledProtocols)\n * // Returns selected stream and protocol\n * const { stream, protocol } = await mss.handle(muxedStream, [\n * '/ipfs-dht/1.0.0',\n * '/ipfs-bitswap/1.0.0'\n * ])\n *\n * // Typically here we'd call the handler function that was registered in\n * // libp2p for the given protocol:\n * // e.g. handlers[protocol].handler(stream)\n * //\n * // If protocol was /ipfs-dht/1.0.0 it might do something like this:\n * // try {\n * // await pipe(\n * // dhtStream,\n * // source => (async function * () {\n * // for await (const chunk of source)\n * // // Incoming DHT data -> process and yield to respond\n * // })(),\n * // dhtStream\n * // )\n * // } catch (err) {\n * // // Error in stream\n * // }\n * }\n * })\n * ```\n */\nasync function handle(stream, protocols, options) {\n protocols = Array.isArray(protocols) ? protocols : [protocols];\n options.log.trace('handle: available protocols %s', protocols);\n const lp = (0,it_length_prefixed_stream__WEBPACK_IMPORTED_MODULE_1__.lpStream)(stream, {\n ...options,\n maxDataLength: _constants_js__WEBPACK_IMPORTED_MODULE_4__.MAX_PROTOCOL_LENGTH,\n maxLengthLength: 2 // 2 bytes is enough to length-prefix MAX_PROTOCOL_LENGTH\n });\n while (true) {\n options.log.trace('handle: reading incoming string');\n const protocol = await _multistream_js__WEBPACK_IMPORTED_MODULE_5__.readString(lp, options);\n options.log.trace('handle: read \"%s\"', protocol);\n if (protocol === _constants_js__WEBPACK_IMPORTED_MODULE_4__.PROTOCOL_ID) {\n options.log.trace('handle: respond with \"%s\" for \"%s\"', _constants_js__WEBPACK_IMPORTED_MODULE_4__.PROTOCOL_ID, protocol);\n await _multistream_js__WEBPACK_IMPORTED_MODULE_5__.write(lp, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(`${_constants_js__WEBPACK_IMPORTED_MODULE_4__.PROTOCOL_ID}\\n`), options);\n options.log.trace('handle: responded with \"%s\" for \"%s\"', _constants_js__WEBPACK_IMPORTED_MODULE_4__.PROTOCOL_ID, protocol);\n continue;\n }\n if (protocols.includes(protocol)) {\n options.log.trace('handle: respond with \"%s\" for \"%s\"', protocol, protocol);\n await _multistream_js__WEBPACK_IMPORTED_MODULE_5__.write(lp, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(`${protocol}\\n`), options);\n options.log.trace('handle: responded with \"%s\" for \"%s\"', protocol, protocol);\n return { stream: lp.unwrap(), protocol };\n }\n if (protocol === 'ls') {\n // <varint-msg-len><varint-proto-name-len><proto-name>\\n<varint-proto-name-len><proto-name>\\n\\n\n const protos = new uint8arraylist__WEBPACK_IMPORTED_MODULE_2__.Uint8ArrayList(...protocols.map(p => it_length_prefixed__WEBPACK_IMPORTED_MODULE_0__.encode.single((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(`${p}\\n`))), (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)('\\n'));\n options.log.trace('handle: respond with \"%s\" for %s', protocols, protocol);\n await _multistream_js__WEBPACK_IMPORTED_MODULE_5__.write(lp, protos, options);\n options.log.trace('handle: responded with \"%s\" for %s', protocols, protocol);\n continue;\n }\n options.log('handle: respond with \"na\" for \"%s\"', protocol);\n await _multistream_js__WEBPACK_IMPORTED_MODULE_5__.write(lp, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)('na\\n'), options);\n options.log('handle: responded with \"na\" for \"%s\"', protocol);\n }\n}\n//# sourceMappingURL=handle.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/multistream-select/dist/src/handle.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/multistream-select/dist/src/multistream.js":
|
||
/*!*************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/multistream-select/dist/src/multistream.js ***!
|
||
\*************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ read: () => (/* binding */ read),\n/* harmony export */ readString: () => (/* binding */ readString),\n/* harmony export */ write: () => (/* binding */ write),\n/* harmony export */ writeAll: () => (/* binding */ writeAll)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/to-string.js\");\n\n\n\n\nconst NewLine = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)('\\n');\n/**\n * `write` encodes and writes a single buffer\n */\nasync function write(writer, buffer, options) {\n await writer.write(buffer, options);\n}\n/**\n * `writeAll` behaves like `write`, except it encodes an array of items as a single write\n */\nasync function writeAll(writer, buffers, options) {\n await writer.writeV(buffers, options);\n}\n/**\n * Read a length-prefixed buffer from the passed stream, stripping the final newline character\n */\nasync function read(reader, options) {\n const buf = await reader.read(options);\n if (buf.byteLength === 0 || buf.get(buf.byteLength - 1) !== NewLine[0]) {\n options.log.error('Invalid mss message - missing newline', buf);\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('missing newline', 'ERR_INVALID_MULTISTREAM_SELECT_MESSAGE');\n }\n return buf.sublist(0, -1); // Remove newline\n}\n/**\n * Read a length-prefixed string from the passed stream, stripping the final newline character\n */\nasync function readString(reader, options) {\n const buf = await read(reader, options);\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(buf.subarray());\n}\n//# sourceMappingURL=multistream.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/multistream-select/dist/src/multistream.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/multistream-select/dist/src/select.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/multistream-select/dist/src/select.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ select: () => (/* binding */ select)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var it_length_prefixed_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-length-prefixed-stream */ \"./node_modules/it-length-prefixed-stream/dist/src/index.js\");\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/* harmony import */ var race_signal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! race-signal */ \"./node_modules/race-signal/dist/src/index.js\");\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./index.js */ \"./node_modules/@libp2p/multistream-select/dist/src/constants.js\");\n/* harmony import */ var _multistream_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./multistream.js */ \"./node_modules/@libp2p/multistream-select/dist/src/multistream.js\");\n\n\n\n\n\n\n\n\n\n\n/**\n * Negotiate a protocol to use from a list of protocols.\n *\n * @param stream - A duplex iterable stream to dial on\n * @param protocols - A list of protocols (or single protocol) to negotiate with. Protocols are attempted in order until a match is made.\n * @param options - An options object containing an AbortSignal and an optional boolean `writeBytes` - if this is true, `Uint8Array`s will be written into `duplex`, otherwise `Uint8ArrayList`s will\n * @returns A stream for the selected protocol and the protocol that was selected from the list of protocols provided to `select`.\n * @example\n *\n * ```TypeScript\n * import { pipe } from 'it-pipe'\n * import * as mss from '@libp2p/multistream-select'\n * import { Mplex } from '@libp2p/mplex'\n *\n * const muxer = new Mplex()\n * const muxedStream = muxer.newStream()\n *\n * // mss.select(protocol(s))\n * // Select from one of the passed protocols (in priority order)\n * // Returns selected stream and protocol\n * const { stream: dhtStream, protocol } = await mss.select(muxedStream, [\n * // This might just be different versions of DHT, but could be different impls\n * '/ipfs-dht/2.0.0', // Most of the time this will probably just be one item.\n * '/ipfs-dht/1.0.0'\n * ])\n *\n * // Typically this stream will be passed back to the caller of libp2p.dialProtocol\n * //\n * // ...it might then do something like this:\n * // try {\n * // await pipe(\n * // [uint8ArrayFromString('Some DHT data')]\n * // dhtStream,\n * // async source => {\n * // for await (const chunk of source)\n * // // DHT response data\n * // }\n * // )\n * // } catch (err) {\n * // // Error in stream\n * // }\n * ```\n */\nasync function select(stream, protocols, options) {\n protocols = Array.isArray(protocols) ? [...protocols] : [protocols];\n if (protocols.length === 1 && options.negotiateFully === false) {\n return optimisticSelect(stream, protocols[0], options);\n }\n const lp = (0,it_length_prefixed_stream__WEBPACK_IMPORTED_MODULE_0__.lpStream)(stream, {\n ...options,\n maxDataLength: _constants_js__WEBPACK_IMPORTED_MODULE_5__.MAX_PROTOCOL_LENGTH\n });\n const protocol = protocols.shift();\n if (protocol == null) {\n throw new Error('At least one protocol must be specified');\n }\n options.log.trace('select: write [\"%s\", \"%s\"]', _constants_js__WEBPACK_IMPORTED_MODULE_5__.PROTOCOL_ID, protocol);\n const p1 = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(`${_constants_js__WEBPACK_IMPORTED_MODULE_5__.PROTOCOL_ID}\\n`);\n const p2 = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(`${protocol}\\n`);\n await _multistream_js__WEBPACK_IMPORTED_MODULE_6__.writeAll(lp, [p1, p2], options);\n options.log.trace('select: reading multistream-select header');\n let response = await _multistream_js__WEBPACK_IMPORTED_MODULE_6__.readString(lp, options);\n options.log.trace('select: read \"%s\"', response);\n // Read the protocol response if we got the protocolId in return\n if (response === _constants_js__WEBPACK_IMPORTED_MODULE_5__.PROTOCOL_ID) {\n options.log.trace('select: reading protocol response');\n response = await _multistream_js__WEBPACK_IMPORTED_MODULE_6__.readString(lp, options);\n options.log.trace('select: read \"%s\"', response);\n }\n // We're done\n if (response === protocol) {\n return { stream: lp.unwrap(), protocol };\n }\n // We haven't gotten a valid ack, try the other protocols\n for (const protocol of protocols) {\n options.log.trace('select: write \"%s\"', protocol);\n await _multistream_js__WEBPACK_IMPORTED_MODULE_6__.write(lp, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(`${protocol}\\n`), options);\n options.log.trace('select: reading protocol response');\n const response = await _multistream_js__WEBPACK_IMPORTED_MODULE_6__.readString(lp, options);\n options.log.trace('select: read \"%s\" for \"%s\"', response, protocol);\n if (response === protocol) {\n return { stream: lp.unwrap(), protocol };\n }\n }\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__.CodeError('protocol selection failed', 'ERR_UNSUPPORTED_PROTOCOL');\n}\n/**\n * Optimistically negotiates a protocol.\n *\n * It *does not* block writes waiting for the other end to respond. Instead, it\n * simply assumes the negotiation went successfully and starts writing data.\n *\n * Use when it is known that the receiver supports the desired protocol.\n */\nfunction optimisticSelect(stream, protocol, options) {\n const originalSink = stream.sink.bind(stream);\n const originalSource = stream.source;\n let negotiated = false;\n let negotiating = false;\n const doneNegotiating = (0,p_defer__WEBPACK_IMPORTED_MODULE_8__[\"default\"])();\n let sentProtocol = false;\n let sendingProtocol = false;\n const doneSendingProtocol = (0,p_defer__WEBPACK_IMPORTED_MODULE_8__[\"default\"])();\n let readProtocol = false;\n let readingProtocol = false;\n const doneReadingProtocol = (0,p_defer__WEBPACK_IMPORTED_MODULE_8__[\"default\"])();\n const lp = (0,it_length_prefixed_stream__WEBPACK_IMPORTED_MODULE_0__.lpStream)({\n sink: originalSink,\n source: originalSource\n }, {\n ...options,\n maxDataLength: _constants_js__WEBPACK_IMPORTED_MODULE_5__.MAX_PROTOCOL_LENGTH\n });\n stream.sink = async (source) => {\n const { sink } = lp.unwrap();\n await sink(async function* () {\n let sentData = false;\n for await (const buf of source) {\n // started reading before the source yielded, wait for protocol send\n if (sendingProtocol) {\n await doneSendingProtocol.promise;\n }\n // writing before reading, send the protocol and the first chunk of data\n if (!sentProtocol) {\n sendingProtocol = true;\n options.log.trace('optimistic: write [\"%s\", \"%s\", data(%d)] in sink', _constants_js__WEBPACK_IMPORTED_MODULE_5__.PROTOCOL_ID, protocol, buf.byteLength);\n const protocolString = `${protocol}\\n`;\n // send protocols in first chunk of data written to transport\n yield new uint8arraylist__WEBPACK_IMPORTED_MODULE_3__.Uint8ArrayList(Uint8Array.from([19]), // length of PROTOCOL_ID plus newline\n (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(`${_constants_js__WEBPACK_IMPORTED_MODULE_5__.PROTOCOL_ID}\\n`), uint8_varint__WEBPACK_IMPORTED_MODULE_2__.encode(protocolString.length), (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(protocolString), buf).subarray();\n options.log.trace('optimistic: wrote [\"%s\", \"%s\", data(%d)] in sink', _constants_js__WEBPACK_IMPORTED_MODULE_5__.PROTOCOL_ID, protocol, buf.byteLength);\n sentProtocol = true;\n sendingProtocol = false;\n doneSendingProtocol.resolve();\n // read the negotiation response but don't block more sending\n negotiate()\n .catch(err => {\n options.log.error('could not finish optimistic protocol negotiation of %s', protocol, err);\n });\n }\n else {\n yield buf;\n }\n sentData = true;\n }\n // special case - the source passed to the sink has ended but we didn't\n // negotiated the protocol yet so do it now\n if (!sentData) {\n await negotiate();\n }\n }());\n };\n async function negotiate() {\n if (negotiating) {\n options.log.trace('optimistic: already negotiating %s stream', protocol);\n await doneNegotiating.promise;\n return;\n }\n negotiating = true;\n try {\n // we haven't sent the protocol yet, send it now\n if (!sentProtocol) {\n options.log.trace('optimistic: doing send protocol for %s stream', protocol);\n await doSendProtocol();\n }\n // if we haven't read the protocol response yet, do it now\n if (!readProtocol) {\n options.log.trace('optimistic: doing read protocol for %s stream', protocol);\n await doReadProtocol();\n }\n }\n finally {\n negotiating = false;\n negotiated = true;\n doneNegotiating.resolve();\n }\n }\n async function doSendProtocol() {\n if (sendingProtocol) {\n await doneSendingProtocol.promise;\n return;\n }\n sendingProtocol = true;\n try {\n options.log.trace('optimistic: write [\"%s\", \"%s\", data] in source', _constants_js__WEBPACK_IMPORTED_MODULE_5__.PROTOCOL_ID, protocol);\n await lp.writeV([\n (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(`${_constants_js__WEBPACK_IMPORTED_MODULE_5__.PROTOCOL_ID}\\n`),\n (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(`${protocol}\\n`)\n ]);\n options.log.trace('optimistic: wrote [\"%s\", \"%s\", data] in source', _constants_js__WEBPACK_IMPORTED_MODULE_5__.PROTOCOL_ID, protocol);\n }\n finally {\n sentProtocol = true;\n sendingProtocol = false;\n doneSendingProtocol.resolve();\n }\n }\n async function doReadProtocol() {\n if (readingProtocol) {\n await doneReadingProtocol.promise;\n return;\n }\n readingProtocol = true;\n try {\n options.log.trace('optimistic: reading multistream select header');\n let response = await _multistream_js__WEBPACK_IMPORTED_MODULE_6__.readString(lp, options);\n options.log.trace('optimistic: read multistream select header \"%s\"', response);\n if (response === _constants_js__WEBPACK_IMPORTED_MODULE_5__.PROTOCOL_ID) {\n response = await _multistream_js__WEBPACK_IMPORTED_MODULE_6__.readString(lp, options);\n }\n options.log.trace('optimistic: read protocol \"%s\", expecting \"%s\"', response, protocol);\n if (response !== protocol) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__.CodeError('protocol selection failed', 'ERR_UNSUPPORTED_PROTOCOL');\n }\n }\n finally {\n readProtocol = true;\n readingProtocol = false;\n doneReadingProtocol.resolve();\n }\n }\n stream.source = (async function* () {\n // make sure we've done protocol negotiation before we read stream data\n await negotiate();\n options.log.trace('optimistic: reading data from \"%s\" stream', protocol);\n yield* lp.unwrap().source;\n })();\n if (stream.closeRead != null) {\n const originalCloseRead = stream.closeRead.bind(stream);\n stream.closeRead = async (opts) => {\n // we need to read & write to negotiate the protocol so ensure we've done\n // this before closing the readable end of the stream\n if (!negotiated) {\n await negotiate().catch(err => {\n options.log.error('could not negotiate protocol before close read', err);\n });\n }\n // protocol has been negotiated, ok to close the readable end\n await originalCloseRead(opts);\n };\n }\n if (stream.closeWrite != null) {\n const originalCloseWrite = stream.closeWrite.bind(stream);\n stream.closeWrite = async (opts) => {\n // we need to read & write to negotiate the protocol so ensure we've done\n // this before closing the writable end of the stream\n if (!negotiated) {\n await negotiate().catch(err => {\n options.log.error('could not negotiate protocol before close write', err);\n });\n }\n // protocol has been negotiated, ok to close the writable end\n await originalCloseWrite(opts);\n };\n }\n if (stream.close != null) {\n const originalClose = stream.close.bind(stream);\n stream.close = async (opts) => {\n // if we are in the process of negotiation, let it finish before closing\n // because we may have unsent early data\n const tasks = [];\n if (sendingProtocol) {\n tasks.push(doneSendingProtocol.promise);\n }\n if (readingProtocol) {\n tasks.push(doneReadingProtocol.promise);\n }\n if (tasks.length > 0) {\n // let the in-flight protocol negotiation finish gracefully\n await (0,race_signal__WEBPACK_IMPORTED_MODULE_1__.raceSignal)(Promise.all(tasks), opts?.signal);\n }\n else {\n // no protocol negotiation attempt has occurred so don't start one\n negotiated = true;\n negotiating = false;\n doneNegotiating.resolve();\n }\n // protocol has been negotiated, ok to close the writable end\n await originalClose(opts);\n };\n }\n return {\n stream,\n protocol\n };\n}\n//# sourceMappingURL=select.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/multistream-select/dist/src/select.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!********************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!**************************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\**************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!************************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!*************************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\*************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/multistream-select/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-collections/dist/src/map.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-collections/dist/src/map.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerMap: () => (/* binding */ PeerMap),\n/* harmony export */ peerMap: () => (/* binding */ peerMap)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@libp2p/peer-collections/dist/src/util.js\");\n\n\n/**\n * We can't use PeerIds as map keys because map keys are\n * compared using same-value-zero equality, so this is just\n * a map that stringifies the PeerIds before storing them.\n *\n * PeerIds cache stringified versions of themselves so this\n * should be a cheap operation.\n *\n * @example\n *\n * ```TypeScript\n * import { peerMap } from '@libp2p/peer-collections'\n *\n * const map = peerMap<string>()\n * map.set(peerId, 'value')\n * ```\n */\nclass PeerMap {\n map;\n constructor(map) {\n this.map = new Map();\n if (map != null) {\n for (const [key, value] of map.entries()) {\n this.map.set(key.toString(), value);\n }\n }\n }\n [Symbol.iterator]() {\n return this.entries();\n }\n clear() {\n this.map.clear();\n }\n delete(peer) {\n return this.map.delete(peer.toString());\n }\n entries() {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_0__.mapIterable)(this.map.entries(), (val) => {\n return [(0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(val[0]), val[1]];\n });\n }\n forEach(fn) {\n this.map.forEach((value, key) => {\n fn(value, (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(key), this);\n });\n }\n get(peer) {\n return this.map.get(peer.toString());\n }\n has(peer) {\n return this.map.has(peer.toString());\n }\n set(peer, value) {\n this.map.set(peer.toString(), value);\n }\n keys() {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_0__.mapIterable)(this.map.keys(), (val) => {\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(val);\n });\n }\n values() {\n return this.map.values();\n }\n get size() {\n return this.map.size;\n }\n}\nfunction peerMap() {\n return new PeerMap();\n}\n//# sourceMappingURL=map.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-collections/dist/src/map.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-collections/dist/src/set.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-collections/dist/src/set.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerSet: () => (/* binding */ PeerSet),\n/* harmony export */ peerSet: () => (/* binding */ peerSet)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@libp2p/peer-collections/dist/src/util.js\");\n\n\n/**\n * We can't use PeerIds as set entries because set entries are\n * compared using same-value-zero equality, so this is just\n * a map that stringifies the PeerIds before storing them.\n *\n * PeerIds cache stringified versions of themselves so this\n * should be a cheap operation.\n *\n * @example\n *\n * ```TypeScript\n * import { peerSet } from '@libp2p/peer-collections'\n *\n * const set = peerSet()\n * set.add(peerId)\n * ```\n */\nclass PeerSet {\n set;\n constructor(set) {\n this.set = new Set();\n if (set != null) {\n for (const key of set) {\n this.set.add(key.toString());\n }\n }\n }\n get size() {\n return this.set.size;\n }\n [Symbol.iterator]() {\n return this.values();\n }\n add(peer) {\n this.set.add(peer.toString());\n }\n clear() {\n this.set.clear();\n }\n delete(peer) {\n this.set.delete(peer.toString());\n }\n entries() {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_0__.mapIterable)(this.set.entries(), (val) => {\n const peerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(val[0]);\n return [peerId, peerId];\n });\n }\n forEach(predicate) {\n this.set.forEach((str) => {\n const id = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(str);\n predicate(id, id, this);\n });\n }\n has(peer) {\n return this.set.has(peer.toString());\n }\n values() {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_0__.mapIterable)(this.set.values(), (val) => {\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(val);\n });\n }\n intersection(other) {\n const output = new PeerSet();\n for (const peerId of other) {\n if (this.has(peerId)) {\n output.add(peerId);\n }\n }\n return output;\n }\n difference(other) {\n const output = new PeerSet();\n for (const peerId of this) {\n if (!other.has(peerId)) {\n output.add(peerId);\n }\n }\n return output;\n }\n union(other) {\n const output = new PeerSet();\n for (const peerId of other) {\n output.add(peerId);\n }\n for (const peerId of this) {\n output.add(peerId);\n }\n return output;\n }\n}\nfunction peerSet() {\n return new PeerSet();\n}\n//# sourceMappingURL=set.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-collections/dist/src/set.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-collections/dist/src/util.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-collections/dist/src/util.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ mapIterable: () => (/* binding */ mapIterable)\n/* harmony export */ });\n/**\n * Calls the passed map function on every entry of the passed iterable iterator\n */\nfunction mapIterable(iter, map) {\n const iterator = {\n [Symbol.iterator]: () => {\n return iterator;\n },\n next: () => {\n const next = iter.next();\n const val = next.value;\n if (next.done === true || val == null) {\n const result = {\n done: true,\n value: undefined\n };\n return result;\n }\n return {\n done: false,\n value: map(val)\n };\n }\n };\n return iterator;\n}\n//# sourceMappingURL=util.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-collections/dist/src/util.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-id-factory/dist/src/index.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-id-factory/dist/src/index.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createEd25519PeerId: () => (/* binding */ createEd25519PeerId),\n/* harmony export */ createFromJSON: () => (/* binding */ createFromJSON),\n/* harmony export */ createFromPrivKey: () => (/* binding */ createFromPrivKey),\n/* harmony export */ createFromProtobuf: () => (/* binding */ createFromProtobuf),\n/* harmony export */ createFromPubKey: () => (/* binding */ createFromPubKey),\n/* harmony export */ createRSAPeerId: () => (/* binding */ createRSAPeerId),\n/* harmony export */ createSecp256k1PeerId: () => (/* binding */ createSecp256k1PeerId),\n/* harmony export */ exportToProtobuf: () => (/* binding */ exportToProtobuf)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _proto_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./proto.js */ \"./node_modules/@libp2p/peer-id-factory/dist/src/proto.js\");\n/**\n * @packageDocumentation\n *\n * Generate, import, and export PeerIDs.\n *\n * A Peer ID is the SHA-256 [multihash](https://github.com/multiformats/multihash) of a public key.\n *\n * The public key is a base64 encoded string of a protobuf containing an RSA DER buffer. This uses a node buffer to pass the base64 encoded public key protobuf to the multihash for ID generation.\n *\n * @example\n *\n * ```TypeScript\n * import { createEd25519PeerId } from '@libp2p/peer-id-factory'\n *\n * const peerId = await createEd25519PeerId()\n * console.log(peerId.toString())\n * ```\n *\n * ```bash\n * 12D3KooWRm8J3iL796zPFi2EtGGtUJn58AG67gcqzMFHZnnsTzqD\n * ```\n */\n\n\n\n\nconst createEd25519PeerId = async () => {\n const key = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.generateKeyPair)('Ed25519');\n const id = await createFromPrivKey(key);\n if (id.type === 'Ed25519') {\n return id;\n }\n throw new Error(`Generated unexpected PeerId type \"${id.type}\"`);\n};\nconst createSecp256k1PeerId = async () => {\n const key = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.generateKeyPair)('secp256k1');\n const id = await createFromPrivKey(key);\n if (id.type === 'secp256k1') {\n return id;\n }\n throw new Error(`Generated unexpected PeerId type \"${id.type}\"`);\n};\nconst createRSAPeerId = async (opts) => {\n const key = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.generateKeyPair)('RSA', opts?.bits ?? 2048);\n const id = await createFromPrivKey(key);\n if (id.type === 'RSA') {\n return id;\n }\n throw new Error(`Generated unexpected PeerId type \"${id.type}\"`);\n};\nasync function createFromPubKey(publicKey) {\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromKeys)((0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.marshalPublicKey)(publicKey));\n}\nasync function createFromPrivKey(privateKey) {\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromKeys)((0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.marshalPublicKey)(privateKey.public), (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.marshalPrivateKey)(privateKey));\n}\nfunction exportToProtobuf(peerId, excludePrivateKey) {\n return _proto_js__WEBPACK_IMPORTED_MODULE_3__.PeerIdProto.encode({\n id: peerId.multihash.bytes,\n pubKey: peerId.publicKey,\n privKey: excludePrivateKey === true || peerId.privateKey == null ? undefined : peerId.privateKey\n });\n}\nasync function createFromProtobuf(buf) {\n const { id, privKey, pubKey } = _proto_js__WEBPACK_IMPORTED_MODULE_3__.PeerIdProto.decode(buf);\n return createFromParts(id ?? new Uint8Array(0), privKey, pubKey);\n}\nasync function createFromJSON(obj) {\n return createFromParts((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(obj.id, 'base58btc'), obj.privKey != null ? (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(obj.privKey, 'base64pad') : undefined, obj.pubKey != null ? (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(obj.pubKey, 'base64pad') : undefined);\n}\nasync function createFromParts(multihash, privKey, pubKey) {\n if (privKey != null) {\n const key = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.unmarshalPrivateKey)(privKey);\n return createFromPrivKey(key);\n }\n else if (pubKey != null) {\n const key = (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.unmarshalPublicKey)(pubKey);\n return createFromPubKey(key);\n }\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromBytes)(multihash);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-id-factory/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-id-factory/dist/src/proto.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-id-factory/dist/src/proto.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerIdProto: () => (/* binding */ PeerIdProto)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar PeerIdProto;\n(function (PeerIdProto) {\n let _codec;\n PeerIdProto.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.id != null) {\n w.uint32(10);\n w.bytes(obj.id);\n }\n if (obj.pubKey != null) {\n w.uint32(18);\n w.bytes(obj.pubKey);\n }\n if (obj.privKey != null) {\n w.uint32(26);\n w.bytes(obj.privKey);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.id = reader.bytes();\n break;\n case 2:\n obj.pubKey = reader.bytes();\n break;\n case 3:\n obj.privKey = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerIdProto.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerIdProto.codec());\n };\n PeerIdProto.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerIdProto.codec());\n };\n})(PeerIdProto || (PeerIdProto = {}));\n//# sourceMappingURL=proto.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-id-factory/dist/src/proto.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!***********************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\***********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!**********************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\**********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-id-factory/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-id/dist/src/index.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-id/dist/src/index.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createPeerId: () => (/* binding */ createPeerId),\n/* harmony export */ peerIdFromBytes: () => (/* binding */ peerIdFromBytes),\n/* harmony export */ peerIdFromCID: () => (/* binding */ peerIdFromCID),\n/* harmony export */ peerIdFromKeys: () => (/* binding */ peerIdFromKeys),\n/* harmony export */ peerIdFromPeerId: () => (/* binding */ peerIdFromPeerId),\n/* harmony export */ peerIdFromString: () => (/* binding */ peerIdFromString)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/peer-id/index.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/dist/src/bases/base58.js\");\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var multiformats_cid__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/cid */ \"./node_modules/multiformats/dist/src/cid.js\");\n/* harmony import */ var multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multiformats/hashes/digest */ \"./node_modules/multiformats/dist/src/hashes/digest.js\");\n/* harmony import */ var multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! multiformats/hashes/identity */ \"./node_modules/multiformats/dist/src/hashes/identity.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@libp2p/peer-id/node_modules/uint8arrays/dist/src/equals.js\");\n/**\n * @packageDocumentation\n *\n * An implementation of a peer id\n *\n * @example\n *\n * ```TypeScript\n * import { peerIdFromString } from '@libp2p/peer-id'\n * const peer = peerIdFromString('k51qzi5uqu5dkwkqm42v9j9kqcam2jiuvloi16g72i4i4amoo2m8u3ol3mqu6s')\n *\n * console.log(peer.toCID()) // CID(bafzaa...)\n * console.log(peer.toString()) // \"12D3K...\"\n * ```\n */\n\n\n\n\n\n\n\n\n\nconst inspect = Symbol.for('nodejs.util.inspect.custom');\nconst baseDecoder = Object\n .values(multiformats_basics__WEBPACK_IMPORTED_MODULE_1__.bases)\n .map(codec => codec.decoder)\n // @ts-expect-error https://github.com/multiformats/js-multiformats/issues/141\n .reduce((acc, curr) => acc.or(curr), multiformats_basics__WEBPACK_IMPORTED_MODULE_1__.bases.identity.decoder);\n// these values are from https://github.com/multiformats/multicodec/blob/master/table.csv\nconst LIBP2P_KEY_CODE = 0x72;\nconst MARSHALLED_ED225519_PUBLIC_KEY_LENGTH = 36;\nconst MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH = 37;\nclass PeerIdImpl {\n type;\n multihash;\n privateKey;\n publicKey;\n string;\n constructor(init) {\n this.type = init.type;\n this.multihash = init.multihash;\n this.privateKey = init.privateKey;\n // mark string cache as non-enumerable\n Object.defineProperty(this, 'string', {\n enumerable: false,\n writable: true\n });\n }\n get [Symbol.toStringTag]() {\n return `PeerId(${this.toString()})`;\n }\n [_libp2p_interface__WEBPACK_IMPORTED_MODULE_7__.peerIdSymbol] = true;\n toString() {\n if (this.string == null) {\n this.string = multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_0__.base58btc.encode(this.multihash.bytes).slice(1);\n }\n return this.string;\n }\n // return self-describing String representation\n // in default format from RFC 0001: https://github.com/libp2p/specs/pull/209\n toCID() {\n return multiformats_cid__WEBPACK_IMPORTED_MODULE_2__.CID.createV1(LIBP2P_KEY_CODE, this.multihash);\n }\n toBytes() {\n return this.multihash.bytes;\n }\n /**\n * Returns Multiaddr as a JSON string\n */\n toJSON() {\n return this.toString();\n }\n /**\n * Checks the equality of `this` peer against a given PeerId\n */\n equals(id) {\n if (id == null) {\n return false;\n }\n if (id instanceof Uint8Array) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_6__.equals)(this.multihash.bytes, id);\n }\n else if (typeof id === 'string') {\n return peerIdFromString(id).equals(this);\n }\n else if (id?.multihash?.bytes != null) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_6__.equals)(this.multihash.bytes, id.multihash.bytes);\n }\n else {\n throw new Error('not valid Id');\n }\n }\n /**\n * Returns PeerId as a human-readable string\n * https://nodejs.org/api/util.html#utilinspectcustom\n *\n * @example\n * ```TypeScript\n * import { peerIdFromString } from '@libp2p/peer-id'\n *\n * console.info(peerIdFromString('QmFoo'))\n * // 'PeerId(QmFoo)'\n * ```\n */\n [inspect]() {\n return `PeerId(${this.toString()})`;\n }\n}\nclass RSAPeerIdImpl extends PeerIdImpl {\n type = 'RSA';\n publicKey;\n constructor(init) {\n super({ ...init, type: 'RSA' });\n this.publicKey = init.publicKey;\n }\n}\nclass Ed25519PeerIdImpl extends PeerIdImpl {\n type = 'Ed25519';\n publicKey;\n constructor(init) {\n super({ ...init, type: 'Ed25519' });\n this.publicKey = init.multihash.digest;\n }\n}\nclass Secp256k1PeerIdImpl extends PeerIdImpl {\n type = 'secp256k1';\n publicKey;\n constructor(init) {\n super({ ...init, type: 'secp256k1' });\n this.publicKey = init.multihash.digest;\n }\n}\nfunction createPeerId(init) {\n if (init.type === 'RSA') {\n return new RSAPeerIdImpl(init);\n }\n if (init.type === 'Ed25519') {\n return new Ed25519PeerIdImpl(init);\n }\n if (init.type === 'secp256k1') {\n return new Secp256k1PeerIdImpl(init);\n }\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError('Type must be \"RSA\", \"Ed25519\" or \"secp256k1\"', 'ERR_INVALID_PARAMETERS');\n}\nfunction peerIdFromPeerId(other) {\n if (other.type === 'RSA') {\n return new RSAPeerIdImpl(other);\n }\n if (other.type === 'Ed25519') {\n return new Ed25519PeerIdImpl(other);\n }\n if (other.type === 'secp256k1') {\n return new Secp256k1PeerIdImpl(other);\n }\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_8__.CodeError('Not a PeerId', 'ERR_INVALID_PARAMETERS');\n}\nfunction peerIdFromString(str, decoder) {\n decoder = decoder ?? baseDecoder;\n if (str.charAt(0) === '1' || str.charAt(0) === 'Q') {\n // identity hash ed25519/secp256k1 key or sha2-256 hash of\n // rsa public key - base58btc encoded either way\n const multihash = multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_3__.decode(multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_0__.base58btc.decode(`z${str}`));\n if (str.startsWith('12D')) {\n return new Ed25519PeerIdImpl({ multihash });\n }\n else if (str.startsWith('16U')) {\n return new Secp256k1PeerIdImpl({ multihash });\n }\n else {\n return new RSAPeerIdImpl({ multihash });\n }\n }\n return peerIdFromBytes(baseDecoder.decode(str));\n}\nfunction peerIdFromBytes(buf) {\n try {\n const multihash = multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_3__.decode(buf);\n if (multihash.code === multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_4__.identity.code) {\n if (multihash.digest.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {\n return new Ed25519PeerIdImpl({ multihash });\n }\n else if (multihash.digest.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {\n return new Secp256k1PeerIdImpl({ multihash });\n }\n }\n if (multihash.code === multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_5__.sha256.code) {\n return new RSAPeerIdImpl({ multihash });\n }\n }\n catch {\n return peerIdFromCID(multiformats_cid__WEBPACK_IMPORTED_MODULE_2__.CID.decode(buf));\n }\n throw new Error('Supplied PeerID CID is invalid');\n}\nfunction peerIdFromCID(cid) {\n if (cid == null || cid.multihash == null || cid.version == null || (cid.version === 1 && cid.code !== LIBP2P_KEY_CODE)) {\n throw new Error('Supplied PeerID CID is invalid');\n }\n const multihash = cid.multihash;\n if (multihash.code === multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_5__.sha256.code) {\n return new RSAPeerIdImpl({ multihash: cid.multihash });\n }\n else if (multihash.code === multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_4__.identity.code) {\n if (multihash.digest.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {\n return new Ed25519PeerIdImpl({ multihash: cid.multihash });\n }\n else if (multihash.digest.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {\n return new Secp256k1PeerIdImpl({ multihash: cid.multihash });\n }\n }\n throw new Error('Supplied PeerID CID is invalid');\n}\n/**\n * @param publicKey - A marshalled public key\n * @param privateKey - A marshalled private key\n */\nasync function peerIdFromKeys(publicKey, privateKey) {\n if (publicKey.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {\n return new Ed25519PeerIdImpl({ multihash: multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_3__.create(multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_4__.identity.code, publicKey), privateKey });\n }\n if (publicKey.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {\n return new Secp256k1PeerIdImpl({ multihash: multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_3__.create(multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_4__.identity.code, publicKey), privateKey });\n }\n return new RSAPeerIdImpl({ multihash: await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_5__.sha256.digest(publicKey), publicKey, privateKey });\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-id/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-id/node_modules/uint8arrays/dist/src/equals.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-id/node_modules/uint8arrays/dist/src/equals.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-id/node_modules/uint8arrays/dist/src/equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-record/dist/src/envelope/envelope.js":
|
||
/*!************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-record/dist/src/envelope/envelope.js ***!
|
||
\************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Envelope: () => (/* binding */ Envelope)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar Envelope;\n(function (Envelope) {\n let _codec;\n Envelope.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.publicKey != null && obj.publicKey.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.publicKey);\n }\n if ((obj.payloadType != null && obj.payloadType.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.payloadType);\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.payload);\n }\n if ((obj.signature != null && obj.signature.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.signature);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n publicKey: new Uint8Array(0),\n payloadType: new Uint8Array(0),\n payload: new Uint8Array(0),\n signature: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.publicKey = reader.bytes();\n break;\n case 2:\n obj.payloadType = reader.bytes();\n break;\n case 3:\n obj.payload = reader.bytes();\n break;\n case 5:\n obj.signature = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Envelope.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Envelope.codec());\n };\n Envelope.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Envelope.codec());\n };\n})(Envelope || (Envelope = {}));\n//# sourceMappingURL=envelope.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-record/dist/src/envelope/envelope.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-record/dist/src/envelope/index.js":
|
||
/*!*********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-record/dist/src/envelope/index.js ***!
|
||
\*********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RecordEnvelope: () => (/* binding */ RecordEnvelope)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/@libp2p/peer-record/dist/src/errors.js\");\n/* harmony import */ var _envelope_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./envelope.js */ \"./node_modules/@libp2p/peer-record/dist/src/envelope/envelope.js\");\n\n\n\n\n\n\n\n\n\nclass RecordEnvelope {\n /**\n * Unmarshal a serialized Envelope protobuf message\n */\n static createFromProtobuf = async (data) => {\n const envelopeData = _envelope_js__WEBPACK_IMPORTED_MODULE_4__.Envelope.decode(data);\n const peerId = await (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_5__.peerIdFromKeys)(envelopeData.publicKey);\n return new RecordEnvelope({\n peerId,\n payloadType: envelopeData.payloadType,\n payload: envelopeData.payload,\n signature: envelopeData.signature\n });\n };\n /**\n * Seal marshals the given Record, places the marshaled bytes inside an Envelope\n * and signs it with the given peerId's private key\n */\n static seal = async (record, peerId) => {\n if (peerId.privateKey == null) {\n throw new Error('Missing private key');\n }\n const domain = record.domain;\n const payloadType = record.codec;\n const payload = record.marshal();\n const signData = formatSignaturePayload(domain, payloadType, payload);\n const key = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_6__.unmarshalPrivateKey)(peerId.privateKey);\n const signature = await key.sign(signData.subarray());\n return new RecordEnvelope({\n peerId,\n payloadType,\n payload,\n signature\n });\n };\n /**\n * Open and certify a given marshalled envelope.\n * Data is unmarshalled and the signature validated for the given domain.\n */\n static openAndCertify = async (data, domain) => {\n const envelope = await RecordEnvelope.createFromProtobuf(data);\n const valid = await envelope.validate(domain);\n if (!valid) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__.CodeError('envelope signature is not valid for the given domain', _errors_js__WEBPACK_IMPORTED_MODULE_8__.codes.ERR_SIGNATURE_NOT_VALID);\n }\n return envelope;\n };\n peerId;\n payloadType;\n payload;\n signature;\n marshaled;\n /**\n * The Envelope is responsible for keeping an arbitrary signed record\n * by a libp2p peer.\n */\n constructor(init) {\n const { peerId, payloadType, payload, signature } = init;\n this.peerId = peerId;\n this.payloadType = payloadType;\n this.payload = payload;\n this.signature = signature;\n }\n /**\n * Marshal the envelope content\n */\n marshal() {\n if (this.peerId.publicKey == null) {\n throw new Error('Missing public key');\n }\n if (this.marshaled == null) {\n this.marshaled = _envelope_js__WEBPACK_IMPORTED_MODULE_4__.Envelope.encode({\n publicKey: this.peerId.publicKey,\n payloadType: this.payloadType,\n payload: this.payload.subarray(),\n signature: this.signature\n });\n }\n return this.marshaled;\n }\n /**\n * Verifies if the other Envelope is identical to this one\n */\n equals(other) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.marshal(), other.marshal());\n }\n /**\n * Validate envelope data signature for the given domain\n */\n async validate(domain) {\n const signData = formatSignaturePayload(domain, this.payloadType, this.payload);\n if (this.peerId.publicKey == null) {\n throw new Error('Missing public key');\n }\n const key = (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_6__.unmarshalPublicKey)(this.peerId.publicKey);\n return key.verify(signData.subarray(), this.signature);\n }\n}\n/**\n * Helper function that prepares a Uint8Array to sign or verify a signature\n */\nconst formatSignaturePayload = (domain, payloadType, payload) => {\n // When signing, a peer will prepare a Uint8Array by concatenating the following:\n // - The length of the domain separation string string in bytes\n // - The domain separation string, encoded as UTF-8\n // - The length of the payload_type field in bytes\n // - The value of the payload_type field\n // - The length of the payload field in bytes\n // - The value of the payload field\n const domainUint8Array = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(domain);\n const domainLength = uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encode(domainUint8Array.byteLength);\n const payloadTypeLength = uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encode(payloadType.length);\n const payloadLength = uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encode(payload.length);\n return new uint8arraylist__WEBPACK_IMPORTED_MODULE_1__.Uint8ArrayList(domainLength, domainUint8Array, payloadTypeLength, payloadType, payloadLength, payload);\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-record/dist/src/envelope/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-record/dist/src/errors.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-record/dist/src/errors.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes)\n/* harmony export */ });\nconst codes = {\n ERR_SIGNATURE_NOT_VALID: 'ERR_SIGNATURE_NOT_VALID'\n};\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-record/dist/src/errors.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-record/dist/src/peer-record/consts.js":
|
||
/*!*************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-record/dist/src/peer-record/consts.js ***!
|
||
\*************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENVELOPE_DOMAIN_PEER_RECORD: () => (/* binding */ ENVELOPE_DOMAIN_PEER_RECORD),\n/* harmony export */ ENVELOPE_PAYLOAD_TYPE_PEER_RECORD: () => (/* binding */ ENVELOPE_PAYLOAD_TYPE_PEER_RECORD)\n/* harmony export */ });\n// The domain string used for peer records contained in a Envelope.\nconst ENVELOPE_DOMAIN_PEER_RECORD = 'libp2p-peer-record';\n// The type hint used to identify peer records in a Envelope.\n// Defined in https://github.com/multiformats/multicodec/blob/master/table.csv\n// with name \"libp2p-peer-record\"\nconst ENVELOPE_PAYLOAD_TYPE_PEER_RECORD = Uint8Array.from([3, 1]);\n//# sourceMappingURL=consts.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-record/dist/src/peer-record/consts.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-record/dist/src/peer-record/index.js":
|
||
/*!************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-record/dist/src/peer-record/index.js ***!
|
||
\************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerRecord: () => (/* binding */ PeerRecord)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_utils_array_equals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/utils/array-equals */ \"./node_modules/@libp2p/utils/dist/src/array-equals.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./consts.js */ \"./node_modules/@libp2p/peer-record/dist/src/peer-record/consts.js\");\n/* harmony import */ var _peer_record_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./peer-record.js */ \"./node_modules/@libp2p/peer-record/dist/src/peer-record/peer-record.js\");\n\n\n\n\n\n/**\n * The PeerRecord is used for distributing peer routing records across the network.\n * It contains the peer's reachable listen addresses.\n */\nclass PeerRecord {\n /**\n * Unmarshal Peer Record Protobuf\n */\n static createFromProtobuf = (buf) => {\n const peerRecord = _peer_record_js__WEBPACK_IMPORTED_MODULE_1__.PeerRecord.decode(buf);\n const peerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromBytes)(peerRecord.peerId);\n const multiaddrs = (peerRecord.addresses ?? []).map((a) => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(a.multiaddr));\n const seqNumber = peerRecord.seq;\n return new PeerRecord({ peerId, multiaddrs, seqNumber });\n };\n static DOMAIN = _consts_js__WEBPACK_IMPORTED_MODULE_3__.ENVELOPE_DOMAIN_PEER_RECORD;\n static CODEC = _consts_js__WEBPACK_IMPORTED_MODULE_3__.ENVELOPE_PAYLOAD_TYPE_PEER_RECORD;\n peerId;\n multiaddrs;\n seqNumber;\n domain = PeerRecord.DOMAIN;\n codec = PeerRecord.CODEC;\n marshaled;\n constructor(init) {\n const { peerId, multiaddrs, seqNumber } = init;\n this.peerId = peerId;\n this.multiaddrs = multiaddrs ?? [];\n this.seqNumber = seqNumber ?? BigInt(Date.now());\n }\n /**\n * Marshal a record to be used in an envelope\n */\n marshal() {\n if (this.marshaled == null) {\n this.marshaled = _peer_record_js__WEBPACK_IMPORTED_MODULE_1__.PeerRecord.encode({\n peerId: this.peerId.toBytes(),\n seq: BigInt(this.seqNumber),\n addresses: this.multiaddrs.map((m) => ({\n multiaddr: m.bytes\n }))\n });\n }\n return this.marshaled;\n }\n /**\n * Returns true if `this` record equals the `other`\n */\n equals(other) {\n if (!(other instanceof PeerRecord)) {\n return false;\n }\n // Validate PeerId\n if (!this.peerId.equals(other.peerId)) {\n return false;\n }\n // Validate seqNumber\n if (this.seqNumber !== other.seqNumber) {\n return false;\n }\n // Validate multiaddrs\n if (!(0,_libp2p_utils_array_equals__WEBPACK_IMPORTED_MODULE_4__.arrayEquals)(this.multiaddrs, other.multiaddrs)) {\n return false;\n }\n return true;\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-record/dist/src/peer-record/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-record/dist/src/peer-record/peer-record.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-record/dist/src/peer-record/peer-record.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerRecord: () => (/* binding */ PeerRecord)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar PeerRecord;\n(function (PeerRecord) {\n let AddressInfo;\n (function (AddressInfo) {\n let _codec;\n AddressInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.multiaddr != null && obj.multiaddr.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.multiaddr);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n multiaddr: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.multiaddr = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n AddressInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, AddressInfo.codec());\n };\n AddressInfo.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, AddressInfo.codec());\n };\n })(AddressInfo = PeerRecord.AddressInfo || (PeerRecord.AddressInfo = {}));\n let _codec;\n PeerRecord.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.peerId != null && obj.peerId.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.peerId);\n }\n if ((obj.seq != null && obj.seq !== 0n)) {\n w.uint32(16);\n w.uint64(obj.seq);\n }\n if (obj.addresses != null) {\n for (const value of obj.addresses) {\n w.uint32(26);\n PeerRecord.AddressInfo.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n peerId: new Uint8Array(0),\n seq: 0n,\n addresses: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.peerId = reader.bytes();\n break;\n case 2:\n obj.seq = reader.uint64();\n break;\n case 3:\n obj.addresses.push(PeerRecord.AddressInfo.codec().decode(reader, reader.uint32()));\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerRecord.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerRecord.codec());\n };\n PeerRecord.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerRecord.codec());\n };\n})(PeerRecord || (PeerRecord = {}));\n//# sourceMappingURL=peer-record.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-record/dist/src/peer-record/peer-record.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/equals.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/equals.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-record/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-store/dist/src/errors.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-store/dist/src/errors.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes)\n/* harmony export */ });\nconst codes = {\n ERR_INVALID_PARAMETERS: 'ERR_INVALID_PARAMETERS'\n};\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-store/dist/src/errors.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-store/dist/src/index.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-store/dist/src/index.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PersistentPeerStore: () => (/* binding */ PersistentPeerStore)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/peer-record */ \"./node_modules/@libp2p/peer-record/dist/src/envelope/index.js\");\n/* harmony import */ var _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-record */ \"./node_modules/@libp2p/peer-record/dist/src/peer-record/index.js\");\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n/* harmony import */ var _store_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store.js */ \"./node_modules/@libp2p/peer-store/dist/src/store.js\");\n/**\n * @packageDocumentation\n *\n * The peer store is where libp2p stores data about the peers it has encountered on the network.\n */\n\n\n\n/**\n * An implementation of PeerStore that stores data in a Datastore\n */\nclass PersistentPeerStore {\n store;\n events;\n peerId;\n log;\n constructor(components, init = {}) {\n this.log = components.logger.forComponent('libp2p:peer-store');\n this.events = components.events;\n this.peerId = components.peerId;\n this.store = new _store_js__WEBPACK_IMPORTED_MODULE_1__.PersistentStore(components, init);\n }\n async forEach(fn, query) {\n this.log.trace('forEach await read lock');\n const release = await this.store.lock.readLock();\n this.log.trace('forEach got read lock');\n try {\n for await (const peer of this.store.all(query)) {\n fn(peer);\n }\n }\n finally {\n this.log.trace('forEach release read lock');\n release();\n }\n }\n async all(query) {\n this.log.trace('all await read lock');\n const release = await this.store.lock.readLock();\n this.log.trace('all got read lock');\n try {\n return await (0,it_all__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.store.all(query));\n }\n finally {\n this.log.trace('all release read lock');\n release();\n }\n }\n async delete(peerId) {\n this.log.trace('delete await write lock');\n const release = await this.store.lock.writeLock();\n this.log.trace('delete got write lock');\n try {\n await this.store.delete(peerId);\n }\n finally {\n this.log.trace('delete release write lock');\n release();\n }\n }\n async has(peerId) {\n this.log.trace('has await read lock');\n const release = await this.store.lock.readLock();\n this.log.trace('has got read lock');\n try {\n return await this.store.has(peerId);\n }\n finally {\n this.log.trace('has release read lock');\n release();\n }\n }\n async get(peerId) {\n this.log.trace('get await read lock');\n const release = await this.store.lock.readLock();\n this.log.trace('get got read lock');\n try {\n return await this.store.load(peerId);\n }\n finally {\n this.log.trace('get release read lock');\n release();\n }\n }\n async save(id, data) {\n this.log.trace('save await write lock');\n const release = await this.store.lock.writeLock();\n this.log.trace('save got write lock');\n try {\n const result = await this.store.save(id, data);\n this.#emitIfUpdated(id, result);\n return result.peer;\n }\n finally {\n this.log.trace('save release write lock');\n release();\n }\n }\n async patch(id, data) {\n this.log.trace('patch await write lock');\n const release = await this.store.lock.writeLock();\n this.log.trace('patch got write lock');\n try {\n const result = await this.store.patch(id, data);\n this.#emitIfUpdated(id, result);\n return result.peer;\n }\n finally {\n this.log.trace('patch release write lock');\n release();\n }\n }\n async merge(id, data) {\n this.log.trace('merge await write lock');\n const release = await this.store.lock.writeLock();\n this.log.trace('merge got write lock');\n try {\n const result = await this.store.merge(id, data);\n this.#emitIfUpdated(id, result);\n return result.peer;\n }\n finally {\n this.log.trace('merge release write lock');\n release();\n }\n }\n async consumePeerRecord(buf, expectedPeer) {\n const envelope = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_2__.RecordEnvelope.openAndCertify(buf, _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_3__.PeerRecord.DOMAIN);\n if (expectedPeer?.equals(envelope.peerId) === false) {\n this.log('envelope peer id was not the expected peer id - expected: %p received: %p', expectedPeer, envelope.peerId);\n return false;\n }\n const peerRecord = _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_3__.PeerRecord.createFromProtobuf(envelope.payload);\n let peer;\n try {\n peer = await this.get(envelope.peerId);\n }\n catch (err) {\n if (err.code !== 'ERR_NOT_FOUND') {\n throw err;\n }\n }\n // ensure seq is greater than, or equal to, the last received\n if (peer?.peerRecordEnvelope != null) {\n const storedEnvelope = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_2__.RecordEnvelope.createFromProtobuf(peer.peerRecordEnvelope);\n const storedRecord = _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_3__.PeerRecord.createFromProtobuf(storedEnvelope.payload);\n if (storedRecord.seqNumber >= peerRecord.seqNumber) {\n this.log('sequence number was lower or equal to existing sequence number - stored: %d received: %d', storedRecord.seqNumber, peerRecord.seqNumber);\n return false;\n }\n }\n await this.patch(peerRecord.peerId, {\n peerRecordEnvelope: buf,\n addresses: peerRecord.multiaddrs.map(multiaddr => ({\n isCertified: true,\n multiaddr\n }))\n });\n return true;\n }\n #emitIfUpdated(id, result) {\n if (!result.updated) {\n return;\n }\n if (this.peerId.equals(id)) {\n this.events.safeDispatchEvent('self:peer:update', { detail: result });\n }\n else {\n this.events.safeDispatchEvent('peer:update', { detail: result });\n }\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-store/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-store/dist/src/pb/peer.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-store/dist/src/pb/peer.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Address: () => (/* binding */ Address),\n/* harmony export */ Peer: () => (/* binding */ Peer),\n/* harmony export */ Tag: () => (/* binding */ Tag)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar Peer;\n(function (Peer) {\n let Peer$metadataEntry;\n (function (Peer$metadataEntry) {\n let _codec;\n Peer$metadataEntry.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.key != null && obj.key !== '')) {\n w.uint32(10);\n w.string(obj.key);\n }\n if ((obj.value != null && obj.value.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.value);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n key: '',\n value: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.key = reader.string();\n break;\n case 2:\n obj.value = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Peer$metadataEntry.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Peer$metadataEntry.codec());\n };\n Peer$metadataEntry.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Peer$metadataEntry.codec());\n };\n })(Peer$metadataEntry = Peer.Peer$metadataEntry || (Peer.Peer$metadataEntry = {}));\n let Peer$tagsEntry;\n (function (Peer$tagsEntry) {\n let _codec;\n Peer$tagsEntry.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.key != null && obj.key !== '')) {\n w.uint32(10);\n w.string(obj.key);\n }\n if (obj.value != null) {\n w.uint32(18);\n Tag.codec().encode(obj.value, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n key: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.key = reader.string();\n break;\n case 2:\n obj.value = Tag.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Peer$tagsEntry.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Peer$tagsEntry.codec());\n };\n Peer$tagsEntry.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Peer$tagsEntry.codec());\n };\n })(Peer$tagsEntry = Peer.Peer$tagsEntry || (Peer.Peer$tagsEntry = {}));\n let _codec;\n Peer.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.addresses != null) {\n for (const value of obj.addresses) {\n w.uint32(10);\n Address.codec().encode(value, w);\n }\n }\n if (obj.protocols != null) {\n for (const value of obj.protocols) {\n w.uint32(18);\n w.string(value);\n }\n }\n if (obj.publicKey != null) {\n w.uint32(34);\n w.bytes(obj.publicKey);\n }\n if (obj.peerRecordEnvelope != null) {\n w.uint32(42);\n w.bytes(obj.peerRecordEnvelope);\n }\n if (obj.metadata != null && obj.metadata.size !== 0) {\n for (const [key, value] of obj.metadata.entries()) {\n w.uint32(50);\n Peer.Peer$metadataEntry.codec().encode({ key, value }, w);\n }\n }\n if (obj.tags != null && obj.tags.size !== 0) {\n for (const [key, value] of obj.tags.entries()) {\n w.uint32(58);\n Peer.Peer$tagsEntry.codec().encode({ key, value }, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n addresses: [],\n protocols: [],\n metadata: new Map(),\n tags: new Map()\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.addresses.push(Address.codec().decode(reader, reader.uint32()));\n break;\n case 2:\n obj.protocols.push(reader.string());\n break;\n case 4:\n obj.publicKey = reader.bytes();\n break;\n case 5:\n obj.peerRecordEnvelope = reader.bytes();\n break;\n case 6: {\n const entry = Peer.Peer$metadataEntry.codec().decode(reader, reader.uint32());\n obj.metadata.set(entry.key, entry.value);\n break;\n }\n case 7: {\n const entry = Peer.Peer$tagsEntry.codec().decode(reader, reader.uint32());\n obj.tags.set(entry.key, entry.value);\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Peer.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Peer.codec());\n };\n Peer.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Peer.codec());\n };\n})(Peer || (Peer = {}));\nvar Address;\n(function (Address) {\n let _codec;\n Address.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.multiaddr != null && obj.multiaddr.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.multiaddr);\n }\n if (obj.isCertified != null) {\n w.uint32(16);\n w.bool(obj.isCertified);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n multiaddr: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.multiaddr = reader.bytes();\n break;\n case 2:\n obj.isCertified = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Address.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Address.codec());\n };\n Address.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Address.codec());\n };\n})(Address || (Address = {}));\nvar Tag;\n(function (Tag) {\n let _codec;\n Tag.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.value != null && obj.value !== 0)) {\n w.uint32(8);\n w.uint32(obj.value);\n }\n if (obj.expiry != null) {\n w.uint32(16);\n w.uint64(obj.expiry);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n value: 0\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.value = reader.uint32();\n break;\n case 2:\n obj.expiry = reader.uint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Tag.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Tag.codec());\n };\n Tag.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Tag.codec());\n };\n})(Tag || (Tag = {}));\n//# sourceMappingURL=peer.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-store/dist/src/pb/peer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-store/dist/src/store.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-store/dist/src/store.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PersistentStore: () => (/* binding */ PersistentStore)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/map.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var mortice__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mortice */ \"./node_modules/mortice/dist/src/index.js\");\n/* harmony import */ var multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/bases/base32 */ \"./node_modules/multiformats/dist/src/bases/base32.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@libp2p/peer-store/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/@libp2p/peer-store/dist/src/errors.js\");\n/* harmony import */ var _pb_peer_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./pb/peer.js */ \"./node_modules/@libp2p/peer-store/dist/src/pb/peer.js\");\n/* harmony import */ var _utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/bytes-to-peer.js */ \"./node_modules/@libp2p/peer-store/dist/src/utils/bytes-to-peer.js\");\n/* harmony import */ var _utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/peer-id-to-datastore-key.js */ \"./node_modules/@libp2p/peer-store/dist/src/utils/peer-id-to-datastore-key.js\");\n/* harmony import */ var _utils_to_peer_pb_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/to-peer-pb.js */ \"./node_modules/@libp2p/peer-store/dist/src/utils/to-peer-pb.js\");\n\n\n\n\n\n\n\n\n\n\n\nfunction decodePeer(key, value, cache) {\n // /peers/${peer-id-as-libp2p-key-cid-string-in-base-32}\n const base32Str = key.toString().split('/')[2];\n const buf = multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_1__.base32.decode(base32Str);\n const peerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__.peerIdFromBytes)(buf);\n const cached = cache.get(peerId);\n if (cached != null) {\n return cached;\n }\n const peer = (0,_utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_4__.bytesToPeer)(peerId, value);\n cache.set(peerId, peer);\n return peer;\n}\nfunction mapQuery(query, cache) {\n if (query == null) {\n return {};\n }\n return {\n prefix: _utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_5__.NAMESPACE_COMMON,\n filters: (query.filters ?? []).map(fn => ({ key, value }) => {\n return fn(decodePeer(key, value, cache));\n }),\n orders: (query.orders ?? []).map(fn => (a, b) => {\n return fn(decodePeer(a.key, a.value, cache), decodePeer(b.key, b.value, cache));\n })\n };\n}\nclass PersistentStore {\n peerId;\n datastore;\n lock;\n addressFilter;\n constructor(components, init = {}) {\n this.peerId = components.peerId;\n this.datastore = components.datastore;\n this.addressFilter = init.addressFilter;\n this.lock = (0,mortice__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({\n name: 'peer-store',\n singleProcess: true\n });\n }\n async has(peerId) {\n return this.datastore.has((0,_utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_5__.peerIdToDatastoreKey)(peerId));\n }\n async delete(peerId) {\n if (this.peerId.equals(peerId)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_6__.CodeError('Cannot delete self peer', _errors_js__WEBPACK_IMPORTED_MODULE_7__.codes.ERR_INVALID_PARAMETERS);\n }\n await this.datastore.delete((0,_utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_5__.peerIdToDatastoreKey)(peerId));\n }\n async load(peerId) {\n const buf = await this.datastore.get((0,_utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_5__.peerIdToDatastoreKey)(peerId));\n return (0,_utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_4__.bytesToPeer)(peerId, buf);\n }\n async save(peerId, data) {\n const { existingBuf, existingPeer } = await this.#findExistingPeer(peerId);\n const peerPb = await (0,_utils_to_peer_pb_js__WEBPACK_IMPORTED_MODULE_8__.toPeerPB)(peerId, data, 'patch', {\n addressFilter: this.addressFilter\n });\n return this.#saveIfDifferent(peerId, peerPb, existingBuf, existingPeer);\n }\n async patch(peerId, data) {\n const { existingBuf, existingPeer } = await this.#findExistingPeer(peerId);\n const peerPb = await (0,_utils_to_peer_pb_js__WEBPACK_IMPORTED_MODULE_8__.toPeerPB)(peerId, data, 'patch', {\n addressFilter: this.addressFilter,\n existingPeer\n });\n return this.#saveIfDifferent(peerId, peerPb, existingBuf, existingPeer);\n }\n async merge(peerId, data) {\n const { existingBuf, existingPeer } = await this.#findExistingPeer(peerId);\n const peerPb = await (0,_utils_to_peer_pb_js__WEBPACK_IMPORTED_MODULE_8__.toPeerPB)(peerId, data, 'merge', {\n addressFilter: this.addressFilter,\n existingPeer\n });\n return this.#saveIfDifferent(peerId, peerPb, existingBuf, existingPeer);\n }\n async *all(query) {\n const peerCache = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_9__.PeerMap();\n for await (const { key, value } of this.datastore.query(mapQuery(query ?? {}, peerCache))) {\n const peer = decodePeer(key, value, peerCache);\n if (peer.id.equals(this.peerId)) {\n // Skip self peer if present\n continue;\n }\n yield peer;\n }\n }\n async #findExistingPeer(peerId) {\n try {\n const existingBuf = await this.datastore.get((0,_utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_5__.peerIdToDatastoreKey)(peerId));\n const existingPeer = (0,_utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_4__.bytesToPeer)(peerId, existingBuf);\n return {\n existingBuf,\n existingPeer\n };\n }\n catch (err) {\n if (err.code !== 'ERR_NOT_FOUND') {\n throw err;\n }\n }\n return {};\n }\n async #saveIfDifferent(peerId, peer, existingBuf, existingPeer) {\n const buf = _pb_peer_js__WEBPACK_IMPORTED_MODULE_10__.Peer.encode(peer);\n if (existingBuf != null && (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(buf, existingBuf)) {\n return {\n peer: (0,_utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_4__.bytesToPeer)(peerId, buf),\n previous: existingPeer,\n updated: false\n };\n }\n await this.datastore.put((0,_utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_5__.peerIdToDatastoreKey)(peerId), buf);\n return {\n peer: (0,_utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_4__.bytesToPeer)(peerId, buf),\n previous: existingPeer,\n updated: true\n };\n }\n}\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-store/dist/src/store.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-store/dist/src/utils/bytes-to-peer.js":
|
||
/*!*************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-store/dist/src/utils/bytes-to-peer.js ***!
|
||
\*************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bytesToPeer: () => (/* binding */ bytesToPeer)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _pb_peer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../pb/peer.js */ \"./node_modules/@libp2p/peer-store/dist/src/pb/peer.js\");\n\n\n\nfunction bytesToPeer(peerId, buf) {\n const peer = _pb_peer_js__WEBPACK_IMPORTED_MODULE_1__.Peer.decode(buf);\n if (peer.publicKey != null && peerId.publicKey == null) {\n peerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromPeerId)({\n ...peerId,\n publicKey: peerId.publicKey\n });\n }\n const tags = new Map();\n // remove any expired tags\n const now = BigInt(Date.now());\n for (const [key, tag] of peer.tags.entries()) {\n if (tag.expiry != null && tag.expiry < now) {\n continue;\n }\n tags.set(key, tag);\n }\n return {\n ...peer,\n id: peerId,\n addresses: peer.addresses.map(({ multiaddr: ma, isCertified }) => {\n return {\n multiaddr: (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(ma),\n isCertified: isCertified ?? false\n };\n }),\n metadata: peer.metadata,\n peerRecordEnvelope: peer.peerRecordEnvelope ?? undefined,\n tags\n };\n}\n//# sourceMappingURL=bytes-to-peer.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-store/dist/src/utils/bytes-to-peer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-store/dist/src/utils/dedupe-addresses.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-store/dist/src/utils/dedupe-addresses.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ dedupeFilterAndSortAddresses: () => (/* binding */ dedupeFilterAndSortAddresses)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/@libp2p/peer-store/dist/src/errors.js\");\n\n\n\nasync function dedupeFilterAndSortAddresses(peerId, filter, addresses) {\n const addressMap = new Map();\n for (const addr of addresses) {\n if (addr == null) {\n continue;\n }\n if (addr.multiaddr instanceof Uint8Array) {\n addr.multiaddr = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(addr.multiaddr);\n }\n if (!(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.isMultiaddr)(addr.multiaddr)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Multiaddr was invalid', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (!(await filter(peerId, addr.multiaddr))) {\n continue;\n }\n const isCertified = addr.isCertified ?? false;\n const maStr = addr.multiaddr.toString();\n const existingAddr = addressMap.get(maStr);\n if (existingAddr != null) {\n addr.isCertified = existingAddr.isCertified || isCertified;\n }\n else {\n addressMap.set(maStr, {\n multiaddr: addr.multiaddr,\n isCertified\n });\n }\n }\n return [...addressMap.values()]\n .sort((a, b) => {\n return a.multiaddr.toString().localeCompare(b.multiaddr.toString());\n })\n .map(({ isCertified, multiaddr }) => ({\n isCertified,\n multiaddr: multiaddr.bytes\n }));\n}\n//# sourceMappingURL=dedupe-addresses.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-store/dist/src/utils/dedupe-addresses.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-store/dist/src/utils/peer-id-to-datastore-key.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-store/dist/src/utils/peer-id-to-datastore-key.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ NAMESPACE_COMMON: () => (/* binding */ NAMESPACE_COMMON),\n/* harmony export */ peerIdToDatastoreKey: () => (/* binding */ peerIdToDatastoreKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/peer-id/index.js\");\n/* harmony import */ var interface_datastore_key__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! interface-datastore/key */ \"./node_modules/interface-datastore/dist/src/key.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/@libp2p/peer-store/dist/src/errors.js\");\n\n\n\n\nconst NAMESPACE_COMMON = '/peers/';\nfunction peerIdToDatastoreKey(peerId) {\n if (!(0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.isPeerId)(peerId) || peerId.type == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError('Invalid PeerId', _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_INVALID_PARAMETERS);\n }\n const b32key = peerId.toCID().toString();\n return new interface_datastore_key__WEBPACK_IMPORTED_MODULE_0__.Key(`${NAMESPACE_COMMON}${b32key}`);\n}\n//# sourceMappingURL=peer-id-to-datastore-key.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-store/dist/src/utils/peer-id-to-datastore-key.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-store/dist/src/utils/to-peer-pb.js":
|
||
/*!**********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-store/dist/src/utils/to-peer-pb.js ***!
|
||
\**********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toPeerPB: () => (/* binding */ toPeerPB)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@libp2p/peer-store/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/@libp2p/peer-store/dist/src/errors.js\");\n/* harmony import */ var _dedupe_addresses_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./dedupe-addresses.js */ \"./node_modules/@libp2p/peer-store/dist/src/utils/dedupe-addresses.js\");\n\n\n\n\nasync function toPeerPB(peerId, data, strategy, options) {\n if (data == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Invalid PeerData', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (data.publicKey != null && peerId.publicKey != null && !(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_0__.equals)(data.publicKey, peerId.publicKey)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('publicKey bytes do not match peer id publicKey bytes', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n const existingPeer = options.existingPeer;\n if (existingPeer != null && !peerId.equals(existingPeer.id)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('peer id did not match existing peer id', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n let addresses = existingPeer?.addresses ?? [];\n let protocols = new Set(existingPeer?.protocols ?? []);\n let metadata = existingPeer?.metadata ?? new Map();\n let tags = existingPeer?.tags ?? new Map();\n let peerRecordEnvelope = existingPeer?.peerRecordEnvelope;\n // when patching, we replace the original fields with passed values\n if (strategy === 'patch') {\n if (data.multiaddrs != null || data.addresses != null) {\n addresses = [];\n if (data.multiaddrs != null) {\n addresses.push(...data.multiaddrs.map(multiaddr => ({\n isCertified: false,\n multiaddr\n })));\n }\n if (data.addresses != null) {\n addresses.push(...data.addresses);\n }\n }\n if (data.protocols != null) {\n protocols = new Set(data.protocols);\n }\n if (data.metadata != null) {\n const metadataEntries = data.metadata instanceof Map ? [...data.metadata.entries()] : Object.entries(data.metadata);\n metadata = createSortedMap(metadataEntries, {\n validate: validateMetadata\n });\n }\n if (data.tags != null) {\n const tagsEntries = data.tags instanceof Map ? [...data.tags.entries()] : Object.entries(data.tags);\n tags = createSortedMap(tagsEntries, {\n validate: validateTag,\n map: mapTag\n });\n }\n if (data.peerRecordEnvelope != null) {\n peerRecordEnvelope = data.peerRecordEnvelope;\n }\n }\n // when merging, we join the original fields with passed values\n if (strategy === 'merge') {\n if (data.multiaddrs != null) {\n addresses.push(...data.multiaddrs.map(multiaddr => ({\n isCertified: false,\n multiaddr\n })));\n }\n if (data.addresses != null) {\n addresses.push(...data.addresses);\n }\n if (data.protocols != null) {\n protocols = new Set([...protocols, ...data.protocols]);\n }\n if (data.metadata != null) {\n const metadataEntries = data.metadata instanceof Map ? [...data.metadata.entries()] : Object.entries(data.metadata);\n for (const [key, value] of metadataEntries) {\n if (value == null) {\n metadata.delete(key);\n }\n else {\n metadata.set(key, value);\n }\n }\n metadata = createSortedMap([...metadata.entries()], {\n validate: validateMetadata\n });\n }\n if (data.tags != null) {\n const tagsEntries = data.tags instanceof Map ? [...data.tags.entries()] : Object.entries(data.tags);\n const mergedTags = new Map(tags);\n for (const [key, value] of tagsEntries) {\n if (value == null) {\n mergedTags.delete(key);\n }\n else {\n mergedTags.set(key, value);\n }\n }\n tags = createSortedMap([...mergedTags.entries()], {\n validate: validateTag,\n map: mapTag\n });\n }\n if (data.peerRecordEnvelope != null) {\n peerRecordEnvelope = data.peerRecordEnvelope;\n }\n }\n const output = {\n addresses: await (0,_dedupe_addresses_js__WEBPACK_IMPORTED_MODULE_3__.dedupeFilterAndSortAddresses)(peerId, options.addressFilter ?? (async () => true), addresses),\n protocols: [...protocols.values()].sort((a, b) => {\n return a.localeCompare(b);\n }),\n metadata,\n tags,\n publicKey: existingPeer?.id.publicKey ?? data.publicKey ?? peerId.publicKey,\n peerRecordEnvelope\n };\n // Ed25519 and secp256k1 have their public key embedded in them so no need to duplicate it\n if (peerId.type !== 'RSA') {\n delete output.publicKey;\n }\n return output;\n}\n/**\n * In JS maps are ordered by insertion order so create a new map with the\n * keys inserted in alphabetical order.\n */\nfunction createSortedMap(entries, options) {\n const output = new Map();\n for (const [key, value] of entries) {\n if (value == null) {\n continue;\n }\n options.validate(key, value);\n }\n for (const [key, value] of entries.sort(([a], [b]) => {\n return a.localeCompare(b);\n })) {\n if (value != null) {\n output.set(key, options.map?.(key, value) ?? value);\n }\n }\n return output;\n}\nfunction validateMetadata(key, value) {\n if (typeof key !== 'string') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Metadata key must be a string', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (!(value instanceof Uint8Array)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Metadata value must be a Uint8Array', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n}\nfunction validateTag(key, tag) {\n if (typeof key !== 'string') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Tag name must be a string', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (tag.value != null) {\n if (parseInt(`${tag.value}`, 10) !== tag.value) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Tag value must be an integer', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (tag.value < 0 || tag.value > 100) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Tag value must be between 0-100', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n }\n if (tag.ttl != null) {\n if (parseInt(`${tag.ttl}`, 10) !== tag.ttl) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Tag ttl must be an integer', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (tag.ttl < 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Tag ttl must be between greater than 0', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n }\n}\nfunction mapTag(key, tag) {\n let expiry;\n if (tag.expiry != null) {\n expiry = tag.expiry;\n }\n if (tag.ttl != null) {\n expiry = BigInt(Date.now() + Number(tag.ttl));\n }\n return {\n value: tag.value ?? 0,\n expiry\n };\n}\n//# sourceMappingURL=to-peer-pb.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-store/dist/src/utils/to-peer-pb.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/peer-store/node_modules/uint8arrays/dist/src/equals.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/peer-store/node_modules/uint8arrays/dist/src/equals.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/peer-store/node_modules/uint8arrays/dist/src/equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/ping/dist/src/constants.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/@libp2p/ping/dist/src/constants.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ERR_WRONG_PING_ACK: () => (/* binding */ ERR_WRONG_PING_ACK),\n/* harmony export */ MAX_INBOUND_STREAMS: () => (/* binding */ MAX_INBOUND_STREAMS),\n/* harmony export */ MAX_OUTBOUND_STREAMS: () => (/* binding */ MAX_OUTBOUND_STREAMS),\n/* harmony export */ PING_LENGTH: () => (/* binding */ PING_LENGTH),\n/* harmony export */ PING_PROTOCOL: () => (/* binding */ PING_PROTOCOL),\n/* harmony export */ PROTOCOL_NAME: () => (/* binding */ PROTOCOL_NAME),\n/* harmony export */ PROTOCOL_PREFIX: () => (/* binding */ PROTOCOL_PREFIX),\n/* harmony export */ PROTOCOL_VERSION: () => (/* binding */ PROTOCOL_VERSION),\n/* harmony export */ TIMEOUT: () => (/* binding */ TIMEOUT)\n/* harmony export */ });\nconst PING_PROTOCOL = '/ipfs/ping/1.0.0';\nconst PING_LENGTH = 32;\nconst PROTOCOL_VERSION = '1.0.0';\nconst PROTOCOL_NAME = 'ping';\nconst PROTOCOL_PREFIX = 'ipfs';\nconst TIMEOUT = 10000;\n// See https://github.com/libp2p/specs/blob/d4b5fb0152a6bb86cfd9ea/ping/ping.md?plain=1#L38-L43\n// The dialing peer MUST NOT keep more than one outbound stream for the ping protocol per peer.\n// The listening peer SHOULD accept at most two streams per peer since cross-stream behavior is\n// non-linear and stream writes occur asynchronously. The listening peer may perceive the\n// dialing peer closing and opening the wrong streams (for instance, closing stream B and\n// opening stream A even though the dialing peer is opening stream B and closing stream A).\nconst MAX_INBOUND_STREAMS = 2;\nconst MAX_OUTBOUND_STREAMS = 1;\nconst ERR_WRONG_PING_ACK = 'ERR_WRONG_PING_ACK';\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/ping/dist/src/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/ping/dist/src/index.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/@libp2p/ping/dist/src/index.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PING_PROTOCOL: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_1__.PING_PROTOCOL),\n/* harmony export */ ping: () => (/* binding */ ping)\n/* harmony export */ });\n/* harmony import */ var _ping_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ping.js */ \"./node_modules/@libp2p/ping/dist/src/ping.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@libp2p/ping/dist/src/constants.js\");\n/**\n * @packageDocumentation\n *\n * The ping service implements the [libp2p ping spec](https://github.com/libp2p/specs/blob/master/ping/ping.md) allowing you to make a latency measurement to a remote peer.\n *\n * @example\n *\n * ```typescript\n * import { createLibp2p } from 'libp2p'\n * import { ping } from '@libp2p/ping'\n * import { multiaddr } from '@multiformats/multiaddr'\n *\n * const node = await createLibp2p({\n * services: {\n * ping: ping()\n * }\n * })\n *\n * const rtt = await node.services.ping.ping(multiaddr('/ip4/...'))\n *\n * console.info(rtt)\n * ```\n */\n\nfunction ping(init = {}) {\n return (components) => new _ping_js__WEBPACK_IMPORTED_MODULE_0__.PingService(components, init);\n}\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/ping/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/ping/dist/src/ping.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/@libp2p/ping/dist/src/ping.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PingService: () => (/* binding */ PingService)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/crypto */ \"./node_modules/@libp2p/crypto/dist/src/random-bytes.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var it_first__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-first */ \"./node_modules/it-first/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@libp2p/ping/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@libp2p/ping/dist/src/constants.js\");\n\n\n\n\n\n\nclass PingService {\n protocol;\n components;\n started;\n timeout;\n maxInboundStreams;\n maxOutboundStreams;\n runOnTransientConnection;\n log;\n constructor(components, init = {}) {\n this.components = components;\n this.log = components.logger.forComponent('libp2p:ping');\n this.started = false;\n this.protocol = `/${init.protocolPrefix ?? _constants_js__WEBPACK_IMPORTED_MODULE_3__.PROTOCOL_PREFIX}/${_constants_js__WEBPACK_IMPORTED_MODULE_3__.PROTOCOL_NAME}/${_constants_js__WEBPACK_IMPORTED_MODULE_3__.PROTOCOL_VERSION}`;\n this.timeout = init.timeout ?? _constants_js__WEBPACK_IMPORTED_MODULE_3__.TIMEOUT;\n this.maxInboundStreams = init.maxInboundStreams ?? _constants_js__WEBPACK_IMPORTED_MODULE_3__.MAX_INBOUND_STREAMS;\n this.maxOutboundStreams = init.maxOutboundStreams ?? _constants_js__WEBPACK_IMPORTED_MODULE_3__.MAX_OUTBOUND_STREAMS;\n this.runOnTransientConnection = init.runOnTransientConnection ?? true;\n this.handleMessage = this.handleMessage.bind(this);\n }\n async start() {\n await this.components.registrar.handle(this.protocol, this.handleMessage, {\n maxInboundStreams: this.maxInboundStreams,\n maxOutboundStreams: this.maxOutboundStreams,\n runOnTransientConnection: this.runOnTransientConnection\n });\n this.started = true;\n }\n async stop() {\n await this.components.registrar.unhandle(this.protocol);\n this.started = false;\n }\n isStarted() {\n return this.started;\n }\n /**\n * A handler to register with Libp2p to process ping messages\n */\n handleMessage(data) {\n this.log('incoming ping from %p', data.connection.remotePeer);\n const { stream } = data;\n const start = Date.now();\n void (0,it_pipe__WEBPACK_IMPORTED_MODULE_1__.pipe)(stream, stream)\n .catch(err => {\n this.log.error('incoming ping from %p failed with error', data.connection.remotePeer, err);\n })\n .finally(() => {\n const ms = Date.now() - start;\n this.log('incoming ping from %p complete in %dms', data.connection.remotePeer, ms);\n });\n }\n /**\n * Ping a given peer and wait for its response, getting the operation latency.\n */\n async ping(peer, options = {}) {\n this.log('pinging %p', peer);\n const start = Date.now();\n const data = (0,_libp2p_crypto__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_constants_js__WEBPACK_IMPORTED_MODULE_3__.PING_LENGTH);\n const connection = await this.components.connectionManager.openConnection(peer, options);\n let stream;\n let onAbort = () => { };\n if (options.signal == null) {\n const signal = AbortSignal.timeout(this.timeout);\n options = {\n ...options,\n signal\n };\n }\n try {\n stream = await connection.newStream(this.protocol, {\n ...options,\n runOnTransientConnection: this.runOnTransientConnection\n });\n onAbort = () => {\n stream?.abort(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.CodeError('ping timeout', _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.ERR_TIMEOUT));\n };\n // make stream abortable\n options.signal?.addEventListener('abort', onAbort, { once: true });\n const result = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_1__.pipe)([data], stream, async (source) => (0,it_first__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(source));\n const ms = Date.now() - start;\n if (result == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.CodeError(`Did not receive a ping ack after ${ms}ms`, _constants_js__WEBPACK_IMPORTED_MODULE_3__.ERR_WRONG_PING_ACK);\n }\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(data, result.subarray())) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.CodeError(`Received wrong ping ack after ${ms}ms`, _constants_js__WEBPACK_IMPORTED_MODULE_3__.ERR_WRONG_PING_ACK);\n }\n this.log('ping %p complete in %dms', connection.remotePeer, ms);\n return ms;\n }\n catch (err) {\n this.log.error('error while pinging %p', connection.remotePeer, err);\n stream?.abort(err);\n throw err;\n }\n finally {\n options.signal?.removeEventListener('abort', onAbort);\n if (stream != null) {\n await stream.close();\n }\n }\n }\n}\n//# sourceMappingURL=ping.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/ping/dist/src/ping.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/ping/node_modules/uint8arrays/dist/src/equals.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/ping/node_modules/uint8arrays/dist/src/equals.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/ping/node_modules/uint8arrays/dist/src/equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/pubsub/dist/src/errors.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/@libp2p/pubsub/dist/src/errors.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes)\n/* harmony export */ });\nconst codes = {\n /**\n * Signature policy is invalid\n */\n ERR_INVALID_SIGNATURE_POLICY: 'ERR_INVALID_SIGNATURE_POLICY',\n /**\n * Signature policy is unhandled\n */\n ERR_UNHANDLED_SIGNATURE_POLICY: 'ERR_UNHANDLED_SIGNATURE_POLICY',\n // Strict signing codes\n /**\n * Message expected to have a `signature`, but doesn't\n */\n ERR_MISSING_SIGNATURE: 'ERR_MISSING_SIGNATURE',\n /**\n * Message expected to have a `seqno`, but doesn't\n */\n ERR_MISSING_SEQNO: 'ERR_MISSING_SEQNO',\n /**\n * Message expected to have a `key`, but doesn't\n */\n ERR_MISSING_KEY: 'ERR_MISSING_KEY',\n /**\n * Message `signature` is invalid\n */\n ERR_INVALID_SIGNATURE: 'ERR_INVALID_SIGNATURE',\n /**\n * Message expected to have a `from`, but doesn't\n */\n ERR_MISSING_FROM: 'ERR_MISSING_FROM',\n // Strict no-signing codes\n /**\n * Message expected to not have a `from`, but does\n */\n ERR_UNEXPECTED_FROM: 'ERR_UNEXPECTED_FROM',\n /**\n * Message expected to not have a `signature`, but does\n */\n ERR_UNEXPECTED_SIGNATURE: 'ERR_UNEXPECTED_SIGNATURE',\n /**\n * Message expected to not have a `key`, but does\n */\n ERR_UNEXPECTED_KEY: 'ERR_UNEXPECTED_KEY',\n /**\n * Message expected to not have a `seqno`, but does\n */\n ERR_UNEXPECTED_SEQNO: 'ERR_UNEXPECTED_SEQNO',\n /**\n * Message failed topic validator\n */\n ERR_TOPIC_VALIDATOR_REJECT: 'ERR_TOPIC_VALIDATOR_REJECT'\n};\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/pubsub/dist/src/errors.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/pubsub/dist/src/utils.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@libp2p/pubsub/dist/src/utils.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ anyMatch: () => (/* binding */ anyMatch),\n/* harmony export */ bigIntFromBytes: () => (/* binding */ bigIntFromBytes),\n/* harmony export */ bigIntToBytes: () => (/* binding */ bigIntToBytes),\n/* harmony export */ ensureArray: () => (/* binding */ ensureArray),\n/* harmony export */ msgId: () => (/* binding */ msgId),\n/* harmony export */ noSignMsgId: () => (/* binding */ noSignMsgId),\n/* harmony export */ randomSeqno: () => (/* binding */ randomSeqno),\n/* harmony export */ toMessage: () => (/* binding */ toMessage),\n/* harmony export */ toRpcMessage: () => (/* binding */ toRpcMessage)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/crypto */ \"./node_modules/@libp2p/crypto/dist/src/random-bytes.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/@libp2p/pubsub/dist/src/errors.js\");\n\n\n\n\n\n\n\n/**\n * Generate a random sequence number\n */\nfunction randomSeqno() {\n return BigInt(`0x${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)((0,_libp2p_crypto__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(8), 'base16')}`);\n}\n/**\n * Generate a message id, based on the `key` and `seqno`\n */\nconst msgId = (key, seqno) => {\n const seqnoBytes = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(seqno.toString(16).padStart(16, '0'), 'base16');\n const msgId = new Uint8Array(key.length + seqnoBytes.length);\n msgId.set(key, 0);\n msgId.set(seqnoBytes, key.length);\n return msgId;\n};\n/**\n * Generate a message id, based on message `data`\n */\nconst noSignMsgId = (data) => {\n return multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.encode(data);\n};\n/**\n * Check if any member of the first set is also a member\n * of the second set\n */\nconst anyMatch = (a, b) => {\n let bHas;\n if (Array.isArray(b)) {\n bHas = (val) => b.includes(val);\n }\n else {\n bHas = (val) => b.has(val);\n }\n for (const val of a) {\n if (bHas(val)) {\n return true;\n }\n }\n return false;\n};\n/**\n * Make everything an array\n */\nconst ensureArray = function (maybeArray) {\n if (!Array.isArray(maybeArray)) {\n return [maybeArray];\n }\n return maybeArray;\n};\nconst isSigned = async (message) => {\n if ((message.sequenceNumber == null) || (message.from == null) || (message.signature == null)) {\n return false;\n }\n // if a public key is present in the `from` field, the message should be signed\n const fromID = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__.peerIdFromBytes)(message.from);\n if (fromID.publicKey != null) {\n return true;\n }\n if (message.key != null) {\n const signingID = await (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__.peerIdFromKeys)(message.key);\n return signingID.equals(fromID);\n }\n return false;\n};\nconst toMessage = async (message) => {\n if (message.from == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.CodeError('RPC message was missing from', _errors_js__WEBPACK_IMPORTED_MODULE_6__.codes.ERR_MISSING_FROM);\n }\n if (!await isSigned(message)) {\n return {\n type: 'unsigned',\n topic: message.topic ?? '',\n data: message.data ?? new Uint8Array(0)\n };\n }\n const from = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__.peerIdFromBytes)(message.from);\n const msg = {\n type: 'signed',\n from: (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__.peerIdFromBytes)(message.from),\n topic: message.topic ?? '',\n sequenceNumber: bigIntFromBytes(message.sequenceNumber ?? new Uint8Array(0)),\n data: message.data ?? new Uint8Array(0),\n signature: message.signature ?? new Uint8Array(0),\n key: message.key ?? from.publicKey ?? new Uint8Array(0)\n };\n if (msg.key.length === 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.CodeError('Signed RPC message was missing key', _errors_js__WEBPACK_IMPORTED_MODULE_6__.codes.ERR_MISSING_KEY);\n }\n return msg;\n};\nconst toRpcMessage = (message) => {\n if (message.type === 'signed') {\n return {\n from: message.from.multihash.bytes,\n data: message.data,\n sequenceNumber: bigIntToBytes(message.sequenceNumber),\n topic: message.topic,\n signature: message.signature,\n key: message.key\n };\n }\n return {\n data: message.data,\n topic: message.topic\n };\n};\nconst bigIntToBytes = (num) => {\n let str = num.toString(16);\n if (str.length % 2 !== 0) {\n str = `0${str}`;\n }\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(str, 'base16');\n};\nconst bigIntFromBytes = (num) => {\n return BigInt(`0x${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(num, 'base16')}`);\n};\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/pubsub/dist/src/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/pubsub/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/abstract-stream.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/abstract-stream.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbstractStream: () => (/* binding */ AbstractStream)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/* harmony import */ var race_signal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! race-signal */ \"./node_modules/race-signal/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _close_source_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./close-source.js */ \"./node_modules/@libp2p/utils/dist/src/close-source.js\");\n\n\n\n\n\n\n\nconst ERR_STREAM_RESET = 'ERR_STREAM_RESET';\nconst ERR_SINK_INVALID_STATE = 'ERR_SINK_INVALID_STATE';\nconst DEFAULT_SEND_CLOSE_WRITE_TIMEOUT = 5000;\nfunction isPromise(thing) {\n if (thing == null) {\n return false;\n }\n return typeof thing.then === 'function' &&\n typeof thing.catch === 'function' &&\n typeof thing.finally === 'function';\n}\nclass AbstractStream {\n id;\n direction;\n timeline;\n protocol;\n metadata;\n source;\n status;\n readStatus;\n writeStatus;\n log;\n sinkController;\n sinkEnd;\n closed;\n endErr;\n streamSource;\n onEnd;\n onCloseRead;\n onCloseWrite;\n onReset;\n onAbort;\n sendCloseWriteTimeout;\n sendingData;\n constructor(init) {\n this.sinkController = new AbortController();\n this.sinkEnd = (0,p_defer__WEBPACK_IMPORTED_MODULE_3__[\"default\"])();\n this.closed = (0,p_defer__WEBPACK_IMPORTED_MODULE_3__[\"default\"])();\n this.log = init.log;\n // stream status\n this.status = 'open';\n this.readStatus = 'ready';\n this.writeStatus = 'ready';\n this.id = init.id;\n this.metadata = init.metadata ?? {};\n this.direction = init.direction;\n this.timeline = {\n open: Date.now()\n };\n this.sendCloseWriteTimeout = init.sendCloseWriteTimeout ?? DEFAULT_SEND_CLOSE_WRITE_TIMEOUT;\n this.onEnd = init.onEnd;\n this.onCloseRead = init?.onCloseRead;\n this.onCloseWrite = init?.onCloseWrite;\n this.onReset = init?.onReset;\n this.onAbort = init?.onAbort;\n this.source = this.streamSource = (0,it_pushable__WEBPACK_IMPORTED_MODULE_0__.pushable)({\n onEnd: (err) => {\n if (err != null) {\n this.log.trace('source ended with error', err);\n }\n else {\n this.log.trace('source ended');\n }\n this.onSourceEnd(err);\n }\n });\n // necessary because the libp2p upgrader wraps the sink function\n this.sink = this.sink.bind(this);\n }\n async sink(source) {\n if (this.writeStatus !== 'ready') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CodeError(`writable end state is \"${this.writeStatus}\" not \"ready\"`, ERR_SINK_INVALID_STATE);\n }\n try {\n this.writeStatus = 'writing';\n const options = {\n signal: this.sinkController.signal\n };\n if (this.direction === 'outbound') { // If initiator, open a new stream\n const res = this.sendNewStream(options);\n if (isPromise(res)) {\n await res;\n }\n }\n const abortListener = () => {\n (0,_close_source_js__WEBPACK_IMPORTED_MODULE_5__.closeSource)(source, this.log);\n };\n try {\n this.sinkController.signal.addEventListener('abort', abortListener);\n this.log.trace('sink reading from source');\n for await (let data of source) {\n data = data instanceof Uint8Array ? new uint8arraylist__WEBPACK_IMPORTED_MODULE_2__.Uint8ArrayList(data) : data;\n const res = this.sendData(data, options);\n if (isPromise(res)) {\n this.sendingData = (0,p_defer__WEBPACK_IMPORTED_MODULE_3__[\"default\"])();\n await res;\n this.sendingData.resolve();\n this.sendingData = undefined;\n }\n }\n }\n finally {\n this.sinkController.signal.removeEventListener('abort', abortListener);\n }\n this.log.trace('sink finished reading from source, write status is \"%s\"', this.writeStatus);\n if (this.writeStatus === 'writing') {\n this.writeStatus = 'closing';\n this.log.trace('send close write to remote');\n await this.sendCloseWrite({\n signal: AbortSignal.timeout(this.sendCloseWriteTimeout)\n });\n this.writeStatus = 'closed';\n }\n this.onSinkEnd();\n }\n catch (err) {\n this.log.trace('sink ended with error, calling abort with error', err);\n this.abort(err);\n throw err;\n }\n finally {\n this.log.trace('resolve sink end');\n this.sinkEnd.resolve();\n }\n }\n onSourceEnd(err) {\n if (this.timeline.closeRead != null) {\n return;\n }\n this.timeline.closeRead = Date.now();\n this.readStatus = 'closed';\n if (err != null && this.endErr == null) {\n this.endErr = err;\n }\n this.onCloseRead?.();\n if (this.timeline.closeWrite != null) {\n this.log.trace('source and sink ended');\n this.timeline.close = Date.now();\n if (this.status !== 'aborted' && this.status !== 'reset') {\n this.status = 'closed';\n }\n if (this.onEnd != null) {\n this.onEnd(this.endErr);\n }\n this.closed.resolve();\n }\n else {\n this.log.trace('source ended, waiting for sink to end');\n }\n }\n onSinkEnd(err) {\n if (this.timeline.closeWrite != null) {\n return;\n }\n this.timeline.closeWrite = Date.now();\n this.writeStatus = 'closed';\n if (err != null && this.endErr == null) {\n this.endErr = err;\n }\n this.onCloseWrite?.();\n if (this.timeline.closeRead != null) {\n this.log.trace('sink and source ended');\n this.timeline.close = Date.now();\n if (this.status !== 'aborted' && this.status !== 'reset') {\n this.status = 'closed';\n }\n if (this.onEnd != null) {\n this.onEnd(this.endErr);\n }\n this.closed.resolve();\n }\n else {\n this.log.trace('sink ended, waiting for source to end');\n }\n }\n // Close for both Reading and Writing\n async close(options) {\n this.log.trace('closing gracefully');\n this.status = 'closing';\n // wait for read and write ends to close\n await (0,race_signal__WEBPACK_IMPORTED_MODULE_1__.raceSignal)(Promise.all([\n this.closeWrite(options),\n this.closeRead(options),\n this.closed.promise\n ]), options?.signal);\n this.status = 'closed';\n this.log.trace('closed gracefully');\n }\n async closeRead(options = {}) {\n if (this.readStatus === 'closing' || this.readStatus === 'closed') {\n return;\n }\n this.log.trace('closing readable end of stream with starting read status \"%s\"', this.readStatus);\n const readStatus = this.readStatus;\n this.readStatus = 'closing';\n if (this.status !== 'reset' && this.status !== 'aborted' && this.timeline.closeRead == null) {\n this.log.trace('send close read to remote');\n await this.sendCloseRead(options);\n }\n if (readStatus === 'ready') {\n this.log.trace('ending internal source queue with %d queued bytes', this.streamSource.readableLength);\n this.streamSource.end();\n }\n this.log.trace('closed readable end of stream');\n }\n async closeWrite(options = {}) {\n if (this.writeStatus === 'closing' || this.writeStatus === 'closed') {\n return;\n }\n this.log.trace('closing writable end of stream with starting write status \"%s\"', this.writeStatus);\n if (this.writeStatus === 'ready') {\n this.log.trace('sink was never sunk, sink an empty array');\n await (0,race_signal__WEBPACK_IMPORTED_MODULE_1__.raceSignal)(this.sink([]), options.signal);\n }\n if (this.writeStatus === 'writing') {\n // try to let sending outgoing data succeed\n if (this.sendingData != null) {\n await (0,race_signal__WEBPACK_IMPORTED_MODULE_1__.raceSignal)(this.sendingData.promise, options.signal);\n }\n // stop reading from the source passed to `.sink`\n this.log.trace('aborting source passed to .sink');\n this.sinkController.abort();\n await (0,race_signal__WEBPACK_IMPORTED_MODULE_1__.raceSignal)(this.sinkEnd.promise, options.signal);\n }\n this.writeStatus = 'closed';\n this.log.trace('closed writable end of stream');\n }\n /**\n * Close immediately for reading and writing and send a reset message (local\n * error)\n */\n abort(err) {\n if (this.status === 'closed' || this.status === 'aborted' || this.status === 'reset') {\n return;\n }\n this.log('abort with error', err);\n // try to send a reset message\n this.log('try to send reset to remote');\n const res = this.sendReset();\n if (isPromise(res)) {\n res.catch((err) => {\n this.log.error('error sending reset message', err);\n });\n }\n this.status = 'aborted';\n this.timeline.abort = Date.now();\n this._closeSinkAndSource(err);\n this.onAbort?.(err);\n }\n /**\n * Receive a reset message - close immediately for reading and writing (remote\n * error)\n */\n reset() {\n if (this.status === 'closed' || this.status === 'aborted' || this.status === 'reset') {\n return;\n }\n const err = new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CodeError('stream reset', ERR_STREAM_RESET);\n this.status = 'reset';\n this.timeline.reset = Date.now();\n this._closeSinkAndSource(err);\n this.onReset?.();\n }\n _closeSinkAndSource(err) {\n this._closeSink(err);\n this._closeSource(err);\n }\n _closeSink(err) {\n // if the sink function is running, cause it to end\n if (this.writeStatus === 'writing') {\n this.log.trace('end sink source');\n this.sinkController.abort();\n }\n this.onSinkEnd(err);\n }\n _closeSource(err) {\n // if the source is not ending, end it\n if (this.readStatus !== 'closing' && this.readStatus !== 'closed') {\n this.log.trace('ending source with %d bytes to be read by consumer', this.streamSource.readableLength);\n this.readStatus = 'closing';\n this.streamSource.end(err);\n }\n }\n /**\n * The remote closed for writing so we should expect to receive no more\n * messages\n */\n remoteCloseWrite() {\n if (this.readStatus === 'closing' || this.readStatus === 'closed') {\n this.log('received remote close write but local source is already closed');\n return;\n }\n this.log.trace('remote close write');\n this._closeSource();\n }\n /**\n * The remote closed for reading so we should not send any more\n * messages\n */\n remoteCloseRead() {\n if (this.writeStatus === 'closing' || this.writeStatus === 'closed') {\n this.log('received remote close read but local sink is already closed');\n return;\n }\n this.log.trace('remote close read');\n this._closeSink();\n }\n /**\n * The underlying muxer has closed, no more messages can be sent or will\n * be received, close immediately to free up resources\n */\n destroy() {\n if (this.status === 'closed' || this.status === 'aborted' || this.status === 'reset') {\n this.log('received destroy but we are already closed');\n return;\n }\n this.log.trace('stream destroyed');\n this._closeSinkAndSource();\n }\n /**\n * When an extending class reads data from it's implementation-specific source,\n * call this method to allow the stream consumer to read the data.\n */\n sourcePush(data) {\n this.streamSource.push(data);\n }\n /**\n * Returns the amount of unread data - can be used to prevent large amounts of\n * data building up when the stream consumer is too slow.\n */\n sourceReadableLength() {\n return this.streamSource.readableLength;\n }\n}\n//# sourceMappingURL=abstract-stream.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/abstract-stream.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/address-sort.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/address-sort.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ certifiedAddressesFirst: () => (/* binding */ certifiedAddressesFirst),\n/* harmony export */ circuitRelayAddressesLast: () => (/* binding */ circuitRelayAddressesLast),\n/* harmony export */ defaultAddressSort: () => (/* binding */ defaultAddressSort),\n/* harmony export */ publicAddressesFirst: () => (/* binding */ publicAddressesFirst)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr_matcher__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr-matcher */ \"./node_modules/@multiformats/multiaddr-matcher/dist/src/index.js\");\n/* harmony import */ var _multiaddr_is_private_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./multiaddr/is-private.js */ \"./node_modules/@libp2p/utils/dist/src/multiaddr/is-private.js\");\n/**\n * @packageDocumentation\n *\n * Provides strategies to sort a list of multiaddrs.\n *\n * @example\n *\n * ```typescript\n * import { publicAddressesFirst } from '@libp2p/utils/address-sort'\n * import { multiaddr } from '@multformats/multiaddr'\n *\n *\n * const addresses = [\n * multiaddr('/ip4/127.0.0.1/tcp/9000'),\n * multiaddr('/ip4/82.41.53.1/tcp/9000')\n * ].sort(publicAddressesFirst)\n *\n * console.info(addresses)\n * // ['/ip4/82.41.53.1/tcp/9000', '/ip4/127.0.0.1/tcp/9000']\n * ```\n */\n\n\n/**\n * Compare function for array.sort() that moves public addresses to the start\n * of the array.\n */\nfunction publicAddressesFirst(a, b) {\n const isAPrivate = (0,_multiaddr_is_private_js__WEBPACK_IMPORTED_MODULE_1__.isPrivate)(a.multiaddr);\n const isBPrivate = (0,_multiaddr_is_private_js__WEBPACK_IMPORTED_MODULE_1__.isPrivate)(b.multiaddr);\n if (isAPrivate && !isBPrivate) {\n return 1;\n }\n else if (!isAPrivate && isBPrivate) {\n return -1;\n }\n return 0;\n}\n/**\n * Compare function for array.sort() that moves certified addresses to the start\n * of the array.\n */\nfunction certifiedAddressesFirst(a, b) {\n if (a.isCertified && !b.isCertified) {\n return -1;\n }\n else if (!a.isCertified && b.isCertified) {\n return 1;\n }\n return 0;\n}\n/**\n * Compare function for array.sort() that moves circuit relay addresses to the\n * start of the array.\n */\nfunction circuitRelayAddressesLast(a, b) {\n const isACircuit = _multiformats_multiaddr_matcher__WEBPACK_IMPORTED_MODULE_0__.Circuit.exactMatch(a.multiaddr);\n const isBCircuit = _multiformats_multiaddr_matcher__WEBPACK_IMPORTED_MODULE_0__.Circuit.exactMatch(b.multiaddr);\n if (isACircuit && !isBCircuit) {\n return 1;\n }\n else if (!isACircuit && isBCircuit) {\n return -1;\n }\n return 0;\n}\nfunction defaultAddressSort(a, b) {\n const publicResult = publicAddressesFirst(a, b);\n if (publicResult !== 0) {\n return publicResult;\n }\n const relayResult = circuitRelayAddressesLast(a, b);\n if (relayResult !== 0) {\n return relayResult;\n }\n const certifiedResult = certifiedAddressesFirst(a, b);\n return certifiedResult;\n}\n//# sourceMappingURL=address-sort.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/address-sort.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/array-equals.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/array-equals.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ arrayEquals: () => (/* binding */ arrayEquals)\n/* harmony export */ });\n/**\n * @packageDocumentation\n *\n * Provides strategies ensure arrays are equivalent.\n *\n * @example\n *\n * ```typescript\n * import { arrayEquals } from '@libp2p/utils/array-equals'\n * import { multiaddr } from '@multformats/multiaddr'\n *\n * const ma1 = multiaddr('/ip4/127.0.0.1/tcp/9000'),\n * const ma2 = multiaddr('/ip4/82.41.53.1/tcp/9000')\n *\n * console.info(arrayEquals([ma1], [ma1])) // true\n * console.info(arrayEquals([ma1], [ma2])) // false\n * ```\n */\n/**\n * Verify if two arrays of non primitive types with the \"equals\" function are equal.\n * Compatible with multiaddr, peer-id and others.\n */\nfunction arrayEquals(a, b) {\n const sort = (a, b) => a.toString().localeCompare(b.toString());\n if (a.length !== b.length) {\n return false;\n }\n b.sort(sort);\n return a.sort(sort).every((item, index) => b[index].equals(item));\n}\n//# sourceMappingURL=array-equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/array-equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/close-source.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/close-source.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ closeSource: () => (/* binding */ closeSource)\n/* harmony export */ });\n/* harmony import */ var get_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! get-iterator */ \"./node_modules/get-iterator/dist/src/index.js\");\n/* harmony import */ var _is_promise_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-promise.js */ \"./node_modules/@libp2p/utils/dist/src/is-promise.js\");\n\n\nfunction closeSource(source, log) {\n const res = (0,get_iterator__WEBPACK_IMPORTED_MODULE_0__.getIterator)(source).return?.();\n if ((0,_is_promise_js__WEBPACK_IMPORTED_MODULE_1__.isPromise)(res)) {\n res.catch(err => {\n log.error('could not cause iterator to return', err);\n });\n }\n}\n//# sourceMappingURL=close-source.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/close-source.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/is-promise.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/is-promise.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isPromise: () => (/* binding */ isPromise)\n/* harmony export */ });\nfunction isPromise(thing) {\n if (thing == null) {\n return false;\n }\n return typeof thing.then === 'function' &&\n typeof thing.catch === 'function' &&\n typeof thing.finally === 'function';\n}\n//# sourceMappingURL=is-promise.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/is-promise.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/multiaddr/is-private.js":
|
||
/*!*********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/multiaddr/is-private.js ***!
|
||
\*********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isPrivate: () => (/* binding */ isPrivate)\n/* harmony export */ });\n/* harmony import */ var _private_ip_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../private-ip.js */ \"./node_modules/@libp2p/utils/dist/src/private-ip.js\");\n\n/**\n * Check if a given multiaddr has a private address.\n */\nfunction isPrivate(ma) {\n try {\n const { address } = ma.nodeAddress();\n return Boolean((0,_private_ip_js__WEBPACK_IMPORTED_MODULE_0__.isPrivateIp)(address));\n }\n catch {\n return true;\n }\n}\n//# sourceMappingURL=is-private.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/multiaddr/is-private.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/peer-queue.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/peer-queue.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerQueue: () => (/* binding */ PeerQueue)\n/* harmony export */ });\n/* harmony import */ var _queue_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./queue/index.js */ \"./node_modules/@libp2p/utils/dist/src/queue/index.js\");\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\n/**\n * Extends Queue to add support for querying queued jobs by peer id\n */\nclass PeerQueue extends _queue_index_js__WEBPACK_IMPORTED_MODULE_0__.Queue {\n has(peerId) {\n return this.find(peerId) != null;\n }\n find(peerId) {\n return this.queue.find(job => {\n return peerId.equals(job.options.peerId);\n });\n }\n}\n//# sourceMappingURL=peer-queue.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/peer-queue.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/private-ip.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/private-ip.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isPrivateIp: () => (/* binding */ isPrivateIp)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/is-ip */ \"./node_modules/@chainsafe/is-ip/lib/is-ip.js\");\n/* harmony import */ var netmask__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! netmask */ \"./node_modules/netmask/lib/netmask.js\");\n\n\nconst PRIVATE_IP_RANGES = [\n '0.0.0.0/8',\n '10.0.0.0/8',\n '100.64.0.0/10',\n '127.0.0.0/8',\n '169.254.0.0/16',\n '172.16.0.0/12',\n '192.0.0.0/24',\n '192.0.0.0/29',\n '192.0.0.8/32',\n '192.0.0.9/32',\n '192.0.0.10/32',\n '192.0.0.170/32',\n '192.0.0.171/32',\n '192.0.2.0/24',\n '192.31.196.0/24',\n '192.52.193.0/24',\n '192.88.99.0/24',\n '192.168.0.0/16',\n '192.175.48.0/24',\n '198.18.0.0/15',\n '198.51.100.0/24',\n '203.0.113.0/24',\n '240.0.0.0/4',\n '255.255.255.255/32'\n];\nconst NETMASK_RANGES = PRIVATE_IP_RANGES.map(ipRange => new netmask__WEBPACK_IMPORTED_MODULE_1__.Netmask(ipRange));\nfunction ipv4Check(ipAddr) {\n for (const r of NETMASK_RANGES) {\n if (r.contains(ipAddr))\n return true;\n }\n return false;\n}\nfunction ipv6Check(ipAddr) {\n return /^::$/.test(ipAddr) ||\n /^::1$/.test(ipAddr) ||\n /^::f{4}:([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$/.test(ipAddr) ||\n /^::f{4}:0.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$/.test(ipAddr) ||\n /^64:ff9b::([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$/.test(ipAddr) ||\n /^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||\n /^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||\n /^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||\n /^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||\n /^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ipAddr) ||\n /^f[c-d]([0-9a-fA-F]{2,2}):/i.test(ipAddr) ||\n /^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(ipAddr) ||\n /^ff([0-9a-fA-F]{2,2}):/i.test(ipAddr);\n}\nfunction isPrivateIp(ip) {\n if ((0,_chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__.isIPv4)(ip))\n return ipv4Check(ip);\n else if ((0,_chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__.isIPv6)(ip))\n return ipv6Check(ip);\n else\n return undefined;\n}\n//# sourceMappingURL=private-ip.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/private-ip.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/queue/index.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/queue/index.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Queue: () => (/* binding */ Queue)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/event-target.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var race_event__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! race-event */ \"./node_modules/race-event/dist/src/index.js\");\n/* harmony import */ var _job_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./job.js */ \"./node_modules/@libp2p/utils/dist/src/queue/job.js\");\n\n\n\n\n// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nfunction lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = Math.trunc(count / 2);\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\n/**\n * Heavily influence by `p-queue` with the following differences:\n *\n * 1. Items remain at the head of the queue while they are running so `queue.size` includes `queue.pending` items - this is so interested parties can join the results of a queue item while it is running\n * 2. The options for a job are stored separately to the job in order for them to be modified while they are still in the queue\n */\nclass Queue extends _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.TypedEventEmitter {\n concurrency;\n queue;\n pending;\n constructor(init = {}) {\n super();\n this.concurrency = init.concurrency ?? Number.POSITIVE_INFINITY;\n this.pending = 0;\n if (init.metricName != null) {\n init.metrics?.registerMetricGroup(init.metricName, {\n calculate: () => {\n return {\n size: this.queue.length,\n running: this.pending,\n queued: this.queue.length - this.pending\n };\n }\n });\n }\n this.queue = [];\n }\n tryToStartAnother() {\n if (this.size === 0) {\n // do this in the microtask queue so all job recipients receive the\n // result before the \"empty\" event fires\n queueMicrotask(() => {\n this.safeDispatchEvent('empty');\n });\n if (this.running === 0) {\n // do this in the microtask queue so all job recipients receive the\n // result before the \"idle\" event fires\n queueMicrotask(() => {\n this.safeDispatchEvent('idle');\n });\n }\n return false;\n }\n if (this.pending < this.concurrency) {\n let job;\n for (const j of this.queue) {\n if (j.status === 'queued') {\n job = j;\n break;\n }\n }\n if (job == null) {\n return false;\n }\n this.safeDispatchEvent('active');\n this.pending++;\n job.run()\n .finally(() => {\n // remove the job from the queue\n for (let i = 0; i < this.queue.length; i++) {\n if (this.queue[i] === job) {\n this.queue.splice(i, 1);\n break;\n }\n }\n this.pending--;\n this.tryToStartAnother();\n this.safeDispatchEvent('next');\n });\n return true;\n }\n return false;\n }\n enqueue(job) {\n if (this.queue[this.size - 1]?.priority >= job.priority) {\n this.queue.push(job);\n return;\n }\n const index = lowerBound(this.queue, job, (a, b) => b.priority - a.priority);\n this.queue.splice(index, 0, job);\n }\n /**\n * Adds a sync or async task to the queue. Always returns a promise.\n */\n async add(fn, options) {\n options?.signal?.throwIfAborted();\n const job = new _job_js__WEBPACK_IMPORTED_MODULE_3__.Job(fn, options, options?.priority);\n const p = job.join(options)\n .then(result => {\n this.safeDispatchEvent('completed', { detail: result });\n this.safeDispatchEvent('success', { detail: { job, result } });\n return result;\n })\n .catch(err => {\n if (job.status === 'queued') {\n // job was aborted before it started - remove the job from the queue\n for (let i = 0; i < this.queue.length; i++) {\n if (this.queue[i] === job) {\n this.queue.splice(i, 1);\n break;\n }\n }\n }\n this.safeDispatchEvent('error', { detail: err });\n this.safeDispatchEvent('failure', { detail: { job, error: err } });\n throw err;\n });\n this.enqueue(job);\n this.safeDispatchEvent('add');\n this.tryToStartAnother();\n return p;\n }\n /**\n * Clear the queue\n */\n clear() {\n this.queue.splice(0, this.queue.length);\n }\n /**\n * Abort all jobs in the queue and clear it\n */\n abort() {\n this.queue.forEach(job => {\n job.abort(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.AbortError());\n });\n this.clear();\n }\n /**\n * Can be called multiple times. Useful if you for example add additional items at a later time.\n *\n * @returns A promise that settles when the queue becomes empty.\n */\n async onEmpty(options) {\n // Instantly resolve if the queue is empty\n if (this.size === 0) {\n return;\n }\n await (0,race_event__WEBPACK_IMPORTED_MODULE_1__.raceEvent)(this, 'empty', options?.signal);\n }\n /**\n * @returns A promise that settles when the queue size is less than the given\n * limit: `queue.size < limit`.\n *\n * If you want to avoid having the queue grow beyond a certain size you can\n * `await queue.onSizeLessThan()` before adding a new item.\n *\n * Note that this only limits the number of items waiting to start. There\n * could still be up to `concurrency` jobs already running that this call does\n * not include in its calculation.\n */\n async onSizeLessThan(limit, options) {\n // Instantly resolve if the queue is empty.\n if (this.size < limit) {\n return;\n }\n await (0,race_event__WEBPACK_IMPORTED_MODULE_1__.raceEvent)(this, 'next', options?.signal, {\n filter: () => this.size < limit\n });\n }\n /**\n * The difference with `.onEmpty` is that `.onIdle` guarantees that all work\n * from the queue has finished. `.onEmpty` merely signals that the queue is\n * empty, but it could mean that some promises haven't completed yet.\n *\n * @returns A promise that settles when the queue becomes empty, and all\n * promises have completed; `queue.size === 0 && queue.pending === 0`.\n */\n async onIdle(options) {\n // Instantly resolve if none pending and if nothing else is queued\n if (this.pending === 0 && this.size === 0) {\n return;\n }\n await (0,race_event__WEBPACK_IMPORTED_MODULE_1__.raceEvent)(this, 'idle', options?.signal);\n }\n /**\n * Size of the queue including running items\n */\n get size() {\n return this.queue.length;\n }\n /**\n * The number of queued items waiting to run.\n */\n get queued() {\n return this.queue.length - this.pending;\n }\n /**\n * The number of items currently running.\n */\n get running() {\n return this.pending;\n }\n /**\n * Returns an async generator that makes it easy to iterate over the results\n * of jobs added to the queue.\n *\n * The generator will end when the queue becomes idle, that is there are no\n * jobs running and no jobs that have yet to run.\n *\n * If you need to keep the queue open indefinitely, consider using it-pushable\n * instead.\n */\n async *toGenerator(options) {\n options?.signal?.throwIfAborted();\n const stream = (0,it_pushable__WEBPACK_IMPORTED_MODULE_0__.pushable)({\n objectMode: true\n });\n const cleanup = (err) => {\n if (err != null) {\n this.abort();\n }\n else {\n this.clear();\n }\n stream.end(err);\n };\n const onQueueJobComplete = (evt) => {\n if (evt.detail != null) {\n stream.push(evt.detail);\n }\n };\n const onQueueError = (evt) => {\n cleanup(evt.detail);\n };\n const onQueueIdle = () => {\n cleanup();\n };\n // clear the queue and throw if the query is aborted\n const onSignalAbort = () => {\n cleanup(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CodeError('Queue aborted', 'ERR_QUEUE_ABORTED'));\n };\n // add listeners\n this.addEventListener('completed', onQueueJobComplete);\n this.addEventListener('error', onQueueError);\n this.addEventListener('idle', onQueueIdle);\n options?.signal?.addEventListener('abort', onSignalAbort);\n try {\n yield* stream;\n }\n finally {\n // remove listeners\n this.removeEventListener('completed', onQueueJobComplete);\n this.removeEventListener('error', onQueueError);\n this.removeEventListener('idle', onQueueIdle);\n options?.signal?.removeEventListener('abort', onSignalAbort);\n // empty the queue for when the user has broken out of a loop early\n cleanup();\n }\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/queue/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/queue/job.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/queue/job.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Job: () => (/* binding */ Job)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/events.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var race_signal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! race-signal */ \"./node_modules/race-signal/dist/src/index.js\");\n/* harmony import */ var _recipient_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./recipient.js */ \"./node_modules/@libp2p/utils/dist/src/queue/recipient.js\");\n\n\n\n/**\n * Returns a random string\n */\nfunction randomId() {\n return `${(parseInt(String(Math.random() * 1e9), 10)).toString()}${Date.now()}`;\n}\nclass Job {\n id;\n fn;\n options;\n priority;\n recipients;\n status;\n timeline;\n controller;\n constructor(fn, options, priority = 0) {\n this.id = randomId();\n this.status = 'queued';\n this.fn = fn;\n this.priority = priority;\n this.options = options;\n this.recipients = [];\n this.timeline = {\n created: Date.now()\n };\n this.controller = new AbortController();\n (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.setMaxListeners)(Infinity, this.controller.signal);\n this.onAbort = this.onAbort.bind(this);\n }\n abort(err) {\n this.controller.abort(err);\n }\n onAbort() {\n const allAborted = this.recipients.reduce((acc, curr) => {\n return acc && (curr.signal?.aborted === true);\n }, true);\n // if all recipients have aborted the job, actually abort the job\n if (allAborted) {\n this.controller.abort(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.AbortError());\n this.cleanup();\n }\n }\n async join(options = {}) {\n const recipient = new _recipient_js__WEBPACK_IMPORTED_MODULE_3__.JobRecipient((new Error('where')).stack, options.signal);\n this.recipients.push(recipient);\n options.signal?.addEventListener('abort', this.onAbort);\n return recipient.deferred.promise;\n }\n async run() {\n this.status = 'running';\n this.timeline.started = Date.now();\n try {\n this.controller.signal.throwIfAborted();\n const result = await (0,race_signal__WEBPACK_IMPORTED_MODULE_0__.raceSignal)(this.fn({\n ...(this.options ?? {}),\n signal: this.controller.signal\n }), this.controller.signal);\n this.recipients.forEach(recipient => {\n recipient.deferred.resolve(result);\n });\n this.status = 'complete';\n }\n catch (err) {\n this.recipients.forEach(recipient => {\n recipient.deferred.reject(err);\n });\n this.status = 'errored';\n }\n finally {\n this.timeline.finished = Date.now();\n this.cleanup();\n }\n }\n cleanup() {\n this.recipients.forEach(recipient => {\n recipient.cleanup();\n recipient.signal?.removeEventListener('abort', this.onAbort);\n });\n }\n}\n//# sourceMappingURL=job.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/queue/job.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/queue/recipient.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/queue/recipient.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ JobRecipient: () => (/* binding */ JobRecipient)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n\n\nclass JobRecipient {\n deferred;\n signal;\n where;\n constructor(where, signal) {\n this.signal = signal;\n this.deferred = (0,p_defer__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n this.where = where;\n this.onAbort = this.onAbort.bind(this);\n this.signal?.addEventListener('abort', this.onAbort);\n }\n onAbort() {\n this.deferred.reject(this.signal?.reason ?? new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.AbortError());\n }\n cleanup() {\n this.signal?.removeEventListener('abort', this.onAbort);\n }\n}\n//# sourceMappingURL=recipient.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/queue/recipient.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/rate-limiter.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/rate-limiter.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RateLimiter: () => (/* binding */ RateLimiter)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var delay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! delay */ \"./node_modules/delay/index.js\");\n\n\nclass RateLimiter {\n memoryStorage;\n points;\n duration;\n blockDuration;\n execEvenly;\n execEvenlyMinDelayMs;\n keyPrefix;\n constructor(opts = {}) {\n this.points = opts.points ?? 4;\n this.duration = opts.duration ?? 1;\n this.blockDuration = opts.blockDuration ?? 0;\n this.execEvenly = opts.execEvenly ?? false;\n this.execEvenlyMinDelayMs = opts.execEvenlyMinDelayMs ?? (this.duration * 1000 / this.points);\n this.keyPrefix = opts.keyPrefix ?? 'rlflx';\n this.memoryStorage = new MemoryStorage();\n }\n async consume(key, pointsToConsume = 1, options = {}) {\n const rlKey = this.getKey(key);\n const secDuration = this._getKeySecDuration(options);\n let res = this.memoryStorage.incrby(rlKey, pointsToConsume, secDuration);\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n if (res.consumedPoints > this.points) {\n // Block only first time when consumed more than points\n if (this.blockDuration > 0 && res.consumedPoints <= (this.points + pointsToConsume)) {\n // Block key\n res = this.memoryStorage.set(rlKey, res.consumedPoints, this.blockDuration);\n }\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Rate limit exceeded', 'ERR_RATE_LIMIT_EXCEEDED', res);\n }\n else if (this.execEvenly && res.msBeforeNext > 0 && !res.isFirstInDuration) {\n // Execute evenly\n let delayMs = Math.ceil(res.msBeforeNext / (res.remainingPoints + 2));\n if (delayMs < this.execEvenlyMinDelayMs) {\n delayMs = res.consumedPoints * this.execEvenlyMinDelayMs;\n }\n await (0,delay__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(delayMs);\n }\n return res;\n }\n penalty(key, points = 1, options = {}) {\n const rlKey = this.getKey(key);\n const secDuration = this._getKeySecDuration(options);\n const res = this.memoryStorage.incrby(rlKey, points, secDuration);\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n return res;\n }\n reward(key, points = 1, options = {}) {\n const rlKey = this.getKey(key);\n const secDuration = this._getKeySecDuration(options);\n const res = this.memoryStorage.incrby(rlKey, -points, secDuration);\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n return res;\n }\n /**\n * Block any key for secDuration seconds\n *\n * @param key\n * @param secDuration\n */\n block(key, secDuration) {\n const msDuration = secDuration * 1000;\n const initPoints = this.points + 1;\n this.memoryStorage.set(this.getKey(key), initPoints, secDuration);\n return {\n remainingPoints: 0,\n msBeforeNext: msDuration === 0 ? -1 : msDuration,\n consumedPoints: initPoints,\n isFirstInDuration: false\n };\n }\n set(key, points, secDuration = 0) {\n const msDuration = (secDuration >= 0 ? secDuration : this.duration) * 1000;\n this.memoryStorage.set(this.getKey(key), points, secDuration);\n return {\n remainingPoints: 0,\n msBeforeNext: msDuration === 0 ? -1 : msDuration,\n consumedPoints: points,\n isFirstInDuration: false\n };\n }\n get(key) {\n const res = this.memoryStorage.get(this.getKey(key));\n if (res != null) {\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n }\n return res;\n }\n delete(key) {\n this.memoryStorage.delete(this.getKey(key));\n }\n _getKeySecDuration(options) {\n if (options?.customDuration != null && options.customDuration >= 0) {\n return options.customDuration;\n }\n return this.duration;\n }\n getKey(key) {\n return this.keyPrefix.length > 0 ? `${this.keyPrefix}:${key}` : key;\n }\n parseKey(rlKey) {\n return rlKey.substring(this.keyPrefix.length);\n }\n}\nclass MemoryStorage {\n storage;\n constructor() {\n this.storage = new Map();\n }\n incrby(key, value, durationSec) {\n const existing = this.storage.get(key);\n if (existing != null) {\n const msBeforeExpires = existing.expiresAt != null\n ? existing.expiresAt.getTime() - new Date().getTime()\n : -1;\n if (existing.expiresAt == null || msBeforeExpires > 0) {\n // Change value\n existing.value += value;\n return {\n remainingPoints: 0,\n msBeforeNext: msBeforeExpires,\n consumedPoints: existing.value,\n isFirstInDuration: false\n };\n }\n return this.set(key, value, durationSec);\n }\n return this.set(key, value, durationSec);\n }\n set(key, value, durationSec) {\n const durationMs = durationSec * 1000;\n const existing = this.storage.get(key);\n if (existing != null) {\n clearTimeout(existing.timeoutId);\n }\n const record = {\n value,\n expiresAt: durationMs > 0 ? new Date(Date.now() + durationMs) : undefined\n };\n this.storage.set(key, record);\n if (durationMs > 0) {\n record.timeoutId = setTimeout(() => {\n this.storage.delete(key);\n }, durationMs);\n if (record.timeoutId.unref != null) {\n record.timeoutId.unref();\n }\n }\n return {\n remainingPoints: 0,\n msBeforeNext: durationMs === 0 ? -1 : durationMs,\n consumedPoints: record.value,\n isFirstInDuration: true\n };\n }\n get(key) {\n const existing = this.storage.get(key);\n if (existing != null) {\n const msBeforeExpires = existing.expiresAt != null\n ? existing.expiresAt.getTime() - new Date().getTime()\n : -1;\n return {\n remainingPoints: 0,\n msBeforeNext: msBeforeExpires,\n consumedPoints: existing.value,\n isFirstInDuration: false\n };\n }\n }\n delete(key) {\n const record = this.storage.get(key);\n if (record != null) {\n if (record.timeoutId != null) {\n clearTimeout(record.timeoutId);\n }\n this.storage.delete(key);\n return true;\n }\n return false;\n }\n}\n//# sourceMappingURL=rate-limiter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/rate-limiter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/utils/dist/src/tracked-map.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@libp2p/utils/dist/src/tracked-map.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ trackedMap: () => (/* binding */ trackedMap)\n/* harmony export */ });\nclass TrackedMap extends Map {\n metric;\n constructor(init) {\n super();\n const { name, metrics } = init;\n this.metric = metrics.registerMetric(name);\n this.updateComponentMetric();\n }\n set(key, value) {\n super.set(key, value);\n this.updateComponentMetric();\n return this;\n }\n delete(key) {\n const deleted = super.delete(key);\n this.updateComponentMetric();\n return deleted;\n }\n clear() {\n super.clear();\n this.updateComponentMetric();\n }\n updateComponentMetric() {\n this.metric.update(this.size);\n }\n}\nfunction trackedMap(config) {\n const { name, metrics } = config;\n let map;\n if (metrics != null) {\n map = new TrackedMap({ name, metrics });\n }\n else {\n map = new Map();\n }\n return map;\n}\n//# sourceMappingURL=tracked-map.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/utils/dist/src/tracked-map.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/websockets/dist/src/constants.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/@libp2p/websockets/dist/src/constants.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CLOSE_TIMEOUT: () => (/* binding */ CLOSE_TIMEOUT),\n/* harmony export */ CODE_CIRCUIT: () => (/* binding */ CODE_CIRCUIT),\n/* harmony export */ CODE_P2P: () => (/* binding */ CODE_P2P),\n/* harmony export */ CODE_TCP: () => (/* binding */ CODE_TCP),\n/* harmony export */ CODE_WS: () => (/* binding */ CODE_WS),\n/* harmony export */ CODE_WSS: () => (/* binding */ CODE_WSS)\n/* harmony export */ });\n// p2p multi-address code\nconst CODE_P2P = 421;\nconst CODE_CIRCUIT = 290;\nconst CODE_TCP = 6;\nconst CODE_WS = 477;\nconst CODE_WSS = 478;\n// Time to wait for a connection to close gracefully before destroying it manually\nconst CLOSE_TIMEOUT = 500;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/websockets/dist/src/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/websockets/dist/src/filters.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@libp2p/websockets/dist/src/filters.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ all: () => (/* binding */ all),\n/* harmony export */ dnsWsOrWss: () => (/* binding */ dnsWsOrWss),\n/* harmony export */ dnsWss: () => (/* binding */ dnsWss),\n/* harmony export */ wss: () => (/* binding */ wss)\n/* harmony export */ });\n/* harmony import */ var _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/mafmt */ \"./node_modules/@multiformats/mafmt/dist/src/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@libp2p/websockets/dist/src/constants.js\");\n\n\nfunction all(multiaddrs) {\n return multiaddrs.filter((ma) => {\n if (ma.protoCodes().includes(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_CIRCUIT)) {\n return false;\n }\n const testMa = ma.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_P2P);\n return _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSockets.matches(testMa) ||\n _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSocketsSecure.matches(testMa);\n });\n}\nfunction wss(multiaddrs) {\n return multiaddrs.filter((ma) => {\n if (ma.protoCodes().includes(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_CIRCUIT)) {\n return false;\n }\n const testMa = ma.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_P2P);\n return _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSocketsSecure.matches(testMa);\n });\n}\nfunction dnsWss(multiaddrs) {\n return multiaddrs.filter((ma) => {\n if (ma.protoCodes().includes(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_CIRCUIT)) {\n return false;\n }\n const testMa = ma.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_P2P);\n return _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSocketsSecure.matches(testMa) &&\n _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.DNS.matches(testMa.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_TCP).decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_WSS));\n });\n}\nfunction dnsWsOrWss(multiaddrs) {\n return multiaddrs.filter((ma) => {\n if (ma.protoCodes().includes(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_CIRCUIT)) {\n return false;\n }\n const testMa = ma.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_P2P);\n // WS\n if (_multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSockets.matches(testMa)) {\n return _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.DNS.matches(testMa.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_TCP).decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_WS));\n }\n // WSS\n return _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSocketsSecure.matches(testMa) &&\n _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.DNS.matches(testMa.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_TCP).decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_WSS));\n });\n}\n//# sourceMappingURL=filters.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/websockets/dist/src/filters.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/websockets/dist/src/index.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@libp2p/websockets/dist/src/index.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ webSockets: () => (/* binding */ webSockets)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/transport/index.js\");\n/* harmony import */ var _multiformats_multiaddr_to_uri__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr-to-uri */ \"./node_modules/@multiformats/multiaddr-to-uri/dist/src/index.js\");\n/* harmony import */ var it_ws_client__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-ws/client */ \"./node_modules/it-ws/dist/src/client.js\");\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/* harmony import */ var wherearewe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! wherearewe */ \"./node_modules/wherearewe/src/index.js\");\n/* harmony import */ var _filters_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./filters.js */ \"./node_modules/@libp2p/websockets/dist/src/filters.js\");\n/* harmony import */ var _listener_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./listener.js */ \"./node_modules/@libp2p/websockets/dist/src/listener.browser.js\");\n/* harmony import */ var _socket_to_conn_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./socket-to-conn.js */ \"./node_modules/@libp2p/websockets/dist/src/socket-to-conn.js\");\n/**\n * @packageDocumentation\n *\n * A [libp2p transport](https://docs.libp2p.io/concepts/transports/overview/) based on [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API).\n *\n * @example\n *\n * ```TypeScript\n * import { createLibp2p } from 'libp2p'\n * import { webSockets } from '@libp2p/websockets'\n * import { multiaddr } from '@multiformats/multiaddr'\n *\n * const node = await createLibp2p({\n * transports: [\n * webSockets()\n * ]\n * //... other config\n * })\n * await node.start()\n *\n * const ma = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')\n * await node.dial(ma)\n * ```\n *\n * ## Filters\n *\n * When run in a browser by default this module will only connect to secure web socket addresses.\n *\n * To change this you should pass a filter to the factory function.\n *\n * You can create your own address filters for this transports, or rely in the filters [provided](./src/filters.js).\n *\n * The available filters are:\n *\n * - `filters.all`\n * - Returns all TCP and DNS based addresses, both with `ws` or `wss`.\n * - `filters.dnsWss`\n * - Returns all DNS based addresses with `wss`.\n * - `filters.dnsWsOrWss`\n * - Returns all DNS based addresses, both with `ws` or `wss`.\n *\n * @example Allow dialing insecure WebSockets\n *\n * ```TypeScript\n * import { createLibp2p } from 'libp2p'\n * import { webSockets } from '@libp2p/websockets'\n * import filters from '@libp2p/websockets/filters'\n *\n * const node = await createLibp2p({\n * transports: [\n * webSockets({\n * // connect to all sockets, even insecure ones\n * filter: filters.all\n * })\n * ]\n * })\n * ```\n */\n\n\n\n\n\n\n\n\n\nclass WebSockets {\n log;\n init;\n logger;\n constructor(components, init) {\n this.log = components.logger.forComponent('libp2p:websockets');\n this.logger = components.logger;\n this.init = init;\n }\n [Symbol.toStringTag] = '@libp2p/websockets';\n [_libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.transportSymbol] = true;\n async dial(ma, options) {\n this.log('dialing %s', ma);\n options = options ?? {};\n const socket = await this._connect(ma, options);\n const maConn = (0,_socket_to_conn_js__WEBPACK_IMPORTED_MODULE_4__.socketToMaConn)(socket, ma, {\n logger: this.logger\n });\n this.log('new outbound connection %s', maConn.remoteAddr);\n const conn = await options.upgrader.upgradeOutbound(maConn);\n this.log('outbound connection %s upgraded', maConn.remoteAddr);\n return conn;\n }\n async _connect(ma, options) {\n if (options?.signal?.aborted === true) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.AbortError();\n }\n const cOpts = ma.toOptions();\n this.log('dialing %s:%s', cOpts.host, cOpts.port);\n const errorPromise = (0,p_defer__WEBPACK_IMPORTED_MODULE_6__[\"default\"])();\n const rawSocket = (0,it_ws_client__WEBPACK_IMPORTED_MODULE_1__.connect)((0,_multiformats_multiaddr_to_uri__WEBPACK_IMPORTED_MODULE_0__.multiaddrToUri)(ma), this.init);\n rawSocket.socket.addEventListener('error', () => {\n // the WebSocket.ErrorEvent type doesn't actually give us any useful\n // information about what happened\n // https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event\n const err = new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.CodeError(`Could not connect to ${ma.toString()}`, 'ERR_CONNECTION_FAILED');\n this.log.error('connection error:', err);\n errorPromise.reject(err);\n });\n if (options.signal == null) {\n await Promise.race([rawSocket.connected(), errorPromise.promise]);\n this.log('connected %s', ma);\n return rawSocket;\n }\n // Allow abort via signal during connect\n let onAbort;\n const abort = new Promise((resolve, reject) => {\n onAbort = () => {\n reject(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.AbortError());\n rawSocket.close().catch(err => {\n this.log.error('error closing raw socket', err);\n });\n };\n // Already aborted?\n if (options?.signal?.aborted === true) {\n onAbort();\n return;\n }\n options?.signal?.addEventListener('abort', onAbort);\n });\n try {\n await Promise.race([abort, errorPromise.promise, rawSocket.connected()]);\n }\n finally {\n if (onAbort != null) {\n options?.signal?.removeEventListener('abort', onAbort);\n }\n }\n this.log('connected %s', ma);\n return rawSocket;\n }\n /**\n * Creates a Websockets listener. The provided `handler` function will be called\n * anytime a new incoming Connection has been successfully upgraded via\n * `upgrader.upgradeInbound`\n */\n createListener(options) {\n return (0,_listener_js__WEBPACK_IMPORTED_MODULE_7__.createListener)({\n logger: this.logger\n }, {\n ...this.init,\n ...options\n });\n }\n /**\n * Takes a list of `Multiaddr`s and returns only valid Websockets addresses.\n * By default, in a browser environment only DNS+WSS multiaddr is accepted,\n * while in a Node.js environment DNS+{WS, WSS} multiaddrs are accepted.\n */\n filter(multiaddrs) {\n multiaddrs = Array.isArray(multiaddrs) ? multiaddrs : [multiaddrs];\n if (this.init?.filter != null) {\n return this.init?.filter(multiaddrs);\n }\n // Browser\n if (wherearewe__WEBPACK_IMPORTED_MODULE_2__.isBrowser || wherearewe__WEBPACK_IMPORTED_MODULE_2__.isWebWorker) {\n return _filters_js__WEBPACK_IMPORTED_MODULE_8__.wss(multiaddrs);\n }\n return _filters_js__WEBPACK_IMPORTED_MODULE_8__.all(multiaddrs);\n }\n}\nfunction webSockets(init = {}) {\n return (components) => {\n return new WebSockets(components, init);\n };\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/websockets/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/websockets/dist/src/listener.browser.js":
|
||
/*!**********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/websockets/dist/src/listener.browser.js ***!
|
||
\**********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createListener: () => (/* binding */ createListener)\n/* harmony export */ });\nfunction createListener() {\n throw new Error('WebSocket Servers can not be created in the browser!');\n}\n//# sourceMappingURL=listener.browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/websockets/dist/src/listener.browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@libp2p/websockets/dist/src/socket-to-conn.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@libp2p/websockets/dist/src/socket-to-conn.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ socketToMaConn: () => (/* binding */ socketToMaConn)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@libp2p/websockets/dist/src/constants.js\");\n\n\n// Convert a stream into a MultiaddrConnection\n// https://github.com/libp2p/interface-transport#multiaddrconnection\nfunction socketToMaConn(stream, remoteAddr, options) {\n const log = options.logger.forComponent('libp2p:websockets:maconn');\n const maConn = {\n log,\n async sink(source) {\n try {\n await stream.sink((async function* () {\n for await (const buf of source) {\n if (buf instanceof Uint8Array) {\n yield buf;\n }\n else {\n yield buf.subarray();\n }\n }\n })());\n }\n catch (err) {\n if (err.type !== 'aborted') {\n log.error(err);\n }\n }\n },\n source: stream.source,\n remoteAddr,\n timeline: { open: Date.now() },\n async close(options = {}) {\n const start = Date.now();\n if (options.signal == null) {\n const signal = AbortSignal.timeout(_constants_js__WEBPACK_IMPORTED_MODULE_0__.CLOSE_TIMEOUT);\n options = {\n ...options,\n signal\n };\n }\n const listener = () => {\n const { host, port } = maConn.remoteAddr.toOptions();\n log('timeout closing stream to %s:%s after %dms, destroying it manually', host, port, Date.now() - start);\n this.abort(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Socket close timeout', 'ERR_SOCKET_CLOSE_TIMEOUT'));\n };\n options.signal?.addEventListener('abort', listener);\n try {\n await stream.close();\n }\n catch (err) {\n log.error('error closing WebSocket gracefully', err);\n this.abort(err);\n }\n finally {\n options.signal?.removeEventListener('abort', listener);\n maConn.timeline.close = Date.now();\n }\n },\n abort(err) {\n const { host, port } = maConn.remoteAddr.toOptions();\n log('timeout closing stream to %s:%s due to error', host, port, err);\n stream.destroy();\n maConn.timeline.close = Date.now();\n }\n };\n stream.socket.addEventListener('close', () => {\n // In instances where `close` was not explicitly called,\n // such as an iterable stream ending, ensure we have set the close\n // timeline\n if (maConn.timeline.close == null) {\n maConn.timeline.close = Date.now();\n }\n }, { once: true });\n return maConn;\n}\n//# sourceMappingURL=socket-to-conn.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@libp2p/websockets/dist/src/socket-to-conn.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/dns/dist/src/dns.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/@multiformats/dns/dist/src/dns.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DNS: () => (/* binding */ DNS)\n/* harmony export */ });\n/* harmony import */ var progress_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! progress-events */ \"./node_modules/progress-events/dist/src/index.js\");\n/* harmony import */ var _resolvers_default_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./resolvers/default.js */ \"./node_modules/@multiformats/dns/dist/src/resolvers/default.browser.js\");\n/* harmony import */ var _utils_cache_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/cache.js */ \"./node_modules/@multiformats/dns/dist/src/utils/cache.js\");\n/* harmony import */ var _utils_get_types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/get-types.js */ \"./node_modules/@multiformats/dns/dist/src/utils/get-types.js\");\n\n\n\n\nconst DEFAULT_ANSWER_CACHE_SIZE = 1000;\nclass DNS {\n resolvers;\n cache;\n constructor(init) {\n this.resolvers = {};\n this.cache = (0,_utils_cache_js__WEBPACK_IMPORTED_MODULE_2__.cache)(init.cacheSize ?? DEFAULT_ANSWER_CACHE_SIZE);\n Object.entries(init.resolvers ?? {}).forEach(([tld, resolver]) => {\n if (!Array.isArray(resolver)) {\n resolver = [resolver];\n }\n // convert `com` -> `com.`\n if (!tld.endsWith('.')) {\n tld = `${tld}.`;\n }\n this.resolvers[tld] = resolver;\n });\n // configure default resolver if none specified\n if (this.resolvers['.'] == null) {\n this.resolvers['.'] = (0,_resolvers_default_js__WEBPACK_IMPORTED_MODULE_1__.defaultResolver)();\n }\n }\n /**\n * Queries DNS resolvers for the passed record types for the passed domain.\n *\n * If cached records exist for all desired types they will be returned\n * instead.\n *\n * Any new responses will be added to the cache for subsequent requests.\n */\n async query(domain, options = {}) {\n const types = (0,_utils_get_types_js__WEBPACK_IMPORTED_MODULE_3__.getTypes)(options.types);\n const cached = options.cached !== false ? this.cache.get(domain, types) : undefined;\n if (cached != null) {\n options.onProgress?.(new progress_events__WEBPACK_IMPORTED_MODULE_0__.CustomProgressEvent('dns:cache', { detail: cached }));\n return cached;\n }\n const tld = `${domain.split('.').pop()}.`;\n const resolvers = (this.resolvers[tld] ?? this.resolvers['.']).sort(() => {\n return (Math.random() > 0.5) ? -1 : 1;\n });\n const errors = [];\n for (const resolver of resolvers) {\n // skip further resolutions if the user aborted the signal\n if (options.signal?.aborted === true) {\n break;\n }\n try {\n const result = await resolver(domain, {\n ...options,\n types\n });\n for (const answer of result.Answer) {\n this.cache.add(domain, answer);\n }\n return result;\n }\n catch (err) {\n errors.push(err);\n options.onProgress?.(new progress_events__WEBPACK_IMPORTED_MODULE_0__.CustomProgressEvent('dns:error', { detail: err }));\n }\n }\n if (errors.length === 1) {\n throw errors[0];\n }\n throw new AggregateError(errors, `DNS lookup of ${domain} ${types} failed`);\n }\n}\n//# sourceMappingURL=dns.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/dns/dist/src/dns.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/dns/dist/src/index.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@multiformats/dns/dist/src/index.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MAX_RECURSIVE_DEPTH: () => (/* binding */ MAX_RECURSIVE_DEPTH),\n/* harmony export */ RecordType: () => (/* binding */ RecordType),\n/* harmony export */ dns: () => (/* binding */ dns)\n/* harmony export */ });\n/* harmony import */ var _dns_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dns.js */ \"./node_modules/@multiformats/dns/dist/src/dns.js\");\n/**\n * @packageDocumentation\n *\n * Query DNS records using `node:dns`, DNS over HTTP and/or DNSJSON over HTTP.\n *\n * A list of publicly accessible servers can be found [here](https://github.com/curl/curl/wiki/DNS-over-HTTPS#publicly-available-servers).\n *\n * @example Using the default resolver\n *\n * ```TypeScript\n * import { dns } from '@multiformats/dns'\n *\n * const resolver = dns()\n *\n * // resolve A records with a 5s timeout\n * const result = await dns.query('google.com', {\n * signal: AbortSignal.timeout(5000)\n * })\n * ```\n *\n * @example Using per-TLD resolvers\n *\n * ```TypeScript\n * import { dns } from '@multiformats/dns'\n * import { dnsJsonOverHttps } from '@multiformats/dns/resolvers'\n *\n * const resolver = dns({\n * resolvers: {\n * // will only be used to resolve `.com` addresses\n * 'com.': dnsJsonOverHttps('https://cloudflare-dns.com/dns-query'),\n *\n * // this can also be an array, resolvers will be shuffled and tried in\n * // series\n * 'net.': [\n * dnsJsonOverHttps('https://dns.google/resolve'),\n * dnsJsonOverHttps('https://dns.pub/dns-query')\n * ],\n *\n * // will only be used to resolve all other addresses\n * '.': dnsJsonOverHttps('https://dnsforge.de/dns-query'),\n * }\n * })\n * ```\n *\n * @example Query for specific record types\n *\n * ```TypeScript\n * import { dns, RecordType } from '@multiformats/dns'\n *\n * const resolver = dns()\n *\n * // resolve only TXT records\n * const result = await dns.query('google.com', {\n * types: [\n * RecordType.TXT\n * ]\n * })\n * ```\n *\n * ## Caching\n *\n * Individual Aanswers are cached so. If you make a request, for which all\n * record types are cached, all values will be pulled from the cache.\n *\n * If any of the record types are not cached, a new request will be resolved as\n * if none of the records were cached, and the cache will be updated to include\n * the new results.\n *\n * @example Ignoring the cache\n *\n * ```TypeScript\n * import { dns, RecordType } from '@multiformats/dns'\n *\n * const resolver = dns()\n *\n * // do not used cached results, always resolve a new query\n * const result = await dns.query('google.com', {\n * cached: false\n * })\n * ```\n */\n\n/**\n * A subset of DNS Record Types\n *\n * @see https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4.\n */\nvar RecordType;\n(function (RecordType) {\n RecordType[RecordType[\"A\"] = 1] = \"A\";\n RecordType[RecordType[\"CNAME\"] = 5] = \"CNAME\";\n RecordType[RecordType[\"TXT\"] = 16] = \"TXT\";\n RecordType[RecordType[\"AAAA\"] = 28] = \"AAAA\";\n})(RecordType || (RecordType = {}));\n/**\n * The default maximum amount of recursion allowed during a query\n */\nconst MAX_RECURSIVE_DEPTH = 32;\nfunction dns(init = {}) {\n return new _dns_js__WEBPACK_IMPORTED_MODULE_0__.DNS(init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/dns/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/dns/dist/src/resolvers/default.browser.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/dns/dist/src/resolvers/default.browser.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ defaultResolver: () => (/* binding */ defaultResolver)\n/* harmony export */ });\n/* harmony import */ var _dns_json_over_https_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dns-json-over-https.js */ \"./node_modules/@multiformats/dns/dist/src/resolvers/dns-json-over-https.js\");\n\nfunction defaultResolver() {\n return [\n (0,_dns_json_over_https_js__WEBPACK_IMPORTED_MODULE_0__.dnsJsonOverHttps)('https://cloudflare-dns.com/dns-query'),\n (0,_dns_json_over_https_js__WEBPACK_IMPORTED_MODULE_0__.dnsJsonOverHttps)('https://dns.google/resolve')\n ];\n}\n//# sourceMappingURL=default.browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/dns/dist/src/resolvers/default.browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/dns/dist/src/resolvers/dns-json-over-https.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/dns/dist/src/resolvers/dns-json-over-https.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_QUERY_CONCURRENCY: () => (/* binding */ DEFAULT_QUERY_CONCURRENCY),\n/* harmony export */ dnsJsonOverHttps: () => (/* binding */ dnsJsonOverHttps)\n/* harmony export */ });\n/* harmony import */ var p_queue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! p-queue */ \"./node_modules/p-queue/dist/index.js\");\n/* harmony import */ var progress_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! progress-events */ \"./node_modules/progress-events/dist/src/index.js\");\n/* harmony import */ var _utils_get_types_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/get-types.js */ \"./node_modules/@multiformats/dns/dist/src/utils/get-types.js\");\n/* harmony import */ var _utils_to_dns_response_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/to-dns-response.js */ \"./node_modules/@multiformats/dns/dist/src/utils/to-dns-response.js\");\n/* eslint-env browser */\n\n\n\n\n/**\n * Browsers limit concurrent connections per host (~6), we don't want to exhaust\n * the limit so this value controls how many DNS queries can be in flight at\n * once.\n */\nconst DEFAULT_QUERY_CONCURRENCY = 4;\n/**\n * Uses the RFC 8427 'application/dns-json' content-type to resolve DNS queries.\n *\n * Supports and server that uses the same schema as Google's DNS over HTTPS\n * resolver.\n *\n * This resolver needs fewer dependencies than the regular DNS-over-HTTPS\n * resolver so can result in a smaller bundle size and consequently is preferred\n * for browser use.\n *\n * @see https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/make-api-requests/dns-json/\n * @see https://github.com/curl/curl/wiki/DNS-over-HTTPS#publicly-available-servers\n * @see https://dnsprivacy.org/public_resolvers/\n * @see https://datatracker.ietf.org/doc/html/rfc8427\n */\nfunction dnsJsonOverHttps(url, init = {}) {\n const httpQueue = new p_queue__WEBPACK_IMPORTED_MODULE_3__[\"default\"]({\n concurrency: init.queryConcurrency ?? DEFAULT_QUERY_CONCURRENCY\n });\n return async (fqdn, options = {}) => {\n const searchParams = new URLSearchParams();\n searchParams.set('name', fqdn);\n (0,_utils_get_types_js__WEBPACK_IMPORTED_MODULE_1__.getTypes)(options.types).forEach(type => {\n searchParams.append('type', type.toString());\n });\n options.onProgress?.(new progress_events__WEBPACK_IMPORTED_MODULE_0__.CustomProgressEvent('dns:query', { detail: fqdn }));\n // query DNS-JSON over HTTPS server\n const response = await httpQueue.add(async () => {\n const res = await fetch(`${url}?${searchParams}`, {\n headers: {\n accept: 'application/dns-json'\n },\n signal: options?.signal\n });\n if (res.status !== 200) {\n throw new Error(`Unexpected HTTP status: ${res.status} - ${res.statusText}`);\n }\n const response = (0,_utils_to_dns_response_js__WEBPACK_IMPORTED_MODULE_2__.toDNSResponse)(await res.json());\n options.onProgress?.(new progress_events__WEBPACK_IMPORTED_MODULE_0__.CustomProgressEvent('dns:response', { detail: response }));\n return response;\n }, {\n signal: options.signal\n });\n if (response == null) {\n throw new Error('No DNS response received');\n }\n return response;\n };\n}\n//# sourceMappingURL=dns-json-over-https.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/dns/dist/src/resolvers/dns-json-over-https.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/dns/dist/src/utils/cache.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@multiformats/dns/dist/src/utils/cache.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cache: () => (/* binding */ cache)\n/* harmony export */ });\n/* harmony import */ var hashlru__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! hashlru */ \"./node_modules/hashlru/index.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../index.js */ \"./node_modules/@multiformats/dns/dist/src/index.js\");\n/* harmony import */ var _to_dns_response_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./to-dns-response.js */ \"./node_modules/@multiformats/dns/dist/src/utils/to-dns-response.js\");\n\n\n\n/**\n * Time Aware Least Recent Used Cache\n *\n * @see https://arxiv.org/pdf/1801.00390\n */\nclass CachedAnswers {\n lru;\n constructor(maxSize) {\n this.lru = hashlru__WEBPACK_IMPORTED_MODULE_0__(maxSize);\n }\n get(fqdn, types) {\n let foundAllAnswers = true;\n const answers = [];\n for (const type of types) {\n const cached = this.getAnswers(fqdn, type);\n if (cached.length === 0) {\n foundAllAnswers = false;\n break;\n }\n answers.push(...cached);\n }\n if (foundAllAnswers) {\n return (0,_to_dns_response_js__WEBPACK_IMPORTED_MODULE_2__.toDNSResponse)({ answers });\n }\n }\n getAnswers(domain, type) {\n const key = `${domain.toLowerCase()}-${type}`;\n const answers = this.lru.get(key);\n if (answers != null) {\n const cachedAnswers = answers\n .filter((entry) => {\n return entry.expires > Date.now();\n })\n .map(({ expires, value }) => ({\n ...value,\n TTL: Math.round((expires - Date.now()) / 1000),\n type: _index_js__WEBPACK_IMPORTED_MODULE_1__.RecordType[value.type]\n }));\n if (cachedAnswers.length === 0) {\n this.lru.remove(key);\n }\n // @ts-expect-error hashlru stringifies stored types which turns enums\n // into strings, we convert back into enums above but tsc doesn't know\n return cachedAnswers;\n }\n return [];\n }\n add(domain, answer) {\n const key = `${domain.toLowerCase()}-${answer.type}`;\n const answers = this.lru.get(key) ?? [];\n answers.push({\n expires: Date.now() + ((answer.TTL ?? _to_dns_response_js__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TTL) * 1000),\n value: answer\n });\n this.lru.set(key, answers);\n }\n remove(domain, type) {\n const key = `${domain.toLowerCase()}-${type}`;\n this.lru.remove(key);\n }\n clear() {\n this.lru.clear();\n }\n}\n/**\n * Avoid sending multiple queries for the same hostname by caching results\n */\nfunction cache(size) {\n return new CachedAnswers(size);\n}\n//# sourceMappingURL=cache.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/dns/dist/src/utils/cache.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/dns/dist/src/utils/get-types.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@multiformats/dns/dist/src/utils/get-types.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getTypes: () => (/* binding */ getTypes)\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index.js */ \"./node_modules/@multiformats/dns/dist/src/index.js\");\n\nfunction getTypes(types) {\n const DEFAULT_TYPES = [\n _index_js__WEBPACK_IMPORTED_MODULE_0__.RecordType.A\n ];\n if (types == null) {\n return DEFAULT_TYPES;\n }\n if (Array.isArray(types)) {\n if (types.length === 0) {\n return DEFAULT_TYPES;\n }\n return types;\n }\n return [\n types\n ];\n}\n//# sourceMappingURL=get-types.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/dns/dist/src/utils/get-types.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/dns/dist/src/utils/to-dns-response.js":
|
||
/*!**************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/dns/dist/src/utils/to-dns-response.js ***!
|
||
\**************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_TTL: () => (/* binding */ DEFAULT_TTL),\n/* harmony export */ toDNSResponse: () => (/* binding */ toDNSResponse)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../index.js */ \"./node_modules/@multiformats/dns/dist/src/index.js\");\n\n\n/**\n * This TTL will be used if the remote service does not return one\n */\nconst DEFAULT_TTL = 60;\nfunction toDNSResponse(obj) {\n return {\n Status: obj.Status ?? 0,\n TC: obj.TC ?? obj.flag_tc ?? false,\n RD: obj.RD ?? obj.flag_rd ?? false,\n RA: obj.RA ?? obj.flag_ra ?? false,\n AD: obj.AD ?? obj.flag_ad ?? false,\n CD: obj.CD ?? obj.flag_cd ?? false,\n Question: (obj.Question ?? obj.questions ?? []).map((question) => {\n return {\n name: question.name,\n type: _index_js__WEBPACK_IMPORTED_MODULE_1__.RecordType[question.type]\n };\n }),\n Answer: (obj.Answer ?? obj.answers ?? []).map((answer) => {\n return {\n name: answer.name,\n type: _index_js__WEBPACK_IMPORTED_MODULE_1__.RecordType[answer.type],\n TTL: (answer.TTL ?? answer.ttl ?? DEFAULT_TTL),\n data: answer.data instanceof Uint8Array ? (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(answer.data) : answer.data\n };\n })\n };\n}\n//# sourceMappingURL=to-dns-response.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/dns/dist/src/utils/to-dns-response.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!****************************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/dns/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/mafmt/dist/src/index.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@multiformats/mafmt/dist/src/index.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Circuit: () => (/* binding */ Circuit),\n/* harmony export */ DNS: () => (/* binding */ DNS),\n/* harmony export */ DNS4: () => (/* binding */ DNS4),\n/* harmony export */ DNS6: () => (/* binding */ DNS6),\n/* harmony export */ DNSADDR: () => (/* binding */ DNSADDR),\n/* harmony export */ HTTP: () => (/* binding */ HTTP),\n/* harmony export */ HTTPS: () => (/* binding */ HTTPS),\n/* harmony export */ IP: () => (/* binding */ IP),\n/* harmony export */ IPFS: () => (/* binding */ IPFS),\n/* harmony export */ P2P: () => (/* binding */ P2P),\n/* harmony export */ P2PWebRTCDirect: () => (/* binding */ P2PWebRTCDirect),\n/* harmony export */ P2PWebRTCStar: () => (/* binding */ P2PWebRTCStar),\n/* harmony export */ QUIC: () => (/* binding */ QUIC),\n/* harmony export */ QUICV1: () => (/* binding */ QUICV1),\n/* harmony export */ Reliable: () => (/* binding */ Reliable),\n/* harmony export */ Stardust: () => (/* binding */ Stardust),\n/* harmony export */ TCP: () => (/* binding */ TCP),\n/* harmony export */ UDP: () => (/* binding */ UDP),\n/* harmony export */ UTP: () => (/* binding */ UTP),\n/* harmony export */ WebRTC: () => (/* binding */ WebRTC),\n/* harmony export */ WebRTCDirect: () => (/* binding */ WebRTCDirect),\n/* harmony export */ WebSocketStar: () => (/* binding */ WebSocketStar),\n/* harmony export */ WebSockets: () => (/* binding */ WebSockets),\n/* harmony export */ WebSocketsSecure: () => (/* binding */ WebSocketsSecure),\n/* harmony export */ WebTransport: () => (/* binding */ WebTransport)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n\n/*\n * Valid combinations\n */\nconst DNS4 = base('dns4');\nconst DNS6 = base('dns6');\nconst DNSADDR = base('dnsaddr');\nconst DNS = or(base('dns'), DNSADDR, DNS4, DNS6);\nconst IP = or(base('ip4'), base('ip6'));\nconst TCP = or(and(IP, base('tcp')), and(DNS, base('tcp')));\nconst UDP = and(IP, base('udp'));\nconst UTP = and(UDP, base('utp'));\nconst QUIC = and(UDP, base('quic'));\nconst QUICV1 = and(UDP, base('quic-v1'));\nconst _WebSockets = or(and(TCP, base('ws')), and(DNS, base('ws')));\nconst WebSockets = or(and(_WebSockets, base('p2p')), _WebSockets);\nconst _WebSocketsSecure = or(and(TCP, base('wss')), and(DNS, base('wss')), and(TCP, base('tls'), base('ws')), and(DNS, base('tls'), base('ws')));\nconst WebSocketsSecure = or(and(_WebSocketsSecure, base('p2p')), _WebSocketsSecure);\nconst HTTP = or(and(TCP, base('http')), and(IP, base('http')), and(DNS, base('http')));\nconst HTTPS = or(and(TCP, base('https')), and(IP, base('https')), and(DNS, base('https')));\nconst _WebRTCDirect = and(UDP, base('webrtc-direct'), base('certhash'));\nconst WebRTCDirect = or(and(_WebRTCDirect, base('p2p')), _WebRTCDirect);\nconst _WebTransport = and(QUICV1, base('webtransport'), base('certhash'), base('certhash'));\nconst WebTransport = or(and(_WebTransport, base('p2p')), _WebTransport);\n/**\n * @deprecated\n */\nconst P2PWebRTCStar = or(and(WebSockets, base('p2p-webrtc-star'), base('p2p')), and(WebSocketsSecure, base('p2p-webrtc-star'), base('p2p')), and(WebSockets, base('p2p-webrtc-star')), and(WebSocketsSecure, base('p2p-webrtc-star')));\nconst WebSocketStar = or(and(WebSockets, base('p2p-websocket-star'), base('p2p')), and(WebSocketsSecure, base('p2p-websocket-star'), base('p2p')), and(WebSockets, base('p2p-websocket-star')), and(WebSocketsSecure, base('p2p-websocket-star')));\n/**\n * @deprecated\n */\nconst P2PWebRTCDirect = or(and(HTTP, base('p2p-webrtc-direct'), base('p2p')), and(HTTPS, base('p2p-webrtc-direct'), base('p2p')), and(HTTP, base('p2p-webrtc-direct')), and(HTTPS, base('p2p-webrtc-direct')));\nconst Reliable = or(_WebSockets, _WebSocketsSecure, HTTP, HTTPS, P2PWebRTCStar, P2PWebRTCDirect, TCP, UTP, QUIC, DNS, WebRTCDirect, WebTransport);\n// Unlike ws-star, stardust can run over any transport thus removing the requirement for websockets (but don't even think about running a stardust server over webrtc-star ;) )\nconst Stardust = or(and(Reliable, base('p2p-stardust'), base('p2p')), and(Reliable, base('p2p-stardust')));\nconst _P2P = or(and(Reliable, base('p2p')), P2PWebRTCStar, P2PWebRTCDirect, WebRTCDirect, WebTransport, base('p2p'));\nconst _Circuit = or(and(_P2P, base('p2p-circuit'), _P2P), and(_P2P, base('p2p-circuit')), and(base('p2p-circuit'), _P2P), and(Reliable, base('p2p-circuit')), and(base('p2p-circuit'), Reliable), base('p2p-circuit'));\nconst CircuitRecursive = () => or(and(_Circuit, CircuitRecursive), _Circuit);\nconst Circuit = CircuitRecursive();\nconst P2P = or(and(Circuit, _P2P, Circuit), and(_P2P, Circuit), and(Circuit, _P2P), Circuit, _P2P);\nconst IPFS = P2P;\nconst WebRTC = or(and(Circuit, base('webrtc'), base('p2p')), and(Circuit, base('webrtc')), and(Reliable, base('webrtc'), base('p2p')), and(Reliable, base('webrtc')), base('webrtc'));\n/*\n * Validation funcs\n */\nfunction makeMatchesFunction(partialMatch) {\n function matches(a) {\n let ma;\n try {\n ma = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(a);\n }\n catch (err) { // catch error\n return false; // also if it's invalid it's probably not matching as well so return false\n }\n const out = partialMatch(ma.protoNames());\n if (out === null) {\n return false;\n }\n if (out === true || out === false) {\n return out;\n }\n return out.length === 0;\n }\n return matches;\n}\nfunction and(...args) {\n function partialMatch(a) {\n if (a.length < args.length) {\n return null;\n }\n let out = a;\n args.some((arg) => {\n out = typeof arg === 'function'\n ? arg().partialMatch(a)\n : arg.partialMatch(a);\n if (Array.isArray(out)) {\n a = out;\n }\n if (out === null) {\n return true;\n }\n return false;\n });\n return out;\n }\n return {\n toString: function () { return '{ ' + args.join(' ') + ' }'; },\n input: args,\n matches: makeMatchesFunction(partialMatch),\n partialMatch\n };\n}\nfunction or(...args) {\n function partialMatch(a) {\n let out = null;\n args.some((arg) => {\n const res = typeof arg === 'function'\n ? arg().partialMatch(a)\n : arg.partialMatch(a);\n if (res != null) {\n out = res;\n return true;\n }\n return false;\n });\n return out;\n }\n const result = {\n toString: function () { return '{ ' + args.join(' ') + ' }'; },\n input: args,\n matches: makeMatchesFunction(partialMatch),\n partialMatch\n };\n return result;\n}\nfunction base(n) {\n const name = n;\n function matches(a) {\n let ma;\n try {\n ma = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(a);\n }\n catch (err) { // catch error\n return false; // also if it's invalid it's probably not matching as well so return false\n }\n const pnames = ma.protoNames();\n if (pnames.length === 1 && pnames[0] === name) {\n return true;\n }\n return false;\n }\n function partialMatch(protos) {\n if (protos.length === 0) {\n return null;\n }\n if (protos[0] === name) {\n return protos.slice(1);\n }\n return null;\n }\n return {\n toString: function () { return name; },\n matches,\n partialMatch\n };\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/mafmt/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr-matcher/dist/src/index.js":
|
||
/*!************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr-matcher/dist/src/index.js ***!
|
||
\************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Circuit: () => (/* binding */ Circuit),\n/* harmony export */ DNS: () => (/* binding */ DNS),\n/* harmony export */ DNS4: () => (/* binding */ DNS4),\n/* harmony export */ DNS6: () => (/* binding */ DNS6),\n/* harmony export */ DNSADDR: () => (/* binding */ DNSADDR),\n/* harmony export */ HTTP: () => (/* binding */ HTTP),\n/* harmony export */ HTTPS: () => (/* binding */ HTTPS),\n/* harmony export */ IP: () => (/* binding */ IP),\n/* harmony export */ IP4: () => (/* binding */ IP4),\n/* harmony export */ IP6: () => (/* binding */ IP6),\n/* harmony export */ IP_OR_DOMAIN: () => (/* binding */ IP_OR_DOMAIN),\n/* harmony export */ P2P: () => (/* binding */ P2P),\n/* harmony export */ QUIC: () => (/* binding */ QUIC),\n/* harmony export */ QUICV1: () => (/* binding */ QUICV1),\n/* harmony export */ TCP: () => (/* binding */ TCP),\n/* harmony export */ UDP: () => (/* binding */ UDP),\n/* harmony export */ WebRTC: () => (/* binding */ WebRTC),\n/* harmony export */ WebRTCDirect: () => (/* binding */ WebRTCDirect),\n/* harmony export */ WebSockets: () => (/* binding */ WebSockets),\n/* harmony export */ WebSocketsSecure: () => (/* binding */ WebSocketsSecure),\n/* harmony export */ WebTransport: () => (/* binding */ WebTransport)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/is-ip */ \"./node_modules/@chainsafe/is-ip/lib/is-ip.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/dist/src/bases/base58.js\");\n/* harmony import */ var multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multiformats/bases/base64 */ \"./node_modules/multiformats/dist/src/bases/base64.js\");\n/**\n * @packageDocumentation\n *\n * This module exports various matchers that can be used to infer the type of a\n * passed multiaddr.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { DNS } from '@multiformats/multiaddr-matcher'\n *\n * const ma = multiaddr('/dnsaddr/example.org')\n *\n * DNS.matches(ma) // true - this is a multiaddr with a DNS address at the start\n * ```\n *\n * @example\n *\n * The default matching behaviour ignores any subsequent tuples in the multiaddr.\n * If you want stricter matching you can use `.exactMatch`:\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { DNS, Circuit } from '@multiformats/multiaddr-matcher'\n *\n * const ma = multiaddr('/dnsaddr/example.org/p2p/QmFoo/p2p-circuit/p2p/QmBar')\n *\n * DNS.exactMatch(ma) // false - this address has extra tuples after the DNS component\n * Circuit.matches(ma) // true\n * Circuit.exactMatch(ma) // true - the extra tuples are circuit relay related\n * ```\n */\n\n\n\n\n/**\n * Split a multiaddr into path components\n */\nconst toParts = (ma) => {\n return ma.toString().split('/').slice(1);\n};\nconst func = (fn) => {\n return {\n match: (vals) => {\n if (vals.length < 1) {\n return false;\n }\n if (fn(vals[0])) {\n return vals.slice(1);\n }\n return false;\n },\n pattern: 'fn'\n };\n};\nconst literal = (str) => {\n return {\n match: (vals) => func((val) => val === str).match(vals),\n pattern: str\n };\n};\nconst string = () => {\n return {\n match: (vals) => func((val) => typeof val === 'string').match(vals),\n pattern: '{string}'\n };\n};\nconst number = () => {\n return {\n match: (vals) => func((val) => !isNaN(parseInt(val))).match(vals),\n pattern: '{number}'\n };\n};\nconst peerId = () => {\n return {\n match: (vals) => {\n if (vals.length < 2) {\n return false;\n }\n if (vals[0] !== 'p2p' && vals[0] !== 'ipfs') {\n return false;\n }\n // Q is RSA, 1 is Ed25519 or Secp256k1\n if (vals[1].startsWith('Q') || vals[1].startsWith('1')) {\n try {\n multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_2__.base58btc.decode(`z${vals[1]}`);\n }\n catch (err) {\n return false;\n }\n }\n else {\n return false;\n }\n return vals.slice(2);\n },\n pattern: '/p2p/{peerid}'\n };\n};\nconst certhash = () => {\n return {\n match: (vals) => {\n if (vals.length < 2) {\n return false;\n }\n if (vals[0] !== 'certhash') {\n return false;\n }\n try {\n multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_3__.base64url.decode(vals[1]);\n }\n catch {\n return false;\n }\n return vals.slice(2);\n },\n pattern: '/certhash/{certhash}'\n };\n};\nconst optional = (matcher) => {\n return {\n match: (vals) => {\n const result = matcher.match(vals);\n if (result === false) {\n return vals;\n }\n return result;\n },\n pattern: `optional(${matcher.pattern})`\n };\n};\nconst or = (...matchers) => {\n return {\n match: (vals) => {\n let matches;\n for (const matcher of matchers) {\n const result = matcher.match(vals);\n // no match\n if (result === false) {\n continue;\n }\n // choose greediest matcher\n if (matches == null || result.length < matches.length) {\n matches = result;\n }\n }\n if (matches == null) {\n return false;\n }\n return matches;\n },\n pattern: `or(${matchers.map(m => m.pattern).join(', ')})`\n };\n};\nconst and = (...matchers) => {\n return {\n match: (vals) => {\n for (const matcher of matchers) {\n // pass what's left of the array\n const result = matcher.match(vals);\n // no match\n if (result === false) {\n return false;\n }\n vals = result;\n }\n return vals;\n },\n pattern: `and(${matchers.map(m => m.pattern).join(', ')})`\n };\n};\nfunction fmt(...matchers) {\n function match(ma) {\n let parts = toParts(ma);\n for (const matcher of matchers) {\n const result = matcher.match(parts);\n if (result === false) {\n return false;\n }\n parts = result;\n }\n return parts;\n }\n function matches(ma) {\n const result = match(ma);\n return result !== false;\n }\n function exactMatch(ma) {\n const result = match(ma);\n if (result === false) {\n return false;\n }\n return result.length === 0;\n }\n return {\n matches,\n exactMatch\n };\n}\n/**\n * DNS matchers\n */\nconst _DNS4 = and(literal('dns4'), string());\nconst _DNS6 = and(literal('dns6'), string());\nconst _DNSADDR = and(literal('dnsaddr'), string());\nconst _DNS = and(literal('dns'), string());\n/**\n * Matches dns4 addresses.\n *\n * Use {@link DNS DNS} instead to match any type of DNS address.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { DNS4 } from '@multiformats/multiaddr-matcher'\n *\n * DNS4.matches(multiaddr('/dns4/example.org')) // true\n * ```\n */\nconst DNS4 = fmt(_DNS4);\n/**\n * Matches dns6 addresses.\n *\n * Use {@link DNS DNS} instead to match any type of DNS address.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { DNS6 } from '@multiformats/multiaddr-matcher'\n *\n * DNS6.matches(multiaddr('/dns6/example.org')) // true\n * ```\n */\nconst DNS6 = fmt(_DNS6);\n/**\n * Matches dnsaddr addresses.\n *\n * Use {@link DNS DNS} instead to match any type of DNS address.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { DNSADDR } from '@multiformats/multiaddr-matcher'\n *\n * DNSADDR.matches(multiaddr('/dnsaddr/example.org')) // true\n * ```\n */\nconst DNSADDR = fmt(_DNSADDR);\n/**\n * Matches any dns address.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { DNS } from '@multiformats/multiaddr-matcher'\n *\n * DNS.matches(multiaddr('/dnsaddr/example.org')) // true\n * DNS.matches(multiaddr('/dns4/example.org')) // true\n * DNS.matches(multiaddr('/dns6/example.org')) // true\n * ```\n */\nconst DNS = fmt(or(_DNS, _DNSADDR, _DNS4, _DNS6));\nconst _IP4 = and(literal('ip4'), func(_chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__.isIPv4));\nconst _IP6 = and(literal('ip6'), func(_chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__.isIPv6));\nconst _IP = or(_IP4, _IP6);\nconst _IP_OR_DOMAIN = or(_IP, _DNS, _DNS4, _DNS6, _DNSADDR);\n/**\n * A matcher for addresses that start with IP or DNS tuples.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { IP_OR_DOMAIN } from '@multiformats/multiaddr-matcher'\n *\n * IP_OR_DOMAIN.matches(multiaddr('/ip4/123.123.123.123/p2p/QmFoo')) // true\n * IP_OR_DOMAIN.matches(multiaddr('/dns/example.com/p2p/QmFoo')) // true\n * IP_OR_DOMAIN.matches(multiaddr('/p2p/QmFoo')) // false\n * ```\n */\nconst IP_OR_DOMAIN = fmt(_IP_OR_DOMAIN);\n/**\n * Matches ip4 addresses.\n *\n * Use {@link IP IP} instead to match any ip4/ip6 address.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { IP4 } from '@multiformats/multiaddr-matcher'\n *\n * const ma = multiaddr('/ip4/123.123.123.123')\n *\n * IP4.matches(ma) // true\n * ```\n */\nconst IP4 = fmt(_IP4);\n/**\n * Matches ip6 addresses.\n *\n * Use {@link IP IP} instead to match any ip4/ip6 address.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { IP6 } from '@multiformats/multiaddr-matcher'\n *\n * const ma = multiaddr('/ip6/fe80::1cc1:a3b8:322f:cf22')\n *\n * IP6.matches(ma) // true\n * ```\n */\nconst IP6 = fmt(_IP6);\n/**\n * Matches ip4 or ip6 addresses.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { IP } from '@multiformats/multiaddr-matcher'\n *\n * IP.matches(multiaddr('/ip4/123.123.123.123')) // true\n * IP.matches(multiaddr('/ip6/fe80::1cc1:a3b8:322f:cf22')) // true\n * ```\n */\nconst IP = fmt(_IP);\nconst _TCP = and(_IP_OR_DOMAIN, literal('tcp'), number());\nconst _UDP = and(_IP_OR_DOMAIN, literal('udp'), number());\nconst TCP_OR_UDP = or(_TCP, _UDP);\n/**\n * Matches TCP addresses.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { TCP } from '@multiformats/multiaddr-matcher'\n *\n * TCP.matches(multiaddr('/ip4/123.123.123.123/tcp/1234')) // true\n * ```\n */\nconst TCP = fmt(_TCP);\n/**\n * Matches UDP addresses.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { UDP } from '@multiformats/multiaddr-matcher'\n *\n * UDP.matches(multiaddr('/ip4/123.123.123.123/udp/1234')) // true\n * ```\n */\nconst UDP = fmt(_UDP);\nconst _QUIC = and(_UDP, literal('quic'));\nconst _QUICV1 = and(_UDP, literal('quic-v1'));\nconst QUIC_V0_OR_V1 = or(_QUIC, _QUICV1);\n/**\n * Matches QUIC addresses.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { QUIC } from '@multiformats/multiaddr-matcher'\n *\n * QUIC.matches(multiaddr('/ip4/123.123.123.123/udp/1234/quic')) // true\n * ```\n */\nconst QUIC = fmt(_QUIC);\n/**\n * Matches QUICv1 addresses.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { QUICV1 } from '@multiformats/multiaddr-matcher'\n *\n * QUICV1.matches(multiaddr('/ip4/123.123.123.123/udp/1234/quic-v1')) // true\n * ```\n */\nconst QUICV1 = fmt(_QUICV1);\nconst _WEB = or(_IP_OR_DOMAIN, _TCP, _UDP, _QUIC, _QUICV1);\nconst _WebSockets = or(and(_WEB, literal('ws'), optional(peerId())));\n/**\n * Matches WebSocket addresses.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { WebSockets } from '@multiformats/multiaddr-matcher'\n *\n * WebSockets.matches(multiaddr('/ip4/123.123.123.123/tcp/1234/ws')) // true\n * ```\n */\nconst WebSockets = fmt(_WebSockets);\nconst _WebSocketsSecure = or(and(_WEB, literal('wss'), optional(peerId())), and(_WEB, literal('tls'), literal('ws'), optional(peerId())));\n/**\n * Matches secure WebSocket addresses.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { WebSocketsSecure } from '@multiformats/multiaddr-matcher'\n *\n * WebSocketsSecure.matches(multiaddr('/ip4/123.123.123.123/tcp/1234/wss')) // true\n * ```\n */\nconst WebSocketsSecure = fmt(_WebSocketsSecure);\nconst _WebRTCDirect = and(TCP_OR_UDP, literal('webrtc-direct'), certhash(), optional(certhash()), optional(peerId()));\n/**\n * Matches WebRTC-direct addresses.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { WebRTCDirect } from '@multiformats/multiaddr-matcher'\n *\n * WebRTCDirect.matches(multiaddr('/ip4/123.123.123.123/tcp/1234/p2p/QmFoo/webrtc-direct/certhash/u....')) // true\n * ```\n */\nconst WebRTCDirect = fmt(_WebRTCDirect);\nconst _WebTransport = and(_QUICV1, literal('webtransport'), certhash(), certhash(), optional(peerId()));\n/**\n * Matches WebTransport addresses.\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { WebRTCDirect } from '@multiformats/multiaddr-matcher'\n *\n * WebRTCDirect.matches(multiaddr('/ip4/123.123.123.123/udp/1234/quic-v1/webtransport/certhash/u..../certhash/u..../p2p/QmFoo')) // true\n * ```\n */\nconst WebTransport = fmt(_WebTransport);\nconst _P2P = or(_WebSockets, _WebSocketsSecure, and(_TCP, optional(peerId())), and(QUIC_V0_OR_V1, optional(peerId())), and(_IP_OR_DOMAIN, optional(peerId())), _WebRTCDirect, _WebTransport, peerId());\n/**\n * Matches peer addresses\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { P2P } from '@multiformats/multiaddr-matcher'\n *\n * P2P.matches(multiaddr('/ip4/123.123.123.123/tcp/1234/p2p/QmFoo')) // true\n * ```\n */\nconst P2P = fmt(_P2P);\nconst _Circuit = and(_P2P, literal('p2p-circuit'), peerId());\n/**\n * Matches circuit relay addresses\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { Circuit } from '@multiformats/multiaddr-matcher'\n *\n * Circuit.matches(multiaddr('/ip4/123.123.123.123/tcp/1234/p2p/QmRelay/p2p-circuit/p2p/QmTarget')) // true\n * ```\n */\nconst Circuit = fmt(_Circuit);\nconst _WebRTC = or(and(_P2P, literal('p2p-circuit'), literal('webrtc'), peerId()), and(_P2P, literal('webrtc'), optional(peerId())), literal('webrtc'));\n/**\n * Matches WebRTC addresses\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { WebRTC } from '@multiformats/multiaddr-matcher'\n *\n * WebRTC.matches(multiaddr('/ip4/123.123.123.123/tcp/1234/p2p/QmRelay/p2p-circuit/webrtc/p2p/QmTarget')) // true\n * ```\n */\nconst WebRTC = fmt(_WebRTC);\nconst _HTTP = or(and(_IP_OR_DOMAIN, literal('tcp'), number(), literal('http'), optional(peerId())), and(_IP_OR_DOMAIN, literal('http'), optional(peerId())));\n/**\n * Matches HTTP addresses\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { HTTP } from '@multiformats/multiaddr-matcher'\n *\n * HTTP.matches(multiaddr('/dns/example.org/http')) // true\n * ```\n */\nconst HTTP = fmt(_HTTP);\nconst _HTTPS = or(and(_IP_OR_DOMAIN, literal('tcp'), or(and(literal('443'), literal('http')), and(number(), literal('https'))), optional(peerId())), and(_IP_OR_DOMAIN, literal('tls'), literal('http'), optional(peerId())), and(_IP_OR_DOMAIN, literal('https'), optional(peerId())));\n/**\n * Matches HTTPS addresses\n *\n * @example\n *\n * ```ts\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { HTTP } from '@multiformats/multiaddr-matcher'\n *\n * HTTP.matches(multiaddr('/dns/example.org/tls/http')) // true\n * ```\n */\nconst HTTPS = fmt(_HTTPS);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr-matcher/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr-to-uri/dist/src/index.js":
|
||
/*!***********************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr-to-uri/dist/src/index.js ***!
|
||
\***********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ multiaddrToUri: () => (/* binding */ multiaddrToUri)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/**\n * @packageDocumentation\n *\n * This module allows easy conversion of Multiaddrs to string URIs.\n *\n * @example Converting multiaddrs to string URIs\n *\n * ```js\n * import { multiaddrToUri } from '@multiformats/multiaddr-to-uri'\n *\n * console.log(multiaddrToUri('/dnsaddr/protocol.ai/https'))\n * // -> https://protocol.ai\n *\n * console.log(multiaddrToUri('/ip4/127.0.0.1/tcp/8080'))\n * // -> http://127.0.0.1:8080\n *\n * console.log(multiaddrToUri('/ip4/127.0.0.1/tcp/8080', { assumeHttp: false }))\n * // -> tcp://127.0.0.1:8080\n * ```\n *\n * Note:\n *\n * - When `/tcp` is the last (terminating) protocol HTTP is assumed by default (implicit `assumeHttp: true`)\n * - this means produced URIs will start with `http://` instead of `tcp://`\n * - passing `{ assumeHttp: false }` disables this behavior\n * - Might be lossy - e.g. a DNSv6 multiaddr\n * - Can throw if the passed multiaddr:\n * - is not a valid multiaddr\n * - is not supported as a URI e.g. circuit\n */\n\nconst ASSUME_HTTP_CODES = [\n (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('tcp').code,\n (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('dns').code,\n (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('dnsaddr').code,\n (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('dns4').code,\n (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('dns6').code\n];\nfunction extractSNI(ma) {\n let sniProtoCode;\n try {\n sniProtoCode = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('sni').code;\n }\n catch (e) {\n // No SNI protocol in multiaddr\n return null;\n }\n for (const [proto, value] of ma) {\n if (proto === sniProtoCode && value !== undefined) {\n return value;\n }\n }\n return null;\n}\nfunction hasTLS(ma) {\n return ma.some(([proto, _]) => proto === (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('tls').code);\n}\nfunction interpretNext(headProtoCode, headProtoVal, restMa) {\n const interpreter = interpreters[(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)(headProtoCode).name];\n if (interpreter === undefined) {\n throw new Error(`Can't interpret protocol ${(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)(headProtoCode).name}`);\n }\n const restVal = interpreter(headProtoVal, restMa);\n if (headProtoCode === (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('ip6').code) {\n return `[${restVal}]`;\n }\n return restVal;\n}\nconst interpreters = {\n ip4: (value, restMa) => value,\n ip6: (value, restMa) => {\n if (restMa.length === 0) {\n return value;\n }\n return `[${value}]`;\n },\n tcp: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `tcp://${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}:${value}`;\n },\n udp: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `udp://${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}:${value}`;\n },\n dnsaddr: (value, restMa) => value,\n dns4: (value, restMa) => value,\n dns6: (value, restMa) => value,\n dns: (value, restMa) => value,\n ipfs: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}/ipfs/${value}`;\n },\n p2p: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}/p2p/${value}`;\n },\n http: (value, restMa) => {\n const maHasTLS = hasTLS(restMa);\n const sni = extractSNI(restMa);\n if (maHasTLS && sni !== null) {\n return `https://${sni}`;\n }\n const protocol = maHasTLS ? 'https://' : 'http://';\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n let baseVal = interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n // We are reinterpreting the base as http, so we need to remove the tcp:// if it's there\n baseVal = baseVal.replace('tcp://', '');\n return `${protocol}${baseVal}`;\n },\n tls: (value, restMa) => {\n // Noop, the parent context knows that it's tls. We don't need to do\n // anything here\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n },\n sni: (value, restMa) => {\n // Noop, the parent context uses the sni information, we don't need to do\n // anything here\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n },\n https: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n let baseVal = interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n // We are reinterpreting the base as http, so we need to remove the tcp:// if it's there\n baseVal = baseVal.replace('tcp://', '');\n return `https://${baseVal}`;\n },\n ws: (value, restMa) => {\n const maHasTLS = hasTLS(restMa);\n const sni = extractSNI(restMa);\n if (maHasTLS && sni !== null) {\n return `wss://${sni}`;\n }\n const protocol = maHasTLS ? 'wss://' : 'ws://';\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n let baseVal = interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n // We are reinterpreting the base, so we need to remove the tcp:// if it's there\n baseVal = baseVal.replace('tcp://', '');\n return `${protocol}${baseVal}`;\n },\n wss: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n let baseVal = interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n // We are reinterpreting the base as http, so we need to remove the tcp:// if it's there\n baseVal = baseVal.replace('tcp://', '');\n return `wss://${baseVal}`;\n },\n 'p2p-websocket-star': (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}/p2p-websocket-star`;\n },\n 'p2p-webrtc-star': (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}/p2p-webrtc-star`;\n },\n 'p2p-webrtc-direct': (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}/p2p-webrtc-direct`;\n }\n};\nfunction multiaddrToUri(input, opts) {\n const ma = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(input);\n const parts = ma.stringTuples();\n const head = parts.pop();\n if (head === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n const protocol = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)(head[0]);\n const interpreter = interpreters[protocol.name];\n if (interpreter == null) {\n throw new Error(`No interpreter found for ${protocol.name}`);\n }\n let uri = interpreter(head[1] ?? '', parts);\n if (opts?.assumeHttp !== false && ASSUME_HTTP_CODES.includes(head[0])) {\n // strip any declared protocol\n uri = uri.replace(/^.*:\\/\\//, '');\n if (head[1] === '443') {\n uri = `https://${uri}`;\n }\n else {\n uri = `http://${uri}`;\n }\n }\n if (uri.startsWith('http://') || uri.startsWith('https://')) {\n // this will strip default ports while keeping paths intact\n uri = new URL(uri).toString();\n // strip trailing slash, e.g. http://127.0.0.1/ -> http://127.0.0.1\n if (uri.endsWith('/')) {\n uri = uri.substring(0, uri.length - 1);\n }\n }\n return uri;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr-to-uri/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/dist/src/codec.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/dist/src/codec.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ParseError: () => (/* binding */ ParseError),\n/* harmony export */ bytesToMultiaddrParts: () => (/* binding */ bytesToMultiaddrParts),\n/* harmony export */ bytesToTuples: () => (/* binding */ bytesToTuples),\n/* harmony export */ cleanPath: () => (/* binding */ cleanPath),\n/* harmony export */ stringToMultiaddrParts: () => (/* binding */ stringToMultiaddrParts),\n/* harmony export */ tuplesToBytes: () => (/* binding */ tuplesToBytes)\n/* harmony export */ });\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _convert_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./convert.js */ \"./node_modules/@multiformats/multiaddr/dist/src/convert.js\");\n/* harmony import */ var _protocols_table_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./protocols-table.js */ \"./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js\");\n\n\n\n\n\nfunction stringToMultiaddrParts(str) {\n str = cleanPath(str);\n const tuples = [];\n const stringTuples = [];\n let path = null;\n const parts = str.split('/').slice(1);\n if (parts.length === 1 && parts[0] === '') {\n return {\n bytes: new Uint8Array(),\n string: '/',\n tuples: [],\n stringTuples: [],\n path: null\n };\n }\n for (let p = 0; p < parts.length; p++) {\n const part = parts[p];\n const proto = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_4__.getProtocol)(part);\n if (proto.size === 0) {\n tuples.push([proto.code]);\n stringTuples.push([proto.code]);\n // eslint-disable-next-line no-continue\n continue;\n }\n p++; // advance addr part\n if (p >= parts.length) {\n throw ParseError('invalid address: ' + str);\n }\n // if it's a path proto, take the rest\n if (proto.path === true) {\n // should we need to check each path part to see if it's a proto?\n // This would allow for other protocols to be added after a unix path,\n // however it would have issues if the path had a protocol name in the path\n path = cleanPath(parts.slice(p).join('/'));\n tuples.push([proto.code, (0,_convert_js__WEBPACK_IMPORTED_MODULE_3__.convertToBytes)(proto.code, path)]);\n stringTuples.push([proto.code, path]);\n break;\n }\n const bytes = (0,_convert_js__WEBPACK_IMPORTED_MODULE_3__.convertToBytes)(proto.code, parts[p]);\n tuples.push([proto.code, bytes]);\n stringTuples.push([proto.code, (0,_convert_js__WEBPACK_IMPORTED_MODULE_3__.convertToString)(proto.code, bytes)]);\n }\n return {\n string: stringTuplesToString(stringTuples),\n bytes: tuplesToBytes(tuples),\n tuples,\n stringTuples,\n path\n };\n}\nfunction bytesToMultiaddrParts(bytes) {\n const tuples = [];\n const stringTuples = [];\n let path = null;\n let i = 0;\n while (i < bytes.length) {\n const code = uint8_varint__WEBPACK_IMPORTED_MODULE_0__.decode(bytes, i);\n const n = uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encodingLength(code);\n const p = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_4__.getProtocol)(code);\n const size = sizeForAddr(p, bytes.slice(i + n));\n if (size === 0) {\n tuples.push([code]);\n stringTuples.push([code]);\n i += n;\n // eslint-disable-next-line no-continue\n continue;\n }\n const addr = bytes.slice(i + n, i + n + size);\n i += (size + n);\n if (i > bytes.length) { // did not end _exactly_ at buffer.length\n throw ParseError('Invalid address Uint8Array: ' + (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(bytes, 'base16'));\n }\n // ok, tuple seems good.\n tuples.push([code, addr]);\n const stringAddr = (0,_convert_js__WEBPACK_IMPORTED_MODULE_3__.convertToString)(code, addr);\n stringTuples.push([code, stringAddr]);\n if (p.path === true) {\n // should we need to check each path part to see if it's a proto?\n // This would allow for other protocols to be added after a unix path,\n // however it would have issues if the path had a protocol name in the path\n path = stringAddr;\n break;\n }\n }\n return {\n bytes: Uint8Array.from(bytes),\n string: stringTuplesToString(stringTuples),\n tuples,\n stringTuples,\n path\n };\n}\n/**\n * [[str name, str addr]... ] -> string\n */\nfunction stringTuplesToString(tuples) {\n const parts = [];\n tuples.map((tup) => {\n const proto = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_4__.getProtocol)(tup[0]);\n parts.push(proto.name);\n if (tup.length > 1 && tup[1] != null) {\n parts.push(tup[1]);\n }\n return null;\n });\n return cleanPath(parts.join('/'));\n}\n/**\n * [[int code, Uint8Array ]... ] -> Uint8Array\n */\nfunction tuplesToBytes(tuples) {\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__.concat)(tuples.map((tup) => {\n const proto = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_4__.getProtocol)(tup[0]);\n let buf = Uint8Array.from(uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encode(proto.code));\n if (tup.length > 1 && tup[1] != null) {\n buf = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__.concat)([buf, tup[1]]); // add address buffer\n }\n return buf;\n }));\n}\n/**\n * For the passed address, return the serialized size\n */\nfunction sizeForAddr(p, addr) {\n if (p.size > 0) {\n return p.size / 8;\n }\n else if (p.size === 0) {\n return 0;\n }\n else {\n const size = uint8_varint__WEBPACK_IMPORTED_MODULE_0__.decode(addr instanceof Uint8Array ? addr : Uint8Array.from(addr));\n return size + uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encodingLength(size);\n }\n}\nfunction bytesToTuples(buf) {\n const tuples = [];\n let i = 0;\n while (i < buf.length) {\n const code = uint8_varint__WEBPACK_IMPORTED_MODULE_0__.decode(buf, i);\n const n = uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encodingLength(code);\n const p = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_4__.getProtocol)(code);\n const size = sizeForAddr(p, buf.slice(i + n));\n if (size === 0) {\n tuples.push([code]);\n i += n;\n // eslint-disable-next-line no-continue\n continue;\n }\n const addr = buf.slice(i + n, i + n + size);\n i += (size + n);\n if (i > buf.length) { // did not end _exactly_ at buffer.length\n throw ParseError('Invalid address Uint8Array: ' + (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(buf, 'base16'));\n }\n // ok, tuple seems good.\n tuples.push([code, addr]);\n }\n return tuples;\n}\nfunction cleanPath(str) {\n return '/' + str.trim().split('/').filter((a) => a).join('/');\n}\nfunction ParseError(str) {\n return new Error('Error parsing address: ' + str);\n}\n//# sourceMappingURL=codec.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/dist/src/codec.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/dist/src/convert.js":
|
||
/*!******************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/dist/src/convert.js ***!
|
||
\******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ convert: () => (/* binding */ convert),\n/* harmony export */ convertToBytes: () => (/* binding */ convertToBytes),\n/* harmony export */ convertToIpNet: () => (/* binding */ convertToIpNet),\n/* harmony export */ convertToString: () => (/* binding */ convertToString)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_netmask__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/netmask */ \"./node_modules/@chainsafe/netmask/dist/src/index.js\");\n/* harmony import */ var multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/bases/base32 */ \"./node_modules/multiformats/dist/src/bases/base32.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/dist/src/bases/base58.js\");\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var multiformats_cid__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! multiformats/cid */ \"./node_modules/multiformats/dist/src/cid.js\");\n/* harmony import */ var multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! multiformats/hashes/digest */ \"./node_modules/multiformats/dist/src/hashes/digest.js\");\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _ip_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ip.js */ \"./node_modules/@multiformats/multiaddr/dist/src/ip.js\");\n/* harmony import */ var _protocols_table_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./protocols-table.js */ \"./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js\");\n/**\n * @packageDocumentation\n *\n * Provides methods for converting\n */\n\n\n\n\n\n\n\n\n\n\n\n\nconst ip4Protocol = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_11__.getProtocol)('ip4');\nconst ip6Protocol = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_11__.getProtocol)('ip6');\nconst ipcidrProtocol = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_11__.getProtocol)('ipcidr');\nfunction convert(proto, a) {\n if (a instanceof Uint8Array) {\n return convertToString(proto, a);\n }\n else {\n return convertToBytes(proto, a);\n }\n}\n/**\n * Convert [code,Uint8Array] to string\n */\nfunction convertToString(proto, buf) {\n const protocol = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_11__.getProtocol)(proto);\n switch (protocol.code) {\n case 4: // ipv4\n case 41: // ipv6\n return bytes2ip(buf);\n case 42: // ipv6zone\n return bytes2str(buf);\n case 6: // tcp\n case 273: // udp\n case 33: // dccp\n case 132: // sctp\n return bytes2port(buf).toString();\n case 53: // dns\n case 54: // dns4\n case 55: // dns6\n case 56: // dnsaddr\n case 400: // unix\n case 449: // sni\n case 777: // memory\n return bytes2str(buf);\n case 421: // ipfs\n return bytes2mh(buf);\n case 444: // onion\n return bytes2onion(buf);\n case 445: // onion3\n return bytes2onion(buf);\n case 466: // certhash\n return bytes2mb(buf);\n default:\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(buf, 'base16'); // no clue. convert to hex\n }\n}\nfunction convertToBytes(proto, str) {\n const protocol = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_11__.getProtocol)(proto);\n switch (protocol.code) {\n case 4: // ipv4\n return ip2bytes(str);\n case 41: // ipv6\n return ip2bytes(str);\n case 42: // ipv6zone\n return str2bytes(str);\n case 6: // tcp\n case 273: // udp\n case 33: // dccp\n case 132: // sctp\n return port2bytes(parseInt(str, 10));\n case 53: // dns\n case 54: // dns4\n case 55: // dns6\n case 56: // dnsaddr\n case 400: // unix\n case 449: // sni\n case 777: // memory\n return str2bytes(str);\n case 421: // ipfs\n return mh2bytes(str);\n case 444: // onion\n return onion2bytes(str);\n case 445: // onion3\n return onion32bytes(str);\n case 466: // certhash\n return mb2bytes(str);\n default:\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__.fromString)(str, 'base16'); // no clue. convert from hex\n }\n}\nfunction convertToIpNet(multiaddr) {\n let mask;\n let addr;\n multiaddr.stringTuples().forEach(([code, value]) => {\n if (code === ip4Protocol.code || code === ip6Protocol.code) {\n addr = value;\n }\n if (code === ipcidrProtocol.code) {\n mask = value;\n }\n });\n if (mask == null || addr == null) {\n throw new Error('Invalid multiaddr');\n }\n return new _chainsafe_netmask__WEBPACK_IMPORTED_MODULE_0__.IpNet(addr, mask);\n}\nconst decoders = Object.values(multiformats_basics__WEBPACK_IMPORTED_MODULE_3__.bases).map((c) => c.decoder);\nconst anybaseDecoder = (function () {\n let acc = decoders[0].or(decoders[1]);\n decoders.slice(2).forEach((d) => (acc = acc.or(d)));\n return acc;\n})();\nfunction ip2bytes(ipString) {\n if (!_ip_js__WEBPACK_IMPORTED_MODULE_10__.isIP(ipString)) {\n throw new Error('invalid ip address');\n }\n return _ip_js__WEBPACK_IMPORTED_MODULE_10__.toBytes(ipString);\n}\nfunction bytes2ip(ipBuff) {\n const ipString = _ip_js__WEBPACK_IMPORTED_MODULE_10__.toString(ipBuff, 0, ipBuff.length);\n if (ipString == null) {\n throw new Error('ipBuff is required');\n }\n if (!_ip_js__WEBPACK_IMPORTED_MODULE_10__.isIP(ipString)) {\n throw new Error('invalid ip address');\n }\n return ipString;\n}\nfunction port2bytes(port) {\n const buf = new ArrayBuffer(2);\n const view = new DataView(buf);\n view.setUint16(0, port);\n return new Uint8Array(buf);\n}\nfunction bytes2port(buf) {\n const view = new DataView(buf.buffer);\n return view.getUint16(buf.byteOffset);\n}\nfunction str2bytes(str) {\n const buf = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__.fromString)(str);\n const size = Uint8Array.from(uint8_varint__WEBPACK_IMPORTED_MODULE_6__.encode(buf.length));\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_7__.concat)([size, buf], size.length + buf.length);\n}\nfunction bytes2str(buf) {\n const size = uint8_varint__WEBPACK_IMPORTED_MODULE_6__.decode(buf);\n buf = buf.slice(uint8_varint__WEBPACK_IMPORTED_MODULE_6__.encodingLength(size));\n if (buf.length !== size) {\n throw new Error('inconsistent lengths');\n }\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(buf);\n}\nfunction mh2bytes(hash) {\n let mh;\n if (hash[0] === 'Q' || hash[0] === '1') {\n mh = multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_5__.decode(multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_2__.base58btc.decode(`z${hash}`)).bytes;\n }\n else {\n mh = multiformats_cid__WEBPACK_IMPORTED_MODULE_4__.CID.parse(hash).multihash.bytes;\n }\n // the address is a varint prefixed multihash string representation\n const size = Uint8Array.from(uint8_varint__WEBPACK_IMPORTED_MODULE_6__.encode(mh.length));\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_7__.concat)([size, mh], size.length + mh.length);\n}\nfunction mb2bytes(mbstr) {\n const mb = anybaseDecoder.decode(mbstr);\n const size = Uint8Array.from(uint8_varint__WEBPACK_IMPORTED_MODULE_6__.encode(mb.length));\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_7__.concat)([size, mb], size.length + mb.length);\n}\nfunction bytes2mb(buf) {\n const size = uint8_varint__WEBPACK_IMPORTED_MODULE_6__.decode(buf);\n const hash = buf.slice(uint8_varint__WEBPACK_IMPORTED_MODULE_6__.encodingLength(size));\n if (hash.length !== size) {\n throw new Error('inconsistent lengths');\n }\n return 'u' + (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(hash, 'base64url');\n}\n/**\n * Converts bytes to bas58btc string\n */\nfunction bytes2mh(buf) {\n const size = uint8_varint__WEBPACK_IMPORTED_MODULE_6__.decode(buf);\n const address = buf.slice(uint8_varint__WEBPACK_IMPORTED_MODULE_6__.encodingLength(size));\n if (address.length !== size) {\n throw new Error('inconsistent lengths');\n }\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(address, 'base58btc');\n}\nfunction onion2bytes(str) {\n const addr = str.split(':');\n if (addr.length !== 2) {\n throw new Error(`failed to parse onion addr: [\"'${addr.join('\", \"')}'\"]' does not contain a port number`);\n }\n if (addr[0].length !== 16) {\n throw new Error(`failed to parse onion addr: ${addr[0]} not a Tor onion address.`);\n }\n // onion addresses do not include the multibase prefix, add it before decoding\n const buf = multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_1__.base32.decode('b' + addr[0]);\n // onion port number\n const port = parseInt(addr[1], 10);\n if (port < 1 || port > 65536) {\n throw new Error('Port number is not in range(1, 65536)');\n }\n const portBuf = port2bytes(port);\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_7__.concat)([buf, portBuf], buf.length + portBuf.length);\n}\nfunction onion32bytes(str) {\n const addr = str.split(':');\n if (addr.length !== 2) {\n throw new Error(`failed to parse onion addr: [\"'${addr.join('\", \"')}'\"]' does not contain a port number`);\n }\n if (addr[0].length !== 56) {\n throw new Error(`failed to parse onion addr: ${addr[0]} not a Tor onion3 address.`);\n }\n // onion addresses do not include the multibase prefix, add it before decoding\n const buf = multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_1__.base32.decode(`b${addr[0]}`);\n // onion port number\n const port = parseInt(addr[1], 10);\n if (port < 1 || port > 65536) {\n throw new Error('Port number is not in range(1, 65536)');\n }\n const portBuf = port2bytes(port);\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_7__.concat)([buf, portBuf], buf.length + portBuf.length);\n}\nfunction bytes2onion(buf) {\n const addrBytes = buf.slice(0, buf.length - 2);\n const portBytes = buf.slice(buf.length - 2);\n const addr = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(addrBytes, 'base32');\n const port = bytes2port(portBytes);\n return `${addr}:${port}`;\n}\n//# sourceMappingURL=convert.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/dist/src/convert.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/dist/src/filter/multiaddr-filter.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/dist/src/filter/multiaddr-filter.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MultiaddrFilter: () => (/* binding */ MultiaddrFilter)\n/* harmony export */ });\n/* harmony import */ var _convert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../convert.js */ \"./node_modules/@multiformats/multiaddr/dist/src/convert.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../index.js */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n\n\n/**\n * A utility class to determine if a Multiaddr contains another\n * multiaddr.\n *\n * This can be used with ipcidr ranges to determine if a given\n * multiaddr is in a ipcidr range.\n *\n * @example\n *\n * ```js\n * import { multiaddr, MultiaddrFilter } from '@multiformats/multiaddr'\n *\n * const range = multiaddr('/ip4/192.168.10.10/ipcidr/24')\n * const filter = new MultiaddrFilter(range)\n *\n * const input = multiaddr('/ip4/192.168.10.2/udp/60')\n * console.info(filter.contains(input)) // true\n * ```\n */\nclass MultiaddrFilter {\n multiaddr;\n netmask;\n constructor(input) {\n this.multiaddr = (0,_index_js__WEBPACK_IMPORTED_MODULE_1__.multiaddr)(input);\n this.netmask = (0,_convert_js__WEBPACK_IMPORTED_MODULE_0__.convertToIpNet)(this.multiaddr);\n }\n contains(input) {\n if (input == null)\n return false;\n const m = (0,_index_js__WEBPACK_IMPORTED_MODULE_1__.multiaddr)(input);\n let ip;\n for (const [code, value] of m.stringTuples()) {\n if (code === 4 || code === 41) {\n ip = value;\n break;\n }\n }\n if (ip === undefined)\n return false;\n return this.netmask.contains(ip);\n }\n}\n//# sourceMappingURL=multiaddr-filter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/dist/src/filter/multiaddr-filter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/dist/src/index.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/dist/src/index.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MultiaddrFilter: () => (/* reexport safe */ _filter_multiaddr_filter_js__WEBPACK_IMPORTED_MODULE_2__.MultiaddrFilter),\n/* harmony export */ fromNodeAddress: () => (/* binding */ fromNodeAddress),\n/* harmony export */ isMultiaddr: () => (/* binding */ isMultiaddr),\n/* harmony export */ isName: () => (/* binding */ isName),\n/* harmony export */ multiaddr: () => (/* binding */ multiaddr),\n/* harmony export */ protocols: () => (/* reexport safe */ _protocols_table_js__WEBPACK_IMPORTED_MODULE_1__.getProtocol),\n/* harmony export */ resolvers: () => (/* binding */ resolvers)\n/* harmony export */ });\n/* harmony import */ var _multiaddr_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./multiaddr.js */ \"./node_modules/@multiformats/multiaddr/dist/src/multiaddr.js\");\n/* harmony import */ var _protocols_table_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./protocols-table.js */ \"./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js\");\n/* harmony import */ var _filter_multiaddr_filter_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./filter/multiaddr-filter.js */ \"./node_modules/@multiformats/multiaddr/dist/src/filter/multiaddr-filter.js\");\n/**\n * @packageDocumentation\n *\n * A standard way to represent addresses that\n *\n * - support any standard network protocol\n * - are self-describing\n * - have a binary packed format\n * - have a nice string representation\n * - encapsulate well\n *\n * @example\n *\n * ```TypeScript\n * import { multiaddr } from '@multiformats/multiaddr'\n * const addr = multiaddr(\"/ip4/127.0.0.1/udp/1234\")\n * // Multiaddr(/ip4/127.0.0.1/udp/1234)\n *\n * const addr = multiaddr(\"/ip4/127.0.0.1/udp/1234\")\n * // Multiaddr(/ip4/127.0.0.1/udp/1234)\n *\n * addr.bytes\n * // <Uint8Array 04 7f 00 00 01 11 04 d2>\n *\n * addr.toString()\n * // '/ip4/127.0.0.1/udp/1234'\n *\n * addr.protos()\n * // [\n * // {code: 4, name: 'ip4', size: 32},\n * // {code: 273, name: 'udp', size: 16}\n * // ]\n *\n * // gives you an object that is friendly with what Node.js core modules expect for addresses\n * addr.nodeAddress()\n * // {\n * // family: 4,\n * // port: 1234,\n * // address: \"127.0.0.1\"\n * // }\n *\n * addr.encapsulate('/sctp/5678')\n * // Multiaddr(/ip4/127.0.0.1/udp/1234/sctp/5678)\n * ```\n *\n * ## Resolving DNSADDR addresses\n *\n * [DNSADDR](https://github.com/multiformats/multiaddr/blob/master/protocols/DNSADDR.md) is a spec that allows storing a TXT DNS record that contains a Multiaddr.\n *\n * To resolve DNSADDR addresses, call the `.resolve()` function the multiaddr, optionally passing a `DNS` resolver.\n *\n * DNSADDR addresses can resolve to multiple multiaddrs, since there is no limit to the number of TXT records that can be stored.\n *\n * @example Resolving DNSADDR Multiaddrs\n *\n * ```TypeScript\n * import { multiaddr, resolvers } from '@multiformats/multiaddr'\n * import { dnsaddr } from '@multiformats/multiaddr/resolvers'\n *\n * resolvers.set('dnsaddr', dnsaddr)\n *\n * const ma = multiaddr('/dnsaddr/bootstrap.libp2p.io')\n *\n * // resolve with a 5s timeout\n * const resolved = await ma.resolve({\n * signal: AbortSignal.timeout(5000)\n * })\n *\n * console.info(await ma.resolve(resolved)\n * // [Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...')...]\n * ```\n *\n * @example Using a custom DNS resolver to resolve DNSADDR Multiaddrs\n *\n * See the docs for [@multiformats/dns](https://www.npmjs.com/package/@multiformats/dns) for a full breakdown of how to specify multiple resolvers or resolvers that can be used for specific TLDs.\n *\n * ```TypeScript\n * import { multiaddr } from '@multiformats/multiaddr'\n * import { dns } from '@multiformats/dns'\n * import { dnsJsonOverHttps } from '@multiformats/dns/resolvers'\n *\n * const resolver = dns({\n * '.': dnsJsonOverHttps('https://cloudflare-dns.com/dns-query')\n * })\n *\n * const ma = multiaddr('/dnsaddr/bootstrap.libp2p.io')\n * const resolved = await ma.resolve({\n * dns: resolver\n * })\n *\n * console.info(resolved)\n * // [Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...')...]\n * ```\n */\n\n\n/**\n * All configured {@link Resolver}s\n */\nconst resolvers = new Map();\n\n/**\n * Creates a Multiaddr from a node-friendly address object\n *\n * @example\n * ```js\n * import { fromNodeAddress } from '@multiformats/multiaddr'\n *\n * fromNodeAddress({address: '127.0.0.1', port: '4001'}, 'tcp')\n * // Multiaddr(/ip4/127.0.0.1/tcp/4001)\n * ```\n */\nfunction fromNodeAddress(addr, transport) {\n if (addr == null) {\n throw new Error('requires node address object');\n }\n if (transport == null) {\n throw new Error('requires transport protocol');\n }\n let ip;\n let host = addr.address;\n switch (addr.family) {\n case 4:\n ip = 'ip4';\n break;\n case 6:\n ip = 'ip6';\n if (host.includes('%')) {\n const parts = host.split('%');\n if (parts.length !== 2) {\n throw Error('Multiple ip6 zones in multiaddr');\n }\n host = parts[0];\n const zone = parts[1];\n ip = `/ip6zone/${zone}/ip6`;\n }\n break;\n default:\n throw Error('Invalid addr family, should be 4 or 6.');\n }\n return new _multiaddr_js__WEBPACK_IMPORTED_MODULE_0__.Multiaddr('/' + [ip, host, transport, addr.port].join('/'));\n}\n/**\n * Returns if something is a {@link Multiaddr} that is a resolvable name\n *\n * @example\n *\n * ```js\n * import { isName, multiaddr } from '@multiformats/multiaddr'\n *\n * isName(multiaddr('/ip4/127.0.0.1'))\n * // false\n * isName(multiaddr('/dns/ipfs.io'))\n * // true\n * ```\n */\nfunction isName(addr) {\n if (!isMultiaddr(addr)) {\n return false;\n }\n // if a part of the multiaddr is resolvable, then return true\n return addr.protos().some((proto) => proto.resolvable);\n}\n/**\n * Check if object is a {@link Multiaddr} instance\n *\n * @example\n *\n * ```js\n * import { isMultiaddr, multiaddr } from '@multiformats/multiaddr'\n *\n * isMultiaddr(5)\n * // false\n * isMultiaddr(multiaddr('/ip4/127.0.0.1'))\n * // true\n * ```\n */\nfunction isMultiaddr(value) {\n return Boolean(value?.[_multiaddr_js__WEBPACK_IMPORTED_MODULE_0__.symbol]);\n}\n/**\n * A function that takes a {@link MultiaddrInput} and returns a {@link Multiaddr}\n *\n * @example\n * ```js\n * import { multiaddr } from '@libp2p/multiaddr'\n *\n * multiaddr('/ip4/127.0.0.1/tcp/4001')\n * // Multiaddr(/ip4/127.0.0.1/tcp/4001)\n * ```\n *\n * @param {MultiaddrInput} [addr] - If String or Uint8Array, needs to adhere to the address format of a [multiaddr](https://github.com/multiformats/multiaddr#string-format)\n */\nfunction multiaddr(addr) {\n return new _multiaddr_js__WEBPACK_IMPORTED_MODULE_0__.Multiaddr(addr);\n}\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/dist/src/ip.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/dist/src/ip.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isIP: () => (/* reexport safe */ _chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__.isIP),\n/* harmony export */ isV4: () => (/* binding */ isV4),\n/* harmony export */ isV6: () => (/* binding */ isV6),\n/* harmony export */ toBytes: () => (/* binding */ toBytes),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/is-ip */ \"./node_modules/@chainsafe/is-ip/lib/is-ip.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/to-string.js\");\n\n\n\nconst isV4 = _chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__.isIPv4;\nconst isV6 = _chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__.isIPv6;\n// Copied from https://github.com/indutny/node-ip/blob/master/lib/ip.js#L7\n// but with buf/offset args removed because we don't use them\nconst toBytes = function (ip) {\n let offset = 0;\n ip = ip.toString().trim();\n if (isV4(ip)) {\n const bytes = new Uint8Array(offset + 4);\n ip.split(/\\./g).forEach((byte) => {\n bytes[offset++] = parseInt(byte, 10) & 0xff;\n });\n return bytes;\n }\n if (isV6(ip)) {\n const sections = ip.split(':', 8);\n let i;\n for (i = 0; i < sections.length; i++) {\n const isv4 = isV4(sections[i]);\n let v4Buffer;\n if (isv4) {\n v4Buffer = toBytes(sections[i]);\n sections[i] = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(v4Buffer.slice(0, 2), 'base16');\n }\n if (v4Buffer != null && ++i < 8) {\n sections.splice(i, 0, (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(v4Buffer.slice(2, 4), 'base16'));\n }\n }\n if (sections[0] === '') {\n while (sections.length < 8)\n sections.unshift('0');\n }\n else if (sections[sections.length - 1] === '') {\n while (sections.length < 8)\n sections.push('0');\n }\n else if (sections.length < 8) {\n for (i = 0; i < sections.length && sections[i] !== ''; i++)\n ;\n const argv = [i, 1];\n for (i = 9 - sections.length; i > 0; i--) {\n argv.push('0');\n }\n sections.splice.apply(sections, argv);\n }\n const bytes = new Uint8Array(offset + 16);\n for (i = 0; i < sections.length; i++) {\n const word = parseInt(sections[i], 16);\n bytes[offset++] = (word >> 8) & 0xff;\n bytes[offset++] = word & 0xff;\n }\n return bytes;\n }\n throw new Error('invalid ip address');\n};\n// Copied from https://github.com/indutny/node-ip/blob/master/lib/ip.js#L63\nconst toString = function (buf, offset = 0, length) {\n offset = ~~offset;\n length = length ?? (buf.length - offset);\n const view = new DataView(buf.buffer);\n if (length === 4) {\n const result = [];\n // IPv4\n for (let i = 0; i < length; i++) {\n result.push(buf[offset + i]);\n }\n return result.join('.');\n }\n if (length === 16) {\n const result = [];\n // IPv6\n for (let i = 0; i < length; i += 2) {\n result.push(view.getUint16(offset + i).toString(16));\n }\n return result.join(':')\n .replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3')\n .replace(/:{3,4}/, '::');\n }\n return '';\n};\n//# sourceMappingURL=ip.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/dist/src/ip.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/dist/src/multiaddr.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/dist/src/multiaddr.js ***!
|
||
\********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Multiaddr: () => (/* binding */ Multiaddr),\n/* harmony export */ symbol: () => (/* binding */ symbol)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/dist/src/bases/base58.js\");\n/* harmony import */ var multiformats_cid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/cid */ \"./node_modules/multiformats/dist/src/cid.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _codec_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./codec.js */ \"./node_modules/@multiformats/multiaddr/dist/src/codec.js\");\n/* harmony import */ var _protocols_table_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./protocols-table.js */ \"./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./index.js */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/**\n * @packageDocumentation\n *\n * An implementation of a Multiaddr in JavaScript\n *\n * @example\n *\n * ```js\n * import { multiaddr } from '@multiformats/multiaddr'\n *\n * const ma = multiaddr('/ip4/127.0.0.1/tcp/1234')\n * ```\n */\n\n\n\n\n\n\n\n\nconst inspect = Symbol.for('nodejs.util.inspect.custom');\nconst symbol = Symbol.for('@multiformats/js-multiaddr/multiaddr');\nconst DNS_CODES = [\n (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)('dns').code,\n (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)('dns4').code,\n (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)('dns6').code,\n (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)('dnsaddr').code\n];\n/**\n * Creates a {@link Multiaddr} from a {@link MultiaddrInput}\n */\nclass Multiaddr {\n bytes;\n #string;\n #tuples;\n #stringTuples;\n #path;\n [symbol] = true;\n constructor(addr) {\n // default\n if (addr == null) {\n addr = '';\n }\n let parts;\n if (addr instanceof Uint8Array) {\n parts = (0,_codec_js__WEBPACK_IMPORTED_MODULE_4__.bytesToMultiaddrParts)(addr);\n }\n else if (typeof addr === 'string') {\n if (addr.length > 0 && addr.charAt(0) !== '/') {\n throw new Error(`multiaddr \"${addr}\" must start with a \"/\"`);\n }\n parts = (0,_codec_js__WEBPACK_IMPORTED_MODULE_4__.stringToMultiaddrParts)(addr);\n }\n else if ((0,_index_js__WEBPACK_IMPORTED_MODULE_6__.isMultiaddr)(addr)) { // Multiaddr\n parts = (0,_codec_js__WEBPACK_IMPORTED_MODULE_4__.bytesToMultiaddrParts)(addr.bytes);\n }\n else {\n throw new Error('addr must be a string, Buffer, or another Multiaddr');\n }\n this.bytes = parts.bytes;\n this.#string = parts.string;\n this.#tuples = parts.tuples;\n this.#stringTuples = parts.stringTuples;\n this.#path = parts.path;\n }\n toString() {\n return this.#string;\n }\n toJSON() {\n return this.toString();\n }\n toOptions() {\n let family;\n let transport;\n let host;\n let port;\n let zone = '';\n const tcp = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)('tcp');\n const udp = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)('udp');\n const ip4 = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)('ip4');\n const ip6 = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)('ip6');\n const dns6 = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)('dns6');\n const ip6zone = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)('ip6zone');\n for (const [code, value] of this.stringTuples()) {\n if (code === ip6zone.code) {\n zone = `%${value ?? ''}`;\n }\n // default to https when protocol & port are omitted from DNS addrs\n if (DNS_CODES.includes(code)) {\n transport = tcp.name;\n port = 443;\n host = `${value ?? ''}${zone}`;\n family = code === dns6.code ? 6 : 4;\n }\n if (code === tcp.code || code === udp.code) {\n transport = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)(code).name;\n port = parseInt(value ?? '');\n }\n if (code === ip4.code || code === ip6.code) {\n transport = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)(code).name;\n host = `${value ?? ''}${zone}`;\n family = code === ip6.code ? 6 : 4;\n }\n }\n if (family == null || transport == null || host == null || port == null) {\n throw new Error('multiaddr must have a valid format: \"/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}\".');\n }\n const opts = {\n family,\n host,\n transport,\n port\n };\n return opts;\n }\n protos() {\n return this.#tuples.map(([code]) => Object.assign({}, (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)(code)));\n }\n protoCodes() {\n return this.#tuples.map(([code]) => code);\n }\n protoNames() {\n return this.#tuples.map(([code]) => (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.getProtocol)(code).name);\n }\n tuples() {\n return this.#tuples;\n }\n stringTuples() {\n return this.#stringTuples;\n }\n encapsulate(addr) {\n addr = new Multiaddr(addr);\n return new Multiaddr(this.toString() + addr.toString());\n }\n decapsulate(addr) {\n const addrString = addr.toString();\n const s = this.toString();\n const i = s.lastIndexOf(addrString);\n if (i < 0) {\n throw new Error(`Address ${this.toString()} does not contain subaddress: ${addr.toString()}`);\n }\n return new Multiaddr(s.slice(0, i));\n }\n decapsulateCode(code) {\n const tuples = this.tuples();\n for (let i = tuples.length - 1; i >= 0; i--) {\n if (tuples[i][0] === code) {\n return new Multiaddr((0,_codec_js__WEBPACK_IMPORTED_MODULE_4__.tuplesToBytes)(tuples.slice(0, i)));\n }\n }\n return this;\n }\n getPeerId() {\n try {\n let tuples = [];\n this.stringTuples().forEach(([code, name]) => {\n if (code === _protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.names.p2p.code) {\n tuples.push([code, name]);\n }\n // if this is a p2p-circuit address, return the target peer id if present\n // not the peer id of the relay\n if (code === _protocols_table_js__WEBPACK_IMPORTED_MODULE_5__.names['p2p-circuit'].code) {\n tuples = [];\n }\n });\n // Get the last ipfs tuple ['p2p', 'peerid string']\n const tuple = tuples.pop();\n if (tuple?.[1] != null) {\n const peerIdStr = tuple[1];\n // peer id is base58btc encoded string but not multibase encoded so add the `z`\n // prefix so we can validate that it is correctly encoded\n if (peerIdStr[0] === 'Q' || peerIdStr[0] === '1') {\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_0__.base58btc.decode(`z${peerIdStr}`), 'base58btc');\n }\n // try to parse peer id as CID\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(multiformats_cid__WEBPACK_IMPORTED_MODULE_1__.CID.parse(peerIdStr).multihash.bytes, 'base58btc');\n }\n return null;\n }\n catch (e) {\n return null;\n }\n }\n getPath() {\n return this.#path;\n }\n equals(addr) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.bytes, addr.bytes);\n }\n async resolve(options) {\n const resolvableProto = this.protos().find((p) => p.resolvable);\n // Multiaddr is not resolvable?\n if (resolvableProto == null) {\n return [this];\n }\n const resolver = _index_js__WEBPACK_IMPORTED_MODULE_6__.resolvers.get(resolvableProto.name);\n if (resolver == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_7__.CodeError(`no available resolver for ${resolvableProto.name}`, 'ERR_NO_AVAILABLE_RESOLVER');\n }\n const result = await resolver(this, options);\n return result.map(str => (0,_index_js__WEBPACK_IMPORTED_MODULE_6__.multiaddr)(str));\n }\n nodeAddress() {\n const options = this.toOptions();\n if (options.transport !== 'tcp' && options.transport !== 'udp') {\n throw new Error(`multiaddr must have a valid format - no protocol with name: \"${options.transport}\". Must have a valid transport protocol: \"{tcp, udp}\"`);\n }\n return {\n family: options.family,\n address: options.host,\n port: options.port\n };\n }\n isThinWaistAddress(addr) {\n const protos = (addr ?? this).protos();\n if (protos.length !== 2) {\n return false;\n }\n if (protos[0].code !== 4 && protos[0].code !== 41) {\n return false;\n }\n if (protos[1].code !== 6 && protos[1].code !== 273) {\n return false;\n }\n return true;\n }\n /**\n * Returns Multiaddr as a human-readable string\n * https://nodejs.org/api/util.html#utilinspectcustom\n *\n * @example\n * ```js\n * import { multiaddr } from '@multiformats/multiaddr'\n *\n * console.info(multiaddr('/ip4/127.0.0.1/tcp/4001'))\n * // 'Multiaddr(/ip4/127.0.0.1/tcp/4001)'\n * ```\n */\n [inspect]() {\n return `Multiaddr(${this.#string})`;\n }\n}\n//# sourceMappingURL=multiaddr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/dist/src/multiaddr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js":
|
||
/*!**************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js ***!
|
||
\**************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes),\n/* harmony export */ createProtocol: () => (/* binding */ createProtocol),\n/* harmony export */ getProtocol: () => (/* binding */ getProtocol),\n/* harmony export */ names: () => (/* binding */ names),\n/* harmony export */ table: () => (/* binding */ table)\n/* harmony export */ });\nconst V = -1;\nconst names = {};\nconst codes = {};\nconst table = [\n [4, 32, 'ip4'],\n [6, 16, 'tcp'],\n [33, 16, 'dccp'],\n [41, 128, 'ip6'],\n [42, V, 'ip6zone'],\n [43, 8, 'ipcidr'],\n [53, V, 'dns', true],\n [54, V, 'dns4', true],\n [55, V, 'dns6', true],\n [56, V, 'dnsaddr', true],\n [132, 16, 'sctp'],\n [273, 16, 'udp'],\n [275, 0, 'p2p-webrtc-star'],\n [276, 0, 'p2p-webrtc-direct'],\n [277, 0, 'p2p-stardust'],\n [280, 0, 'webrtc-direct'],\n [281, 0, 'webrtc'],\n [290, 0, 'p2p-circuit'],\n [301, 0, 'udt'],\n [302, 0, 'utp'],\n [400, V, 'unix', false, true],\n // `ipfs` is added before `p2p` for legacy support.\n // All text representations will default to `p2p`, but `ipfs` will\n // still be supported\n [421, V, 'ipfs'],\n // `p2p` is the preferred name for 421, and is now the default\n [421, V, 'p2p'],\n [443, 0, 'https'],\n [444, 96, 'onion'],\n [445, 296, 'onion3'],\n [446, V, 'garlic64'],\n [448, 0, 'tls'],\n [449, V, 'sni'],\n [460, 0, 'quic'],\n [461, 0, 'quic-v1'],\n [465, 0, 'webtransport'],\n [466, V, 'certhash'],\n [477, 0, 'ws'],\n [478, 0, 'wss'],\n [479, 0, 'p2p-websocket-star'],\n [480, 0, 'http'],\n [777, V, 'memory']\n];\n// populate tables\ntable.forEach(row => {\n const proto = createProtocol(...row);\n codes[proto.code] = proto;\n names[proto.name] = proto;\n});\nfunction createProtocol(code, size, name, resolvable, path) {\n return {\n code,\n size,\n name,\n resolvable: Boolean(resolvable),\n path: Boolean(path)\n };\n}\n/**\n * For the passed proto string or number, return a {@link Protocol}\n *\n * @example\n *\n * ```js\n * import { protocol } from '@multiformats/multiaddr'\n *\n * console.info(protocol(4))\n * // { code: 4, size: 32, name: 'ip4', resolvable: false, path: false }\n * ```\n */\nfunction getProtocol(proto) {\n if (typeof proto === 'number') {\n if (codes[proto] != null) {\n return codes[proto];\n }\n throw new Error(`no protocol with code: ${proto}`);\n }\n else if (typeof proto === 'string') {\n if (names[proto] != null) {\n return names[proto];\n }\n throw new Error(`no protocol with name: ${proto}`);\n }\n throw new Error(`invalid protocol id type: ${typeof proto}`);\n}\n//# sourceMappingURL=protocols-table.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/dist/src/resolvers/dnsaddr.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/dist/src/resolvers/dnsaddr.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ dnsaddrResolver: () => (/* binding */ dnsaddrResolver)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _multiformats_dns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/dns */ \"./node_modules/@multiformats/dns/dist/src/index.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../index.js */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _protocols_table_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../protocols-table.js */ \"./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js\");\n\n\n\n\nconst MAX_RECURSIVE_DEPTH = 32;\nconst { code: dnsaddrCode } = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_2__.getProtocol)('dnsaddr');\nconst dnsaddrResolver = async function dnsaddrResolver(ma, options = {}) {\n const recursionLimit = options.maxRecursiveDepth ?? MAX_RECURSIVE_DEPTH;\n if (recursionLimit === 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Max recursive depth reached', 'ERR_MAX_RECURSIVE_DEPTH_REACHED');\n }\n const [, hostname] = ma.stringTuples().find(([proto]) => proto === dnsaddrCode) ?? [];\n const resolver = options?.dns ?? (0,_multiformats_dns__WEBPACK_IMPORTED_MODULE_0__.dns)();\n const result = await resolver.query(`_dnsaddr.${hostname}`, {\n signal: options?.signal,\n types: [\n _multiformats_dns__WEBPACK_IMPORTED_MODULE_0__.RecordType.TXT\n ]\n });\n const peerId = ma.getPeerId();\n const output = [];\n for (const answer of result.Answer) {\n const addr = answer.data.split('=')[1];\n if (addr == null) {\n continue;\n }\n if (peerId != null && !addr.includes(peerId)) {\n continue;\n }\n const ma = (0,_index_js__WEBPACK_IMPORTED_MODULE_1__.multiaddr)(addr);\n if (addr.startsWith('/dnsaddr')) {\n const resolved = await ma.resolve({\n ...options,\n maxRecursiveDepth: recursionLimit - 1\n });\n output.push(...resolved.map(ma => ma.toString()));\n }\n else {\n output.push(ma.toString());\n }\n }\n return output;\n};\n//# sourceMappingURL=dnsaddr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/dist/src/resolvers/dnsaddr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js":
|
||
/*!**************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js ***!
|
||
\**************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ dnsaddrResolver: () => (/* reexport safe */ _dnsaddr_js__WEBPACK_IMPORTED_MODULE_0__.dnsaddrResolver)\n/* harmony export */ });\n/* harmony import */ var _dnsaddr_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dnsaddr.js */ \"./node_modules/@multiformats/multiaddr/dist/src/resolvers/dnsaddr.js\");\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/concat.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/concat.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ concat: () => (/* binding */ concat)\n/* harmony export */ });\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #alloc */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #util/as-uint8array */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Uint8Arrays\n */\nfunction concat(arrays, length) {\n if (length == null) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n const output = (0,_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(length);\n let offset = 0;\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n return (0,_util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(output);\n}\n//# sourceMappingURL=concat.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/concat.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/equals.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/equals.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!***********************************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\***********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!*********************************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\*********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/util/as-uint8array.js":
|
||
/*!******************************************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/util/as-uint8array.js ***!
|
||
\******************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asUint8Array: () => (/* binding */ asUint8Array)\n/* harmony export */ });\n/**\n * To guarantee Uint8Array semantics, convert nodejs Buffers\n * into vanilla Uint8Arrays\n */\nfunction asUint8Array(buf) {\n return buf;\n}\n//# sourceMappingURL=as-uint8array.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/util/as-uint8array.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!**********************************************************************************************!*\
|
||
!*** ./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\**********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@multiformats/multiaddr/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/ciphers/esm/_arx.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/@noble/ciphers/esm/_arx.js ***!
|
||
\*************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCipher: () => (/* binding */ createCipher),\n/* harmony export */ rotl: () => (/* binding */ rotl)\n/* harmony export */ });\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/ciphers/esm/_assert.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/ciphers/esm/utils.js\");\n// Basic utils for ARX (add-rotate-xor) salsa and chacha ciphers.\n\n\n/*\nRFC8439 requires multi-step cipher stream, where\nauthKey starts with counter: 0, actual msg with counter: 1.\n\nFor this, we need a way to re-use nonce / counter:\n\n const counter = new Uint8Array(4);\n chacha(..., counter, ...); // counter is now 1\n chacha(..., counter, ...); // counter is now 2\n\nThis is complicated:\n\n- 32-bit counters are enough, no need for 64-bit: max ArrayBuffer size in JS is 4GB\n- Original papers don't allow mutating counters\n- Counter overflow is undefined [^1]\n- Idea A: allow providing (nonce | counter) instead of just nonce, re-use it\n- Caveat: Cannot be re-used through all cases:\n- * chacha has (counter | nonce)\n- * xchacha has (nonce16 | counter | nonce16)\n- Idea B: separate nonce / counter and provide separate API for counter re-use\n- Caveat: there are different counter sizes depending on an algorithm.\n- salsa & chacha also differ in structures of key & sigma:\n salsa20: s[0] | k(4) | s[1] | nonce(2) | ctr(2) | s[2] | k(4) | s[3]\n chacha: s(4) | k(8) | ctr(1) | nonce(3)\n chacha20orig: s(4) | k(8) | ctr(2) | nonce(2)\n- Idea C: helper method such as `setSalsaState(key, nonce, sigma, data)`\n- Caveat: we can't re-use counter array\n\nxchacha [^2] uses the subkey and remaining 8 byte nonce with ChaCha20 as normal\n(prefixed by 4 NUL bytes, since [RFC8439] specifies a 12-byte nonce).\n\n[^1]: https://mailarchive.ietf.org/arch/msg/cfrg/gsOnTJzcbgG6OqD8Sc0GO5aR_tU/\n[^2]: https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-xchacha#appendix-A.2\n*/\nconst sigma16 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('expand 16-byte k');\nconst sigma32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('expand 32-byte k');\nconst sigma16_32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(sigma16);\nconst sigma32_32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(sigma32);\nfunction rotl(a, b) {\n return (a << b) | (a >>> (32 - b));\n}\n// Is byte array aligned to 4 byte offset (u32)?\nfunction isAligned32(b) {\n return b.byteOffset % 4 === 0;\n}\n// Salsa and Chacha block length is always 512-bit\nconst BLOCK_LEN = 64;\nconst BLOCK_LEN32 = 16;\n// new Uint32Array([2**32]) // => Uint32Array(1) [ 0 ]\n// new Uint32Array([2**32-1]) // => Uint32Array(1) [ 4294967295 ]\nconst MAX_COUNTER = 2 ** 32 - 1;\nconst U32_EMPTY = new Uint32Array();\nfunction runCipher(core, sigma, key, nonce, data, output, counter, rounds) {\n const len = data.length;\n const block = new Uint8Array(BLOCK_LEN);\n const b32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(block);\n // Make sure that buffers aligned to 4 bytes\n const isAligned = isAligned32(data) && isAligned32(output);\n const d32 = isAligned ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(data) : U32_EMPTY;\n const o32 = isAligned ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(output) : U32_EMPTY;\n for (let pos = 0; pos < len; counter++) {\n core(sigma, key, nonce, b32, counter, rounds);\n if (counter >= MAX_COUNTER)\n throw new Error('arx: counter overflow');\n const take = Math.min(BLOCK_LEN, len - pos);\n // aligned to 4 bytes\n if (isAligned && take === BLOCK_LEN) {\n const pos32 = pos / 4;\n if (pos % 4 !== 0)\n throw new Error('arx: invalid block position');\n for (let j = 0, posj; j < BLOCK_LEN32; j++) {\n posj = pos32 + j;\n o32[posj] = d32[posj] ^ b32[j];\n }\n pos += BLOCK_LEN;\n continue;\n }\n for (let j = 0, posj; j < take; j++) {\n posj = pos + j;\n output[posj] = data[posj] ^ block[j];\n }\n pos += take;\n }\n}\nfunction createCipher(core, opts) {\n const { allowShortKeys, extendNonceFn, counterLength, counterRight, rounds } = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.checkOpts)({ allowShortKeys: false, counterLength: 8, counterRight: false, rounds: 20 }, opts);\n if (typeof core !== 'function')\n throw new Error('core must be a function');\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.number)(counterLength);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.number)(rounds);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.bool)(counterRight);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.bool)(allowShortKeys);\n return (key, nonce, data, output, counter = 0) => {\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.bytes)(key);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.bytes)(nonce);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.bytes)(data);\n const len = data.length;\n if (!output)\n output = new Uint8Array(len);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.bytes)(output);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.number)(counter);\n if (counter < 0 || counter >= MAX_COUNTER)\n throw new Error('arx: counter overflow');\n if (output.length < len)\n throw new Error(`arx: output (${output.length}) is shorter than data (${len})`);\n const toClean = [];\n // Key & sigma\n // key=16 -> sigma16, k=key|key\n // key=32 -> sigma32, k=key\n let l = key.length, k, sigma;\n if (l === 32) {\n k = key.slice();\n toClean.push(k);\n sigma = sigma32_32;\n }\n else if (l === 16 && allowShortKeys) {\n k = new Uint8Array(32);\n k.set(key);\n k.set(key, 16);\n sigma = sigma16_32;\n toClean.push(k);\n }\n else {\n throw new Error(`arx: invalid 32-byte key, got length=${l}`);\n }\n // Nonce\n // salsa20: 8 (8-byte counter)\n // chacha20orig: 8 (8-byte counter)\n // chacha20: 12 (4-byte counter)\n // xsalsa20: 24 (16 -> hsalsa, 8 -> old nonce)\n // xchacha20: 24 (16 -> hchacha, 8 -> old nonce)\n // Align nonce to 4 bytes\n if (!isAligned32(nonce)) {\n nonce = nonce.slice();\n toClean.push(nonce);\n }\n const k32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(k);\n // hsalsa & hchacha: handle extended nonce\n if (extendNonceFn) {\n if (nonce.length !== 24)\n throw new Error(`arx: extended nonce must be 24 bytes`);\n extendNonceFn(sigma, k32, (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(nonce.subarray(0, 16)), k32);\n nonce = nonce.subarray(16);\n }\n // Handle nonce counter\n const nonceNcLen = 16 - counterLength;\n if (nonceNcLen !== nonce.length)\n throw new Error(`arx: nonce must be ${nonceNcLen} or 16 bytes`);\n // Pad counter when nonce is 64 bit\n if (nonceNcLen !== 12) {\n const nc = new Uint8Array(12);\n nc.set(nonce, counterRight ? 0 : 12 - nonce.length);\n nonce = nc;\n toClean.push(nonce);\n }\n const n32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(nonce);\n runCipher(core, sigma, k32, n32, data, output, counter, rounds);\n while (toClean.length > 0)\n toClean.pop().fill(0);\n return output;\n };\n}\n//# sourceMappingURL=_arx.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/ciphers/esm/_arx.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/ciphers/esm/_assert.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/@noble/ciphers/esm/_assert.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bool: () => (/* binding */ bool),\n/* harmony export */ bytes: () => (/* binding */ bytes),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ exists: () => (/* binding */ exists),\n/* harmony export */ hash: () => (/* binding */ hash),\n/* harmony export */ number: () => (/* binding */ number),\n/* harmony export */ output: () => (/* binding */ output)\n/* harmony export */ });\nfunction number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`boolean expected, not ${b}`);\n}\n// TODO: merge with utils\nfunction isBytes(a) {\n return (a != null &&\n typeof a === 'object' &&\n (a instanceof Uint8Array || a.constructor.name === 'Uint8Array'));\n}\nfunction bytes(b, ...lengths) {\n if (!isBytes(b))\n throw new Error('Uint8Array expected');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('hash must be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\n\nconst assert = { number, bool, bytes, hash, exists, output };\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (assert);\n//# sourceMappingURL=_assert.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/ciphers/esm/_assert.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/ciphers/esm/_poly1305.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@noble/ciphers/esm/_poly1305.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ poly1305: () => (/* binding */ poly1305),\n/* harmony export */ wrapConstructorWithKey: () => (/* binding */ wrapConstructorWithKey)\n/* harmony export */ });\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/ciphers/esm/_assert.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/ciphers/esm/utils.js\");\n\n\n// Poly1305 is a fast and parallel secret-key message-authentication code.\n// https://cr.yp.to/mac.html, https://cr.yp.to/mac/poly1305-20050329.pdf\n// https://datatracker.ietf.org/doc/html/rfc8439\n// Based on Public Domain poly1305-donna https://github.com/floodyberry/poly1305-donna\nconst u8to16 = (a, i) => (a[i++] & 0xff) | ((a[i++] & 0xff) << 8);\nclass Poly1305 {\n constructor(key) {\n this.blockLen = 16;\n this.outputLen = 16;\n this.buffer = new Uint8Array(16);\n this.r = new Uint16Array(10);\n this.h = new Uint16Array(10);\n this.pad = new Uint16Array(8);\n this.pos = 0;\n this.finished = false;\n key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(key);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)(key, 32);\n const t0 = u8to16(key, 0);\n const t1 = u8to16(key, 2);\n const t2 = u8to16(key, 4);\n const t3 = u8to16(key, 6);\n const t4 = u8to16(key, 8);\n const t5 = u8to16(key, 10);\n const t6 = u8to16(key, 12);\n const t7 = u8to16(key, 14);\n // https://github.com/floodyberry/poly1305-donna/blob/e6ad6e091d30d7f4ec2d4f978be1fcfcbce72781/poly1305-donna-16.h#L47\n this.r[0] = t0 & 0x1fff;\n this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;\n this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;\n this.r[5] = (t4 >>> 1) & 0x1ffe;\n this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;\n this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n this.r[9] = (t7 >>> 5) & 0x007f;\n for (let i = 0; i < 8; i++)\n this.pad[i] = u8to16(key, 16 + 2 * i);\n }\n process(data, offset, isLast = false) {\n const hibit = isLast ? 0 : 1 << 11;\n const { h, r } = this;\n const r0 = r[0];\n const r1 = r[1];\n const r2 = r[2];\n const r3 = r[3];\n const r4 = r[4];\n const r5 = r[5];\n const r6 = r[6];\n const r7 = r[7];\n const r8 = r[8];\n const r9 = r[9];\n const t0 = u8to16(data, offset + 0);\n const t1 = u8to16(data, offset + 2);\n const t2 = u8to16(data, offset + 4);\n const t3 = u8to16(data, offset + 6);\n const t4 = u8to16(data, offset + 8);\n const t5 = u8to16(data, offset + 10);\n const t6 = u8to16(data, offset + 12);\n const t7 = u8to16(data, offset + 14);\n let h0 = h[0] + (t0 & 0x1fff);\n let h1 = h[1] + (((t0 >>> 13) | (t1 << 3)) & 0x1fff);\n let h2 = h[2] + (((t1 >>> 10) | (t2 << 6)) & 0x1fff);\n let h3 = h[3] + (((t2 >>> 7) | (t3 << 9)) & 0x1fff);\n let h4 = h[4] + (((t3 >>> 4) | (t4 << 12)) & 0x1fff);\n let h5 = h[5] + ((t4 >>> 1) & 0x1fff);\n let h6 = h[6] + (((t4 >>> 14) | (t5 << 2)) & 0x1fff);\n let h7 = h[7] + (((t5 >>> 11) | (t6 << 5)) & 0x1fff);\n let h8 = h[8] + (((t6 >>> 8) | (t7 << 8)) & 0x1fff);\n let h9 = h[9] + ((t7 >>> 5) | hibit);\n let c = 0;\n let d0 = c + h0 * r0 + h1 * (5 * r9) + h2 * (5 * r8) + h3 * (5 * r7) + h4 * (5 * r6);\n c = d0 >>> 13;\n d0 &= 0x1fff;\n d0 += h5 * (5 * r5) + h6 * (5 * r4) + h7 * (5 * r3) + h8 * (5 * r2) + h9 * (5 * r1);\n c += d0 >>> 13;\n d0 &= 0x1fff;\n let d1 = c + h0 * r1 + h1 * r0 + h2 * (5 * r9) + h3 * (5 * r8) + h4 * (5 * r7);\n c = d1 >>> 13;\n d1 &= 0x1fff;\n d1 += h5 * (5 * r6) + h6 * (5 * r5) + h7 * (5 * r4) + h8 * (5 * r3) + h9 * (5 * r2);\n c += d1 >>> 13;\n d1 &= 0x1fff;\n let d2 = c + h0 * r2 + h1 * r1 + h2 * r0 + h3 * (5 * r9) + h4 * (5 * r8);\n c = d2 >>> 13;\n d2 &= 0x1fff;\n d2 += h5 * (5 * r7) + h6 * (5 * r6) + h7 * (5 * r5) + h8 * (5 * r4) + h9 * (5 * r3);\n c += d2 >>> 13;\n d2 &= 0x1fff;\n let d3 = c + h0 * r3 + h1 * r2 + h2 * r1 + h3 * r0 + h4 * (5 * r9);\n c = d3 >>> 13;\n d3 &= 0x1fff;\n d3 += h5 * (5 * r8) + h6 * (5 * r7) + h7 * (5 * r6) + h8 * (5 * r5) + h9 * (5 * r4);\n c += d3 >>> 13;\n d3 &= 0x1fff;\n let d4 = c + h0 * r4 + h1 * r3 + h2 * r2 + h3 * r1 + h4 * r0;\n c = d4 >>> 13;\n d4 &= 0x1fff;\n d4 += h5 * (5 * r9) + h6 * (5 * r8) + h7 * (5 * r7) + h8 * (5 * r6) + h9 * (5 * r5);\n c += d4 >>> 13;\n d4 &= 0x1fff;\n let d5 = c + h0 * r5 + h1 * r4 + h2 * r3 + h3 * r2 + h4 * r1;\n c = d5 >>> 13;\n d5 &= 0x1fff;\n d5 += h5 * r0 + h6 * (5 * r9) + h7 * (5 * r8) + h8 * (5 * r7) + h9 * (5 * r6);\n c += d5 >>> 13;\n d5 &= 0x1fff;\n let d6 = c + h0 * r6 + h1 * r5 + h2 * r4 + h3 * r3 + h4 * r2;\n c = d6 >>> 13;\n d6 &= 0x1fff;\n d6 += h5 * r1 + h6 * r0 + h7 * (5 * r9) + h8 * (5 * r8) + h9 * (5 * r7);\n c += d6 >>> 13;\n d6 &= 0x1fff;\n let d7 = c + h0 * r7 + h1 * r6 + h2 * r5 + h3 * r4 + h4 * r3;\n c = d7 >>> 13;\n d7 &= 0x1fff;\n d7 += h5 * r2 + h6 * r1 + h7 * r0 + h8 * (5 * r9) + h9 * (5 * r8);\n c += d7 >>> 13;\n d7 &= 0x1fff;\n let d8 = c + h0 * r8 + h1 * r7 + h2 * r6 + h3 * r5 + h4 * r4;\n c = d8 >>> 13;\n d8 &= 0x1fff;\n d8 += h5 * r3 + h6 * r2 + h7 * r1 + h8 * r0 + h9 * (5 * r9);\n c += d8 >>> 13;\n d8 &= 0x1fff;\n let d9 = c + h0 * r9 + h1 * r8 + h2 * r7 + h3 * r6 + h4 * r5;\n c = d9 >>> 13;\n d9 &= 0x1fff;\n d9 += h5 * r4 + h6 * r3 + h7 * r2 + h8 * r1 + h9 * r0;\n c += d9 >>> 13;\n d9 &= 0x1fff;\n c = ((c << 2) + c) | 0;\n c = (c + d0) | 0;\n d0 = c & 0x1fff;\n c = c >>> 13;\n d1 += c;\n h[0] = d0;\n h[1] = d1;\n h[2] = d2;\n h[3] = d3;\n h[4] = d4;\n h[5] = d5;\n h[6] = d6;\n h[7] = d7;\n h[8] = d8;\n h[9] = d9;\n }\n finalize() {\n const { h, pad } = this;\n const g = new Uint16Array(10);\n let c = h[1] >>> 13;\n h[1] &= 0x1fff;\n for (let i = 2; i < 10; i++) {\n h[i] += c;\n c = h[i] >>> 13;\n h[i] &= 0x1fff;\n }\n h[0] += c * 5;\n c = h[0] >>> 13;\n h[0] &= 0x1fff;\n h[1] += c;\n c = h[1] >>> 13;\n h[1] &= 0x1fff;\n h[2] += c;\n g[0] = h[0] + 5;\n c = g[0] >>> 13;\n g[0] &= 0x1fff;\n for (let i = 1; i < 10; i++) {\n g[i] = h[i] + c;\n c = g[i] >>> 13;\n g[i] &= 0x1fff;\n }\n g[9] -= 1 << 13;\n let mask = (c ^ 1) - 1;\n for (let i = 0; i < 10; i++)\n g[i] &= mask;\n mask = ~mask;\n for (let i = 0; i < 10; i++)\n h[i] = (h[i] & mask) | g[i];\n h[0] = (h[0] | (h[1] << 13)) & 0xffff;\n h[1] = ((h[1] >>> 3) | (h[2] << 10)) & 0xffff;\n h[2] = ((h[2] >>> 6) | (h[3] << 7)) & 0xffff;\n h[3] = ((h[3] >>> 9) | (h[4] << 4)) & 0xffff;\n h[4] = ((h[4] >>> 12) | (h[5] << 1) | (h[6] << 14)) & 0xffff;\n h[5] = ((h[6] >>> 2) | (h[7] << 11)) & 0xffff;\n h[6] = ((h[7] >>> 5) | (h[8] << 8)) & 0xffff;\n h[7] = ((h[8] >>> 8) | (h[9] << 5)) & 0xffff;\n let f = h[0] + pad[0];\n h[0] = f & 0xffff;\n for (let i = 1; i < 8; i++) {\n f = (((h[i] + pad[i]) | 0) + (f >>> 16)) | 0;\n h[i] = f & 0xffff;\n }\n }\n update(data) {\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.exists)(this);\n const { buffer, blockLen } = this;\n data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input\n if (take === blockLen) {\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(data, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(buffer, 0, false);\n this.pos = 0;\n }\n }\n return this;\n }\n destroy() {\n this.h.fill(0);\n this.r.fill(0);\n this.buffer.fill(0);\n this.pad.fill(0);\n }\n digestInto(out) {\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.exists)(this);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.output)(out, this);\n this.finished = true;\n const { buffer, h } = this;\n let { pos } = this;\n if (pos) {\n buffer[pos++] = 1;\n // buffer.subarray(pos).fill(0);\n for (; pos < 16; pos++)\n buffer[pos] = 0;\n this.process(buffer, 0, true);\n }\n this.finalize();\n let opos = 0;\n for (let i = 0; i < 8; i++) {\n out[opos++] = h[i] >>> 0;\n out[opos++] = h[i] >>> 8;\n }\n return out;\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n}\nfunction wrapConstructorWithKey(hashCons) {\n const hashC = (msg, key) => hashCons(key).update((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(msg)).digest();\n const tmp = hashCons(new Uint8Array(32));\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (key) => hashCons(key);\n return hashC;\n}\nconst poly1305 = wrapConstructorWithKey((key) => new Poly1305(key));\n//# sourceMappingURL=_poly1305.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/ciphers/esm/_poly1305.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/ciphers/esm/chacha.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/@noble/ciphers/esm/chacha.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _poly1305_aead: () => (/* binding */ _poly1305_aead),\n/* harmony export */ chacha12: () => (/* binding */ chacha12),\n/* harmony export */ chacha20: () => (/* binding */ chacha20),\n/* harmony export */ chacha20orig: () => (/* binding */ chacha20orig),\n/* harmony export */ chacha20poly1305: () => (/* binding */ chacha20poly1305),\n/* harmony export */ chacha8: () => (/* binding */ chacha8),\n/* harmony export */ hchacha: () => (/* binding */ hchacha),\n/* harmony export */ xchacha20: () => (/* binding */ xchacha20),\n/* harmony export */ xchacha20poly1305: () => (/* binding */ xchacha20poly1305)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/ciphers/esm/utils.js\");\n/* harmony import */ var _poly1305_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_poly1305.js */ \"./node_modules/@noble/ciphers/esm/_poly1305.js\");\n/* harmony import */ var _arx_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_arx.js */ \"./node_modules/@noble/ciphers/esm/_arx.js\");\n\n\n\n// ChaCha20 stream cipher was released in 2008. ChaCha aims to increase\n// the diffusion per round, but had slightly less cryptanalysis.\n// https://cr.yp.to/chacha.html, http://cr.yp.to/chacha/chacha-20080128.pdf\n/**\n * ChaCha core function.\n */\n// prettier-ignore\nfunction chachaCore(s, k, n, out, cnt, rounds = 20) {\n let y00 = s[0], y01 = s[1], y02 = s[2], y03 = s[3], // \"expa\" \"nd 3\" \"2-by\" \"te k\"\n y04 = k[0], y05 = k[1], y06 = k[2], y07 = k[3], // Key Key Key Key\n y08 = k[4], y09 = k[5], y10 = k[6], y11 = k[7], // Key Key Key Key\n y12 = cnt, y13 = n[0], y14 = n[1], y15 = n[2]; // Counter Counter\tNonce Nonce\n // Save state to temporary variables\n let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15;\n for (let r = 0; r < rounds; r += 2) {\n x00 = (x00 + x04) | 0;\n x12 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x12 ^ x00, 16);\n x08 = (x08 + x12) | 0;\n x04 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x04 ^ x08, 12);\n x00 = (x00 + x04) | 0;\n x12 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x12 ^ x00, 8);\n x08 = (x08 + x12) | 0;\n x04 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x04 ^ x08, 7);\n x01 = (x01 + x05) | 0;\n x13 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x13 ^ x01, 16);\n x09 = (x09 + x13) | 0;\n x05 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x05 ^ x09, 12);\n x01 = (x01 + x05) | 0;\n x13 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x13 ^ x01, 8);\n x09 = (x09 + x13) | 0;\n x05 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x05 ^ x09, 7);\n x02 = (x02 + x06) | 0;\n x14 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x14 ^ x02, 16);\n x10 = (x10 + x14) | 0;\n x06 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x06 ^ x10, 12);\n x02 = (x02 + x06) | 0;\n x14 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x14 ^ x02, 8);\n x10 = (x10 + x14) | 0;\n x06 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x06 ^ x10, 7);\n x03 = (x03 + x07) | 0;\n x15 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x15 ^ x03, 16);\n x11 = (x11 + x15) | 0;\n x07 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x07 ^ x11, 12);\n x03 = (x03 + x07) | 0;\n x15 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x15 ^ x03, 8);\n x11 = (x11 + x15) | 0;\n x07 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x07 ^ x11, 7);\n x00 = (x00 + x05) | 0;\n x15 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x15 ^ x00, 16);\n x10 = (x10 + x15) | 0;\n x05 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x05 ^ x10, 12);\n x00 = (x00 + x05) | 0;\n x15 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x15 ^ x00, 8);\n x10 = (x10 + x15) | 0;\n x05 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x05 ^ x10, 7);\n x01 = (x01 + x06) | 0;\n x12 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x12 ^ x01, 16);\n x11 = (x11 + x12) | 0;\n x06 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x06 ^ x11, 12);\n x01 = (x01 + x06) | 0;\n x12 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x12 ^ x01, 8);\n x11 = (x11 + x12) | 0;\n x06 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x06 ^ x11, 7);\n x02 = (x02 + x07) | 0;\n x13 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x13 ^ x02, 16);\n x08 = (x08 + x13) | 0;\n x07 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x07 ^ x08, 12);\n x02 = (x02 + x07) | 0;\n x13 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x13 ^ x02, 8);\n x08 = (x08 + x13) | 0;\n x07 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x07 ^ x08, 7);\n x03 = (x03 + x04) | 0;\n x14 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x14 ^ x03, 16);\n x09 = (x09 + x14) | 0;\n x04 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x04 ^ x09, 12);\n x03 = (x03 + x04) | 0;\n x14 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x14 ^ x03, 8);\n x09 = (x09 + x14) | 0;\n x04 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x04 ^ x09, 7);\n }\n // Write output\n let oi = 0;\n out[oi++] = (y00 + x00) | 0;\n out[oi++] = (y01 + x01) | 0;\n out[oi++] = (y02 + x02) | 0;\n out[oi++] = (y03 + x03) | 0;\n out[oi++] = (y04 + x04) | 0;\n out[oi++] = (y05 + x05) | 0;\n out[oi++] = (y06 + x06) | 0;\n out[oi++] = (y07 + x07) | 0;\n out[oi++] = (y08 + x08) | 0;\n out[oi++] = (y09 + x09) | 0;\n out[oi++] = (y10 + x10) | 0;\n out[oi++] = (y11 + x11) | 0;\n out[oi++] = (y12 + x12) | 0;\n out[oi++] = (y13 + x13) | 0;\n out[oi++] = (y14 + x14) | 0;\n out[oi++] = (y15 + x15) | 0;\n}\n/**\n * hchacha helper method, used primarily in xchacha, to hash\n * key and nonce into key' and nonce'.\n * Same as chachaCore, but there doesn't seem to be a way to move the block\n * out without 25% performance hit.\n */\n// prettier-ignore\nfunction hchacha(s, k, i, o32) {\n let x00 = s[0], x01 = s[1], x02 = s[2], x03 = s[3], x04 = k[0], x05 = k[1], x06 = k[2], x07 = k[3], x08 = k[4], x09 = k[5], x10 = k[6], x11 = k[7], x12 = i[0], x13 = i[1], x14 = i[2], x15 = i[3];\n for (let r = 0; r < 20; r += 2) {\n x00 = (x00 + x04) | 0;\n x12 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x12 ^ x00, 16);\n x08 = (x08 + x12) | 0;\n x04 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x04 ^ x08, 12);\n x00 = (x00 + x04) | 0;\n x12 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x12 ^ x00, 8);\n x08 = (x08 + x12) | 0;\n x04 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x04 ^ x08, 7);\n x01 = (x01 + x05) | 0;\n x13 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x13 ^ x01, 16);\n x09 = (x09 + x13) | 0;\n x05 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x05 ^ x09, 12);\n x01 = (x01 + x05) | 0;\n x13 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x13 ^ x01, 8);\n x09 = (x09 + x13) | 0;\n x05 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x05 ^ x09, 7);\n x02 = (x02 + x06) | 0;\n x14 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x14 ^ x02, 16);\n x10 = (x10 + x14) | 0;\n x06 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x06 ^ x10, 12);\n x02 = (x02 + x06) | 0;\n x14 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x14 ^ x02, 8);\n x10 = (x10 + x14) | 0;\n x06 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x06 ^ x10, 7);\n x03 = (x03 + x07) | 0;\n x15 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x15 ^ x03, 16);\n x11 = (x11 + x15) | 0;\n x07 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x07 ^ x11, 12);\n x03 = (x03 + x07) | 0;\n x15 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x15 ^ x03, 8);\n x11 = (x11 + x15) | 0;\n x07 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x07 ^ x11, 7);\n x00 = (x00 + x05) | 0;\n x15 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x15 ^ x00, 16);\n x10 = (x10 + x15) | 0;\n x05 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x05 ^ x10, 12);\n x00 = (x00 + x05) | 0;\n x15 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x15 ^ x00, 8);\n x10 = (x10 + x15) | 0;\n x05 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x05 ^ x10, 7);\n x01 = (x01 + x06) | 0;\n x12 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x12 ^ x01, 16);\n x11 = (x11 + x12) | 0;\n x06 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x06 ^ x11, 12);\n x01 = (x01 + x06) | 0;\n x12 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x12 ^ x01, 8);\n x11 = (x11 + x12) | 0;\n x06 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x06 ^ x11, 7);\n x02 = (x02 + x07) | 0;\n x13 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x13 ^ x02, 16);\n x08 = (x08 + x13) | 0;\n x07 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x07 ^ x08, 12);\n x02 = (x02 + x07) | 0;\n x13 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x13 ^ x02, 8);\n x08 = (x08 + x13) | 0;\n x07 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x07 ^ x08, 7);\n x03 = (x03 + x04) | 0;\n x14 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x14 ^ x03, 16);\n x09 = (x09 + x14) | 0;\n x04 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x04 ^ x09, 12);\n x03 = (x03 + x04) | 0;\n x14 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x14 ^ x03, 8);\n x09 = (x09 + x14) | 0;\n x04 = (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.rotl)(x04 ^ x09, 7);\n }\n let oi = 0;\n o32[oi++] = x00;\n o32[oi++] = x01;\n o32[oi++] = x02;\n o32[oi++] = x03;\n o32[oi++] = x12;\n o32[oi++] = x13;\n o32[oi++] = x14;\n o32[oi++] = x15;\n}\n/**\n * Original, non-RFC chacha20 from DJB. 8-byte nonce, 8-byte counter.\n */\nconst chacha20orig = /* @__PURE__ */ (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.createCipher)(chachaCore, {\n counterRight: false,\n counterLength: 8,\n allowShortKeys: true,\n});\n/**\n * ChaCha stream cipher. Conforms to RFC 8439 (IETF, TLS). 12-byte nonce, 4-byte counter.\n * With 12-byte nonce, it's not safe to use fill it with random (CSPRNG), due to collision chance.\n */\nconst chacha20 = /* @__PURE__ */ (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.createCipher)(chachaCore, {\n counterRight: false,\n counterLength: 4,\n allowShortKeys: false,\n});\n/**\n * XChaCha eXtended-nonce ChaCha. 24-byte nonce.\n * With 24-byte nonce, it's safe to use fill it with random (CSPRNG).\n * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-xchacha\n */\nconst xchacha20 = /* @__PURE__ */ (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.createCipher)(chachaCore, {\n counterRight: false,\n counterLength: 8,\n extendNonceFn: hchacha,\n allowShortKeys: false,\n});\n/**\n * Reduced 8-round chacha, described in original paper.\n */\nconst chacha8 = /* @__PURE__ */ (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.createCipher)(chachaCore, {\n counterRight: false,\n counterLength: 4,\n rounds: 8,\n});\n/**\n * Reduced 12-round chacha, described in original paper.\n */\nconst chacha12 = /* @__PURE__ */ (0,_arx_js__WEBPACK_IMPORTED_MODULE_2__.createCipher)(chachaCore, {\n counterRight: false,\n counterLength: 4,\n rounds: 12,\n});\nconst ZEROS16 = /* @__PURE__ */ new Uint8Array(16);\n// Pad to digest size with zeros\nconst updatePadded = (h, msg) => {\n h.update(msg);\n const left = msg.length % 16;\n if (left)\n h.update(ZEROS16.subarray(left));\n};\nconst ZEROS32 = /* @__PURE__ */ new Uint8Array(32);\nfunction computeTag(fn, key, nonce, data, AAD) {\n const authKey = fn(key, nonce, ZEROS32);\n const h = _poly1305_js__WEBPACK_IMPORTED_MODULE_1__.poly1305.create(authKey);\n if (AAD)\n updatePadded(h, AAD);\n updatePadded(h, data);\n const num = new Uint8Array(16);\n const view = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.createView)(num);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.setBigUint64)(view, 0, BigInt(AAD ? AAD.length : 0), true);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.setBigUint64)(view, 8, BigInt(data.length), true);\n h.update(num);\n const res = h.digest();\n authKey.fill(0);\n return res;\n}\n/**\n * AEAD algorithm from RFC 8439.\n * Salsa20 and chacha (RFC 8439) use poly1305 differently.\n * We could have composed them similar to:\n * https://github.com/paulmillr/scure-base/blob/b266c73dde977b1dd7ef40ef7a23cc15aab526b3/index.ts#L250\n * But it's hard because of authKey:\n * In salsa20, authKey changes position in salsa stream.\n * In chacha, authKey can't be computed inside computeTag, it modifies the counter.\n */\nconst _poly1305_aead = (xorStream) => (key, nonce, AAD) => {\n const tagLength = 16;\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)(key, 32);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)(nonce);\n return {\n encrypt: (plaintext, output) => {\n const plength = plaintext.length;\n const clength = plength + tagLength;\n if (output) {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)(output, clength);\n }\n else {\n output = new Uint8Array(clength);\n }\n xorStream(key, nonce, plaintext, output, 1);\n const tag = computeTag(xorStream, key, nonce, output.subarray(0, -tagLength), AAD);\n output.set(tag, plength); // append tag\n return output;\n },\n decrypt: (ciphertext, output) => {\n const clength = ciphertext.length;\n const plength = clength - tagLength;\n if (clength < tagLength)\n throw new Error(`encrypted data must be at least ${tagLength} bytes`);\n if (output) {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)(output, plength);\n }\n else {\n output = new Uint8Array(plength);\n }\n const data = ciphertext.subarray(0, -tagLength);\n const passedTag = ciphertext.subarray(-tagLength);\n const tag = computeTag(xorStream, key, nonce, data, AAD);\n if (!(0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.equalBytes)(passedTag, tag))\n throw new Error('invalid tag');\n xorStream(key, nonce, data, output, 1);\n return output;\n },\n };\n};\n/**\n * ChaCha20-Poly1305 from RFC 8439.\n * With 12-byte nonce, it's not safe to use fill it with random (CSPRNG), due to collision chance.\n */\nconst chacha20poly1305 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.wrapCipher)({ blockSize: 64, nonceLength: 12, tagLength: 16 }, _poly1305_aead(chacha20));\n/**\n * XChaCha20-Poly1305 extended-nonce chacha.\n * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-xchacha\n * With 24-byte nonce, it's safe to use fill it with random (CSPRNG).\n */\nconst xchacha20poly1305 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.wrapCipher)({ blockSize: 64, nonceLength: 24, tagLength: 16 }, _poly1305_aead(xchacha20));\n//# sourceMappingURL=chacha.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/ciphers/esm/chacha.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/ciphers/esm/utils.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@noble/ciphers/esm/utils.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Hash: () => (/* binding */ Hash),\n/* harmony export */ asyncLoop: () => (/* binding */ asyncLoop),\n/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex),\n/* harmony export */ bytesToNumberBE: () => (/* binding */ bytesToNumberBE),\n/* harmony export */ bytesToUtf8: () => (/* binding */ bytesToUtf8),\n/* harmony export */ checkOpts: () => (/* binding */ checkOpts),\n/* harmony export */ concatBytes: () => (/* binding */ concatBytes),\n/* harmony export */ createView: () => (/* binding */ createView),\n/* harmony export */ ensureBytes: () => (/* binding */ ensureBytes),\n/* harmony export */ equalBytes: () => (/* binding */ equalBytes),\n/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes),\n/* harmony export */ hexToNumber: () => (/* binding */ hexToNumber),\n/* harmony export */ isLE: () => (/* binding */ isLE),\n/* harmony export */ nextTick: () => (/* binding */ nextTick),\n/* harmony export */ numberToBytesBE: () => (/* binding */ numberToBytesBE),\n/* harmony export */ setBigUint64: () => (/* binding */ setBigUint64),\n/* harmony export */ toBytes: () => (/* binding */ toBytes),\n/* harmony export */ u16: () => (/* binding */ u16),\n/* harmony export */ u32: () => (/* binding */ u32),\n/* harmony export */ u64Lengths: () => (/* binding */ u64Lengths),\n/* harmony export */ u8: () => (/* binding */ u8),\n/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes),\n/* harmony export */ wrapCipher: () => (/* binding */ wrapCipher)\n/* harmony export */ });\n/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */\n// Cast array to different type\nconst u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nconst u16 = (arr) => new Uint16Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 2));\nconst u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\nfunction isBytes(a) {\n return (a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));\n}\n// Cast array to view\nconst createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// big-endian hardware is rare. Just in case someone still decides to run ciphers:\n// early-throw an error because we don't support BE yet.\nconst isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nfunction bytesToHex(bytes) {\n if (!isBytes(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };\nfunction asciiToBase16(char) {\n if (char >= asciis._0 && char <= asciis._9)\n return char - asciis._0;\n if (char >= asciis._A && char <= asciis._F)\n return char - (asciis._A - 10);\n if (char >= asciis._a && char <= asciis._f)\n return char - (asciis._a - 10);\n return;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2;\n }\n return array;\n}\nfunction hexToNumber(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n // Big Endian\n return BigInt(hex === '' ? '0' : `0x${hex}`);\n}\n// BE: Big Endian, LE: Little Endian\nfunction bytesToNumberBE(bytes) {\n return hexToNumber(bytesToHex(bytes));\n}\nfunction numberToBytesBE(n, len) {\n return hexToBytes(n.toString(16).padStart(len * 2, '0'));\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nconst nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nasync function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nfunction utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\nfunction bytesToUtf8(bytes) {\n return new TextDecoder().decode(bytes);\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nfunction toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n else if (isBytes(data))\n data = data.slice();\n else\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nfunction concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n if (!isBytes(a))\n throw new Error('Uint8Array expected');\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n// Check if object doens't have custom constructor (like Uint8Array/Array)\nconst isPlainObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]' && obj.constructor === Object;\nfunction checkOpts(defaults, opts) {\n if (opts !== undefined && (typeof opts !== 'object' || !isPlainObject(opts)))\n throw new Error('options must be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nfunction ensureBytes(b, len) {\n if (!isBytes(b))\n throw new Error('Uint8Array expected');\n if (typeof len === 'number')\n if (b.length !== len)\n throw new Error(`Uint8Array length ${len} expected`);\n}\n// Compares 2 u8a-s in kinda constant time\nfunction equalBytes(a, b) {\n if (a.length !== b.length)\n return false;\n let diff = 0;\n for (let i = 0; i < a.length; i++)\n diff |= a[i] ^ b[i];\n return diff === 0;\n}\n// For runtime check if class implements interface\nclass Hash {\n}\nconst wrapCipher = (params, c) => {\n Object.assign(c, params);\n return c;\n};\n// Polyfill for Safari 14\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\nfunction u64Lengths(ciphertext, AAD) {\n const num = new Uint8Array(16);\n const view = createView(num);\n setBigUint64(view, 0, BigInt(AAD ? AAD.length : 0), true);\n setBigUint64(view, 8, BigInt(ciphertext.length), true);\n return num;\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/ciphers/esm/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/curves/esm/_shortw_utils.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/@noble/curves/esm/_shortw_utils.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCurve: () => (/* binding */ createCurve),\n/* harmony export */ getHash: () => (/* binding */ getHash)\n/* harmony export */ });\n/* harmony import */ var _noble_hashes_hmac__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/hmac */ \"./node_modules/@noble/hashes/esm/hmac.js\");\n/* harmony import */ var _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/hashes/utils */ \"./node_modules/@noble/hashes/esm/utils.js\");\n/* harmony import */ var _abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract/weierstrass.js */ \"./node_modules/@noble/curves/esm/abstract/weierstrass.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n\n\n// connects noble-curves to noble-hashes\nfunction getHash(hash) {\n return {\n hash,\n hmac: (key, ...msgs) => (0,_noble_hashes_hmac__WEBPACK_IMPORTED_MODULE_0__.hmac)(hash, key, (0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(...msgs)),\n randomBytes: _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__.randomBytes,\n };\n}\nfunction createCurve(curveDef, defHash) {\n const create = (hash) => (0,_abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_2__.weierstrass)({ ...curveDef, ...getHash(hash) });\n return Object.freeze({ ...create(defHash), create });\n}\n//# sourceMappingURL=_shortw_utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/curves/esm/_shortw_utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/curves/esm/abstract/curve.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@noble/curves/esm/abstract/curve.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ validateBasic: () => (/* binding */ validateBasic),\n/* harmony export */ wNAF: () => (/* binding */ wNAF)\n/* harmony export */ });\n/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Abelian group utilities\n\n\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\n// Elliptic curve multiplication of Point by scalar. Fragile.\n// Scalars should always be less than curve order: this should be checked inside of a curve itself.\n// Creates precomputation tables for fast multiplication:\n// - private scalar is split by fixed size windows of W bits\n// - every window point is collected from window's table & added to accumulator\n// - since windows are different, same point inside tables won't be accessed more than once per calc\n// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar)\n// - +1 window is neccessary for wNAF\n// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication\n// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow\n// windows to be in different memory locations\nfunction wNAF(c, bits) {\n const constTimeNegate = (condition, item) => {\n const neg = item.negate();\n return condition ? neg : item;\n };\n const opts = (W) => {\n const windows = Math.ceil(bits / W) + 1; // +1, because\n const windowSize = 2 ** (W - 1); // -1 because we skip zero\n return { windows, windowSize };\n };\n return {\n constTimeNegate,\n // non-const time multiplication ladder\n unsafeLadder(elm, n) {\n let p = c.ZERO;\n let d = elm;\n while (n > _0n) {\n if (n & _1n)\n p = p.add(d);\n d = d.double();\n n >>= _1n;\n }\n return p;\n },\n /**\n * Creates a wNAF precomputation window. Used for caching.\n * Default window size is set by `utils.precompute()` and is equal to 8.\n * Number of precomputed points depends on the curve size:\n * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:\n * - 𝑊 is the window size\n * - 𝑛 is the bitlength of the curve order.\n * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.\n * @returns precomputed point tables flattened to a single array\n */\n precomputeWindow(elm, W) {\n const { windows, windowSize } = opts(W);\n const points = [];\n let p = elm;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n // =1, because we skip zero\n for (let i = 1; i < windowSize; i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n },\n /**\n * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.\n * @param W window size\n * @param precomputes precomputed tables\n * @param n scalar (we don't check here, but should be less than curve order)\n * @returns real and fake (for const-time) points\n */\n wNAF(W, precomputes, n) {\n // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise\n // But need to carefully remove other checks before wNAF. ORDER == bits here\n const { windows, windowSize } = opts(W);\n let p = c.ZERO;\n let f = c.BASE;\n const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc.\n const maxNumber = 2 ** W;\n const shiftBy = BigInt(W);\n for (let window = 0; window < windows; window++) {\n const offset = window * windowSize;\n // Extract W bits.\n let wbits = Number(n & mask);\n // Shift number by W bits.\n n >>= shiftBy;\n // If the bits are bigger than max size, we'll split those.\n // +224 => 256 - 32\n if (wbits > windowSize) {\n wbits -= maxNumber;\n n += _1n;\n }\n // This code was first written with assumption that 'f' and 'p' will never be infinity point:\n // since each addition is multiplied by 2 ** W, it cannot cancel each other. However,\n // there is negate now: it is possible that negated element from low value\n // would be the same as high element, which will create carry into next window.\n // It's not obvious how this can fail, but still worth investigating later.\n // Check if we're onto Zero point.\n // Add random point inside current window to f.\n const offset1 = offset;\n const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero\n const cond1 = window % 2 !== 0;\n const cond2 = wbits < 0;\n if (wbits === 0) {\n // The most important part for const-time getPublicKey\n f = f.add(constTimeNegate(cond1, precomputes[offset1]));\n }\n else {\n p = p.add(constTimeNegate(cond2, precomputes[offset2]));\n }\n }\n // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ()\n // Even if the variable is still unused, there are some checks which will\n // throw an exception, so compiler needs to prove they won't happen, which is hard.\n // At this point there is a way to F be infinity-point even if p is not,\n // which makes it less const-time: around 1 bigint multiply.\n return { p, f };\n },\n wNAFCached(P, precomputesMap, n, transform) {\n // @ts-ignore\n const W = P._WINDOW_SIZE || 1;\n // Calculate precomputes on a first run, reuse them after\n let comp = precomputesMap.get(P);\n if (!comp) {\n comp = this.precomputeWindow(P, W);\n if (W !== 1) {\n precomputesMap.set(P, transform(comp));\n }\n }\n return this.wNAF(W, comp, n);\n },\n };\n}\nfunction validateBasic(curve) {\n (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.validateField)(curve.Fp);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject)(curve, {\n n: 'bigint',\n h: 'bigint',\n Gx: 'field',\n Gy: 'field',\n }, {\n nBitLength: 'isSafeInteger',\n nByteLength: 'isSafeInteger',\n });\n // Set defaults\n return Object.freeze({\n ...(0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.nLength)(curve.n, curve.nBitLength),\n ...curve,\n ...{ p: curve.Fp.ORDER },\n });\n}\n//# sourceMappingURL=curve.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/curves/esm/abstract/curve.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/curves/esm/abstract/edwards.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@noble/curves/esm/abstract/edwards.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ twistedEdwards: () => (/* binding */ twistedEdwards)\n/* harmony export */ });\n/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/* harmony import */ var _curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./curve.js */ \"./node_modules/@noble/curves/esm/abstract/curve.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y²\n\n\n\n\n// Be friendly to bad ECMAScript parsers by not using bigint literals\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _8n = BigInt(8);\n// verification rule is either zip215 or rfc8032 / nist186-5. Consult fromHex:\nconst VERIFY_DEFAULT = { zip215: true };\nfunction validateOpts(curve) {\n const opts = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.validateBasic)(curve);\n _utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject(curve, {\n hash: 'function',\n a: 'bigint',\n d: 'bigint',\n randomBytes: 'function',\n }, {\n adjustScalarBytes: 'function',\n domain: 'function',\n uvRatio: 'function',\n mapToCurve: 'function',\n });\n // Set defaults\n return Object.freeze({ ...opts });\n}\n// It is not generic twisted curve for now, but ed25519/ed448 generic implementation\nfunction twistedEdwards(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { Fp, n: CURVE_ORDER, prehash: prehash, hash: cHash, randomBytes, nByteLength, h: cofactor, } = CURVE;\n const MASK = _2n << (BigInt(nByteLength * 8) - _1n);\n const modP = Fp.create; // Function overrides\n // sqrt(u/v)\n const uvRatio = CURVE.uvRatio ||\n ((u, v) => {\n try {\n return { isValid: true, value: Fp.sqrt(u * Fp.inv(v)) };\n }\n catch (e) {\n return { isValid: false, value: _0n };\n }\n });\n const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes); // NOOP\n const domain = CURVE.domain ||\n ((data, ctx, phflag) => {\n if (ctx.length || phflag)\n throw new Error('Contexts/pre-hash are not supported');\n return data;\n }); // NOOP\n const inBig = (n) => typeof n === 'bigint' && _0n < n; // n in [1..]\n const inRange = (n, max) => inBig(n) && inBig(max) && n < max; // n in [1..max-1]\n const in0MaskRange = (n) => n === _0n || inRange(n, MASK); // n in [0..MASK-1]\n function assertInRange(n, max) {\n // n in [1..max-1]\n if (inRange(n, max))\n return n;\n throw new Error(`Expected valid scalar < ${max}, got ${typeof n} ${n}`);\n }\n function assertGE0(n) {\n // n in [0..CURVE_ORDER-1]\n return n === _0n ? n : assertInRange(n, CURVE_ORDER); // GE = prime subgroup, not full group\n }\n const pointPrecomputes = new Map();\n function isPoint(other) {\n if (!(other instanceof Point))\n throw new Error('ExtendedPoint expected');\n }\n // Extended Point works in extended coordinates: (x, y, z, t) ∋ (x=x/z, y=y/z, t=xy).\n // https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates\n class Point {\n constructor(ex, ey, ez, et) {\n this.ex = ex;\n this.ey = ey;\n this.ez = ez;\n this.et = et;\n if (!in0MaskRange(ex))\n throw new Error('x required');\n if (!in0MaskRange(ey))\n throw new Error('y required');\n if (!in0MaskRange(ez))\n throw new Error('z required');\n if (!in0MaskRange(et))\n throw new Error('t required');\n }\n get x() {\n return this.toAffine().x;\n }\n get y() {\n return this.toAffine().y;\n }\n static fromAffine(p) {\n if (p instanceof Point)\n throw new Error('extended point not allowed');\n const { x, y } = p || {};\n if (!in0MaskRange(x) || !in0MaskRange(y))\n throw new Error('invalid affine point');\n return new Point(x, y, _1n, modP(x * y));\n }\n static normalizeZ(points) {\n const toInv = Fp.invertBatch(points.map((p) => p.ez));\n return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n }\n // \"Private method\", don't use it directly\n _setWindowSize(windowSize) {\n this._WINDOW_SIZE = windowSize;\n pointPrecomputes.delete(this);\n }\n // Not required for fromHex(), which always creates valid points.\n // Could be useful for fromAffine().\n assertValidity() {\n const { a, d } = CURVE;\n if (this.is0())\n throw new Error('bad point: ZERO'); // TODO: optimize, with vars below?\n // Equation in affine coordinates: ax² + y² = 1 + dx²y²\n // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y²\n const { ex: X, ey: Y, ez: Z, et: T } = this;\n const X2 = modP(X * X); // X²\n const Y2 = modP(Y * Y); // Y²\n const Z2 = modP(Z * Z); // Z²\n const Z4 = modP(Z2 * Z2); // Z⁴\n const aX2 = modP(X2 * a); // aX²\n const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z²\n const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y²\n if (left !== right)\n throw new Error('bad point: equation left != right (1)');\n // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T\n const XY = modP(X * Y);\n const ZT = modP(Z * T);\n if (XY !== ZT)\n throw new Error('bad point: equation left != right (2)');\n }\n // Compare one point to another.\n equals(other) {\n isPoint(other);\n const { ex: X1, ey: Y1, ez: Z1 } = this;\n const { ex: X2, ey: Y2, ez: Z2 } = other;\n const X1Z2 = modP(X1 * Z2);\n const X2Z1 = modP(X2 * Z1);\n const Y1Z2 = modP(Y1 * Z2);\n const Y2Z1 = modP(Y2 * Z1);\n return X1Z2 === X2Z1 && Y1Z2 === Y2Z1;\n }\n is0() {\n return this.equals(Point.ZERO);\n }\n negate() {\n // Flips point sign to a negative one (-x, y in affine coords)\n return new Point(modP(-this.ex), this.ey, this.ez, modP(-this.et));\n }\n // Fast algo for doubling Extended Point.\n // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd\n // Cost: 4M + 4S + 1*a + 6add + 1*2.\n double() {\n const { a } = CURVE;\n const { ex: X1, ey: Y1, ez: Z1 } = this;\n const A = modP(X1 * X1); // A = X12\n const B = modP(Y1 * Y1); // B = Y12\n const C = modP(_2n * modP(Z1 * Z1)); // C = 2*Z12\n const D = modP(a * A); // D = a*A\n const x1y1 = X1 + Y1;\n const E = modP(modP(x1y1 * x1y1) - A - B); // E = (X1+Y1)2-A-B\n const G = D + B; // G = D+B\n const F = G - C; // F = G-C\n const H = D - B; // H = D-B\n const X3 = modP(E * F); // X3 = E*F\n const Y3 = modP(G * H); // Y3 = G*H\n const T3 = modP(E * H); // T3 = E*H\n const Z3 = modP(F * G); // Z3 = F*G\n return new Point(X3, Y3, Z3, T3);\n }\n // Fast algo for adding 2 Extended Points.\n // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd\n // Cost: 9M + 1*a + 1*d + 7add.\n add(other) {\n isPoint(other);\n const { a, d } = CURVE;\n const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this;\n const { ex: X2, ey: Y2, ez: Z2, et: T2 } = other;\n // Faster algo for adding 2 Extended Points when curve's a=-1.\n // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-4\n // Cost: 8M + 8add + 2*2.\n // Note: It does not check whether the `other` point is valid.\n if (a === BigInt(-1)) {\n const A = modP((Y1 - X1) * (Y2 + X2));\n const B = modP((Y1 + X1) * (Y2 - X2));\n const F = modP(B - A);\n if (F === _0n)\n return this.double(); // Same point. Tests say it doesn't affect timing\n const C = modP(Z1 * _2n * T2);\n const D = modP(T1 * _2n * Z2);\n const E = D + C;\n const G = B + A;\n const H = D - C;\n const X3 = modP(E * F);\n const Y3 = modP(G * H);\n const T3 = modP(E * H);\n const Z3 = modP(F * G);\n return new Point(X3, Y3, Z3, T3);\n }\n const A = modP(X1 * X2); // A = X1*X2\n const B = modP(Y1 * Y2); // B = Y1*Y2\n const C = modP(T1 * d * T2); // C = T1*d*T2\n const D = modP(Z1 * Z2); // D = Z1*Z2\n const E = modP((X1 + Y1) * (X2 + Y2) - A - B); // E = (X1+Y1)*(X2+Y2)-A-B\n const F = D - C; // F = D-C\n const G = D + C; // G = D+C\n const H = modP(B - a * A); // H = B-a*A\n const X3 = modP(E * F); // X3 = E*F\n const Y3 = modP(G * H); // Y3 = G*H\n const T3 = modP(E * H); // T3 = E*H\n const Z3 = modP(F * G); // Z3 = F*G\n return new Point(X3, Y3, Z3, T3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n wNAF(n) {\n return wnaf.wNAFCached(this, pointPrecomputes, n, Point.normalizeZ);\n }\n // Constant-time multiplication.\n multiply(scalar) {\n const { p, f } = this.wNAF(assertInRange(scalar, CURVE_ORDER));\n return Point.normalizeZ([p, f])[0];\n }\n // Non-constant-time multiplication. Uses double-and-add algorithm.\n // It's faster, but should only be used when you don't care about\n // an exposed private key e.g. sig verification.\n // Does NOT allow scalars higher than CURVE.n.\n multiplyUnsafe(scalar) {\n let n = assertGE0(scalar); // 0 <= scalar < CURVE.n\n if (n === _0n)\n return I;\n if (this.equals(I) || n === _1n)\n return this;\n if (this.equals(G))\n return this.wNAF(n).p;\n return wnaf.unsafeLadder(this, n);\n }\n // Checks if point is of small order.\n // If you add something to small order point, you will have \"dirty\"\n // point with torsion component.\n // Multiplies point by cofactor and checks if the result is 0.\n isSmallOrder() {\n return this.multiplyUnsafe(cofactor).is0();\n }\n // Multiplies point by curve order and checks if the result is 0.\n // Returns `false` is the point is dirty.\n isTorsionFree() {\n return wnaf.unsafeLadder(this, CURVE_ORDER).is0();\n }\n // Converts Extended point to default (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n toAffine(iz) {\n const { ex: x, ey: y, ez: z } = this;\n const is0 = this.is0();\n if (iz == null)\n iz = is0 ? _8n : Fp.inv(z); // 8 was chosen arbitrarily\n const ax = modP(x * iz);\n const ay = modP(y * iz);\n const zz = modP(z * iz);\n if (is0)\n return { x: _0n, y: _1n };\n if (zz !== _1n)\n throw new Error('invZ was invalid');\n return { x: ax, y: ay };\n }\n clearCofactor() {\n const { h: cofactor } = CURVE;\n if (cofactor === _1n)\n return this;\n return this.multiplyUnsafe(cofactor);\n }\n // Converts hash string or Uint8Array to Point.\n // Uses algo from RFC8032 5.1.3.\n static fromHex(hex, zip215 = false) {\n const { d, a } = CURVE;\n const len = Fp.BYTES;\n hex = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('pointHex', hex, len); // copy hex to a new array\n const normed = hex.slice(); // copy again, we'll manipulate it\n const lastByte = hex[len - 1]; // select last byte\n normed[len - 1] = lastByte & ~0x80; // clear last bit\n const y = _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberLE(normed);\n if (y === _0n) {\n // y=0 is allowed\n }\n else {\n // RFC8032 prohibits >= p, but ZIP215 doesn't\n if (zip215)\n assertInRange(y, MASK); // zip215=true [1..P-1] (2^255-19-1 for ed25519)\n else\n assertInRange(y, Fp.ORDER); // zip215=false [1..MASK-1] (2^256-1 for ed25519)\n }\n // Ed25519: x² = (y²-1)/(dy²+1) mod p. Ed448: x² = (y²-1)/(dy²-1) mod p. Generic case:\n // ax²+y²=1+dx²y² => y²-1=dx²y²-ax² => y²-1=x²(dy²-a) => x²=(y²-1)/(dy²-a)\n const y2 = modP(y * y); // denominator is always non-0 mod p.\n const u = modP(y2 - _1n); // u = y² - 1\n const v = modP(d * y2 - a); // v = d y² + 1.\n let { isValid, value: x } = uvRatio(u, v); // √(u/v)\n if (!isValid)\n throw new Error('Point.fromHex: invalid y coordinate');\n const isXOdd = (x & _1n) === _1n; // There are 2 square roots. Use x_0 bit to select proper\n const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit\n if (!zip215 && x === _0n && isLastByteOdd)\n // if x=0 and x_0 = 1, fail\n throw new Error('Point.fromHex: x=0 and x_0=1');\n if (isLastByteOdd !== isXOdd)\n x = modP(-x); // if x_0 != x mod 2, set x = p-x\n return Point.fromAffine({ x, y });\n }\n static fromPrivateKey(privKey) {\n return getExtendedPublicKey(privKey).point;\n }\n toRawBytes() {\n const { x, y } = this.toAffine();\n const bytes = _utils_js__WEBPACK_IMPORTED_MODULE_1__.numberToBytesLE(y, Fp.BYTES); // each y has 2 x values (x, -y)\n bytes[bytes.length - 1] |= x & _1n ? 0x80 : 0; // when compressing, it's enough to store y\n return bytes; // and use the last byte to encode sign of x\n }\n toHex() {\n return _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToHex(this.toRawBytes()); // Same as toRawBytes, but returns string.\n }\n }\n Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy));\n Point.ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0\n const { BASE: G, ZERO: I } = Point;\n const wnaf = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.wNAF)(Point, nByteLength * 8);\n function modN(a) {\n return (0,_modular_js__WEBPACK_IMPORTED_MODULE_2__.mod)(a, CURVE_ORDER);\n }\n // Little-endian SHA512 with modulo n\n function modN_LE(hash) {\n return modN(_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberLE(hash));\n }\n /** Convenience method that creates public key and other stuff. RFC8032 5.1.5 */\n function getExtendedPublicKey(key) {\n const len = nByteLength;\n key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('private key', key, len);\n // Hash private key with curve's hash function to produce uniformingly random input\n // Check byte lengths: ensure(64, h(ensure(32, key)))\n const hashed = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('hashed private key', cHash(key), 2 * len);\n const head = adjustScalarBytes(hashed.slice(0, len)); // clear first half bits, produce FE\n const prefix = hashed.slice(len, 2 * len); // second half is called key prefix (5.1.6)\n const scalar = modN_LE(head); // The actual private scalar\n const point = G.multiply(scalar); // Point on Edwards curve aka public key\n const pointBytes = point.toRawBytes(); // Uint8Array representation\n return { head, prefix, scalar, point, pointBytes };\n }\n // Calculates EdDSA pub key. RFC8032 5.1.5. Privkey is hashed. Use first half with 3 bits cleared\n function getPublicKey(privKey) {\n return getExtendedPublicKey(privKey).pointBytes;\n }\n // int('LE', SHA512(dom2(F, C) || msgs)) mod N\n function hashDomainToScalar(context = new Uint8Array(), ...msgs) {\n const msg = _utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes(...msgs);\n return modN_LE(cHash(domain(msg, (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('context', context), !!prehash)));\n }\n /** Signs message with privateKey. RFC8032 5.1.6 */\n function sign(msg, privKey, options = {}) {\n msg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('message', msg);\n if (prehash)\n msg = prehash(msg); // for ed25519ph etc.\n const { prefix, scalar, pointBytes } = getExtendedPublicKey(privKey);\n const r = hashDomainToScalar(options.context, prefix, msg); // r = dom2(F, C) || prefix || PH(M)\n const R = G.multiply(r).toRawBytes(); // R = rG\n const k = hashDomainToScalar(options.context, R, pointBytes, msg); // R || A || PH(M)\n const s = modN(r + k * scalar); // S = (r + k * s) mod L\n assertGE0(s); // 0 <= s < l\n const res = _utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes(R, _utils_js__WEBPACK_IMPORTED_MODULE_1__.numberToBytesLE(s, Fp.BYTES));\n return (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('result', res, nByteLength * 2); // 64-byte signature\n }\n const verifyOpts = VERIFY_DEFAULT;\n function verify(sig, msg, publicKey, options = verifyOpts) {\n const { context, zip215 } = options;\n const len = Fp.BYTES; // Verifies EdDSA signature against message and public key. RFC8032 5.1.7.\n sig = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('signature', sig, 2 * len); // An extended group equation is checked.\n msg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('message', msg);\n if (prehash)\n msg = prehash(msg); // for ed25519ph, etc\n const s = _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberLE(sig.slice(len, 2 * len));\n // zip215: true is good for consensus-critical apps and allows points < 2^256\n // zip215: false follows RFC8032 / NIST186-5 and restricts points to CURVE.p\n let A, R, SB;\n try {\n A = Point.fromHex(publicKey, zip215);\n R = Point.fromHex(sig.slice(0, len), zip215);\n SB = G.multiplyUnsafe(s); // 0 <= s < l is done inside\n }\n catch (error) {\n return false;\n }\n if (!zip215 && A.isSmallOrder())\n return false;\n const k = hashDomainToScalar(context, R.toRawBytes(), A.toRawBytes(), msg);\n const RkA = R.add(A.multiplyUnsafe(k));\n // [8][S]B = [8]R + [8][k]A'\n return RkA.subtract(SB).clearCofactor().equals(Point.ZERO);\n }\n G._setWindowSize(8); // Enable precomputes. Slows down first publicKey computation by 20ms.\n const utils = {\n getExtendedPublicKey,\n // ed25519 private keys are uniform 32b. No need to check for modulo bias, like in secp256k1.\n randomPrivateKey: () => randomBytes(Fp.BYTES),\n /**\n * We're doing scalar multiplication (used in getPublicKey etc) with precomputed BASE_POINT\n * values. This slows down first getPublicKey() by milliseconds (see Speed section),\n * but allows to speed-up subsequent getPublicKey() calls up to 20x.\n * @param windowSize 2, 4, 8, 16\n */\n precompute(windowSize = 8, point = Point.BASE) {\n point._setWindowSize(windowSize);\n point.multiply(BigInt(3));\n return point;\n },\n };\n return {\n CURVE,\n getPublicKey,\n sign,\n verify,\n ExtendedPoint: Point,\n utils,\n };\n}\n//# sourceMappingURL=edwards.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/curves/esm/abstract/edwards.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/curves/esm/abstract/hash-to-curve.js":
|
||
/*!******************************************************************!*\
|
||
!*** ./node_modules/@noble/curves/esm/abstract/hash-to-curve.js ***!
|
||
\******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createHasher: () => (/* binding */ createHasher),\n/* harmony export */ expand_message_xmd: () => (/* binding */ expand_message_xmd),\n/* harmony export */ expand_message_xof: () => (/* binding */ expand_message_xof),\n/* harmony export */ hash_to_field: () => (/* binding */ hash_to_field),\n/* harmony export */ isogenyMap: () => (/* binding */ isogenyMap)\n/* harmony export */ });\n/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n\n\n// Octet Stream to Integer. \"spec\" implementation of os2ip is 2.5x slower vs bytesToNumberBE.\nconst os2ip = _utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberBE;\n// Integer to Octet Stream (numberToBytesBE)\nfunction i2osp(value, length) {\n if (value < 0 || value >= 1 << (8 * length)) {\n throw new Error(`bad I2OSP call: value=${value} length=${length}`);\n }\n const res = Array.from({ length }).fill(0);\n for (let i = length - 1; i >= 0; i--) {\n res[i] = value & 0xff;\n value >>>= 8;\n }\n return new Uint8Array(res);\n}\nfunction strxor(a, b) {\n const arr = new Uint8Array(a.length);\n for (let i = 0; i < a.length; i++) {\n arr[i] = a[i] ^ b[i];\n }\n return arr;\n}\nfunction anum(item) {\n if (!Number.isSafeInteger(item))\n throw new Error('number expected');\n}\n// Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits\n// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1\nfunction expand_message_xmd(msg, DST, lenInBytes, H) {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(msg);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(DST);\n anum(lenInBytes);\n // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3\n if (DST.length > 255)\n DST = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.concatBytes)((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.utf8ToBytes)('H2C-OVERSIZE-DST-'), DST));\n const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H;\n const ell = Math.ceil(lenInBytes / b_in_bytes);\n if (ell > 255)\n throw new Error('Invalid xmd length');\n const DST_prime = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.concatBytes)(DST, i2osp(DST.length, 1));\n const Z_pad = i2osp(0, r_in_bytes);\n const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str\n const b = new Array(ell);\n const b_0 = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.concatBytes)(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime));\n b[0] = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.concatBytes)(b_0, i2osp(1, 1), DST_prime));\n for (let i = 1; i <= ell; i++) {\n const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime];\n b[i] = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.concatBytes)(...args));\n }\n const pseudo_random_bytes = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.concatBytes)(...b);\n return pseudo_random_bytes.slice(0, lenInBytes);\n}\n// Produces a uniformly random byte string using an extendable-output function (XOF) H.\n// 1. The collision resistance of H MUST be at least k bits.\n// 2. H MUST be an XOF that has been proved indifferentiable from\n// a random oracle under a reasonable cryptographic assumption.\n// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2\nfunction expand_message_xof(msg, DST, lenInBytes, k, H) {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(msg);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(DST);\n anum(lenInBytes);\n // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3\n // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8));\n if (DST.length > 255) {\n const dkLen = Math.ceil((2 * k) / 8);\n DST = H.create({ dkLen }).update((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.utf8ToBytes)('H2C-OVERSIZE-DST-')).update(DST).digest();\n }\n if (lenInBytes > 65535 || DST.length > 255)\n throw new Error('expand_message_xof: invalid lenInBytes');\n return (H.create({ dkLen: lenInBytes })\n .update(msg)\n .update(i2osp(lenInBytes, 2))\n // 2. DST_prime = DST || I2OSP(len(DST), 1)\n .update(DST)\n .update(i2osp(DST.length, 1))\n .digest());\n}\n/**\n * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F\n * https://www.rfc-editor.org/rfc/rfc9380#section-5.2\n * @param msg a byte string containing the message to hash\n * @param count the number of elements of F to output\n * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above\n * @returns [u_0, ..., u_(count - 1)], a list of field elements.\n */\nfunction hash_to_field(msg, count, options) {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.validateObject)(options, {\n DST: 'stringOrUint8Array',\n p: 'bigint',\n m: 'isSafeInteger',\n k: 'isSafeInteger',\n hash: 'hash',\n });\n const { p, k, m, hash, expand, DST: _DST } = options;\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(msg);\n anum(count);\n const DST = typeof _DST === 'string' ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.utf8ToBytes)(_DST) : _DST;\n const log2p = p.toString(2).length;\n const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above\n const len_in_bytes = count * m * L;\n let prb; // pseudo_random_bytes\n if (expand === 'xmd') {\n prb = expand_message_xmd(msg, DST, len_in_bytes, hash);\n }\n else if (expand === 'xof') {\n prb = expand_message_xof(msg, DST, len_in_bytes, k, hash);\n }\n else if (expand === '_internal_pass') {\n // for internal tests only\n prb = msg;\n }\n else {\n throw new Error('expand must be \"xmd\" or \"xof\"');\n }\n const u = new Array(count);\n for (let i = 0; i < count; i++) {\n const e = new Array(m);\n for (let j = 0; j < m; j++) {\n const elm_offset = L * (j + i * m);\n const tv = prb.subarray(elm_offset, elm_offset + L);\n e[j] = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.mod)(os2ip(tv), p);\n }\n u[i] = e;\n }\n return u;\n}\nfunction isogenyMap(field, map) {\n // Make same order as in spec\n const COEFF = map.map((i) => Array.from(i).reverse());\n return (x, y) => {\n const [xNum, xDen, yNum, yDen] = COEFF.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i)));\n x = field.div(xNum, xDen); // xNum / xDen\n y = field.mul(y, field.div(yNum, yDen)); // y * (yNum / yDev)\n return { x, y };\n };\n}\nfunction createHasher(Point, mapToCurve, def) {\n if (typeof mapToCurve !== 'function')\n throw new Error('mapToCurve() must be defined');\n return {\n // Encodes byte string to elliptic curve.\n // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3\n hashToCurve(msg, options) {\n const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options });\n const u0 = Point.fromAffine(mapToCurve(u[0]));\n const u1 = Point.fromAffine(mapToCurve(u[1]));\n const P = u0.add(u1).clearCofactor();\n P.assertValidity();\n return P;\n },\n // Encodes byte string to elliptic curve.\n // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3\n encodeToCurve(msg, options) {\n const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options });\n const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor();\n P.assertValidity();\n return P;\n },\n };\n}\n//# sourceMappingURL=hash-to-curve.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/curves/esm/abstract/hash-to-curve.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/curves/esm/abstract/modular.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@noble/curves/esm/abstract/modular.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Field: () => (/* binding */ Field),\n/* harmony export */ FpDiv: () => (/* binding */ FpDiv),\n/* harmony export */ FpInvertBatch: () => (/* binding */ FpInvertBatch),\n/* harmony export */ FpIsSquare: () => (/* binding */ FpIsSquare),\n/* harmony export */ FpPow: () => (/* binding */ FpPow),\n/* harmony export */ FpSqrt: () => (/* binding */ FpSqrt),\n/* harmony export */ FpSqrtEven: () => (/* binding */ FpSqrtEven),\n/* harmony export */ FpSqrtOdd: () => (/* binding */ FpSqrtOdd),\n/* harmony export */ getFieldBytesLength: () => (/* binding */ getFieldBytesLength),\n/* harmony export */ getMinHashLength: () => (/* binding */ getMinHashLength),\n/* harmony export */ hashToPrivateScalar: () => (/* binding */ hashToPrivateScalar),\n/* harmony export */ invert: () => (/* binding */ invert),\n/* harmony export */ isNegativeLE: () => (/* binding */ isNegativeLE),\n/* harmony export */ mapHashToField: () => (/* binding */ mapHashToField),\n/* harmony export */ mod: () => (/* binding */ mod),\n/* harmony export */ nLength: () => (/* binding */ nLength),\n/* harmony export */ pow: () => (/* binding */ pow),\n/* harmony export */ pow2: () => (/* binding */ pow2),\n/* harmony export */ tonelliShanks: () => (/* binding */ tonelliShanks),\n/* harmony export */ validateField: () => (/* binding */ validateField)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Utilities for modular arithmetics and finite fields\n\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);\n// prettier-ignore\nconst _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8);\n// prettier-ignore\nconst _9n = BigInt(9), _16n = BigInt(16);\n// Calculates a modulo b\nfunction mod(a, b) {\n const result = a % b;\n return result >= _0n ? result : b + result;\n}\n/**\n * Efficiently raise num to power and do modular division.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n * @example\n * pow(2n, 6n, 11n) // 64n % 11n == 9n\n */\n// TODO: use field version && remove\nfunction pow(num, power, modulo) {\n if (modulo <= _0n || power < _0n)\n throw new Error('Expected power/modulo > 0');\n if (modulo === _1n)\n return _0n;\n let res = _1n;\n while (power > _0n) {\n if (power & _1n)\n res = (res * num) % modulo;\n num = (num * num) % modulo;\n power >>= _1n;\n }\n return res;\n}\n// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4)\nfunction pow2(x, power, modulo) {\n let res = x;\n while (power-- > _0n) {\n res *= res;\n res %= modulo;\n }\n return res;\n}\n// Inverses number over modulo\nfunction invert(number, modulo) {\n if (number === _0n || modulo <= _0n) {\n throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);\n }\n // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/\n // Fermat's little theorem \"CT-like\" version inv(n) = n^(m-2) mod m is 30x slower.\n let a = mod(number, modulo);\n let b = modulo;\n // prettier-ignore\n let x = _0n, y = _1n, u = _1n, v = _0n;\n while (a !== _0n) {\n // JIT applies optimization if those two lines follow each other\n const q = b / a;\n const r = b % a;\n const m = x - u * q;\n const n = y - v * q;\n // prettier-ignore\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n const gcd = b;\n if (gcd !== _1n)\n throw new Error('invert: does not exist');\n return mod(x, modulo);\n}\n/**\n * Tonelli-Shanks square root search algorithm.\n * 1. https://eprint.iacr.org/2012/685.pdf (page 12)\n * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks\n * Will start an infinite loop if field order P is not prime.\n * @param P field order\n * @returns function that takes field Fp (created from P) and number n\n */\nfunction tonelliShanks(P) {\n // Legendre constant: used to calculate Legendre symbol (a | p),\n // which denotes the value of a^((p-1)/2) (mod p).\n // (a | p) ≡ 1 if a is a square (mod p)\n // (a | p) ≡ -1 if a is not a square (mod p)\n // (a | p) ≡ 0 if a ≡ 0 (mod p)\n const legendreC = (P - _1n) / _2n;\n let Q, S, Z;\n // Step 1: By factoring out powers of 2 from p - 1,\n // find q and s such that p - 1 = q*(2^s) with q odd\n for (Q = P - _1n, S = 0; Q % _2n === _0n; Q /= _2n, S++)\n ;\n // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq\n for (Z = _2n; Z < P && pow(Z, legendreC, P) !== P - _1n; Z++)\n ;\n // Fast-path\n if (S === 1) {\n const p1div4 = (P + _1n) / _4n;\n return function tonelliFast(Fp, n) {\n const root = Fp.pow(n, p1div4);\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Slow-path\n const Q1div2 = (Q + _1n) / _2n;\n return function tonelliSlow(Fp, n) {\n // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1\n if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE))\n throw new Error('Cannot find square root');\n let r = S;\n // TODO: will fail at Fp2/etc\n let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b\n let x = Fp.pow(n, Q1div2); // first guess at the square root\n let b = Fp.pow(n, Q); // first guess at the fudge factor\n while (!Fp.eql(b, Fp.ONE)) {\n if (Fp.eql(b, Fp.ZERO))\n return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0)\n // Find m such b^(2^m)==1\n let m = 1;\n for (let t2 = Fp.sqr(b); m < r; m++) {\n if (Fp.eql(t2, Fp.ONE))\n break;\n t2 = Fp.sqr(t2); // t2 *= t2\n }\n // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow\n const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1)\n g = Fp.sqr(ge); // g = ge * ge\n x = Fp.mul(x, ge); // x *= ge\n b = Fp.mul(b, g); // b *= g\n r = m;\n }\n return x;\n };\n}\nfunction FpSqrt(P) {\n // NOTE: different algorithms can give different roots, it is up to user to decide which one they want.\n // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve).\n // P ≡ 3 (mod 4)\n // √n = n^((P+1)/4)\n if (P % _4n === _3n) {\n // Not all roots possible!\n // const ORDER =\n // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn;\n // const NUM = 72057594037927816n;\n const p1div4 = (P + _1n) / _4n;\n return function sqrt3mod4(Fp, n) {\n const root = Fp.pow(n, p1div4);\n // Throw if root**2 != n\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10)\n if (P % _8n === _5n) {\n const c1 = (P - _5n) / _8n;\n return function sqrt5mod8(Fp, n) {\n const n2 = Fp.mul(n, _2n);\n const v = Fp.pow(n2, c1);\n const nv = Fp.mul(n, v);\n const i = Fp.mul(Fp.mul(nv, _2n), v);\n const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // P ≡ 9 (mod 16)\n if (P % _16n === _9n) {\n // NOTE: tonelli is too slow for bls-Fp2 calculations even on start\n // Means we cannot use sqrt for constants at all!\n //\n // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F\n // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F\n // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F\n // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic\n // sqrt = (x) => {\n // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4\n // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1\n // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1\n // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1\n // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x\n // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x\n // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x\n // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x\n // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x\n // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2\n // }\n }\n // Other cases: Tonelli-Shanks algorithm\n return tonelliShanks(P);\n}\n// Little-endian check for first LE bit (last BE bit);\nconst isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n;\n// prettier-ignore\nconst FIELD_FIELDS = [\n 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr',\n 'eql', 'add', 'sub', 'mul', 'pow', 'div',\n 'addN', 'subN', 'mulN', 'sqrN'\n];\nfunction validateField(field) {\n const initial = {\n ORDER: 'bigint',\n MASK: 'bigint',\n BYTES: 'isSafeInteger',\n BITS: 'isSafeInteger',\n };\n const opts = FIELD_FIELDS.reduce((map, val) => {\n map[val] = 'function';\n return map;\n }, initial);\n return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.validateObject)(field, opts);\n}\n// Generic field functions\n/**\n * Same as `pow` but for Fp: non-constant-time.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n */\nfunction FpPow(f, num, power) {\n // Should have same speed as pow for bigints\n // TODO: benchmark!\n if (power < _0n)\n throw new Error('Expected power > 0');\n if (power === _0n)\n return f.ONE;\n if (power === _1n)\n return num;\n let p = f.ONE;\n let d = num;\n while (power > _0n) {\n if (power & _1n)\n p = f.mul(p, d);\n d = f.sqr(d);\n power >>= _1n;\n }\n return p;\n}\n/**\n * Efficiently invert an array of Field elements.\n * `inv(0)` will return `undefined` here: make sure to throw an error.\n */\nfunction FpInvertBatch(f, nums) {\n const tmp = new Array(nums.length);\n // Walk from first to last, multiply them by each other MOD p\n const lastMultiplied = nums.reduce((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = acc;\n return f.mul(acc, num);\n }, f.ONE);\n // Invert last element\n const inverted = f.inv(lastMultiplied);\n // Walk from last to first, multiply them by inverted each other MOD p\n nums.reduceRight((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = f.mul(acc, tmp[i]);\n return f.mul(acc, num);\n }, inverted);\n return tmp;\n}\nfunction FpDiv(f, lhs, rhs) {\n return f.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, f.ORDER) : f.inv(rhs));\n}\n// This function returns True whenever the value x is a square in the field F.\nfunction FpIsSquare(f) {\n const legendreConst = (f.ORDER - _1n) / _2n; // Integer arithmetic\n return (x) => {\n const p = f.pow(x, legendreConst);\n return f.eql(p, f.ZERO) || f.eql(p, f.ONE);\n };\n}\n// CURVE.n lengths\nfunction nLength(n, nBitLength) {\n // Bit size, byte size of CURVE.n\n const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;\n const nByteLength = Math.ceil(_nBitLength / 8);\n return { nBitLength: _nBitLength, nByteLength };\n}\n/**\n * Initializes a finite field over prime. **Non-primes are not supported.**\n * Do not init in loop: slow. Very fragile: always run a benchmark on a change.\n * Major performance optimizations:\n * * a) denormalized operations like mulN instead of mul\n * * b) same object shape: never add or remove keys\n * * c) Object.freeze\n * @param ORDER prime positive bigint\n * @param bitLen how many bits the field consumes\n * @param isLE (def: false) if encoding / decoding should be in little-endian\n * @param redef optional faster redefinitions of sqrt and other methods\n */\nfunction Field(ORDER, bitLen, isLE = false, redef = {}) {\n if (ORDER <= _0n)\n throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);\n const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen);\n if (BYTES > 2048)\n throw new Error('Field lengths over 2048 bytes are not supported');\n const sqrtP = FpSqrt(ORDER);\n const f = Object.freeze({\n ORDER,\n BITS,\n BYTES,\n MASK: (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bitMask)(BITS),\n ZERO: _0n,\n ONE: _1n,\n create: (num) => mod(num, ORDER),\n isValid: (num) => {\n if (typeof num !== 'bigint')\n throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);\n return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible\n },\n is0: (num) => num === _0n,\n isOdd: (num) => (num & _1n) === _1n,\n neg: (num) => mod(-num, ORDER),\n eql: (lhs, rhs) => lhs === rhs,\n sqr: (num) => mod(num * num, ORDER),\n add: (lhs, rhs) => mod(lhs + rhs, ORDER),\n sub: (lhs, rhs) => mod(lhs - rhs, ORDER),\n mul: (lhs, rhs) => mod(lhs * rhs, ORDER),\n pow: (num, power) => FpPow(f, num, power),\n div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),\n // Same as above, but doesn't normalize\n sqrN: (num) => num * num,\n addN: (lhs, rhs) => lhs + rhs,\n subN: (lhs, rhs) => lhs - rhs,\n mulN: (lhs, rhs) => lhs * rhs,\n inv: (num) => invert(num, ORDER),\n sqrt: redef.sqrt || ((n) => sqrtP(f, n)),\n invertBatch: (lst) => FpInvertBatch(f, lst),\n // TODO: do we really need constant cmov?\n // We don't have const-time bigints anyway, so probably will be not very useful\n cmov: (a, b, c) => (c ? b : a),\n toBytes: (num) => (isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesLE)(num, BYTES) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesBE)(num, BYTES)),\n fromBytes: (bytes) => {\n if (bytes.length !== BYTES)\n throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`);\n return isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(bytes) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberBE)(bytes);\n },\n });\n return Object.freeze(f);\n}\nfunction FpSqrtOdd(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? root : Fp.neg(root);\n}\nfunction FpSqrtEven(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? Fp.neg(root) : root;\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field).\n * Which makes it slightly more biased, less secure.\n * @deprecated use mapKeyToField instead\n */\nfunction hashToPrivateScalar(hash, groupOrder, isLE = false) {\n hash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('privateHash', hash);\n const hashLen = hash.length;\n const minLen = nLength(groupOrder).nByteLength + 8;\n if (minLen < 24 || hashLen < minLen || hashLen > 1024)\n throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`);\n const num = isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(hash) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberBE)(hash);\n return mod(num, groupOrder - _1n) + _1n;\n}\n/**\n * Returns total number of bytes consumed by the field element.\n * For example, 32 bytes for usual 256-bit weierstrass curve.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of field\n */\nfunction getFieldBytesLength(fieldOrder) {\n if (typeof fieldOrder !== 'bigint')\n throw new Error('field order must be bigint');\n const bitLength = fieldOrder.toString(2).length;\n return Math.ceil(bitLength / 8);\n}\n/**\n * Returns minimal amount of bytes that can be safely reduced\n * by field order.\n * Should be 2^-128 for 128-bit curve such as P256.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of target hash\n */\nfunction getMinHashLength(fieldOrder) {\n const length = getFieldBytesLength(fieldOrder);\n return length + Math.ceil(length / 2);\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF\n * and convert them into private scalar, with the modulo bias being negligible.\n * Needs at least 48 bytes of input for 32-byte private key.\n * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/\n * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final\n * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5\n * @param hash hash output from SHA3 or a similar function\n * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n)\n * @param isLE interpret hash bytes as LE num\n * @returns valid private scalar\n */\nfunction mapHashToField(key, fieldOrder, isLE = false) {\n const len = key.length;\n const fieldLen = getFieldBytesLength(fieldOrder);\n const minLen = getMinHashLength(fieldOrder);\n // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings.\n if (len < 16 || len < minLen || len > 1024)\n throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);\n const num = isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberBE)(key) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(key);\n // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0\n const reduced = mod(num, fieldOrder - _1n) + _1n;\n return isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesLE)(reduced, fieldLen) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesBE)(reduced, fieldLen);\n}\n//# sourceMappingURL=modular.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/curves/esm/abstract/modular.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/curves/esm/abstract/montgomery.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/@noble/curves/esm/abstract/montgomery.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ montgomery: () => (/* binding */ montgomery)\n/* harmony export */ });\n/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nfunction validateOpts(curve) {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.validateObject)(curve, {\n a: 'bigint',\n }, {\n montgomeryBits: 'isSafeInteger',\n nByteLength: 'isSafeInteger',\n adjustScalarBytes: 'function',\n domain: 'function',\n powPminus2: 'function',\n Gu: 'bigint',\n });\n // Set defaults\n return Object.freeze({ ...curve });\n}\n// NOTE: not really montgomery curve, just bunch of very specific methods for X25519/X448 (RFC 7748, https://www.rfc-editor.org/rfc/rfc7748)\n// Uses only one coordinate instead of two\nfunction montgomery(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { P } = CURVE;\n const modP = (n) => (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.mod)(n, P);\n const montgomeryBits = CURVE.montgomeryBits;\n const montgomeryBytes = Math.ceil(montgomeryBits / 8);\n const fieldLen = CURVE.nByteLength;\n const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes);\n const powPminus2 = CURVE.powPminus2 || ((x) => (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.pow)(x, P - BigInt(2), P));\n // cswap from RFC7748. But it is not from RFC7748!\n /*\n cswap(swap, x_2, x_3):\n dummy = mask(swap) AND (x_2 XOR x_3)\n x_2 = x_2 XOR dummy\n x_3 = x_3 XOR dummy\n Return (x_2, x_3)\n Where mask(swap) is the all-1 or all-0 word of the same length as x_2\n and x_3, computed, e.g., as mask(swap) = 0 - swap.\n */\n function cswap(swap, x_2, x_3) {\n const dummy = modP(swap * (x_2 - x_3));\n x_2 = modP(x_2 - dummy);\n x_3 = modP(x_3 + dummy);\n return [x_2, x_3];\n }\n // Accepts 0 as well\n function assertFieldElement(n) {\n if (typeof n === 'bigint' && _0n <= n && n < P)\n return n;\n throw new Error('Expected valid scalar 0 < scalar < CURVE.P');\n }\n // x25519 from 4\n // The constant a24 is (486662 - 2) / 4 = 121665 for curve25519/X25519\n const a24 = (CURVE.a - BigInt(2)) / BigInt(4);\n /**\n *\n * @param pointU u coordinate (x) on Montgomery Curve 25519\n * @param scalar by which the point would be multiplied\n * @returns new Point on Montgomery curve\n */\n function montgomeryLadder(pointU, scalar) {\n const u = assertFieldElement(pointU);\n // Section 5: Implementations MUST accept non-canonical values and process them as\n // if they had been reduced modulo the field prime.\n const k = assertFieldElement(scalar);\n const x_1 = u;\n let x_2 = _1n;\n let z_2 = _0n;\n let x_3 = u;\n let z_3 = _1n;\n let swap = _0n;\n let sw;\n for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) {\n const k_t = (k >> t) & _1n;\n swap ^= k_t;\n sw = cswap(swap, x_2, x_3);\n x_2 = sw[0];\n x_3 = sw[1];\n sw = cswap(swap, z_2, z_3);\n z_2 = sw[0];\n z_3 = sw[1];\n swap = k_t;\n const A = x_2 + z_2;\n const AA = modP(A * A);\n const B = x_2 - z_2;\n const BB = modP(B * B);\n const E = AA - BB;\n const C = x_3 + z_3;\n const D = x_3 - z_3;\n const DA = modP(D * A);\n const CB = modP(C * B);\n const dacb = DA + CB;\n const da_cb = DA - CB;\n x_3 = modP(dacb * dacb);\n z_3 = modP(x_1 * modP(da_cb * da_cb));\n x_2 = modP(AA * BB);\n z_2 = modP(E * (AA + modP(a24 * E)));\n }\n // (x_2, x_3) = cswap(swap, x_2, x_3)\n sw = cswap(swap, x_2, x_3);\n x_2 = sw[0];\n x_3 = sw[1];\n // (z_2, z_3) = cswap(swap, z_2, z_3)\n sw = cswap(swap, z_2, z_3);\n z_2 = sw[0];\n z_3 = sw[1];\n // z_2^(p - 2)\n const z2 = powPminus2(z_2);\n // Return x_2 * (z_2^(p - 2))\n return modP(x_2 * z2);\n }\n function encodeUCoordinate(u) {\n return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesLE)(modP(u), montgomeryBytes);\n }\n function decodeUCoordinate(uEnc) {\n // Section 5: When receiving such an array, implementations of X25519\n // MUST mask the most significant bit in the final byte.\n const u = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('u coordinate', uEnc, montgomeryBytes);\n if (fieldLen === 32)\n u[31] &= 127; // 0b0111_1111\n return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(u);\n }\n function decodeScalar(n) {\n const bytes = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('scalar', n);\n const len = bytes.length;\n if (len !== montgomeryBytes && len !== fieldLen)\n throw new Error(`Expected ${montgomeryBytes} or ${fieldLen} bytes, got ${len}`);\n return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(adjustScalarBytes(bytes));\n }\n function scalarMult(scalar, u) {\n const pointU = decodeUCoordinate(u);\n const _scalar = decodeScalar(scalar);\n const pu = montgomeryLadder(pointU, _scalar);\n // The result was not contributory\n // https://cr.yp.to/ecdh.html#validate\n if (pu === _0n)\n throw new Error('Invalid private or public key received');\n return encodeUCoordinate(pu);\n }\n // Computes public key from private. By doing scalar multiplication of base point.\n const GuBytes = encodeUCoordinate(CURVE.Gu);\n function scalarMultBase(scalar) {\n return scalarMult(scalar, GuBytes);\n }\n return {\n scalarMult,\n scalarMultBase,\n getSharedSecret: (privateKey, publicKey) => scalarMult(privateKey, publicKey),\n getPublicKey: (privateKey) => scalarMultBase(privateKey),\n utils: { randomPrivateKey: () => CURVE.randomBytes(CURVE.nByteLength) },\n GuBytes: GuBytes,\n };\n}\n//# sourceMappingURL=montgomery.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/curves/esm/abstract/montgomery.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/curves/esm/abstract/utils.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@noble/curves/esm/abstract/utils.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ abytes: () => (/* binding */ abytes),\n/* harmony export */ bitGet: () => (/* binding */ bitGet),\n/* harmony export */ bitLen: () => (/* binding */ bitLen),\n/* harmony export */ bitMask: () => (/* binding */ bitMask),\n/* harmony export */ bitSet: () => (/* binding */ bitSet),\n/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex),\n/* harmony export */ bytesToNumberBE: () => (/* binding */ bytesToNumberBE),\n/* harmony export */ bytesToNumberLE: () => (/* binding */ bytesToNumberLE),\n/* harmony export */ concatBytes: () => (/* binding */ concatBytes),\n/* harmony export */ createHmacDrbg: () => (/* binding */ createHmacDrbg),\n/* harmony export */ ensureBytes: () => (/* binding */ ensureBytes),\n/* harmony export */ equalBytes: () => (/* binding */ equalBytes),\n/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes),\n/* harmony export */ hexToNumber: () => (/* binding */ hexToNumber),\n/* harmony export */ isBytes: () => (/* binding */ isBytes),\n/* harmony export */ numberToBytesBE: () => (/* binding */ numberToBytesBE),\n/* harmony export */ numberToBytesLE: () => (/* binding */ numberToBytesLE),\n/* harmony export */ numberToHexUnpadded: () => (/* binding */ numberToHexUnpadded),\n/* harmony export */ numberToVarBytesBE: () => (/* binding */ numberToVarBytesBE),\n/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes),\n/* harmony export */ validateObject: () => (/* binding */ validateObject)\n/* harmony export */ });\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// 100 lines of code in the file are duplicated from noble-hashes (utils).\n// This is OK: `abstract` directory does not use noble-hashes.\n// User may opt-in into using different hashing library. This way, noble-hashes\n// won't be included into their bundle.\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nfunction isBytes(a) {\n return (a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));\n}\nfunction abytes(item) {\n if (!isBytes(item))\n throw new Error('Uint8Array expected');\n}\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nfunction bytesToHex(bytes) {\n abytes(bytes);\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\nfunction numberToHexUnpadded(num) {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n}\nfunction hexToNumber(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n // Big Endian\n return BigInt(hex === '' ? '0' : `0x${hex}`);\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };\nfunction asciiToBase16(char) {\n if (char >= asciis._0 && char <= asciis._9)\n return char - asciis._0;\n if (char >= asciis._A && char <= asciis._F)\n return char - (asciis._A - 10);\n if (char >= asciis._a && char <= asciis._f)\n return char - (asciis._a - 10);\n return;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2;\n }\n return array;\n}\n// BE: Big Endian, LE: Little Endian\nfunction bytesToNumberBE(bytes) {\n return hexToNumber(bytesToHex(bytes));\n}\nfunction bytesToNumberLE(bytes) {\n abytes(bytes);\n return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));\n}\nfunction numberToBytesBE(n, len) {\n return hexToBytes(n.toString(16).padStart(len * 2, '0'));\n}\nfunction numberToBytesLE(n, len) {\n return numberToBytesBE(n, len).reverse();\n}\n// Unpadded, rarely used\nfunction numberToVarBytesBE(n) {\n return hexToBytes(numberToHexUnpadded(n));\n}\n/**\n * Takes hex string or Uint8Array, converts to Uint8Array.\n * Validates output length.\n * Will throw error for other types.\n * @param title descriptive title for an error e.g. 'private key'\n * @param hex hex string or Uint8Array\n * @param expectedLength optional, will compare to result array's length\n * @returns\n */\nfunction ensureBytes(title, hex, expectedLength) {\n let res;\n if (typeof hex === 'string') {\n try {\n res = hexToBytes(hex);\n }\n catch (e) {\n throw new Error(`${title} must be valid hex string, got \"${hex}\". Cause: ${e}`);\n }\n }\n else if (isBytes(hex)) {\n // Uint8Array.from() instead of hash.slice() because node.js Buffer\n // is instance of Uint8Array, and its slice() creates **mutable** copy\n res = Uint8Array.from(hex);\n }\n else {\n throw new Error(`${title} must be hex string or Uint8Array`);\n }\n const len = res.length;\n if (typeof expectedLength === 'number' && len !== expectedLength)\n throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);\n return res;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nfunction concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n// Compares 2 u8a-s in kinda constant time\nfunction equalBytes(a, b) {\n if (a.length !== b.length)\n return false;\n let diff = 0;\n for (let i = 0; i < a.length; i++)\n diff |= a[i] ^ b[i];\n return diff === 0;\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nfunction utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n// Bit operations\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n */\nfunction bitLen(n) {\n let len;\n for (len = 0; n > _0n; n >>= _1n, len += 1)\n ;\n return len;\n}\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n */\nfunction bitGet(n, pos) {\n return (n >> BigInt(pos)) & _1n;\n}\n/**\n * Sets single bit at position.\n */\nfunction bitSet(n, pos, value) {\n return n | ((value ? _1n : _0n) << BigInt(pos));\n}\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n */\nconst bitMask = (n) => (_2n << BigInt(n - 1)) - _1n;\n// DRBG\nconst u8n = (data) => new Uint8Array(data); // creates Uint8Array\nconst u8fr = (arr) => Uint8Array.from(arr); // another shortcut\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @returns function that will call DRBG until 2nd arg returns something meaningful\n * @example\n * const drbg = createHmacDRBG<Key>(32, 32, hmac);\n * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined\n */\nfunction createHmacDrbg(hashLen, qByteLen, hmacFn) {\n if (typeof hashLen !== 'number' || hashLen < 2)\n throw new Error('hashLen must be a number');\n if (typeof qByteLen !== 'number' || qByteLen < 2)\n throw new Error('qByteLen must be a number');\n if (typeof hmacFn !== 'function')\n throw new Error('hmacFn must be a function');\n // Step B, Step C: set hashLen to 8*ceil(hlen/8)\n let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same\n let i = 0; // Iterations counter, will throw when over 1000\n const reset = () => {\n v.fill(1);\n k.fill(0);\n i = 0;\n };\n const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values)\n const reseed = (seed = u8n()) => {\n // HMAC-DRBG reseed() function. Steps D-G\n k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed)\n v = h(); // v = hmac(k || v)\n if (seed.length === 0)\n return;\n k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed)\n v = h(); // v = hmac(k || v)\n };\n const gen = () => {\n // HMAC-DRBG generate() function\n if (i++ >= 1000)\n throw new Error('drbg: tried 1000 values');\n let len = 0;\n const out = [];\n while (len < qByteLen) {\n v = h();\n const sl = v.slice();\n out.push(sl);\n len += v.length;\n }\n return concatBytes(...out);\n };\n const genUntil = (seed, pred) => {\n reset();\n reseed(seed); // Steps D-G\n let res = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(gen())))\n reseed();\n reset();\n return res;\n };\n return genUntil;\n}\n// Validating curves and fields\nconst validatorFns = {\n bigint: (val) => typeof val === 'bigint',\n function: (val) => typeof val === 'function',\n boolean: (val) => typeof val === 'boolean',\n string: (val) => typeof val === 'string',\n stringOrUint8Array: (val) => typeof val === 'string' || isBytes(val),\n isSafeInteger: (val) => Number.isSafeInteger(val),\n array: (val) => Array.isArray(val),\n field: (val, object) => object.Fp.isValid(val),\n hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen),\n};\n// type Record<K extends string | number | symbol, T> = { [P in K]: T; }\nfunction validateObject(object, validators, optValidators = {}) {\n const checkField = (fieldName, type, isOptional) => {\n const checkVal = validatorFns[type];\n if (typeof checkVal !== 'function')\n throw new Error(`Invalid validator \"${type}\", expected function`);\n const val = object[fieldName];\n if (isOptional && val === undefined)\n return;\n if (!checkVal(val, object)) {\n throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`);\n }\n };\n for (const [fieldName, type] of Object.entries(validators))\n checkField(fieldName, type, false);\n for (const [fieldName, type] of Object.entries(optValidators))\n checkField(fieldName, type, true);\n return object;\n}\n// validate type tests\n// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };\n// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!\n// // Should fail type-check\n// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });\n// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });\n// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });\n// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/curves/esm/abstract/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/curves/esm/abstract/weierstrass.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@noble/curves/esm/abstract/weierstrass.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DER: () => (/* binding */ DER),\n/* harmony export */ SWUFpSqrtRatio: () => (/* binding */ SWUFpSqrtRatio),\n/* harmony export */ mapToCurveSimpleSWU: () => (/* binding */ mapToCurveSimpleSWU),\n/* harmony export */ weierstrass: () => (/* binding */ weierstrass),\n/* harmony export */ weierstrassPoints: () => (/* binding */ weierstrassPoints)\n/* harmony export */ });\n/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/* harmony import */ var _curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./curve.js */ \"./node_modules/@noble/curves/esm/abstract/curve.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Short Weierstrass curve. The formula is: y² = x³ + ax + b\n\n\n\n\nfunction validatePointOpts(curve) {\n const opts = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.validateBasic)(curve);\n _utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject(opts, {\n a: 'field',\n b: 'field',\n }, {\n allowedPrivateKeyLengths: 'array',\n wrapPrivateKey: 'boolean',\n isTorsionFree: 'function',\n clearCofactor: 'function',\n allowInfinityPoint: 'boolean',\n fromBytes: 'function',\n toBytes: 'function',\n });\n const { endo, Fp, a } = opts;\n if (endo) {\n if (!Fp.eql(a, Fp.ZERO)) {\n throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0');\n }\n if (typeof endo !== 'object' ||\n typeof endo.beta !== 'bigint' ||\n typeof endo.splitScalar !== 'function') {\n throw new Error('Expected endomorphism with beta: bigint and splitScalar: function');\n }\n }\n return Object.freeze({ ...opts });\n}\n// ASN.1 DER encoding utilities\nconst { bytesToNumberBE: b2n, hexToBytes: h2b } = _utils_js__WEBPACK_IMPORTED_MODULE_1__;\nconst DER = {\n // asn.1 DER encoding utils\n Err: class DERErr extends Error {\n constructor(m = '') {\n super(m);\n }\n },\n _parseInt(data) {\n const { Err: E } = DER;\n if (data.length < 2 || data[0] !== 0x02)\n throw new E('Invalid signature integer tag');\n const len = data[1];\n const res = data.subarray(2, len + 2);\n if (!len || res.length !== len)\n throw new E('Invalid signature integer: wrong length');\n // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,\n // since we always use positive integers here. It must always be empty:\n // - add zero byte if exists\n // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)\n if (res[0] & 0b10000000)\n throw new E('Invalid signature integer: negative');\n if (res[0] === 0x00 && !(res[1] & 0b10000000))\n throw new E('Invalid signature integer: unnecessary leading zero');\n return { d: b2n(res), l: data.subarray(len + 2) }; // d is data, l is left\n },\n toSig(hex) {\n // parse DER signature\n const { Err: E } = DER;\n const data = typeof hex === 'string' ? h2b(hex) : hex;\n _utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes(data);\n let l = data.length;\n if (l < 2 || data[0] != 0x30)\n throw new E('Invalid signature tag');\n if (data[1] !== l - 2)\n throw new E('Invalid signature: incorrect length');\n const { d: r, l: sBytes } = DER._parseInt(data.subarray(2));\n const { d: s, l: rBytesLeft } = DER._parseInt(sBytes);\n if (rBytesLeft.length)\n throw new E('Invalid signature: left bytes after parsing');\n return { r, s };\n },\n hexFromSig(sig) {\n // Add leading zero if first byte has negative bit enabled. More details in '_parseInt'\n const slice = (s) => (Number.parseInt(s[0], 16) & 0b1000 ? '00' + s : s);\n const h = (num) => {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n };\n const s = slice(h(sig.s));\n const r = slice(h(sig.r));\n const shl = s.length / 2;\n const rhl = r.length / 2;\n const sl = h(shl);\n const rl = h(rhl);\n return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;\n },\n};\n// Be friendly to bad ECMAScript parsers by not using bigint literals\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4);\nfunction weierstrassPoints(opts) {\n const CURVE = validatePointOpts(opts);\n const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ\n const toBytes = CURVE.toBytes ||\n ((_c, point, _isCompressed) => {\n const a = point.toAffine();\n return _utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y));\n });\n const fromBytes = CURVE.fromBytes ||\n ((bytes) => {\n // const head = bytes[0];\n const tail = bytes.subarray(1);\n // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported');\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n });\n /**\n * y² = x³ + ax + b: Short weierstrass curve formula\n * @returns y²\n */\n function weierstrassEquation(x) {\n const { a, b } = CURVE;\n const x2 = Fp.sqr(x); // x * x\n const x3 = Fp.mul(x2, x); // x2 * x\n return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b\n }\n // Validate whether the passed curve params are valid.\n // We check if curve equation works for generator point.\n // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381.\n // ProjectivePoint class has not been initialized yet.\n if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))\n throw new Error('bad generator point: equation left != right');\n // Valid group elements reside in range 1..n-1\n function isWithinCurveOrder(num) {\n return typeof num === 'bigint' && _0n < num && num < CURVE.n;\n }\n function assertGE(num) {\n if (!isWithinCurveOrder(num))\n throw new Error('Expected valid bigint: 0 < bigint < curve.n');\n }\n // Validates if priv key is valid and converts it to bigint.\n // Supports options allowedPrivateKeyLengths and wrapPrivateKey.\n function normPrivateKeyToScalar(key) {\n const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE;\n if (lengths && typeof key !== 'bigint') {\n if (_utils_js__WEBPACK_IMPORTED_MODULE_1__.isBytes(key))\n key = _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToHex(key);\n // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes\n if (typeof key !== 'string' || !lengths.includes(key.length))\n throw new Error('Invalid key');\n key = key.padStart(nByteLength * 2, '0');\n }\n let num;\n try {\n num =\n typeof key === 'bigint'\n ? key\n : _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberBE((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('private key', key, nByteLength));\n }\n catch (error) {\n throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);\n }\n if (wrapPrivateKey)\n num = _modular_js__WEBPACK_IMPORTED_MODULE_2__.mod(num, n); // disabled by default, enabled for BLS\n assertGE(num); // num in range [1..N-1]\n return num;\n }\n const pointPrecomputes = new Map();\n function assertPrjPoint(other) {\n if (!(other instanceof Point))\n throw new Error('ProjectivePoint expected');\n }\n /**\n * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z)\n * Default Point works in 2d / affine coordinates: (x, y)\n * We're doing calculations in projective, because its operations don't require costly inversion.\n */\n class Point {\n constructor(px, py, pz) {\n this.px = px;\n this.py = py;\n this.pz = pz;\n if (px == null || !Fp.isValid(px))\n throw new Error('x required');\n if (py == null || !Fp.isValid(py))\n throw new Error('y required');\n if (pz == null || !Fp.isValid(pz))\n throw new Error('z required');\n }\n // Does not validate if the point is on-curve.\n // Use fromHex instead, or call assertValidity() later.\n static fromAffine(p) {\n const { x, y } = p || {};\n if (!p || !Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('invalid affine point');\n if (p instanceof Point)\n throw new Error('projective point not allowed');\n const is0 = (i) => Fp.eql(i, Fp.ZERO);\n // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0)\n if (is0(x) && is0(y))\n return Point.ZERO;\n return new Point(x, y, Fp.ONE);\n }\n get x() {\n return this.toAffine().x;\n }\n get y() {\n return this.toAffine().y;\n }\n /**\n * Takes a bunch of Projective Points but executes only one\n * inversion on all of them. Inversion is very slow operation,\n * so this improves performance massively.\n * Optimization: converts a list of projective points to a list of identical points with Z=1.\n */\n static normalizeZ(points) {\n const toInv = Fp.invertBatch(points.map((p) => p.pz));\n return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n }\n /**\n * Converts hash string or Uint8Array to Point.\n * @param hex short/long ECDSA hex\n */\n static fromHex(hex) {\n const P = Point.fromAffine(fromBytes((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('pointHex', hex)));\n P.assertValidity();\n return P;\n }\n // Multiplies generator point by privateKey.\n static fromPrivateKey(privateKey) {\n return Point.BASE.multiply(normPrivateKeyToScalar(privateKey));\n }\n // \"Private method\", don't use it directly\n _setWindowSize(windowSize) {\n this._WINDOW_SIZE = windowSize;\n pointPrecomputes.delete(this);\n }\n // A point on curve is valid if it conforms to equation.\n assertValidity() {\n if (this.is0()) {\n // (0, 1, 0) aka ZERO is invalid in most contexts.\n // In BLS, ZERO can be serialized, so we allow it.\n // (0, 0, 0) is wrong representation of ZERO and is always invalid.\n if (CURVE.allowInfinityPoint && !Fp.is0(this.py))\n return;\n throw new Error('bad point: ZERO');\n }\n // Some 3rd-party test vectors require different wording between here & `fromCompressedHex`\n const { x, y } = this.toAffine();\n // Check if x, y are valid field elements\n if (!Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('bad point: x or y not FE');\n const left = Fp.sqr(y); // y²\n const right = weierstrassEquation(x); // x³ + ax + b\n if (!Fp.eql(left, right))\n throw new Error('bad point: equation left != right');\n if (!this.isTorsionFree())\n throw new Error('bad point: not in prime-order subgroup');\n }\n hasEvenY() {\n const { y } = this.toAffine();\n if (Fp.isOdd)\n return !Fp.isOdd(y);\n throw new Error(\"Field doesn't support isOdd\");\n }\n /**\n * Compare one point to another.\n */\n equals(other) {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1));\n const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1));\n return U1 && U2;\n }\n /**\n * Flips point to one corresponding to (x, -y) in Affine coordinates.\n */\n negate() {\n return new Point(this.px, Fp.neg(this.py), this.pz);\n }\n // Renes-Costello-Batina exception-free doubling formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 3\n // Cost: 8M + 3S + 3*a + 2*b3 + 15add.\n double() {\n const { a, b } = CURVE;\n const b3 = Fp.mul(b, _3n);\n const { px: X1, py: Y1, pz: Z1 } = this;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n let t0 = Fp.mul(X1, X1); // step 1\n let t1 = Fp.mul(Y1, Y1);\n let t2 = Fp.mul(Z1, Z1);\n let t3 = Fp.mul(X1, Y1);\n t3 = Fp.add(t3, t3); // step 5\n Z3 = Fp.mul(X1, Z1);\n Z3 = Fp.add(Z3, Z3);\n X3 = Fp.mul(a, Z3);\n Y3 = Fp.mul(b3, t2);\n Y3 = Fp.add(X3, Y3); // step 10\n X3 = Fp.sub(t1, Y3);\n Y3 = Fp.add(t1, Y3);\n Y3 = Fp.mul(X3, Y3);\n X3 = Fp.mul(t3, X3);\n Z3 = Fp.mul(b3, Z3); // step 15\n t2 = Fp.mul(a, t2);\n t3 = Fp.sub(t0, t2);\n t3 = Fp.mul(a, t3);\n t3 = Fp.add(t3, Z3);\n Z3 = Fp.add(t0, t0); // step 20\n t0 = Fp.add(Z3, t0);\n t0 = Fp.add(t0, t2);\n t0 = Fp.mul(t0, t3);\n Y3 = Fp.add(Y3, t0);\n t2 = Fp.mul(Y1, Z1); // step 25\n t2 = Fp.add(t2, t2);\n t0 = Fp.mul(t2, t3);\n X3 = Fp.sub(X3, t0);\n Z3 = Fp.mul(t2, t1);\n Z3 = Fp.add(Z3, Z3); // step 30\n Z3 = Fp.add(Z3, Z3);\n return new Point(X3, Y3, Z3);\n }\n // Renes-Costello-Batina exception-free addition formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 1\n // Cost: 12M + 0S + 3*a + 3*b3 + 23add.\n add(other) {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n const a = CURVE.a;\n const b3 = Fp.mul(CURVE.b, _3n);\n let t0 = Fp.mul(X1, X2); // step 1\n let t1 = Fp.mul(Y1, Y2);\n let t2 = Fp.mul(Z1, Z2);\n let t3 = Fp.add(X1, Y1);\n let t4 = Fp.add(X2, Y2); // step 5\n t3 = Fp.mul(t3, t4);\n t4 = Fp.add(t0, t1);\n t3 = Fp.sub(t3, t4);\n t4 = Fp.add(X1, Z1);\n let t5 = Fp.add(X2, Z2); // step 10\n t4 = Fp.mul(t4, t5);\n t5 = Fp.add(t0, t2);\n t4 = Fp.sub(t4, t5);\n t5 = Fp.add(Y1, Z1);\n X3 = Fp.add(Y2, Z2); // step 15\n t5 = Fp.mul(t5, X3);\n X3 = Fp.add(t1, t2);\n t5 = Fp.sub(t5, X3);\n Z3 = Fp.mul(a, t4);\n X3 = Fp.mul(b3, t2); // step 20\n Z3 = Fp.add(X3, Z3);\n X3 = Fp.sub(t1, Z3);\n Z3 = Fp.add(t1, Z3);\n Y3 = Fp.mul(X3, Z3);\n t1 = Fp.add(t0, t0); // step 25\n t1 = Fp.add(t1, t0);\n t2 = Fp.mul(a, t2);\n t4 = Fp.mul(b3, t4);\n t1 = Fp.add(t1, t2);\n t2 = Fp.sub(t0, t2); // step 30\n t2 = Fp.mul(a, t2);\n t4 = Fp.add(t4, t2);\n t0 = Fp.mul(t1, t4);\n Y3 = Fp.add(Y3, t0);\n t0 = Fp.mul(t5, t4); // step 35\n X3 = Fp.mul(t3, X3);\n X3 = Fp.sub(X3, t0);\n t0 = Fp.mul(t3, t1);\n Z3 = Fp.mul(t5, Z3);\n Z3 = Fp.add(Z3, t0); // step 40\n return new Point(X3, Y3, Z3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n is0() {\n return this.equals(Point.ZERO);\n }\n wNAF(n) {\n return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => {\n const toInv = Fp.invertBatch(comp.map((p) => p.pz));\n return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n });\n }\n /**\n * Non-constant-time multiplication. Uses double-and-add algorithm.\n * It's faster, but should only be used when you don't care about\n * an exposed private key e.g. sig verification, which works over *public* keys.\n */\n multiplyUnsafe(n) {\n const I = Point.ZERO;\n if (n === _0n)\n return I;\n assertGE(n); // Will throw on 0\n if (n === _1n)\n return this;\n const { endo } = CURVE;\n if (!endo)\n return wnaf.unsafeLadder(this, n);\n // Apply endomorphism\n let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let k1p = I;\n let k2p = I;\n let d = this;\n while (k1 > _0n || k2 > _0n) {\n if (k1 & _1n)\n k1p = k1p.add(d);\n if (k2 & _1n)\n k2p = k2p.add(d);\n d = d.double();\n k1 >>= _1n;\n k2 >>= _1n;\n }\n if (k1neg)\n k1p = k1p.negate();\n if (k2neg)\n k2p = k2p.negate();\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n return k1p.add(k2p);\n }\n /**\n * Constant time multiplication.\n * Uses wNAF method. Windowed method may be 10% faster,\n * but takes 2x longer to generate and consumes 2x memory.\n * Uses precomputes when available.\n * Uses endomorphism for Koblitz curves.\n * @param scalar by which the point would be multiplied\n * @returns New point\n */\n multiply(scalar) {\n assertGE(scalar);\n let n = scalar;\n let point, fake; // Fake point is used to const-time mult\n const { endo } = CURVE;\n if (endo) {\n const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let { p: k1p, f: f1p } = this.wNAF(k1);\n let { p: k2p, f: f2p } = this.wNAF(k2);\n k1p = wnaf.constTimeNegate(k1neg, k1p);\n k2p = wnaf.constTimeNegate(k2neg, k2p);\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n point = k1p.add(k2p);\n fake = f1p.add(f2p);\n }\n else {\n const { p, f } = this.wNAF(n);\n point = p;\n fake = f;\n }\n // Normalize `z` for both points, but return only real one\n return Point.normalizeZ([point, fake])[0];\n }\n /**\n * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.\n * Not using Strauss-Shamir trick: precomputation tables are faster.\n * The trick could be useful if both P and Q are not G (not in our case).\n * @returns non-zero affine point\n */\n multiplyAndAddUnsafe(Q, a, b) {\n const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes\n const mul = (P, a // Select faster multiply() method\n ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a));\n const sum = mul(this, a).add(mul(Q, b));\n return sum.is0() ? undefined : sum;\n }\n // Converts Projective point to affine (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n // (x, y, z) ∋ (x=x/z, y=y/z)\n toAffine(iz) {\n const { px: x, py: y, pz: z } = this;\n const is0 = this.is0();\n // If invZ was 0, we return zero point. However we still want to execute\n // all operations, so we replace invZ with a random number, 1.\n if (iz == null)\n iz = is0 ? Fp.ONE : Fp.inv(z);\n const ax = Fp.mul(x, iz);\n const ay = Fp.mul(y, iz);\n const zz = Fp.mul(z, iz);\n if (is0)\n return { x: Fp.ZERO, y: Fp.ZERO };\n if (!Fp.eql(zz, Fp.ONE))\n throw new Error('invZ was invalid');\n return { x: ax, y: ay };\n }\n isTorsionFree() {\n const { h: cofactor, isTorsionFree } = CURVE;\n if (cofactor === _1n)\n return true; // No subgroups, always torsion-free\n if (isTorsionFree)\n return isTorsionFree(Point, this);\n throw new Error('isTorsionFree() has not been declared for the elliptic curve');\n }\n clearCofactor() {\n const { h: cofactor, clearCofactor } = CURVE;\n if (cofactor === _1n)\n return this; // Fast-path\n if (clearCofactor)\n return clearCofactor(Point, this);\n return this.multiplyUnsafe(CURVE.h);\n }\n toRawBytes(isCompressed = true) {\n this.assertValidity();\n return toBytes(Point, this, isCompressed);\n }\n toHex(isCompressed = true) {\n return _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToHex(this.toRawBytes(isCompressed));\n }\n }\n Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);\n Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);\n const _bits = CURVE.nBitLength;\n const wnaf = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.wNAF)(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);\n // Validate if generator point is on curve\n return {\n CURVE,\n ProjectivePoint: Point,\n normPrivateKeyToScalar,\n weierstrassEquation,\n isWithinCurveOrder,\n };\n}\nfunction validateOpts(curve) {\n const opts = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.validateBasic)(curve);\n _utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject(opts, {\n hash: 'hash',\n hmac: 'function',\n randomBytes: 'function',\n }, {\n bits2int: 'function',\n bits2int_modN: 'function',\n lowS: 'boolean',\n });\n return Object.freeze({ lowS: true, ...opts });\n}\nfunction weierstrass(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { Fp, n: CURVE_ORDER } = CURVE;\n const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32\n const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32\n function isValidFieldElement(num) {\n return _0n < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE\n }\n function modN(a) {\n return _modular_js__WEBPACK_IMPORTED_MODULE_2__.mod(a, CURVE_ORDER);\n }\n function invN(a) {\n return _modular_js__WEBPACK_IMPORTED_MODULE_2__.invert(a, CURVE_ORDER);\n }\n const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({\n ...CURVE,\n toBytes(_c, point, isCompressed) {\n const a = point.toAffine();\n const x = Fp.toBytes(a.x);\n const cat = _utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes;\n if (isCompressed) {\n return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x);\n }\n else {\n return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y));\n }\n },\n fromBytes(bytes) {\n const len = bytes.length;\n const head = bytes[0];\n const tail = bytes.subarray(1);\n // this.assertValidity() is done inside of fromHex\n if (len === compressedLen && (head === 0x02 || head === 0x03)) {\n const x = _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberBE(tail);\n if (!isValidFieldElement(x))\n throw new Error('Point is not on curve');\n const y2 = weierstrassEquation(x); // y² = x³ + ax + b\n let y;\n try {\n y = Fp.sqrt(y2); // y = y² ^ (p+1)/4\n }\n catch (sqrtError) {\n const suffix = sqrtError instanceof Error ? ': ' + sqrtError.message : '';\n throw new Error('Point is not on curve' + suffix);\n }\n const isYOdd = (y & _1n) === _1n;\n // ECDSA\n const isHeadOdd = (head & 1) === 1;\n if (isHeadOdd !== isYOdd)\n y = Fp.neg(y);\n return { x, y };\n }\n else if (len === uncompressedLen && head === 0x04) {\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n }\n else {\n throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`);\n }\n },\n });\n const numToNByteStr = (num) => _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToHex(_utils_js__WEBPACK_IMPORTED_MODULE_1__.numberToBytesBE(num, CURVE.nByteLength));\n function isBiggerThanHalfOrder(number) {\n const HALF = CURVE_ORDER >> _1n;\n return number > HALF;\n }\n function normalizeS(s) {\n return isBiggerThanHalfOrder(s) ? modN(-s) : s;\n }\n // slice bytes num\n const slcNum = (b, from, to) => _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberBE(b.slice(from, to));\n /**\n * ECDSA signature with its (r, s) properties. Supports DER & compact representations.\n */\n class Signature {\n constructor(r, s, recovery) {\n this.r = r;\n this.s = s;\n this.recovery = recovery;\n this.assertValidity();\n }\n // pair (bytes of r, bytes of s)\n static fromCompact(hex) {\n const l = CURVE.nByteLength;\n hex = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('compactSignature', hex, l * 2);\n return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));\n }\n // DER encoded ECDSA signature\n // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script\n static fromDER(hex) {\n const { r, s } = DER.toSig((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('DER', hex));\n return new Signature(r, s);\n }\n assertValidity() {\n // can use assertGE here\n if (!isWithinCurveOrder(this.r))\n throw new Error('r must be 0 < r < CURVE.n');\n if (!isWithinCurveOrder(this.s))\n throw new Error('s must be 0 < s < CURVE.n');\n }\n addRecoveryBit(recovery) {\n return new Signature(this.r, this.s, recovery);\n }\n recoverPublicKey(msgHash) {\n const { r, s, recovery: rec } = this;\n const h = bits2int_modN((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('msgHash', msgHash)); // Truncate hash\n if (rec == null || ![0, 1, 2, 3].includes(rec))\n throw new Error('recovery id invalid');\n const radj = rec === 2 || rec === 3 ? r + CURVE.n : r;\n if (radj >= Fp.ORDER)\n throw new Error('recovery id 2 or 3 invalid');\n const prefix = (rec & 1) === 0 ? '02' : '03';\n const R = Point.fromHex(prefix + numToNByteStr(radj));\n const ir = invN(radj); // r^-1\n const u1 = modN(-h * ir); // -hr^-1\n const u2 = modN(s * ir); // sr^-1\n const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1)\n if (!Q)\n throw new Error('point at infinify'); // unsafe is fine: no priv data leaked\n Q.assertValidity();\n return Q;\n }\n // Signatures should be low-s, to prevent malleability.\n hasHighS() {\n return isBiggerThanHalfOrder(this.s);\n }\n normalizeS() {\n return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;\n }\n // DER-encoded\n toDERRawBytes() {\n return _utils_js__WEBPACK_IMPORTED_MODULE_1__.hexToBytes(this.toDERHex());\n }\n toDERHex() {\n return DER.hexFromSig({ r: this.r, s: this.s });\n }\n // padded bytes of r, then padded bytes of s\n toCompactRawBytes() {\n return _utils_js__WEBPACK_IMPORTED_MODULE_1__.hexToBytes(this.toCompactHex());\n }\n toCompactHex() {\n return numToNByteStr(this.r) + numToNByteStr(this.s);\n }\n }\n const utils = {\n isValidPrivateKey(privateKey) {\n try {\n normPrivateKeyToScalar(privateKey);\n return true;\n }\n catch (error) {\n return false;\n }\n },\n normPrivateKeyToScalar: normPrivateKeyToScalar,\n /**\n * Produces cryptographically secure private key from random of size\n * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.\n */\n randomPrivateKey: () => {\n const length = _modular_js__WEBPACK_IMPORTED_MODULE_2__.getMinHashLength(CURVE.n);\n return _modular_js__WEBPACK_IMPORTED_MODULE_2__.mapHashToField(CURVE.randomBytes(length), CURVE.n);\n },\n /**\n * Creates precompute table for an arbitrary EC point. Makes point \"cached\".\n * Allows to massively speed-up `point.multiply(scalar)`.\n * @returns cached point\n * @example\n * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));\n * fast.multiply(privKey); // much faster ECDH now\n */\n precompute(windowSize = 8, point = Point.BASE) {\n point._setWindowSize(windowSize);\n point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here\n return point;\n },\n };\n /**\n * Computes public key for a private key. Checks for validity of the private key.\n * @param privateKey private key\n * @param isCompressed whether to return compact (default), or full key\n * @returns Public key, full when isCompressed=false; short when isCompressed=true\n */\n function getPublicKey(privateKey, isCompressed = true) {\n return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);\n }\n /**\n * Quick and dirty check for item being public key. Does not validate hex, or being on-curve.\n */\n function isProbPub(item) {\n const arr = _utils_js__WEBPACK_IMPORTED_MODULE_1__.isBytes(item);\n const str = typeof item === 'string';\n const len = (arr || str) && item.length;\n if (arr)\n return len === compressedLen || len === uncompressedLen;\n if (str)\n return len === 2 * compressedLen || len === 2 * uncompressedLen;\n if (item instanceof Point)\n return true;\n return false;\n }\n /**\n * ECDH (Elliptic Curve Diffie Hellman).\n * Computes shared public key from private key and public key.\n * Checks: 1) private key validity 2) shared key is on-curve.\n * Does NOT hash the result.\n * @param privateA private key\n * @param publicB different public key\n * @param isCompressed whether to return compact (default), or full key\n * @returns shared public key\n */\n function getSharedSecret(privateA, publicB, isCompressed = true) {\n if (isProbPub(privateA))\n throw new Error('first arg must be private key');\n if (!isProbPub(publicB))\n throw new Error('second arg must be public key');\n const b = Point.fromHex(publicB); // check for being on-curve\n return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);\n }\n // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets.\n // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int.\n // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same.\n // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors\n const bits2int = CURVE.bits2int ||\n function (bytes) {\n // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)\n // for some cases, since bytes.length * 8 is not actual bitLength.\n const num = _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberBE(bytes); // check for == u8 done here\n const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits\n return delta > 0 ? num >> BigInt(delta) : num;\n };\n const bits2int_modN = CURVE.bits2int_modN ||\n function (bytes) {\n return modN(bits2int(bytes)); // can't use bytesToNumberBE here\n };\n // NOTE: pads output with zero as per spec\n const ORDER_MASK = _utils_js__WEBPACK_IMPORTED_MODULE_1__.bitMask(CURVE.nBitLength);\n /**\n * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`.\n */\n function int2octets(num) {\n if (typeof num !== 'bigint')\n throw new Error('bigint expected');\n if (!(_0n <= num && num < ORDER_MASK))\n throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);\n // works with order, can have different size than numToField!\n return _utils_js__WEBPACK_IMPORTED_MODULE_1__.numberToBytesBE(num, CURVE.nByteLength);\n }\n // Steps A, D of RFC6979 3.2\n // Creates RFC6979 seed; converts msg/privKey to numbers.\n // Used only in sign, not in verify.\n // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521.\n // Also it can be bigger for P224 + SHA256\n function prepSig(msgHash, privateKey, opts = defaultSigOpts) {\n if (['recovered', 'canonical'].some((k) => k in opts))\n throw new Error('sign() legacy options not supported');\n const { hash, randomBytes } = CURVE;\n let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default\n if (lowS == null)\n lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash\n msgHash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('msgHash', msgHash);\n if (prehash)\n msgHash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('prehashed msgHash', hash(msgHash));\n // We can't later call bits2octets, since nested bits2int is broken for curves\n // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call.\n // const bits2octets = (bits) => int2octets(bits2int_modN(bits))\n const h1int = bits2int_modN(msgHash);\n const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint\n const seedArgs = [int2octets(d), int2octets(h1int)];\n // extraEntropy. RFC6979 3.6: additional k' (optional).\n if (ent != null && ent !== false) {\n // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')\n const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is\n seedArgs.push((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('extraEntropy', e)); // check for being bytes\n }\n const seed = _utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes(...seedArgs); // Step D of RFC6979 3.2\n const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash!\n // Converts signature params into point w r/s, checks result for validity.\n function k2sig(kBytes) {\n // RFC 6979 Section 3.2, step 3: k = bits2int(T)\n const k = bits2int(kBytes); // Cannot use fields methods, since it is group element\n if (!isWithinCurveOrder(k))\n return; // Important: all mod() calls here must be done over N\n const ik = invN(k); // k^-1 mod n\n const q = Point.BASE.multiply(k).toAffine(); // q = Gk\n const r = modN(q.x); // r = q.x mod n\n if (r === _0n)\n return;\n // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to\n // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it:\n // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT\n const s = modN(ik * modN(m + r * d)); // Not using blinding here\n if (s === _0n)\n return;\n let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n)\n let normS = s;\n if (lowS && isBiggerThanHalfOrder(s)) {\n normS = normalizeS(s); // if lowS was passed, ensure s is always\n recovery ^= 1; // // in the bottom half of N\n }\n return new Signature(r, normS, recovery); // use normS, not s\n }\n return { seed, k2sig };\n }\n const defaultSigOpts = { lowS: CURVE.lowS, prehash: false };\n const defaultVerOpts = { lowS: CURVE.lowS, prehash: false };\n /**\n * Signs message hash with a private key.\n * ```\n * sign(m, d, k) where\n * (x, y) = G × k\n * r = x mod n\n * s = (m + dr)/k mod n\n * ```\n * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`.\n * @param privKey private key\n * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg.\n * @returns signature with recovery param\n */\n function sign(msgHash, privKey, opts = defaultSigOpts) {\n const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2.\n const C = CURVE;\n const drbg = _utils_js__WEBPACK_IMPORTED_MODULE_1__.createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac);\n return drbg(seed, k2sig); // Steps B, C, D, E, F, G\n }\n // Enable precomputes. Slows down first publicKey computation by 20ms.\n Point.BASE._setWindowSize(8);\n // utils.precompute(8, ProjectivePoint.BASE)\n /**\n * Verifies a signature against message hash and public key.\n * Rejects lowS signatures by default: to override,\n * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf:\n *\n * ```\n * verify(r, s, h, P) where\n * U1 = hs^-1 mod n\n * U2 = rs^-1 mod n\n * R = U1⋅G - U2⋅P\n * mod(R.x, n) == r\n * ```\n */\n function verify(signature, msgHash, publicKey, opts = defaultVerOpts) {\n const sg = signature;\n msgHash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('msgHash', msgHash);\n publicKey = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('publicKey', publicKey);\n if ('strict' in opts)\n throw new Error('options.strict was renamed to lowS');\n const { lowS, prehash } = opts;\n let _sig = undefined;\n let P;\n try {\n if (typeof sg === 'string' || _utils_js__WEBPACK_IMPORTED_MODULE_1__.isBytes(sg)) {\n // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length).\n // Since DER can also be 2*nByteLength bytes, we check for it first.\n try {\n _sig = Signature.fromDER(sg);\n }\n catch (derError) {\n if (!(derError instanceof DER.Err))\n throw derError;\n _sig = Signature.fromCompact(sg);\n }\n }\n else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') {\n const { r, s } = sg;\n _sig = new Signature(r, s);\n }\n else {\n throw new Error('PARSE');\n }\n P = Point.fromHex(publicKey);\n }\n catch (error) {\n if (error.message === 'PARSE')\n throw new Error(`signature must be Signature instance, Uint8Array or hex string`);\n return false;\n }\n if (lowS && _sig.hasHighS())\n return false;\n if (prehash)\n msgHash = CURVE.hash(msgHash);\n const { r, s } = _sig;\n const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element\n const is = invN(s); // s^-1\n const u1 = modN(h * is); // u1 = hs^-1 mod n\n const u2 = modN(r * is); // u2 = rs^-1 mod n\n const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P\n if (!R)\n return false;\n const v = modN(R.x);\n return v === r;\n }\n return {\n CURVE,\n getPublicKey,\n getSharedSecret,\n sign,\n verify,\n ProjectivePoint: Point,\n Signature,\n utils,\n };\n}\n/**\n * Implementation of the Shallue and van de Woestijne method for any weierstrass curve.\n * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular.\n * b = True and y = sqrt(u / v) if (u / v) is square in F, and\n * b = False and y = sqrt(Z * (u / v)) otherwise.\n * @param Fp\n * @param Z\n * @returns\n */\nfunction SWUFpSqrtRatio(Fp, Z) {\n // Generic implementation\n const q = Fp.ORDER;\n let l = _0n;\n for (let o = q - _1n; o % _2n === _0n; o /= _2n)\n l += _1n;\n const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1.\n // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<.\n // 2n ** c1 == 2n << (c1-1)\n const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n);\n const _2n_pow_c1 = _2n_pow_c1_1 * _2n;\n const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic\n const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic\n const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic\n const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic\n const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2\n const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2)\n let sqrtRatio = (u, v) => {\n let tv1 = c6; // 1. tv1 = c6\n let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4\n let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2\n tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v\n let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3\n tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3\n tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2\n tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v\n tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u\n let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2\n tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5\n let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1\n tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7\n tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR)\n tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR)\n // 17. for i in (c1, c1 - 1, ..., 2):\n for (let i = c1; i > _1n; i--) {\n let tv5 = i - _2n; // 18. tv5 = i - 2\n tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5\n let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5\n const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1\n tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1\n tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1\n tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1)\n tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1)\n }\n return { isValid: isQR, value: tv3 };\n };\n if (Fp.ORDER % _4n === _3n) {\n // sqrt_ratio_3mod4(u, v)\n const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic\n const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z)\n sqrtRatio = (u, v) => {\n let tv1 = Fp.sqr(v); // 1. tv1 = v^2\n const tv2 = Fp.mul(u, v); // 2. tv2 = u * v\n tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2\n let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1\n y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2\n const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2\n const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v\n const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u\n let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR)\n return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2\n };\n }\n // No curves uses that\n // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8\n return sqrtRatio;\n}\n/**\n * Simplified Shallue-van de Woestijne-Ulas Method\n * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2\n */\nfunction mapToCurveSimpleSWU(Fp, opts) {\n _modular_js__WEBPACK_IMPORTED_MODULE_2__.validateField(Fp);\n if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))\n throw new Error('mapToCurveSimpleSWU: invalid opts');\n const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z);\n if (!Fp.isOdd)\n throw new Error('Fp.isOdd is not implemented!');\n // Input: u, an element of F.\n // Output: (x, y), a point on E.\n return (u) => {\n // prettier-ignore\n let tv1, tv2, tv3, tv4, tv5, tv6, x, y;\n tv1 = Fp.sqr(u); // 1. tv1 = u^2\n tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1\n tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2\n tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1\n tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1\n tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3\n tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0)\n tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4\n tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2\n tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2\n tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6\n tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5\n tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3\n tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4\n tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6\n tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5\n x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3\n const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6)\n y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1\n y = Fp.mul(y, value); // 20. y = y * y1\n x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square)\n y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square)\n const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y)\n y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1)\n x = Fp.div(x, tv4); // 25. x = x / tv4\n return { x, y };\n };\n}\n//# sourceMappingURL=weierstrass.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/curves/esm/abstract/weierstrass.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/curves/esm/ed25519.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/@noble/curves/esm/ed25519.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ED25519_TORSION_SUBGROUP: () => (/* binding */ ED25519_TORSION_SUBGROUP),\n/* harmony export */ RistrettoPoint: () => (/* binding */ RistrettoPoint),\n/* harmony export */ ed25519: () => (/* binding */ ed25519),\n/* harmony export */ ed25519ctx: () => (/* binding */ ed25519ctx),\n/* harmony export */ ed25519ph: () => (/* binding */ ed25519ph),\n/* harmony export */ edwardsToMontgomery: () => (/* binding */ edwardsToMontgomery),\n/* harmony export */ edwardsToMontgomeryPriv: () => (/* binding */ edwardsToMontgomeryPriv),\n/* harmony export */ edwardsToMontgomeryPub: () => (/* binding */ edwardsToMontgomeryPub),\n/* harmony export */ encodeToCurve: () => (/* binding */ encodeToCurve),\n/* harmony export */ hashToCurve: () => (/* binding */ hashToCurve),\n/* harmony export */ hashToRistretto255: () => (/* binding */ hashToRistretto255),\n/* harmony export */ hash_to_ristretto255: () => (/* binding */ hash_to_ristretto255),\n/* harmony export */ x25519: () => (/* binding */ x25519)\n/* harmony export */ });\n/* harmony import */ var _noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/hashes/sha512 */ \"./node_modules/@noble/hashes/esm/sha512.js\");\n/* harmony import */ var _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @noble/hashes/utils */ \"./node_modules/@noble/hashes/esm/utils.js\");\n/* harmony import */ var _abstract_edwards_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./abstract/edwards.js */ \"./node_modules/@noble/curves/esm/abstract/edwards.js\");\n/* harmony import */ var _abstract_montgomery_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./abstract/montgomery.js */ \"./node_modules/@noble/curves/esm/abstract/montgomery.js\");\n/* harmony import */ var _abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract/modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _abstract_utils_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./abstract/utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/* harmony import */ var _abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./abstract/hash-to-curve.js */ \"./node_modules/@noble/curves/esm/abstract/hash-to-curve.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n\n\n\n\n\n\n/**\n * ed25519 Twisted Edwards curve with following addons:\n * - X25519 ECDH\n * - Ristretto cofactor elimination\n * - Elligator hash-to-group / point indistinguishability\n */\nconst ED25519_P = BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819949');\n// √(-1) aka √(a) aka 2^((p-1)/4)\nconst ED25519_SQRT_M1 = BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752');\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _5n = BigInt(5);\n// prettier-ignore\nconst _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80);\nfunction ed25519_pow_2_252_3(x) {\n const P = ED25519_P;\n const x2 = (x * x) % P;\n const b2 = (x2 * x) % P; // x^3, 11\n const b4 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b2, _2n, P) * b2) % P; // x^15, 1111\n const b5 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b4, _1n, P) * x) % P; // x^31\n const b10 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b5, _5n, P) * b5) % P;\n const b20 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b10, _10n, P) * b10) % P;\n const b40 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b20, _20n, P) * b20) % P;\n const b80 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b40, _40n, P) * b40) % P;\n const b160 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b80, _80n, P) * b80) % P;\n const b240 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b160, _80n, P) * b80) % P;\n const b250 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b240, _10n, P) * b10) % P;\n const pow_p_5_8 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b250, _2n, P) * x) % P;\n // ^ To pow to (p+3)/8, multiply it by x.\n return { pow_p_5_8, b2 };\n}\nfunction adjustScalarBytes(bytes) {\n // Section 5: For X25519, in order to decode 32 random bytes as an integer scalar,\n // set the three least significant bits of the first byte\n bytes[0] &= 248; // 0b1111_1000\n // and the most significant bit of the last to zero,\n bytes[31] &= 127; // 0b0111_1111\n // set the second most significant bit of the last byte to 1\n bytes[31] |= 64; // 0b0100_0000\n return bytes;\n}\n// sqrt(u/v)\nfunction uvRatio(u, v) {\n const P = ED25519_P;\n const v3 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(v * v * v, P); // v³\n const v7 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(v3 * v3 * v, P); // v⁷\n // (p+3)/8 and (p-5)/8\n const pow = ed25519_pow_2_252_3(u * v7).pow_p_5_8;\n let x = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(u * v3 * pow, P); // (uv³)(uv⁷)^(p-5)/8\n const vx2 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(v * x * x, P); // vx²\n const root1 = x; // First root candidate\n const root2 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(x * ED25519_SQRT_M1, P); // Second root candidate\n const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root\n const useRoot2 = vx2 === (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(-u, P); // If vx² = -u, set x <-- x * 2^((p-1)/4)\n const noRoot = vx2 === (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(-u * ED25519_SQRT_M1, P); // There is no valid root, vx² = -u√(-1)\n if (useRoot1)\n x = root1;\n if (useRoot2 || noRoot)\n x = root2; // We return root2 anyway, for const-time\n if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.isNegativeLE)(x, P))\n x = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(-x, P);\n return { isValid: useRoot1 || useRoot2, value: x };\n}\n// Just in case\nconst ED25519_TORSION_SUBGROUP = [\n '0100000000000000000000000000000000000000000000000000000000000000',\n 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a',\n '0000000000000000000000000000000000000000000000000000000000000080',\n '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05',\n 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f',\n '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85',\n '0000000000000000000000000000000000000000000000000000000000000000',\n 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa',\n];\nconst Fp = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.Field)(ED25519_P, undefined, true);\nconst ed25519Defaults = {\n // Param: a\n a: BigInt(-1), // Fp.create(-1) is proper; our way still works and is faster\n // d is equal to -121665/121666 over finite field.\n // Negative number is P - number, and division is invert(number, P)\n d: BigInt('37095705934669439343138083508754565189542113879843219016388785533085940283555'),\n // Finite field 𝔽p over which we'll do calculations; 2n**255n - 19n\n Fp,\n // Subgroup order: how many points curve has\n // 2n**252n + 27742317777372353535851937790883648493n;\n n: BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989'),\n // Cofactor\n h: BigInt(8),\n // Base point (x, y) aka generator point\n Gx: BigInt('15112221349535400772501151409588531511454012693041857206046113283949847762202'),\n Gy: BigInt('46316835694926478169428394003475163141307993866256225615783033603165251855960'),\n hash: _noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_1__.sha512,\n randomBytes: _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_2__.randomBytes,\n adjustScalarBytes,\n // dom2\n // Ratio of u to v. Allows us to combine inversion and square root. Uses algo from RFC8032 5.1.3.\n // Constant-time, u/√v\n uvRatio,\n};\nconst ed25519 = /* @__PURE__ */ (0,_abstract_edwards_js__WEBPACK_IMPORTED_MODULE_3__.twistedEdwards)(ed25519Defaults);\nfunction ed25519_domain(data, ctx, phflag) {\n if (ctx.length > 255)\n throw new Error('Context is too big');\n return (0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_2__.concatBytes)((0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_2__.utf8ToBytes)('SigEd25519 no Ed25519 collisions'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data);\n}\nconst ed25519ctx = /* @__PURE__ */ (0,_abstract_edwards_js__WEBPACK_IMPORTED_MODULE_3__.twistedEdwards)({\n ...ed25519Defaults,\n domain: ed25519_domain,\n});\nconst ed25519ph = /* @__PURE__ */ (0,_abstract_edwards_js__WEBPACK_IMPORTED_MODULE_3__.twistedEdwards)({\n ...ed25519Defaults,\n domain: ed25519_domain,\n prehash: _noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_1__.sha512,\n});\nconst x25519 = /* @__PURE__ */ (() => (0,_abstract_montgomery_js__WEBPACK_IMPORTED_MODULE_4__.montgomery)({\n P: ED25519_P,\n a: BigInt(486662),\n montgomeryBits: 255, // n is 253 bits\n nByteLength: 32,\n Gu: BigInt(9),\n powPminus2: (x) => {\n const P = ED25519_P;\n // x^(p-2) aka x^(2^255-21)\n const { pow_p_5_8, b2 } = ed25519_pow_2_252_3(x);\n return (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(pow_p_5_8, BigInt(3), P) * b2, P);\n },\n adjustScalarBytes,\n randomBytes: _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_2__.randomBytes,\n}))();\n/**\n * Converts ed25519 public key to x25519 public key. Uses formula:\n * * `(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)`\n * * `(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))`\n * @example\n * const someonesPub = ed25519.getPublicKey(ed25519.utils.randomPrivateKey());\n * const aPriv = x25519.utils.randomPrivateKey();\n * x25519.getSharedSecret(aPriv, edwardsToMontgomeryPub(someonesPub))\n */\nfunction edwardsToMontgomeryPub(edwardsPub) {\n const { y } = ed25519.ExtendedPoint.fromHex(edwardsPub);\n const _1n = BigInt(1);\n return Fp.toBytes(Fp.create((_1n + y) * Fp.inv(_1n - y)));\n}\nconst edwardsToMontgomery = edwardsToMontgomeryPub; // deprecated\n/**\n * Converts ed25519 secret key to x25519 secret key.\n * @example\n * const someonesPub = x25519.getPublicKey(x25519.utils.randomPrivateKey());\n * const aPriv = ed25519.utils.randomPrivateKey();\n * x25519.getSharedSecret(edwardsToMontgomeryPriv(aPriv), someonesPub)\n */\nfunction edwardsToMontgomeryPriv(edwardsPriv) {\n const hashed = ed25519Defaults.hash(edwardsPriv.subarray(0, 32));\n return ed25519Defaults.adjustScalarBytes(hashed).subarray(0, 32);\n}\n// Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator)\n// NOTE: very important part is usage of FpSqrtEven for ELL2_C1_EDWARDS, since\n// SageMath returns different root first and everything falls apart\nconst ELL2_C1 = (Fp.ORDER + BigInt(3)) / BigInt(8); // 1. c1 = (q + 3) / 8 # Integer arithmetic\nconst ELL2_C2 = Fp.pow(_2n, ELL2_C1); // 2. c2 = 2^c1\nconst ELL2_C3 = Fp.sqrt(Fp.neg(Fp.ONE)); // 3. c3 = sqrt(-1)\nconst ELL2_C4 = (Fp.ORDER - BigInt(5)) / BigInt(8); // 4. c4 = (q - 5) / 8 # Integer arithmetic\nconst ELL2_J = BigInt(486662);\n// prettier-ignore\nfunction map_to_curve_elligator2_curve25519(u) {\n let tv1 = Fp.sqr(u); // 1. tv1 = u^2\n tv1 = Fp.mul(tv1, _2n); // 2. tv1 = 2 * tv1\n let xd = Fp.add(tv1, Fp.ONE); // 3. xd = tv1 + 1 # Nonzero: -1 is square (mod p), tv1 is not\n let x1n = Fp.neg(ELL2_J); // 4. x1n = -J # x1 = x1n / xd = -J / (1 + 2 * u^2)\n let tv2 = Fp.sqr(xd); // 5. tv2 = xd^2\n let gxd = Fp.mul(tv2, xd); // 6. gxd = tv2 * xd # gxd = xd^3\n let gx1 = Fp.mul(tv1, ELL2_J); // 7. gx1 = J * tv1 # x1n + J * xd\n gx1 = Fp.mul(gx1, x1n); // 8. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd\n gx1 = Fp.add(gx1, tv2); // 9. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2\n gx1 = Fp.mul(gx1, x1n); // 10. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2\n let tv3 = Fp.sqr(gxd); // 11. tv3 = gxd^2\n tv2 = Fp.sqr(tv3); // 12. tv2 = tv3^2 # gxd^4\n tv3 = Fp.mul(tv3, gxd); // 13. tv3 = tv3 * gxd # gxd^3\n tv3 = Fp.mul(tv3, gx1); // 14. tv3 = tv3 * gx1 # gx1 * gxd^3\n tv2 = Fp.mul(tv2, tv3); // 15. tv2 = tv2 * tv3 # gx1 * gxd^7\n let y11 = Fp.pow(tv2, ELL2_C4); // 16. y11 = tv2^c4 # (gx1 * gxd^7)^((p - 5) / 8)\n y11 = Fp.mul(y11, tv3); // 17. y11 = y11 * tv3 # gx1*gxd^3*(gx1*gxd^7)^((p-5)/8)\n let y12 = Fp.mul(y11, ELL2_C3); // 18. y12 = y11 * c3\n tv2 = Fp.sqr(y11); // 19. tv2 = y11^2\n tv2 = Fp.mul(tv2, gxd); // 20. tv2 = tv2 * gxd\n let e1 = Fp.eql(tv2, gx1); // 21. e1 = tv2 == gx1\n let y1 = Fp.cmov(y12, y11, e1); // 22. y1 = CMOV(y12, y11, e1) # If g(x1) is square, this is its sqrt\n let x2n = Fp.mul(x1n, tv1); // 23. x2n = x1n * tv1 # x2 = x2n / xd = 2 * u^2 * x1n / xd\n let y21 = Fp.mul(y11, u); // 24. y21 = y11 * u\n y21 = Fp.mul(y21, ELL2_C2); // 25. y21 = y21 * c2\n let y22 = Fp.mul(y21, ELL2_C3); // 26. y22 = y21 * c3\n let gx2 = Fp.mul(gx1, tv1); // 27. gx2 = gx1 * tv1 # g(x2) = gx2 / gxd = 2 * u^2 * g(x1)\n tv2 = Fp.sqr(y21); // 28. tv2 = y21^2\n tv2 = Fp.mul(tv2, gxd); // 29. tv2 = tv2 * gxd\n let e2 = Fp.eql(tv2, gx2); // 30. e2 = tv2 == gx2\n let y2 = Fp.cmov(y22, y21, e2); // 31. y2 = CMOV(y22, y21, e2) # If g(x2) is square, this is its sqrt\n tv2 = Fp.sqr(y1); // 32. tv2 = y1^2\n tv2 = Fp.mul(tv2, gxd); // 33. tv2 = tv2 * gxd\n let e3 = Fp.eql(tv2, gx1); // 34. e3 = tv2 == gx1\n let xn = Fp.cmov(x2n, x1n, e3); // 35. xn = CMOV(x2n, x1n, e3) # If e3, x = x1, else x = x2\n let y = Fp.cmov(y2, y1, e3); // 36. y = CMOV(y2, y1, e3) # If e3, y = y1, else y = y2\n let e4 = Fp.isOdd(y); // 37. e4 = sgn0(y) == 1 # Fix sign of y\n y = Fp.cmov(y, Fp.neg(y), e3 !== e4); // 38. y = CMOV(y, -y, e3 XOR e4)\n return { xMn: xn, xMd: xd, yMn: y, yMd: _1n }; // 39. return (xn, xd, y, 1)\n}\nconst ELL2_C1_EDWARDS = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.FpSqrtEven)(Fp, Fp.neg(BigInt(486664))); // sgn0(c1) MUST equal 0\nfunction map_to_curve_elligator2_edwards25519(u) {\n const { xMn, xMd, yMn, yMd } = map_to_curve_elligator2_curve25519(u); // 1. (xMn, xMd, yMn, yMd) =\n // map_to_curve_elligator2_curve25519(u)\n let xn = Fp.mul(xMn, yMd); // 2. xn = xMn * yMd\n xn = Fp.mul(xn, ELL2_C1_EDWARDS); // 3. xn = xn * c1\n let xd = Fp.mul(xMd, yMn); // 4. xd = xMd * yMn # xn / xd = c1 * xM / yM\n let yn = Fp.sub(xMn, xMd); // 5. yn = xMn - xMd\n let yd = Fp.add(xMn, xMd); // 6. yd = xMn + xMd # (n / d - 1) / (n / d + 1) = (n - d) / (n + d)\n let tv1 = Fp.mul(xd, yd); // 7. tv1 = xd * yd\n let e = Fp.eql(tv1, Fp.ZERO); // 8. e = tv1 == 0\n xn = Fp.cmov(xn, Fp.ZERO, e); // 9. xn = CMOV(xn, 0, e)\n xd = Fp.cmov(xd, Fp.ONE, e); // 10. xd = CMOV(xd, 1, e)\n yn = Fp.cmov(yn, Fp.ONE, e); // 11. yn = CMOV(yn, 1, e)\n yd = Fp.cmov(yd, Fp.ONE, e); // 12. yd = CMOV(yd, 1, e)\n const inv = Fp.invertBatch([xd, yd]); // batch division\n return { x: Fp.mul(xn, inv[0]), y: Fp.mul(yn, inv[1]) }; // 13. return (xn, xd, yn, yd)\n}\nconst htf = /* @__PURE__ */ (() => (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_5__.createHasher)(ed25519.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), {\n DST: 'edwards25519_XMD:SHA-512_ELL2_RO_',\n encodeDST: 'edwards25519_XMD:SHA-512_ELL2_NU_',\n p: Fp.ORDER,\n m: 1,\n k: 128,\n expand: 'xmd',\n hash: _noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_1__.sha512,\n}))();\nconst hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)();\nconst encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)();\nfunction assertRstPoint(other) {\n if (!(other instanceof RistPoint))\n throw new Error('RistrettoPoint expected');\n}\n// √(-1) aka √(a) aka 2^((p-1)/4)\nconst SQRT_M1 = ED25519_SQRT_M1;\n// √(ad - 1)\nconst SQRT_AD_MINUS_ONE = BigInt('25063068953384623474111414158702152701244531502492656460079210482610430750235');\n// 1 / √(a-d)\nconst INVSQRT_A_MINUS_D = BigInt('54469307008909316920995813868745141605393597292927456921205312896311721017578');\n// 1-d²\nconst ONE_MINUS_D_SQ = BigInt('1159843021668779879193775521855586647937357759715417654439879720876111806838');\n// (d-1)²\nconst D_MINUS_ONE_SQ = BigInt('40440834346308536858101042469323190826248399146238708352240133220865137265952');\n// Calculates 1/√(number)\nconst invertSqrt = (number) => uvRatio(_1n, number);\nconst MAX_255B = BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');\nconst bytes255ToNumberLE = (bytes) => ed25519.CURVE.Fp.create((0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_6__.bytesToNumberLE)(bytes) & MAX_255B);\n// Computes Elligator map for Ristretto\n// https://ristretto.group/formulas/elligator.html\nfunction calcElligatorRistrettoMap(r0) {\n const { d } = ed25519.CURVE;\n const P = ed25519.CURVE.Fp.ORDER;\n const mod = ed25519.CURVE.Fp.create;\n const r = mod(SQRT_M1 * r0 * r0); // 1\n const Ns = mod((r + _1n) * ONE_MINUS_D_SQ); // 2\n let c = BigInt(-1); // 3\n const D = mod((c - d * r) * mod(r + d)); // 4\n let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D); // 5\n let s_ = mod(s * r0); // 6\n if (!(0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.isNegativeLE)(s_, P))\n s_ = mod(-s_);\n if (!Ns_D_is_sq)\n s = s_; // 7\n if (!Ns_D_is_sq)\n c = r; // 8\n const Nt = mod(c * (r - _1n) * D_MINUS_ONE_SQ - D); // 9\n const s2 = s * s;\n const W0 = mod((s + s) * D); // 10\n const W1 = mod(Nt * SQRT_AD_MINUS_ONE); // 11\n const W2 = mod(_1n - s2); // 12\n const W3 = mod(_1n + s2); // 13\n return new ed25519.ExtendedPoint(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2));\n}\n/**\n * Each ed25519/ExtendedPoint has 8 different equivalent points. This can be\n * a source of bugs for protocols like ring signatures. Ristretto was created to solve this.\n * Ristretto point operates in X:Y:Z:T extended coordinates like ExtendedPoint,\n * but it should work in its own namespace: do not combine those two.\n * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448\n */\nclass RistPoint {\n // Private property to discourage combining ExtendedPoint + RistrettoPoint\n // Always use Ristretto encoding/decoding instead.\n constructor(ep) {\n this.ep = ep;\n }\n static fromAffine(ap) {\n return new RistPoint(ed25519.ExtendedPoint.fromAffine(ap));\n }\n /**\n * Takes uniform output of 64-byte hash function like sha512 and converts it to `RistrettoPoint`.\n * The hash-to-group operation applies Elligator twice and adds the results.\n * **Note:** this is one-way map, there is no conversion from point to hash.\n * https://ristretto.group/formulas/elligator.html\n * @param hex 64-byte output of a hash function\n */\n static hashToCurve(hex) {\n hex = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_6__.ensureBytes)('ristrettoHash', hex, 64);\n const r1 = bytes255ToNumberLE(hex.slice(0, 32));\n const R1 = calcElligatorRistrettoMap(r1);\n const r2 = bytes255ToNumberLE(hex.slice(32, 64));\n const R2 = calcElligatorRistrettoMap(r2);\n return new RistPoint(R1.add(R2));\n }\n /**\n * Converts ristretto-encoded string to ristretto point.\n * https://ristretto.group/formulas/decoding.html\n * @param hex Ristretto-encoded 32 bytes. Not every 32-byte string is valid ristretto encoding\n */\n static fromHex(hex) {\n hex = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_6__.ensureBytes)('ristrettoHex', hex, 32);\n const { a, d } = ed25519.CURVE;\n const P = ed25519.CURVE.Fp.ORDER;\n const mod = ed25519.CURVE.Fp.create;\n const emsg = 'RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint';\n const s = bytes255ToNumberLE(hex);\n // 1. Check that s_bytes is the canonical encoding of a field element, or else abort.\n // 3. Check that s is non-negative, or else abort\n if (!(0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_6__.equalBytes)((0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_6__.numberToBytesLE)(s, 32), hex) || (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.isNegativeLE)(s, P))\n throw new Error(emsg);\n const s2 = mod(s * s);\n const u1 = mod(_1n + a * s2); // 4 (a is -1)\n const u2 = mod(_1n - a * s2); // 5\n const u1_2 = mod(u1 * u1);\n const u2_2 = mod(u2 * u2);\n const v = mod(a * d * u1_2 - u2_2); // 6\n const { isValid, value: I } = invertSqrt(mod(v * u2_2)); // 7\n const Dx = mod(I * u2); // 8\n const Dy = mod(I * Dx * v); // 9\n let x = mod((s + s) * Dx); // 10\n if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.isNegativeLE)(x, P))\n x = mod(-x); // 10\n const y = mod(u1 * Dy); // 11\n const t = mod(x * y); // 12\n if (!isValid || (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.isNegativeLE)(t, P) || y === _0n)\n throw new Error(emsg);\n return new RistPoint(new ed25519.ExtendedPoint(x, y, _1n, t));\n }\n /**\n * Encodes ristretto point to Uint8Array.\n * https://ristretto.group/formulas/encoding.html\n */\n toRawBytes() {\n let { ex: x, ey: y, ez: z, et: t } = this.ep;\n const P = ed25519.CURVE.Fp.ORDER;\n const mod = ed25519.CURVE.Fp.create;\n const u1 = mod(mod(z + y) * mod(z - y)); // 1\n const u2 = mod(x * y); // 2\n // Square root always exists\n const u2sq = mod(u2 * u2);\n const { value: invsqrt } = invertSqrt(mod(u1 * u2sq)); // 3\n const D1 = mod(invsqrt * u1); // 4\n const D2 = mod(invsqrt * u2); // 5\n const zInv = mod(D1 * D2 * t); // 6\n let D; // 7\n if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.isNegativeLE)(t * zInv, P)) {\n let _x = mod(y * SQRT_M1);\n let _y = mod(x * SQRT_M1);\n x = _x;\n y = _y;\n D = mod(D1 * INVSQRT_A_MINUS_D);\n }\n else {\n D = D2; // 8\n }\n if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.isNegativeLE)(x * zInv, P))\n y = mod(-y); // 9\n let s = mod((z - y) * D); // 10 (check footer's note, no sqrt(-a))\n if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.isNegativeLE)(s, P))\n s = mod(-s);\n return (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_6__.numberToBytesLE)(s, 32); // 11\n }\n toHex() {\n return (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_6__.bytesToHex)(this.toRawBytes());\n }\n toString() {\n return this.toHex();\n }\n // Compare one point to another.\n equals(other) {\n assertRstPoint(other);\n const { ex: X1, ey: Y1 } = this.ep;\n const { ex: X2, ey: Y2 } = other.ep;\n const mod = ed25519.CURVE.Fp.create;\n // (x1 * y2 == y1 * x2) | (y1 * y2 == x1 * x2)\n const one = mod(X1 * Y2) === mod(Y1 * X2);\n const two = mod(Y1 * Y2) === mod(X1 * X2);\n return one || two;\n }\n add(other) {\n assertRstPoint(other);\n return new RistPoint(this.ep.add(other.ep));\n }\n subtract(other) {\n assertRstPoint(other);\n return new RistPoint(this.ep.subtract(other.ep));\n }\n multiply(scalar) {\n return new RistPoint(this.ep.multiply(scalar));\n }\n multiplyUnsafe(scalar) {\n return new RistPoint(this.ep.multiplyUnsafe(scalar));\n }\n double() {\n return new RistPoint(this.ep.double());\n }\n negate() {\n return new RistPoint(this.ep.negate());\n }\n}\nconst RistrettoPoint = /* @__PURE__ */ (() => {\n if (!RistPoint.BASE)\n RistPoint.BASE = new RistPoint(ed25519.ExtendedPoint.BASE);\n if (!RistPoint.ZERO)\n RistPoint.ZERO = new RistPoint(ed25519.ExtendedPoint.ZERO);\n return RistPoint;\n})();\n// Hashing to ristretto255. https://www.rfc-editor.org/rfc/rfc9380#appendix-B\nconst hashToRistretto255 = (msg, options) => {\n const d = options.DST;\n const DST = typeof d === 'string' ? (0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_2__.utf8ToBytes)(d) : d;\n const uniform_bytes = (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_5__.expand_message_xmd)(msg, DST, 64, _noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_1__.sha512);\n const P = RistPoint.hashToCurve(uniform_bytes);\n return P;\n};\nconst hash_to_ristretto255 = hashToRistretto255; // legacy\n//# sourceMappingURL=ed25519.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/curves/esm/ed25519.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/curves/esm/secp256k1.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/@noble/curves/esm/secp256k1.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ encodeToCurve: () => (/* binding */ encodeToCurve),\n/* harmony export */ hashToCurve: () => (/* binding */ hashToCurve),\n/* harmony export */ schnorr: () => (/* binding */ schnorr),\n/* harmony export */ secp256k1: () => (/* binding */ secp256k1)\n/* harmony export */ });\n/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/@noble/hashes/esm/sha256.js\");\n/* harmony import */ var _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @noble/hashes/utils */ \"./node_modules/@noble/hashes/esm/utils.js\");\n/* harmony import */ var _abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract/modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./abstract/weierstrass.js */ \"./node_modules/@noble/curves/esm/abstract/weierstrass.js\");\n/* harmony import */ var _abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./abstract/utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/* harmony import */ var _abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./abstract/hash-to-curve.js */ \"./node_modules/@noble/curves/esm/abstract/hash-to-curve.js\");\n/* harmony import */ var _shortw_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_shortw_utils.js */ \"./node_modules/@noble/curves/esm/_shortw_utils.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n\n\n\n\n\n\nconst secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');\nconst secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141');\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst divNearest = (a, b) => (a + b / _2n) / b;\n/**\n * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit.\n * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00]\n */\nfunction sqrtMod(y) {\n const P = secp256k1P;\n // prettier-ignore\n const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);\n // prettier-ignore\n const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);\n const b2 = (y * y * y) % P; // x^3, 11\n const b3 = (b2 * b2 * y) % P; // x^7\n const b6 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b3, _3n, P) * b3) % P;\n const b9 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b6, _3n, P) * b3) % P;\n const b11 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b9, _2n, P) * b2) % P;\n const b22 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b11, _11n, P) * b11) % P;\n const b44 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b22, _22n, P) * b22) % P;\n const b88 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b44, _44n, P) * b44) % P;\n const b176 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b88, _88n, P) * b88) % P;\n const b220 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b176, _44n, P) * b44) % P;\n const b223 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b220, _3n, P) * b3) % P;\n const t1 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(b223, _23n, P) * b22) % P;\n const t2 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(t1, _6n, P) * b2) % P;\n const root = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow2)(t2, _2n, P);\n if (!Fp.eql(Fp.sqr(root), y))\n throw new Error('Cannot find square root');\n return root;\n}\nconst Fp = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.Field)(secp256k1P, undefined, undefined, { sqrt: sqrtMod });\nconst secp256k1 = (0,_shortw_utils_js__WEBPACK_IMPORTED_MODULE_1__.createCurve)({\n a: BigInt(0), // equation params: a, b\n b: BigInt(7), // Seem to be rigid: bitcointalk.org/index.php?topic=289795.msg3183975#msg3183975\n Fp, // Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n\n n: secp256k1N, // Curve order, total count of valid points in the field\n // Base point (x, y) aka generator point\n Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'),\n Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'),\n h: BigInt(1), // Cofactor\n lowS: true, // Allow only low-S signatures by default in sign() and verify()\n /**\n * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism.\n * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%.\n * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit.\n * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066\n */\n endo: {\n beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'),\n splitScalar: (k) => {\n const n = secp256k1N;\n const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15');\n const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3');\n const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8');\n const b2 = a1;\n const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16)\n const c1 = divNearest(b2 * k, n);\n const c2 = divNearest(-b1 * k, n);\n let k1 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(k - c1 * a1 - c2 * a2, n);\n let k2 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(-c1 * b1 - c2 * b2, n);\n const k1neg = k1 > POW_2_128;\n const k2neg = k2 > POW_2_128;\n if (k1neg)\n k1 = n - k1;\n if (k2neg)\n k2 = n - k2;\n if (k1 > POW_2_128 || k2 > POW_2_128) {\n throw new Error('splitScalar: Endomorphism failed, k=' + k);\n }\n return { k1neg, k1, k2neg, k2 };\n },\n },\n}, _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_2__.sha256);\n// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.\n// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki\nconst _0n = BigInt(0);\nconst fe = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1P;\nconst ge = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1N;\n/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */\nconst TAGGED_HASH_PREFIXES = {};\nfunction taggedHash(tag, ...messages) {\n let tagP = TAGGED_HASH_PREFIXES[tag];\n if (tagP === undefined) {\n const tagH = (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_2__.sha256)(Uint8Array.from(tag, (c) => c.charCodeAt(0)));\n tagP = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.concatBytes)(tagH, tagH);\n TAGGED_HASH_PREFIXES[tag] = tagP;\n }\n return (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_2__.sha256)((0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.concatBytes)(tagP, ...messages));\n}\n// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03\nconst pointToBytes = (point) => point.toRawBytes(true).slice(1);\nconst numTo32b = (n) => (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.numberToBytesBE)(n, 32);\nconst modP = (x) => (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(x, secp256k1P);\nconst modN = (x) => (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(x, secp256k1N);\nconst Point = secp256k1.ProjectivePoint;\nconst GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b);\n// Calculate point, scalar and bytes\nfunction schnorrGetExtPubKey(priv) {\n let d_ = secp256k1.utils.normPrivateKeyToScalar(priv); // same method executed in fromPrivateKey\n let p = Point.fromPrivateKey(d_); // P = d'⋅G; 0 < d' < n check is done inside\n const scalar = p.hasEvenY() ? d_ : modN(-d_);\n return { scalar: scalar, bytes: pointToBytes(p) };\n}\n/**\n * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point.\n * @returns valid point checked for being on-curve\n */\nfunction lift_x(x) {\n if (!fe(x))\n throw new Error('bad x: need 0 < x < p'); // Fail if x ≥ p.\n const xx = modP(x * x);\n const c = modP(xx * x + BigInt(7)); // Let c = x³ + 7 mod p.\n let y = sqrtMod(c); // Let y = c^(p+1)/4 mod p.\n if (y % _2n !== _0n)\n y = modP(-y); // Return the unique point P such that x(P) = x and\n const p = new Point(x, y, _1n); // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise.\n p.assertValidity();\n return p;\n}\n/**\n * Create tagged hash, convert it to bigint, reduce modulo-n.\n */\nfunction challenge(...args) {\n return modN((0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.bytesToNumberBE)(taggedHash('BIP0340/challenge', ...args)));\n}\n/**\n * Schnorr public key is just `x` coordinate of Point as per BIP340.\n */\nfunction schnorrGetPublicKey(privateKey) {\n return schnorrGetExtPubKey(privateKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G)\n}\n/**\n * Creates Schnorr signature as per BIP340. Verifies itself before returning anything.\n * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous.\n */\nfunction schnorrSign(message, privateKey, auxRand = (0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_4__.randomBytes)(32)) {\n const m = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.ensureBytes)('message', message);\n const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); // checks for isWithinCurveOrder\n const a = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.ensureBytes)('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array\n const t = numTo32b(d ^ (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.bytesToNumberBE)(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a)\n const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m)\n const k_ = modN((0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.bytesToNumberBE)(rand)); // Let k' = int(rand) mod n\n if (k_ === _0n)\n throw new Error('sign failed: k is zero'); // Fail if k' = 0.\n const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); // Let R = k'⋅G.\n const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n.\n const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n).\n sig.set(rx, 0);\n sig.set(numTo32b(modN(k + e * d)), 32);\n // If Verify(bytes(P), m, sig) (see below) returns failure, abort\n if (!schnorrVerify(sig, m, px))\n throw new Error('sign: Invalid signature produced');\n return sig;\n}\n/**\n * Verifies Schnorr signature.\n * Will swallow errors & return false except for initial type validation of arguments.\n */\nfunction schnorrVerify(signature, message, publicKey) {\n const sig = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.ensureBytes)('signature', signature, 64);\n const m = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.ensureBytes)('message', message);\n const pub = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.ensureBytes)('publicKey', publicKey, 32);\n try {\n const P = lift_x((0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.bytesToNumberBE)(pub)); // P = lift_x(int(pk)); fail if that fails\n const r = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.bytesToNumberBE)(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p.\n if (!fe(r))\n return false;\n const s = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.bytesToNumberBE)(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n.\n if (!ge(s))\n return false;\n const e = challenge(numTo32b(r), pointToBytes(P), m); // int(challenge(bytes(r)||bytes(P)||m))%n\n const R = GmulAdd(P, s, modN(-e)); // R = s⋅G - e⋅P\n if (!R || !R.hasEvenY() || R.toAffine().x !== r)\n return false; // -eP == (n-e)P\n return true; // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r.\n }\n catch (error) {\n return false;\n }\n}\nconst schnorr = /* @__PURE__ */ (() => ({\n getPublicKey: schnorrGetPublicKey,\n sign: schnorrSign,\n verify: schnorrVerify,\n utils: {\n randomPrivateKey: secp256k1.utils.randomPrivateKey,\n lift_x,\n pointToBytes,\n numberToBytesBE: _abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.numberToBytesBE,\n bytesToNumberBE: _abstract_utils_js__WEBPACK_IMPORTED_MODULE_3__.bytesToNumberBE,\n taggedHash,\n mod: _abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod,\n },\n}))();\nconst isoMap = /* @__PURE__ */ (() => (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_5__.isogenyMap)(Fp, [\n // xNum\n [\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7',\n '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581',\n '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262',\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c',\n ],\n // xDen\n [\n '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b',\n '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n // yNum\n [\n '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c',\n '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3',\n '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931',\n '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84',\n ],\n // yDen\n [\n '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b',\n '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573',\n '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n].map((i) => i.map((j) => BigInt(j)))))();\nconst mapSWU = /* @__PURE__ */ (() => (0,_abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_6__.mapToCurveSimpleSWU)(Fp, {\n A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'),\n B: BigInt('1771'),\n Z: Fp.create(BigInt('-11')),\n}))();\nconst htf = /* @__PURE__ */ (() => (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_5__.createHasher)(secp256k1.ProjectivePoint, (scalars) => {\n const { x, y } = mapSWU(Fp.create(scalars[0]));\n return isoMap(x, y);\n}, {\n DST: 'secp256k1_XMD:SHA-256_SSWU_RO_',\n encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_',\n p: Fp.ORDER,\n m: 1,\n k: 128,\n expand: 'xmd',\n hash: _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_2__.sha256,\n}))();\nconst hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)();\nconst encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)();\n//# sourceMappingURL=secp256k1.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/curves/esm/secp256k1.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/hashes/esm/_assert.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/@noble/hashes/esm/_assert.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bool: () => (/* binding */ bool),\n/* harmony export */ bytes: () => (/* binding */ bytes),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ exists: () => (/* binding */ exists),\n/* harmony export */ hash: () => (/* binding */ hash),\n/* harmony export */ isBytes: () => (/* binding */ isBytes),\n/* harmony export */ number: () => (/* binding */ number),\n/* harmony export */ output: () => (/* binding */ output)\n/* harmony export */ });\nfunction number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`positive integer expected, not ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`boolean expected, not ${b}`);\n}\n// copied from utils\nfunction isBytes(a) {\n return (a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));\n}\nfunction bytes(b, ...lengths) {\n if (!isBytes(b))\n throw new Error('Uint8Array expected');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(h) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(h.outputLen);\n number(h.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\n\nconst assert = { number, bool, bytes, hash, exists, output };\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (assert);\n//# sourceMappingURL=_assert.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/hashes/esm/_assert.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/hashes/esm/_md.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/@noble/hashes/esm/_md.js ***!
|
||
\***********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Chi: () => (/* binding */ Chi),\n/* harmony export */ HashMD: () => (/* binding */ HashMD),\n/* harmony export */ Maj: () => (/* binding */ Maj)\n/* harmony export */ });\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/hashes/esm/_assert.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/hashes/esm/utils.js\");\n\n\n// Polyfill for Safari 14\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n// Choice: a ? b : c\nconst Chi = (a, b, c) => (a & b) ^ (~a & c);\n// Majority function, true if any two inpust is true\nconst Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n */\nclass HashMD extends _utils_js__WEBPACK_IMPORTED_MODULE_0__.Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.buffer = new Uint8Array(blockLen);\n this.view = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.createView)(this.buffer);\n }\n update(data) {\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__.exists)(this);\n const { view, buffer, blockLen } = this;\n data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.toBytes)(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.createView)(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__.exists)(this);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__.output)(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.createView)(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n}\n//# sourceMappingURL=_md.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/hashes/esm/_md.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/hashes/esm/_u64.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@noble/hashes/esm/_u64.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ add: () => (/* binding */ add),\n/* harmony export */ add3H: () => (/* binding */ add3H),\n/* harmony export */ add3L: () => (/* binding */ add3L),\n/* harmony export */ add4H: () => (/* binding */ add4H),\n/* harmony export */ add4L: () => (/* binding */ add4L),\n/* harmony export */ add5H: () => (/* binding */ add5H),\n/* harmony export */ add5L: () => (/* binding */ add5L),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ fromBig: () => (/* binding */ fromBig),\n/* harmony export */ rotlBH: () => (/* binding */ rotlBH),\n/* harmony export */ rotlBL: () => (/* binding */ rotlBL),\n/* harmony export */ rotlSH: () => (/* binding */ rotlSH),\n/* harmony export */ rotlSL: () => (/* binding */ rotlSL),\n/* harmony export */ rotr32H: () => (/* binding */ rotr32H),\n/* harmony export */ rotr32L: () => (/* binding */ rotr32L),\n/* harmony export */ rotrBH: () => (/* binding */ rotrBH),\n/* harmony export */ rotrBL: () => (/* binding */ rotrBL),\n/* harmony export */ rotrSH: () => (/* binding */ rotrSH),\n/* harmony export */ rotrSL: () => (/* binding */ rotrSL),\n/* harmony export */ shrSH: () => (/* binding */ shrSH),\n/* harmony export */ shrSL: () => (/* binding */ shrSL),\n/* harmony export */ split: () => (/* binding */ split),\n/* harmony export */ toBig: () => (/* binding */ toBig)\n/* harmony export */ });\nconst U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\n\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (u64);\n//# sourceMappingURL=_u64.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/hashes/esm/_u64.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/hashes/esm/crypto.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@noble/hashes/esm/crypto.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ crypto: () => (/* binding */ crypto)\n/* harmony export */ });\nconst crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\n//# sourceMappingURL=crypto.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/hashes/esm/crypto.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/hashes/esm/hkdf.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@noble/hashes/esm/hkdf.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ expand: () => (/* binding */ expand),\n/* harmony export */ extract: () => (/* binding */ extract),\n/* harmony export */ hkdf: () => (/* binding */ hkdf)\n/* harmony export */ });\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/hashes/esm/_assert.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/hashes/esm/utils.js\");\n/* harmony import */ var _hmac_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hmac.js */ \"./node_modules/@noble/hashes/esm/hmac.js\");\n\n\n\n// HKDF (RFC 5869)\n// https://soatok.blog/2021/11/17/understanding-hkdf/\n/**\n * HKDF-Extract(IKM, salt) -> PRK\n * Arguments position differs from spec (IKM is first one, since it is not optional)\n * @param hash\n * @param ikm\n * @param salt\n * @returns\n */\nfunction extract(hash, ikm, salt) {\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.hash)(hash);\n // NOTE: some libraries treat zero-length array as 'not provided';\n // we don't, since we have undefined as 'not provided'\n // https://github.com/RustCrypto/KDFs/issues/15\n if (salt === undefined)\n salt = new Uint8Array(hash.outputLen); // if not provided, it is set to a string of HashLen zeros\n return (0,_hmac_js__WEBPACK_IMPORTED_MODULE_1__.hmac)(hash, (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.toBytes)(salt), (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.toBytes)(ikm));\n}\n// HKDF-Expand(PRK, info, L) -> OKM\nconst HKDF_COUNTER = /* @__PURE__ */ new Uint8Array([0]);\nconst EMPTY_BUFFER = /* @__PURE__ */ new Uint8Array();\n/**\n * HKDF-expand from the spec.\n * @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step)\n * @param info - optional context and application specific information (can be a zero-length string)\n * @param length - length of output keying material in octets\n */\nfunction expand(hash, prk, info, length = 32) {\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.hash)(hash);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.number)(length);\n if (length > 255 * hash.outputLen)\n throw new Error('Length should be <= 255*HashLen');\n const blocks = Math.ceil(length / hash.outputLen);\n if (info === undefined)\n info = EMPTY_BUFFER;\n // first L(ength) octets of T\n const okm = new Uint8Array(blocks * hash.outputLen);\n // Re-use HMAC instance between blocks\n const HMAC = _hmac_js__WEBPACK_IMPORTED_MODULE_1__.hmac.create(hash, prk);\n const HMACTmp = HMAC._cloneInto();\n const T = new Uint8Array(HMAC.outputLen);\n for (let counter = 0; counter < blocks; counter++) {\n HKDF_COUNTER[0] = counter + 1;\n // T(0) = empty string (zero length)\n // T(N) = HMAC-Hash(PRK, T(N-1) | info | N)\n HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T)\n .update(info)\n .update(HKDF_COUNTER)\n .digestInto(T);\n okm.set(T, hash.outputLen * counter);\n HMAC._cloneInto(HMACTmp);\n }\n HMAC.destroy();\n HMACTmp.destroy();\n T.fill(0);\n HKDF_COUNTER.fill(0);\n return okm.slice(0, length);\n}\n/**\n * HKDF (RFC 5869): extract + expand in one step.\n * @param hash - hash function that would be used (e.g. sha256)\n * @param ikm - input keying material, the initial key\n * @param salt - optional salt value (a non-secret random value)\n * @param info - optional context and application specific information\n * @param length - length of output keying material in octets\n */\nconst hkdf = (hash, ikm, salt, info, length) => expand(hash, extract(hash, ikm, salt), info, length);\n//# sourceMappingURL=hkdf.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/hashes/esm/hkdf.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/hashes/esm/hmac.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@noble/hashes/esm/hmac.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HMAC: () => (/* binding */ HMAC),\n/* harmony export */ hmac: () => (/* binding */ hmac)\n/* harmony export */ });\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/hashes/esm/_assert.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/hashes/esm/utils.js\");\n\n\n// HMAC (RFC 2104)\nclass HMAC extends _utils_js__WEBPACK_IMPORTED_MODULE_0__.Hash {\n constructor(hash, _key) {\n super();\n this.finished = false;\n this.destroyed = false;\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__.hash)(hash);\n const key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.toBytes)(_key);\n this.iHash = hash.create();\n if (typeof this.iHash.update !== 'function')\n throw new Error('Expected instance of class which extends utils.Hash');\n this.blockLen = this.iHash.blockLen;\n this.outputLen = this.iHash.outputLen;\n const blockLen = this.blockLen;\n const pad = new Uint8Array(blockLen);\n // blockLen can be bigger than outputLen\n pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36;\n this.iHash.update(pad);\n // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n this.oHash = hash.create();\n // Undo internal XOR && apply outer XOR\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36 ^ 0x5c;\n this.oHash.update(pad);\n pad.fill(0);\n }\n update(buf) {\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__.exists)(this);\n this.iHash.update(buf);\n return this;\n }\n digestInto(out) {\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__.exists)(this);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__.bytes)(out, this.outputLen);\n this.finished = true;\n this.iHash.digestInto(out);\n this.oHash.update(out);\n this.oHash.digestInto(out);\n this.destroy();\n }\n digest() {\n const out = new Uint8Array(this.oHash.outputLen);\n this.digestInto(out);\n return out;\n }\n _cloneInto(to) {\n // Create new instance without calling constructor since key already in state and we don't know it.\n to || (to = Object.create(Object.getPrototypeOf(this), {}));\n const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n to = to;\n to.finished = finished;\n to.destroyed = destroyed;\n to.blockLen = blockLen;\n to.outputLen = outputLen;\n to.oHash = oHash._cloneInto(to.oHash);\n to.iHash = iHash._cloneInto(to.iHash);\n return to;\n }\n destroy() {\n this.destroyed = true;\n this.oHash.destroy();\n this.iHash.destroy();\n }\n}\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n */\nconst hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();\nhmac.create = (hash, key) => new HMAC(hash, key);\n//# sourceMappingURL=hmac.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/hashes/esm/hmac.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/hashes/esm/pbkdf2.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@noble/hashes/esm/pbkdf2.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pbkdf2: () => (/* binding */ pbkdf2),\n/* harmony export */ pbkdf2Async: () => (/* binding */ pbkdf2Async)\n/* harmony export */ });\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/hashes/esm/_assert.js\");\n/* harmony import */ var _hmac_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hmac.js */ \"./node_modules/@noble/hashes/esm/hmac.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/hashes/esm/utils.js\");\n\n\n\n// Common prologue and epilogue for sync/async functions\nfunction pbkdf2Init(hash, _password, _salt, _opts) {\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.hash)(hash);\n const opts = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.checkOpts)({ dkLen: 32, asyncTick: 10 }, _opts);\n const { c, dkLen, asyncTick } = opts;\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.number)(c);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.number)(dkLen);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.number)(asyncTick);\n if (c < 1)\n throw new Error('PBKDF2: iterations (c) should be >= 1');\n const password = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(_password);\n const salt = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(_salt);\n // DK = PBKDF2(PRF, Password, Salt, c, dkLen);\n const DK = new Uint8Array(dkLen);\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n const PRF = _hmac_js__WEBPACK_IMPORTED_MODULE_2__.hmac.create(hash, password);\n const PRFSalt = PRF._cloneInto().update(salt);\n return { c, dkLen, asyncTick, DK, PRF, PRFSalt };\n}\nfunction pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {\n PRF.destroy();\n PRFSalt.destroy();\n if (prfW)\n prfW.destroy();\n u.fill(0);\n return DK;\n}\n/**\n * PBKDF2-HMAC: RFC 2898 key derivation function\n * @param hash - hash function that would be used e.g. sha256\n * @param password - password from which a derived key is generated\n * @param salt - cryptographic salt\n * @param opts - {c, dkLen} where c is work factor and dkLen is output message size\n */\nfunction pbkdf2(hash, password, salt, opts) {\n const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.createView)(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n for (let ui = 1; ui < c; ui++) {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n }\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\nasync function pbkdf2Async(hash, password, salt, opts) {\n const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.createView)(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n await (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.asyncLoop)(c - 1, asyncTick, () => {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n });\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\n//# sourceMappingURL=pbkdf2.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/hashes/esm/pbkdf2.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/hashes/esm/sha256.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@noble/hashes/esm/sha256.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ sha224: () => (/* binding */ sha224),\n/* harmony export */ sha256: () => (/* binding */ sha256)\n/* harmony export */ });\n/* harmony import */ var _md_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_md.js */ \"./node_modules/@noble/hashes/esm/_md.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/hashes/esm/utils.js\");\n\n\n// SHA2-256 need to try 2^128 hashes to execute birthday attack.\n// BTC network is doing 2^67 hashes/sec as per early 2023.\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n// Initial state:\n// first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19\n// prettier-ignore\nconst SHA256_IV = /* @__PURE__ */ new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nclass SHA256 extends _md_js__WEBPACK_IMPORTED_MODULE_0__.HashMD {\n constructor() {\n super(64, 32, 8, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n this.A = SHA256_IV[0] | 0;\n this.B = SHA256_IV[1] | 0;\n this.C = SHA256_IV[2] | 0;\n this.D = SHA256_IV[3] | 0;\n this.E = SHA256_IV[4] | 0;\n this.F = SHA256_IV[5] | 0;\n this.G = SHA256_IV[6] | 0;\n this.H = SHA256_IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(W15, 7) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(W15, 18) ^ (W15 >>> 3);\n const s1 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(W2, 17) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(E, 6) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(E, 11) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(E, 25);\n const T1 = (H + sigma1 + (0,_md_js__WEBPACK_IMPORTED_MODULE_0__.Chi)(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(A, 2) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(A, 13) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(A, 22);\n const T2 = (sigma0 + (0,_md_js__WEBPACK_IMPORTED_MODULE_0__.Maj)(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n constructor() {\n super();\n this.A = 0xc1059ed8 | 0;\n this.B = 0x367cd507 | 0;\n this.C = 0x3070dd17 | 0;\n this.D = 0xf70e5939 | 0;\n this.E = 0xffc00b31 | 0;\n this.F = 0x68581511 | 0;\n this.G = 0x64f98fa7 | 0;\n this.H = 0xbefa4fa4 | 0;\n this.outputLen = 28;\n }\n}\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nconst sha256 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.wrapConstructor)(() => new SHA256());\nconst sha224 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.wrapConstructor)(() => new SHA224());\n//# sourceMappingURL=sha256.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/hashes/esm/sha256.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/hashes/esm/sha512.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@noble/hashes/esm/sha512.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SHA512: () => (/* binding */ SHA512),\n/* harmony export */ sha384: () => (/* binding */ sha384),\n/* harmony export */ sha512: () => (/* binding */ sha512),\n/* harmony export */ sha512_224: () => (/* binding */ sha512_224),\n/* harmony export */ sha512_256: () => (/* binding */ sha512_256)\n/* harmony export */ });\n/* harmony import */ var _md_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_md.js */ \"./node_modules/@noble/hashes/esm/_md.js\");\n/* harmony import */ var _u64_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_u64.js */ \"./node_modules/@noble/hashes/esm/_u64.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/hashes/esm/utils.js\");\n\n\n\n// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):\n// prettier-ignore\nconst [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\n// Temporary buffer, not used to store anything between runs\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\nclass SHA512 extends _md_js__WEBPACK_IMPORTED_MODULE_1__.HashMD {\n constructor() {\n super(128, 64, 16, false);\n // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.\n // Also looks cleaner and easier to verify with spec.\n // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x6a09e667 | 0;\n this.Al = 0xf3bcc908 | 0;\n this.Bh = 0xbb67ae85 | 0;\n this.Bl = 0x84caa73b | 0;\n this.Ch = 0x3c6ef372 | 0;\n this.Cl = 0xfe94f82b | 0;\n this.Dh = 0xa54ff53a | 0;\n this.Dl = 0x5f1d36f1 | 0;\n this.Eh = 0x510e527f | 0;\n this.El = 0xade682d1 | 0;\n this.Fh = 0x9b05688c | 0;\n this.Fl = 0x2b3e6c1f | 0;\n this.Gh = 0x1f83d9ab | 0;\n this.Gl = 0xfb41bd6b | 0;\n this.Hh = 0x5be0cd19 | 0;\n this.Hl = 0x137e2179 | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSH(W15h, W15l, 1) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSH(W15h, W15l, 8) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].shrSH(W15h, W15l, 7);\n const s0l = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSL(W15h, W15l, 1) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSL(W15h, W15l, 8) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSH(W2h, W2l, 19) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrBH(W2h, W2l, 61) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].shrSH(W2h, W2l, 6);\n const s1l = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSL(W2h, W2l, 19) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrBL(W2h, W2l, 61) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSH(Eh, El, 14) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSH(Eh, El, 18) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrBH(Eh, El, 41);\n const sigma1l = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSL(Eh, El, 14) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSL(Eh, El, 18) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSH(Ah, Al, 28) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrBH(Ah, Al, 34) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrBH(Ah, Al, 39);\n const sigma0l = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrSL(Ah, Al, 28) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrBL(Ah, Al, 34) ^ _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add3L(T1l, sigma0l, MAJl);\n Ah = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = _u64_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n SHA512_W_H.fill(0);\n SHA512_W_L.fill(0);\n }\n destroy() {\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\nclass SHA512_224 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x8c3d37c8 | 0;\n this.Al = 0x19544da2 | 0;\n this.Bh = 0x73e19966 | 0;\n this.Bl = 0x89dcd4d6 | 0;\n this.Ch = 0x1dfab7ae | 0;\n this.Cl = 0x32ff9c82 | 0;\n this.Dh = 0x679dd514 | 0;\n this.Dl = 0x582f9fcf | 0;\n this.Eh = 0x0f6d2b69 | 0;\n this.El = 0x7bd44da8 | 0;\n this.Fh = 0x77e36f73 | 0;\n this.Fl = 0x04c48942 | 0;\n this.Gh = 0x3f9d85a8 | 0;\n this.Gl = 0x6a1d36c8 | 0;\n this.Hh = 0x1112e6ad | 0;\n this.Hl = 0x91d692a1 | 0;\n this.outputLen = 28;\n }\n}\nclass SHA512_256 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x22312194 | 0;\n this.Al = 0xfc2bf72c | 0;\n this.Bh = 0x9f555fa3 | 0;\n this.Bl = 0xc84c64c2 | 0;\n this.Ch = 0x2393b86b | 0;\n this.Cl = 0x6f53b151 | 0;\n this.Dh = 0x96387719 | 0;\n this.Dl = 0x5940eabd | 0;\n this.Eh = 0x96283ee2 | 0;\n this.El = 0xa88effe3 | 0;\n this.Fh = 0xbe5e1e25 | 0;\n this.Fl = 0x53863992 | 0;\n this.Gh = 0x2b0199fc | 0;\n this.Gl = 0x2c85b8aa | 0;\n this.Hh = 0x0eb72ddc | 0;\n this.Hl = 0x81c52ca2 | 0;\n this.outputLen = 32;\n }\n}\nclass SHA384 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0xcbbb9d5d | 0;\n this.Al = 0xc1059ed8 | 0;\n this.Bh = 0x629a292a | 0;\n this.Bl = 0x367cd507 | 0;\n this.Ch = 0x9159015a | 0;\n this.Cl = 0x3070dd17 | 0;\n this.Dh = 0x152fecd8 | 0;\n this.Dl = 0xf70e5939 | 0;\n this.Eh = 0x67332667 | 0;\n this.El = 0xffc00b31 | 0;\n this.Fh = 0x8eb44a87 | 0;\n this.Fl = 0x68581511 | 0;\n this.Gh = 0xdb0c2e0d | 0;\n this.Gl = 0x64f98fa7 | 0;\n this.Hh = 0x47b5481d | 0;\n this.Hl = 0xbefa4fa4 | 0;\n this.outputLen = 48;\n }\n}\nconst sha512 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.wrapConstructor)(() => new SHA512());\nconst sha512_224 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.wrapConstructor)(() => new SHA512_224());\nconst sha512_256 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.wrapConstructor)(() => new SHA512_256());\nconst sha384 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.wrapConstructor)(() => new SHA384());\n//# sourceMappingURL=sha512.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/hashes/esm/sha512.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/hashes/esm/utils.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/@noble/hashes/esm/utils.js ***!
|
||
\*************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Hash: () => (/* binding */ Hash),\n/* harmony export */ asyncLoop: () => (/* binding */ asyncLoop),\n/* harmony export */ byteSwap: () => (/* binding */ byteSwap),\n/* harmony export */ byteSwap32: () => (/* binding */ byteSwap32),\n/* harmony export */ byteSwapIfBE: () => (/* binding */ byteSwapIfBE),\n/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex),\n/* harmony export */ checkOpts: () => (/* binding */ checkOpts),\n/* harmony export */ concatBytes: () => (/* binding */ concatBytes),\n/* harmony export */ createView: () => (/* binding */ createView),\n/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes),\n/* harmony export */ isBytes: () => (/* binding */ isBytes),\n/* harmony export */ isLE: () => (/* binding */ isLE),\n/* harmony export */ nextTick: () => (/* binding */ nextTick),\n/* harmony export */ randomBytes: () => (/* binding */ randomBytes),\n/* harmony export */ rotl: () => (/* binding */ rotl),\n/* harmony export */ rotr: () => (/* binding */ rotr),\n/* harmony export */ toBytes: () => (/* binding */ toBytes),\n/* harmony export */ u32: () => (/* binding */ u32),\n/* harmony export */ u8: () => (/* binding */ u8),\n/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes),\n/* harmony export */ wrapConstructor: () => (/* binding */ wrapConstructor),\n/* harmony export */ wrapConstructorWithOpts: () => (/* binding */ wrapConstructorWithOpts),\n/* harmony export */ wrapXOFConstructorWithOpts: () => (/* binding */ wrapXOFConstructorWithOpts)\n/* harmony export */ });\n/* harmony import */ var _noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/hashes/crypto */ \"./node_modules/@noble/hashes/esm/crypto.js\");\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/hashes/esm/_assert.js\");\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\n\n\n// export { isBytes } from './_assert.js';\n// We can't reuse isBytes from _assert, because somehow this causes huge perf issues\nfunction isBytes(a) {\n return (a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));\n}\n// Cast array to different type\nconst u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nconst u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nconst createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nconst rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// The rotate left (circular left shift) operation for uint32\nconst rotl = (word, shift) => (word << shift) | ((word >>> (32 - shift)) >>> 0);\nconst isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\n// The byte swap operation for uint32\nconst byteSwap = (word) => ((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff);\n// Conditionally byte swap if on a big-endian platform\nconst byteSwapIfBE = isLE ? (n) => n : (n) => byteSwap(n);\n// In place byte swap for Uint32Array\nfunction byteSwap32(arr) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n}\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nfunction bytesToHex(bytes) {\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.bytes)(bytes);\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };\nfunction asciiToBase16(char) {\n if (char >= asciis._0 && char <= asciis._9)\n return char - asciis._0;\n if (char >= asciis._A && char <= asciis._F)\n return char - (asciis._A - 10);\n if (char >= asciis._a && char <= asciis._f)\n return char - (asciis._a - 10);\n return;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nconst nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nasync function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nfunction utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nfunction toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.bytes)(data);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nfunction concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__.bytes)(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n// For runtime check if class implements interface\nclass Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nconst toStr = {}.toString;\nfunction checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nfunction wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nfunction wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nfunction wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nfunction randomBytes(bytesLength = 32) {\n if (_noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_1__.crypto && typeof _noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_1__.crypto.getRandomValues === 'function') {\n return _noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_1__.crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/hashes/esm/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@noble/secp256k1/lib/esm/index.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/@noble/secp256k1/lib/esm/index.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("var crypto__WEBPACK_IMPORTED_MODULE_0___namespace_cache;\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CURVE: () => (/* binding */ CURVE),\n/* harmony export */ Point: () => (/* binding */ Point),\n/* harmony export */ Signature: () => (/* binding */ Signature),\n/* harmony export */ getPublicKey: () => (/* binding */ getPublicKey),\n/* harmony export */ getSharedSecret: () => (/* binding */ getSharedSecret),\n/* harmony export */ recoverPublicKey: () => (/* binding */ recoverPublicKey),\n/* harmony export */ schnorr: () => (/* binding */ schnorr),\n/* harmony export */ sign: () => (/* binding */ sign),\n/* harmony export */ signSync: () => (/* binding */ signSync),\n/* harmony export */ utils: () => (/* binding */ utils),\n/* harmony export */ verify: () => (/* binding */ verify)\n/* harmony export */ });\n/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! crypto */ \"?ce41\");\n/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */\n\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst _3n = BigInt(3);\nconst _8n = BigInt(8);\nconst CURVE = Object.freeze({\n a: _0n,\n b: BigInt(7),\n P: BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'),\n n: BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'),\n h: _1n,\n Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'),\n Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'),\n beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'),\n});\nconst divNearest = (a, b) => (a + b / _2n) / b;\nconst endo = {\n beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'),\n splitScalar(k) {\n const { n } = CURVE;\n const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15');\n const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3');\n const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8');\n const b2 = a1;\n const POW_2_128 = BigInt('0x100000000000000000000000000000000');\n const c1 = divNearest(b2 * k, n);\n const c2 = divNearest(-b1 * k, n);\n let k1 = mod(k - c1 * a1 - c2 * a2, n);\n let k2 = mod(-c1 * b1 - c2 * b2, n);\n const k1neg = k1 > POW_2_128;\n const k2neg = k2 > POW_2_128;\n if (k1neg)\n k1 = n - k1;\n if (k2neg)\n k2 = n - k2;\n if (k1 > POW_2_128 || k2 > POW_2_128) {\n throw new Error('splitScalarEndo: Endomorphism failed, k=' + k);\n }\n return { k1neg, k1, k2neg, k2 };\n },\n};\nconst fieldLen = 32;\nconst groupLen = 32;\nconst hashLen = 32;\nconst compressedLen = fieldLen + 1;\nconst uncompressedLen = 2 * fieldLen + 1;\n\nfunction weierstrass(x) {\n const { a, b } = CURVE;\n const x2 = mod(x * x);\n const x3 = mod(x2 * x);\n return mod(x3 + a * x + b);\n}\nconst USE_ENDOMORPHISM = CURVE.a === _0n;\nclass ShaError extends Error {\n constructor(message) {\n super(message);\n }\n}\nfunction assertJacPoint(other) {\n if (!(other instanceof JacobianPoint))\n throw new TypeError('JacobianPoint expected');\n}\nclass JacobianPoint {\n constructor(x, y, z) {\n this.x = x;\n this.y = y;\n this.z = z;\n }\n static fromAffine(p) {\n if (!(p instanceof Point)) {\n throw new TypeError('JacobianPoint#fromAffine: expected Point');\n }\n if (p.equals(Point.ZERO))\n return JacobianPoint.ZERO;\n return new JacobianPoint(p.x, p.y, _1n);\n }\n static toAffineBatch(points) {\n const toInv = invertBatch(points.map((p) => p.z));\n return points.map((p, i) => p.toAffine(toInv[i]));\n }\n static normalizeZ(points) {\n return JacobianPoint.toAffineBatch(points).map(JacobianPoint.fromAffine);\n }\n equals(other) {\n assertJacPoint(other);\n const { x: X1, y: Y1, z: Z1 } = this;\n const { x: X2, y: Y2, z: Z2 } = other;\n const Z1Z1 = mod(Z1 * Z1);\n const Z2Z2 = mod(Z2 * Z2);\n const U1 = mod(X1 * Z2Z2);\n const U2 = mod(X2 * Z1Z1);\n const S1 = mod(mod(Y1 * Z2) * Z2Z2);\n const S2 = mod(mod(Y2 * Z1) * Z1Z1);\n return U1 === U2 && S1 === S2;\n }\n negate() {\n return new JacobianPoint(this.x, mod(-this.y), this.z);\n }\n double() {\n const { x: X1, y: Y1, z: Z1 } = this;\n const A = mod(X1 * X1);\n const B = mod(Y1 * Y1);\n const C = mod(B * B);\n const x1b = X1 + B;\n const D = mod(_2n * (mod(x1b * x1b) - A - C));\n const E = mod(_3n * A);\n const F = mod(E * E);\n const X3 = mod(F - _2n * D);\n const Y3 = mod(E * (D - X3) - _8n * C);\n const Z3 = mod(_2n * Y1 * Z1);\n return new JacobianPoint(X3, Y3, Z3);\n }\n add(other) {\n assertJacPoint(other);\n const { x: X1, y: Y1, z: Z1 } = this;\n const { x: X2, y: Y2, z: Z2 } = other;\n if (X2 === _0n || Y2 === _0n)\n return this;\n if (X1 === _0n || Y1 === _0n)\n return other;\n const Z1Z1 = mod(Z1 * Z1);\n const Z2Z2 = mod(Z2 * Z2);\n const U1 = mod(X1 * Z2Z2);\n const U2 = mod(X2 * Z1Z1);\n const S1 = mod(mod(Y1 * Z2) * Z2Z2);\n const S2 = mod(mod(Y2 * Z1) * Z1Z1);\n const H = mod(U2 - U1);\n const r = mod(S2 - S1);\n if (H === _0n) {\n if (r === _0n) {\n return this.double();\n }\n else {\n return JacobianPoint.ZERO;\n }\n }\n const HH = mod(H * H);\n const HHH = mod(H * HH);\n const V = mod(U1 * HH);\n const X3 = mod(r * r - HHH - _2n * V);\n const Y3 = mod(r * (V - X3) - S1 * HHH);\n const Z3 = mod(Z1 * Z2 * H);\n return new JacobianPoint(X3, Y3, Z3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n multiplyUnsafe(scalar) {\n const P0 = JacobianPoint.ZERO;\n if (typeof scalar === 'bigint' && scalar === _0n)\n return P0;\n let n = normalizeScalar(scalar);\n if (n === _1n)\n return this;\n if (!USE_ENDOMORPHISM) {\n let p = P0;\n let d = this;\n while (n > _0n) {\n if (n & _1n)\n p = p.add(d);\n d = d.double();\n n >>= _1n;\n }\n return p;\n }\n let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let k1p = P0;\n let k2p = P0;\n let d = this;\n while (k1 > _0n || k2 > _0n) {\n if (k1 & _1n)\n k1p = k1p.add(d);\n if (k2 & _1n)\n k2p = k2p.add(d);\n d = d.double();\n k1 >>= _1n;\n k2 >>= _1n;\n }\n if (k1neg)\n k1p = k1p.negate();\n if (k2neg)\n k2p = k2p.negate();\n k2p = new JacobianPoint(mod(k2p.x * endo.beta), k2p.y, k2p.z);\n return k1p.add(k2p);\n }\n precomputeWindow(W) {\n const windows = USE_ENDOMORPHISM ? 128 / W + 1 : 256 / W + 1;\n const points = [];\n let p = this;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n for (let i = 1; i < 2 ** (W - 1); i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n }\n wNAF(n, affinePoint) {\n if (!affinePoint && this.equals(JacobianPoint.BASE))\n affinePoint = Point.BASE;\n const W = (affinePoint && affinePoint._WINDOW_SIZE) || 1;\n if (256 % W) {\n throw new Error('Point#wNAF: Invalid precomputation window, must be power of 2');\n }\n let precomputes = affinePoint && pointPrecomputes.get(affinePoint);\n if (!precomputes) {\n precomputes = this.precomputeWindow(W);\n if (affinePoint && W !== 1) {\n precomputes = JacobianPoint.normalizeZ(precomputes);\n pointPrecomputes.set(affinePoint, precomputes);\n }\n }\n let p = JacobianPoint.ZERO;\n let f = JacobianPoint.BASE;\n const windows = 1 + (USE_ENDOMORPHISM ? 128 / W : 256 / W);\n const windowSize = 2 ** (W - 1);\n const mask = BigInt(2 ** W - 1);\n const maxNumber = 2 ** W;\n const shiftBy = BigInt(W);\n for (let window = 0; window < windows; window++) {\n const offset = window * windowSize;\n let wbits = Number(n & mask);\n n >>= shiftBy;\n if (wbits > windowSize) {\n wbits -= maxNumber;\n n += _1n;\n }\n const offset1 = offset;\n const offset2 = offset + Math.abs(wbits) - 1;\n const cond1 = window % 2 !== 0;\n const cond2 = wbits < 0;\n if (wbits === 0) {\n f = f.add(constTimeNegate(cond1, precomputes[offset1]));\n }\n else {\n p = p.add(constTimeNegate(cond2, precomputes[offset2]));\n }\n }\n return { p, f };\n }\n multiply(scalar, affinePoint) {\n let n = normalizeScalar(scalar);\n let point;\n let fake;\n if (USE_ENDOMORPHISM) {\n const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let { p: k1p, f: f1p } = this.wNAF(k1, affinePoint);\n let { p: k2p, f: f2p } = this.wNAF(k2, affinePoint);\n k1p = constTimeNegate(k1neg, k1p);\n k2p = constTimeNegate(k2neg, k2p);\n k2p = new JacobianPoint(mod(k2p.x * endo.beta), k2p.y, k2p.z);\n point = k1p.add(k2p);\n fake = f1p.add(f2p);\n }\n else {\n const { p, f } = this.wNAF(n, affinePoint);\n point = p;\n fake = f;\n }\n return JacobianPoint.normalizeZ([point, fake])[0];\n }\n toAffine(invZ) {\n const { x, y, z } = this;\n const is0 = this.equals(JacobianPoint.ZERO);\n if (invZ == null)\n invZ = is0 ? _8n : invert(z);\n const iz1 = invZ;\n const iz2 = mod(iz1 * iz1);\n const iz3 = mod(iz2 * iz1);\n const ax = mod(x * iz2);\n const ay = mod(y * iz3);\n const zz = mod(z * iz1);\n if (is0)\n return Point.ZERO;\n if (zz !== _1n)\n throw new Error('invZ was invalid');\n return new Point(ax, ay);\n }\n}\nJacobianPoint.BASE = new JacobianPoint(CURVE.Gx, CURVE.Gy, _1n);\nJacobianPoint.ZERO = new JacobianPoint(_0n, _1n, _0n);\nfunction constTimeNegate(condition, item) {\n const neg = item.negate();\n return condition ? neg : item;\n}\nconst pointPrecomputes = new WeakMap();\nclass Point {\n constructor(x, y) {\n this.x = x;\n this.y = y;\n }\n _setWindowSize(windowSize) {\n this._WINDOW_SIZE = windowSize;\n pointPrecomputes.delete(this);\n }\n hasEvenY() {\n return this.y % _2n === _0n;\n }\n static fromCompressedHex(bytes) {\n const isShort = bytes.length === 32;\n const x = bytesToNumber(isShort ? bytes : bytes.subarray(1));\n if (!isValidFieldElement(x))\n throw new Error('Point is not on curve');\n const y2 = weierstrass(x);\n let y = sqrtMod(y2);\n const isYOdd = (y & _1n) === _1n;\n if (isShort) {\n if (isYOdd)\n y = mod(-y);\n }\n else {\n const isFirstByteOdd = (bytes[0] & 1) === 1;\n if (isFirstByteOdd !== isYOdd)\n y = mod(-y);\n }\n const point = new Point(x, y);\n point.assertValidity();\n return point;\n }\n static fromUncompressedHex(bytes) {\n const x = bytesToNumber(bytes.subarray(1, fieldLen + 1));\n const y = bytesToNumber(bytes.subarray(fieldLen + 1, fieldLen * 2 + 1));\n const point = new Point(x, y);\n point.assertValidity();\n return point;\n }\n static fromHex(hex) {\n const bytes = ensureBytes(hex);\n const len = bytes.length;\n const header = bytes[0];\n if (len === fieldLen)\n return this.fromCompressedHex(bytes);\n if (len === compressedLen && (header === 0x02 || header === 0x03)) {\n return this.fromCompressedHex(bytes);\n }\n if (len === uncompressedLen && header === 0x04)\n return this.fromUncompressedHex(bytes);\n throw new Error(`Point.fromHex: received invalid point. Expected 32-${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes, not ${len}`);\n }\n static fromPrivateKey(privateKey) {\n return Point.BASE.multiply(normalizePrivateKey(privateKey));\n }\n static fromSignature(msgHash, signature, recovery) {\n const { r, s } = normalizeSignature(signature);\n if (![0, 1, 2, 3].includes(recovery))\n throw new Error('Cannot recover: invalid recovery bit');\n const h = truncateHash(ensureBytes(msgHash));\n const { n } = CURVE;\n const radj = recovery === 2 || recovery === 3 ? r + n : r;\n const rinv = invert(radj, n);\n const u1 = mod(-h * rinv, n);\n const u2 = mod(s * rinv, n);\n const prefix = recovery & 1 ? '03' : '02';\n const R = Point.fromHex(prefix + numTo32bStr(radj));\n const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2);\n if (!Q)\n throw new Error('Cannot recover signature: point at infinify');\n Q.assertValidity();\n return Q;\n }\n toRawBytes(isCompressed = false) {\n return hexToBytes(this.toHex(isCompressed));\n }\n toHex(isCompressed = false) {\n const x = numTo32bStr(this.x);\n if (isCompressed) {\n const prefix = this.hasEvenY() ? '02' : '03';\n return `${prefix}${x}`;\n }\n else {\n return `04${x}${numTo32bStr(this.y)}`;\n }\n }\n toHexX() {\n return this.toHex(true).slice(2);\n }\n toRawX() {\n return this.toRawBytes(true).slice(1);\n }\n assertValidity() {\n const msg = 'Point is not on elliptic curve';\n const { x, y } = this;\n if (!isValidFieldElement(x) || !isValidFieldElement(y))\n throw new Error(msg);\n const left = mod(y * y);\n const right = weierstrass(x);\n if (mod(left - right) !== _0n)\n throw new Error(msg);\n }\n equals(other) {\n return this.x === other.x && this.y === other.y;\n }\n negate() {\n return new Point(this.x, mod(-this.y));\n }\n double() {\n return JacobianPoint.fromAffine(this).double().toAffine();\n }\n add(other) {\n return JacobianPoint.fromAffine(this).add(JacobianPoint.fromAffine(other)).toAffine();\n }\n subtract(other) {\n return this.add(other.negate());\n }\n multiply(scalar) {\n return JacobianPoint.fromAffine(this).multiply(scalar, this).toAffine();\n }\n multiplyAndAddUnsafe(Q, a, b) {\n const P = JacobianPoint.fromAffine(this);\n const aP = a === _0n || a === _1n || this !== Point.BASE ? P.multiplyUnsafe(a) : P.multiply(a);\n const bQ = JacobianPoint.fromAffine(Q).multiplyUnsafe(b);\n const sum = aP.add(bQ);\n return sum.equals(JacobianPoint.ZERO) ? undefined : sum.toAffine();\n }\n}\nPoint.BASE = new Point(CURVE.Gx, CURVE.Gy);\nPoint.ZERO = new Point(_0n, _0n);\nfunction sliceDER(s) {\n return Number.parseInt(s[0], 16) >= 8 ? '00' + s : s;\n}\nfunction parseDERInt(data) {\n if (data.length < 2 || data[0] !== 0x02) {\n throw new Error(`Invalid signature integer tag: ${bytesToHex(data)}`);\n }\n const len = data[1];\n const res = data.subarray(2, len + 2);\n if (!len || res.length !== len) {\n throw new Error(`Invalid signature integer: wrong length`);\n }\n if (res[0] === 0x00 && res[1] <= 0x7f) {\n throw new Error('Invalid signature integer: trailing length');\n }\n return { data: bytesToNumber(res), left: data.subarray(len + 2) };\n}\nfunction parseDERSignature(data) {\n if (data.length < 2 || data[0] != 0x30) {\n throw new Error(`Invalid signature tag: ${bytesToHex(data)}`);\n }\n if (data[1] !== data.length - 2) {\n throw new Error('Invalid signature: incorrect length');\n }\n const { data: r, left: sBytes } = parseDERInt(data.subarray(2));\n const { data: s, left: rBytesLeft } = parseDERInt(sBytes);\n if (rBytesLeft.length) {\n throw new Error(`Invalid signature: left bytes after parsing: ${bytesToHex(rBytesLeft)}`);\n }\n return { r, s };\n}\nclass Signature {\n constructor(r, s) {\n this.r = r;\n this.s = s;\n this.assertValidity();\n }\n static fromCompact(hex) {\n const arr = hex instanceof Uint8Array;\n const name = 'Signature.fromCompact';\n if (typeof hex !== 'string' && !arr)\n throw new TypeError(`${name}: Expected string or Uint8Array`);\n const str = arr ? bytesToHex(hex) : hex;\n if (str.length !== 128)\n throw new Error(`${name}: Expected 64-byte hex`);\n return new Signature(hexToNumber(str.slice(0, 64)), hexToNumber(str.slice(64, 128)));\n }\n static fromDER(hex) {\n const arr = hex instanceof Uint8Array;\n if (typeof hex !== 'string' && !arr)\n throw new TypeError(`Signature.fromDER: Expected string or Uint8Array`);\n const { r, s } = parseDERSignature(arr ? hex : hexToBytes(hex));\n return new Signature(r, s);\n }\n static fromHex(hex) {\n return this.fromDER(hex);\n }\n assertValidity() {\n const { r, s } = this;\n if (!isWithinCurveOrder(r))\n throw new Error('Invalid Signature: r must be 0 < r < n');\n if (!isWithinCurveOrder(s))\n throw new Error('Invalid Signature: s must be 0 < s < n');\n }\n hasHighS() {\n const HALF = CURVE.n >> _1n;\n return this.s > HALF;\n }\n normalizeS() {\n return this.hasHighS() ? new Signature(this.r, mod(-this.s, CURVE.n)) : this;\n }\n toDERRawBytes() {\n return hexToBytes(this.toDERHex());\n }\n toDERHex() {\n const sHex = sliceDER(numberToHexUnpadded(this.s));\n const rHex = sliceDER(numberToHexUnpadded(this.r));\n const sHexL = sHex.length / 2;\n const rHexL = rHex.length / 2;\n const sLen = numberToHexUnpadded(sHexL);\n const rLen = numberToHexUnpadded(rHexL);\n const length = numberToHexUnpadded(rHexL + sHexL + 4);\n return `30${length}02${rLen}${rHex}02${sLen}${sHex}`;\n }\n toRawBytes() {\n return this.toDERRawBytes();\n }\n toHex() {\n return this.toDERHex();\n }\n toCompactRawBytes() {\n return hexToBytes(this.toCompactHex());\n }\n toCompactHex() {\n return numTo32bStr(this.r) + numTo32bStr(this.s);\n }\n}\nfunction concatBytes(...arrays) {\n if (!arrays.every((b) => b instanceof Uint8Array))\n throw new Error('Uint8Array list expected');\n if (arrays.length === 1)\n return arrays[0];\n const length = arrays.reduce((a, arr) => a + arr.length, 0);\n const result = new Uint8Array(length);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const arr = arrays[i];\n result.set(arr, pad);\n pad += arr.length;\n }\n return result;\n}\nconst hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));\nfunction bytesToHex(uint8a) {\n if (!(uint8a instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n let hex = '';\n for (let i = 0; i < uint8a.length; i++) {\n hex += hexes[uint8a[i]];\n }\n return hex;\n}\nconst POW_2_256 = BigInt('0x10000000000000000000000000000000000000000000000000000000000000000');\nfunction numTo32bStr(num) {\n if (typeof num !== 'bigint')\n throw new Error('Expected bigint');\n if (!(_0n <= num && num < POW_2_256))\n throw new Error('Expected number 0 <= n < 2^256');\n return num.toString(16).padStart(64, '0');\n}\nfunction numTo32b(num) {\n const b = hexToBytes(numTo32bStr(num));\n if (b.length !== 32)\n throw new Error('Error: expected 32 bytes');\n return b;\n}\nfunction numberToHexUnpadded(num) {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n}\nfunction hexToNumber(hex) {\n if (typeof hex !== 'string') {\n throw new TypeError('hexToNumber: expected string, got ' + typeof hex);\n }\n return BigInt(`0x${hex}`);\n}\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string') {\n throw new TypeError('hexToBytes: expected string, got ' + typeof hex);\n }\n if (hex.length % 2)\n throw new Error('hexToBytes: received invalid unpadded hex' + hex.length);\n const array = new Uint8Array(hex.length / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\nfunction bytesToNumber(bytes) {\n return hexToNumber(bytesToHex(bytes));\n}\nfunction ensureBytes(hex) {\n return hex instanceof Uint8Array ? Uint8Array.from(hex) : hexToBytes(hex);\n}\nfunction normalizeScalar(num) {\n if (typeof num === 'number' && Number.isSafeInteger(num) && num > 0)\n return BigInt(num);\n if (typeof num === 'bigint' && isWithinCurveOrder(num))\n return num;\n throw new TypeError('Expected valid private scalar: 0 < scalar < curve.n');\n}\nfunction mod(a, b = CURVE.P) {\n const result = a % b;\n return result >= _0n ? result : b + result;\n}\nfunction pow2(x, power) {\n const { P } = CURVE;\n let res = x;\n while (power-- > _0n) {\n res *= res;\n res %= P;\n }\n return res;\n}\nfunction sqrtMod(x) {\n const { P } = CURVE;\n const _6n = BigInt(6);\n const _11n = BigInt(11);\n const _22n = BigInt(22);\n const _23n = BigInt(23);\n const _44n = BigInt(44);\n const _88n = BigInt(88);\n const b2 = (x * x * x) % P;\n const b3 = (b2 * b2 * x) % P;\n const b6 = (pow2(b3, _3n) * b3) % P;\n const b9 = (pow2(b6, _3n) * b3) % P;\n const b11 = (pow2(b9, _2n) * b2) % P;\n const b22 = (pow2(b11, _11n) * b11) % P;\n const b44 = (pow2(b22, _22n) * b22) % P;\n const b88 = (pow2(b44, _44n) * b44) % P;\n const b176 = (pow2(b88, _88n) * b88) % P;\n const b220 = (pow2(b176, _44n) * b44) % P;\n const b223 = (pow2(b220, _3n) * b3) % P;\n const t1 = (pow2(b223, _23n) * b22) % P;\n const t2 = (pow2(t1, _6n) * b2) % P;\n const rt = pow2(t2, _2n);\n const xc = (rt * rt) % P;\n if (xc !== x)\n throw new Error('Cannot find square root');\n return rt;\n}\nfunction invert(number, modulo = CURVE.P) {\n if (number === _0n || modulo <= _0n) {\n throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);\n }\n let a = mod(number, modulo);\n let b = modulo;\n let x = _0n, y = _1n, u = _1n, v = _0n;\n while (a !== _0n) {\n const q = b / a;\n const r = b % a;\n const m = x - u * q;\n const n = y - v * q;\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n const gcd = b;\n if (gcd !== _1n)\n throw new Error('invert: does not exist');\n return mod(x, modulo);\n}\nfunction invertBatch(nums, p = CURVE.P) {\n const scratch = new Array(nums.length);\n const lastMultiplied = nums.reduce((acc, num, i) => {\n if (num === _0n)\n return acc;\n scratch[i] = acc;\n return mod(acc * num, p);\n }, _1n);\n const inverted = invert(lastMultiplied, p);\n nums.reduceRight((acc, num, i) => {\n if (num === _0n)\n return acc;\n scratch[i] = mod(acc * scratch[i], p);\n return mod(acc * num, p);\n }, inverted);\n return scratch;\n}\nfunction bits2int_2(bytes) {\n const delta = bytes.length * 8 - groupLen * 8;\n const num = bytesToNumber(bytes);\n return delta > 0 ? num >> BigInt(delta) : num;\n}\nfunction truncateHash(hash, truncateOnly = false) {\n const h = bits2int_2(hash);\n if (truncateOnly)\n return h;\n const { n } = CURVE;\n return h >= n ? h - n : h;\n}\nlet _sha256Sync;\nlet _hmacSha256Sync;\nclass HmacDrbg {\n constructor(hashLen, qByteLen) {\n this.hashLen = hashLen;\n this.qByteLen = qByteLen;\n if (typeof hashLen !== 'number' || hashLen < 2)\n throw new Error('hashLen must be a number');\n if (typeof qByteLen !== 'number' || qByteLen < 2)\n throw new Error('qByteLen must be a number');\n this.v = new Uint8Array(hashLen).fill(1);\n this.k = new Uint8Array(hashLen).fill(0);\n this.counter = 0;\n }\n hmac(...values) {\n return utils.hmacSha256(this.k, ...values);\n }\n hmacSync(...values) {\n return _hmacSha256Sync(this.k, ...values);\n }\n checkSync() {\n if (typeof _hmacSha256Sync !== 'function')\n throw new ShaError('hmacSha256Sync needs to be set');\n }\n incr() {\n if (this.counter >= 1000)\n throw new Error('Tried 1,000 k values for sign(), all were invalid');\n this.counter += 1;\n }\n async reseed(seed = new Uint8Array()) {\n this.k = await this.hmac(this.v, Uint8Array.from([0x00]), seed);\n this.v = await this.hmac(this.v);\n if (seed.length === 0)\n return;\n this.k = await this.hmac(this.v, Uint8Array.from([0x01]), seed);\n this.v = await this.hmac(this.v);\n }\n reseedSync(seed = new Uint8Array()) {\n this.checkSync();\n this.k = this.hmacSync(this.v, Uint8Array.from([0x00]), seed);\n this.v = this.hmacSync(this.v);\n if (seed.length === 0)\n return;\n this.k = this.hmacSync(this.v, Uint8Array.from([0x01]), seed);\n this.v = this.hmacSync(this.v);\n }\n async generate() {\n this.incr();\n let len = 0;\n const out = [];\n while (len < this.qByteLen) {\n this.v = await this.hmac(this.v);\n const sl = this.v.slice();\n out.push(sl);\n len += this.v.length;\n }\n return concatBytes(...out);\n }\n generateSync() {\n this.checkSync();\n this.incr();\n let len = 0;\n const out = [];\n while (len < this.qByteLen) {\n this.v = this.hmacSync(this.v);\n const sl = this.v.slice();\n out.push(sl);\n len += this.v.length;\n }\n return concatBytes(...out);\n }\n}\nfunction isWithinCurveOrder(num) {\n return _0n < num && num < CURVE.n;\n}\nfunction isValidFieldElement(num) {\n return _0n < num && num < CURVE.P;\n}\nfunction kmdToSig(kBytes, m, d, lowS = true) {\n const { n } = CURVE;\n const k = truncateHash(kBytes, true);\n if (!isWithinCurveOrder(k))\n return;\n const kinv = invert(k, n);\n const q = Point.BASE.multiply(k);\n const r = mod(q.x, n);\n if (r === _0n)\n return;\n const s = mod(kinv * mod(m + d * r, n), n);\n if (s === _0n)\n return;\n let sig = new Signature(r, s);\n let recovery = (q.x === sig.r ? 0 : 2) | Number(q.y & _1n);\n if (lowS && sig.hasHighS()) {\n sig = sig.normalizeS();\n recovery ^= 1;\n }\n return { sig, recovery };\n}\nfunction normalizePrivateKey(key) {\n let num;\n if (typeof key === 'bigint') {\n num = key;\n }\n else if (typeof key === 'number' && Number.isSafeInteger(key) && key > 0) {\n num = BigInt(key);\n }\n else if (typeof key === 'string') {\n if (key.length !== 2 * groupLen)\n throw new Error('Expected 32 bytes of private key');\n num = hexToNumber(key);\n }\n else if (key instanceof Uint8Array) {\n if (key.length !== groupLen)\n throw new Error('Expected 32 bytes of private key');\n num = bytesToNumber(key);\n }\n else {\n throw new TypeError('Expected valid private key');\n }\n if (!isWithinCurveOrder(num))\n throw new Error('Expected private key: 0 < key < n');\n return num;\n}\nfunction normalizePublicKey(publicKey) {\n if (publicKey instanceof Point) {\n publicKey.assertValidity();\n return publicKey;\n }\n else {\n return Point.fromHex(publicKey);\n }\n}\nfunction normalizeSignature(signature) {\n if (signature instanceof Signature) {\n signature.assertValidity();\n return signature;\n }\n try {\n return Signature.fromDER(signature);\n }\n catch (error) {\n return Signature.fromCompact(signature);\n }\n}\nfunction getPublicKey(privateKey, isCompressed = false) {\n return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);\n}\nfunction recoverPublicKey(msgHash, signature, recovery, isCompressed = false) {\n return Point.fromSignature(msgHash, signature, recovery).toRawBytes(isCompressed);\n}\nfunction isProbPub(item) {\n const arr = item instanceof Uint8Array;\n const str = typeof item === 'string';\n const len = (arr || str) && item.length;\n if (arr)\n return len === compressedLen || len === uncompressedLen;\n if (str)\n return len === compressedLen * 2 || len === uncompressedLen * 2;\n if (item instanceof Point)\n return true;\n return false;\n}\nfunction getSharedSecret(privateA, publicB, isCompressed = false) {\n if (isProbPub(privateA))\n throw new TypeError('getSharedSecret: first arg must be private key');\n if (!isProbPub(publicB))\n throw new TypeError('getSharedSecret: second arg must be public key');\n const b = normalizePublicKey(publicB);\n b.assertValidity();\n return b.multiply(normalizePrivateKey(privateA)).toRawBytes(isCompressed);\n}\nfunction bits2int(bytes) {\n const slice = bytes.length > fieldLen ? bytes.slice(0, fieldLen) : bytes;\n return bytesToNumber(slice);\n}\nfunction bits2octets(bytes) {\n const z1 = bits2int(bytes);\n const z2 = mod(z1, CURVE.n);\n return int2octets(z2 < _0n ? z1 : z2);\n}\nfunction int2octets(num) {\n return numTo32b(num);\n}\nfunction initSigArgs(msgHash, privateKey, extraEntropy) {\n if (msgHash == null)\n throw new Error(`sign: expected valid message hash, not \"${msgHash}\"`);\n const h1 = ensureBytes(msgHash);\n const d = normalizePrivateKey(privateKey);\n const seedArgs = [int2octets(d), bits2octets(h1)];\n if (extraEntropy != null) {\n if (extraEntropy === true)\n extraEntropy = utils.randomBytes(fieldLen);\n const e = ensureBytes(extraEntropy);\n if (e.length !== fieldLen)\n throw new Error(`sign: Expected ${fieldLen} bytes of extra data`);\n seedArgs.push(e);\n }\n const seed = concatBytes(...seedArgs);\n const m = bits2int(h1);\n return { seed, m, d };\n}\nfunction finalizeSig(recSig, opts) {\n const { sig, recovery } = recSig;\n const { der, recovered } = Object.assign({ canonical: true, der: true }, opts);\n const hashed = der ? sig.toDERRawBytes() : sig.toCompactRawBytes();\n return recovered ? [hashed, recovery] : hashed;\n}\nasync function sign(msgHash, privKey, opts = {}) {\n const { seed, m, d } = initSigArgs(msgHash, privKey, opts.extraEntropy);\n const drbg = new HmacDrbg(hashLen, groupLen);\n await drbg.reseed(seed);\n let sig;\n while (!(sig = kmdToSig(await drbg.generate(), m, d, opts.canonical)))\n await drbg.reseed();\n return finalizeSig(sig, opts);\n}\nfunction signSync(msgHash, privKey, opts = {}) {\n const { seed, m, d } = initSigArgs(msgHash, privKey, opts.extraEntropy);\n const drbg = new HmacDrbg(hashLen, groupLen);\n drbg.reseedSync(seed);\n let sig;\n while (!(sig = kmdToSig(drbg.generateSync(), m, d, opts.canonical)))\n drbg.reseedSync();\n return finalizeSig(sig, opts);\n}\n\nconst vopts = { strict: true };\nfunction verify(signature, msgHash, publicKey, opts = vopts) {\n let sig;\n try {\n sig = normalizeSignature(signature);\n msgHash = ensureBytes(msgHash);\n }\n catch (error) {\n return false;\n }\n const { r, s } = sig;\n if (opts.strict && sig.hasHighS())\n return false;\n const h = truncateHash(msgHash);\n let P;\n try {\n P = normalizePublicKey(publicKey);\n }\n catch (error) {\n return false;\n }\n const { n } = CURVE;\n const sinv = invert(s, n);\n const u1 = mod(h * sinv, n);\n const u2 = mod(r * sinv, n);\n const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2);\n if (!R)\n return false;\n const v = mod(R.x, n);\n return v === r;\n}\nfunction schnorrChallengeFinalize(ch) {\n return mod(bytesToNumber(ch), CURVE.n);\n}\nclass SchnorrSignature {\n constructor(r, s) {\n this.r = r;\n this.s = s;\n this.assertValidity();\n }\n static fromHex(hex) {\n const bytes = ensureBytes(hex);\n if (bytes.length !== 64)\n throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${bytes.length}`);\n const r = bytesToNumber(bytes.subarray(0, 32));\n const s = bytesToNumber(bytes.subarray(32, 64));\n return new SchnorrSignature(r, s);\n }\n assertValidity() {\n const { r, s } = this;\n if (!isValidFieldElement(r) || !isWithinCurveOrder(s))\n throw new Error('Invalid signature');\n }\n toHex() {\n return numTo32bStr(this.r) + numTo32bStr(this.s);\n }\n toRawBytes() {\n return hexToBytes(this.toHex());\n }\n}\nfunction schnorrGetPublicKey(privateKey) {\n return Point.fromPrivateKey(privateKey).toRawX();\n}\nclass InternalSchnorrSignature {\n constructor(message, privateKey, auxRand = utils.randomBytes()) {\n if (message == null)\n throw new TypeError(`sign: Expected valid message, not \"${message}\"`);\n this.m = ensureBytes(message);\n const { x, scalar } = this.getScalar(normalizePrivateKey(privateKey));\n this.px = x;\n this.d = scalar;\n this.rand = ensureBytes(auxRand);\n if (this.rand.length !== 32)\n throw new TypeError('sign: Expected 32 bytes of aux randomness');\n }\n getScalar(priv) {\n const point = Point.fromPrivateKey(priv);\n const scalar = point.hasEvenY() ? priv : CURVE.n - priv;\n return { point, scalar, x: point.toRawX() };\n }\n initNonce(d, t0h) {\n return numTo32b(d ^ bytesToNumber(t0h));\n }\n finalizeNonce(k0h) {\n const k0 = mod(bytesToNumber(k0h), CURVE.n);\n if (k0 === _0n)\n throw new Error('sign: Creation of signature failed. k is zero');\n const { point: R, x: rx, scalar: k } = this.getScalar(k0);\n return { R, rx, k };\n }\n finalizeSig(R, k, e, d) {\n return new SchnorrSignature(R.x, mod(k + e * d, CURVE.n)).toRawBytes();\n }\n error() {\n throw new Error('sign: Invalid signature produced');\n }\n async calc() {\n const { m, d, px, rand } = this;\n const tag = utils.taggedHash;\n const t = this.initNonce(d, await tag(TAGS.aux, rand));\n const { R, rx, k } = this.finalizeNonce(await tag(TAGS.nonce, t, px, m));\n const e = schnorrChallengeFinalize(await tag(TAGS.challenge, rx, px, m));\n const sig = this.finalizeSig(R, k, e, d);\n if (!(await schnorrVerify(sig, m, px)))\n this.error();\n return sig;\n }\n calcSync() {\n const { m, d, px, rand } = this;\n const tag = utils.taggedHashSync;\n const t = this.initNonce(d, tag(TAGS.aux, rand));\n const { R, rx, k } = this.finalizeNonce(tag(TAGS.nonce, t, px, m));\n const e = schnorrChallengeFinalize(tag(TAGS.challenge, rx, px, m));\n const sig = this.finalizeSig(R, k, e, d);\n if (!schnorrVerifySync(sig, m, px))\n this.error();\n return sig;\n }\n}\nasync function schnorrSign(msg, privKey, auxRand) {\n return new InternalSchnorrSignature(msg, privKey, auxRand).calc();\n}\nfunction schnorrSignSync(msg, privKey, auxRand) {\n return new InternalSchnorrSignature(msg, privKey, auxRand).calcSync();\n}\nfunction initSchnorrVerify(signature, message, publicKey) {\n const raw = signature instanceof SchnorrSignature;\n const sig = raw ? signature : SchnorrSignature.fromHex(signature);\n if (raw)\n sig.assertValidity();\n return {\n ...sig,\n m: ensureBytes(message),\n P: normalizePublicKey(publicKey),\n };\n}\nfunction finalizeSchnorrVerify(r, P, s, e) {\n const R = Point.BASE.multiplyAndAddUnsafe(P, normalizePrivateKey(s), mod(-e, CURVE.n));\n if (!R || !R.hasEvenY() || R.x !== r)\n return false;\n return true;\n}\nasync function schnorrVerify(signature, message, publicKey) {\n try {\n const { r, s, m, P } = initSchnorrVerify(signature, message, publicKey);\n const e = schnorrChallengeFinalize(await utils.taggedHash(TAGS.challenge, numTo32b(r), P.toRawX(), m));\n return finalizeSchnorrVerify(r, P, s, e);\n }\n catch (error) {\n return false;\n }\n}\nfunction schnorrVerifySync(signature, message, publicKey) {\n try {\n const { r, s, m, P } = initSchnorrVerify(signature, message, publicKey);\n const e = schnorrChallengeFinalize(utils.taggedHashSync(TAGS.challenge, numTo32b(r), P.toRawX(), m));\n return finalizeSchnorrVerify(r, P, s, e);\n }\n catch (error) {\n if (error instanceof ShaError)\n throw error;\n return false;\n }\n}\nconst schnorr = {\n Signature: SchnorrSignature,\n getPublicKey: schnorrGetPublicKey,\n sign: schnorrSign,\n verify: schnorrVerify,\n signSync: schnorrSignSync,\n verifySync: schnorrVerifySync,\n};\nPoint.BASE._setWindowSize(8);\nconst crypto = {\n node: /*#__PURE__*/ (crypto__WEBPACK_IMPORTED_MODULE_0___namespace_cache || (crypto__WEBPACK_IMPORTED_MODULE_0___namespace_cache = __webpack_require__.t(crypto__WEBPACK_IMPORTED_MODULE_0__, 2))),\n web: typeof self === 'object' && 'crypto' in self ? self.crypto : undefined,\n};\nconst TAGS = {\n challenge: 'BIP0340/challenge',\n aux: 'BIP0340/aux',\n nonce: 'BIP0340/nonce',\n};\nconst TAGGED_HASH_PREFIXES = {};\nconst utils = {\n bytesToHex,\n hexToBytes,\n concatBytes,\n mod,\n invert,\n isValidPrivateKey(privateKey) {\n try {\n normalizePrivateKey(privateKey);\n return true;\n }\n catch (error) {\n return false;\n }\n },\n _bigintTo32Bytes: numTo32b,\n _normalizePrivateKey: normalizePrivateKey,\n hashToPrivateKey: (hash) => {\n hash = ensureBytes(hash);\n const minLen = groupLen + 8;\n if (hash.length < minLen || hash.length > 1024) {\n throw new Error(`Expected valid bytes of private key as per FIPS 186`);\n }\n const num = mod(bytesToNumber(hash), CURVE.n - _1n) + _1n;\n return numTo32b(num);\n },\n randomBytes: (bytesLength = 32) => {\n if (crypto.web) {\n return crypto.web.getRandomValues(new Uint8Array(bytesLength));\n }\n else if (crypto.node) {\n const { randomBytes } = crypto.node;\n return Uint8Array.from(randomBytes(bytesLength));\n }\n else {\n throw new Error(\"The environment doesn't have randomBytes function\");\n }\n },\n randomPrivateKey: () => utils.hashToPrivateKey(utils.randomBytes(groupLen + 8)),\n precompute(windowSize = 8, point = Point.BASE) {\n const cached = point === Point.BASE ? point : new Point(point.x, point.y);\n cached._setWindowSize(windowSize);\n cached.multiply(_3n);\n return cached;\n },\n sha256: async (...messages) => {\n if (crypto.web) {\n const buffer = await crypto.web.subtle.digest('SHA-256', concatBytes(...messages));\n return new Uint8Array(buffer);\n }\n else if (crypto.node) {\n const { createHash } = crypto.node;\n const hash = createHash('sha256');\n messages.forEach((m) => hash.update(m));\n return Uint8Array.from(hash.digest());\n }\n else {\n throw new Error(\"The environment doesn't have sha256 function\");\n }\n },\n hmacSha256: async (key, ...messages) => {\n if (crypto.web) {\n const ckey = await crypto.web.subtle.importKey('raw', key, { name: 'HMAC', hash: { name: 'SHA-256' } }, false, ['sign']);\n const message = concatBytes(...messages);\n const buffer = await crypto.web.subtle.sign('HMAC', ckey, message);\n return new Uint8Array(buffer);\n }\n else if (crypto.node) {\n const { createHmac } = crypto.node;\n const hash = createHmac('sha256', key);\n messages.forEach((m) => hash.update(m));\n return Uint8Array.from(hash.digest());\n }\n else {\n throw new Error(\"The environment doesn't have hmac-sha256 function\");\n }\n },\n sha256Sync: undefined,\n hmacSha256Sync: undefined,\n taggedHash: async (tag, ...messages) => {\n let tagP = TAGGED_HASH_PREFIXES[tag];\n if (tagP === undefined) {\n const tagH = await utils.sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0)));\n tagP = concatBytes(tagH, tagH);\n TAGGED_HASH_PREFIXES[tag] = tagP;\n }\n return utils.sha256(tagP, ...messages);\n },\n taggedHashSync: (tag, ...messages) => {\n if (typeof _sha256Sync !== 'function')\n throw new ShaError('sha256Sync is undefined, you need to set it');\n let tagP = TAGGED_HASH_PREFIXES[tag];\n if (tagP === undefined) {\n const tagH = _sha256Sync(Uint8Array.from(tag, (c) => c.charCodeAt(0)));\n tagP = concatBytes(tagH, tagH);\n TAGGED_HASH_PREFIXES[tag] = tagP;\n }\n return _sha256Sync(tagP, ...messages);\n },\n _JacobianPoint: JacobianPoint,\n};\nObject.defineProperties(utils, {\n sha256Sync: {\n configurable: false,\n get() {\n return _sha256Sync;\n },\n set(val) {\n if (!_sha256Sync)\n _sha256Sync = val;\n },\n },\n hmacSha256Sync: {\n configurable: false,\n get() {\n return _hmacSha256Sync;\n },\n set(val) {\n if (!_hmacSha256Sync)\n _hmacSha256Sync = val;\n },\n },\n});\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@noble/secp256k1/lib/esm/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/dist/lib/message/version_0.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/@waku/core/dist/lib/message/version_0.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DecodedMessage: () => (/* binding */ DecodedMessage),\n/* harmony export */ Decoder: () => (/* binding */ Decoder),\n/* harmony export */ Encoder: () => (/* binding */ Encoder),\n/* harmony export */ Version: () => (/* binding */ Version),\n/* harmony export */ createDecoder: () => (/* binding */ createDecoder),\n/* harmony export */ createEncoder: () => (/* binding */ createEncoder),\n/* harmony export */ proto: () => (/* reexport safe */ _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_message)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/index.js\");\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_1__.Logger(\"message:version-0\");\nconst OneMillion = BigInt(1_000_000);\nconst Version = 0;\n\nclass DecodedMessage {\n pubsubTopic;\n proto;\n constructor(pubsubTopic, proto) {\n this.pubsubTopic = pubsubTopic;\n this.proto = proto;\n }\n get ephemeral() {\n return Boolean(this.proto.ephemeral);\n }\n get payload() {\n return this.proto.payload;\n }\n get contentTopic() {\n return this.proto.contentTopic;\n }\n get _rawTimestamp() {\n return this.proto.timestamp;\n }\n get timestamp() {\n // In the case we receive a value that is bigger than JS's max number,\n // we catch the error and return undefined.\n try {\n if (this.proto.timestamp) {\n // nanoseconds 10^-9 to milliseconds 10^-3\n const timestamp = this.proto.timestamp / OneMillion;\n return new Date(Number(timestamp));\n }\n return;\n }\n catch (e) {\n return;\n }\n }\n get meta() {\n return this.proto.meta;\n }\n get version() {\n // https://rfc.vac.dev/spec/14/\n // > If omitted, the value SHOULD be interpreted as version 0.\n return this.proto.version ?? 0;\n }\n get rateLimitProof() {\n return this.proto.rateLimitProof;\n }\n}\nclass Encoder {\n contentTopic;\n ephemeral;\n pubsubTopic;\n metaSetter;\n constructor(contentTopic, ephemeral = false, pubsubTopic, metaSetter) {\n this.contentTopic = contentTopic;\n this.ephemeral = ephemeral;\n this.pubsubTopic = pubsubTopic;\n this.metaSetter = metaSetter;\n if (!contentTopic || contentTopic === \"\") {\n throw new Error(\"Content topic must be specified\");\n }\n }\n async toWire(message) {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_message.WakuMessage.encode(await this.toProtoObj(message));\n }\n async toProtoObj(message) {\n const timestamp = message.timestamp ?? new Date();\n const protoMessage = {\n payload: message.payload,\n version: Version,\n contentTopic: this.contentTopic,\n timestamp: BigInt(timestamp.valueOf()) * OneMillion,\n meta: undefined,\n rateLimitProof: message.rateLimitProof,\n ephemeral: this.ephemeral\n };\n if (this.metaSetter) {\n const meta = this.metaSetter(protoMessage);\n return { ...protoMessage, meta };\n }\n return protoMessage;\n }\n}\n/**\n * Creates an encoder that encode messages without Waku level encryption or signature.\n *\n * An encoder is used to encode messages in the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)\n * format to be sent over the Waku network. The resulting encoder can then be\n * pass to { @link @waku/interfaces!ISender.send } to automatically encode outgoing\n * messages.\n */\nfunction createEncoder({ pubsubTopic, pubsubTopicShardInfo, contentTopic, ephemeral, metaSetter }) {\n return new Encoder(contentTopic, ephemeral, (0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.determinePubsubTopic)(contentTopic, pubsubTopic ?? pubsubTopicShardInfo), metaSetter);\n}\nclass Decoder {\n pubsubTopic;\n contentTopic;\n constructor(pubsubTopic, contentTopic) {\n this.pubsubTopic = pubsubTopic;\n this.contentTopic = contentTopic;\n if (!contentTopic || contentTopic === \"\") {\n throw new Error(\"Content topic must be specified\");\n }\n }\n fromWireToProtoObj(bytes) {\n const protoMessage = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_message.WakuMessage.decode(bytes);\n return Promise.resolve({\n payload: protoMessage.payload,\n contentTopic: protoMessage.contentTopic,\n version: protoMessage.version ?? undefined,\n timestamp: protoMessage.timestamp ?? undefined,\n meta: protoMessage.meta ?? undefined,\n rateLimitProof: protoMessage.rateLimitProof ?? undefined,\n ephemeral: protoMessage.ephemeral ?? false\n });\n }\n async fromProtoObj(pubsubTopic, proto) {\n // https://rfc.vac.dev/spec/14/\n // > If omitted, the value SHOULD be interpreted as version 0.\n if (proto.version ?? 0 !== Version) {\n log.error(\"Failed to decode due to incorrect version, expected:\", Version, \", actual:\", proto.version);\n return Promise.resolve(undefined);\n }\n return new DecodedMessage(pubsubTopic, proto);\n }\n}\n/**\n * Creates a decoder that decode messages without Waku level encryption.\n *\n * A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)\n * format when received from the Waku network. The resulting decoder can then be\n * pass to { @link @waku/interfaces!IReceiver.subscribe } to automatically decode incoming\n * messages.\n *\n * @param contentTopic The resulting decoder will only decode messages with this content topic.\n */\nfunction createDecoder(contentTopic, pubsubTopicShardInfo) {\n return new Decoder((0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.determinePubsubTopic)(contentTopic, pubsubTopicShardInfo), contentTopic);\n}\n//# sourceMappingURL=version_0.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/dist/lib/message/version_0.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/connection_manager.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/connection_manager.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EConnectionStateEvents: () => (/* binding */ EConnectionStateEvents),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* binding */ EPeersByDiscoveryEvents),\n/* harmony export */ Tags: () => (/* binding */ Tags)\n/* harmony export */ });\nvar Tags;\n(function (Tags) {\n Tags[\"BOOTSTRAP\"] = \"bootstrap\";\n Tags[\"PEER_EXCHANGE\"] = \"peer-exchange\";\n Tags[\"LOCAL\"] = \"local-peer-cache\";\n})(Tags || (Tags = {}));\nvar EPeersByDiscoveryEvents;\n(function (EPeersByDiscoveryEvents) {\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_BOOTSTRAP\"] = \"peer:discovery:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_PEER_EXCHANGE\"] = \"peer:discovery:peer-exchange\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_BOOTSTRAP\"] = \"peer:connected:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_PEER_EXCHANGE\"] = \"peer:connected:peer-exchange\";\n})(EPeersByDiscoveryEvents || (EPeersByDiscoveryEvents = {}));\nvar EConnectionStateEvents;\n(function (EConnectionStateEvents) {\n EConnectionStateEvents[\"CONNECTION_STATUS\"] = \"waku:connection\";\n})(EConnectionStateEvents || (EConnectionStateEvents = {}));\n//# sourceMappingURL=connection_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/connection_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/constants.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/constants.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_CLUSTER_ID: () => (/* binding */ DEFAULT_CLUSTER_ID),\n/* harmony export */ DefaultPubsubTopic: () => (/* binding */ DefaultPubsubTopic)\n/* harmony export */ });\n/**\n * DefaultPubsubTopic is the default gossipsub topic to use for Waku.\n */\nconst DefaultPubsubTopic = \"/waku/2/default-waku/proto\";\n/**\n * The default cluster ID for The Waku Network\n */\nconst DEFAULT_CLUSTER_ID = 1;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/dns_discovery.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/dns_discovery.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=dns_discovery.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/dns_discovery.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/enr.js":
|
||
/*!***************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/enr.js ***!
|
||
\***************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=enr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/enr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/filter.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/filter.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=filter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/filter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/index.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/index.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_CLUSTER_ID: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_17__.DEFAULT_CLUSTER_ID),\n/* harmony export */ DefaultPubsubTopic: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_17__.DefaultPubsubTopic),\n/* harmony export */ EConnectionStateEvents: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.EConnectionStateEvents),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.EPeersByDiscoveryEvents),\n/* harmony export */ PageDirection: () => (/* reexport safe */ _store_js__WEBPACK_IMPORTED_MODULE_7__.PageDirection),\n/* harmony export */ ProtocolError: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.ProtocolError),\n/* harmony export */ Protocols: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.Protocols),\n/* harmony export */ Tags: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.Tags)\n/* harmony export */ });\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/enr.js\");\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filter.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/filter.js\");\n/* harmony import */ var _light_push_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./light_push.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/light_push.js\");\n/* harmony import */ var _message_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/message.js\");\n/* harmony import */ var _peer_exchange_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer_exchange.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/peer_exchange.js\");\n/* harmony import */ var _protocols_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./protocols.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/protocols.js\");\n/* harmony import */ var _relay_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./relay.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/relay.js\");\n/* harmony import */ var _store_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./store.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/store.js\");\n/* harmony import */ var _waku_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./waku.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/waku.js\");\n/* harmony import */ var _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./connection_manager.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/connection_manager.js\");\n/* harmony import */ var _sender_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sender.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/sender.js\");\n/* harmony import */ var _receiver_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./receiver.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/receiver.js\");\n/* harmony import */ var _misc_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./misc.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/misc.js\");\n/* harmony import */ var _libp2p_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./libp2p.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/libp2p.js\");\n/* harmony import */ var _keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./keep_alive_manager.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/keep_alive_manager.js\");\n/* harmony import */ var _dns_discovery_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./dns_discovery.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/dns_discovery.js\");\n/* harmony import */ var _metadata_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./metadata.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/metadata.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/constants.js\");\n/* harmony import */ var _local_storage_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./local_storage.js */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/local_storage.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/keep_alive_manager.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/keep_alive_manager.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=keep_alive_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/keep_alive_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/libp2p.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/libp2p.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=libp2p.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/libp2p.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/light_push.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/light_push.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/light_push.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/local_storage.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/local_storage.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=local_storage.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/local_storage.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/message.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/message.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/metadata.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/metadata.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=metadata.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/metadata.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/misc.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/misc.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=misc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/misc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/peer_exchange.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/peer_exchange.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=peer_exchange.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/peer_exchange.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/protocols.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/protocols.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ProtocolError: () => (/* binding */ ProtocolError),\n/* harmony export */ Protocols: () => (/* binding */ Protocols)\n/* harmony export */ });\nvar Protocols;\n(function (Protocols) {\n Protocols[\"Relay\"] = \"relay\";\n Protocols[\"Store\"] = \"store\";\n Protocols[\"LightPush\"] = \"lightpush\";\n Protocols[\"Filter\"] = \"filter\";\n})(Protocols || (Protocols = {}));\nvar ProtocolError;\n(function (ProtocolError) {\n /** Could not determine the origin of the fault. Best to check connectivity and try again */\n ProtocolError[\"GENERIC_FAIL\"] = \"Generic error\";\n /**\n * Failure to protobuf encode the message. This is not recoverable and needs\n * further investigation.\n */\n ProtocolError[\"ENCODE_FAILED\"] = \"Failed to encode\";\n /**\n * Failure to protobuf decode the message. May be due to a remote peer issue,\n * ensuring that messages are sent via several peer enable mitigation of this error.\n */\n ProtocolError[\"DECODE_FAILED\"] = \"Failed to decode\";\n /**\n * The message payload is empty, making the message invalid. Ensure that a non-empty\n * payload is set on the outgoing message.\n */\n ProtocolError[\"EMPTY_PAYLOAD\"] = \"Payload is empty\";\n /**\n * The message size is above the maximum message size allowed on the Waku Network.\n * Compressing the message or using an alternative strategy for large messages is recommended.\n */\n ProtocolError[\"SIZE_TOO_BIG\"] = \"Size is too big\";\n /**\n * The PubsubTopic passed to the send function is not configured on the Waku node.\n * Please ensure that the PubsubTopic is used when initializing the Waku node.\n */\n ProtocolError[\"TOPIC_NOT_CONFIGURED\"] = \"Topic not configured\";\n /**\n * Failure to find a peer with suitable protocols. This may due to a connection issue.\n * Mitigation can be: retrying after a given time period, display connectivity issue\n * to user or listening for `peer:connected:bootstrap` or `peer:connected:peer-exchange`\n * on the connection manager before retrying.\n */\n ProtocolError[\"NO_PEER_AVAILABLE\"] = \"No peer available\";\n /**\n * The remote peer did not behave as expected. Mitigation for `NO_PEER_AVAILABLE`\n * or `DECODE_FAILED` can be used.\n */\n ProtocolError[\"REMOTE_PEER_FAULT\"] = \"Remote peer fault\";\n /**\n * The remote peer rejected the message. Information provided by the remote peer\n * is logged. Review message validity, or mitigation for `NO_PEER_AVAILABLE`\n * or `DECODE_FAILED` can be used.\n */\n ProtocolError[\"REMOTE_PEER_REJECTED\"] = \"Remote peer rejected\";\n /**\n * The protocol request timed out without a response. This may be due to a connection issue.\n * Mitigation can be: retrying after a given time period\n */\n ProtocolError[\"REQUEST_TIMEOUT\"] = \"Request timeout\";\n})(ProtocolError || (ProtocolError = {}));\n//# sourceMappingURL=protocols.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/protocols.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/receiver.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/receiver.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=receiver.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/receiver.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/relay.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/relay.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=relay.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/relay.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/sender.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/sender.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=sender.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/sender.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/store.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/store.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PageDirection: () => (/* binding */ PageDirection)\n/* harmony export */ });\nvar PageDirection;\n(function (PageDirection) {\n PageDirection[\"BACKWARD\"] = \"backward\";\n PageDirection[\"FORWARD\"] = \"forward\";\n})(PageDirection || (PageDirection = {}));\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/store.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/interfaces/dist/waku.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/interfaces/dist/waku.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=waku.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/interfaces/dist/waku.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/bytes/index.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/bytes/index.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex),\n/* harmony export */ bytesToUtf8: () => (/* binding */ bytesToUtf8),\n/* harmony export */ concat: () => (/* binding */ concat),\n/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes),\n/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@waku/core/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@waku/core/node_modules/uint8arrays/dist/src/to-string.js\");\n\n\n/**\n * Convert input to a byte array.\n *\n * Handles both `0x` prefixed and non-prefixed strings.\n */\nfunction hexToBytes(hex) {\n if (typeof hex === \"string\") {\n const _hex = hex.replace(/^0x/i, \"\");\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(_hex.toLowerCase(), \"base16\");\n }\n return hex;\n}\n/**\n * Convert byte array to hex string (no `0x` prefix).\n */\nconst bytesToHex = (bytes) => (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(bytes, \"base16\");\n/**\n * Decode byte array to utf-8 string.\n */\nconst bytesToUtf8 = (b) => (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(b, \"utf8\");\n/**\n * Encode utf-8 string to byte array.\n */\nconst utf8ToBytes = (s) => (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(s, \"utf8\");\n/**\n * Concatenate using Uint8Arrays as `Buffer` has a different behavior with `DataView`\n */\nfunction concat(byteArrays, totalLength) {\n const len = totalLength ?? byteArrays.reduce((acc, curr) => acc + curr.length, 0);\n const res = new Uint8Array(len);\n let offset = 0;\n for (const bytes of byteArrays) {\n res.set(bytes, offset);\n offset += bytes.length;\n }\n return res;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/bytes/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/common/group_by.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/common/group_by.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ groupByContentTopic: () => (/* binding */ groupByContentTopic)\n/* harmony export */ });\nfunction groupByContentTopic(values) {\n const groupedDecoders = new Map();\n values.forEach((value) => {\n let decs = groupedDecoders.get(value.contentTopic);\n if (!decs) {\n groupedDecoders.set(value.contentTopic, []);\n decs = groupedDecoders.get(value.contentTopic);\n }\n decs.push(value);\n });\n return groupedDecoders;\n}\n//# sourceMappingURL=group_by.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/common/group_by.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/common/index.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/common/index.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ contentTopicToPubsubTopic: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.contentTopicToPubsubTopic),\n/* harmony export */ contentTopicToShardIndex: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.contentTopicToShardIndex),\n/* harmony export */ contentTopicsByPubsubTopic: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.contentTopicsByPubsubTopic),\n/* harmony export */ decodeRelayShard: () => (/* reexport safe */ _relay_shard_codec_js__WEBPACK_IMPORTED_MODULE_7__.decodeRelayShard),\n/* harmony export */ determinePubsubTopic: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.determinePubsubTopic),\n/* harmony export */ encodeRelayShard: () => (/* reexport safe */ _relay_shard_codec_js__WEBPACK_IMPORTED_MODULE_7__.encodeRelayShard),\n/* harmony export */ ensurePubsubTopicIsConfigured: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.ensurePubsubTopicIsConfigured),\n/* harmony export */ ensureShardingConfigured: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.ensureShardingConfigured),\n/* harmony export */ ensureValidContentTopic: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.ensureValidContentTopic),\n/* harmony export */ getPseudoRandomSubset: () => (/* reexport safe */ _random_subset_js__WEBPACK_IMPORTED_MODULE_1__.getPseudoRandomSubset),\n/* harmony export */ getWsMultiaddrFromMultiaddrs: () => (/* binding */ getWsMultiaddrFromMultiaddrs),\n/* harmony export */ groupByContentTopic: () => (/* reexport safe */ _group_by_js__WEBPACK_IMPORTED_MODULE_2__.groupByContentTopic),\n/* harmony export */ isDefined: () => (/* reexport safe */ _is_defined_js__WEBPACK_IMPORTED_MODULE_0__.isDefined),\n/* harmony export */ isMessageSizeUnderCap: () => (/* reexport safe */ _is_size_valid_js__WEBPACK_IMPORTED_MODULE_4__.isMessageSizeUnderCap),\n/* harmony export */ isWireSizeUnderCap: () => (/* reexport safe */ _is_size_valid_js__WEBPACK_IMPORTED_MODULE_4__.isWireSizeUnderCap),\n/* harmony export */ pubsubTopicToSingleShardInfo: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.pubsubTopicToSingleShardInfo),\n/* harmony export */ pushOrInitMapSet: () => (/* reexport safe */ _push_or_init_map_js__WEBPACK_IMPORTED_MODULE_6__.pushOrInitMapSet),\n/* harmony export */ removeItemFromArray: () => (/* binding */ removeItemFromArray),\n/* harmony export */ shardInfoToPubsubTopics: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.shardInfoToPubsubTopics),\n/* harmony export */ singleShardInfoToPubsubTopic: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.singleShardInfoToPubsubTopic),\n/* harmony export */ singleShardInfosToShardInfo: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.singleShardInfosToShardInfo),\n/* harmony export */ toAsyncIterator: () => (/* reexport safe */ _to_async_iterator_js__WEBPACK_IMPORTED_MODULE_3__.toAsyncIterator)\n/* harmony export */ });\n/* harmony import */ var _is_defined_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is_defined.js */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/common/is_defined.js\");\n/* harmony import */ var _random_subset_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./random_subset.js */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/common/random_subset.js\");\n/* harmony import */ var _group_by_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./group_by.js */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/common/group_by.js\");\n/* harmony import */ var _to_async_iterator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./to_async_iterator.js */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/common/to_async_iterator.js\");\n/* harmony import */ var _is_size_valid_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./is_size_valid.js */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/common/is_size_valid.js\");\n/* harmony import */ var _sharding_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./sharding.js */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/common/sharding.js\");\n/* harmony import */ var _push_or_init_map_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./push_or_init_map.js */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/common/push_or_init_map.js\");\n/* harmony import */ var _relay_shard_codec_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./relay_shard_codec.js */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/common/relay_shard_codec.js\");\n\n\n\n\n\n\n\n\nfunction removeItemFromArray(arr, value) {\n const index = arr.indexOf(value);\n if (index > -1) {\n arr.splice(index, 1);\n }\n return arr;\n}\nfunction getWsMultiaddrFromMultiaddrs(addresses) {\n const wsMultiaddr = addresses.find((addr) => addr.toString().includes(\"ws\") || addr.toString().includes(\"wss\"));\n if (!wsMultiaddr) {\n throw new Error(\"No ws multiaddr found in the given addresses\");\n }\n return wsMultiaddr;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/common/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/common/is_defined.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/common/is_defined.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isDefined: () => (/* binding */ isDefined)\n/* harmony export */ });\nfunction isDefined(value) {\n return Boolean(value);\n}\n//# sourceMappingURL=is_defined.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/common/is_defined.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/common/is_size_valid.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/common/is_size_valid.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isMessageSizeUnderCap: () => (/* binding */ isMessageSizeUnderCap),\n/* harmony export */ isWireSizeUnderCap: () => (/* binding */ isWireSizeUnderCap)\n/* harmony export */ });\nconst MB = 1024 ** 2;\nconst SIZE_CAP_IN_MB = 1;\n/**\n * Return whether the size of the message is under the upper limit for the network.\n * This performs a protobuf encoding! If you have access to the fully encoded message,\n * use {@link isSizeUnderCapBuf} instead.\n * @param message\n * @param encoder\n */\nasync function isMessageSizeUnderCap(encoder, message) {\n const buf = await encoder.toWire(message);\n if (!buf)\n return false;\n return isWireSizeUnderCap(buf);\n}\nconst isWireSizeUnderCap = (buf) => buf.length / MB <= SIZE_CAP_IN_MB;\n//# sourceMappingURL=is_size_valid.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/common/is_size_valid.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/common/push_or_init_map.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/common/push_or_init_map.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pushOrInitMapSet: () => (/* binding */ pushOrInitMapSet)\n/* harmony export */ });\nfunction pushOrInitMapSet(map, key, newValue) {\n let arr = map.get(key);\n if (typeof arr === \"undefined\") {\n map.set(key, new Set());\n arr = map.get(key);\n }\n arr.add(newValue);\n}\n//# sourceMappingURL=push_or_init_map.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/common/push_or_init_map.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/common/random_subset.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/common/random_subset.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getPseudoRandomSubset: () => (/* binding */ getPseudoRandomSubset)\n/* harmony export */ });\n/**\n * Return pseudo random subset of the input.\n */\nfunction getPseudoRandomSubset(values, wantedNumber) {\n if (values.length <= wantedNumber || values.length <= 1) {\n return values;\n }\n return shuffle(values).slice(0, wantedNumber);\n}\nfunction shuffle(arr) {\n if (arr.length <= 1) {\n return arr;\n }\n const randInt = () => {\n return Math.floor(Math.random() * Math.floor(arr.length));\n };\n for (let i = 0; i < arr.length; i++) {\n const j = randInt();\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n return arr;\n}\n//# sourceMappingURL=random_subset.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/common/random_subset.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/common/relay_shard_codec.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/common/relay_shard_codec.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeRelayShard: () => (/* binding */ decodeRelayShard),\n/* harmony export */ encodeRelayShard: () => (/* binding */ encodeRelayShard)\n/* harmony export */ });\nconst decodeRelayShard = (bytes) => {\n // explicitly converting to Uint8Array to avoid Buffer\n // https://github.com/libp2p/js-libp2p/issues/2146\n bytes = new Uint8Array(bytes);\n if (bytes.length < 3)\n throw new Error(\"Insufficient data\");\n const view = new DataView(bytes.buffer);\n const clusterId = view.getUint16(0);\n const shards = [];\n if (bytes.length === 130) {\n // rsv format (Bit Vector)\n for (let i = 0; i < 1024; i++) {\n const byteIndex = Math.floor(i / 8) + 2; // Adjusted for the 2-byte cluster field\n const bitIndex = 7 - (i % 8);\n if (view.getUint8(byteIndex) & (1 << bitIndex)) {\n shards.push(i);\n }\n }\n }\n else {\n // rs format (Index List)\n const numIndices = view.getUint8(2);\n for (let i = 0, offset = 3; i < numIndices; i++, offset += 2) {\n if (offset + 1 >= bytes.length)\n throw new Error(\"Unexpected end of data\");\n shards.push(view.getUint16(offset));\n }\n }\n return { clusterId, shards };\n};\nconst encodeRelayShard = (shardInfo) => {\n const { clusterId, shards } = shardInfo;\n const totalLength = shards.length >= 64 ? 130 : 3 + 2 * shards.length;\n const buffer = new ArrayBuffer(totalLength);\n const view = new DataView(buffer);\n view.setUint16(0, clusterId);\n if (shards.length >= 64) {\n // rsv format (Bit Vector)\n for (const index of shards) {\n const byteIndex = Math.floor(index / 8) + 2; // Adjusted for the 2-byte cluster field\n const bitIndex = 7 - (index % 8);\n view.setUint8(byteIndex, view.getUint8(byteIndex) | (1 << bitIndex));\n }\n }\n else {\n // rs format (Index List)\n view.setUint8(2, shards.length);\n for (let i = 0, offset = 3; i < shards.length; i++, offset += 2) {\n view.setUint16(offset, shards[i]);\n }\n }\n return new Uint8Array(buffer);\n};\n//# sourceMappingURL=relay_shard_codec.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/common/relay_shard_codec.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/common/sharding.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/common/sharding.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ contentTopicToPubsubTopic: () => (/* binding */ contentTopicToPubsubTopic),\n/* harmony export */ contentTopicToShardIndex: () => (/* binding */ contentTopicToShardIndex),\n/* harmony export */ contentTopicsByPubsubTopic: () => (/* binding */ contentTopicsByPubsubTopic),\n/* harmony export */ determinePubsubTopic: () => (/* binding */ determinePubsubTopic),\n/* harmony export */ ensurePubsubTopicIsConfigured: () => (/* binding */ ensurePubsubTopicIsConfigured),\n/* harmony export */ ensureShardingConfigured: () => (/* binding */ ensureShardingConfigured),\n/* harmony export */ ensureValidContentTopic: () => (/* binding */ ensureValidContentTopic),\n/* harmony export */ pubsubTopicToSingleShardInfo: () => (/* binding */ pubsubTopicToSingleShardInfo),\n/* harmony export */ shardInfoToPubsubTopics: () => (/* binding */ shardInfoToPubsubTopics),\n/* harmony export */ singleShardInfoToPubsubTopic: () => (/* binding */ singleShardInfoToPubsubTopic),\n/* harmony export */ singleShardInfosToShardInfo: () => (/* binding */ singleShardInfosToShardInfo)\n/* harmony export */ });\n/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/@noble/hashes/esm/sha256.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/core/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _bytes_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bytes/index.js */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/bytes/index.js\");\n\n\n\nconst singleShardInfoToPubsubTopic = (shardInfo) => {\n if (shardInfo.clusterId === undefined || shardInfo.shard === undefined)\n throw new Error(\"Invalid shard\");\n return `/waku/2/rs/${shardInfo.clusterId}/${shardInfo.shard}`;\n};\nconst singleShardInfosToShardInfo = (singleShardInfos) => {\n if (singleShardInfos.length === 0)\n throw new Error(\"Invalid shard\");\n const clusterIds = singleShardInfos.map((shardInfo) => shardInfo.clusterId);\n if (new Set(clusterIds).size !== 1) {\n throw new Error(\"Passed shard infos have different clusterIds\");\n }\n const shards = singleShardInfos\n .map((shardInfo) => shardInfo.shard)\n .filter((shard) => shard !== undefined);\n return {\n clusterId: singleShardInfos[0].clusterId,\n shards\n };\n};\nconst shardInfoToPubsubTopics = (shardInfo) => {\n if (\"contentTopics\" in shardInfo && shardInfo.contentTopics) {\n // Autosharding: explicitly defined content topics\n return Array.from(new Set(shardInfo.contentTopics.map((contentTopic) => contentTopicToPubsubTopic(contentTopic, shardInfo.clusterId))));\n }\n else if (\"shards\" in shardInfo) {\n // Static sharding\n if (shardInfo.shards === undefined)\n throw new Error(\"Invalid shard\");\n return Array.from(new Set(shardInfo.shards.map((index) => `/waku/2/rs/${shardInfo.clusterId ?? _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_CLUSTER_ID}/${index}`)));\n }\n else if (\"application\" in shardInfo && \"version\" in shardInfo) {\n // Autosharding: single shard from application and version\n return [\n contentTopicToPubsubTopic(`/${shardInfo.application}/${shardInfo.version}/default/default`, shardInfo.clusterId)\n ];\n }\n else {\n throw new Error(\"Missing required configuration in shard parameters\");\n }\n};\nconst pubsubTopicToSingleShardInfo = (pubsubTopics) => {\n const parts = pubsubTopics.split(\"/\");\n if (parts.length != 6 ||\n parts[1] !== \"waku\" ||\n parts[2] !== \"2\" ||\n parts[3] !== \"rs\")\n throw new Error(\"Invalid pubsub topic\");\n const clusterId = parseInt(parts[4]);\n const shard = parseInt(parts[5]);\n if (isNaN(clusterId) || isNaN(shard))\n throw new Error(\"Invalid clusterId or shard\");\n return {\n clusterId,\n shard\n };\n};\n//TODO: move part of BaseProtocol instead of utils\n// return `ProtocolError.TOPIC_NOT_CONFIGURED` instead of throwing\nfunction ensurePubsubTopicIsConfigured(pubsubTopic, configuredTopics) {\n if (!configuredTopics.includes(pubsubTopic)) {\n throw new Error(`Pubsub topic ${pubsubTopic} has not been configured on this instance. Configured topics are: ${configuredTopics}. Please update your configuration by passing in the topic during Waku node instantiation.`);\n }\n}\n/**\n * Given a string, will throw an error if it is not formatted as a valid content topic for autosharding based on https://rfc.vac.dev/spec/51/\n * @param contentTopic String to validate\n * @returns Object with each content topic field as an attribute\n */\nfunction ensureValidContentTopic(contentTopic) {\n const parts = contentTopic.split(\"/\");\n if (parts.length < 5 || parts.length > 6) {\n throw Error(\"Content topic format is invalid\");\n }\n // Validate generation field if present\n let generation = 0;\n if (parts.length == 6) {\n generation = parseInt(parts[1]);\n if (isNaN(generation)) {\n throw new Error(\"Invalid generation field in content topic\");\n }\n if (generation > 0) {\n throw new Error(\"Generation greater than 0 is not supported\");\n }\n }\n // Validate remaining fields\n const fields = parts.splice(-4);\n // Validate application field\n if (fields[0].length == 0) {\n throw new Error(\"Application field cannot be empty\");\n }\n // Validate version field\n if (fields[1].length == 0) {\n throw new Error(\"Version field cannot be empty\");\n }\n // Validate topic name field\n if (fields[2].length == 0) {\n throw new Error(\"Topic name field cannot be empty\");\n }\n // Validate encoding field\n if (fields[3].length == 0) {\n throw new Error(\"Encoding field cannot be empty\");\n }\n return {\n generation,\n application: fields[0],\n version: fields[1],\n topicName: fields[2],\n encoding: fields[3]\n };\n}\n/**\n * Given a string, determines which autoshard index to use for its pubsub topic.\n * Based on the algorithm described in the RFC: https://rfc.vac.dev/spec/51//#algorithm\n */\nfunction contentTopicToShardIndex(contentTopic, networkShards = 8) {\n const { application, version } = ensureValidContentTopic(contentTopic);\n const digest = (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_2__.sha256)((0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_1__.concat)([(0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(application), (0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(version)]));\n const dataview = new DataView(digest.buffer.slice(-8));\n return Number(dataview.getBigUint64(0, false) % BigInt(networkShards));\n}\nfunction contentTopicToPubsubTopic(contentTopic, clusterId = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_CLUSTER_ID, networkShards = 8) {\n const shardIndex = contentTopicToShardIndex(contentTopic, networkShards);\n return `/waku/2/rs/${clusterId}/${shardIndex}`;\n}\n/**\n * Given an array of content topics, groups them together by their Pubsub topic as derived using the algorithm for autosharding.\n * If any of the content topics are not properly formatted, the function will throw an error.\n */\nfunction contentTopicsByPubsubTopic(contentTopics, clusterId = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_CLUSTER_ID, networkShards = 8) {\n const groupedContentTopics = new Map();\n for (const contentTopic of contentTopics) {\n const pubsubTopic = contentTopicToPubsubTopic(contentTopic, clusterId, networkShards);\n let topics = groupedContentTopics.get(pubsubTopic);\n if (!topics) {\n groupedContentTopics.set(pubsubTopic, []);\n topics = groupedContentTopics.get(pubsubTopic);\n }\n topics.push(contentTopic);\n }\n return groupedContentTopics;\n}\n/**\n * Used when creating encoders/decoders to determine which pubsub topic to use\n */\nfunction determinePubsubTopic(contentTopic, pubsubTopicShardInfo = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DefaultPubsubTopic) {\n if (typeof pubsubTopicShardInfo == \"string\") {\n return pubsubTopicShardInfo;\n }\n else {\n return pubsubTopicShardInfo\n ? pubsubTopicShardInfo.shard\n ? singleShardInfoToPubsubTopic(pubsubTopicShardInfo)\n : contentTopicToPubsubTopic(contentTopic, pubsubTopicShardInfo.clusterId)\n : _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DefaultPubsubTopic;\n }\n}\n/**\n * Validates sharding configuration and sets defaults where possible.\n * @returns Validated sharding parameters, with any missing values set to defaults\n */\nconst ensureShardingConfigured = (shardInfo) => {\n const clusterId = shardInfo.clusterId ?? _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_CLUSTER_ID;\n const shards = \"shards\" in shardInfo ? shardInfo.shards : [];\n const contentTopics = \"contentTopics\" in shardInfo ? shardInfo.contentTopics : [];\n const [application, version] = \"application\" in shardInfo && \"version\" in shardInfo\n ? [shardInfo.application, shardInfo.version]\n : [undefined, undefined];\n const isShardsConfigured = shards && shards.length > 0;\n const isContentTopicsConfigured = contentTopics && contentTopics.length > 0;\n const isApplicationVersionConfigured = application && version;\n if (isShardsConfigured) {\n return {\n shardingParams: { clusterId, shards },\n shardInfo: { clusterId, shards },\n pubsubTopics: shardInfoToPubsubTopics({ clusterId, shards })\n };\n }\n if (isContentTopicsConfigured) {\n const pubsubTopics = Array.from(new Set(contentTopics.map((topic) => contentTopicToPubsubTopic(topic, clusterId))));\n const shards = Array.from(new Set(contentTopics.map((topic) => contentTopicToShardIndex(topic))));\n return {\n shardingParams: { clusterId, contentTopics },\n shardInfo: { clusterId, shards },\n pubsubTopics\n };\n }\n if (isApplicationVersionConfigured) {\n const pubsubTopic = contentTopicToPubsubTopic(`/${application}/${version}/default/default`, clusterId);\n return {\n shardingParams: { clusterId, application, version },\n shardInfo: {\n clusterId,\n shards: [pubsubTopicToSingleShardInfo(pubsubTopic).shard]\n },\n pubsubTopics: [pubsubTopic]\n };\n }\n throw new Error(\"Missing minimum required configuration options for static sharding or autosharding.\");\n};\n//# sourceMappingURL=sharding.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/common/sharding.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/common/to_async_iterator.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/common/to_async_iterator.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toAsyncIterator: () => (/* binding */ toAsyncIterator)\n/* harmony export */ });\nconst FRAME_RATE = 60;\n/**\n * Function that transforms IReceiver subscription to iterable stream of data.\n * @param receiver - object that allows to be subscribed to;\n * @param decoder - parameter to be passed to receiver for subscription;\n * @param options - options for receiver for subscription;\n * @param iteratorOptions - optional configuration for iterator;\n * @returns iterator and stop function to terminate it.\n */\nasync function toAsyncIterator(receiver, decoder, iteratorOptions) {\n const iteratorDelay = iteratorOptions?.iteratorDelay ?? FRAME_RATE;\n const messages = [];\n let unsubscribe;\n unsubscribe = await receiver.subscribe(decoder, (message) => {\n messages.push(message);\n });\n const isWithTimeout = Number.isInteger(iteratorOptions?.timeoutMs);\n const timeoutMs = iteratorOptions?.timeoutMs ?? 0;\n const startTime = Date.now();\n async function* iterator() {\n while (true) {\n if (isWithTimeout && Date.now() - startTime >= timeoutMs) {\n return;\n }\n await wait(iteratorDelay);\n const message = messages.shift();\n if (!unsubscribe && messages.length === 0) {\n return message;\n }\n if (!message && unsubscribe) {\n continue;\n }\n yield message;\n }\n }\n return {\n iterator: iterator(),\n async stop() {\n if (unsubscribe) {\n await unsubscribe();\n unsubscribe = undefined;\n }\n }\n };\n}\nfunction wait(ms) {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n//# sourceMappingURL=to_async_iterator.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/common/to_async_iterator.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/index.js":
|
||
/*!************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/index.js ***!
|
||
\************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Logger: () => (/* reexport safe */ _logger_index_js__WEBPACK_IMPORTED_MODULE_1__.Logger),\n/* harmony export */ contentTopicToPubsubTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.contentTopicToPubsubTopic),\n/* harmony export */ contentTopicToShardIndex: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.contentTopicToShardIndex),\n/* harmony export */ contentTopicsByPubsubTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.contentTopicsByPubsubTopic),\n/* harmony export */ decodeRelayShard: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.decodeRelayShard),\n/* harmony export */ determinePubsubTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.determinePubsubTopic),\n/* harmony export */ encodeRelayShard: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.encodeRelayShard),\n/* harmony export */ ensurePubsubTopicIsConfigured: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.ensurePubsubTopicIsConfigured),\n/* harmony export */ ensureShardingConfigured: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.ensureShardingConfigured),\n/* harmony export */ ensureValidContentTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.ensureValidContentTopic),\n/* harmony export */ getPseudoRandomSubset: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.getPseudoRandomSubset),\n/* harmony export */ getWsMultiaddrFromMultiaddrs: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.getWsMultiaddrFromMultiaddrs),\n/* harmony export */ groupByContentTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.groupByContentTopic),\n/* harmony export */ isDefined: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.isDefined),\n/* harmony export */ isMessageSizeUnderCap: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.isMessageSizeUnderCap),\n/* harmony export */ isWireSizeUnderCap: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.isWireSizeUnderCap),\n/* harmony export */ pubsubTopicToSingleShardInfo: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.pubsubTopicToSingleShardInfo),\n/* harmony export */ pushOrInitMapSet: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.pushOrInitMapSet),\n/* harmony export */ removeItemFromArray: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.removeItemFromArray),\n/* harmony export */ shardInfoToPubsubTopics: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.shardInfoToPubsubTopics),\n/* harmony export */ singleShardInfoToPubsubTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.singleShardInfoToPubsubTopic),\n/* harmony export */ singleShardInfosToShardInfo: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.singleShardInfosToShardInfo),\n/* harmony export */ toAsyncIterator: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.toAsyncIterator)\n/* harmony export */ });\n/* harmony import */ var _common_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common/index.js */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/common/index.js\");\n/* harmony import */ var _logger_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger/index.js */ \"./node_modules/@waku/core/node_modules/@waku/utils/dist/logger/index.js\");\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/@waku/utils/dist/logger/index.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/@waku/utils/dist/logger/index.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Logger: () => (/* binding */ Logger)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n\nconst APP_NAME = \"waku\";\nclass Logger {\n _info;\n _warn;\n _error;\n static createDebugNamespace(level, prefix) {\n return prefix ? `${APP_NAME}:${level}:${prefix}` : `${APP_NAME}:${level}`;\n }\n constructor(prefix) {\n this._info = debug__WEBPACK_IMPORTED_MODULE_0__(Logger.createDebugNamespace(\"info\", prefix));\n this._warn = debug__WEBPACK_IMPORTED_MODULE_0__(Logger.createDebugNamespace(\"warn\", prefix));\n this._error = debug__WEBPACK_IMPORTED_MODULE_0__(Logger.createDebugNamespace(\"error\", prefix));\n }\n get info() {\n return this._info;\n }\n get warn() {\n return this._warn;\n }\n get error() {\n return this._error;\n }\n log(level, ...args) {\n const logger = this[level];\n logger(...args);\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/@waku/utils/dist/logger/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@waku/core/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@waku/core/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/core/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/core/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@waku/core/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/core/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/dist/dns/constants.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/dist/dns/constants.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_BOOTSTRAP_TAG_NAME: () => (/* binding */ DEFAULT_BOOTSTRAP_TAG_NAME),\n/* harmony export */ DEFAULT_BOOTSTRAP_TAG_TTL: () => (/* binding */ DEFAULT_BOOTSTRAP_TAG_TTL),\n/* harmony export */ DEFAULT_BOOTSTRAP_TAG_VALUE: () => (/* binding */ DEFAULT_BOOTSTRAP_TAG_VALUE),\n/* harmony export */ DEFAULT_NODE_REQUIREMENTS: () => (/* binding */ DEFAULT_NODE_REQUIREMENTS),\n/* harmony export */ enrTree: () => (/* binding */ enrTree)\n/* harmony export */ });\nconst enrTree = {\n TEST: \"enrtree://AOGYWMBYOUIMOENHXCHILPKY3ZRFEULMFI4DOM442QSZ73TT2A7VI@test.waku.nodes.status.im\",\n SANDBOX: \"enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im\"\n};\nconst DEFAULT_BOOTSTRAP_TAG_NAME = \"bootstrap\";\nconst DEFAULT_BOOTSTRAP_TAG_VALUE = 50;\nconst DEFAULT_BOOTSTRAP_TAG_TTL = 100_000_000;\nconst DEFAULT_NODE_REQUIREMENTS = {\n store: 2,\n filter: 1,\n lightPush: 1\n};\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/dist/dns/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/dist/dns/dns.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/dist/dns/dns.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DnsNodeDiscovery: () => (/* binding */ DnsNodeDiscovery)\n/* harmony export */ });\n/* harmony import */ var _waku_enr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/enr */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _dns_over_https_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dns_over_https.js */ \"./node_modules/@waku/discovery/dist/dns/dns_over_https.js\");\n/* harmony import */ var _enrtree_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./enrtree.js */ \"./node_modules/@waku/discovery/dist/dns/enrtree.js\");\n/* harmony import */ var _fetch_nodes_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fetch_nodes.js */ \"./node_modules/@waku/discovery/dist/dns/fetch_nodes.js\");\n\n\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_1__.Logger(\"discovery:dns\");\nclass DnsNodeDiscovery {\n dns;\n _DNSTreeCache;\n _errorTolerance = 10;\n static async dnsOverHttp(dnsClient) {\n if (!dnsClient) {\n dnsClient = await _dns_over_https_js__WEBPACK_IMPORTED_MODULE_2__.DnsOverHttps.create();\n }\n return new DnsNodeDiscovery(dnsClient);\n }\n /**\n * Returns a list of verified peers listed in an EIP-1459 DNS tree. Method may\n * return fewer peers than requested if @link wantedNodeCapabilityCount requires\n * larger quantity of peers than available or the number of errors/duplicate\n * peers encountered by randomized search exceeds the sum of the fields of\n * @link wantedNodeCapabilityCount plus the @link _errorTolerance factor.\n */\n async getPeers(enrTreeUrls, wantedNodeCapabilityCount) {\n const networkIndex = Math.floor(Math.random() * enrTreeUrls.length);\n const { publicKey, domain } = _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.parseTree(enrTreeUrls[networkIndex]);\n const context = {\n domain,\n publicKey,\n visits: {}\n };\n const peers = await (0,_fetch_nodes_js__WEBPACK_IMPORTED_MODULE_4__.fetchNodesUntilCapabilitiesFulfilled)(wantedNodeCapabilityCount, this._errorTolerance, () => this._search(domain, context));\n log.info(\"retrieved peers: \", peers.map((peer) => {\n return {\n id: peer.peerId?.toString(),\n multiaddrs: peer.multiaddrs?.map((ma) => ma.toString())\n };\n }));\n return peers;\n }\n constructor(dns) {\n this._DNSTreeCache = {};\n this.dns = dns;\n }\n /**\n * {@inheritDoc getPeers}\n */\n async *getNextPeer(enrTreeUrls, wantedNodeCapabilityCount) {\n const networkIndex = Math.floor(Math.random() * enrTreeUrls.length);\n const { publicKey, domain } = _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.parseTree(enrTreeUrls[networkIndex]);\n const context = {\n domain,\n publicKey,\n visits: {}\n };\n for await (const peer of (0,_fetch_nodes_js__WEBPACK_IMPORTED_MODULE_4__.yieldNodesUntilCapabilitiesFulfilled)(wantedNodeCapabilityCount, this._errorTolerance, () => this._search(domain, context))) {\n yield peer;\n }\n }\n /**\n * Runs a recursive, randomized descent of the DNS tree to retrieve a single\n * ENR record as an ENR. Returns null if parsing or DNS resolution fails.\n */\n async _search(subdomain, context) {\n try {\n const entry = await this._getTXTRecord(subdomain, context);\n context.visits[subdomain] = true;\n let next;\n let branches;\n const entryType = getEntryType(entry);\n try {\n switch (entryType) {\n case _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.ROOT_PREFIX:\n next = _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.parseAndVerifyRoot(entry, context.publicKey);\n return await this._search(next, context);\n case _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.BRANCH_PREFIX:\n branches = _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.parseBranch(entry);\n next = selectRandomPath(branches, context);\n return await this._search(next, context);\n case _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.RECORD_PREFIX:\n return _waku_enr__WEBPACK_IMPORTED_MODULE_0__.EnrDecoder.fromString(entry);\n default:\n return null;\n }\n }\n catch (error) {\n log.error(`Failed to search DNS tree ${entryType} at subdomain ${subdomain}: ${error}`);\n return null;\n }\n }\n catch (error) {\n log.error(`Failed to retrieve TXT record at subdomain ${subdomain}: ${error}`);\n return null;\n }\n }\n /**\n * Retrieves the TXT record stored at a location from either\n * this DNS tree cache or via DNS query.\n *\n * @throws if the TXT Record contains non-UTF-8 values.\n */\n async _getTXTRecord(subdomain, context) {\n if (this._DNSTreeCache[subdomain]) {\n return this._DNSTreeCache[subdomain];\n }\n // Location is either the top level tree entry host or a subdomain of it.\n const location = subdomain !== context.domain\n ? `${subdomain}.${context.domain}`\n : context.domain;\n const response = await this.dns.resolveTXT(location);\n if (!response.length)\n throw new Error(\"Received empty result array while fetching TXT record\");\n if (!response[0].length)\n throw new Error(\"Received empty TXT record\");\n // Branch entries can be an array of strings of comma delimited subdomains, with\n // some subdomain strings split across the array elements\n const result = response.join(\"\");\n this._DNSTreeCache[subdomain] = result;\n return result;\n }\n}\nfunction getEntryType(entry) {\n if (entry.startsWith(_enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.ROOT_PREFIX))\n return _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.ROOT_PREFIX;\n if (entry.startsWith(_enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.BRANCH_PREFIX))\n return _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.BRANCH_PREFIX;\n if (entry.startsWith(_enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.RECORD_PREFIX))\n return _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.RECORD_PREFIX;\n return \"\";\n}\n/**\n * Returns a randomly selected subdomain string from the list provided by a branch\n * entry record.\n *\n * The client must track subdomains which are already resolved to avoid\n * going into an infinite loop b/c branch entries can contain\n * circular references. It’s in the client’s best interest to traverse the\n * tree in random order.\n */\nfunction selectRandomPath(branches, context) {\n // Identify domains already visited in this traversal of the DNS tree.\n // Then filter against them to prevent cycles.\n const circularRefs = {};\n for (const [idx, subdomain] of branches.entries()) {\n if (context.visits[subdomain]) {\n circularRefs[idx] = true;\n }\n }\n // If all possible paths are circular...\n if (Object.keys(circularRefs).length === branches.length) {\n throw new Error(\"Unresolvable circular path detected\");\n }\n // Randomly select a viable path\n let index;\n do {\n index = Math.floor(Math.random() * branches.length);\n } while (circularRefs[index]);\n return branches[index];\n}\n//# sourceMappingURL=dns.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/dist/dns/dns.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/dist/dns/dns_discovery.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/dist/dns/dns_discovery.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerDiscoveryDns: () => (/* binding */ PeerDiscoveryDns),\n/* harmony export */ wakuDnsDiscovery: () => (/* binding */ wakuDnsDiscovery)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/event-target.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/peer-discovery/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/discovery/dist/dns/constants.js\");\n/* harmony import */ var _dns_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dns.js */ \"./node_modules/@waku/discovery/dist/dns/dns.js\");\n\n\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_0__.Logger(\"peer-discovery-dns\");\n/**\n * Parse options and expose function to return bootstrap peer addresses.\n */\nclass PeerDiscoveryDns extends _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.TypedEventEmitter {\n nextPeer;\n _started;\n _components;\n _options;\n constructor(components, options) {\n super();\n this._started = false;\n this._components = components;\n this._options = options;\n const { enrUrls } = options;\n log.info(\"Use following EIP-1459 ENR Tree URLs: \", enrUrls);\n }\n /**\n * Start discovery process\n */\n async start() {\n log.info(\"Starting peer discovery via dns\");\n this._started = true;\n if (this.nextPeer === undefined) {\n let { enrUrls } = this._options;\n if (!Array.isArray(enrUrls))\n enrUrls = [enrUrls];\n const { wantedNodeCapabilityCount } = this._options;\n const dns = await _dns_js__WEBPACK_IMPORTED_MODULE_2__.DnsNodeDiscovery.dnsOverHttp();\n this.nextPeer = dns.getNextPeer.bind(dns, enrUrls, wantedNodeCapabilityCount);\n }\n for await (const peerEnr of this.nextPeer()) {\n if (!this._started) {\n return;\n }\n const { peerInfo, shardInfo } = peerEnr;\n if (!peerInfo) {\n continue;\n }\n const tagsToUpdate = {\n [_constants_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_BOOTSTRAP_TAG_NAME]: {\n value: this._options.tagValue ?? _constants_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_BOOTSTRAP_TAG_VALUE,\n ttl: this._options.tagTTL ?? _constants_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_BOOTSTRAP_TAG_TTL\n }\n };\n let isPeerChanged = false;\n const isPeerExists = await this._components.peerStore.has(peerInfo.id);\n if (isPeerExists) {\n const peer = await this._components.peerStore.get(peerInfo.id);\n const hasBootstrapTag = peer.tags.has(_constants_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_BOOTSTRAP_TAG_NAME);\n if (!hasBootstrapTag) {\n isPeerChanged = true;\n await this._components.peerStore.merge(peerInfo.id, {\n tags: tagsToUpdate\n });\n }\n }\n else {\n isPeerChanged = true;\n await this._components.peerStore.save(peerInfo.id, {\n tags: tagsToUpdate,\n ...(shardInfo && {\n metadata: {\n shardInfo: (0,_waku_utils__WEBPACK_IMPORTED_MODULE_0__.encodeRelayShard)(shardInfo)\n }\n })\n });\n }\n if (isPeerChanged) {\n this.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CustomEvent(\"peer\", { detail: peerInfo }));\n }\n }\n }\n /**\n * Stop emitting events\n */\n stop() {\n this._started = false;\n }\n get [_libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.peerDiscoverySymbol]() {\n return true;\n }\n get [Symbol.toStringTag]() {\n return \"@waku/bootstrap\";\n }\n}\nfunction wakuDnsDiscovery(enrUrls, wantedNodeCapabilityCount = _constants_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_NODE_REQUIREMENTS) {\n return (components) => new PeerDiscoveryDns(components, { enrUrls, wantedNodeCapabilityCount });\n}\n//# sourceMappingURL=dns_discovery.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/dist/dns/dns_discovery.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/dist/dns/dns_over_https.js":
|
||
/*!*****************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/dist/dns/dns_over_https.js ***!
|
||
\*****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DnsOverHttps: () => (/* binding */ DnsOverHttps)\n/* harmony export */ });\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var dns_query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dns-query */ \"./node_modules/dns-query/index.mjs\");\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_0__.Logger(\"dns-over-https\");\nclass DnsOverHttps {\n endpoints;\n retries;\n /**\n * Create new Dns-Over-Http DNS client.\n *\n * @param endpoints The endpoints for Dns-Over-Https queries;\n * Defaults to using dns-query's API..\n * @param retries Retries if a given endpoint fails.\n *\n * @throws {code: string} If DNS query fails.\n */\n static async create(endpoints, retries) {\n const _endpoints = endpoints ?? (await dns_query__WEBPACK_IMPORTED_MODULE_2__.wellknown.endpoints(\"doh\"));\n return new DnsOverHttps(_endpoints, retries);\n }\n constructor(endpoints, retries = 3) {\n this.endpoints = endpoints;\n this.retries = retries;\n }\n /**\n * Resolves a TXT record\n *\n * @param domain The domain name\n *\n * @throws if the query fails\n */\n async resolveTXT(domain) {\n let answers;\n try {\n const res = await (0,dns_query__WEBPACK_IMPORTED_MODULE_2__.query)({\n question: { type: \"TXT\", name: domain }\n }, {\n endpoints: this.endpoints,\n retries: this.retries\n });\n answers = res.answers;\n }\n catch (error) {\n log.error(\"query failed: \", error);\n throw new Error(\"DNS query failed\");\n }\n if (!answers)\n throw new Error(`Could not resolve ${domain}`);\n const data = answers.map((a) => a.data);\n const result = [];\n data.forEach((d) => {\n if (typeof d === \"string\") {\n result.push(d);\n }\n else if (Array.isArray(d)) {\n d.forEach((sd) => {\n if (typeof sd === \"string\") {\n result.push(sd);\n }\n else {\n result.push((0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.bytesToUtf8)(sd));\n }\n });\n }\n else {\n result.push((0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.bytesToUtf8)(d));\n }\n });\n return result;\n }\n}\n//# sourceMappingURL=dns_over_https.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/dist/dns/dns_over_https.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/dist/dns/enrtree.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/dist/dns/enrtree.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENRTree: () => (/* binding */ ENRTree)\n/* harmony export */ });\n/* harmony import */ var _waku_enr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/enr */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var hi_base32__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! hi-base32 */ \"./node_modules/hi-base32/src/base32.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/from-string.js\");\n\n\n\n\n\nclass ENRTree {\n static RECORD_PREFIX = _waku_enr__WEBPACK_IMPORTED_MODULE_0__.ENR.RECORD_PREFIX;\n static TREE_PREFIX = \"enrtree:\";\n static BRANCH_PREFIX = \"enrtree-branch:\";\n static ROOT_PREFIX = \"enrtree-root:\";\n /**\n * Extracts the branch subdomain referenced by a DNS tree root string after verifying\n * the root record signature with its base32 compressed public key.\n */\n static parseAndVerifyRoot(root, publicKey) {\n if (!root.startsWith(this.ROOT_PREFIX))\n throw new Error(`ENRTree root entry must start with '${this.ROOT_PREFIX}'`);\n const rootValues = ENRTree.parseRootValues(root);\n const decodedPublicKey = hi_base32__WEBPACK_IMPORTED_MODULE_2__.decode.asBytes(publicKey);\n // The signature is a 65-byte secp256k1 over the keccak256 hash\n // of the record content, excluding the `sig=` part, encoded as URL-safe base64 string\n // (Trailing recovery bit must be trimmed to pass `ecdsaVerify` method)\n const signedComponent = root.split(\" sig\")[0];\n const signedComponentBuffer = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(signedComponent);\n const signatureBuffer = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(rootValues.signature, \"base64url\").slice(0, 64);\n const isVerified = (0,_waku_enr__WEBPACK_IMPORTED_MODULE_0__.verifySignature)(signatureBuffer, (0,_waku_enr__WEBPACK_IMPORTED_MODULE_0__.keccak256)(signedComponentBuffer), new Uint8Array(decodedPublicKey));\n if (!isVerified)\n throw new Error(\"Unable to verify ENRTree root signature\");\n return rootValues.eRoot;\n }\n static parseRootValues(txt) {\n const matches = txt.match(/^enrtree-root:v1 e=([^ ]+) l=([^ ]+) seq=(\\d+) sig=([^ ]+)$/);\n if (!Array.isArray(matches))\n throw new Error(\"Could not parse ENRTree root entry\");\n matches.shift(); // The first entry is the full match\n const [eRoot, lRoot, seq, signature] = matches;\n if (!eRoot)\n throw new Error(\"Could not parse 'e' value from ENRTree root entry\");\n if (!lRoot)\n throw new Error(\"Could not parse 'l' value from ENRTree root entry\");\n if (!seq)\n throw new Error(\"Could not parse 'seq' value from ENRTree root entry\");\n if (!signature)\n throw new Error(\"Could not parse 'sig' value from ENRTree root entry\");\n return { eRoot, lRoot, seq: Number(seq), signature };\n }\n /**\n * Returns the public key and top level domain of an ENR tree entry.\n * The domain is the starting point for traversing a set of linked DNS TXT records\n * and the public key is used to verify the root entry record\n */\n static parseTree(tree) {\n if (!tree.startsWith(this.TREE_PREFIX))\n throw new Error(`ENRTree tree entry must start with '${this.TREE_PREFIX}'`);\n const matches = tree.match(/^enrtree:\\/\\/([^@]+)@(.+)$/);\n if (!Array.isArray(matches))\n throw new Error(\"Could not parse ENRTree tree entry\");\n matches.shift(); // The first entry is the full match\n const [publicKey, domain] = matches;\n if (!publicKey)\n throw new Error(\"Could not parse public key from ENRTree tree entry\");\n if (!domain)\n throw new Error(\"Could not parse domain from ENRTree tree entry\");\n return { publicKey, domain };\n }\n /**\n * Returns subdomains listed in an ENR branch entry. These in turn lead to\n * either further branch entries or ENR records.\n */\n static parseBranch(branch) {\n if (!branch.startsWith(this.BRANCH_PREFIX))\n throw new Error(`ENRTree branch entry must start with '${this.BRANCH_PREFIX}'`);\n return branch.split(this.BRANCH_PREFIX)[1].split(\",\");\n }\n}\n//# sourceMappingURL=enrtree.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/dist/dns/enrtree.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/dist/dns/fetch_nodes.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/dist/dns/fetch_nodes.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fetchNodesUntilCapabilitiesFulfilled: () => (/* binding */ fetchNodesUntilCapabilitiesFulfilled),\n/* harmony export */ yieldNodesUntilCapabilitiesFulfilled: () => (/* binding */ yieldNodesUntilCapabilitiesFulfilled)\n/* harmony export */ });\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_0__.Logger(\"discovery:fetch_nodes\");\n/**\n * Fetch nodes using passed [[getNode]] until all wanted capabilities are\n * fulfilled or the number of [[getNode]] call exceeds the sum of\n * [[wantedNodeCapabilityCount]] plus [[errorTolerance]].\n */\nasync function fetchNodesUntilCapabilitiesFulfilled(wantedNodeCapabilityCount, errorTolerance, getNode) {\n const wanted = {\n relay: wantedNodeCapabilityCount.relay ?? 0,\n store: wantedNodeCapabilityCount.store ?? 0,\n filter: wantedNodeCapabilityCount.filter ?? 0,\n lightPush: wantedNodeCapabilityCount.lightPush ?? 0\n };\n const maxSearches = wanted.relay + wanted.store + wanted.filter + wanted.lightPush;\n const actual = {\n relay: 0,\n store: 0,\n filter: 0,\n lightPush: 0\n };\n let totalSearches = 0;\n const peers = [];\n while (!isSatisfied(wanted, actual) &&\n totalSearches < maxSearches + errorTolerance) {\n const peer = await getNode();\n if (peer && isNewPeer(peer, peers)) {\n // ENRs without a waku2 key are ignored.\n if (peer.waku2) {\n if (helpsSatisfyCapabilities(peer.waku2, wanted, actual)) {\n addCapabilities(peer.waku2, actual);\n peers.push(peer);\n }\n }\n log.info(`got new peer candidate from DNS address=${peer.nodeId}@${peer.ip}`);\n }\n totalSearches++;\n }\n return peers;\n}\n/**\n * Fetch nodes using passed [[getNode]] until all wanted capabilities are\n * fulfilled or the number of [[getNode]] call exceeds the sum of\n * [[wantedNodeCapabilityCount]] plus [[errorTolerance]].\n */\nasync function* yieldNodesUntilCapabilitiesFulfilled(wantedNodeCapabilityCount, errorTolerance, getNode) {\n const wanted = {\n relay: wantedNodeCapabilityCount.relay ?? 0,\n store: wantedNodeCapabilityCount.store ?? 0,\n filter: wantedNodeCapabilityCount.filter ?? 0,\n lightPush: wantedNodeCapabilityCount.lightPush ?? 0\n };\n const maxSearches = wanted.relay + wanted.store + wanted.filter + wanted.lightPush;\n const actual = {\n relay: 0,\n store: 0,\n filter: 0,\n lightPush: 0\n };\n let totalSearches = 0;\n const peerNodeIds = new Set();\n while (!isSatisfied(wanted, actual) &&\n totalSearches < maxSearches + errorTolerance) {\n const peer = await getNode();\n if (peer && peer.nodeId && !peerNodeIds.has(peer.nodeId)) {\n peerNodeIds.add(peer.nodeId);\n // ENRs without a waku2 key are ignored.\n if (peer.waku2) {\n if (helpsSatisfyCapabilities(peer.waku2, wanted, actual)) {\n addCapabilities(peer.waku2, actual);\n yield peer;\n }\n }\n log.info(`got new peer candidate from DNS address=${peer.nodeId}@${peer.ip}`);\n }\n totalSearches++;\n }\n}\nfunction isSatisfied(wanted, actual) {\n return (actual.relay >= wanted.relay &&\n actual.store >= wanted.store &&\n actual.filter >= wanted.filter &&\n actual.lightPush >= wanted.lightPush);\n}\nfunction isNewPeer(peer, peers) {\n if (!peer.nodeId)\n return false;\n for (const existingPeer of peers) {\n if (peer.nodeId === existingPeer.nodeId) {\n return false;\n }\n }\n return true;\n}\nfunction addCapabilities(node, total) {\n if (node.relay)\n total.relay += 1;\n if (node.store)\n total.store += 1;\n if (node.filter)\n total.filter += 1;\n if (node.lightPush)\n total.lightPush += 1;\n}\n/**\n * Checks if the proposed ENR [[node]] helps satisfy the [[wanted]] capabilities,\n * considering the [[actual]] capabilities of nodes retrieved so far..\n *\n * @throws If the function is called when the wanted capabilities are already fulfilled.\n */\nfunction helpsSatisfyCapabilities(node, wanted, actual) {\n if (isSatisfied(wanted, actual)) {\n throw \"Internal Error: Waku2 wanted capabilities are already fulfilled\";\n }\n const missing = missingCapabilities(wanted, actual);\n return ((missing.relay && node.relay) ||\n (missing.store && node.store) ||\n (missing.filter && node.filter) ||\n (missing.lightPush && node.lightPush));\n}\n/**\n * Return a [[Waku2]] Object for which capabilities are set to true if they are\n * [[wanted]] yet missing from [[actual]].\n */\nfunction missingCapabilities(wanted, actual) {\n return {\n relay: actual.relay < wanted.relay,\n store: actual.store < wanted.store,\n filter: actual.filter < wanted.filter,\n lightPush: actual.lightPush < wanted.lightPush\n };\n}\n//# sourceMappingURL=fetch_nodes.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/dist/dns/fetch_nodes.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/dist/index.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/dist/index.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DnsNodeDiscovery: () => (/* reexport safe */ _dns_dns_js__WEBPACK_IMPORTED_MODULE_2__.DnsNodeDiscovery),\n/* harmony export */ LocalPeerCacheDiscovery: () => (/* reexport safe */ _local_peer_cache_index_js__WEBPACK_IMPORTED_MODULE_5__.LocalPeerCacheDiscovery),\n/* harmony export */ PeerDiscoveryDns: () => (/* reexport safe */ _dns_dns_discovery_js__WEBPACK_IMPORTED_MODULE_0__.PeerDiscoveryDns),\n/* harmony export */ PeerExchangeCodec: () => (/* reexport safe */ _peer_exchange_waku_peer_exchange_js__WEBPACK_IMPORTED_MODULE_3__.PeerExchangeCodec),\n/* harmony export */ PeerExchangeDiscovery: () => (/* reexport safe */ _peer_exchange_waku_peer_exchange_discovery_js__WEBPACK_IMPORTED_MODULE_4__.PeerExchangeDiscovery),\n/* harmony export */ WakuPeerExchange: () => (/* reexport safe */ _peer_exchange_waku_peer_exchange_js__WEBPACK_IMPORTED_MODULE_3__.WakuPeerExchange),\n/* harmony export */ enrTree: () => (/* reexport safe */ _dns_constants_js__WEBPACK_IMPORTED_MODULE_1__.enrTree),\n/* harmony export */ wakuDnsDiscovery: () => (/* reexport safe */ _dns_dns_discovery_js__WEBPACK_IMPORTED_MODULE_0__.wakuDnsDiscovery),\n/* harmony export */ wakuLocalPeerCacheDiscovery: () => (/* reexport safe */ _local_peer_cache_index_js__WEBPACK_IMPORTED_MODULE_5__.wakuLocalPeerCacheDiscovery),\n/* harmony export */ wakuPeerExchange: () => (/* reexport safe */ _peer_exchange_waku_peer_exchange_js__WEBPACK_IMPORTED_MODULE_3__.wakuPeerExchange),\n/* harmony export */ wakuPeerExchangeDiscovery: () => (/* reexport safe */ _peer_exchange_waku_peer_exchange_discovery_js__WEBPACK_IMPORTED_MODULE_4__.wakuPeerExchangeDiscovery)\n/* harmony export */ });\n/* harmony import */ var _dns_dns_discovery_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dns/dns_discovery.js */ \"./node_modules/@waku/discovery/dist/dns/dns_discovery.js\");\n/* harmony import */ var _dns_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dns/constants.js */ \"./node_modules/@waku/discovery/dist/dns/constants.js\");\n/* harmony import */ var _dns_dns_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dns/dns.js */ \"./node_modules/@waku/discovery/dist/dns/dns.js\");\n/* harmony import */ var _peer_exchange_waku_peer_exchange_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./peer-exchange/waku_peer_exchange.js */ \"./node_modules/@waku/discovery/dist/peer-exchange/waku_peer_exchange.js\");\n/* harmony import */ var _peer_exchange_waku_peer_exchange_discovery_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer-exchange/waku_peer_exchange_discovery.js */ \"./node_modules/@waku/discovery/dist/peer-exchange/waku_peer_exchange_discovery.js\");\n/* harmony import */ var _local_peer_cache_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./local-peer-cache/index.js */ \"./node_modules/@waku/discovery/dist/local-peer-cache/index.js\");\n// DNS Discovery\n\n\n\n// Peer Exchange Discovery\n\n\n// Local Peer Cache Discovery\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/dist/local-peer-cache/index.js":
|
||
/*!*********************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/dist/local-peer-cache/index.js ***!
|
||
\*********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_LOCAL_TAG_NAME: () => (/* binding */ DEFAULT_LOCAL_TAG_NAME),\n/* harmony export */ LocalPeerCacheDiscovery: () => (/* binding */ LocalPeerCacheDiscovery),\n/* harmony export */ wakuLocalPeerCacheDiscovery: () => (/* binding */ wakuLocalPeerCacheDiscovery)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/event-target.js\");\n/* harmony import */ var _libp2p_peer_id_factory__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/peer-id-factory */ \"./node_modules/@libp2p/peer-id-factory/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n\n\n\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_2__.Logger(\"peer-exchange-discovery\");\nconst DEFAULT_LOCAL_TAG_NAME = _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.LOCAL;\nconst DEFAULT_LOCAL_TAG_VALUE = 50;\nconst DEFAULT_LOCAL_TAG_TTL = 100_000_000;\nclass LocalPeerCacheDiscovery extends _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.TypedEventEmitter {\n components;\n options;\n isStarted;\n peers = [];\n constructor(components, options) {\n super();\n this.components = components;\n this.options = options;\n this.isStarted = false;\n this.peers = this.getPeersFromLocalStorage();\n }\n get [Symbol.toStringTag]() {\n return \"@waku/local-peer-cache-discovery\";\n }\n async start() {\n if (this.isStarted)\n return;\n log.info(\"Starting Local Storage Discovery\");\n this.components.events.addEventListener(\"peer:identify\", this.handleNewPeers);\n for (const { id: idStr, address } of this.peers) {\n const peerId = await (0,_libp2p_peer_id_factory__WEBPACK_IMPORTED_MODULE_4__.createFromJSON)({ id: idStr });\n if (await this.components.peerStore.has(peerId))\n continue;\n await this.components.peerStore.save(peerId, {\n multiaddrs: [(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(address)],\n tags: {\n [this.options?.tagName ?? DEFAULT_LOCAL_TAG_NAME]: {\n value: this.options?.tagValue ?? DEFAULT_LOCAL_TAG_VALUE,\n ttl: this.options?.tagTTL ?? DEFAULT_LOCAL_TAG_TTL\n }\n }\n });\n this.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CustomEvent(\"peer\", {\n detail: {\n id: peerId,\n multiaddrs: [(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(address)]\n }\n }));\n }\n log.info(`Discovered ${this.peers.length} peers`);\n this.isStarted = true;\n }\n stop() {\n if (!this.isStarted)\n return;\n log.info(\"Stopping Local Storage Discovery\");\n this.components.events.removeEventListener(\"peer:identify\", this.handleNewPeers);\n this.isStarted = false;\n this.savePeersToLocalStorage();\n }\n handleNewPeers = (event) => {\n const { peerId, listenAddrs } = event.detail;\n const websocketMultiaddr = (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.getWsMultiaddrFromMultiaddrs)(listenAddrs);\n const localStoragePeers = this.getPeersFromLocalStorage();\n const existingPeerIndex = localStoragePeers.findIndex((_peer) => _peer.id === peerId.toString());\n if (existingPeerIndex >= 0) {\n localStoragePeers[existingPeerIndex].address =\n websocketMultiaddr.toString();\n }\n else {\n localStoragePeers.push({\n id: peerId.toString(),\n address: websocketMultiaddr.toString()\n });\n }\n this.peers = localStoragePeers;\n this.savePeersToLocalStorage();\n };\n getPeersFromLocalStorage() {\n try {\n const storedPeersData = localStorage.getItem(\"waku:peers\");\n if (!storedPeersData)\n return [];\n const peers = JSON.parse(storedPeersData);\n return peers.filter(isValidStoredPeer);\n }\n catch (error) {\n log.error(\"Error parsing peers from local storage:\", error);\n return [];\n }\n }\n savePeersToLocalStorage() {\n try {\n localStorage.setItem(\"waku:peers\", JSON.stringify(this.peers));\n }\n catch (error) {\n log.error(\"Error saving peers to local storage:\", error);\n }\n }\n}\nfunction isValidStoredPeer(peer) {\n return (peer &&\n typeof peer === \"object\" &&\n typeof peer.id === \"string\" &&\n typeof peer.address === \"string\");\n}\nfunction wakuLocalPeerCacheDiscovery() {\n return (components, options) => new LocalPeerCacheDiscovery(components, options);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/dist/local-peer-cache/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/dist/peer-exchange/rpc.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/dist/peer-exchange/rpc.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerExchangeRPC: () => (/* binding */ PeerExchangeRPC)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/discovery/node_modules/@waku/proto/dist/index.js\");\n\n/**\n * PeerExchangeRPC represents a message conforming to the Waku Peer Exchange protocol\n */\nclass PeerExchangeRPC {\n proto;\n constructor(proto) {\n this.proto = proto;\n }\n static createRequest(params) {\n const { numPeers } = params;\n return new PeerExchangeRPC({\n query: {\n numPeers: numPeers\n },\n response: undefined\n });\n }\n /**\n * Encode the current PeerExchangeRPC request to bytes\n * @returns Uint8Array\n */\n encode() {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_peer_exchange.PeerExchangeRPC.encode(this.proto);\n }\n /**\n * Decode the current PeerExchangeRPC request to bytes\n * @returns Uint8Array\n */\n static decode(bytes) {\n const res = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_peer_exchange.PeerExchangeRPC.decode(bytes);\n return new PeerExchangeRPC(res);\n }\n get query() {\n return this.proto.query;\n }\n get response() {\n return this.proto.response;\n }\n}\n//# sourceMappingURL=rpc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/dist/peer-exchange/rpc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/dist/peer-exchange/waku_peer_exchange.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/dist/peer-exchange/waku_peer_exchange.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerExchangeCodec: () => (/* binding */ PeerExchangeCodec),\n/* harmony export */ WakuPeerExchange: () => (/* binding */ WakuPeerExchange),\n/* harmony export */ wakuPeerExchange: () => (/* binding */ wakuPeerExchange)\n/* harmony export */ });\n/* harmony import */ var _waku_core_lib_base_protocol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/core/lib/base_protocol */ \"./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/base_protocol.js\");\n/* harmony import */ var _waku_enr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/enr */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _rpc_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./rpc.js */ \"./node_modules/@waku/discovery/dist/peer-exchange/rpc.js\");\n\n\n\n\n\n\n\n\n\n\nconst PeerExchangeCodec = \"/vac/waku/peer-exchange/2.0.0-alpha1\";\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_3__.Logger(\"peer-exchange\");\n/**\n * Implementation of the Peer Exchange protocol (https://rfc.vac.dev/spec/34/)\n */\nclass WakuPeerExchange extends _waku_core_lib_base_protocol__WEBPACK_IMPORTED_MODULE_0__.BaseProtocol {\n /**\n * @param components - libp2p components\n */\n constructor(components, pubsubTopics) {\n super(PeerExchangeCodec, components, log, pubsubTopics);\n }\n /**\n * Make a peer exchange query to a peer\n */\n async query(params) {\n const { numPeers } = params;\n const rpcQuery = _rpc_js__WEBPACK_IMPORTED_MODULE_8__.PeerExchangeRPC.createRequest({\n numPeers: BigInt(numPeers)\n });\n const peer = await this.peerStore.get(params.peerId);\n if (!peer) {\n return {\n peerInfos: null,\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.ProtocolError.NO_PEER_AVAILABLE\n };\n }\n const stream = await this.getStream(peer);\n const res = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_6__.pipe)([rpcQuery.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_5__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_5__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(source));\n try {\n const bytes = new uint8arraylist__WEBPACK_IMPORTED_MODULE_7__.Uint8ArrayList();\n res.forEach((chunk) => {\n bytes.append(chunk);\n });\n const { response } = _rpc_js__WEBPACK_IMPORTED_MODULE_8__.PeerExchangeRPC.decode(bytes);\n if (!response) {\n log.error(\"PeerExchangeRPC message did not contains a `response` field\");\n return {\n peerInfos: null,\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.ProtocolError.EMPTY_PAYLOAD\n };\n }\n const peerInfos = await Promise.all(response.peerInfos\n .map((peerInfo) => peerInfo.enr)\n .filter(_waku_utils__WEBPACK_IMPORTED_MODULE_3__.isDefined)\n .map(async (enr) => {\n return { ENR: await _waku_enr__WEBPACK_IMPORTED_MODULE_1__.EnrDecoder.fromRLP(enr) };\n }));\n return {\n peerInfos,\n error: null\n };\n }\n catch (err) {\n log.error(\"Failed to decode push reply\", err);\n return {\n peerInfos: null,\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.ProtocolError.DECODE_FAILED\n };\n }\n }\n}\n/**\n *\n * @returns A function that creates a new peer exchange protocol\n */\nfunction wakuPeerExchange(pubsubTopics) {\n return (components) => new WakuPeerExchange(components, pubsubTopics);\n}\n//# sourceMappingURL=waku_peer_exchange.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/dist/peer-exchange/waku_peer_exchange.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/dist/peer-exchange/waku_peer_exchange_discovery.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/dist/peer-exchange/waku_peer_exchange_discovery.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_PEER_EXCHANGE_TAG_NAME: () => (/* binding */ DEFAULT_PEER_EXCHANGE_TAG_NAME),\n/* harmony export */ PeerExchangeDiscovery: () => (/* binding */ PeerExchangeDiscovery),\n/* harmony export */ wakuPeerExchangeDiscovery: () => (/* binding */ wakuPeerExchangeDiscovery)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/event-target.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/peer-discovery/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_peer_exchange_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./waku_peer_exchange.js */ \"./node_modules/@waku/discovery/dist/peer-exchange/waku_peer_exchange.js\");\n\n\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_1__.Logger(\"peer-exchange-discovery\");\nconst DEFAULT_PEER_EXCHANGE_REQUEST_NODES = 10;\nconst DEFAULT_PEER_EXCHANGE_QUERY_INTERVAL_MS = 10 * 1000;\nconst DEFAULT_MAX_RETRIES = 3;\nconst DEFAULT_PEER_EXCHANGE_TAG_NAME = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.PEER_EXCHANGE;\nconst DEFAULT_PEER_EXCHANGE_TAG_VALUE = 50;\nconst DEFAULT_PEER_EXCHANGE_TAG_TTL = 100_000_000;\nclass PeerExchangeDiscovery extends _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.TypedEventEmitter {\n components;\n peerExchange;\n options;\n isStarted;\n queryingPeers = new Set();\n queryAttempts = new Map();\n handleDiscoveredPeer = (event) => {\n const { protocols, peerId } = event.detail;\n if (!protocols.includes(_waku_peer_exchange_js__WEBPACK_IMPORTED_MODULE_2__.PeerExchangeCodec) ||\n this.queryingPeers.has(peerId.toString()))\n return;\n this.queryingPeers.add(peerId.toString());\n this.startRecurringQueries(peerId).catch((error) => log.error(`Error querying peer ${error}`));\n };\n constructor(components, pubsubTopics, options = {}) {\n super();\n this.components = components;\n this.peerExchange = new _waku_peer_exchange_js__WEBPACK_IMPORTED_MODULE_2__.WakuPeerExchange(components, pubsubTopics);\n this.options = options;\n this.isStarted = false;\n }\n /**\n * Start emitting events\n */\n start() {\n if (this.isStarted) {\n return;\n }\n log.info(\"Starting peer exchange node discovery, discovering peers\");\n // might be better to use \"peer:identify\" or \"peer:update\"\n this.components.events.addEventListener(\"peer:identify\", this.handleDiscoveredPeer);\n }\n /**\n * Remove event listener\n */\n stop() {\n if (!this.isStarted)\n return;\n log.info(\"Stopping peer exchange node discovery\");\n this.isStarted = false;\n this.queryingPeers.clear();\n this.components.events.removeEventListener(\"peer:identify\", this.handleDiscoveredPeer);\n }\n get [_libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.peerDiscoverySymbol]() {\n return true;\n }\n get [Symbol.toStringTag]() {\n return \"@waku/peer-exchange\";\n }\n startRecurringQueries = async (peerId) => {\n const peerIdStr = peerId.toString();\n const { queryInterval = DEFAULT_PEER_EXCHANGE_QUERY_INTERVAL_MS, maxRetries = DEFAULT_MAX_RETRIES } = this.options;\n log.info(`Querying peer: ${peerIdStr} (attempt ${this.queryAttempts.get(peerIdStr) ?? 1})`);\n await this.query(peerId);\n const currentAttempt = this.queryAttempts.get(peerIdStr) ?? 1;\n if (currentAttempt > maxRetries) {\n this.abortQueriesForPeer(peerIdStr);\n return;\n }\n setTimeout(() => {\n this.queryAttempts.set(peerIdStr, currentAttempt + 1);\n this.startRecurringQueries(peerId).catch((error) => {\n log.error(`Error in startRecurringQueries: ${error}`);\n });\n }, queryInterval * currentAttempt);\n };\n async query(peerId) {\n const { error, peerInfos } = await this.peerExchange.query({\n numPeers: DEFAULT_PEER_EXCHANGE_REQUEST_NODES,\n peerId\n });\n if (error) {\n log.error(\"Peer exchange query failed\", error);\n return { error, peerInfos: null };\n }\n for (const _peerInfo of peerInfos) {\n const { ENR } = _peerInfo;\n if (!ENR) {\n log.warn(\"No ENR in peerInfo object, skipping\");\n continue;\n }\n const { peerId, peerInfo, shardInfo } = ENR;\n if (!peerId || !peerInfo) {\n continue;\n }\n const hasPeer = await this.components.peerStore.has(peerId);\n if (hasPeer) {\n continue;\n }\n // update the tags for the peer\n await this.components.peerStore.save(peerId, {\n tags: {\n [DEFAULT_PEER_EXCHANGE_TAG_NAME]: {\n value: this.options.tagValue ?? DEFAULT_PEER_EXCHANGE_TAG_VALUE,\n ttl: this.options.tagTTL ?? DEFAULT_PEER_EXCHANGE_TAG_TTL\n }\n },\n ...(shardInfo && {\n metadata: {\n shardInfo: (0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.encodeRelayShard)(shardInfo)\n }\n })\n });\n log.info(`Discovered peer: ${peerId.toString()}`);\n this.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CustomEvent(\"peer\", {\n detail: {\n id: peerId,\n multiaddrs: peerInfo.multiaddrs\n }\n }));\n }\n return { error: null, peerInfos };\n }\n abortQueriesForPeer(peerIdStr) {\n log.info(`Aborting queries for peer: ${peerIdStr}`);\n this.queryingPeers.delete(peerIdStr);\n this.queryAttempts.delete(peerIdStr);\n }\n}\nfunction wakuPeerExchangeDiscovery(pubsubTopics) {\n return (components) => new PeerExchangeDiscovery(components, pubsubTopics);\n}\n//# sourceMappingURL=waku_peer_exchange_discovery.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/dist/peer-exchange/waku_peer_exchange_discovery.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/base_protocol.js":
|
||
/*!****************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/base_protocol.js ***!
|
||
\****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BaseProtocol: () => (/* binding */ BaseProtocol)\n/* harmony export */ });\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/libp2p */ \"./node_modules/@waku/utils/dist/libp2p/index.js\");\n/* harmony import */ var _filterPeers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./filterPeers.js */ \"./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/filterPeers.js\");\n/* harmony import */ var _stream_manager_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stream_manager.js */ \"./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/stream_manager.js\");\n\n\n\n\n/**\n * A class with predefined helpers, to be used as a base to implement Waku\n * Protocols.\n */\nclass BaseProtocol {\n multicodec;\n components;\n log;\n pubsubTopics;\n options;\n addLibp2pEventListener;\n removeLibp2pEventListener;\n streamManager;\n constructor(multicodec, components, log, pubsubTopics, options) {\n this.multicodec = multicodec;\n this.components = components;\n this.log = log;\n this.pubsubTopics = pubsubTopics;\n this.options = options;\n this.addLibp2pEventListener = components.events.addEventListener.bind(components.events);\n this.removeLibp2pEventListener = components.events.removeEventListener.bind(components.events);\n this.streamManager = new _stream_manager_js__WEBPACK_IMPORTED_MODULE_3__.StreamManager(multicodec, components.connectionManager.getConnections.bind(components.connectionManager), this.addLibp2pEventListener);\n }\n async getStream(peer) {\n return this.streamManager.getStream(peer);\n }\n get peerStore() {\n return this.components.peerStore;\n }\n /**\n * Returns known peers from the address book (`libp2p.peerStore`) that support\n * the class protocol. Waku may or may not be currently connected to these\n * peers.\n */\n async allPeers() {\n return (0,_waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__.getPeersForProtocol)(this.peerStore, [this.multicodec]);\n }\n async connectedPeers() {\n const peers = await this.allPeers();\n return peers.filter((peer) => {\n return (this.components.connectionManager.getConnections(peer.id).length > 0);\n });\n }\n /**\n * Retrieves a list of connected peers that support the protocol. The list is sorted by latency.\n *\n * @param numPeers - The total number of peers to retrieve. If 0, all peers are returned.\n * @param maxBootstrapPeers - The maximum number of bootstrap peers to retrieve.\n \n * @returns A list of peers that support the protocol sorted by latency.\n */\n async getPeers({ numPeers, maxBootstrapPeers } = {\n maxBootstrapPeers: 1,\n numPeers: 0\n }) {\n // Retrieve all connected peers that support the protocol & shard (if configured)\n const connectedPeersForProtocolAndShard = await (0,_waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__.getConnectedPeersForProtocolAndShard)(this.components.connectionManager.getConnections(), this.peerStore, [this.multicodec], this.options?.shardInfo\n ? (0,_waku_utils__WEBPACK_IMPORTED_MODULE_0__.ensureShardingConfigured)(this.options.shardInfo).shardInfo\n : undefined);\n // Filter the peers based on discovery & number of peers requested\n const filteredPeers = (0,_filterPeers_js__WEBPACK_IMPORTED_MODULE_2__.filterPeersByDiscovery)(connectedPeersForProtocolAndShard, numPeers, maxBootstrapPeers);\n // Sort the peers by latency\n const sortedFilteredPeers = await (0,_waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__.sortPeersByLatency)(this.peerStore, filteredPeers);\n if (sortedFilteredPeers.length === 0) {\n this.log.warn(\"No peers found. Ensure you have a connection to the network.\");\n }\n if (sortedFilteredPeers.length < numPeers) {\n this.log.warn(`Only ${sortedFilteredPeers.length} peers found. Requested ${numPeers}.`);\n }\n return sortedFilteredPeers;\n }\n}\n//# sourceMappingURL=base_protocol.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/base_protocol.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/filterPeers.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/filterPeers.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ filterPeersByDiscovery: () => (/* binding */ filterPeersByDiscovery)\n/* harmony export */ });\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/index.js\");\n\n/**\n * Retrieves a list of peers based on the specified criteria:\n * 1. If numPeers is 0, return all peers\n * 2. Bootstrap peers are prioritized\n * 3. Non-bootstrap peers are randomly selected to fill up to numPeers\n *\n * @param peers - The list of peers to filter from.\n * @param numPeers - The total number of peers to retrieve. If 0, all peers are returned, irrespective of `maxBootstrapPeers`.\n * @param maxBootstrapPeers - The maximum number of bootstrap peers to retrieve.\n * @returns An array of peers based on the specified criteria.\n */\nfunction filterPeersByDiscovery(peers, numPeers, maxBootstrapPeers) {\n // Collect the bootstrap peers up to the specified maximum\n let bootstrapPeers = peers\n .filter((peer) => peer.tags.has(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP))\n .slice(0, maxBootstrapPeers);\n // If numPeers is less than the number of bootstrap peers, adjust the bootstrapPeers array\n if (numPeers > 0 && numPeers < bootstrapPeers.length) {\n bootstrapPeers = bootstrapPeers.slice(0, numPeers);\n }\n // Collect non-bootstrap peers\n const nonBootstrapPeers = peers.filter((peer) => !peer.tags.has(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP));\n // If numPeers is 0, return all peers\n if (numPeers === 0) {\n return [...bootstrapPeers, ...nonBootstrapPeers];\n }\n // Initialize the list of selected peers with the bootstrap peers\n const selectedPeers = [...bootstrapPeers];\n // Fill up to numPeers with remaining random peers if needed\n while (selectedPeers.length < numPeers && nonBootstrapPeers.length > 0) {\n const randomIndex = Math.floor(Math.random() * nonBootstrapPeers.length);\n const randomPeer = nonBootstrapPeers.splice(randomIndex, 1)[0];\n selectedPeers.push(randomPeer);\n }\n return selectedPeers;\n}\n//# sourceMappingURL=filterPeers.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/filterPeers.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/stream_manager.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/stream_manager.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ StreamManager: () => (/* binding */ StreamManager)\n/* harmony export */ });\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/libp2p */ \"./node_modules/@waku/utils/dist/libp2p/index.js\");\n\n\nclass StreamManager {\n multicodec;\n getConnections;\n addEventListener;\n streamPool;\n log;\n constructor(multicodec, getConnections, addEventListener) {\n this.multicodec = multicodec;\n this.getConnections = getConnections;\n this.addEventListener = addEventListener;\n this.log = new _waku_utils__WEBPACK_IMPORTED_MODULE_0__.Logger(`stream-manager:${multicodec}`);\n this.addEventListener(\"peer:update\", this.handlePeerUpdateStreamPool.bind(this));\n this.getStream = this.getStream.bind(this);\n this.streamPool = new Map();\n }\n async getStream(peer) {\n const peerIdStr = peer.id.toString();\n const streamPromise = this.streamPool.get(peerIdStr);\n if (!streamPromise) {\n return this.newStream(peer); // fallback by creating a new stream on the spot\n }\n // We have the stream, let's remove it from the map\n this.streamPool.delete(peerIdStr);\n this.prepareNewStream(peer);\n const stream = await streamPromise;\n if (!stream || stream.status === \"closed\") {\n return this.newStream(peer); // fallback by creating a new stream on the spot\n }\n return stream;\n }\n async newStream(peer) {\n const connections = this.getConnections(peer.id);\n const connection = (0,_waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__.selectConnection)(connections);\n if (!connection) {\n throw new Error(\"Failed to get a connection to the peer\");\n }\n return connection.newStream(this.multicodec);\n }\n prepareNewStream(peer) {\n const streamPromise = this.newStream(peer).catch(() => {\n // No error thrown as this call is not triggered by the user\n this.log.error(`Failed to prepare a new stream for ${peer.id.toString()}`);\n });\n this.streamPool.set(peer.id.toString(), streamPromise);\n }\n handlePeerUpdateStreamPool = (evt) => {\n const peer = evt.detail.peer;\n if (peer.protocols.includes(this.multicodec)) {\n this.log.info(`Preemptively opening a stream to ${peer.id.toString()}`);\n this.prepareNewStream(peer);\n }\n };\n}\n//# sourceMappingURL=stream_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/core/dist/lib/stream_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/constants.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/constants.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ERR_INVALID_ID: () => (/* binding */ ERR_INVALID_ID),\n/* harmony export */ ERR_NO_SIGNATURE: () => (/* binding */ ERR_NO_SIGNATURE),\n/* harmony export */ MAX_RECORD_SIZE: () => (/* binding */ MAX_RECORD_SIZE),\n/* harmony export */ MULTIADDR_LENGTH_SIZE: () => (/* binding */ MULTIADDR_LENGTH_SIZE)\n/* harmony export */ });\n// Maximum encoded size of an ENR\nconst MAX_RECORD_SIZE = 300;\nconst ERR_INVALID_ID = \"Invalid record id\";\nconst ERR_NO_SIGNATURE = \"No valid signature found\";\n// The maximum length of byte size of a multiaddr to encode in the `multiaddr` field\n// The size is a big endian 16-bit unsigned integer\nconst MULTIADDR_LENGTH_SIZE = 2;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/creator.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/creator.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EnrCreator: () => (/* binding */ EnrCreator)\n/* harmony export */ });\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/crypto.js\");\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/enr.js\");\n/* harmony import */ var _peer_id_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./peer_id.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/peer_id.js\");\n\n\n\n\nclass EnrCreator {\n static fromPublicKey(publicKey, kvs = {}) {\n // EIP-778 specifies that the key must be in compressed format, 33 bytes\n if (publicKey.length !== 33) {\n publicKey = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_1__.compressPublicKey)(publicKey);\n }\n return _enr_js__WEBPACK_IMPORTED_MODULE_2__.ENR.create({\n ...kvs,\n id: (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.utf8ToBytes)(\"v4\"),\n secp256k1: publicKey\n });\n }\n static async fromPeerId(peerId, kvs = {}) {\n switch (peerId.type) {\n case \"secp256k1\":\n return EnrCreator.fromPublicKey((0,_peer_id_js__WEBPACK_IMPORTED_MODULE_3__.getPublicKeyFromPeerId)(peerId), kvs);\n default:\n throw new Error();\n }\n }\n}\n//# sourceMappingURL=creator.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/creator.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/crypto.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/crypto.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compressPublicKey: () => (/* binding */ compressPublicKey),\n/* harmony export */ keccak256: () => (/* binding */ keccak256),\n/* harmony export */ sign: () => (/* binding */ sign),\n/* harmony export */ verifySignature: () => (/* binding */ verifySignature)\n/* harmony export */ });\n/* harmony import */ var _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/secp256k1 */ \"./node_modules/@noble/secp256k1/lib/esm/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! js-sha3 */ \"./node_modules/js-sha3/src/sha3.js\");\n\n\n\n/**\n * ECDSA Sign a message with the given private key.\n *\n * @param message The message to sign, usually a hash.\n * @param privateKey The ECDSA private key to use to sign the message.\n *\n * @returns The signature and the recovery id concatenated.\n */\nasync function sign(message, privateKey) {\n const [signature, recoveryId] = await _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.sign(message, privateKey, {\n recovered: true,\n der: false\n });\n return (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.concat)([signature, new Uint8Array([recoveryId])], signature.length + 1);\n}\nfunction keccak256(input) {\n return new Uint8Array(js_sha3__WEBPACK_IMPORTED_MODULE_2__.keccak256.arrayBuffer(input));\n}\nfunction compressPublicKey(publicKey) {\n if (publicKey.length === 64) {\n publicKey = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.concat)([new Uint8Array([4]), publicKey], 65);\n }\n const point = _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.Point.fromHex(publicKey);\n return point.toRawBytes(true);\n}\n/**\n * Verify an ECDSA signature.\n */\nfunction verifySignature(signature, message, publicKey) {\n try {\n const _signature = _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.Signature.fromCompact(signature.slice(0, 64));\n return _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.verify(_signature, message, publicKey);\n }\n catch {\n return false;\n }\n}\n//# sourceMappingURL=crypto.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/crypto.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/decoder.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/decoder.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EnrDecoder: () => (/* binding */ EnrDecoder)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/rlp */ \"./node_modules/@ethersproject/rlp/lib.esm/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/enr.js\");\n\n\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_0__.Logger(\"enr:decoder\");\nclass EnrDecoder {\n static fromString(encoded) {\n if (!encoded.startsWith(_enr_js__WEBPACK_IMPORTED_MODULE_3__.ENR.RECORD_PREFIX)) {\n throw new Error(`\"string encoded ENR must start with '${_enr_js__WEBPACK_IMPORTED_MODULE_3__.ENR.RECORD_PREFIX}'`);\n }\n return EnrDecoder.fromRLP((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(encoded.slice(4), \"base64url\"));\n }\n static fromRLP(encoded) {\n const decoded = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_4__.decode(encoded).map(_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.hexToBytes);\n return fromValues(decoded);\n }\n}\nasync function fromValues(values) {\n const { signature, seq, kvs } = checkValues(values);\n const obj = {};\n for (let i = 0; i < kvs.length; i += 2) {\n try {\n obj[(0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.bytesToUtf8)(kvs[i])] = kvs[i + 1];\n }\n catch (e) {\n log.error(\"Failed to decode ENR key to UTF-8, skipping it\", kvs[i], e);\n }\n }\n const _seq = decodeSeq(seq);\n const enr = await _enr_js__WEBPACK_IMPORTED_MODULE_3__.ENR.create(obj, _seq, signature);\n checkSignature(seq, kvs, enr, signature);\n return enr;\n}\nfunction decodeSeq(seq) {\n // If seq is an empty array, translate as value 0\n if (!seq.length)\n return BigInt(0);\n return BigInt(\"0x\" + (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.bytesToHex)(seq));\n}\nfunction checkValues(values) {\n if (!Array.isArray(values)) {\n throw new Error(\"Decoded ENR must be an array\");\n }\n if (values.length % 2 !== 0) {\n throw new Error(\"Decoded ENR must have an even number of elements\");\n }\n const [signature, seq, ...kvs] = values;\n if (!signature || Array.isArray(signature)) {\n throw new Error(\"Decoded ENR invalid signature: must be a byte array\");\n }\n if (!seq || Array.isArray(seq)) {\n throw new Error(\"Decoded ENR invalid sequence number: must be a byte array\");\n }\n return { signature, seq, kvs };\n}\nfunction checkSignature(seq, kvs, enr, signature) {\n const rlpEncodedBytes = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.hexToBytes)(_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_4__.encode([seq, ...kvs]));\n if (!enr.verify(rlpEncodedBytes, signature)) {\n throw new Error(\"Unable to verify ENR signature\");\n }\n}\n//# sourceMappingURL=decoder.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/decoder.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/enr.js":
|
||
/*!*************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/enr.js ***!
|
||
\*************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENR: () => (/* binding */ ENR),\n/* harmony export */ TransportProtocol: () => (/* binding */ TransportProtocol),\n/* harmony export */ TransportProtocolPerIpVersion: () => (/* binding */ TransportProtocolPerIpVersion)\n/* harmony export */ });\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/constants.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/crypto.js\");\n/* harmony import */ var _get_multiaddr_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./get_multiaddr.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/get_multiaddr.js\");\n/* harmony import */ var _peer_id_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer_id.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/peer_id.js\");\n/* harmony import */ var _raw_enr_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./raw_enr.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/raw_enr.js\");\n/* harmony import */ var _v4_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./v4.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/v4.js\");\n\n\n\n\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_0__.Logger(\"enr\");\nvar TransportProtocol;\n(function (TransportProtocol) {\n TransportProtocol[\"TCP\"] = \"tcp\";\n TransportProtocol[\"UDP\"] = \"udp\";\n})(TransportProtocol || (TransportProtocol = {}));\nvar TransportProtocolPerIpVersion;\n(function (TransportProtocolPerIpVersion) {\n TransportProtocolPerIpVersion[\"TCP4\"] = \"tcp4\";\n TransportProtocolPerIpVersion[\"UDP4\"] = \"udp4\";\n TransportProtocolPerIpVersion[\"TCP6\"] = \"tcp6\";\n TransportProtocolPerIpVersion[\"UDP6\"] = \"udp6\";\n})(TransportProtocolPerIpVersion || (TransportProtocolPerIpVersion = {}));\nclass ENR extends _raw_enr_js__WEBPACK_IMPORTED_MODULE_5__.RawEnr {\n static RECORD_PREFIX = \"enr:\";\n peerId;\n static async create(kvs = {}, seq = BigInt(1), signature) {\n const enr = new ENR(kvs, seq, signature);\n try {\n const publicKey = enr.publicKey;\n if (publicKey) {\n enr.peerId = await (0,_peer_id_js__WEBPACK_IMPORTED_MODULE_4__.createPeerIdFromPublicKey)(publicKey);\n }\n }\n catch (e) {\n log.error(\"Could not calculate peer id for ENR\", e);\n }\n return enr;\n }\n get nodeId() {\n switch (this.id) {\n case \"v4\":\n return this.publicKey ? _v4_js__WEBPACK_IMPORTED_MODULE_6__.nodeId(this.publicKey) : undefined;\n default:\n throw new Error(_constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_ID);\n }\n }\n getLocationMultiaddr = _get_multiaddr_js__WEBPACK_IMPORTED_MODULE_3__.locationMultiaddrFromEnrFields.bind({}, this);\n get shardInfo() {\n if (this.rs && this.rsv) {\n log.warn(\"ENR contains both `rs` and `rsv` fields.\");\n }\n return this.rs || this.rsv;\n }\n setLocationMultiaddr(multiaddr) {\n const protoNames = multiaddr.protoNames();\n if (protoNames.length !== 2 &&\n protoNames[1] !== \"udp\" &&\n protoNames[1] !== \"tcp\") {\n throw new Error(\"Invalid multiaddr\");\n }\n const tuples = multiaddr.tuples();\n if (!tuples[0][1] || !tuples[1][1]) {\n throw new Error(\"Invalid multiaddr\");\n }\n // IPv4\n if (tuples[0][0] === 4) {\n this.set(\"ip\", tuples[0][1]);\n this.set(protoNames[1], tuples[1][1]);\n }\n else {\n this.set(\"ip6\", tuples[0][1]);\n this.set(protoNames[1] + \"6\", tuples[1][1]);\n }\n }\n getAllLocationMultiaddrs() {\n const multiaddrs = [];\n for (const protocol of Object.values(TransportProtocolPerIpVersion)) {\n const ma = this.getLocationMultiaddr(protocol);\n if (ma)\n multiaddrs.push(ma);\n }\n const _multiaddrs = this.multiaddrs ?? [];\n return multiaddrs.concat(_multiaddrs).map((ma) => {\n if (this.peerId) {\n return ma.encapsulate(`/p2p/${this.peerId.toString()}`);\n }\n return ma;\n });\n }\n get peerInfo() {\n const id = this.peerId;\n if (!id)\n return;\n return {\n id,\n multiaddrs: this.getAllLocationMultiaddrs()\n };\n }\n /**\n * Returns the full multiaddr from the ENR fields matching the provided\n * `protocol` parameter.\n * To return full multiaddrs from the `multiaddrs` ENR field,\n * use { @link ENR.getFullMultiaddrs }.\n *\n * @param protocol\n */\n getFullMultiaddr(protocol) {\n if (this.peerId) {\n const locationMultiaddr = this.getLocationMultiaddr(protocol);\n if (locationMultiaddr) {\n return locationMultiaddr.encapsulate(`/p2p/${this.peerId.toString()}`);\n }\n }\n return;\n }\n /**\n * Returns the full multiaddrs from the `multiaddrs` ENR field.\n */\n getFullMultiaddrs() {\n if (this.peerId && this.multiaddrs) {\n const peerId = this.peerId;\n return this.multiaddrs.map((ma) => {\n return ma.encapsulate(`/p2p/${peerId.toString()}`);\n });\n }\n return [];\n }\n verify(data, signature) {\n if (!this.get(\"id\") || this.id !== \"v4\") {\n throw new Error(_constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_ID);\n }\n if (!this.publicKey) {\n throw new Error(\"Failed to verify ENR: No public key\");\n }\n return (0,_crypto_js__WEBPACK_IMPORTED_MODULE_2__.verifySignature)(signature, (0,_crypto_js__WEBPACK_IMPORTED_MODULE_2__.keccak256)(data), this.publicKey);\n }\n async sign(data, privateKey) {\n switch (this.id) {\n case \"v4\":\n this.signature = await _v4_js__WEBPACK_IMPORTED_MODULE_6__.sign(privateKey, data);\n break;\n default:\n throw new Error(_constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_ID);\n }\n return this.signature;\n }\n}\n//# sourceMappingURL=enr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/enr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/get_multiaddr.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/get_multiaddr.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ locationMultiaddrFromEnrFields: () => (/* binding */ locationMultiaddrFromEnrFields)\n/* harmony export */ });\n/* harmony import */ var _multiaddr_from_fields_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./multiaddr_from_fields.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/multiaddr_from_fields.js\");\n\nfunction locationMultiaddrFromEnrFields(enr, protocol) {\n switch (protocol) {\n case \"udp\":\n return (locationMultiaddrFromEnrFields(enr, \"udp4\") ||\n locationMultiaddrFromEnrFields(enr, \"udp6\"));\n case \"tcp\":\n return (locationMultiaddrFromEnrFields(enr, \"tcp4\") ||\n locationMultiaddrFromEnrFields(enr, \"tcp6\"));\n }\n const isIpv6 = protocol.endsWith(\"6\");\n const ipVal = enr.get(isIpv6 ? \"ip6\" : \"ip\");\n if (!ipVal)\n return;\n const protoName = protocol.slice(0, 3);\n let protoVal;\n switch (protoName) {\n case \"udp\":\n protoVal = isIpv6 ? enr.get(\"udp6\") : enr.get(\"udp\");\n break;\n case \"tcp\":\n protoVal = isIpv6 ? enr.get(\"tcp6\") : enr.get(\"tcp\");\n break;\n default:\n return;\n }\n if (!protoVal)\n return;\n return (0,_multiaddr_from_fields_js__WEBPACK_IMPORTED_MODULE_0__.multiaddrFromFields)(isIpv6 ? \"ip6\" : \"ip4\", protoName, ipVal, protoVal);\n}\n//# sourceMappingURL=get_multiaddr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/get_multiaddr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/index.js":
|
||
/*!***************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/index.js ***!
|
||
\***************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENR: () => (/* reexport safe */ _enr_js__WEBPACK_IMPORTED_MODULE_3__.ENR),\n/* harmony export */ ERR_INVALID_ID: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_ID),\n/* harmony export */ ERR_NO_SIGNATURE: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_NO_SIGNATURE),\n/* harmony export */ EnrCreator: () => (/* reexport safe */ _creator_js__WEBPACK_IMPORTED_MODULE_1__.EnrCreator),\n/* harmony export */ EnrDecoder: () => (/* reexport safe */ _decoder_js__WEBPACK_IMPORTED_MODULE_2__.EnrDecoder),\n/* harmony export */ MAX_RECORD_SIZE: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.MAX_RECORD_SIZE),\n/* harmony export */ MULTIADDR_LENGTH_SIZE: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.MULTIADDR_LENGTH_SIZE),\n/* harmony export */ TransportProtocol: () => (/* reexport safe */ _enr_js__WEBPACK_IMPORTED_MODULE_3__.TransportProtocol),\n/* harmony export */ TransportProtocolPerIpVersion: () => (/* reexport safe */ _enr_js__WEBPACK_IMPORTED_MODULE_3__.TransportProtocolPerIpVersion),\n/* harmony export */ compressPublicKey: () => (/* reexport safe */ _crypto_js__WEBPACK_IMPORTED_MODULE_6__.compressPublicKey),\n/* harmony export */ createPeerIdFromPublicKey: () => (/* reexport safe */ _peer_id_js__WEBPACK_IMPORTED_MODULE_4__.createPeerIdFromPublicKey),\n/* harmony export */ decodeWaku2: () => (/* reexport safe */ _waku2_codec_js__WEBPACK_IMPORTED_MODULE_5__.decodeWaku2),\n/* harmony export */ encodeWaku2: () => (/* reexport safe */ _waku2_codec_js__WEBPACK_IMPORTED_MODULE_5__.encodeWaku2),\n/* harmony export */ getPrivateKeyFromPeerId: () => (/* reexport safe */ _peer_id_js__WEBPACK_IMPORTED_MODULE_4__.getPrivateKeyFromPeerId),\n/* harmony export */ getPublicKeyFromPeerId: () => (/* reexport safe */ _peer_id_js__WEBPACK_IMPORTED_MODULE_4__.getPublicKeyFromPeerId),\n/* harmony export */ keccak256: () => (/* reexport safe */ _crypto_js__WEBPACK_IMPORTED_MODULE_6__.keccak256),\n/* harmony export */ sign: () => (/* reexport safe */ _crypto_js__WEBPACK_IMPORTED_MODULE_6__.sign),\n/* harmony export */ verifySignature: () => (/* reexport safe */ _crypto_js__WEBPACK_IMPORTED_MODULE_6__.verifySignature)\n/* harmony export */ });\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/constants.js\");\n/* harmony import */ var _creator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./creator.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/creator.js\");\n/* harmony import */ var _decoder_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./decoder.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/decoder.js\");\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/enr.js\");\n/* harmony import */ var _peer_id_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer_id.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/peer_id.js\");\n/* harmony import */ var _waku2_codec_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./waku2_codec.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/waku2_codec.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/crypto.js\");\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/multiaddr_from_fields.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/multiaddr_from_fields.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ multiaddrFromFields: () => (/* binding */ multiaddrFromFields)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiformats/multiaddr/convert */ \"./node_modules/@multiformats/multiaddr/dist/src/convert.js\");\n\n\nfunction multiaddrFromFields(ipFamily, protocol, ipBytes, protocolBytes) {\n let ma = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(\"/\" + ipFamily + \"/\" + (0,_multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_1__.convertToString)(ipFamily, ipBytes));\n ma = ma.encapsulate((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(\"/\" + protocol + \"/\" + (0,_multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_1__.convertToString)(protocol, protocolBytes)));\n return ma;\n}\n//# sourceMappingURL=multiaddr_from_fields.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/multiaddr_from_fields.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/multiaddrs_codec.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/multiaddrs_codec.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeMultiaddrs: () => (/* binding */ decodeMultiaddrs),\n/* harmony export */ encodeMultiaddrs: () => (/* binding */ encodeMultiaddrs)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/constants.js\");\n\n\nfunction decodeMultiaddrs(bytes) {\n const multiaddrs = [];\n let index = 0;\n while (index < bytes.length) {\n const sizeDataView = new DataView(bytes.buffer, index, _constants_js__WEBPACK_IMPORTED_MODULE_1__.MULTIADDR_LENGTH_SIZE);\n const size = sizeDataView.getUint16(0);\n index += _constants_js__WEBPACK_IMPORTED_MODULE_1__.MULTIADDR_LENGTH_SIZE;\n const multiaddrBytes = bytes.slice(index, index + size);\n index += size;\n multiaddrs.push((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(multiaddrBytes));\n }\n return multiaddrs;\n}\nfunction encodeMultiaddrs(multiaddrs) {\n const totalLength = multiaddrs.reduce((acc, ma) => acc + _constants_js__WEBPACK_IMPORTED_MODULE_1__.MULTIADDR_LENGTH_SIZE + ma.bytes.length, 0);\n const bytes = new Uint8Array(totalLength);\n const dataView = new DataView(bytes.buffer);\n let index = 0;\n multiaddrs.forEach((multiaddr) => {\n if (multiaddr.getPeerId())\n throw new Error(\"`multiaddr` field MUST not contain peer id\");\n // Prepend the size of the next entry\n dataView.setUint16(index, multiaddr.bytes.length);\n index += _constants_js__WEBPACK_IMPORTED_MODULE_1__.MULTIADDR_LENGTH_SIZE;\n bytes.set(multiaddr.bytes, index);\n index += multiaddr.bytes.length;\n });\n return bytes;\n}\n//# sourceMappingURL=multiaddrs_codec.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/multiaddrs_codec.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/peer_id.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/peer_id.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createPeerIdFromPublicKey: () => (/* binding */ createPeerIdFromPublicKey),\n/* harmony export */ getPrivateKeyFromPeerId: () => (/* binding */ getPrivateKeyFromPeerId),\n/* harmony export */ getPublicKeyFromPeerId: () => (/* binding */ getPublicKeyFromPeerId)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n\n\n\nfunction createPeerIdFromPublicKey(publicKey) {\n const _publicKey = new _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.supportedKeys.secp256k1.Secp256k1PublicKey(publicKey);\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromKeys)(_publicKey.bytes, undefined);\n}\nfunction getPublicKeyFromPeerId(peerId) {\n if (peerId.type !== \"secp256k1\") {\n throw new Error(\"Unsupported peer id type\");\n }\n return (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPublicKey)(peerId.publicKey).marshal();\n}\n// Only used in tests\nasync function getPrivateKeyFromPeerId(peerId) {\n if (peerId.type !== \"secp256k1\") {\n throw new Error(\"Unsupported peer id type\");\n }\n if (!peerId.privateKey) {\n throw new Error(\"Private key not present on peer id\");\n }\n const privateKey = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPrivateKey)(peerId.privateKey);\n return privateKey.marshal();\n}\n//# sourceMappingURL=peer_id.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/peer_id.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/raw_enr.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/raw_enr.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RawEnr: () => (/* binding */ RawEnr)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr/convert */ \"./node_modules/@multiformats/multiaddr/dist/src/convert.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/constants.js\");\n/* harmony import */ var _multiaddrs_codec_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./multiaddrs_codec.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/multiaddrs_codec.js\");\n/* harmony import */ var _waku2_codec_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./waku2_codec.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/waku2_codec.js\");\n\n\n\n\n\n\nclass RawEnr extends Map {\n seq;\n signature;\n constructor(kvs = {}, seq = BigInt(1), signature) {\n super(Object.entries(kvs));\n this.seq = seq;\n this.signature = signature;\n }\n set(k, v) {\n this.signature = undefined;\n this.seq++;\n return super.set(k, v);\n }\n get id() {\n const id = this.get(\"id\");\n if (!id)\n throw new Error(\"id not found.\");\n return (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_2__.bytesToUtf8)(id);\n }\n get publicKey() {\n switch (this.id) {\n case \"v4\":\n return this.get(\"secp256k1\");\n default:\n throw new Error(_constants_js__WEBPACK_IMPORTED_MODULE_3__.ERR_INVALID_ID);\n }\n }\n get rs() {\n const rs = this.get(\"rs\");\n if (!rs)\n return undefined;\n return (0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.decodeRelayShard)(rs);\n }\n get rsv() {\n const rsv = this.get(\"rsv\");\n if (!rsv)\n return undefined;\n return (0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.decodeRelayShard)(rsv);\n }\n get ip() {\n return getStringValue(this, \"ip\", \"ip4\");\n }\n set ip(ip) {\n setStringValue(this, \"ip\", \"ip4\", ip);\n }\n get tcp() {\n return getNumberAsStringValue(this, \"tcp\", \"tcp\");\n }\n set tcp(port) {\n setNumberAsStringValue(this, \"tcp\", \"tcp\", port);\n }\n get udp() {\n return getNumberAsStringValue(this, \"udp\", \"udp\");\n }\n set udp(port) {\n setNumberAsStringValue(this, \"udp\", \"udp\", port);\n }\n get ip6() {\n return getStringValue(this, \"ip6\", \"ip6\");\n }\n set ip6(ip) {\n setStringValue(this, \"ip6\", \"ip6\", ip);\n }\n get tcp6() {\n return getNumberAsStringValue(this, \"tcp6\", \"tcp\");\n }\n set tcp6(port) {\n setNumberAsStringValue(this, \"tcp6\", \"tcp\", port);\n }\n get udp6() {\n return getNumberAsStringValue(this, \"udp6\", \"udp\");\n }\n set udp6(port) {\n setNumberAsStringValue(this, \"udp6\", \"udp\", port);\n }\n /**\n * Get the `multiaddrs` field from ENR.\n *\n * This field is used to store multiaddresses that cannot be stored with the current ENR pre-defined keys.\n * These can be a multiaddresses that include encapsulation (e.g. wss) or do not use `ip4` nor `ip6` for the host\n * address (e.g. `dns4`, `dnsaddr`, etc)..\n *\n * If the peer information only contains information that can be represented with the ENR pre-defined keys\n * (ip, tcp, etc) then the usage of { @link ENR.getLocationMultiaddr } should be preferred.\n *\n * The multiaddresses stored in this field are expected to be location multiaddresses, ie, peer id less.\n */\n get multiaddrs() {\n const raw = this.get(\"multiaddrs\");\n if (raw)\n return (0,_multiaddrs_codec_js__WEBPACK_IMPORTED_MODULE_4__.decodeMultiaddrs)(raw);\n return;\n }\n /**\n * Set the `multiaddrs` field on the ENR.\n *\n * This field is used to store multiaddresses that cannot be stored with the current ENR pre-defined keys.\n * These can be a multiaddresses that include encapsulation (e.g. wss) or do not use `ip4` nor `ip6` for the host\n * address (e.g. `dns4`, `dnsaddr`, etc)..\n *\n * If the peer information only contains information that can be represented with the ENR pre-defined keys\n * (ip, tcp, etc) then the usage of { @link ENR.setLocationMultiaddr } should be preferred.\n * The multiaddresses stored in this field must be location multiaddresses,\n * ie, without a peer id.\n */\n set multiaddrs(multiaddrs) {\n deleteUndefined(this, \"multiaddrs\", multiaddrs, _multiaddrs_codec_js__WEBPACK_IMPORTED_MODULE_4__.encodeMultiaddrs);\n }\n /**\n * Get the `waku2` field from ENR.\n */\n get waku2() {\n const raw = this.get(\"waku2\");\n if (raw)\n return (0,_waku2_codec_js__WEBPACK_IMPORTED_MODULE_5__.decodeWaku2)(raw[0]);\n return;\n }\n /**\n * Set the `waku2` field on the ENR.\n */\n set waku2(waku2) {\n deleteUndefined(this, \"waku2\", waku2, (w) => new Uint8Array([(0,_waku2_codec_js__WEBPACK_IMPORTED_MODULE_5__.encodeWaku2)(w)]));\n }\n}\nfunction getStringValue(map, key, proto) {\n const raw = map.get(key);\n if (!raw)\n return;\n return (0,_multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__.convertToString)(proto, raw);\n}\nfunction getNumberAsStringValue(map, key, proto) {\n const raw = map.get(key);\n if (!raw)\n return;\n return Number((0,_multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__.convertToString)(proto, raw));\n}\nfunction setStringValue(map, key, proto, value) {\n deleteUndefined(map, key, value, _multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__.convertToBytes.bind({}, proto));\n}\nfunction setNumberAsStringValue(map, key, proto, value) {\n setStringValue(map, key, proto, value?.toString(10));\n}\nfunction deleteUndefined(map, key, value, transform) {\n if (value !== undefined) {\n map.set(key, transform(value));\n }\n else {\n map.delete(key);\n }\n}\n//# sourceMappingURL=raw_enr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/raw_enr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/v4.js":
|
||
/*!************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/v4.js ***!
|
||
\************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ nodeId: () => (/* binding */ nodeId),\n/* harmony export */ sign: () => (/* binding */ sign)\n/* harmony export */ });\n/* harmony import */ var _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/secp256k1 */ \"./node_modules/@noble/secp256k1/lib/esm/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/discovery/node_modules/@waku/enr/dist/crypto.js\");\n\n\n\nasync function sign(privKey, msg) {\n return _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.sign((0,_crypto_js__WEBPACK_IMPORTED_MODULE_2__.keccak256)(msg), privKey, {\n der: false\n });\n}\nfunction nodeId(pubKey) {\n const publicKey = _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.Point.fromHex(pubKey);\n const uncompressedPubkey = publicKey.toRawBytes(false);\n return (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.bytesToHex)((0,_crypto_js__WEBPACK_IMPORTED_MODULE_2__.keccak256)(uncompressedPubkey.slice(1)));\n}\n//# sourceMappingURL=v4.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/v4.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/enr/dist/waku2_codec.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/enr/dist/waku2_codec.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeWaku2: () => (/* binding */ decodeWaku2),\n/* harmony export */ encodeWaku2: () => (/* binding */ encodeWaku2)\n/* harmony export */ });\nfunction encodeWaku2(protocols) {\n let byte = 0;\n if (protocols.lightPush)\n byte += 1;\n byte = byte << 1;\n if (protocols.filter)\n byte += 1;\n byte = byte << 1;\n if (protocols.store)\n byte += 1;\n byte = byte << 1;\n if (protocols.relay)\n byte += 1;\n return byte;\n}\nfunction decodeWaku2(byte) {\n const waku2 = {\n relay: false,\n store: false,\n filter: false,\n lightPush: false\n };\n if (byte % 2)\n waku2.relay = true;\n byte = byte >> 1;\n if (byte % 2)\n waku2.store = true;\n byte = byte >> 1;\n if (byte % 2)\n waku2.filter = true;\n byte = byte >> 1;\n if (byte % 2)\n waku2.lightPush = true;\n return waku2;\n}\n//# sourceMappingURL=waku2_codec.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/enr/dist/waku2_codec.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/connection_manager.js":
|
||
/*!***********************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/connection_manager.js ***!
|
||
\***********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EConnectionStateEvents: () => (/* binding */ EConnectionStateEvents),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* binding */ EPeersByDiscoveryEvents),\n/* harmony export */ Tags: () => (/* binding */ Tags)\n/* harmony export */ });\nvar Tags;\n(function (Tags) {\n Tags[\"BOOTSTRAP\"] = \"bootstrap\";\n Tags[\"PEER_EXCHANGE\"] = \"peer-exchange\";\n Tags[\"LOCAL\"] = \"local-peer-cache\";\n})(Tags || (Tags = {}));\nvar EPeersByDiscoveryEvents;\n(function (EPeersByDiscoveryEvents) {\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_BOOTSTRAP\"] = \"peer:discovery:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_PEER_EXCHANGE\"] = \"peer:discovery:peer-exchange\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_BOOTSTRAP\"] = \"peer:connected:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_PEER_EXCHANGE\"] = \"peer:connected:peer-exchange\";\n})(EPeersByDiscoveryEvents || (EPeersByDiscoveryEvents = {}));\nvar EConnectionStateEvents;\n(function (EConnectionStateEvents) {\n EConnectionStateEvents[\"CONNECTION_STATUS\"] = \"waku:connection\";\n})(EConnectionStateEvents || (EConnectionStateEvents = {}));\n//# sourceMappingURL=connection_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/connection_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/constants.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/constants.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_CLUSTER_ID: () => (/* binding */ DEFAULT_CLUSTER_ID),\n/* harmony export */ DefaultPubsubTopic: () => (/* binding */ DefaultPubsubTopic)\n/* harmony export */ });\n/**\n * DefaultPubsubTopic is the default gossipsub topic to use for Waku.\n */\nconst DefaultPubsubTopic = \"/waku/2/default-waku/proto\";\n/**\n * The default cluster ID for The Waku Network\n */\nconst DEFAULT_CLUSTER_ID = 1;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/dns_discovery.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/dns_discovery.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=dns_discovery.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/dns_discovery.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/enr.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/enr.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=enr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/enr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/filter.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/filter.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=filter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/filter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/index.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/index.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_CLUSTER_ID: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_17__.DEFAULT_CLUSTER_ID),\n/* harmony export */ DefaultPubsubTopic: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_17__.DefaultPubsubTopic),\n/* harmony export */ EConnectionStateEvents: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.EConnectionStateEvents),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.EPeersByDiscoveryEvents),\n/* harmony export */ PageDirection: () => (/* reexport safe */ _store_js__WEBPACK_IMPORTED_MODULE_7__.PageDirection),\n/* harmony export */ ProtocolError: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.ProtocolError),\n/* harmony export */ Protocols: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.Protocols),\n/* harmony export */ Tags: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.Tags)\n/* harmony export */ });\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/enr.js\");\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filter.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/filter.js\");\n/* harmony import */ var _light_push_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./light_push.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/light_push.js\");\n/* harmony import */ var _message_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/message.js\");\n/* harmony import */ var _peer_exchange_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer_exchange.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/peer_exchange.js\");\n/* harmony import */ var _protocols_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./protocols.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/protocols.js\");\n/* harmony import */ var _relay_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./relay.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/relay.js\");\n/* harmony import */ var _store_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./store.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/store.js\");\n/* harmony import */ var _waku_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./waku.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/waku.js\");\n/* harmony import */ var _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./connection_manager.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/connection_manager.js\");\n/* harmony import */ var _sender_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sender.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/sender.js\");\n/* harmony import */ var _receiver_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./receiver.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/receiver.js\");\n/* harmony import */ var _misc_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./misc.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/misc.js\");\n/* harmony import */ var _libp2p_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./libp2p.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/libp2p.js\");\n/* harmony import */ var _keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./keep_alive_manager.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/keep_alive_manager.js\");\n/* harmony import */ var _dns_discovery_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./dns_discovery.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/dns_discovery.js\");\n/* harmony import */ var _metadata_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./metadata.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/metadata.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/constants.js\");\n/* harmony import */ var _local_storage_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./local_storage.js */ \"./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/local_storage.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/keep_alive_manager.js":
|
||
/*!***********************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/keep_alive_manager.js ***!
|
||
\***********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=keep_alive_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/keep_alive_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/libp2p.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/libp2p.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=libp2p.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/libp2p.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/light_push.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/light_push.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/light_push.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/local_storage.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/local_storage.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=local_storage.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/local_storage.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/message.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/message.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/metadata.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/metadata.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=metadata.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/metadata.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/misc.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/misc.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=misc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/misc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/peer_exchange.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/peer_exchange.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=peer_exchange.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/peer_exchange.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/protocols.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/protocols.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ProtocolError: () => (/* binding */ ProtocolError),\n/* harmony export */ Protocols: () => (/* binding */ Protocols)\n/* harmony export */ });\nvar Protocols;\n(function (Protocols) {\n Protocols[\"Relay\"] = \"relay\";\n Protocols[\"Store\"] = \"store\";\n Protocols[\"LightPush\"] = \"lightpush\";\n Protocols[\"Filter\"] = \"filter\";\n})(Protocols || (Protocols = {}));\nvar ProtocolError;\n(function (ProtocolError) {\n /** Could not determine the origin of the fault. Best to check connectivity and try again */\n ProtocolError[\"GENERIC_FAIL\"] = \"Generic error\";\n /**\n * Failure to protobuf encode the message. This is not recoverable and needs\n * further investigation.\n */\n ProtocolError[\"ENCODE_FAILED\"] = \"Failed to encode\";\n /**\n * Failure to protobuf decode the message. May be due to a remote peer issue,\n * ensuring that messages are sent via several peer enable mitigation of this error.\n */\n ProtocolError[\"DECODE_FAILED\"] = \"Failed to decode\";\n /**\n * The message payload is empty, making the message invalid. Ensure that a non-empty\n * payload is set on the outgoing message.\n */\n ProtocolError[\"EMPTY_PAYLOAD\"] = \"Payload is empty\";\n /**\n * The message size is above the maximum message size allowed on the Waku Network.\n * Compressing the message or using an alternative strategy for large messages is recommended.\n */\n ProtocolError[\"SIZE_TOO_BIG\"] = \"Size is too big\";\n /**\n * The PubsubTopic passed to the send function is not configured on the Waku node.\n * Please ensure that the PubsubTopic is used when initializing the Waku node.\n */\n ProtocolError[\"TOPIC_NOT_CONFIGURED\"] = \"Topic not configured\";\n /**\n * Failure to find a peer with suitable protocols. This may due to a connection issue.\n * Mitigation can be: retrying after a given time period, display connectivity issue\n * to user or listening for `peer:connected:bootstrap` or `peer:connected:peer-exchange`\n * on the connection manager before retrying.\n */\n ProtocolError[\"NO_PEER_AVAILABLE\"] = \"No peer available\";\n /**\n * The remote peer did not behave as expected. Mitigation for `NO_PEER_AVAILABLE`\n * or `DECODE_FAILED` can be used.\n */\n ProtocolError[\"REMOTE_PEER_FAULT\"] = \"Remote peer fault\";\n /**\n * The remote peer rejected the message. Information provided by the remote peer\n * is logged. Review message validity, or mitigation for `NO_PEER_AVAILABLE`\n * or `DECODE_FAILED` can be used.\n */\n ProtocolError[\"REMOTE_PEER_REJECTED\"] = \"Remote peer rejected\";\n /**\n * The protocol request timed out without a response. This may be due to a connection issue.\n * Mitigation can be: retrying after a given time period\n */\n ProtocolError[\"REQUEST_TIMEOUT\"] = \"Request timeout\";\n})(ProtocolError || (ProtocolError = {}));\n//# sourceMappingURL=protocols.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/protocols.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/receiver.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/receiver.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=receiver.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/receiver.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/relay.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/relay.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=relay.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/relay.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/sender.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/sender.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=sender.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/sender.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/store.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/store.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PageDirection: () => (/* binding */ PageDirection)\n/* harmony export */ });\nvar PageDirection;\n(function (PageDirection) {\n PageDirection[\"BACKWARD\"] = \"backward\";\n PageDirection[\"FORWARD\"] = \"forward\";\n})(PageDirection || (PageDirection = {}));\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/store.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/waku.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/waku.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=waku.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/interfaces/dist/waku.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/filter.js":
|
||
/*!****************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/filter.js ***!
|
||
\****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterRequest: () => (/* binding */ FilterRequest),\n/* harmony export */ FilterRpc: () => (/* binding */ FilterRpc),\n/* harmony export */ MessagePush: () => (/* binding */ MessagePush),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar FilterRequest;\n(function (FilterRequest) {\n let ContentFilter;\n (function (ContentFilter) {\n let _codec;\n ContentFilter.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(10);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.contentTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ContentFilter.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ContentFilter.codec());\n };\n ContentFilter.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ContentFilter.codec(), opts);\n };\n })(ContentFilter = FilterRequest.ContentFilter || (FilterRequest.ContentFilter = {}));\n let _codec;\n FilterRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.subscribe != null && obj.subscribe !== false)) {\n w.uint32(8);\n w.bool(obj.subscribe);\n }\n if ((obj.topic != null && obj.topic !== '')) {\n w.uint32(18);\n w.string(obj.topic);\n }\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n w.uint32(26);\n FilterRequest.ContentFilter.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n subscribe: false,\n topic: '',\n contentFilters: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.subscribe = reader.bool();\n break;\n }\n case 2: {\n obj.topic = reader.string();\n break;\n }\n case 3: {\n if (opts.limits?.contentFilters != null && obj.contentFilters.length === opts.limits.contentFilters) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"contentFilters\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.contentFilters.push(FilterRequest.ContentFilter.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.contentFilters$\n }));\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterRequest.codec());\n };\n FilterRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterRequest.codec(), opts);\n };\n})(FilterRequest || (FilterRequest = {}));\nvar MessagePush;\n(function (MessagePush) {\n let _codec;\n MessagePush.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.messages != null) {\n for (const value of obj.messages) {\n w.uint32(10);\n WakuMessage.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n messages: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"messages\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.messages$\n }));\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n MessagePush.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, MessagePush.codec());\n };\n MessagePush.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, MessagePush.codec(), opts);\n };\n})(MessagePush || (MessagePush = {}));\nvar FilterRpc;\n(function (FilterRpc) {\n let _codec;\n FilterRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.request != null) {\n w.uint32(18);\n FilterRequest.codec().encode(obj.request, w);\n }\n if (obj.push != null) {\n w.uint32(26);\n MessagePush.codec().encode(obj.push, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.request = FilterRequest.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.request\n });\n break;\n }\n case 3: {\n obj.push = MessagePush.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.push\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterRpc.codec());\n };\n FilterRpc.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterRpc.codec(), opts);\n };\n})(FilterRpc || (FilterRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=filter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/filter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/filter_v2.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/filter_v2.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterSubscribeRequest: () => (/* binding */ FilterSubscribeRequest),\n/* harmony export */ FilterSubscribeResponse: () => (/* binding */ FilterSubscribeResponse),\n/* harmony export */ MessagePush: () => (/* binding */ MessagePush),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar FilterSubscribeRequest;\n(function (FilterSubscribeRequest) {\n let FilterSubscribeType;\n (function (FilterSubscribeType) {\n FilterSubscribeType[\"SUBSCRIBER_PING\"] = \"SUBSCRIBER_PING\";\n FilterSubscribeType[\"SUBSCRIBE\"] = \"SUBSCRIBE\";\n FilterSubscribeType[\"UNSUBSCRIBE\"] = \"UNSUBSCRIBE\";\n FilterSubscribeType[\"UNSUBSCRIBE_ALL\"] = \"UNSUBSCRIBE_ALL\";\n })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));\n let __FilterSubscribeTypeValues;\n (function (__FilterSubscribeTypeValues) {\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"SUBSCRIBER_PING\"] = 0] = \"SUBSCRIBER_PING\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"SUBSCRIBE\"] = 1] = \"SUBSCRIBE\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"UNSUBSCRIBE\"] = 2] = \"UNSUBSCRIBE\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"UNSUBSCRIBE_ALL\"] = 3] = \"UNSUBSCRIBE_ALL\";\n })(__FilterSubscribeTypeValues || (__FilterSubscribeTypeValues = {}));\n (function (FilterSubscribeType) {\n FilterSubscribeType.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__FilterSubscribeTypeValues);\n };\n })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));\n let _codec;\n FilterSubscribeRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.filterSubscribeType != null && __FilterSubscribeTypeValues[obj.filterSubscribeType] !== 0) {\n w.uint32(16);\n FilterSubscribeRequest.FilterSubscribeType.codec().encode(obj.filterSubscribeType, w);\n }\n if (obj.pubsubTopic != null) {\n w.uint32(82);\n w.string(obj.pubsubTopic);\n }\n if (obj.contentTopics != null) {\n for (const value of obj.contentTopics) {\n w.uint32(90);\n w.string(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: '',\n filterSubscribeType: FilterSubscribeType.SUBSCRIBER_PING,\n contentTopics: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.filterSubscribeType = FilterSubscribeRequest.FilterSubscribeType.codec().decode(reader);\n break;\n }\n case 10: {\n obj.pubsubTopic = reader.string();\n break;\n }\n case 11: {\n if (opts.limits?.contentTopics != null && obj.contentTopics.length === opts.limits.contentTopics) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"contentTopics\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.contentTopics.push(reader.string());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterSubscribeRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterSubscribeRequest.codec());\n };\n FilterSubscribeRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterSubscribeRequest.codec(), opts);\n };\n})(FilterSubscribeRequest || (FilterSubscribeRequest = {}));\nvar FilterSubscribeResponse;\n(function (FilterSubscribeResponse) {\n let _codec;\n FilterSubscribeResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if ((obj.statusCode != null && obj.statusCode !== 0)) {\n w.uint32(80);\n w.uint32(obj.statusCode);\n }\n if (obj.statusDesc != null) {\n w.uint32(90);\n w.string(obj.statusDesc);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: '',\n statusCode: 0\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 10: {\n obj.statusCode = reader.uint32();\n break;\n }\n case 11: {\n obj.statusDesc = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterSubscribeResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterSubscribeResponse.codec());\n };\n FilterSubscribeResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterSubscribeResponse.codec(), opts);\n };\n})(FilterSubscribeResponse || (FilterSubscribeResponse = {}));\nvar MessagePush;\n(function (MessagePush) {\n let _codec;\n MessagePush.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.wakuMessage != null) {\n w.uint32(10);\n WakuMessage.codec().encode(obj.wakuMessage, w);\n }\n if (obj.pubsubTopic != null) {\n w.uint32(18);\n w.string(obj.pubsubTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.wakuMessage = WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.wakuMessage\n });\n break;\n }\n case 2: {\n obj.pubsubTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n MessagePush.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, MessagePush.codec());\n };\n MessagePush.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, MessagePush.codec(), opts);\n };\n})(MessagePush || (MessagePush = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=filter_v2.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/filter_v2.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/light_push.js":
|
||
/*!********************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/light_push.js ***!
|
||
\********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushRequest: () => (/* binding */ PushRequest),\n/* harmony export */ PushResponse: () => (/* binding */ PushResponse),\n/* harmony export */ PushRpc: () => (/* binding */ PushRpc),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar PushRequest;\n(function (PushRequest) {\n let _codec;\n PushRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {\n w.uint32(10);\n w.string(obj.pubsubTopic);\n }\n if (obj.message != null) {\n w.uint32(18);\n WakuMessage.codec().encode(obj.message, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n pubsubTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.pubsubTopic = reader.string();\n break;\n }\n case 2: {\n obj.message = WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.message\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushRequest.codec());\n };\n PushRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushRequest.codec(), opts);\n };\n})(PushRequest || (PushRequest = {}));\nvar PushResponse;\n(function (PushResponse) {\n let _codec;\n PushResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.isSuccess != null && obj.isSuccess !== false)) {\n w.uint32(8);\n w.bool(obj.isSuccess);\n }\n if (obj.info != null) {\n w.uint32(18);\n w.string(obj.info);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n isSuccess: false\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.isSuccess = reader.bool();\n break;\n }\n case 2: {\n obj.info = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushResponse.codec());\n };\n PushResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushResponse.codec(), opts);\n };\n})(PushResponse || (PushResponse = {}));\nvar PushRpc;\n(function (PushRpc) {\n let _codec;\n PushRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.request != null) {\n w.uint32(18);\n PushRequest.codec().encode(obj.request, w);\n }\n if (obj.response != null) {\n w.uint32(26);\n PushResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.request = PushRequest.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.request\n });\n break;\n }\n case 3: {\n obj.response = PushResponse.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.response\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushRpc.codec());\n };\n PushRpc.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushRpc.codec(), opts);\n };\n})(PushRpc || (PushRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/light_push.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/message.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/message.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/metadata.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/metadata.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WakuMetadataRequest: () => (/* binding */ WakuMetadataRequest),\n/* harmony export */ WakuMetadataResponse: () => (/* binding */ WakuMetadataResponse)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar WakuMetadataRequest;\n(function (WakuMetadataRequest) {\n let _codec;\n WakuMetadataRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.clusterId != null) {\n w.uint32(8);\n w.uint32(obj.clusterId);\n }\n if (obj.shards != null) {\n for (const value of obj.shards) {\n w.uint32(16);\n w.uint32(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n shards: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.clusterId = reader.uint32();\n break;\n }\n case 2: {\n if (opts.limits?.shards != null && obj.shards.length === opts.limits.shards) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"shards\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.shards.push(reader.uint32());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMetadataRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMetadataRequest.codec());\n };\n WakuMetadataRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMetadataRequest.codec(), opts);\n };\n})(WakuMetadataRequest || (WakuMetadataRequest = {}));\nvar WakuMetadataResponse;\n(function (WakuMetadataResponse) {\n let _codec;\n WakuMetadataResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.clusterId != null) {\n w.uint32(8);\n w.uint32(obj.clusterId);\n }\n if (obj.shards != null) {\n for (const value of obj.shards) {\n w.uint32(16);\n w.uint32(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n shards: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.clusterId = reader.uint32();\n break;\n }\n case 2: {\n if (opts.limits?.shards != null && obj.shards.length === opts.limits.shards) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"shards\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.shards.push(reader.uint32());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMetadataResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMetadataResponse.codec());\n };\n WakuMetadataResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMetadataResponse.codec(), opts);\n };\n})(WakuMetadataResponse || (WakuMetadataResponse = {}));\n//# sourceMappingURL=metadata.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/metadata.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/peer_exchange.js":
|
||
/*!***********************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/peer_exchange.js ***!
|
||
\***********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerExchangeQuery: () => (/* binding */ PeerExchangeQuery),\n/* harmony export */ PeerExchangeRPC: () => (/* binding */ PeerExchangeRPC),\n/* harmony export */ PeerExchangeResponse: () => (/* binding */ PeerExchangeResponse),\n/* harmony export */ PeerInfo: () => (/* binding */ PeerInfo)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar PeerInfo;\n(function (PeerInfo) {\n let _codec;\n PeerInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.enr != null) {\n w.uint32(10);\n w.bytes(obj.enr);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.enr = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerInfo.codec());\n };\n PeerInfo.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerInfo.codec(), opts);\n };\n})(PeerInfo || (PeerInfo = {}));\nvar PeerExchangeQuery;\n(function (PeerExchangeQuery) {\n let _codec;\n PeerExchangeQuery.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.numPeers != null) {\n w.uint32(8);\n w.uint64(obj.numPeers);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.numPeers = reader.uint64();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeQuery.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeQuery.codec());\n };\n PeerExchangeQuery.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeQuery.codec(), opts);\n };\n})(PeerExchangeQuery || (PeerExchangeQuery = {}));\nvar PeerExchangeResponse;\n(function (PeerExchangeResponse) {\n let _codec;\n PeerExchangeResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.peerInfos != null) {\n for (const value of obj.peerInfos) {\n w.uint32(10);\n PeerInfo.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n peerInfos: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (opts.limits?.peerInfos != null && obj.peerInfos.length === opts.limits.peerInfos) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"peerInfos\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.peerInfos.push(PeerInfo.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.peerInfos$\n }));\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeResponse.codec());\n };\n PeerExchangeResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeResponse.codec(), opts);\n };\n})(PeerExchangeResponse || (PeerExchangeResponse = {}));\nvar PeerExchangeRPC;\n(function (PeerExchangeRPC) {\n let _codec;\n PeerExchangeRPC.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.query != null) {\n w.uint32(10);\n PeerExchangeQuery.codec().encode(obj.query, w);\n }\n if (obj.response != null) {\n w.uint32(18);\n PeerExchangeResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.query = PeerExchangeQuery.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.query\n });\n break;\n }\n case 2: {\n obj.response = PeerExchangeResponse.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.response\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeRPC.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeRPC.codec());\n };\n PeerExchangeRPC.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeRPC.codec(), opts);\n };\n})(PeerExchangeRPC || (PeerExchangeRPC = {}));\n//# sourceMappingURL=peer_exchange.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/peer_exchange.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/store.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/store.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContentFilter: () => (/* binding */ ContentFilter),\n/* harmony export */ HistoryQuery: () => (/* binding */ HistoryQuery),\n/* harmony export */ HistoryResponse: () => (/* binding */ HistoryResponse),\n/* harmony export */ HistoryRpc: () => (/* binding */ HistoryRpc),\n/* harmony export */ Index: () => (/* binding */ Index),\n/* harmony export */ PagingInfo: () => (/* binding */ PagingInfo),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar Index;\n(function (Index) {\n let _codec;\n Index.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.digest != null && obj.digest.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.digest);\n }\n if ((obj.receiverTime != null && obj.receiverTime !== 0n)) {\n w.uint32(16);\n w.sint64(obj.receiverTime);\n }\n if ((obj.senderTime != null && obj.senderTime !== 0n)) {\n w.uint32(24);\n w.sint64(obj.senderTime);\n }\n if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {\n w.uint32(34);\n w.string(obj.pubsubTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n digest: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n receiverTime: 0n,\n senderTime: 0n,\n pubsubTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.digest = reader.bytes();\n break;\n }\n case 2: {\n obj.receiverTime = reader.sint64();\n break;\n }\n case 3: {\n obj.senderTime = reader.sint64();\n break;\n }\n case 4: {\n obj.pubsubTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Index.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Index.codec());\n };\n Index.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Index.codec(), opts);\n };\n})(Index || (Index = {}));\nvar PagingInfo;\n(function (PagingInfo) {\n let Direction;\n (function (Direction) {\n Direction[\"BACKWARD\"] = \"BACKWARD\";\n Direction[\"FORWARD\"] = \"FORWARD\";\n })(Direction = PagingInfo.Direction || (PagingInfo.Direction = {}));\n let __DirectionValues;\n (function (__DirectionValues) {\n __DirectionValues[__DirectionValues[\"BACKWARD\"] = 0] = \"BACKWARD\";\n __DirectionValues[__DirectionValues[\"FORWARD\"] = 1] = \"FORWARD\";\n })(__DirectionValues || (__DirectionValues = {}));\n (function (Direction) {\n Direction.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__DirectionValues);\n };\n })(Direction = PagingInfo.Direction || (PagingInfo.Direction = {}));\n let _codec;\n PagingInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.pageSize != null) {\n w.uint32(8);\n w.uint64(obj.pageSize);\n }\n if (obj.cursor != null) {\n w.uint32(18);\n Index.codec().encode(obj.cursor, w);\n }\n if (obj.direction != null) {\n w.uint32(24);\n PagingInfo.Direction.codec().encode(obj.direction, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.pageSize = reader.uint64();\n break;\n }\n case 2: {\n obj.cursor = Index.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.cursor\n });\n break;\n }\n case 3: {\n obj.direction = PagingInfo.Direction.codec().decode(reader);\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PagingInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PagingInfo.codec());\n };\n PagingInfo.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PagingInfo.codec(), opts);\n };\n})(PagingInfo || (PagingInfo = {}));\nvar ContentFilter;\n(function (ContentFilter) {\n let _codec;\n ContentFilter.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(10);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.contentTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ContentFilter.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ContentFilter.codec());\n };\n ContentFilter.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ContentFilter.codec(), opts);\n };\n})(ContentFilter || (ContentFilter = {}));\nvar HistoryQuery;\n(function (HistoryQuery) {\n let _codec;\n HistoryQuery.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.pubsubTopic != null) {\n w.uint32(18);\n w.string(obj.pubsubTopic);\n }\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n w.uint32(26);\n ContentFilter.codec().encode(value, w);\n }\n }\n if (obj.pagingInfo != null) {\n w.uint32(34);\n PagingInfo.codec().encode(obj.pagingInfo, w);\n }\n if (obj.startTime != null) {\n w.uint32(40);\n w.sint64(obj.startTime);\n }\n if (obj.endTime != null) {\n w.uint32(48);\n w.sint64(obj.endTime);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentFilters: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2: {\n obj.pubsubTopic = reader.string();\n break;\n }\n case 3: {\n if (opts.limits?.contentFilters != null && obj.contentFilters.length === opts.limits.contentFilters) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"contentFilters\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.contentFilters.push(ContentFilter.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.contentFilters$\n }));\n break;\n }\n case 4: {\n obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.pagingInfo\n });\n break;\n }\n case 5: {\n obj.startTime = reader.sint64();\n break;\n }\n case 6: {\n obj.endTime = reader.sint64();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryQuery.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryQuery.codec());\n };\n HistoryQuery.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryQuery.codec(), opts);\n };\n})(HistoryQuery || (HistoryQuery = {}));\nvar HistoryResponse;\n(function (HistoryResponse) {\n let HistoryError;\n (function (HistoryError) {\n HistoryError[\"NONE\"] = \"NONE\";\n HistoryError[\"INVALID_CURSOR\"] = \"INVALID_CURSOR\";\n HistoryError[\"TOO_MANY_RESULTS\"] = \"TOO_MANY_RESULTS\";\n HistoryError[\"SERVICE_UNAVAILABLE\"] = \"SERVICE_UNAVAILABLE\";\n })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));\n let __HistoryErrorValues;\n (function (__HistoryErrorValues) {\n __HistoryErrorValues[__HistoryErrorValues[\"NONE\"] = 0] = \"NONE\";\n __HistoryErrorValues[__HistoryErrorValues[\"INVALID_CURSOR\"] = 1] = \"INVALID_CURSOR\";\n __HistoryErrorValues[__HistoryErrorValues[\"TOO_MANY_RESULTS\"] = 429] = \"TOO_MANY_RESULTS\";\n __HistoryErrorValues[__HistoryErrorValues[\"SERVICE_UNAVAILABLE\"] = 503] = \"SERVICE_UNAVAILABLE\";\n })(__HistoryErrorValues || (__HistoryErrorValues = {}));\n (function (HistoryError) {\n HistoryError.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__HistoryErrorValues);\n };\n })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));\n let _codec;\n HistoryResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.messages != null) {\n for (const value of obj.messages) {\n w.uint32(18);\n WakuMessage.codec().encode(value, w);\n }\n }\n if (obj.pagingInfo != null) {\n w.uint32(26);\n PagingInfo.codec().encode(obj.pagingInfo, w);\n }\n if (obj.error != null && __HistoryErrorValues[obj.error] !== 0) {\n w.uint32(32);\n HistoryResponse.HistoryError.codec().encode(obj.error, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n messages: [],\n error: HistoryError.NONE\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2: {\n if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"messages\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.messages$\n }));\n break;\n }\n case 3: {\n obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.pagingInfo\n });\n break;\n }\n case 4: {\n obj.error = HistoryResponse.HistoryError.codec().decode(reader);\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryResponse.codec());\n };\n HistoryResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryResponse.codec(), opts);\n };\n})(HistoryResponse || (HistoryResponse = {}));\nvar HistoryRpc;\n(function (HistoryRpc) {\n let _codec;\n HistoryRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.query != null) {\n w.uint32(18);\n HistoryQuery.codec().encode(obj.query, w);\n }\n if (obj.response != null) {\n w.uint32(26);\n HistoryResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.query = HistoryQuery.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.query\n });\n break;\n }\n case 3: {\n obj.response = HistoryResponse.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.response\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryRpc.codec());\n };\n HistoryRpc.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryRpc.codec(), opts);\n };\n})(HistoryRpc || (HistoryRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/store.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/topic_only_message.js":
|
||
/*!****************************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/topic_only_message.js ***!
|
||
\****************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TopicOnlyMessage: () => (/* binding */ TopicOnlyMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar TopicOnlyMessage;\n(function (TopicOnlyMessage) {\n let _codec;\n TopicOnlyMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n TopicOnlyMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, TopicOnlyMessage.codec());\n };\n TopicOnlyMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, TopicOnlyMessage.codec(), opts);\n };\n})(TopicOnlyMessage || (TopicOnlyMessage = {}));\n//# sourceMappingURL=topic_only_message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/topic_only_message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/@waku/proto/dist/index.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/@waku/proto/dist/index.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushResponse: () => (/* reexport safe */ _generated_light_push_js__WEBPACK_IMPORTED_MODULE_4__.PushResponse),\n/* harmony export */ TopicOnlyMessage: () => (/* reexport safe */ _generated_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__.TopicOnlyMessage),\n/* harmony export */ WakuMessage: () => (/* reexport safe */ _generated_filter_js__WEBPACK_IMPORTED_MODULE_1__.WakuMessage),\n/* harmony export */ proto_filter: () => (/* reexport module object */ _generated_filter_js__WEBPACK_IMPORTED_MODULE_1__),\n/* harmony export */ proto_filter_v2: () => (/* reexport module object */ _generated_filter_v2_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ proto_lightpush: () => (/* reexport module object */ _generated_light_push_js__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ proto_message: () => (/* reexport module object */ _generated_message_js__WEBPACK_IMPORTED_MODULE_0__),\n/* harmony export */ proto_metadata: () => (/* reexport module object */ _generated_metadata_js__WEBPACK_IMPORTED_MODULE_7__),\n/* harmony export */ proto_peer_exchange: () => (/* reexport module object */ _generated_peer_exchange_js__WEBPACK_IMPORTED_MODULE_6__),\n/* harmony export */ proto_store: () => (/* reexport module object */ _generated_store_js__WEBPACK_IMPORTED_MODULE_5__),\n/* harmony export */ proto_topic_only_message: () => (/* reexport module object */ _generated_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__)\n/* harmony export */ });\n/* harmony import */ var _generated_message_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./generated/message.js */ \"./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/message.js\");\n/* harmony import */ var _generated_filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./generated/filter.js */ \"./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/filter.js\");\n/* harmony import */ var _generated_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./generated/topic_only_message.js */ \"./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/topic_only_message.js\");\n/* harmony import */ var _generated_filter_v2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./generated/filter_v2.js */ \"./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/filter_v2.js\");\n/* harmony import */ var _generated_light_push_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generated/light_push.js */ \"./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/light_push.js\");\n/* harmony import */ var _generated_store_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./generated/store.js */ \"./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/store.js\");\n/* harmony import */ var _generated_peer_exchange_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./generated/peer_exchange.js */ \"./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/peer_exchange.js\");\n/* harmony import */ var _generated_metadata_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./generated/metadata.js */ \"./node_modules/@waku/discovery/node_modules/@waku/proto/dist/generated/metadata.js\");\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/@waku/proto/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/discovery/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/chachapoly.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/chachapoly.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ChaChaPoly: () => (/* binding */ ChaChaPoly)\n/* harmony export */ });\n/* harmony import */ var _stablelib_chacha20poly1305__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @stablelib/chacha20poly1305 */ \"./node_modules/@stablelib/chacha20poly1305/lib/chacha20poly1305.js\");\n\nclass ChaChaPoly {\n encrypt(k, nonce, ad, plaintext) {\n const ctx = new _stablelib_chacha20poly1305__WEBPACK_IMPORTED_MODULE_0__.ChaCha20Poly1305(k);\n const n = nonce.getBytes(true);\n return ctx.seal(n, plaintext, ad);\n }\n decrypt(k, nonce, ad, ciphertext) {\n const ctx = new _stablelib_chacha20poly1305__WEBPACK_IMPORTED_MODULE_0__.ChaCha20Poly1305(k);\n const n = nonce.getBytes(true);\n return ctx.open(n, ciphertext, ad);\n }\n}\n//# sourceMappingURL=chachapoly.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/chachapoly.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/codec.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/codec.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ NoiseHandshakeDecoder: () => (/* binding */ NoiseHandshakeDecoder),\n/* harmony export */ NoiseHandshakeEncoder: () => (/* binding */ NoiseHandshakeEncoder),\n/* harmony export */ NoiseHandshakeMessage: () => (/* binding */ NoiseHandshakeMessage),\n/* harmony export */ NoiseSecureMessage: () => (/* binding */ NoiseSecureMessage),\n/* harmony export */ NoiseSecureTransferDecoder: () => (/* binding */ NoiseSecureTransferDecoder),\n/* harmony export */ NoiseSecureTransferEncoder: () => (/* binding */ NoiseSecureTransferEncoder)\n/* harmony export */ });\n/* harmony import */ var _waku_core_lib_message_version_0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/core/lib/message/version_0 */ \"./node_modules/@waku/core/dist/lib/message/version_0.js\");\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var _payload_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./payload.js */ \"./node_modules/@waku/noise/dist/payload.js\");\n\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_2__(\"waku:message:noise-codec\");\nconst OneMillion = BigInt(1000000);\n// WakuMessage version for noise protocol\nconst version = 2;\n/**\n * Used internally in the pairing object to represent a handshake message\n */\nclass NoiseHandshakeMessage extends _waku_core_lib_message_version_0__WEBPACK_IMPORTED_MODULE_0__.DecodedMessage {\n get payloadV2() {\n if (!this.payload)\n throw new Error(\"no payload available\");\n return _payload_js__WEBPACK_IMPORTED_MODULE_3__.PayloadV2.deserialize(this.payload);\n }\n}\n/**\n * Used in the pairing object for encoding the messages exchanged\n * during the handshake process\n */\nclass NoiseHandshakeEncoder {\n /**\n * @param pubsubTopic pubsub topic on which handshake happens\n * @param contentTopic content topic on which the encoded WakuMessages will be sent\n * @param hsStepResult the result of a step executed while performing the handshake process\n * @param ephemeral makes messages ephemeral in the Waku network\n */\n constructor(contentTopic, pubsubTopic, hsStepResult, ephemeral = true) {\n this.contentTopic = contentTopic;\n this.pubsubTopic = pubsubTopic;\n this.hsStepResult = hsStepResult;\n this.ephemeral = ephemeral;\n }\n async toWire(message) {\n const protoMessage = await this.toProtoObj(message);\n if (!protoMessage)\n return;\n return _waku_proto__WEBPACK_IMPORTED_MODULE_1__.WakuMessage.encode(protoMessage);\n }\n async toProtoObj(message) {\n const timestamp = message.timestamp ?? new Date();\n return {\n ephemeral: this.ephemeral,\n rateLimitProof: undefined,\n payload: this.hsStepResult.payload2.serialize(),\n version: version,\n meta: undefined,\n contentTopic: this.contentTopic,\n timestamp: BigInt(timestamp.valueOf()) * OneMillion,\n };\n }\n}\n/**\n * Used in the pairing object for decoding the messages exchanged\n * during the handshake process\n */\nclass NoiseHandshakeDecoder {\n /**\n * @param pubsubTopic pubsub topic on which handshake happens\n * @param contentTopic content topic on which the encoded WakuMessages were sent\n */\n constructor(contentTopic, pubsubTopic) {\n this.contentTopic = contentTopic;\n this.pubsubTopic = pubsubTopic;\n }\n fromWireToProtoObj(bytes) {\n const protoMessage = _waku_proto__WEBPACK_IMPORTED_MODULE_1__.WakuMessage.decode(bytes);\n log(\"Message decoded\", protoMessage);\n return Promise.resolve(protoMessage);\n }\n async fromProtoObj(pubSubTopic, proto) {\n // https://github.com/status-im/js-waku/issues/921\n if (proto.version === undefined) {\n proto.version = 0;\n }\n if (proto.version !== version) {\n log(\"Failed to decode due to incorrect version, expected:\", version, \", actual:\", proto.version);\n return Promise.resolve(undefined);\n }\n if (!proto.payload) {\n log(\"No payload, skipping: \", proto);\n return;\n }\n return new NoiseHandshakeMessage(pubSubTopic, proto);\n }\n}\n/**\n * Represents a secure message. These are messages that are transmitted\n * after a successful handshake is performed.\n */\nclass NoiseSecureMessage extends _waku_core_lib_message_version_0__WEBPACK_IMPORTED_MODULE_0__.DecodedMessage {\n constructor(pubSubTopic, proto, decodedPayload) {\n super(pubSubTopic, proto);\n this._decodedPayload = decodedPayload;\n this.pubsubTopic = pubSubTopic;\n }\n get payload() {\n return this._decodedPayload;\n }\n}\n/**\n * js-waku encoder for secure messages. After a handshake is successful, a\n * codec for encoding messages is generated. The messages encoded with this\n * codec will be encrypted with the cipherstates and message nametags that were\n * created after a handshake is complete\n */\nclass NoiseSecureTransferEncoder {\n /**\n * @param contentTopic content topic on which the encoded WakuMessages were sent.\n * @param pubsubTopic pubsub topic on which handshake happens\n * @param hsResult handshake result obtained after the handshake is successful.\n * @param ephemeral whether messages should be tagged as ephemeral defaults to true.\n * @param metaSetter callback function that set the `meta` field.\n */\n constructor(contentTopic, pubsubTopic, hsResult, ephemeral = true, metaSetter) {\n this.contentTopic = contentTopic;\n this.pubsubTopic = pubsubTopic;\n this.hsResult = hsResult;\n this.ephemeral = ephemeral;\n this.metaSetter = metaSetter;\n }\n async toWire(message) {\n const protoMessage = await this.toProtoObj(message);\n if (!protoMessage)\n return;\n return _waku_proto__WEBPACK_IMPORTED_MODULE_1__.WakuMessage.encode(protoMessage);\n }\n async toProtoObj(message) {\n const timestamp = message.timestamp ?? new Date();\n if (!message.payload) {\n log(\"No payload to encrypt, skipping: \", message);\n return;\n }\n const preparedPayload = this.hsResult.writeMessage(message.payload);\n const payload = preparedPayload.serialize();\n const protoMessage = {\n payload,\n rateLimitProof: undefined,\n ephemeral: this.ephemeral,\n version: version,\n meta: undefined,\n contentTopic: this.contentTopic,\n timestamp: BigInt(timestamp.valueOf()) * OneMillion,\n };\n if (this.metaSetter) {\n const meta = this.metaSetter(protoMessage);\n return { ...protoMessage, meta };\n }\n return protoMessage;\n }\n}\n/**\n * js-waku decoder for secure messages. After a handshake is successful, a codec\n * for decoding messages is generated. This decoder will attempt to decrypt\n * messages with the cipherstates and message nametags that were created after a\n * handshake is complete\n */\nclass NoiseSecureTransferDecoder {\n /**\n * @param contentTopic content topic on which the encoded WakuMessages were sent\n * @param pubsubTopic pubsub topic on which handshake happens\n * @param hsResult handshake result obtained after the handshake is successful\n */\n constructor(contentTopic, pubsubTopic, hsResult) {\n this.contentTopic = contentTopic;\n this.pubsubTopic = pubsubTopic;\n this.hsResult = hsResult;\n }\n fromWireToProtoObj(bytes) {\n const protoMessage = _waku_proto__WEBPACK_IMPORTED_MODULE_1__.WakuMessage.decode(bytes);\n log(\"Message decoded\", protoMessage);\n return Promise.resolve(protoMessage);\n }\n async fromProtoObj(pubSubTopic, proto) {\n // https://github.com/status-im/js-waku/issues/921\n if (proto.version === undefined) {\n proto.version = 0;\n }\n if (proto.version !== version) {\n log(\"Failed to decode due to incorrect version, expected:\", version, \", actual:\", proto.version);\n return Promise.resolve(undefined);\n }\n if (!proto.payload) {\n log(\"No payload, skipping: \", proto);\n return;\n }\n try {\n const payloadV2 = _payload_js__WEBPACK_IMPORTED_MODULE_3__.PayloadV2.deserialize(proto.payload);\n const decryptedPayload = this.hsResult.readMessage(payloadV2);\n return new NoiseSecureMessage(pubSubTopic, proto, decryptedPayload);\n }\n catch (err) {\n log(\"could not decode message \", err);\n return;\n }\n }\n}\n//# sourceMappingURL=codec.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/codec.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/crypto.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/crypto.js ***!
|
||
\*************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HKDF: () => (/* binding */ HKDF),\n/* harmony export */ commitPublicKey: () => (/* binding */ commitPublicKey),\n/* harmony export */ hash: () => (/* binding */ hash)\n/* harmony export */ });\n/* harmony import */ var _stablelib_hkdf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @stablelib/hkdf */ \"./node_modules/@stablelib/hkdf/lib/hkdf.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n\n\n/**\n * HKDF key derivation function\n * @param ck chaining key\n * @param ikm input key material\n * @param length length of each generated key\n * @param numKeys number of keys to generate\n * @returns array of `numValues` length containing Uint8Array keys of a given byte `length`\n */\nfunction HKDF(hash, ck, ikm, length, numKeys) {\n const numBytes = length * numKeys;\n const okm = new _stablelib_hkdf__WEBPACK_IMPORTED_MODULE_0__.HKDF(hash, ikm, ck).expand(numBytes);\n const result = [];\n for (let i = 0; i < numBytes; i += length) {\n const k = okm.subarray(i, i + length);\n result.push(k);\n }\n return result;\n}\nfunction hash(hash, data) {\n const h = new hash();\n h.update(data);\n const digest = h.digest();\n h.clean();\n return digest;\n}\n/**\n * Generates a random static key commitment using a public key pk for randomness r as H(pk || s)\n * @param h Hash function\n * @param publicKey x25519 public key\n * @param r random fixed-length value\n * @returns 32 byte hash\n */\nfunction commitPublicKey(h, publicKey, r) {\n const data = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__.concat)([publicKey, r]);\n return hash(h, data);\n}\n//# sourceMappingURL=crypto.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/crypto.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/dh25519.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/dh25519.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DH25519: () => (/* binding */ DH25519)\n/* harmony export */ });\n/* harmony import */ var _stablelib_x25519__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @stablelib/x25519 */ \"./node_modules/@stablelib/x25519/lib/x25519.js\");\n\nclass DH25519 {\n intoKey(s) {\n if (s.length != _stablelib_x25519__WEBPACK_IMPORTED_MODULE_0__.PUBLIC_KEY_LENGTH) {\n throw new Error(\"invalid public key length\");\n }\n return s;\n }\n generateKeyPair() {\n const keypair = _stablelib_x25519__WEBPACK_IMPORTED_MODULE_0__.generateKeyPair();\n return {\n publicKey: keypair.publicKey,\n privateKey: keypair.secretKey,\n };\n }\n generateKeyPairFromSeed(seed) {\n const keypair = _stablelib_x25519__WEBPACK_IMPORTED_MODULE_0__.generateKeyPairFromSeed(seed);\n return {\n publicKey: keypair.publicKey,\n privateKey: keypair.secretKey,\n };\n }\n DH(privateKey, publicKey) {\n try {\n const derivedU8 = _stablelib_x25519__WEBPACK_IMPORTED_MODULE_0__.sharedKey(privateKey, publicKey);\n if (derivedU8.length === 32) {\n return derivedU8;\n }\n return derivedU8.subarray(0, 32);\n }\n catch (e) {\n console.error(e);\n return new Uint8Array(32);\n }\n }\n DHLen() {\n return _stablelib_x25519__WEBPACK_IMPORTED_MODULE_0__.PUBLIC_KEY_LENGTH;\n }\n}\n//# sourceMappingURL=dh25519.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/dh25519.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/handshake.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/handshake.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Handshake: () => (/* binding */ Handshake),\n/* harmony export */ HandshakeResult: () => (/* binding */ HandshakeResult),\n/* harmony export */ HandshakeStepResult: () => (/* binding */ HandshakeStepResult),\n/* harmony export */ MessageNametagError: () => (/* binding */ MessageNametagError)\n/* harmony export */ });\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\n/* harmony import */ var pkcs7_padding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! pkcs7-padding */ \"./node_modules/pkcs7-padding/index.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/noise/dist/crypto.js\");\n/* harmony import */ var _handshake_state_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./handshake_state.js */ \"./node_modules/@waku/noise/dist/handshake_state.js\");\n/* harmony import */ var _messagenametag_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./messagenametag.js */ \"./node_modules/@waku/noise/dist/messagenametag.js\");\n/* harmony import */ var _patterns_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./patterns.js */ \"./node_modules/@waku/noise/dist/patterns.js\");\n/* harmony import */ var _payload_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./payload.js */ \"./node_modules/@waku/noise/dist/payload.js\");\n\n\n\n\n\n\n\n\n// Noise state machine\n// While processing messages patterns, users either:\n// - read (decrypt) the other party's (encrypted) transport message\n// - write (encrypt) a message, sent through a PayloadV2\n// These two intermediate results are stored in the HandshakeStepResult data structure\nclass HandshakeStepResult {\n constructor() {\n this.payload2 = new _payload_js__WEBPACK_IMPORTED_MODULE_7__.PayloadV2();\n this.transportMessage = new Uint8Array();\n }\n equals(b) {\n return this.payload2.equals(b.payload2) && (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.transportMessage, b.transportMessage);\n }\n clone() {\n const r = new HandshakeStepResult();\n r.transportMessage = new Uint8Array(this.transportMessage);\n r.payload2 = this.payload2.clone();\n return r;\n }\n}\n// When a handshake is complete, the HandshakeResult will contain the two\n// Cipher States used to encrypt/decrypt outbound/inbound messages\n// The recipient static key rs and handshake hash values h are stored to address some possible future applications (channel-binding, session management, etc.).\n// However, are not required by Noise specifications and are thus optional\nclass HandshakeResult {\n constructor(csOutbound, csInbound) {\n this.csOutbound = csOutbound;\n this.csInbound = csInbound;\n // Optional fields:\n this.nametagsInbound = new _messagenametag_js__WEBPACK_IMPORTED_MODULE_5__.MessageNametagBuffer();\n this.nametagsOutbound = new _messagenametag_js__WEBPACK_IMPORTED_MODULE_5__.MessageNametagBuffer();\n this.rs = new Uint8Array();\n this.h = new Uint8Array();\n }\n getCSOutbound() {\n return this.csOutbound;\n }\n getCSInbound() {\n return this.csInbound;\n }\n // Noise specification, Section 5:\n // Transport messages are then encrypted and decrypted by calling EncryptWithAd()\n // and DecryptWithAd() on the relevant CipherState with zero-length associated data.\n // If DecryptWithAd() signals an error due to DECRYPT() failure, then the input message is discarded.\n // The application may choose to delete the CipherState and terminate the session on such an error,\n // or may continue to attempt communications. If EncryptWithAd() or DecryptWithAd() signal an error\n // due to nonce exhaustion, then the application must delete the CipherState and terminate the session.\n // Writes an encrypted message using the proper Cipher State\n writeMessage(transportMessage, outboundMessageNametagBuffer = undefined) {\n const payload2 = new _payload_js__WEBPACK_IMPORTED_MODULE_7__.PayloadV2();\n // We set the message nametag using the input buffer\n payload2.messageNametag = (outboundMessageNametagBuffer ?? this.nametagsOutbound).pop();\n // According to 35/WAKU2-NOISE RFC, no Handshake protocol information is sent when exchanging messages\n // This correspond to setting protocol-id to 0\n payload2.protocolId = 0;\n // We pad the transport message\n const paddedTransportMessage = pkcs7_padding__WEBPACK_IMPORTED_MODULE_1__.pad(transportMessage, _handshake_state_js__WEBPACK_IMPORTED_MODULE_4__.NoisePaddingBlockSize);\n // Encryption is done with zero-length associated data as per specification\n payload2.transportMessage = this.csOutbound.encryptWithAd(payload2.messageNametag, paddedTransportMessage);\n return payload2;\n }\n // Reads an encrypted message using the proper Cipher State\n // Decryption is attempted only if the input PayloadV2 has a messageNametag equal to the one expected\n readMessage(readPayload2, inboundMessageNametagBuffer = undefined) {\n // The output decrypted message\n let message = new Uint8Array();\n // If the message nametag does not correspond to the nametag expected in the inbound message nametag buffer\n // an error is raised (to be handled externally, i.e. re-request lost messages, discard, etc.)\n const nametagIsOk = (inboundMessageNametagBuffer ?? this.nametagsInbound).checkNametag(readPayload2.messageNametag);\n if (!nametagIsOk) {\n throw new Error(\"nametag is not ok\");\n }\n // At this point the messageNametag matches the expected nametag.\n // According to 35/WAKU2-NOISE RFC, no Handshake protocol information is sent when exchanging messages\n if (readPayload2.protocolId == 0) {\n // On application level we decide to discard messages which fail decryption, without raising an error\n try {\n // Decryption is done with messageNametag as associated data\n const paddedMessage = this.csInbound.decryptWithAd(readPayload2.messageNametag, readPayload2.transportMessage);\n // We unpad the decrypted message\n message = pkcs7_padding__WEBPACK_IMPORTED_MODULE_1__.unpad(paddedMessage);\n // The message successfully decrypted, we can delete the first element of the inbound Message Nametag Buffer\n this.nametagsInbound.delete(1);\n }\n catch (err) {\n console.debug(\"A read message failed decryption. Returning empty message as plaintext.\");\n message = new Uint8Array();\n }\n }\n return message;\n }\n}\nclass MessageNametagError extends Error {\n constructor(expectedNametag, actualNametag) {\n super(\"the message nametag of the read message doesn't match the expected one\");\n this.expectedNametag = expectedNametag;\n this.actualNametag = actualNametag;\n this.name = \"MessageNametagError\";\n }\n}\nclass Handshake {\n constructor({ hsPattern, ephemeralKey, staticKey, prologue = new Uint8Array(), psk = new Uint8Array(), preMessagePKs = [], initiator = false, }) {\n this.hs = new _handshake_state_js__WEBPACK_IMPORTED_MODULE_4__.HandshakeState(hsPattern, psk);\n this.hs.ss.mixHash(prologue);\n this.hs.e = ephemeralKey;\n this.hs.s = staticKey;\n this.hs.psk = psk;\n this.hs.msgPatternIdx = 0;\n this.hs.initiator = initiator;\n // We process any eventual handshake pre-message pattern by processing pre-message public keys\n this.hs.processPreMessagePatternTokens(preMessagePKs);\n }\n equals(b) {\n return this.hs.equals(b.hs);\n }\n clone() {\n const result = new Handshake({\n hsPattern: this.hs.handshakePattern,\n });\n result.hs = this.hs.clone();\n return result;\n }\n // Generates an 8 decimal digits authorization code using HKDF and the handshake state\n genAuthcode() {\n const [output0] = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_3__.HKDF)(this.hs.handshakePattern.hash, this.hs.ss.h, new Uint8Array(), 8, 1);\n const bn = new bn_js__WEBPACK_IMPORTED_MODULE_0__.BN(output0);\n const code = bn.mod(new bn_js__WEBPACK_IMPORTED_MODULE_0__.BN(100000000)).toString().padStart(8, \"0\");\n return code.toString();\n }\n // Advances 1 step in handshake\n // Each user in a handshake alternates writing and reading of handshake messages.\n // If the user is writing the handshake message, the transport message (if not empty) and eventually a non-empty message nametag has to be passed to transportMessage and messageNametag and readPayloadV2 can be left to its default value\n // It the user is reading the handshake message, the read payload v2 has to be passed to readPayloadV2 and the transportMessage can be left to its default values. Decryption is skipped if the PayloadV2 read doesn't have a message nametag equal to messageNametag (empty input nametags are converted to all-0 MessageNametagLength bytes arrays)\n stepHandshake({ readPayloadV2 = new _payload_js__WEBPACK_IMPORTED_MODULE_7__.PayloadV2(), transportMessage = new Uint8Array(), messageNametag = new Uint8Array(), }) {\n const hsStepResult = new HandshakeStepResult();\n // If there are no more message patterns left for processing\n // we return an empty HandshakeStepResult\n if (this.hs.msgPatternIdx > this.hs.handshakePattern.messagePatterns.length - 1) {\n console.debug(\"stepHandshake called more times than the number of message patterns present in handshake\");\n return hsStepResult;\n }\n // We process the next handshake message pattern\n // We get if the user is reading or writing the input handshake message\n const direction = this.hs.handshakePattern.messagePatterns[this.hs.msgPatternIdx].direction;\n const { reading, writing } = this.hs.getReadingWritingState(direction);\n // If we write an answer at this handshake step\n if (writing) {\n // We initialize a payload v2 and we set proper protocol ID (if supported)\n const protocolId = _patterns_js__WEBPACK_IMPORTED_MODULE_6__.PayloadV2ProtocolIDs[this.hs.handshakePattern.name];\n if (protocolId === undefined) {\n throw new Error(\"handshake pattern not supported\");\n }\n hsStepResult.payload2.protocolId = protocolId;\n // We set the messageNametag and the handshake and transport messages\n hsStepResult.payload2.messageNametag = (0,_messagenametag_js__WEBPACK_IMPORTED_MODULE_5__.toMessageNametag)(messageNametag);\n hsStepResult.payload2.handshakeMessage = this.hs.processMessagePatternTokens();\n // We write the payload by passing the messageNametag as extra additional data\n hsStepResult.payload2.transportMessage = this.hs.processMessagePatternPayload(transportMessage, hsStepResult.payload2.messageNametag);\n // If we read an answer during this handshake step\n }\n else if (reading) {\n // If the read message nametag doesn't match the expected input one we raise an error\n const expectedNametag = (0,_messagenametag_js__WEBPACK_IMPORTED_MODULE_5__.toMessageNametag)(messageNametag);\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(readPayloadV2.messageNametag, expectedNametag)) {\n throw new MessageNametagError(expectedNametag, readPayloadV2.messageNametag);\n }\n // We process the read public keys and (eventually decrypt) the read transport message\n const readHandshakeMessage = readPayloadV2.handshakeMessage;\n const readTransportMessage = readPayloadV2.transportMessage;\n // Since we only read, nothing meaningful (i.e. public keys) is returned\n this.hs.processMessagePatternTokens(readHandshakeMessage);\n // We retrieve and store the (decrypted) received transport message by passing the messageNametag as extra additional data\n hsStepResult.transportMessage = this.hs.processMessagePatternPayload(readTransportMessage, readPayloadV2.messageNametag);\n }\n else {\n throw new Error(\"handshake Error: neither writing or reading user\");\n }\n // We increase the handshake state message pattern index to progress to next step\n this.hs.msgPatternIdx += 1;\n return hsStepResult;\n }\n // Finalizes the handshake by calling Split and assigning the proper Cipher States to users\n finalizeHandshake() {\n let hsResult;\n // Noise specification, Section 5:\n // Processing the final handshake message returns two CipherState objects,\n // the first for encrypting transport messages from initiator to responder,\n // and the second for messages in the other direction.\n // We call Split()\n const { cs1, cs2 } = this.hs.ss.split();\n // Optional: We derive a secret for the nametag derivation\n const { nms1, nms2 } = this.hs.genMessageNametagSecrets();\n // We assign the proper Cipher States\n if (this.hs.initiator) {\n hsResult = new HandshakeResult(cs1, cs2);\n // and nametags secrets\n hsResult.nametagsInbound.secret = nms1;\n hsResult.nametagsOutbound.secret = nms2;\n }\n else {\n hsResult = new HandshakeResult(cs2, cs1);\n // and nametags secrets\n hsResult.nametagsInbound.secret = nms2;\n hsResult.nametagsOutbound.secret = nms1;\n }\n // We initialize the message nametags inbound/outbound buffers\n hsResult.nametagsInbound.initNametagsBuffer();\n hsResult.nametagsOutbound.initNametagsBuffer();\n if (!this.hs.rs)\n throw new Error(\"invalid handshake state\");\n // We store the optional fields rs and h\n hsResult.rs = new Uint8Array(this.hs.rs);\n hsResult.h = new Uint8Array(this.hs.ss.h);\n return hsResult;\n }\n}\n//# sourceMappingURL=handshake.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/handshake.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/handshake_state.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/handshake_state.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HandshakeState: () => (/* binding */ HandshakeState),\n/* harmony export */ NoisePaddingBlockSize: () => (/* binding */ NoisePaddingBlockSize)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var pkcs7_padding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! pkcs7-padding */ \"./node_modules/pkcs7-padding/index.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/noise/dist/crypto.js\");\n/* harmony import */ var _messagenametag_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./messagenametag.js */ \"./node_modules/@waku/noise/dist/messagenametag.js\");\n/* harmony import */ var _noise_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./noise.js */ \"./node_modules/@waku/noise/dist/noise.js\");\n/* harmony import */ var _patterns_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./patterns.js */ \"./node_modules/@waku/noise/dist/patterns.js\");\n/* harmony import */ var _publickey_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./publickey.js */ \"./node_modules/@waku/noise/dist/publickey.js\");\n\n\n\n\n\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_0__(\"waku:noise:handshake-state\");\n// The padding blocksize of a transport message\nconst NoisePaddingBlockSize = 248;\n// The Handshake State as in https://noiseprotocol.org/noise.html#the-handshakestate-object\n// Contains\n// - the local and remote ephemeral/static keys e,s,re,rs (if any)\n// - the initiator flag (true if the user creating the state is the handshake initiator, false otherwise)\n// - the handshakePattern (containing the handshake protocol name, and (pre)message patterns)\n// This object is further extended from specifications by storing:\n// - a message pattern index msgPatternIdx indicating the next handshake message pattern to process\n// - the user's preshared psk, if any\nclass HandshakeState {\n constructor(handshakePattern, psk) {\n this.handshakePattern = handshakePattern;\n this.psk = psk;\n // By default the Handshake State initiator flag is set to false\n // Will be set to true when the user associated to the handshake state starts an handshake\n this.initiator = false;\n this.ss = new _noise_js__WEBPACK_IMPORTED_MODULE_5__.SymmetricState(handshakePattern);\n this.msgPatternIdx = 0;\n }\n equals(b) {\n if (this.s != null && b.s != null) {\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.s.privateKey, b.s.privateKey))\n return false;\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.s.publicKey, b.s.publicKey))\n return false;\n }\n else {\n return false;\n }\n if (this.e != null && b.e != null) {\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.e.privateKey, b.e.privateKey))\n return false;\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.e.publicKey, b.e.publicKey))\n return false;\n }\n else {\n return false;\n }\n if (this.rs != null && b.rs != null) {\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.rs, b.rs))\n return false;\n }\n else {\n return false;\n }\n if (this.re != null && b.re != null) {\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.re, b.re))\n return false;\n }\n else {\n return false;\n }\n if (!this.ss.equals(b.ss))\n return false;\n if (this.initiator != b.initiator)\n return false;\n if (!this.handshakePattern.equals(b.handshakePattern))\n return false;\n if (this.msgPatternIdx != b.msgPatternIdx)\n return false;\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.psk, b.psk))\n return false;\n return true;\n }\n clone() {\n const result = new HandshakeState(this.handshakePattern, this.psk);\n result.s = this.s;\n result.e = this.e;\n result.rs = this.rs ? new Uint8Array(this.rs) : undefined;\n result.re = this.re ? new Uint8Array(this.re) : undefined;\n result.ss = this.ss.clone();\n result.initiator = this.initiator;\n result.msgPatternIdx = this.msgPatternIdx;\n return result;\n }\n genMessageNametagSecrets() {\n const [nms1, nms2] = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_3__.HKDF)(this.handshakePattern.hash, this.ss.h, new Uint8Array(), 32, 2);\n return { nms1, nms2 };\n }\n // Uses the cryptographic information stored in the input handshake state to generate a random message nametag\n // In current implementation the messageNametag = HKDF(handshake hash value), but other derivation mechanisms can be implemented\n toMessageNametag() {\n const [output] = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_3__.HKDF)(this.handshakePattern.hash, this.ss.h, new Uint8Array(), 32, 1);\n return output.subarray(0, _messagenametag_js__WEBPACK_IMPORTED_MODULE_4__.MessageNametagLength);\n }\n // Handshake Processing\n // Based on the message handshake direction and if the user is or not the initiator, returns a boolean tuple telling if the user\n // has to read or write the next handshake message\n getReadingWritingState(direction) {\n let reading = false;\n let writing = false;\n if (this.initiator && direction == _patterns_js__WEBPACK_IMPORTED_MODULE_6__.MessageDirection.r) {\n // I'm Alice and direction is ->\n reading = false;\n writing = true;\n }\n else if (this.initiator && direction == _patterns_js__WEBPACK_IMPORTED_MODULE_6__.MessageDirection.l) {\n // I'm Alice and direction is <-\n reading = true;\n writing = false;\n }\n else if (!this.initiator && direction == _patterns_js__WEBPACK_IMPORTED_MODULE_6__.MessageDirection.r) {\n // I'm Bob and direction is ->\n reading = true;\n writing = false;\n }\n else if (!this.initiator && direction == _patterns_js__WEBPACK_IMPORTED_MODULE_6__.MessageDirection.l) {\n // I'm Bob and direction is <-\n reading = false;\n writing = true;\n }\n return { reading, writing };\n }\n // Checks if a pre-message is valid according to Noise specifications\n // http://www.noiseprotocol.org/noise.html#handshake-patterns\n isValid(msg) {\n let isValid = true;\n // Non-empty pre-messages can only have patterns \"e\", \"s\", \"e,s\" in each direction\n const allowedPatterns = [\n new _patterns_js__WEBPACK_IMPORTED_MODULE_6__.PreMessagePattern(_patterns_js__WEBPACK_IMPORTED_MODULE_6__.MessageDirection.r, [_patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.s]),\n new _patterns_js__WEBPACK_IMPORTED_MODULE_6__.PreMessagePattern(_patterns_js__WEBPACK_IMPORTED_MODULE_6__.MessageDirection.r, [_patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.e]),\n new _patterns_js__WEBPACK_IMPORTED_MODULE_6__.PreMessagePattern(_patterns_js__WEBPACK_IMPORTED_MODULE_6__.MessageDirection.r, [_patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.e, _patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.s]),\n new _patterns_js__WEBPACK_IMPORTED_MODULE_6__.PreMessagePattern(_patterns_js__WEBPACK_IMPORTED_MODULE_6__.MessageDirection.l, [_patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.s]),\n new _patterns_js__WEBPACK_IMPORTED_MODULE_6__.PreMessagePattern(_patterns_js__WEBPACK_IMPORTED_MODULE_6__.MessageDirection.l, [_patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.e]),\n new _patterns_js__WEBPACK_IMPORTED_MODULE_6__.PreMessagePattern(_patterns_js__WEBPACK_IMPORTED_MODULE_6__.MessageDirection.l, [_patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.e, _patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.s]),\n ];\n // We check if pre message patterns are allowed\n for (const pattern of msg) {\n if (!allowedPatterns.find((x) => x.equals(pattern))) {\n isValid = false;\n break;\n }\n }\n return isValid;\n }\n // Handshake messages processing procedures\n // Processes pre-message patterns\n processPreMessagePatternTokens(inPreMessagePKs = []) {\n // I make a copy of the input pre-message public keys, so that I can easily delete processed ones without using iterators/counters\n const preMessagePKs = inPreMessagePKs.map((x) => x.clone());\n // Here we store currently processed pre message public key\n let currPK;\n // We retrieve the pre-message patterns to process, if any\n // If none, there's nothing to do\n if (this.handshakePattern.preMessagePatterns.length == 0) {\n return;\n }\n // If not empty, we check that pre-message is valid according to Noise specifications\n if (!this.isValid(this.handshakePattern.preMessagePatterns)) {\n throw new Error(\"invalid pre-message in handshake\");\n }\n // We iterate over each pattern contained in the pre-message\n for (const messagePattern of this.handshakePattern.preMessagePatterns) {\n const direction = messagePattern.direction;\n const tokens = messagePattern.tokens;\n // We get if the user is reading or writing the current pre-message pattern\n const { reading, writing } = this.getReadingWritingState(direction);\n // We process each message pattern token\n for (const token of tokens) {\n // We process the pattern token\n switch (token) {\n case _patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.e:\n // We expect an ephemeral key, so we attempt to read it (next PK to process will always be at index 0 of preMessagePKs)\n if (preMessagePKs.length > 0) {\n currPK = preMessagePKs[0];\n }\n else {\n throw new Error(\"noise pre-message read e, expected a public key\");\n }\n // If user is reading the \"e\" token\n if (reading) {\n log(\"noise pre-message read e\");\n // We check if current key is encrypted or not. We assume pre-message public keys are all unencrypted on users' end\n if (currPK.flag == 0) {\n // Sets re and calls MixHash(re.public_key).\n this.re = this.handshakePattern.dhKey.intoKey(currPK.pk);\n this.ss.mixHash(this.re);\n }\n else {\n throw new Error(\"noise read e, incorrect encryption flag for pre-message public key\");\n }\n // If user is writing the \"e\" token\n }\n else if (writing) {\n log(\"noise pre-message write e\");\n // When writing, the user is sending a public key,\n // We check that the public part corresponds to the set local key and we call MixHash(e.public_key).\n if (this.e && (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.e.publicKey, this.handshakePattern.dhKey.intoKey(currPK.pk))) {\n this.ss.mixHash(this.e.publicKey);\n }\n else {\n throw new Error(\"noise pre-message e key doesn't correspond to locally set e key pair\");\n }\n }\n // Noise specification: section 9.2\n // In non-PSK handshakes, the \"e\" token in a pre-message pattern or message pattern always results\n // in a call to MixHash(e.public_key).\n // In a PSK handshake, all of these calls are followed by MixKey(e.public_key).\n if (this.handshakePattern.name.indexOf(\"psk\") > -1) {\n this.ss.mixKey(currPK.pk);\n }\n // We delete processed public key\n preMessagePKs.shift();\n break;\n case _patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.s:\n // We expect a static key, so we attempt to read it (next PK to process will always be at index of preMessagePKs)\n if (preMessagePKs.length > 0) {\n currPK = preMessagePKs[0];\n }\n else {\n throw new Error(\"noise pre-message read s, expected a public key\");\n }\n // If user is reading the \"s\" token\n if (reading) {\n log(\"noise pre-message read s\");\n // We check if current key is encrypted or not. We assume pre-message public keys are all unencrypted on users' end\n if (currPK.flag == 0) {\n // Sets re and calls MixHash(re.public_key).\n this.rs = this.handshakePattern.dhKey.intoKey(currPK.pk);\n this.ss.mixHash(this.rs);\n }\n else {\n throw new Error(\"noise read s, incorrect encryption flag for pre-message public key\");\n }\n // If user is writing the \"s\" token\n }\n else if (writing) {\n log(\"noise pre-message write s\");\n // If writing, it means that the user is sending a public key,\n // We check that the public part corresponds to the set local key and we call MixHash(s.public_key).\n if (this.s && (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.s.publicKey, this.handshakePattern.dhKey.intoKey(currPK.pk))) {\n this.ss.mixHash(this.s.publicKey);\n }\n else {\n throw new Error(\"noise pre-message s key doesn't correspond to locally set s key pair\");\n }\n }\n // Noise specification: section 9.2\n // In non-PSK handshakes, the \"e\" token in a pre-message pattern or message pattern always results\n // in a call to MixHash(e.public_key).\n // In a PSK handshake, all of these calls are followed by MixKey(e.public_key).\n if (this.handshakePattern.name.indexOf(\"psk\") > -1) {\n this.ss.mixKey(currPK.pk);\n }\n // We delete processed public key\n preMessagePKs.shift();\n break;\n default:\n throw new Error(\"invalid Token for pre-message pattern\");\n }\n }\n }\n }\n // This procedure encrypts/decrypts the implicit payload attached at the end of every message pattern\n // An optional extraAd to pass extra additional data in encryption/decryption can be set (useful to authenticate messageNametag)\n processMessagePatternPayload(transportMessage, extraAd = new Uint8Array()) {\n let payload;\n // We retrieve current message pattern (direction + tokens) to process\n const direction = this.handshakePattern.messagePatterns[this.msgPatternIdx].direction;\n // We get if the user is reading or writing the input handshake message\n const { reading, writing } = this.getReadingWritingState(direction);\n // We decrypt the transportMessage, if any\n if (reading) {\n payload = this.ss.decryptAndHash(transportMessage, extraAd);\n payload = pkcs7_padding__WEBPACK_IMPORTED_MODULE_1__.unpad(payload);\n }\n else if (writing) {\n payload = pkcs7_padding__WEBPACK_IMPORTED_MODULE_1__.pad(transportMessage, NoisePaddingBlockSize);\n payload = this.ss.encryptAndHash(payload, extraAd);\n }\n else {\n throw new Error(\"undefined state\");\n }\n return payload;\n }\n // We process an input handshake message according to current handshake state and we return the next handshake step's handshake message\n processMessagePatternTokens(inputHandshakeMessage = []) {\n // We retrieve current message pattern (direction + tokens) to process\n const messagePattern = this.handshakePattern.messagePatterns[this.msgPatternIdx];\n const direction = messagePattern.direction;\n const tokens = messagePattern.tokens;\n // We get if the user is reading or writing the input handshake message\n const { reading, writing } = this.getReadingWritingState(direction);\n // I make a copy of the handshake message so that I can easily delete processed PKs without using iterators/counters\n // (Possibly) non-empty if reading\n const inHandshakeMessage = inputHandshakeMessage;\n // The party's output public keys\n // (Possibly) non-empty if writing\n const outHandshakeMessage = [];\n // In currPK we store the currently processed public key from the handshake message\n let currPK;\n // We process each message pattern token\n for (const token of tokens) {\n switch (token) {\n case _patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.e:\n // If user is reading the \"s\" token\n if (reading) {\n log(\"noise read e\");\n // We expect an ephemeral key, so we attempt to read it (next PK to process will always be at index 0 of preMessagePKs)\n if (inHandshakeMessage.length > 0) {\n currPK = inHandshakeMessage[0];\n }\n else {\n throw new Error(\"noise read e, expected a public key\");\n }\n // We check if current key is encrypted or not\n // Note: by specification, ephemeral keys should always be unencrypted. But we support encrypted ones.\n if (currPK.flag == 0) {\n // Unencrypted Public Key\n // Sets re and calls MixHash(re.public_key).\n this.re = this.handshakePattern.dhKey.intoKey(currPK.pk);\n this.ss.mixHash(this.re);\n // The following is out of specification: we call decryptAndHash for encrypted ephemeral keys, similarly as happens for (encrypted) static keys\n }\n else if (currPK.flag == 1) {\n // Encrypted public key\n // Decrypts re, sets re and calls MixHash(re.public_key).\n this.re = this.handshakePattern.dhKey.intoKey(this.ss.decryptAndHash(currPK.pk));\n }\n else {\n throw new Error(\"noise read e, incorrect encryption flag for public key\");\n }\n // Noise specification: section 9.2\n // In non-PSK handshakes, the \"e\" token in a pre-message pattern or message pattern always results\n // in a call to MixHash(e.public_key).\n // In a PSK handshake, all of these calls are followed by MixKey(e.public_key).\n if (this.handshakePattern.name.indexOf(\"psk\") > -1) {\n this.ss.mixKey(this.re);\n }\n // We delete processed public key\n inHandshakeMessage.shift();\n // If user is writing the \"e\" token\n }\n else if (writing) {\n log(\"noise write e\");\n // We generate a new ephemeral keypair\n this.e = this.handshakePattern.dhKey.generateKeyPair();\n // We update the state\n this.ss.mixHash(this.e.publicKey);\n // Noise specification: section 9.2\n // In non-PSK handshakes, the \"e\" token in a pre-message pattern or message pattern always results\n // in a call to MixHash(e.public_key).\n // In a PSK handshake, all of these calls are followed by MixKey(e.public_key).\n if (this.handshakePattern.name.indexOf(\"psk\") > -1) {\n this.ss.mixKey(this.e.publicKey);\n }\n // We add the ephemeral public key to the Waku payload\n outHandshakeMessage.push(_publickey_js__WEBPACK_IMPORTED_MODULE_7__.NoisePublicKey.fromPublicKey(this.e.publicKey));\n }\n break;\n case _patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.s:\n // If user is reading the \"s\" token\n if (reading) {\n log(\"noise read s\");\n // We expect a static key, so we attempt to read it (next PK to process will always be at index 0 of preMessagePKs)\n if (inHandshakeMessage.length > 0) {\n currPK = inHandshakeMessage[0];\n }\n else {\n throw new Error(\"noise read s, expected a public key\");\n }\n // We check if current key is encrypted or not\n if (currPK.flag == 0) {\n // Unencrypted Public Key\n // Sets re and calls MixHash(re.public_key).\n this.rs = this.handshakePattern.dhKey.intoKey(currPK.pk);\n this.ss.mixHash(this.rs);\n }\n else if (currPK.flag == 1) {\n // Encrypted public key\n // Decrypts rs, sets rs and calls MixHash(rs.public_key).\n this.rs = this.handshakePattern.dhKey.intoKey(this.ss.decryptAndHash(currPK.pk));\n }\n else {\n throw new Error(\"noise read s, incorrect encryption flag for public key\");\n }\n // We delete processed public key\n inHandshakeMessage.shift();\n // If user is writing the \"s\" token\n }\n else if (writing) {\n log(\"noise write s\");\n // If the local static key is not set (the handshake state was not properly initialized), we raise an error\n if (!this.s) {\n throw new Error(\"static key not set\");\n }\n // We encrypt the public part of the static key in case a key is set in the Cipher State\n // That is, encS may either be an encrypted or unencrypted static key.\n const encS = this.ss.encryptAndHash(this.s.publicKey);\n // We add the (encrypted) static public key to the Waku payload\n // Note that encS = (Enc(s) || tag) if encryption key is set, otherwise encS = s.\n // We distinguish these two cases by checking length of encryption and we set the proper encryption flag\n if (encS.length > this.handshakePattern.dhKey.DHLen()) {\n outHandshakeMessage.push(new _publickey_js__WEBPACK_IMPORTED_MODULE_7__.NoisePublicKey(1, encS));\n }\n else {\n outHandshakeMessage.push(new _publickey_js__WEBPACK_IMPORTED_MODULE_7__.NoisePublicKey(0, encS));\n }\n }\n break;\n case _patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.psk:\n // If user is reading the \"psk\" token\n log(\"noise psk\");\n // Calls MixKeyAndHash(psk)\n this.ss.mixKeyAndHash(this.psk);\n break;\n case _patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.ee:\n // If user is reading the \"ee\" token\n log(\"noise dh ee\");\n // If local and/or remote ephemeral keys are not set, we raise an error\n if (!this.e || !this.re) {\n throw new Error(\"local or remote ephemeral key not set\");\n }\n // Calls MixKey(DH(e, re)).\n this.ss.mixKey(this.handshakePattern.dhKey.DH(this.e.privateKey, this.re));\n break;\n case _patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.es:\n // If user is reading the \"es\" token\n log(\"noise dh es\");\n // We check if keys are correctly set.\n // If both present, we call MixKey(DH(e, rs)) if initiator, MixKey(DH(s, re)) if responder.\n if (this.initiator) {\n if (!this.e || !this.rs) {\n throw new Error(\"local or remote ephemeral/static key not set\");\n }\n this.ss.mixKey(this.handshakePattern.dhKey.DH(this.e.privateKey, this.rs));\n }\n else {\n if (!this.re || !this.s) {\n throw new Error(\"local or remote ephemeral/static key not set\");\n }\n this.ss.mixKey(this.handshakePattern.dhKey.DH(this.s.privateKey, this.re));\n }\n break;\n case _patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.se:\n // If user is reading the \"se\" token\n log(\"noise dh se\");\n // We check if keys are correctly set.\n // If both present, call MixKey(DH(s, re)) if initiator, MixKey(DH(e, rs)) if responder.\n if (this.initiator) {\n if (!this.s || !this.re) {\n throw new Error(\"local or remote ephemeral/static key not set\");\n }\n this.ss.mixKey(this.handshakePattern.dhKey.DH(this.s.privateKey, this.re));\n }\n else {\n if (!this.rs || !this.e) {\n throw new Error(\"local or remote ephemeral/static key not set\");\n }\n this.ss.mixKey(this.handshakePattern.dhKey.DH(this.e.privateKey, this.rs));\n }\n break;\n case _patterns_js__WEBPACK_IMPORTED_MODULE_6__.NoiseTokens.ss:\n // If user is reading the \"ss\" token\n log(\"noise dh ss\");\n // If local and/or remote static keys are not set, we raise an error\n if (!this.s || !this.rs) {\n throw new Error(\"local or remote static key not set\");\n }\n // Calls MixKey(DH(s, rs)).\n this.ss.mixKey(this.handshakePattern.dhKey.DH(this.s.privateKey, this.rs));\n break;\n }\n }\n return outHandshakeMessage;\n }\n}\n//# sourceMappingURL=handshake_state.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/handshake_state.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/index.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CipherState: () => (/* reexport safe */ _noise_js__WEBPACK_IMPORTED_MODULE_4__.CipherState),\n/* harmony export */ Handshake: () => (/* reexport safe */ _handshake_js__WEBPACK_IMPORTED_MODULE_2__.Handshake),\n/* harmony export */ HandshakePattern: () => (/* reexport safe */ _patterns_js__WEBPACK_IMPORTED_MODULE_7__.HandshakePattern),\n/* harmony export */ HandshakeResult: () => (/* reexport safe */ _handshake_js__WEBPACK_IMPORTED_MODULE_2__.HandshakeResult),\n/* harmony export */ HandshakeStepResult: () => (/* reexport safe */ _handshake_js__WEBPACK_IMPORTED_MODULE_2__.HandshakeStepResult),\n/* harmony export */ InitiatorParameters: () => (/* reexport safe */ _pairing_js__WEBPACK_IMPORTED_MODULE_6__.InitiatorParameters),\n/* harmony export */ MessageDirection: () => (/* reexport safe */ _patterns_js__WEBPACK_IMPORTED_MODULE_7__.MessageDirection),\n/* harmony export */ MessageNametagBuffer: () => (/* reexport safe */ _messagenametag_js__WEBPACK_IMPORTED_MODULE_3__.MessageNametagBuffer),\n/* harmony export */ MessageNametagError: () => (/* reexport safe */ _handshake_js__WEBPACK_IMPORTED_MODULE_2__.MessageNametagError),\n/* harmony export */ MessagePattern: () => (/* reexport safe */ _patterns_js__WEBPACK_IMPORTED_MODULE_7__.MessagePattern),\n/* harmony export */ NoiseHandshakeDecoder: () => (/* reexport safe */ _codec_js__WEBPACK_IMPORTED_MODULE_0__.NoiseHandshakeDecoder),\n/* harmony export */ NoiseHandshakeEncoder: () => (/* reexport safe */ _codec_js__WEBPACK_IMPORTED_MODULE_0__.NoiseHandshakeEncoder),\n/* harmony export */ NoiseHandshakePatterns: () => (/* reexport safe */ _patterns_js__WEBPACK_IMPORTED_MODULE_7__.NoiseHandshakePatterns),\n/* harmony export */ NoisePublicKey: () => (/* reexport safe */ _publickey_js__WEBPACK_IMPORTED_MODULE_9__.NoisePublicKey),\n/* harmony export */ NoiseSecureTransferDecoder: () => (/* reexport safe */ _codec_js__WEBPACK_IMPORTED_MODULE_0__.NoiseSecureTransferDecoder),\n/* harmony export */ NoiseSecureTransferEncoder: () => (/* reexport safe */ _codec_js__WEBPACK_IMPORTED_MODULE_0__.NoiseSecureTransferEncoder),\n/* harmony export */ NoiseTokens: () => (/* reexport safe */ _patterns_js__WEBPACK_IMPORTED_MODULE_7__.NoiseTokens),\n/* harmony export */ Nonce: () => (/* reexport safe */ _nonce_js__WEBPACK_IMPORTED_MODULE_5__.Nonce),\n/* harmony export */ PayloadV2: () => (/* reexport safe */ _payload_js__WEBPACK_IMPORTED_MODULE_8__.PayloadV2),\n/* harmony export */ PayloadV2ProtocolIDs: () => (/* reexport safe */ _patterns_js__WEBPACK_IMPORTED_MODULE_7__.PayloadV2ProtocolIDs),\n/* harmony export */ PreMessagePattern: () => (/* reexport safe */ _patterns_js__WEBPACK_IMPORTED_MODULE_7__.PreMessagePattern),\n/* harmony export */ QR: () => (/* reexport safe */ _qr_js__WEBPACK_IMPORTED_MODULE_10__.QR),\n/* harmony export */ ResponderParameters: () => (/* reexport safe */ _pairing_js__WEBPACK_IMPORTED_MODULE_6__.ResponderParameters),\n/* harmony export */ WakuPairing: () => (/* reexport safe */ _pairing_js__WEBPACK_IMPORTED_MODULE_6__.WakuPairing),\n/* harmony export */ X25519DHKey: () => (/* reexport safe */ _dh25519_js__WEBPACK_IMPORTED_MODULE_1__.DH25519)\n/* harmony export */ });\n/* harmony import */ var _codec_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./codec.js */ \"./node_modules/@waku/noise/dist/codec.js\");\n/* harmony import */ var _dh25519_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dh25519.js */ \"./node_modules/@waku/noise/dist/dh25519.js\");\n/* harmony import */ var _handshake_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./handshake.js */ \"./node_modules/@waku/noise/dist/handshake.js\");\n/* harmony import */ var _messagenametag_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./messagenametag.js */ \"./node_modules/@waku/noise/dist/messagenametag.js\");\n/* harmony import */ var _noise_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./noise.js */ \"./node_modules/@waku/noise/dist/noise.js\");\n/* harmony import */ var _nonce_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./nonce.js */ \"./node_modules/@waku/noise/dist/nonce.js\");\n/* harmony import */ var _pairing_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./pairing.js */ \"./node_modules/@waku/noise/dist/pairing.js\");\n/* harmony import */ var _patterns_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./patterns.js */ \"./node_modules/@waku/noise/dist/patterns.js\");\n/* harmony import */ var _payload_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./payload.js */ \"./node_modules/@waku/noise/dist/payload.js\");\n/* harmony import */ var _publickey_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./publickey.js */ \"./node_modules/@waku/noise/dist/publickey.js\");\n/* harmony import */ var _qr_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./qr.js */ \"./node_modules/@waku/noise/dist/qr.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/messagenametag.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/messagenametag.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MessageNametagBuffer: () => (/* binding */ MessageNametagBuffer),\n/* harmony export */ MessageNametagBufferSize: () => (/* binding */ MessageNametagBufferSize),\n/* harmony export */ MessageNametagLength: () => (/* binding */ MessageNametagLength),\n/* harmony export */ toMessageNametag: () => (/* binding */ toMessageNametag)\n/* harmony export */ });\n/* harmony import */ var _stablelib_sha256__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @stablelib/sha256 */ \"./node_modules/@stablelib/sha256/lib/sha256.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@waku/noise/dist/utils.js\");\n\n\n\n\nconst MessageNametagLength = 16;\nconst MessageNametagBufferSize = 50;\n/**\n * Converts a sequence or array (arbitrary size) to a MessageNametag\n * @param input\n * @returns\n */\nfunction toMessageNametag(input) {\n return input.subarray(0, MessageNametagLength);\n}\nclass MessageNametagBuffer {\n constructor() {\n this.buffer = new Array(MessageNametagBufferSize);\n this.counter = 0;\n for (let i = 0; i < this.buffer.length; i++) {\n this.buffer[i] = new Uint8Array(MessageNametagLength);\n }\n }\n /**\n * Initializes the empty Message nametag buffer. The n-th nametag is equal to HKDF( secret || n )\n */\n initNametagsBuffer() {\n // We default the counter and buffer fields\n this.counter = 0;\n this.buffer = new Array(MessageNametagBufferSize);\n if (this.secret) {\n for (let i = 0; i < this.buffer.length; i++) {\n const counterBytesLE = (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.writeUIntLE)(new Uint8Array(8), this.counter, 0, 8);\n // TODO: determine if this hash should be sha256, or if it should depend on the handshake pattern\n const d = hashSHA256((0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__.concat)([this.secret, counterBytesLE]));\n this.buffer[i] = toMessageNametag(d);\n this.counter++;\n }\n }\n else {\n // We warn users if no secret is set\n console.debug(\"The message nametags buffer has not a secret set\");\n }\n }\n /**\n * Pop the nametag from the message nametag buffer\n * @returns MessageNametag\n */\n pop() {\n // Note that if the input MessageNametagBuffer is set to default, an all 0 messageNametag is returned\n const messageNametag = new Uint8Array(this.buffer[0]);\n this.delete(1);\n return messageNametag;\n }\n /**\n * Checks if the input messageNametag is contained in the input MessageNametagBuffer\n * @param messageNametag Message nametag to verify\n * @returns true if it's the expected nametag, false otherwise\n */\n checkNametag(messageNametag) {\n const index = this.buffer.findIndex((x) => (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(x, messageNametag));\n if (index == -1) {\n console.debug(\"Message nametag not found in buffer\");\n return false;\n }\n else if (index > 0) {\n console.debug(\"Message nametag is present in buffer but is not the next expected nametag. One or more messages were probably lost\");\n return false;\n }\n // index is 0, hence the read message tag is the next expected one\n return true;\n }\n getNametagPosition(messageNametag) {\n const index = this.buffer.findIndex((x) => (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(x, messageNametag));\n return index;\n }\n rotateLeft(k) {\n if (k < 0 || this.buffer.length == 0) {\n return;\n }\n const idx = k % this.buffer.length;\n const a1 = this.buffer.slice(idx);\n const a2 = this.buffer.slice(0, idx);\n this.buffer = a1.concat(a2);\n }\n /**\n * Deletes the first n elements in buffer and appends n new ones\n * @param n number of message nametags to delete\n */\n delete(n) {\n if (n <= 0) {\n return;\n }\n // We ensure n is at most MessageNametagBufferSize (the buffer will be fully replaced)\n n = Math.min(n, MessageNametagBufferSize);\n // We update the last n values in the array if a secret is set\n // Note that if the input MessageNametagBuffer is set to default, nothing is done here\n if (this.secret) {\n // We rotate left the array by n\n this.rotateLeft(n);\n for (let i = 0; i < n; i++) {\n const counterBytesLE = (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.writeUIntLE)(new Uint8Array(8), this.counter, 0, 8);\n const d = hashSHA256((0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__.concat)([this.secret, counterBytesLE]));\n this.buffer[this.buffer.length - n + i] = toMessageNametag(d);\n this.counter++;\n }\n }\n else {\n // We warn users that no secret is set\n console.debug(\"The message nametags buffer has no secret set\");\n }\n }\n getNametagAtPosition(position) {\n return this.buffer[position];\n }\n}\n/**\n * Generate hash using SHA2-256\n * @param data data to hash\n * @returns hash digest\n */\nfunction hashSHA256(data) {\n return (0,_stablelib_sha256__WEBPACK_IMPORTED_MODULE_0__.hash)(data);\n}\n//# sourceMappingURL=messagenametag.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/messagenametag.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/noise.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/noise.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CipherState: () => (/* binding */ CipherState),\n/* harmony export */ SymmetricState: () => (/* binding */ SymmetricState),\n/* harmony export */ createEmptyKey: () => (/* binding */ createEmptyKey),\n/* harmony export */ isEmptyKey: () => (/* binding */ isEmptyKey)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var uint8arrays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays */ \"./node_modules/uint8arrays/dist/src/index.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/noise/dist/crypto.js\");\n/* harmony import */ var _nonce_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./nonce.js */ \"./node_modules/@waku/noise/dist/nonce.js\");\n\n\n\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_0__(\"waku:noise:handshake-state\");\n// Waku Noise Protocols for Waku Payload Encryption\n// Noise module implementing the Noise State Objects and ChaChaPoly encryption/decryption primitives\n// See spec for more details:\n// https://github.com/vacp2p/rfc/tree/master/content/docs/rfcs/35\n//\n// Implementation partially inspired by noise-libp2p and js-libp2p-noise\n// https://github.com/status-im/nim-libp2p/blob/master/libp2p/protocols/secure/noise.nim\n// https://github.com/ChainSafe/js-libp2p-noise\n/*\n# Noise state machine primitives\n\n# Overview :\n# - Alice and Bob process (i.e. read and write, based on their role) each token appearing in a handshake pattern, consisting of pre-message and message patterns;\n# - Both users initialize and update according to processed tokens a Handshake State, a Symmetric State and a Cipher State;\n# - A preshared key psk is processed by calling MixKeyAndHash(psk);\n# - When an ephemeral public key e is read or written, the handshake hash value h is updated by calling mixHash(e); If the handshake expects a psk, MixKey(e) is further called\n# - When an encrypted static public key s or a payload message m is read, it is decrypted with decryptAndHash;\n# - When a static public key s or a payload message is written, it is encrypted with encryptAndHash;\n# - When any Diffie-Hellman token ee, es, se, ss is read or written, the chaining key ck is updated by calling MixKey on the computed secret;\n# - If all tokens are processed, users compute two new Cipher States by calling Split;\n# - The two Cipher States obtained from Split are used to encrypt/decrypt outbound/inbound messages.\n\n#################################\n# Cipher State Primitives\n#################################\n*/\n/**\n * Create empty chaining key\n * @returns 32-byte empty key\n */\nfunction createEmptyKey() {\n return new Uint8Array(32);\n}\n/**\n * Checks if a 32-byte key is empty\n * @param k key to verify\n * @returns true if empty, false otherwise\n */\nfunction isEmptyKey(k) {\n const emptyKey = createEmptyKey();\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(emptyKey, k);\n}\n/**\n * The Cipher State as in https://noiseprotocol.org/noise.html#the-cipherstate-object\n * Contains an encryption key k and a nonce n (used in Noise as a counter)\n */\nclass CipherState {\n /**\n * @param k encryption key\n * @param n nonce\n */\n constructor(cipher, k = createEmptyKey(), n = new _nonce_js__WEBPACK_IMPORTED_MODULE_5__.Nonce()) {\n this.k = k;\n this.n = n;\n this.cipher = cipher;\n }\n /**\n * Create a copy of the CipherState\n * @returns a copy of the CipherState\n */\n clone() {\n return new CipherState(this.cipher, new Uint8Array(this.k), new _nonce_js__WEBPACK_IMPORTED_MODULE_5__.Nonce(this.n.getUint64()));\n }\n /**\n * Check CipherState equality\n * @param other object to compare against\n * @returns true if equal, false otherwise\n */\n equals(other) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(this.k, other.getKey()) && this.n.getUint64() == other.getNonce().getUint64();\n }\n /**\n * Checks if a Cipher State has an encryption key set\n * @returns true if a key is set, false otherwise`\n */\n hasKey() {\n return !isEmptyKey(this.k);\n }\n /**\n * Encrypts a plaintext using key material in a Noise Cipher State\n * The CipherState is updated increasing the nonce (used as a counter in Noise) by one\n * @param ad associated data\n * @param plaintext data to encrypt\n */\n encryptWithAd(ad, plaintext) {\n this.n.assertValue();\n let ciphertext = new Uint8Array();\n if (this.hasKey()) {\n // If an encryption key is set in the Cipher state, we proceed with encryption\n ciphertext = this.cipher.encrypt(this.k, this.n, ad, plaintext);\n this.n.increment();\n this.n.assertValue();\n log(\"encryptWithAd\", ciphertext, this.n.getUint64() - 1);\n }\n else {\n // Otherwise we return the input plaintext according to specification http://www.noiseprotocol.org/noise.html#the-cipherstate-object\n ciphertext = plaintext;\n log(\"encryptWithAd called with no encryption key set. Returning plaintext.\");\n }\n return ciphertext;\n }\n /**\n * Decrypts a ciphertext using key material in a Noise Cipher State\n * The CipherState is updated increasing the nonce (used as a counter in Noise) by one\n * @param ad associated data\n * @param ciphertext data to decrypt\n */\n decryptWithAd(ad, ciphertext) {\n this.n.assertValue();\n if (this.hasKey()) {\n const plaintext = this.cipher.decrypt(this.k, this.n, ad, ciphertext);\n if (!plaintext) {\n throw new Error(\"decryptWithAd failed\");\n }\n this.n.increment();\n this.n.assertValue();\n return plaintext;\n }\n else {\n // Otherwise we return the input ciphertext according to specification\n // http://www.noiseprotocol.org/noise.html#the-cipherstate-object\n log(\"decryptWithAd called with no encryption key set. Returning ciphertext.\");\n return ciphertext;\n }\n }\n /**\n * Sets the nonce of a Cipher State\n * @param nonce Nonce\n */\n setNonce(nonce) {\n this.n = nonce;\n }\n /**\n * Sets the key of a Cipher State\n * @param key set the cipherstate encryption key\n */\n setCipherStateKey(key) {\n this.k = key;\n }\n /**\n * Gets the encryption key of a Cipher State\n * @returns encryption key\n */\n getKey() {\n return this.k;\n }\n /**\n * Gets the nonce of a Cipher State\n * @returns Nonce\n */\n getNonce() {\n return this.n;\n }\n}\n/**\n * Hash protocol name\n * @param name name of the noise handshake pattern to hash\n * @returns sha256 digest of the protocol name\n */\nfunction hashProtocol(h, name) {\n // If protocol_name is less than or equal to HASHLEN bytes in length,\n // sets h equal to protocol_name with zero bytes appended to make HASHLEN bytes.\n // Otherwise sets h = HASH(protocol_name).\n const protocolName = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_1__.fromString)(name, \"utf-8\");\n if (protocolName.length <= 32) {\n const h = new Uint8Array(32);\n h.set(protocolName);\n return h;\n }\n else {\n return (0,_crypto_js__WEBPACK_IMPORTED_MODULE_4__.hash)(h, protocolName);\n }\n}\n/**\n * The Symmetric State as in https://noiseprotocol.org/noise.html#the-symmetricstate-object\n * Contains a Cipher State cs, the chaining key ck and the handshake hash value h\n */\nclass SymmetricState {\n constructor(handshakePattern) {\n this.handshakePattern = handshakePattern;\n this.h = hashProtocol(handshakePattern.hash, handshakePattern.name);\n this.ck = this.h;\n this.cs = new CipherState(handshakePattern.cipher);\n }\n /**\n * Check CipherState equality\n * @param other object to compare against\n * @returns true if equal, false otherwise\n */\n equals(other) {\n return (this.cs.equals(other.cs) &&\n (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(this.ck, other.ck) &&\n (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(this.h, other.h) &&\n this.handshakePattern.equals(other.handshakePattern));\n }\n /**\n * Create a copy of the SymmetricState\n * @returns a copy of the SymmetricState\n */\n clone() {\n const ss = new SymmetricState(this.handshakePattern);\n ss.cs = this.cs.clone();\n ss.ck = new Uint8Array(this.ck);\n ss.h = new Uint8Array(this.h);\n return ss;\n }\n /**\n * MixKey as per Noise specification http://www.noiseprotocol.org/noise.html#the-symmetricstate-object\n * Updates a Symmetric state chaining key and symmetric state\n * @param inputKeyMaterial\n */\n mixKey(inputKeyMaterial) {\n // We derive two keys using HKDF\n const [ck, tempK] = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_4__.HKDF)(this.handshakePattern.hash, this.ck, inputKeyMaterial, 32, 2);\n // We update ck and the Cipher state's key k using the output of HDKF\n this.cs = new CipherState(this.handshakePattern.cipher, tempK);\n this.ck = ck;\n log(\"mixKey\", this.ck, this.cs.k);\n }\n /**\n * MixHash as per Noise specification http://www.noiseprotocol.org/noise.html#the-symmetricstate-object\n * Hashes data into a Symmetric State's handshake hash value h\n * @param data input data to hash into h\n */\n mixHash(data) {\n // We hash the previous handshake hash and input data and store the result in the Symmetric State's handshake hash value\n this.h = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_4__.hash)(this.handshakePattern.hash, (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_2__.concat)([this.h, data]));\n log(\"mixHash\", this.h);\n }\n /**\n * mixKeyAndHash as per Noise specification http://www.noiseprotocol.org/noise.html#the-symmetricstate-object\n * Combines MixKey and MixHash\n * @param inputKeyMaterial\n */\n mixKeyAndHash(inputKeyMaterial) {\n // Derives 3 keys using HKDF, the chaining key and the input key material\n const [tmpKey0, tmpKey1, tmpKey2] = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_4__.HKDF)(this.handshakePattern.hash, this.ck, inputKeyMaterial, 32, 3);\n // Sets the chaining key\n this.ck = tmpKey0;\n // Updates the handshake hash value\n this.mixHash(tmpKey1);\n // Updates the Cipher state's key\n // Note for later support of 512 bits hash functions: \"If HASHLEN is 64, then truncates tempKeys[2] to 32 bytes.\"\n this.cs = new CipherState(this.handshakePattern.cipher, tmpKey2);\n }\n /**\n * EncryptAndHash as per Noise specification http://www.noiseprotocol.org/noise.html#the-symmetricstate-object\n * Combines encryptWithAd and mixHash\n * Note that by setting extraAd, it is possible to pass extra additional data that will be concatenated to the ad\n * specified by Noise (can be used to authenticate messageNametag)\n * @param plaintext data to encrypt\n * @param extraAd extra additional data\n */\n encryptAndHash(plaintext, extraAd = new Uint8Array()) {\n // The additional data\n const ad = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_2__.concat)([this.h, extraAd]);\n // Note that if an encryption key is not set yet in the Cipher state, ciphertext will be equal to plaintext\n const ciphertext = this.cs.encryptWithAd(ad, plaintext);\n // We call mixHash over the result\n this.mixHash(ciphertext);\n return ciphertext;\n }\n /**\n * DecryptAndHash as per Noise specification http://www.noiseprotocol.org/noise.html#the-symmetricstate-object\n * Combines decryptWithAd and mixHash\n * @param ciphertext data to decrypt\n * @param extraAd extra additional data\n */\n decryptAndHash(ciphertext, extraAd = new Uint8Array()) {\n // The additional data\n const ad = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_2__.concat)([this.h, extraAd]);\n // Note that if an encryption key is not set yet in the Cipher state, plaintext will be equal to ciphertext\n const plaintext = this.cs.decryptWithAd(ad, ciphertext);\n // According to specification, the ciphertext enters mixHash (and not the plaintext)\n this.mixHash(ciphertext);\n return plaintext;\n }\n /**\n * Split as per Noise specification http://www.noiseprotocol.org/noise.html#the-symmetricstate-object\n * Once a handshake is complete, returns two Cipher States to encrypt/decrypt outbound/inbound messages\n * @returns CipherState to encrypt and CipherState to decrypt\n */\n split() {\n // Derives 2 keys using HKDF and the chaining key\n const [tmpKey1, tmpKey2] = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_4__.HKDF)(this.handshakePattern.hash, this.ck, new Uint8Array(0), 32, 2);\n // Returns a tuple of two Cipher States initialized with the derived keys\n return {\n cs1: new CipherState(this.handshakePattern.cipher, tmpKey1),\n cs2: new CipherState(this.handshakePattern.cipher, tmpKey2),\n };\n }\n /**\n * Gets the chaining key field of a Symmetric State\n * @returns Chaining key\n */\n getChainingKey() {\n return this.ck;\n }\n /**\n * Gets the handshake hash field of a Symmetric State\n * @returns Handshake hash\n */\n getHandshakeHash() {\n return this.h;\n }\n /**\n * Gets the Cipher State field of a Symmetric State\n * @returns Cipher State\n */\n getCipherState() {\n return this.cs;\n }\n}\n//# sourceMappingURL=noise.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/noise.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/nonce.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/nonce.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MAX_NONCE: () => (/* binding */ MAX_NONCE),\n/* harmony export */ MIN_NONCE: () => (/* binding */ MIN_NONCE),\n/* harmony export */ Nonce: () => (/* binding */ Nonce)\n/* harmony export */ });\n// Adapted from https://github.com/ChainSafe/js-libp2p-noise/blob/master/src/nonce.ts\nconst MIN_NONCE = 0;\n// For performance reasons, the nonce is represented as a JS `number`\n// Although JS `number` can safely represent integers up to 2 ** 53 - 1, we choose to only use\n// 4 bytes to store the data for performance reason.\n// This is a slight deviation from the noise spec, which describes the max nonce as 2 ** 64 - 2\n// The effect is that this implementation will need a new handshake to be performed after fewer messages are exchanged than other implementations with full uint64 nonces.\n// this MAX_NONCE is still a large number of messages, so the practical effect of this is negligible.\nconst MAX_NONCE = 0xffffffff;\nconst ERR_MAX_NONCE = \"Cipherstate has reached maximum n, a new handshake must be performed\";\n/**\n * The nonce is an uint that's increased over time.\n * Maintaining different representations help improve performance.\n */\nclass Nonce {\n constructor(n = MIN_NONCE) {\n this.n = n;\n this.bytes = new Uint8Array(12);\n this.view = new DataView(this.bytes.buffer, this.bytes.byteOffset, this.bytes.byteLength);\n this.view.setUint32(4, n, true);\n }\n increment() {\n this.n++;\n }\n getBytes(littleEndian) {\n // Even though we're treating the nonce as 8 bytes, RFC7539 specifies 12 bytes for a nonce.\n this.view.setUint32(4, this.n, littleEndian);\n return this.bytes;\n }\n getUint64() {\n return this.n;\n }\n clone() {\n return new Nonce(this.n);\n }\n equals(b) {\n return b.n == this.n;\n }\n assertValue() {\n if (this.n > MAX_NONCE) {\n throw new Error(ERR_MAX_NONCE);\n }\n }\n}\n//# sourceMappingURL=nonce.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/nonce.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/pairing.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/pairing.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InitiatorParameters: () => (/* binding */ InitiatorParameters),\n/* harmony export */ ResponderParameters: () => (/* binding */ ResponderParameters),\n/* harmony export */ WakuPairing: () => (/* binding */ WakuPairing)\n/* harmony export */ });\n/* harmony import */ var _stablelib_hmac_drbg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @stablelib/hmac-drbg */ \"./node_modules/@stablelib/hmac-drbg/lib/hmac-drbg.js\");\n/* harmony import */ var _stablelib_random__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @stablelib/random */ \"./node_modules/@stablelib/random/lib/random.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.mjs\");\n/* harmony import */ var p_event__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! p-event */ \"./node_modules/p-event/index.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _codec_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./codec.js */ \"./node_modules/@waku/noise/dist/codec.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/noise/dist/crypto.js\");\n/* harmony import */ var _handshake_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./handshake.js */ \"./node_modules/@waku/noise/dist/handshake.js\");\n/* harmony import */ var _messagenametag_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./messagenametag.js */ \"./node_modules/@waku/noise/dist/messagenametag.js\");\n/* harmony import */ var _patterns_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./patterns.js */ \"./node_modules/@waku/noise/dist/patterns.js\");\n/* harmony import */ var _publickey_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./publickey.js */ \"./node_modules/@waku/noise/dist/publickey.js\");\n/* harmony import */ var _qr_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./qr.js */ \"./node_modules/@waku/noise/dist/qr.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_2__(\"waku:noise:pairing\");\nfunction delay(ms) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\nconst rng = new _stablelib_hmac_drbg__WEBPACK_IMPORTED_MODULE_0__.HMACDRBG();\n/**\n * Initiator parameters used to setup the pairing object\n */\nclass InitiatorParameters {\n constructor(qrCode, qrMessageNameTag) {\n this.qrCode = qrCode;\n this.qrMessageNameTag = qrMessageNameTag;\n }\n}\n/**\n * Responder parameters used to setup the pairing object\n */\nclass ResponderParameters {\n constructor(applicationName = \"waku-noise-sessions\", applicationVersion = \"0.1\", shardId = \"10\") {\n this.applicationName = applicationName;\n this.applicationVersion = applicationVersion;\n this.shardId = shardId;\n }\n}\n/**\n * Pairing object to setup a noise session\n */\nclass WakuPairing {\n /**\n * Convert a QR into a content topic\n * Must follow - https://github.com/vacp2p/rfc-index/blob/main/waku/informational/23/topics.md\n * @param qr\n * @returns content topic string\n */\n static toContentTopic(qr) {\n return \"/\" + qr.applicationName + \"/\" + qr.applicationVersion + \"/\" + qr.shardId + \"/proto\";\n }\n /**\n * @param pubsubTopic pubsubTopic to be used for handshake\n * @param sender object that implements Sender interface to publish waku messages\n * @param responder object that implements Responder interface to subscribe and receive waku messages\n * @param myStaticKey x25519 keypair\n * @param pairingParameters Pairing parameters (depending if this is the initiator or responder)\n * @param myEphemeralKey optional ephemeral key\n * @param encoderParameters optional parameters for the resulting encoders\n */\n constructor(pubsubTopic, sender, responder, myStaticKey, pairingParameters, myEphemeralKey, encoderParameters = {}) {\n this.pubsubTopic = pubsubTopic;\n this.sender = sender;\n this.responder = responder;\n this.myStaticKey = myStaticKey;\n this.myEphemeralKey = myEphemeralKey;\n this.encoderParameters = encoderParameters;\n this.started = false;\n this.eventEmitter = new eventemitter3__WEBPACK_IMPORTED_MODULE_3__.EventEmitter();\n this.hsPattern = _patterns_js__WEBPACK_IMPORTED_MODULE_10__.NoiseHandshakePatterns.Noise_WakuPairing_25519_ChaChaPoly_SHA256;\n this.randomFixLenVal = (0,_stablelib_random__WEBPACK_IMPORTED_MODULE_1__.randomBytes)(32, rng);\n this.myCommittedStaticKey = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_7__.commitPublicKey)(this.hsPattern.hash, this.myStaticKey.publicKey, this.randomFixLenVal);\n if (!this.myEphemeralKey) {\n this.myEphemeralKey = _patterns_js__WEBPACK_IMPORTED_MODULE_10__.NoiseHandshakePatterns.Noise_WakuPairing_25519_ChaChaPoly_SHA256.dhKey.generateKeyPair();\n }\n if (pairingParameters instanceof InitiatorParameters) {\n this.initiator = true;\n this.qr = _qr_js__WEBPACK_IMPORTED_MODULE_12__.QR.from(pairingParameters.qrCode);\n this.qrMessageNameTag = pairingParameters.qrMessageNameTag;\n }\n else {\n this.initiator = false;\n this.qrMessageNameTag = (0,_stablelib_random__WEBPACK_IMPORTED_MODULE_1__.randomBytes)(_messagenametag_js__WEBPACK_IMPORTED_MODULE_9__.MessageNametagLength, rng);\n this.qr = new _qr_js__WEBPACK_IMPORTED_MODULE_12__.QR(pairingParameters.applicationName, pairingParameters.applicationVersion, pairingParameters.shardId, this.myEphemeralKey.publicKey, this.myCommittedStaticKey);\n }\n // We set the contentTopic from the content topic parameters exchanged in the QR\n this.contentTopic = WakuPairing.toContentTopic(this.qr);\n // Pre-handshake message\n // <- eB {H(sB||r), contentTopicParams, messageNametag}\n const preMessagePKs = [_publickey_js__WEBPACK_IMPORTED_MODULE_11__.NoisePublicKey.fromPublicKey(this.qr.ephemeralKey)];\n this.handshake = new _handshake_js__WEBPACK_IMPORTED_MODULE_8__.Handshake({\n hsPattern: this.hsPattern,\n ephemeralKey: this.myEphemeralKey,\n staticKey: myStaticKey,\n prologue: this.qr.toByteArray(),\n preMessagePKs,\n initiator: this.initiator,\n });\n }\n /**\n * Get pairing information (as an InitiatorParameter object)\n * @returns InitiatorParameters\n */\n getPairingInfo() {\n return new InitiatorParameters(this.qr.toString(), this.qrMessageNameTag);\n }\n /**\n * Get auth code (to validate that pairing). It must be displayed on both\n * devices and the user(s) must confirm if the auth code match\n * @returns Promise that resolves to an auth code\n */\n async getAuthCode() {\n return new Promise((resolve) => {\n if (this.authCode) {\n resolve(this.authCode);\n }\n else {\n this.eventEmitter.on(\"authCodeGenerated\", (authCode) => {\n this.authCode = authCode;\n resolve(authCode);\n });\n }\n });\n }\n /**\n * Indicate if auth code is valid. This is a function that must be\n * manually called by the user(s) if the auth code in both devices being\n * paired match. If false, pairing session is terminated\n * @param isValid true if authcode is correct, false otherwise.\n */\n validateAuthCode(isValid) {\n this.eventEmitter.emit(\"confirmAuthCode\", isValid);\n }\n async isAuthCodeConfirmed() {\n // wait for user to confirm or not, or for the whole pairing process to time out\n const p1 = (0,p_event__WEBPACK_IMPORTED_MODULE_4__.pEvent)(this.eventEmitter, \"confirmAuthCode\");\n const p2 = (0,p_event__WEBPACK_IMPORTED_MODULE_4__.pEvent)(this.eventEmitter, \"pairingTimeout\");\n return Promise.race([p1, p2]);\n }\n async executeReadStepWithNextMessage(messageNametag, iterator) {\n // TODO: create test unit for this function\n let stopLoop = false;\n this.eventEmitter.once(\"pairingTimeout\", () => {\n stopLoop = true;\n });\n this.eventEmitter.once(\"pairingComplete\", () => {\n stopLoop = true;\n });\n while (!stopLoop) {\n try {\n const item = await iterator.next();\n if (!item.value) {\n throw Error(\"Received no message\");\n }\n const step = this.handshake.stepHandshake({\n readPayloadV2: item.value.payloadV2,\n messageNametag,\n });\n return step;\n }\n catch (err) {\n if (err instanceof _handshake_js__WEBPACK_IMPORTED_MODULE_8__.MessageNametagError) {\n log(\"Unexpected message nametag\", err.expectedNametag, err.actualNametag);\n }\n else {\n throw err;\n }\n }\n }\n throw new Error(\"could not obtain next message\");\n }\n async initiatorHandshake() {\n // Subscribe to the contact content topic\n const decoder = new _codec_js__WEBPACK_IMPORTED_MODULE_6__.NoiseHandshakeDecoder(this.contentTopic, this.pubsubTopic);\n const subscriptionIterator = await this.responder.toSubscriptionIterator(decoder);\n // The handshake initiator writes a Waku2 payload v2 containing the handshake message\n // and the (encrypted) transport message\n // The message is sent with a messageNametag equal to the one received through the QR code\n let hsStep = this.handshake.stepHandshake({\n transportMessage: this.myCommittedStaticKey,\n messageNametag: this.qrMessageNameTag,\n });\n // We prepare a message from initiator's payload2\n // At this point wakuMsg is sent over the Waku network to responder content topic\n let encoder = new _codec_js__WEBPACK_IMPORTED_MODULE_6__.NoiseHandshakeEncoder(this.contentTopic, this.pubsubTopic, hsStep);\n await this.sender.send(encoder, {\n payload: new Uint8Array(),\n });\n // We generate an authorization code using the handshake state\n // this check has to be confirmed with a user interaction, comparing auth codes in both ends\n const confirmationPromise = this.isAuthCodeConfirmed();\n await delay(100);\n this.eventEmitter.emit(\"authCodeGenerated\", this.handshake.genAuthcode());\n log(\"Waiting for authcode confirmation...\");\n const confirmed = await confirmationPromise;\n if (!confirmed) {\n throw new Error(\"authcode is not confirmed\");\n }\n // 2nd step\n // <- sB, eAsB {r}\n hsStep = await this.executeReadStepWithNextMessage(this.handshake.hs.toMessageNametag(), subscriptionIterator.iterator);\n await subscriptionIterator.stop();\n if (!this.handshake.hs.rs)\n throw new Error(\"invalid handshake state\");\n // Initiator further checks if responder's commitment opens to responder's static key received\n const expectedResponderCommittedStaticKey = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_7__.commitPublicKey)(this.hsPattern.hash, this.handshake.hs.rs, hsStep.transportMessage);\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_5__.equals)(expectedResponderCommittedStaticKey, this.qr.committedStaticKey)) {\n throw new Error(\"expected committed static key does not match the responder actual committed static key\");\n }\n // 3rd step\n // -> sA, sAeB, sAsB {s}\n // Similarly as in first step, the initiator writes a Waku2 payload containing the handshake message and the (encrypted) transport message\n hsStep = this.handshake.stepHandshake({\n transportMessage: this.randomFixLenVal,\n messageNametag: this.handshake.hs.toMessageNametag(),\n });\n encoder = new _codec_js__WEBPACK_IMPORTED_MODULE_6__.NoiseHandshakeEncoder(this.contentTopic, this.pubsubTopic, hsStep);\n await this.sender.send(encoder, {\n payload: new Uint8Array(),\n });\n // Secure Transfer Phase\n this.handshakeResult = this.handshake.finalizeHandshake();\n this.eventEmitter.emit(\"pairingComplete\");\n return WakuPairing.getSecureCodec(this.contentTopic, this.pubsubTopic, this.handshakeResult, this.encoderParameters);\n }\n async responderHandshake() {\n // Subscribe to the contact content topic\n const decoder = new _codec_js__WEBPACK_IMPORTED_MODULE_6__.NoiseHandshakeDecoder(this.contentTopic, this.pubsubTopic);\n const subscriptionIterator = await this.responder.toSubscriptionIterator(decoder);\n // the received reads the initiator's payloads, and returns the (decrypted) transport message the initiator sent\n // Note that the received verifies if the received payloadV2 has the expected messageNametag set\n let hsStep = await this.executeReadStepWithNextMessage(this.qrMessageNameTag, subscriptionIterator.iterator);\n const initiatorCommittedStaticKey = new Uint8Array(hsStep.transportMessage);\n const confirmationPromise = this.isAuthCodeConfirmed();\n await delay(100);\n this.eventEmitter.emit(\"authCodeGenerated\", this.handshake.genAuthcode());\n log(\"Waiting for authcode confirmation...\");\n const confirmed = await confirmationPromise;\n if (!confirmed) {\n throw new Error(\"authcode is not confirmed\");\n }\n // 2nd step\n // <- sB, eAsB {r}\n // Responder writes and returns a payload\n hsStep = this.handshake.stepHandshake({\n transportMessage: this.randomFixLenVal,\n messageNametag: this.handshake.hs.toMessageNametag(),\n });\n // We prepare a Waku message from responder's payload2\n const encoder = new _codec_js__WEBPACK_IMPORTED_MODULE_6__.NoiseHandshakeEncoder(this.contentTopic, this.pubsubTopic, hsStep);\n await this.sender.send(encoder, {\n payload: new Uint8Array(),\n });\n // 3rd step\n // -> sA, sAeB, sAsB {s}\n // The responder reads the initiator's payload sent by the initiator\n hsStep = await this.executeReadStepWithNextMessage(this.handshake.hs.toMessageNametag(), subscriptionIterator.iterator);\n await subscriptionIterator.stop();\n if (!this.handshake.hs.rs)\n throw new Error(\"invalid handshake state\");\n // The responder further checks if the initiator's commitment opens to the initiator's static key received\n const expectedInitiatorCommittedStaticKey = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_7__.commitPublicKey)(this.hsPattern.hash, this.handshake.hs.rs, hsStep.transportMessage);\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_5__.equals)(expectedInitiatorCommittedStaticKey, initiatorCommittedStaticKey)) {\n throw new Error(\"expected committed static key does not match the initiator actual committed static key\");\n }\n // Secure Transfer Phase\n this.handshakeResult = this.handshake.finalizeHandshake();\n this.eventEmitter.emit(\"pairingComplete\");\n return WakuPairing.getSecureCodec(this.contentTopic, this.pubsubTopic, this.handshakeResult, this.encoderParameters);\n }\n /**\n * Get codecs for encoding/decoding messages in js-waku. This function can be used\n * to continue a session using a stored hsResult\n * @param contentTopic Content topic for the waku messages\n * @param hsResult Noise Pairing result\n * @param encoderParameters Parameters for the resulting encoder\n * @returns an array with [NoiseSecureTransferEncoder, NoiseSecureTransferDecoder]\n */\n static getSecureCodec(contentTopic, pubsubTopic, hsResult, encoderParameters) {\n const secureEncoder = new _codec_js__WEBPACK_IMPORTED_MODULE_6__.NoiseSecureTransferEncoder(contentTopic, pubsubTopic, hsResult, encoderParameters.ephemeral, encoderParameters.metaSetter);\n const secureDecoder = new _codec_js__WEBPACK_IMPORTED_MODULE_6__.NoiseSecureTransferDecoder(contentTopic, pubsubTopic, hsResult);\n return [secureEncoder, secureDecoder];\n }\n /**\n * Get handshake result\n * @returns result of a successful pairing\n */\n getHandshakeResult() {\n if (!this.handshakeResult) {\n throw new Error(\"handshake is not complete\");\n }\n return this.handshakeResult;\n }\n /**\n * Execute handshake\n * @param timeoutMs Timeout in milliseconds after which the pairing session is invalid\n * @returns promise that resolves to codecs for encoding/decoding messages in js-waku\n */\n async execute(timeoutMs = 60000) {\n if (this.started) {\n throw new Error(\"pairing already executed. Create new pairing object\");\n }\n this.started = true;\n return new Promise((resolve, reject) => {\n // Limit QR exposure to some timeout\n const timer = setTimeout(() => {\n reject(new Error(\"pairing has timed out\"));\n this.eventEmitter.emit(\"pairingTimeout\");\n }, timeoutMs);\n const handshakeFn = this.initiator ? this.initiatorHandshake : this.responderHandshake;\n handshakeFn\n .bind(this)()\n .then((response) => resolve(response), (err) => reject(err))\n .finally(() => clearTimeout(timer));\n });\n }\n}\n//# sourceMappingURL=pairing.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/pairing.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/patterns.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/patterns.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HandshakePattern: () => (/* binding */ HandshakePattern),\n/* harmony export */ MessageDirection: () => (/* binding */ MessageDirection),\n/* harmony export */ MessagePattern: () => (/* binding */ MessagePattern),\n/* harmony export */ NoiseHandshakePatterns: () => (/* binding */ NoiseHandshakePatterns),\n/* harmony export */ NoiseTokens: () => (/* binding */ NoiseTokens),\n/* harmony export */ PayloadV2ProtocolIDs: () => (/* binding */ PayloadV2ProtocolIDs),\n/* harmony export */ PreMessagePattern: () => (/* binding */ PreMessagePattern)\n/* harmony export */ });\n/* harmony import */ var _stablelib_sha256__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @stablelib/sha256 */ \"./node_modules/@stablelib/sha256/lib/sha256.js\");\n/* harmony import */ var _chachapoly_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chachapoly.js */ \"./node_modules/@waku/noise/dist/chachapoly.js\");\n/* harmony import */ var _dh25519_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dh25519.js */ \"./node_modules/@waku/noise/dist/dh25519.js\");\n\n\n\n/**\n * The Noise tokens appearing in Noise (pre)message patterns\n * as in http://www.noiseprotocol.org/noise.html#handshake-pattern-basics\n */\nvar NoiseTokens;\n(function (NoiseTokens) {\n NoiseTokens[\"e\"] = \"e\";\n NoiseTokens[\"s\"] = \"s\";\n NoiseTokens[\"es\"] = \"es\";\n NoiseTokens[\"ee\"] = \"ee\";\n NoiseTokens[\"se\"] = \"se\";\n NoiseTokens[\"ss\"] = \"ss\";\n NoiseTokens[\"psk\"] = \"psk\";\n})(NoiseTokens || (NoiseTokens = {}));\n/**\n * The direction of a (pre)message pattern in canonical form (i.e. Alice-initiated form)\n * as in http://www.noiseprotocol.org/noise.html#alice-and-bob\n */\nvar MessageDirection;\n(function (MessageDirection) {\n MessageDirection[\"r\"] = \"->\";\n MessageDirection[\"l\"] = \"<-\";\n})(MessageDirection || (MessageDirection = {}));\n/**\n * The pre message pattern consisting of a message direction and some Noise tokens, if any.\n * (if non empty, only tokens e and s are allowed: http://www.noiseprotocol.org/noise.html#handshake-pattern-basics)\n */\nclass PreMessagePattern {\n constructor(direction, tokens) {\n this.direction = direction;\n this.tokens = tokens;\n }\n /**\n * Check PreMessagePattern equality\n * @param other object to compare against\n * @returns true if equal, false otherwise\n */\n equals(other) {\n return (this.direction == other.direction &&\n this.tokens.length === other.tokens.length &&\n this.tokens.every((val, index) => val === other.tokens[index]));\n }\n}\n/**\n * The message pattern consisting of a message direction and some Noise tokens\n * All Noise tokens are allowed\n */\nclass MessagePattern {\n constructor(direction, tokens) {\n this.direction = direction;\n this.tokens = tokens;\n }\n /**\n * Check MessagePattern equality\n * @param other object to compare against\n * @returns true if equal, false otherwise\n */\n equals(other) {\n return (this.direction == other.direction &&\n this.tokens.length === other.tokens.length &&\n this.tokens.every((val, index) => val === other.tokens[index]));\n }\n}\n/**\n * The handshake pattern object. It stores the handshake protocol name, the\n * handshake pre message patterns and the handshake message patterns\n */\nclass HandshakePattern {\n constructor(name, dhKeyType, cipherType, hash, preMessagePatterns, messagePatterns) {\n this.name = name;\n this.hash = hash;\n this.preMessagePatterns = preMessagePatterns;\n this.messagePatterns = messagePatterns;\n this.dhKey = new dhKeyType();\n this.cipher = new cipherType();\n }\n /**\n * Check HandshakePattern equality\n * @param other object to compare against\n * @returns true if equal, false otherwise\n */\n equals(other) {\n if (this.preMessagePatterns.length != other.preMessagePatterns.length)\n return false;\n for (let i = 0; i < this.preMessagePatterns.length; i++) {\n if (!this.preMessagePatterns[i].equals(other.preMessagePatterns[i]))\n return false;\n }\n if (this.messagePatterns.length != other.messagePatterns.length)\n return false;\n for (let i = 0; i < this.messagePatterns.length; i++) {\n if (!this.messagePatterns[i].equals(other.messagePatterns[i]))\n return false;\n }\n return this.name == other.name;\n }\n}\n/**\n * Supported Noise handshake patterns as defined in https://rfc.vac.dev/spec/35/#specification\n */\nconst NoiseHandshakePatterns = {\n Noise_K1K1_25519_ChaChaPoly_SHA256: new HandshakePattern(\"Noise_K1K1_25519_ChaChaPoly_SHA256\", _dh25519_js__WEBPACK_IMPORTED_MODULE_2__.DH25519, _chachapoly_js__WEBPACK_IMPORTED_MODULE_1__.ChaChaPoly, _stablelib_sha256__WEBPACK_IMPORTED_MODULE_0__.SHA256, [\n new PreMessagePattern(MessageDirection.r, [NoiseTokens.s]),\n new PreMessagePattern(MessageDirection.l, [NoiseTokens.s]),\n ], [\n new MessagePattern(MessageDirection.r, [NoiseTokens.e]),\n new MessagePattern(MessageDirection.l, [NoiseTokens.e, NoiseTokens.ee, NoiseTokens.es]),\n new MessagePattern(MessageDirection.r, [NoiseTokens.se]),\n ]),\n Noise_XK1_25519_ChaChaPoly_SHA256: new HandshakePattern(\"Noise_XK1_25519_ChaChaPoly_SHA256\", _dh25519_js__WEBPACK_IMPORTED_MODULE_2__.DH25519, _chachapoly_js__WEBPACK_IMPORTED_MODULE_1__.ChaChaPoly, _stablelib_sha256__WEBPACK_IMPORTED_MODULE_0__.SHA256, [new PreMessagePattern(MessageDirection.l, [NoiseTokens.s])], [\n new MessagePattern(MessageDirection.r, [NoiseTokens.e]),\n new MessagePattern(MessageDirection.l, [NoiseTokens.e, NoiseTokens.ee, NoiseTokens.es]),\n new MessagePattern(MessageDirection.r, [NoiseTokens.s, NoiseTokens.se]),\n ]),\n Noise_XX_25519_ChaChaPoly_SHA256: new HandshakePattern(\"Noise_XX_25519_ChaChaPoly_SHA256\", _dh25519_js__WEBPACK_IMPORTED_MODULE_2__.DH25519, _chachapoly_js__WEBPACK_IMPORTED_MODULE_1__.ChaChaPoly, _stablelib_sha256__WEBPACK_IMPORTED_MODULE_0__.SHA256, [], [\n new MessagePattern(MessageDirection.r, [NoiseTokens.e]),\n new MessagePattern(MessageDirection.l, [NoiseTokens.e, NoiseTokens.ee, NoiseTokens.s, NoiseTokens.es]),\n new MessagePattern(MessageDirection.r, [NoiseTokens.s, NoiseTokens.se]),\n ]),\n Noise_XXpsk0_25519_ChaChaPoly_SHA256: new HandshakePattern(\"Noise_XXpsk0_25519_ChaChaPoly_SHA256\", _dh25519_js__WEBPACK_IMPORTED_MODULE_2__.DH25519, _chachapoly_js__WEBPACK_IMPORTED_MODULE_1__.ChaChaPoly, _stablelib_sha256__WEBPACK_IMPORTED_MODULE_0__.SHA256, [], [\n new MessagePattern(MessageDirection.r, [NoiseTokens.psk, NoiseTokens.e]),\n new MessagePattern(MessageDirection.l, [NoiseTokens.e, NoiseTokens.ee, NoiseTokens.s, NoiseTokens.es]),\n new MessagePattern(MessageDirection.r, [NoiseTokens.s, NoiseTokens.se]),\n ]),\n Noise_WakuPairing_25519_ChaChaPoly_SHA256: new HandshakePattern(\"Noise_WakuPairing_25519_ChaChaPoly_SHA256\", _dh25519_js__WEBPACK_IMPORTED_MODULE_2__.DH25519, _chachapoly_js__WEBPACK_IMPORTED_MODULE_1__.ChaChaPoly, _stablelib_sha256__WEBPACK_IMPORTED_MODULE_0__.SHA256, [new PreMessagePattern(MessageDirection.l, [NoiseTokens.e])], [\n new MessagePattern(MessageDirection.r, [NoiseTokens.e, NoiseTokens.ee]),\n new MessagePattern(MessageDirection.l, [NoiseTokens.s, NoiseTokens.es]),\n new MessagePattern(MessageDirection.r, [NoiseTokens.s, NoiseTokens.se, NoiseTokens.ss]),\n ]),\n};\n/**\n * Supported Protocol ID for PayloadV2 objects\n * Protocol IDs are defined according to https://rfc.vac.dev/spec/35/#specification\n */\nconst PayloadV2ProtocolIDs = {\n \"\": 0,\n Noise_K1K1_25519_ChaChaPoly_SHA256: 10,\n Noise_XK1_25519_ChaChaPoly_SHA256: 11,\n Noise_XX_25519_ChaChaPoly_SHA256: 12,\n Noise_XXpsk0_25519_ChaChaPoly_SHA256: 13,\n Noise_WakuPairing_25519_ChaChaPoly_SHA256: 14,\n ChaChaPoly: 30,\n};\n//# sourceMappingURL=patterns.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/patterns.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/payload.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/payload.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PayloadV2: () => (/* binding */ PayloadV2)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _messagenametag_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./messagenametag.js */ \"./node_modules/@waku/noise/dist/messagenametag.js\");\n/* harmony import */ var _patterns_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./patterns.js */ \"./node_modules/@waku/noise/dist/patterns.js\");\n/* harmony import */ var _publickey_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./publickey.js */ \"./node_modules/@waku/noise/dist/publickey.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@waku/noise/dist/utils.js\");\n\n\n\n\n\n\nconst authDataLen = 16;\n/**\n * PayloadV2 defines an object for Waku payloads with version 2 as in\n * https://rfc.vac.dev/spec/35/#public-keys-serialization\n * It contains a message nametag, protocol ID field, the handshake message (for Noise handshakes)\n * and the transport message\n */\nclass PayloadV2 {\n constructor(messageNametag = new Uint8Array(_messagenametag_js__WEBPACK_IMPORTED_MODULE_2__.MessageNametagLength), protocolId = 0, handshakeMessage = [], transportMessage = new Uint8Array()) {\n this.messageNametag = messageNametag;\n this.protocolId = protocolId;\n this.handshakeMessage = handshakeMessage;\n this.transportMessage = transportMessage;\n }\n /**\n * Create a copy of the PayloadV2\n * @returns a copy of the PayloadV2\n */\n clone() {\n const r = new PayloadV2();\n r.protocolId = this.protocolId;\n r.transportMessage = new Uint8Array(this.transportMessage);\n r.messageNametag = new Uint8Array(this.messageNametag);\n for (let i = 0; i < this.handshakeMessage.length; i++) {\n r.handshakeMessage.push(this.handshakeMessage[i].clone());\n }\n return r;\n }\n /**\n * Check PayloadV2 equality\n * @param other object to compare against\n * @returns true if equal, false otherwise\n */\n equals(other) {\n let pkEquals = true;\n if (this.handshakeMessage.length != other.handshakeMessage.length) {\n pkEquals = false;\n }\n for (let i = 0; i < this.handshakeMessage.length; i++) {\n if (!this.handshakeMessage[i].equals(other.handshakeMessage[i])) {\n pkEquals = false;\n break;\n }\n }\n return ((0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(this.messageNametag, other.messageNametag) &&\n this.protocolId == other.protocolId &&\n (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(this.transportMessage, other.transportMessage) &&\n pkEquals);\n }\n /**\n * Serializes a PayloadV2 object to a byte sequences according to https://rfc.vac.dev/spec/35/.\n * The output serialized payload concatenates the input PayloadV2 object fields as\n * payload = ( protocolId || serializedHandshakeMessageLen || serializedHandshakeMessage || transportMessageLen || transportMessage)\n * The output can be then passed to the payload field of a WakuMessage https://rfc.vac.dev/spec/14/\n * @returns serialized payload\n */\n serialize() {\n // We collect public keys contained in the handshake message\n // According to https://rfc.vac.dev/spec/35/, the maximum size for the handshake message is 256 bytes, that is\n // the handshake message length can be represented with 1 byte only. (its length can be stored in 1 byte)\n // However, to ease public keys length addition operation, we declare it as int and later cast to uit8\n let serializedHandshakeMessageLen = 0;\n // This variables will store the concatenation of the serializations of all public keys in the handshake message\n let serializedHandshakeMessage = new Uint8Array();\n // For each public key in the handshake message\n for (const pk of this.handshakeMessage) {\n // We serialize the public key\n const serializedPk = pk.serialize();\n // We sum its serialized length to the total\n serializedHandshakeMessageLen += serializedPk.length;\n // We add its serialization to the concatenation of all serialized public keys in the handshake message\n serializedHandshakeMessage = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([serializedHandshakeMessage, serializedPk]);\n // If we are processing more than 256 byte, we return an error\n if (serializedHandshakeMessageLen > 255) {\n console.debug(\"PayloadV2 malformed: too many public keys contained in the handshake message\");\n throw new Error(\"too many public keys in handshake message\");\n }\n }\n // The output payload as in https://rfc.vac.dev/spec/35/. We concatenate all the PayloadV2 fields as\n // payload = ( protocolId || serializedHandshakeMessageLen || serializedHandshakeMessage || transportMessageLen || transportMessage)\n // We concatenate all the data\n // The protocol ID (1 byte) and handshake message length (1 byte) can be directly casted to byte to allow direct copy to the payload byte sequence\n const payload = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([\n this.messageNametag,\n new Uint8Array([this.protocolId]),\n new Uint8Array([serializedHandshakeMessageLen]),\n serializedHandshakeMessage,\n // The transport message length is converted from uint64 to bytes in Little-Endian\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.writeUIntLE)(new Uint8Array(8), this.transportMessage.length, 0, 8),\n this.transportMessage,\n ]);\n return payload;\n }\n /**\n * Deserializes a byte sequence to a PayloadV2 object according to https://rfc.vac.dev/spec/35/.\n * @param payload input serialized payload\n * @returns PayloadV2\n */\n static deserialize(payload) {\n // i is the read input buffer position index\n let i = 0;\n // We start by reading the messageNametag\n const messageNametag = new Uint8Array(_messagenametag_js__WEBPACK_IMPORTED_MODULE_2__.MessageNametagLength);\n for (let j = 0; j < _messagenametag_js__WEBPACK_IMPORTED_MODULE_2__.MessageNametagLength; j++) {\n messageNametag[j] = payload[i + j];\n }\n i += _messagenametag_js__WEBPACK_IMPORTED_MODULE_2__.MessageNametagLength;\n // We read the Protocol ID\n const protocolId = payload[i];\n const protocolName = Object.keys(_patterns_js__WEBPACK_IMPORTED_MODULE_3__.PayloadV2ProtocolIDs).find((key) => _patterns_js__WEBPACK_IMPORTED_MODULE_3__.PayloadV2ProtocolIDs[key] === protocolId);\n if (protocolName === undefined) {\n throw new Error(\"protocolId not found\");\n }\n const pattern = _patterns_js__WEBPACK_IMPORTED_MODULE_3__.NoiseHandshakePatterns[protocolName];\n const keySize = pattern ? pattern.dhKey.DHLen() : 0;\n i++;\n // We read the Handshake Message length (1 byte)\n const handshakeMessageLen = payload[i];\n if (handshakeMessageLen > 255) {\n console.debug(\"payload malformed: too many public keys contained in the handshake message\");\n throw new Error(\"too many public keys in handshake message\");\n }\n i++;\n // We now read for handshakeMessageLen bytes the buffer and we deserialize each (encrypted/unencrypted) public key read\n // In handshakeMessage we accumulate the read deserialized Noise Public keys\n const handshakeMessage = new Array();\n let written = 0;\n // We read the buffer until handshakeMessageLen are read\n while (written != handshakeMessageLen) {\n // We obtain the current Noise Public key encryption flag\n const flag = payload[i];\n // If the key is unencrypted, we only read the X coordinate of the EC public key and we deserialize into a Noise Public Key\n if (flag === 0) {\n const pkLen = 1 + keySize;\n handshakeMessage.push(_publickey_js__WEBPACK_IMPORTED_MODULE_4__.NoisePublicKey.deserialize(payload.subarray(i, i + pkLen)));\n i += pkLen;\n written += pkLen;\n // If the key is encrypted, we only read the encrypted X coordinate and the authorization tag, and we deserialize into a Noise Public Key\n }\n else if (flag === 1) {\n const pkLen = 1 + keySize + authDataLen;\n handshakeMessage.push(_publickey_js__WEBPACK_IMPORTED_MODULE_4__.NoisePublicKey.deserialize(payload.subarray(i, i + pkLen)));\n i += pkLen;\n written += pkLen;\n }\n else {\n throw new Error(\"invalid flag for Noise public key\");\n }\n }\n // We read the transport message length (8 bytes) and we convert to uint64 in Little Endian\n const transportMessageLen = (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.readUIntLE)(payload, i, i + 8 - 1);\n i += 8;\n // We read the transport message (handshakeMessage bytes)\n const transportMessage = payload.subarray(i, i + transportMessageLen);\n i += transportMessageLen;\n return new PayloadV2(messageNametag, protocolId, handshakeMessage, transportMessage);\n }\n}\n//# sourceMappingURL=payload.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/payload.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/publickey.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/publickey.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ NoisePublicKey: () => (/* binding */ NoisePublicKey)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n\n\n/**\n * A Noise public key is a public key exchanged during Noise handshakes (no private part)\n * This follows https://rfc.vac.dev/spec/35/#public-keys-serialization\n */\nclass NoisePublicKey {\n /**\n * @param flag 1 to indicate that the public key is encrypted, 0 for unencrypted.\n * Note: besides encryption, flag can be used to distinguish among multiple supported Elliptic Curves\n * @param pk contains the X coordinate of the public key, if unencrypted\n * or the encryption of the X coordinate concatenated with the authorization tag, if encrypted\n */\n constructor(flag, pk) {\n this.flag = flag;\n this.pk = pk;\n }\n /**\n * Create a copy of the NoisePublicKey\n * @returns a copy of the NoisePublicKey\n */\n clone() {\n return new NoisePublicKey(this.flag, new Uint8Array(this.pk));\n }\n /**\n * Check NoisePublicKey equality\n * @param other object to compare against\n * @returns true if equal, false otherwise\n */\n equals(other) {\n return this.flag == other.flag && (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(this.pk, other.pk);\n }\n /**\n * Converts a public Elliptic Curve key to an unencrypted Noise public key\n * @param publicKey 32-byte public key\n * @returns NoisePublicKey\n */\n static fromPublicKey(publicKey) {\n return new NoisePublicKey(0, publicKey);\n }\n /**\n * Converts a Noise public key to a stream of bytes as in https://rfc.vac.dev/spec/35/#public-keys-serialization\n * @returns Serialized NoisePublicKey\n */\n serialize() {\n // Public key is serialized as (flag || pk)\n // Note that pk contains the X coordinate of the public key if unencrypted\n // or the encryption concatenated with the authorization tag if encrypted\n const serializedNoisePublicKey = new Uint8Array((0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([new Uint8Array([this.flag ? 1 : 0]), this.pk]));\n return serializedNoisePublicKey;\n }\n /**\n * Converts a serialized Noise public key to a NoisePublicKey object as in https://rfc.vac.dev/spec/35/#public-keys-serialization\n * @param serializedPK Serialized NoisePublicKey\n * @returns NoisePublicKey\n */\n static deserialize(serializedPK) {\n if (serializedPK.length == 0)\n throw new Error(\"invalid serialized key\");\n // We retrieve the encryption flag\n const flag = serializedPK[0];\n if (!(flag == 0 || flag == 1))\n throw new Error(\"invalid flag in serialized public key\");\n const pk = serializedPK.subarray(1);\n return new NoisePublicKey(flag, pk);\n }\n}\n//# sourceMappingURL=publickey.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/publickey.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/qr.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/qr.js ***!
|
||
\*********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ QR: () => (/* binding */ QR)\n/* harmony export */ });\n/* harmony import */ var uint8arrays__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays */ \"./node_modules/uint8arrays/dist/src/index.js\");\n\n/**\n * QR code generation\n */\nclass QR {\n constructor(applicationName, applicationVersion, shardId, ephemeralKey, committedStaticKey) {\n this.applicationName = applicationName;\n this.applicationVersion = applicationVersion;\n this.shardId = shardId;\n this.ephemeralKey = ephemeralKey;\n this.committedStaticKey = committedStaticKey;\n }\n // Serializes input parameters to a base64 string for exposure through QR code (used by WakuPairing)\n toString() {\n let qr = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.toString)((0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.fromString)(this.applicationName), \"base64urlpad\") + \":\";\n qr += (0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.toString)((0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.fromString)(this.applicationVersion), \"base64urlpad\") + \":\";\n qr += (0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.toString)((0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.fromString)(this.shardId), \"base64urlpad\") + \":\";\n qr += (0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.toString)(this.ephemeralKey, \"base64urlpad\") + \":\";\n qr += (0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.toString)(this.committedStaticKey, \"base64urlpad\");\n return qr;\n }\n /**\n * Convert QR code into byte array\n * @returns byte array serialization of a base64 encoded QR code\n */\n toByteArray() {\n const enc = new TextEncoder();\n return enc.encode(this.toString());\n }\n /**\n * Deserializes input string in base64 to the corresponding (applicationName, applicationVersion, shardId, ephemeralKey, committedStaticKey)\n * @param input input base64 encoded string\n * @returns QR\n */\n static from(input) {\n let qrStr;\n if (input instanceof Uint8Array) {\n const dec = new TextDecoder();\n qrStr = dec.decode(input);\n }\n else {\n qrStr = input;\n }\n const values = qrStr.split(\":\");\n if (values.length != 5)\n throw new Error(\"invalid qr string\");\n const applicationName = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.toString)((0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.fromString)(values[0], \"base64urlpad\"));\n const applicationVersion = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.toString)((0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.fromString)(values[1], \"base64urlpad\"));\n const shardId = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.toString)((0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.fromString)(values[2], \"base64urlpad\"));\n const ephemeralKey = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.fromString)(values[3], \"base64urlpad\");\n const committedStaticKey = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.fromString)(values[4], \"base64urlpad\");\n return new QR(applicationName, applicationVersion, shardId, ephemeralKey, committedStaticKey);\n }\n}\n//# sourceMappingURL=qr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/qr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/noise/dist/utils.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@waku/noise/dist/utils.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ readUIntLE: () => (/* binding */ readUIntLE),\n/* harmony export */ writeUIntLE: () => (/* binding */ writeUIntLE)\n/* harmony export */ });\n// Adapted from https://github.com/feross/buffer\nfunction checkInt(buf, value, offset, ext, max, min) {\n if (value > max || value < min)\n throw new RangeError('\"value\" argument is out of bounds');\n if (offset + ext > buf.length)\n throw new RangeError(\"Index out of range\");\n}\nfunction writeUIntLE(buf, value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(buf, value, offset, byteLength, maxBytes, 0);\n }\n let mul = 1;\n let i = 0;\n buf[offset] = value & 0xff;\n while (++i < byteLength && (mul *= 0x100)) {\n buf[offset + i] = (value / mul) & 0xff;\n }\n return buf;\n}\nfunction checkOffset(offset, ext, length) {\n if (offset % 1 !== 0 || offset < 0)\n throw new RangeError(\"offset is not uint\");\n if (offset + ext > length)\n throw new RangeError(\"Trying to access beyond buffer length\");\n}\nfunction readUIntLE(buf, offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength, buf.length);\n let val = buf[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength && (mul *= 0x100)) {\n val += buf[offset + i] * mul;\n }\n return val;\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/noise/dist/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/proto/dist/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@waku/proto/dist/index.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushResponse: () => (/* reexport safe */ _lib_light_push_js__WEBPACK_IMPORTED_MODULE_4__.PushResponse),\n/* harmony export */ TopicOnlyMessage: () => (/* reexport safe */ _lib_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__.TopicOnlyMessage),\n/* harmony export */ WakuMessage: () => (/* reexport safe */ _lib_filter_js__WEBPACK_IMPORTED_MODULE_1__.WakuMessage),\n/* harmony export */ proto_filter: () => (/* reexport module object */ _lib_filter_js__WEBPACK_IMPORTED_MODULE_1__),\n/* harmony export */ proto_filter_v2: () => (/* reexport module object */ _lib_filter_v2_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ proto_lightpush: () => (/* reexport module object */ _lib_light_push_js__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ proto_message: () => (/* reexport module object */ _lib_message_js__WEBPACK_IMPORTED_MODULE_0__),\n/* harmony export */ proto_metadata: () => (/* reexport module object */ _lib_metadata_js__WEBPACK_IMPORTED_MODULE_7__),\n/* harmony export */ proto_peer_exchange: () => (/* reexport module object */ _lib_peer_exchange_js__WEBPACK_IMPORTED_MODULE_6__),\n/* harmony export */ proto_store: () => (/* reexport module object */ _lib_store_js__WEBPACK_IMPORTED_MODULE_5__),\n/* harmony export */ proto_topic_only_message: () => (/* reexport module object */ _lib_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__)\n/* harmony export */ });\n/* harmony import */ var _lib_message_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/message.js */ \"./node_modules/@waku/proto/dist/lib/message.js\");\n/* harmony import */ var _lib_filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/filter.js */ \"./node_modules/@waku/proto/dist/lib/filter.js\");\n/* harmony import */ var _lib_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/topic_only_message.js */ \"./node_modules/@waku/proto/dist/lib/topic_only_message.js\");\n/* harmony import */ var _lib_filter_v2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/filter_v2.js */ \"./node_modules/@waku/proto/dist/lib/filter_v2.js\");\n/* harmony import */ var _lib_light_push_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/light_push.js */ \"./node_modules/@waku/proto/dist/lib/light_push.js\");\n/* harmony import */ var _lib_store_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/store.js */ \"./node_modules/@waku/proto/dist/lib/store.js\");\n/* harmony import */ var _lib_peer_exchange_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lib/peer_exchange.js */ \"./node_modules/@waku/proto/dist/lib/peer_exchange.js\");\n/* harmony import */ var _lib_metadata_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./lib/metadata.js */ \"./node_modules/@waku/proto/dist/lib/metadata.js\");\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/proto/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/proto/dist/lib/filter.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/@waku/proto/dist/lib/filter.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterRequest: () => (/* binding */ FilterRequest),\n/* harmony export */ FilterRpc: () => (/* binding */ FilterRpc),\n/* harmony export */ MessagePush: () => (/* binding */ MessagePush),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar FilterRequest;\n(function (FilterRequest) {\n let ContentFilter;\n (function (ContentFilter) {\n let _codec;\n ContentFilter.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(10);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.contentTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ContentFilter.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ContentFilter.codec());\n };\n ContentFilter.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ContentFilter.codec());\n };\n })(ContentFilter = FilterRequest.ContentFilter || (FilterRequest.ContentFilter = {}));\n let _codec;\n FilterRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.subscribe != null && obj.subscribe !== false)) {\n w.uint32(8);\n w.bool(obj.subscribe);\n }\n if ((obj.topic != null && obj.topic !== '')) {\n w.uint32(18);\n w.string(obj.topic);\n }\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n w.uint32(26);\n FilterRequest.ContentFilter.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n subscribe: false,\n topic: '',\n contentFilters: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.subscribe = reader.bool();\n break;\n case 2:\n obj.topic = reader.string();\n break;\n case 3:\n obj.contentFilters.push(FilterRequest.ContentFilter.codec().decode(reader, reader.uint32()));\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterRequest.codec());\n };\n FilterRequest.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterRequest.codec());\n };\n})(FilterRequest || (FilterRequest = {}));\nvar MessagePush;\n(function (MessagePush) {\n let _codec;\n MessagePush.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.messages != null) {\n for (const value of obj.messages) {\n w.uint32(10);\n WakuMessage.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n messages: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32()));\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n MessagePush.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, MessagePush.codec());\n };\n MessagePush.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, MessagePush.codec());\n };\n})(MessagePush || (MessagePush = {}));\nvar FilterRpc;\n(function (FilterRpc) {\n let _codec;\n FilterRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.request != null) {\n w.uint32(18);\n FilterRequest.codec().encode(obj.request, w);\n }\n if (obj.push != null) {\n w.uint32(26);\n MessagePush.codec().encode(obj.push, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.request = FilterRequest.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.push = MessagePush.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterRpc.codec());\n };\n FilterRpc.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterRpc.codec());\n };\n})(FilterRpc || (FilterRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n proof: new Uint8Array(0),\n merkleRoot: new Uint8Array(0),\n epoch: new Uint8Array(0),\n shareX: new Uint8Array(0),\n shareY: new Uint8Array(0),\n nullifier: new Uint8Array(0),\n rlnIdentifier: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.proof = reader.bytes();\n break;\n case 2:\n obj.merkleRoot = reader.bytes();\n break;\n case 3:\n obj.epoch = reader.bytes();\n break;\n case 4:\n obj.shareX = reader.bytes();\n break;\n case 5:\n obj.shareY = reader.bytes();\n break;\n case 6:\n obj.nullifier = reader.bytes();\n break;\n case 7:\n obj.rlnIdentifier = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec());\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n payload: new Uint8Array(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n case 11:\n obj.meta = reader.bytes();\n break;\n case 21:\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32());\n break;\n case 31:\n obj.ephemeral = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec());\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=filter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/proto/dist/lib/filter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/proto/dist/lib/filter_v2.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/@waku/proto/dist/lib/filter_v2.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterSubscribeRequest: () => (/* binding */ FilterSubscribeRequest),\n/* harmony export */ FilterSubscribeResponse: () => (/* binding */ FilterSubscribeResponse),\n/* harmony export */ MessagePush: () => (/* binding */ MessagePush),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar FilterSubscribeRequest;\n(function (FilterSubscribeRequest) {\n let FilterSubscribeType;\n (function (FilterSubscribeType) {\n FilterSubscribeType[\"SUBSCRIBER_PING\"] = \"SUBSCRIBER_PING\";\n FilterSubscribeType[\"SUBSCRIBE\"] = \"SUBSCRIBE\";\n FilterSubscribeType[\"UNSUBSCRIBE\"] = \"UNSUBSCRIBE\";\n FilterSubscribeType[\"UNSUBSCRIBE_ALL\"] = \"UNSUBSCRIBE_ALL\";\n })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));\n let __FilterSubscribeTypeValues;\n (function (__FilterSubscribeTypeValues) {\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"SUBSCRIBER_PING\"] = 0] = \"SUBSCRIBER_PING\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"SUBSCRIBE\"] = 1] = \"SUBSCRIBE\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"UNSUBSCRIBE\"] = 2] = \"UNSUBSCRIBE\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"UNSUBSCRIBE_ALL\"] = 3] = \"UNSUBSCRIBE_ALL\";\n })(__FilterSubscribeTypeValues || (__FilterSubscribeTypeValues = {}));\n (function (FilterSubscribeType) {\n FilterSubscribeType.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__FilterSubscribeTypeValues);\n };\n })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));\n let _codec;\n FilterSubscribeRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.filterSubscribeType != null && __FilterSubscribeTypeValues[obj.filterSubscribeType] !== 0) {\n w.uint32(16);\n FilterSubscribeRequest.FilterSubscribeType.codec().encode(obj.filterSubscribeType, w);\n }\n if (obj.pubsubTopic != null) {\n w.uint32(82);\n w.string(obj.pubsubTopic);\n }\n if (obj.contentTopics != null) {\n for (const value of obj.contentTopics) {\n w.uint32(90);\n w.string(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n requestId: '',\n filterSubscribeType: FilterSubscribeType.SUBSCRIBER_PING,\n contentTopics: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.filterSubscribeType = FilterSubscribeRequest.FilterSubscribeType.codec().decode(reader);\n break;\n case 10:\n obj.pubsubTopic = reader.string();\n break;\n case 11:\n obj.contentTopics.push(reader.string());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterSubscribeRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterSubscribeRequest.codec());\n };\n FilterSubscribeRequest.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterSubscribeRequest.codec());\n };\n})(FilterSubscribeRequest || (FilterSubscribeRequest = {}));\nvar FilterSubscribeResponse;\n(function (FilterSubscribeResponse) {\n let _codec;\n FilterSubscribeResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if ((obj.statusCode != null && obj.statusCode !== 0)) {\n w.uint32(80);\n w.uint32(obj.statusCode);\n }\n if (obj.statusDesc != null) {\n w.uint32(90);\n w.string(obj.statusDesc);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n requestId: '',\n statusCode: 0\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 10:\n obj.statusCode = reader.uint32();\n break;\n case 11:\n obj.statusDesc = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterSubscribeResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterSubscribeResponse.codec());\n };\n FilterSubscribeResponse.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterSubscribeResponse.codec());\n };\n})(FilterSubscribeResponse || (FilterSubscribeResponse = {}));\nvar MessagePush;\n(function (MessagePush) {\n let _codec;\n MessagePush.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.wakuMessage != null) {\n w.uint32(10);\n WakuMessage.codec().encode(obj.wakuMessage, w);\n }\n if (obj.pubsubTopic != null) {\n w.uint32(18);\n w.string(obj.pubsubTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.wakuMessage = WakuMessage.codec().decode(reader, reader.uint32());\n break;\n case 2:\n obj.pubsubTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n MessagePush.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, MessagePush.codec());\n };\n MessagePush.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, MessagePush.codec());\n };\n})(MessagePush || (MessagePush = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n proof: new Uint8Array(0),\n merkleRoot: new Uint8Array(0),\n epoch: new Uint8Array(0),\n shareX: new Uint8Array(0),\n shareY: new Uint8Array(0),\n nullifier: new Uint8Array(0),\n rlnIdentifier: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.proof = reader.bytes();\n break;\n case 2:\n obj.merkleRoot = reader.bytes();\n break;\n case 3:\n obj.epoch = reader.bytes();\n break;\n case 4:\n obj.shareX = reader.bytes();\n break;\n case 5:\n obj.shareY = reader.bytes();\n break;\n case 6:\n obj.nullifier = reader.bytes();\n break;\n case 7:\n obj.rlnIdentifier = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec());\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n payload: new Uint8Array(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n case 11:\n obj.meta = reader.bytes();\n break;\n case 21:\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32());\n break;\n case 31:\n obj.ephemeral = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec());\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=filter_v2.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/proto/dist/lib/filter_v2.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/proto/dist/lib/light_push.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/@waku/proto/dist/lib/light_push.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushRequest: () => (/* binding */ PushRequest),\n/* harmony export */ PushResponse: () => (/* binding */ PushResponse),\n/* harmony export */ PushRpc: () => (/* binding */ PushRpc),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar PushRequest;\n(function (PushRequest) {\n let _codec;\n PushRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {\n w.uint32(10);\n w.string(obj.pubsubTopic);\n }\n if (obj.message != null) {\n w.uint32(18);\n WakuMessage.codec().encode(obj.message, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n pubsubTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.pubsubTopic = reader.string();\n break;\n case 2:\n obj.message = WakuMessage.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushRequest.codec());\n };\n PushRequest.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushRequest.codec());\n };\n})(PushRequest || (PushRequest = {}));\nvar PushResponse;\n(function (PushResponse) {\n let _codec;\n PushResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.isSuccess != null && obj.isSuccess !== false)) {\n w.uint32(8);\n w.bool(obj.isSuccess);\n }\n if (obj.info != null) {\n w.uint32(18);\n w.string(obj.info);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n isSuccess: false\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.isSuccess = reader.bool();\n break;\n case 2:\n obj.info = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushResponse.codec());\n };\n PushResponse.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushResponse.codec());\n };\n})(PushResponse || (PushResponse = {}));\nvar PushRpc;\n(function (PushRpc) {\n let _codec;\n PushRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.request != null) {\n w.uint32(18);\n PushRequest.codec().encode(obj.request, w);\n }\n if (obj.response != null) {\n w.uint32(26);\n PushResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.request = PushRequest.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.response = PushResponse.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushRpc.codec());\n };\n PushRpc.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushRpc.codec());\n };\n})(PushRpc || (PushRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n proof: new Uint8Array(0),\n merkleRoot: new Uint8Array(0),\n epoch: new Uint8Array(0),\n shareX: new Uint8Array(0),\n shareY: new Uint8Array(0),\n nullifier: new Uint8Array(0),\n rlnIdentifier: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.proof = reader.bytes();\n break;\n case 2:\n obj.merkleRoot = reader.bytes();\n break;\n case 3:\n obj.epoch = reader.bytes();\n break;\n case 4:\n obj.shareX = reader.bytes();\n break;\n case 5:\n obj.shareY = reader.bytes();\n break;\n case 6:\n obj.nullifier = reader.bytes();\n break;\n case 7:\n obj.rlnIdentifier = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec());\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n payload: new Uint8Array(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n case 11:\n obj.meta = reader.bytes();\n break;\n case 21:\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32());\n break;\n case 31:\n obj.ephemeral = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec());\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/proto/dist/lib/light_push.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/proto/dist/lib/message.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@waku/proto/dist/lib/message.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n proof: new Uint8Array(0),\n merkleRoot: new Uint8Array(0),\n epoch: new Uint8Array(0),\n shareX: new Uint8Array(0),\n shareY: new Uint8Array(0),\n nullifier: new Uint8Array(0),\n rlnIdentifier: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.proof = reader.bytes();\n break;\n case 2:\n obj.merkleRoot = reader.bytes();\n break;\n case 3:\n obj.epoch = reader.bytes();\n break;\n case 4:\n obj.shareX = reader.bytes();\n break;\n case 5:\n obj.shareY = reader.bytes();\n break;\n case 6:\n obj.nullifier = reader.bytes();\n break;\n case 7:\n obj.rlnIdentifier = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec());\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n payload: new Uint8Array(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n case 11:\n obj.meta = reader.bytes();\n break;\n case 21:\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32());\n break;\n case 31:\n obj.ephemeral = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec());\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/proto/dist/lib/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/proto/dist/lib/metadata.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@waku/proto/dist/lib/metadata.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WakuMetadataRequest: () => (/* binding */ WakuMetadataRequest),\n/* harmony export */ WakuMetadataResponse: () => (/* binding */ WakuMetadataResponse)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar WakuMetadataRequest;\n(function (WakuMetadataRequest) {\n let _codec;\n WakuMetadataRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.clusterId != null) {\n w.uint32(8);\n w.uint32(obj.clusterId);\n }\n if (obj.shards != null) {\n for (const value of obj.shards) {\n w.uint32(16);\n w.uint32(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n shards: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.clusterId = reader.uint32();\n break;\n case 2:\n obj.shards.push(reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMetadataRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMetadataRequest.codec());\n };\n WakuMetadataRequest.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMetadataRequest.codec());\n };\n})(WakuMetadataRequest || (WakuMetadataRequest = {}));\nvar WakuMetadataResponse;\n(function (WakuMetadataResponse) {\n let _codec;\n WakuMetadataResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.clusterId != null) {\n w.uint32(8);\n w.uint32(obj.clusterId);\n }\n if (obj.shards != null) {\n for (const value of obj.shards) {\n w.uint32(16);\n w.uint32(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n shards: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.clusterId = reader.uint32();\n break;\n case 2:\n obj.shards.push(reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMetadataResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMetadataResponse.codec());\n };\n WakuMetadataResponse.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMetadataResponse.codec());\n };\n})(WakuMetadataResponse || (WakuMetadataResponse = {}));\n//# sourceMappingURL=metadata.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/proto/dist/lib/metadata.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/proto/dist/lib/peer_exchange.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@waku/proto/dist/lib/peer_exchange.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerExchangeQuery: () => (/* binding */ PeerExchangeQuery),\n/* harmony export */ PeerExchangeRPC: () => (/* binding */ PeerExchangeRPC),\n/* harmony export */ PeerExchangeResponse: () => (/* binding */ PeerExchangeResponse),\n/* harmony export */ PeerInfo: () => (/* binding */ PeerInfo)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar PeerInfo;\n(function (PeerInfo) {\n let _codec;\n PeerInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.enr != null) {\n w.uint32(10);\n w.bytes(obj.enr);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.enr = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerInfo.codec());\n };\n PeerInfo.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerInfo.codec());\n };\n})(PeerInfo || (PeerInfo = {}));\nvar PeerExchangeQuery;\n(function (PeerExchangeQuery) {\n let _codec;\n PeerExchangeQuery.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.numPeers != null) {\n w.uint32(8);\n w.uint64(obj.numPeers);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.numPeers = reader.uint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeQuery.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeQuery.codec());\n };\n PeerExchangeQuery.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeQuery.codec());\n };\n})(PeerExchangeQuery || (PeerExchangeQuery = {}));\nvar PeerExchangeResponse;\n(function (PeerExchangeResponse) {\n let _codec;\n PeerExchangeResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.peerInfos != null) {\n for (const value of obj.peerInfos) {\n w.uint32(10);\n PeerInfo.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n peerInfos: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.peerInfos.push(PeerInfo.codec().decode(reader, reader.uint32()));\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeResponse.codec());\n };\n PeerExchangeResponse.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeResponse.codec());\n };\n})(PeerExchangeResponse || (PeerExchangeResponse = {}));\nvar PeerExchangeRPC;\n(function (PeerExchangeRPC) {\n let _codec;\n PeerExchangeRPC.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.query != null) {\n w.uint32(10);\n PeerExchangeQuery.codec().encode(obj.query, w);\n }\n if (obj.response != null) {\n w.uint32(18);\n PeerExchangeResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.query = PeerExchangeQuery.codec().decode(reader, reader.uint32());\n break;\n case 2:\n obj.response = PeerExchangeResponse.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeRPC.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeRPC.codec());\n };\n PeerExchangeRPC.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeRPC.codec());\n };\n})(PeerExchangeRPC || (PeerExchangeRPC = {}));\n//# sourceMappingURL=peer_exchange.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/proto/dist/lib/peer_exchange.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/proto/dist/lib/store.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/@waku/proto/dist/lib/store.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContentFilter: () => (/* binding */ ContentFilter),\n/* harmony export */ HistoryQuery: () => (/* binding */ HistoryQuery),\n/* harmony export */ HistoryResponse: () => (/* binding */ HistoryResponse),\n/* harmony export */ HistoryRpc: () => (/* binding */ HistoryRpc),\n/* harmony export */ Index: () => (/* binding */ Index),\n/* harmony export */ PagingInfo: () => (/* binding */ PagingInfo),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar Index;\n(function (Index) {\n let _codec;\n Index.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.digest != null && obj.digest.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.digest);\n }\n if ((obj.receiverTime != null && obj.receiverTime !== 0n)) {\n w.uint32(16);\n w.sint64(obj.receiverTime);\n }\n if ((obj.senderTime != null && obj.senderTime !== 0n)) {\n w.uint32(24);\n w.sint64(obj.senderTime);\n }\n if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {\n w.uint32(34);\n w.string(obj.pubsubTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n digest: new Uint8Array(0),\n receiverTime: 0n,\n senderTime: 0n,\n pubsubTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.digest = reader.bytes();\n break;\n case 2:\n obj.receiverTime = reader.sint64();\n break;\n case 3:\n obj.senderTime = reader.sint64();\n break;\n case 4:\n obj.pubsubTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Index.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Index.codec());\n };\n Index.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Index.codec());\n };\n})(Index || (Index = {}));\nvar PagingInfo;\n(function (PagingInfo) {\n let Direction;\n (function (Direction) {\n Direction[\"BACKWARD\"] = \"BACKWARD\";\n Direction[\"FORWARD\"] = \"FORWARD\";\n })(Direction = PagingInfo.Direction || (PagingInfo.Direction = {}));\n let __DirectionValues;\n (function (__DirectionValues) {\n __DirectionValues[__DirectionValues[\"BACKWARD\"] = 0] = \"BACKWARD\";\n __DirectionValues[__DirectionValues[\"FORWARD\"] = 1] = \"FORWARD\";\n })(__DirectionValues || (__DirectionValues = {}));\n (function (Direction) {\n Direction.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__DirectionValues);\n };\n })(Direction = PagingInfo.Direction || (PagingInfo.Direction = {}));\n let _codec;\n PagingInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.pageSize != null) {\n w.uint32(8);\n w.uint64(obj.pageSize);\n }\n if (obj.cursor != null) {\n w.uint32(18);\n Index.codec().encode(obj.cursor, w);\n }\n if (obj.direction != null) {\n w.uint32(24);\n PagingInfo.Direction.codec().encode(obj.direction, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.pageSize = reader.uint64();\n break;\n case 2:\n obj.cursor = Index.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.direction = PagingInfo.Direction.codec().decode(reader);\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PagingInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PagingInfo.codec());\n };\n PagingInfo.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PagingInfo.codec());\n };\n})(PagingInfo || (PagingInfo = {}));\nvar ContentFilter;\n(function (ContentFilter) {\n let _codec;\n ContentFilter.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(10);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.contentTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ContentFilter.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ContentFilter.codec());\n };\n ContentFilter.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ContentFilter.codec());\n };\n})(ContentFilter || (ContentFilter = {}));\nvar HistoryQuery;\n(function (HistoryQuery) {\n let _codec;\n HistoryQuery.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.pubsubTopic != null) {\n w.uint32(18);\n w.string(obj.pubsubTopic);\n }\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n w.uint32(26);\n ContentFilter.codec().encode(value, w);\n }\n }\n if (obj.pagingInfo != null) {\n w.uint32(34);\n PagingInfo.codec().encode(obj.pagingInfo, w);\n }\n if (obj.startTime != null) {\n w.uint32(40);\n w.sint64(obj.startTime);\n }\n if (obj.endTime != null) {\n w.uint32(48);\n w.sint64(obj.endTime);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n contentFilters: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2:\n obj.pubsubTopic = reader.string();\n break;\n case 3:\n obj.contentFilters.push(ContentFilter.codec().decode(reader, reader.uint32()));\n break;\n case 4:\n obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32());\n break;\n case 5:\n obj.startTime = reader.sint64();\n break;\n case 6:\n obj.endTime = reader.sint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryQuery.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryQuery.codec());\n };\n HistoryQuery.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryQuery.codec());\n };\n})(HistoryQuery || (HistoryQuery = {}));\nvar HistoryResponse;\n(function (HistoryResponse) {\n let HistoryError;\n (function (HistoryError) {\n HistoryError[\"NONE\"] = \"NONE\";\n HistoryError[\"INVALID_CURSOR\"] = \"INVALID_CURSOR\";\n })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));\n let __HistoryErrorValues;\n (function (__HistoryErrorValues) {\n __HistoryErrorValues[__HistoryErrorValues[\"NONE\"] = 0] = \"NONE\";\n __HistoryErrorValues[__HistoryErrorValues[\"INVALID_CURSOR\"] = 1] = \"INVALID_CURSOR\";\n })(__HistoryErrorValues || (__HistoryErrorValues = {}));\n (function (HistoryError) {\n HistoryError.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__HistoryErrorValues);\n };\n })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));\n let _codec;\n HistoryResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.messages != null) {\n for (const value of obj.messages) {\n w.uint32(18);\n WakuMessage.codec().encode(value, w);\n }\n }\n if (obj.pagingInfo != null) {\n w.uint32(26);\n PagingInfo.codec().encode(obj.pagingInfo, w);\n }\n if (obj.error != null && __HistoryErrorValues[obj.error] !== 0) {\n w.uint32(32);\n HistoryResponse.HistoryError.codec().encode(obj.error, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n messages: [],\n error: HistoryError.NONE\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2:\n obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32()));\n break;\n case 3:\n obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32());\n break;\n case 4:\n obj.error = HistoryResponse.HistoryError.codec().decode(reader);\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryResponse.codec());\n };\n HistoryResponse.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryResponse.codec());\n };\n})(HistoryResponse || (HistoryResponse = {}));\nvar HistoryRpc;\n(function (HistoryRpc) {\n let _codec;\n HistoryRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.query != null) {\n w.uint32(18);\n HistoryQuery.codec().encode(obj.query, w);\n }\n if (obj.response != null) {\n w.uint32(26);\n HistoryResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.query = HistoryQuery.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.response = HistoryResponse.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryRpc.codec());\n };\n HistoryRpc.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryRpc.codec());\n };\n})(HistoryRpc || (HistoryRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n proof: new Uint8Array(0),\n merkleRoot: new Uint8Array(0),\n epoch: new Uint8Array(0),\n shareX: new Uint8Array(0),\n shareY: new Uint8Array(0),\n nullifier: new Uint8Array(0),\n rlnIdentifier: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.proof = reader.bytes();\n break;\n case 2:\n obj.merkleRoot = reader.bytes();\n break;\n case 3:\n obj.epoch = reader.bytes();\n break;\n case 4:\n obj.shareX = reader.bytes();\n break;\n case 5:\n obj.shareY = reader.bytes();\n break;\n case 6:\n obj.nullifier = reader.bytes();\n break;\n case 7:\n obj.rlnIdentifier = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec());\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n payload: new Uint8Array(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n case 11:\n obj.meta = reader.bytes();\n break;\n case 21:\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32());\n break;\n case 31:\n obj.ephemeral = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec());\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/proto/dist/lib/store.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/proto/dist/lib/topic_only_message.js":
|
||
/*!*****************************************************************!*\
|
||
!*** ./node_modules/@waku/proto/dist/lib/topic_only_message.js ***!
|
||
\*****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TopicOnlyMessage: () => (/* binding */ TopicOnlyMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar TopicOnlyMessage;\n(function (TopicOnlyMessage) {\n let _codec;\n TopicOnlyMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2:\n obj.contentTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n TopicOnlyMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, TopicOnlyMessage.codec());\n };\n TopicOnlyMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, TopicOnlyMessage.codec());\n };\n})(TopicOnlyMessage || (TopicOnlyMessage = {}));\n//# sourceMappingURL=topic_only_message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/proto/dist/lib/topic_only_message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/dist/constants.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/@waku/relay/dist/constants.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RelayCodecs: () => (/* binding */ RelayCodecs),\n/* harmony export */ RelayFanoutTTL: () => (/* binding */ RelayFanoutTTL),\n/* harmony export */ RelayGossipFactor: () => (/* binding */ RelayGossipFactor),\n/* harmony export */ RelayHeartbeatInitialDelay: () => (/* binding */ RelayHeartbeatInitialDelay),\n/* harmony export */ RelayHeartbeatInterval: () => (/* binding */ RelayHeartbeatInterval),\n/* harmony export */ RelayMaxIHaveLength: () => (/* binding */ RelayMaxIHaveLength),\n/* harmony export */ RelayOpportunisticGraftPeers: () => (/* binding */ RelayOpportunisticGraftPeers),\n/* harmony export */ RelayOpportunisticGraftTicks: () => (/* binding */ RelayOpportunisticGraftTicks),\n/* harmony export */ RelayPruneBackoff: () => (/* binding */ RelayPruneBackoff),\n/* harmony export */ RelayPrunePeers: () => (/* binding */ RelayPrunePeers),\n/* harmony export */ minute: () => (/* binding */ minute),\n/* harmony export */ second: () => (/* binding */ second)\n/* harmony export */ });\nconst second = 1000;\nconst minute = 60 * second;\n/**\n * RelayCodec is the libp2p identifier for the waku relay protocol\n */\nconst RelayCodecs = [\"/vac/waku/relay/2.0.0\"];\n/**\n * RelayGossipFactor affects how many peers we will emit gossip to at each heartbeat.\n * We will send gossip to RelayGossipFactor * (total number of non-mesh peers), or\n * RelayDlazy, whichever is greater.\n */\nconst RelayGossipFactor = 0.25;\n/**\n * GossipsubHeartbeatInitialDelay is the short delay before the heartbeat timer begins\n * after the router is initialized.\n */\nconst RelayHeartbeatInitialDelay = 100;\n/**\n * RelayHeartbeatInterval controls the time between heartbeats.\n */\nconst RelayHeartbeatInterval = second;\n/**\n * RelayPrunePeers controls the number of peers to include in prune Peer eXchange.\n * When we prune a peer that's eligible for PX (has a good score, etc), we will try to\n * send them signed peer records for up to RelayPrunePeers other peers that we\n * know of.\n */\nconst RelayPrunePeers = 16;\n/**\n * RelayPruneBackoff controls the backoff time for pruned peers. This is how long\n * a peer must wait before attempting to graft into our mesh again after being pruned.\n * When pruning a peer, we send them our value of RelayPruneBackoff so they know\n * the minimum time to wait. Peers running older versions may not send a backoff time,\n * so if we receive a prune message without one, we will wait at least RelayPruneBackoff\n * before attempting to re-graft.\n */\nconst RelayPruneBackoff = minute;\n/**\n * RelayFanoutTTL controls how long we keep track of the fanout state. If it's been\n * RelayFanoutTTL since we've published to a topic that we're not subscribed to,\n * we'll delete the fanout map for that topic.\n */\nconst RelayFanoutTTL = minute;\n/**\n * RelayOpportunisticGraftTicks is the number of heartbeat ticks for attempting to improve the mesh\n * with opportunistic grafting. Every RelayOpportunisticGraftTicks we will attempt to select some\n * high-scoring mesh peers to replace lower-scoring ones, if the median score of our mesh peers falls\n * below a threshold\n */\nconst RelayOpportunisticGraftTicks = 60;\n/**\n * RelayOpportunisticGraftPeers is the number of peers to opportunistically graft.\n */\nconst RelayOpportunisticGraftPeers = 2;\n/**\n * RelayMaxIHaveLength is the maximum number of messages to include in an IHAVE message.\n * Also controls the maximum number of IHAVE ids we will accept and request with IWANT from a\n * peer within a heartbeat, to protect from IHAVE floods. You should adjust this value from the\n * default if your system is pushing more than 5000 messages in GossipsubHistoryGossip heartbeats;\n * with the defaults this is 1666 messages/s.\n */\nconst RelayMaxIHaveLength = 5000;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/dist/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/dist/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@waku/relay/dist/index.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ wakuGossipSub: () => (/* binding */ wakuGossipSub),\n/* harmony export */ wakuRelay: () => (/* binding */ wakuRelay)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_libp2p_gossipsub__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @chainsafe/libp2p-gossipsub */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/index.js\");\n/* harmony import */ var _chainsafe_libp2p_gossipsub_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @chainsafe/libp2p-gossipsub/types */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/@noble/hashes/esm/sha256.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/relay/dist/constants.js\");\n/* harmony import */ var _message_validator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message_validator.js */ \"./node_modules/@waku/relay/dist/message_validator.js\");\n/* harmony import */ var _topic_only_message_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./topic_only_message.js */ \"./node_modules/@waku/relay/dist/topic_only_message.js\");\n\n\n\n\n\n\n\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_1__.Logger(\"relay\");\n/**\n * Implements the [Waku v2 Relay protocol](https://rfc.vac.dev/spec/11/).\n * Throws if libp2p.pubsub does not support Waku Relay\n */\nclass Relay {\n pubsubTopics;\n defaultDecoder;\n static multicodec = _constants_js__WEBPACK_IMPORTED_MODULE_2__.RelayCodecs[0];\n gossipSub;\n /**\n * observers called when receiving new message.\n * Observers under key `\"\"` are always called.\n */\n observers;\n constructor(libp2p, pubsubTopics) {\n if (!this.isRelayPubsub(libp2p.services.pubsub)) {\n throw Error(`Failed to initialize Relay. libp2p.pubsub does not support ${Relay.multicodec}`);\n }\n this.gossipSub = libp2p.services.pubsub;\n this.pubsubTopics = new Set(pubsubTopics);\n if (this.gossipSub.isStarted()) {\n this.subscribeToAllTopics();\n }\n this.observers = new Map();\n // Default PubsubTopic decoder\n // TODO: User might want to decide what decoder should be used (e.g. for RLN)\n this.defaultDecoder = new _topic_only_message_js__WEBPACK_IMPORTED_MODULE_4__.TopicOnlyDecoder();\n }\n /**\n * Mounts the gossipsub protocol onto the libp2p node\n * and subscribes to all the topics.\n *\n * @override\n * @returns {void}\n */\n async start() {\n if (this.gossipSub.isStarted()) {\n throw Error(\"GossipSub already started.\");\n }\n await this.gossipSub.start();\n this.subscribeToAllTopics();\n }\n /**\n * Send Waku message.\n */\n async send(encoder, message) {\n const successes = [];\n const { pubsubTopic } = encoder;\n if (!this.pubsubTopics.has(pubsubTopic)) {\n log.error(\"Failed to send waku relay: topic not configured\");\n return {\n successes,\n failures: [\n {\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.TOPIC_NOT_CONFIGURED\n }\n ]\n };\n }\n const msg = await encoder.toWire(message);\n if (!msg) {\n log.error(\"Failed to encode message, aborting publish\");\n return {\n successes,\n failures: [\n {\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.ENCODE_FAILED\n }\n ]\n };\n }\n if (!(0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.isWireSizeUnderCap)(msg)) {\n log.error(\"Failed to send waku relay: message is bigger that 1MB\");\n return {\n successes,\n failures: [\n {\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.SIZE_TOO_BIG\n }\n ]\n };\n }\n const { recipients } = await this.gossipSub.publish(pubsubTopic, msg);\n return {\n successes: recipients\n };\n }\n subscribe(decoders, callback) {\n const observers = [];\n for (const decoder of Array.isArray(decoders) ? decoders : [decoders]) {\n const { pubsubTopic } = decoder;\n const ctObs = this.observers.get(pubsubTopic) ?? new Map();\n const observer = { pubsubTopic, decoder, callback };\n (0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.pushOrInitMapSet)(ctObs, decoder.contentTopic, observer);\n this.observers.set(pubsubTopic, ctObs);\n observers.push([pubsubTopic, observer]);\n }\n return () => {\n this.removeObservers(observers);\n };\n }\n removeObservers(observers) {\n for (const [pubsubTopic, observer] of observers) {\n const ctObs = this.observers.get(pubsubTopic);\n if (!ctObs)\n continue;\n const contentTopic = observer.decoder.contentTopic;\n const _obs = ctObs.get(contentTopic);\n if (!_obs)\n continue;\n _obs.delete(observer);\n ctObs.set(contentTopic, _obs);\n this.observers.set(pubsubTopic, ctObs);\n }\n }\n toSubscriptionIterator(decoders) {\n return (0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.toAsyncIterator)(this, decoders);\n }\n getActiveSubscriptions() {\n const map = new Map();\n for (const pubsubTopic of this.pubsubTopics) {\n map.set(pubsubTopic, Array.from(this.observers.keys()));\n }\n return map;\n }\n getMeshPeers(topic = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DefaultPubsubTopic) {\n return this.gossipSub.getMeshPeers(topic);\n }\n subscribeToAllTopics() {\n for (const pubsubTopic of this.pubsubTopics) {\n this.gossipSubSubscribe(pubsubTopic);\n }\n }\n async processIncomingMessage(pubsubTopic, bytes) {\n const topicOnlyMsg = await this.defaultDecoder.fromWireToProtoObj(bytes);\n if (!topicOnlyMsg || !topicOnlyMsg.contentTopic) {\n log.warn(\"Message does not have a content topic, skipping\");\n return;\n }\n // Retrieve the map of content topics for the given pubsubTopic\n const contentTopicMap = this.observers.get(pubsubTopic);\n if (!contentTopicMap) {\n return;\n }\n // Retrieve the set of observers for the given contentTopic\n const observers = contentTopicMap.get(topicOnlyMsg.contentTopic);\n if (!observers) {\n return;\n }\n await Promise.all(Array.from(observers).map(({ decoder, callback }) => {\n return (async () => {\n try {\n const protoMsg = await decoder.fromWireToProtoObj(bytes);\n if (!protoMsg) {\n log.error(\"Internal error: message previously decoded failed on 2nd pass.\");\n return;\n }\n const msg = await decoder.fromProtoObj(pubsubTopic, protoMsg);\n if (msg) {\n await callback(msg);\n }\n else {\n log.error(\"Failed to decode messages on\", topicOnlyMsg.contentTopic);\n }\n }\n catch (error) {\n log.error(\"Error while decoding message:\", error);\n }\n })();\n }));\n }\n /**\n * Subscribe to a pubsub topic and start emitting Waku messages to observers.\n *\n * @override\n */\n gossipSubSubscribe(pubsubTopic) {\n this.gossipSub.addEventListener(\"gossipsub:message\", (event) => {\n if (event.detail.msg.topic !== pubsubTopic)\n return;\n this.processIncomingMessage(event.detail.msg.topic, event.detail.msg.data).catch((e) => log.error(\"Failed to process incoming message\", e));\n });\n this.gossipSub.topicValidators.set(pubsubTopic, _message_validator_js__WEBPACK_IMPORTED_MODULE_3__.messageValidator);\n this.gossipSub.subscribe(pubsubTopic);\n }\n isRelayPubsub(pubsub) {\n return pubsub?.multicodecs?.includes(Relay.multicodec) ?? false;\n }\n}\nfunction wakuRelay(pubsubTopics) {\n return (libp2p) => new Relay(libp2p, pubsubTopics);\n}\nfunction wakuGossipSub(init = {}) {\n return (components) => {\n init = {\n ...init,\n msgIdFn: ({ data }) => (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_5__.sha256)(data),\n // Ensure that no signature is included nor expected in the messages.\n globalSignaturePolicy: _chainsafe_libp2p_gossipsub_types__WEBPACK_IMPORTED_MODULE_6__.SignaturePolicy.StrictNoSign,\n fallbackToFloodsub: false\n };\n const pubsub = new _chainsafe_libp2p_gossipsub__WEBPACK_IMPORTED_MODULE_7__.GossipSub(components, init);\n pubsub.multicodecs = _constants_js__WEBPACK_IMPORTED_MODULE_2__.RelayCodecs;\n return pubsub;\n };\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/dist/message_validator.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/dist/message_validator.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ messageValidator: () => (/* binding */ messageValidator)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/pubsub/index.js\");\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/relay/node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_1__.Logger(\"relay\");\nfunction messageValidator(peer, message) {\n const startTime = performance.now();\n log.info(`validating message from ${peer} received on ${message.topic}`);\n let result = _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.TopicValidatorResult.Accept;\n try {\n const protoMessage = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_message.WakuMessage.decode(message.data);\n if (!protoMessage.contentTopic ||\n !protoMessage.contentTopic.length ||\n !protoMessage.payload ||\n !protoMessage.payload.length) {\n result = _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.TopicValidatorResult.Reject;\n }\n }\n catch (e) {\n result = _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.TopicValidatorResult.Reject;\n }\n const endTime = performance.now();\n const timeTakenMs = endTime - startTime;\n if (timeTakenMs > 100) {\n log.warn(`message validation took ${timeTakenMs}ms for peer ${peer} on topic ${message.topic}. This should be less than 100ms.`);\n }\n else {\n log.info(`message validation took ${timeTakenMs}ms for peer ${peer} on topic ${message.topic}`);\n }\n return result;\n}\n//# sourceMappingURL=message_validator.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/dist/message_validator.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/dist/topic_only_message.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/dist/topic_only_message.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TopicOnlyDecoder: () => (/* binding */ TopicOnlyDecoder),\n/* harmony export */ TopicOnlyMessage: () => (/* binding */ TopicOnlyMessage)\n/* harmony export */ });\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/relay/node_modules/@waku/proto/dist/index.js\");\n\n\nclass TopicOnlyMessage {\n pubsubTopic;\n proto;\n payload = new Uint8Array();\n rateLimitProof;\n timestamp;\n meta;\n ephemeral;\n constructor(pubsubTopic, proto) {\n this.pubsubTopic = pubsubTopic;\n this.proto = proto;\n }\n get contentTopic() {\n return this.proto.contentTopic;\n }\n}\nclass TopicOnlyDecoder {\n pubsubTopic = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DefaultPubsubTopic;\n contentTopic = \"\";\n fromWireToProtoObj(bytes) {\n const protoMessage = _waku_proto__WEBPACK_IMPORTED_MODULE_1__.TopicOnlyMessage.decode(bytes);\n return Promise.resolve({\n contentTopic: protoMessage.contentTopic,\n payload: new Uint8Array(),\n rateLimitProof: undefined,\n timestamp: undefined,\n meta: undefined,\n version: undefined,\n ephemeral: undefined\n });\n }\n async fromProtoObj(pubsubTopic, proto) {\n return new TopicOnlyMessage(pubsubTopic, proto);\n }\n}\n//# sourceMappingURL=topic_only_message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/dist/topic_only_message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/connection_manager.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/connection_manager.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EConnectionStateEvents: () => (/* binding */ EConnectionStateEvents),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* binding */ EPeersByDiscoveryEvents),\n/* harmony export */ Tags: () => (/* binding */ Tags)\n/* harmony export */ });\nvar Tags;\n(function (Tags) {\n Tags[\"BOOTSTRAP\"] = \"bootstrap\";\n Tags[\"PEER_EXCHANGE\"] = \"peer-exchange\";\n Tags[\"LOCAL\"] = \"local-peer-cache\";\n})(Tags || (Tags = {}));\nvar EPeersByDiscoveryEvents;\n(function (EPeersByDiscoveryEvents) {\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_BOOTSTRAP\"] = \"peer:discovery:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_PEER_EXCHANGE\"] = \"peer:discovery:peer-exchange\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_BOOTSTRAP\"] = \"peer:connected:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_PEER_EXCHANGE\"] = \"peer:connected:peer-exchange\";\n})(EPeersByDiscoveryEvents || (EPeersByDiscoveryEvents = {}));\nvar EConnectionStateEvents;\n(function (EConnectionStateEvents) {\n EConnectionStateEvents[\"CONNECTION_STATUS\"] = \"waku:connection\";\n})(EConnectionStateEvents || (EConnectionStateEvents = {}));\n//# sourceMappingURL=connection_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/connection_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/constants.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/constants.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_CLUSTER_ID: () => (/* binding */ DEFAULT_CLUSTER_ID),\n/* harmony export */ DefaultPubsubTopic: () => (/* binding */ DefaultPubsubTopic)\n/* harmony export */ });\n/**\n * DefaultPubsubTopic is the default gossipsub topic to use for Waku.\n */\nconst DefaultPubsubTopic = \"/waku/2/default-waku/proto\";\n/**\n * The default cluster ID for The Waku Network\n */\nconst DEFAULT_CLUSTER_ID = 1;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/dns_discovery.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/dns_discovery.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=dns_discovery.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/dns_discovery.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/enr.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/enr.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=enr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/enr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/filter.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/filter.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=filter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/filter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/index.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/index.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_CLUSTER_ID: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_17__.DEFAULT_CLUSTER_ID),\n/* harmony export */ DefaultPubsubTopic: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_17__.DefaultPubsubTopic),\n/* harmony export */ EConnectionStateEvents: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.EConnectionStateEvents),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.EPeersByDiscoveryEvents),\n/* harmony export */ PageDirection: () => (/* reexport safe */ _store_js__WEBPACK_IMPORTED_MODULE_7__.PageDirection),\n/* harmony export */ ProtocolError: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.ProtocolError),\n/* harmony export */ Protocols: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.Protocols),\n/* harmony export */ Tags: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.Tags)\n/* harmony export */ });\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/enr.js\");\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filter.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/filter.js\");\n/* harmony import */ var _light_push_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./light_push.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/light_push.js\");\n/* harmony import */ var _message_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/message.js\");\n/* harmony import */ var _peer_exchange_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer_exchange.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/peer_exchange.js\");\n/* harmony import */ var _protocols_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./protocols.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/protocols.js\");\n/* harmony import */ var _relay_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./relay.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/relay.js\");\n/* harmony import */ var _store_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./store.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/store.js\");\n/* harmony import */ var _waku_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./waku.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/waku.js\");\n/* harmony import */ var _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./connection_manager.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/connection_manager.js\");\n/* harmony import */ var _sender_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sender.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/sender.js\");\n/* harmony import */ var _receiver_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./receiver.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/receiver.js\");\n/* harmony import */ var _misc_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./misc.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/misc.js\");\n/* harmony import */ var _libp2p_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./libp2p.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/libp2p.js\");\n/* harmony import */ var _keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./keep_alive_manager.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/keep_alive_manager.js\");\n/* harmony import */ var _dns_discovery_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./dns_discovery.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/dns_discovery.js\");\n/* harmony import */ var _metadata_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./metadata.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/metadata.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/constants.js\");\n/* harmony import */ var _local_storage_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./local_storage.js */ \"./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/local_storage.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/keep_alive_manager.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/keep_alive_manager.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=keep_alive_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/keep_alive_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/libp2p.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/libp2p.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=libp2p.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/libp2p.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/light_push.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/light_push.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/light_push.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/local_storage.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/local_storage.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=local_storage.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/local_storage.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/message.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/message.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/metadata.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/metadata.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=metadata.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/metadata.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/misc.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/misc.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=misc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/misc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/peer_exchange.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/peer_exchange.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=peer_exchange.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/peer_exchange.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/protocols.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/protocols.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ProtocolError: () => (/* binding */ ProtocolError),\n/* harmony export */ Protocols: () => (/* binding */ Protocols)\n/* harmony export */ });\nvar Protocols;\n(function (Protocols) {\n Protocols[\"Relay\"] = \"relay\";\n Protocols[\"Store\"] = \"store\";\n Protocols[\"LightPush\"] = \"lightpush\";\n Protocols[\"Filter\"] = \"filter\";\n})(Protocols || (Protocols = {}));\nvar ProtocolError;\n(function (ProtocolError) {\n /** Could not determine the origin of the fault. Best to check connectivity and try again */\n ProtocolError[\"GENERIC_FAIL\"] = \"Generic error\";\n /**\n * Failure to protobuf encode the message. This is not recoverable and needs\n * further investigation.\n */\n ProtocolError[\"ENCODE_FAILED\"] = \"Failed to encode\";\n /**\n * Failure to protobuf decode the message. May be due to a remote peer issue,\n * ensuring that messages are sent via several peer enable mitigation of this error.\n */\n ProtocolError[\"DECODE_FAILED\"] = \"Failed to decode\";\n /**\n * The message payload is empty, making the message invalid. Ensure that a non-empty\n * payload is set on the outgoing message.\n */\n ProtocolError[\"EMPTY_PAYLOAD\"] = \"Payload is empty\";\n /**\n * The message size is above the maximum message size allowed on the Waku Network.\n * Compressing the message or using an alternative strategy for large messages is recommended.\n */\n ProtocolError[\"SIZE_TOO_BIG\"] = \"Size is too big\";\n /**\n * The PubsubTopic passed to the send function is not configured on the Waku node.\n * Please ensure that the PubsubTopic is used when initializing the Waku node.\n */\n ProtocolError[\"TOPIC_NOT_CONFIGURED\"] = \"Topic not configured\";\n /**\n * Failure to find a peer with suitable protocols. This may due to a connection issue.\n * Mitigation can be: retrying after a given time period, display connectivity issue\n * to user or listening for `peer:connected:bootstrap` or `peer:connected:peer-exchange`\n * on the connection manager before retrying.\n */\n ProtocolError[\"NO_PEER_AVAILABLE\"] = \"No peer available\";\n /**\n * The remote peer did not behave as expected. Mitigation for `NO_PEER_AVAILABLE`\n * or `DECODE_FAILED` can be used.\n */\n ProtocolError[\"REMOTE_PEER_FAULT\"] = \"Remote peer fault\";\n /**\n * The remote peer rejected the message. Information provided by the remote peer\n * is logged. Review message validity, or mitigation for `NO_PEER_AVAILABLE`\n * or `DECODE_FAILED` can be used.\n */\n ProtocolError[\"REMOTE_PEER_REJECTED\"] = \"Remote peer rejected\";\n /**\n * The protocol request timed out without a response. This may be due to a connection issue.\n * Mitigation can be: retrying after a given time period\n */\n ProtocolError[\"REQUEST_TIMEOUT\"] = \"Request timeout\";\n})(ProtocolError || (ProtocolError = {}));\n//# sourceMappingURL=protocols.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/protocols.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/receiver.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/receiver.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=receiver.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/receiver.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/relay.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/relay.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=relay.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/relay.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/sender.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/sender.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=sender.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/sender.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/store.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/store.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PageDirection: () => (/* binding */ PageDirection)\n/* harmony export */ });\nvar PageDirection;\n(function (PageDirection) {\n PageDirection[\"BACKWARD\"] = \"backward\";\n PageDirection[\"FORWARD\"] = \"forward\";\n})(PageDirection || (PageDirection = {}));\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/store.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/waku.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/waku.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=waku.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/interfaces/dist/waku.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/filter.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/filter.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterRequest: () => (/* binding */ FilterRequest),\n/* harmony export */ FilterRpc: () => (/* binding */ FilterRpc),\n/* harmony export */ MessagePush: () => (/* binding */ MessagePush),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar FilterRequest;\n(function (FilterRequest) {\n let ContentFilter;\n (function (ContentFilter) {\n let _codec;\n ContentFilter.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(10);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.contentTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ContentFilter.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ContentFilter.codec());\n };\n ContentFilter.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ContentFilter.codec(), opts);\n };\n })(ContentFilter = FilterRequest.ContentFilter || (FilterRequest.ContentFilter = {}));\n let _codec;\n FilterRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.subscribe != null && obj.subscribe !== false)) {\n w.uint32(8);\n w.bool(obj.subscribe);\n }\n if ((obj.topic != null && obj.topic !== '')) {\n w.uint32(18);\n w.string(obj.topic);\n }\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n w.uint32(26);\n FilterRequest.ContentFilter.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n subscribe: false,\n topic: '',\n contentFilters: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.subscribe = reader.bool();\n break;\n }\n case 2: {\n obj.topic = reader.string();\n break;\n }\n case 3: {\n if (opts.limits?.contentFilters != null && obj.contentFilters.length === opts.limits.contentFilters) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"contentFilters\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.contentFilters.push(FilterRequest.ContentFilter.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.contentFilters$\n }));\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterRequest.codec());\n };\n FilterRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterRequest.codec(), opts);\n };\n})(FilterRequest || (FilterRequest = {}));\nvar MessagePush;\n(function (MessagePush) {\n let _codec;\n MessagePush.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.messages != null) {\n for (const value of obj.messages) {\n w.uint32(10);\n WakuMessage.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n messages: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"messages\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.messages$\n }));\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n MessagePush.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, MessagePush.codec());\n };\n MessagePush.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, MessagePush.codec(), opts);\n };\n})(MessagePush || (MessagePush = {}));\nvar FilterRpc;\n(function (FilterRpc) {\n let _codec;\n FilterRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.request != null) {\n w.uint32(18);\n FilterRequest.codec().encode(obj.request, w);\n }\n if (obj.push != null) {\n w.uint32(26);\n MessagePush.codec().encode(obj.push, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.request = FilterRequest.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.request\n });\n break;\n }\n case 3: {\n obj.push = MessagePush.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.push\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterRpc.codec());\n };\n FilterRpc.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterRpc.codec(), opts);\n };\n})(FilterRpc || (FilterRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=filter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/filter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/filter_v2.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/filter_v2.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterSubscribeRequest: () => (/* binding */ FilterSubscribeRequest),\n/* harmony export */ FilterSubscribeResponse: () => (/* binding */ FilterSubscribeResponse),\n/* harmony export */ MessagePush: () => (/* binding */ MessagePush),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar FilterSubscribeRequest;\n(function (FilterSubscribeRequest) {\n let FilterSubscribeType;\n (function (FilterSubscribeType) {\n FilterSubscribeType[\"SUBSCRIBER_PING\"] = \"SUBSCRIBER_PING\";\n FilterSubscribeType[\"SUBSCRIBE\"] = \"SUBSCRIBE\";\n FilterSubscribeType[\"UNSUBSCRIBE\"] = \"UNSUBSCRIBE\";\n FilterSubscribeType[\"UNSUBSCRIBE_ALL\"] = \"UNSUBSCRIBE_ALL\";\n })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));\n let __FilterSubscribeTypeValues;\n (function (__FilterSubscribeTypeValues) {\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"SUBSCRIBER_PING\"] = 0] = \"SUBSCRIBER_PING\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"SUBSCRIBE\"] = 1] = \"SUBSCRIBE\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"UNSUBSCRIBE\"] = 2] = \"UNSUBSCRIBE\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"UNSUBSCRIBE_ALL\"] = 3] = \"UNSUBSCRIBE_ALL\";\n })(__FilterSubscribeTypeValues || (__FilterSubscribeTypeValues = {}));\n (function (FilterSubscribeType) {\n FilterSubscribeType.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__FilterSubscribeTypeValues);\n };\n })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));\n let _codec;\n FilterSubscribeRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.filterSubscribeType != null && __FilterSubscribeTypeValues[obj.filterSubscribeType] !== 0) {\n w.uint32(16);\n FilterSubscribeRequest.FilterSubscribeType.codec().encode(obj.filterSubscribeType, w);\n }\n if (obj.pubsubTopic != null) {\n w.uint32(82);\n w.string(obj.pubsubTopic);\n }\n if (obj.contentTopics != null) {\n for (const value of obj.contentTopics) {\n w.uint32(90);\n w.string(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: '',\n filterSubscribeType: FilterSubscribeType.SUBSCRIBER_PING,\n contentTopics: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.filterSubscribeType = FilterSubscribeRequest.FilterSubscribeType.codec().decode(reader);\n break;\n }\n case 10: {\n obj.pubsubTopic = reader.string();\n break;\n }\n case 11: {\n if (opts.limits?.contentTopics != null && obj.contentTopics.length === opts.limits.contentTopics) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"contentTopics\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.contentTopics.push(reader.string());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterSubscribeRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterSubscribeRequest.codec());\n };\n FilterSubscribeRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterSubscribeRequest.codec(), opts);\n };\n})(FilterSubscribeRequest || (FilterSubscribeRequest = {}));\nvar FilterSubscribeResponse;\n(function (FilterSubscribeResponse) {\n let _codec;\n FilterSubscribeResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if ((obj.statusCode != null && obj.statusCode !== 0)) {\n w.uint32(80);\n w.uint32(obj.statusCode);\n }\n if (obj.statusDesc != null) {\n w.uint32(90);\n w.string(obj.statusDesc);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: '',\n statusCode: 0\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 10: {\n obj.statusCode = reader.uint32();\n break;\n }\n case 11: {\n obj.statusDesc = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterSubscribeResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterSubscribeResponse.codec());\n };\n FilterSubscribeResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterSubscribeResponse.codec(), opts);\n };\n})(FilterSubscribeResponse || (FilterSubscribeResponse = {}));\nvar MessagePush;\n(function (MessagePush) {\n let _codec;\n MessagePush.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.wakuMessage != null) {\n w.uint32(10);\n WakuMessage.codec().encode(obj.wakuMessage, w);\n }\n if (obj.pubsubTopic != null) {\n w.uint32(18);\n w.string(obj.pubsubTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.wakuMessage = WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.wakuMessage\n });\n break;\n }\n case 2: {\n obj.pubsubTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n MessagePush.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, MessagePush.codec());\n };\n MessagePush.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, MessagePush.codec(), opts);\n };\n})(MessagePush || (MessagePush = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=filter_v2.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/filter_v2.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/light_push.js":
|
||
/*!****************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/light_push.js ***!
|
||
\****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushRequest: () => (/* binding */ PushRequest),\n/* harmony export */ PushResponse: () => (/* binding */ PushResponse),\n/* harmony export */ PushRpc: () => (/* binding */ PushRpc),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar PushRequest;\n(function (PushRequest) {\n let _codec;\n PushRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {\n w.uint32(10);\n w.string(obj.pubsubTopic);\n }\n if (obj.message != null) {\n w.uint32(18);\n WakuMessage.codec().encode(obj.message, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n pubsubTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.pubsubTopic = reader.string();\n break;\n }\n case 2: {\n obj.message = WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.message\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushRequest.codec());\n };\n PushRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushRequest.codec(), opts);\n };\n})(PushRequest || (PushRequest = {}));\nvar PushResponse;\n(function (PushResponse) {\n let _codec;\n PushResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.isSuccess != null && obj.isSuccess !== false)) {\n w.uint32(8);\n w.bool(obj.isSuccess);\n }\n if (obj.info != null) {\n w.uint32(18);\n w.string(obj.info);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n isSuccess: false\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.isSuccess = reader.bool();\n break;\n }\n case 2: {\n obj.info = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushResponse.codec());\n };\n PushResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushResponse.codec(), opts);\n };\n})(PushResponse || (PushResponse = {}));\nvar PushRpc;\n(function (PushRpc) {\n let _codec;\n PushRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.request != null) {\n w.uint32(18);\n PushRequest.codec().encode(obj.request, w);\n }\n if (obj.response != null) {\n w.uint32(26);\n PushResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.request = PushRequest.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.request\n });\n break;\n }\n case 3: {\n obj.response = PushResponse.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.response\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushRpc.codec());\n };\n PushRpc.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushRpc.codec(), opts);\n };\n})(PushRpc || (PushRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/light_push.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/message.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/message.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/metadata.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/metadata.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WakuMetadataRequest: () => (/* binding */ WakuMetadataRequest),\n/* harmony export */ WakuMetadataResponse: () => (/* binding */ WakuMetadataResponse)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar WakuMetadataRequest;\n(function (WakuMetadataRequest) {\n let _codec;\n WakuMetadataRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.clusterId != null) {\n w.uint32(8);\n w.uint32(obj.clusterId);\n }\n if (obj.shards != null) {\n for (const value of obj.shards) {\n w.uint32(16);\n w.uint32(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n shards: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.clusterId = reader.uint32();\n break;\n }\n case 2: {\n if (opts.limits?.shards != null && obj.shards.length === opts.limits.shards) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"shards\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.shards.push(reader.uint32());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMetadataRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMetadataRequest.codec());\n };\n WakuMetadataRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMetadataRequest.codec(), opts);\n };\n})(WakuMetadataRequest || (WakuMetadataRequest = {}));\nvar WakuMetadataResponse;\n(function (WakuMetadataResponse) {\n let _codec;\n WakuMetadataResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.clusterId != null) {\n w.uint32(8);\n w.uint32(obj.clusterId);\n }\n if (obj.shards != null) {\n for (const value of obj.shards) {\n w.uint32(16);\n w.uint32(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n shards: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.clusterId = reader.uint32();\n break;\n }\n case 2: {\n if (opts.limits?.shards != null && obj.shards.length === opts.limits.shards) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"shards\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.shards.push(reader.uint32());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMetadataResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMetadataResponse.codec());\n };\n WakuMetadataResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMetadataResponse.codec(), opts);\n };\n})(WakuMetadataResponse || (WakuMetadataResponse = {}));\n//# sourceMappingURL=metadata.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/metadata.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/peer_exchange.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/peer_exchange.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerExchangeQuery: () => (/* binding */ PeerExchangeQuery),\n/* harmony export */ PeerExchangeRPC: () => (/* binding */ PeerExchangeRPC),\n/* harmony export */ PeerExchangeResponse: () => (/* binding */ PeerExchangeResponse),\n/* harmony export */ PeerInfo: () => (/* binding */ PeerInfo)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar PeerInfo;\n(function (PeerInfo) {\n let _codec;\n PeerInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.enr != null) {\n w.uint32(10);\n w.bytes(obj.enr);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.enr = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerInfo.codec());\n };\n PeerInfo.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerInfo.codec(), opts);\n };\n})(PeerInfo || (PeerInfo = {}));\nvar PeerExchangeQuery;\n(function (PeerExchangeQuery) {\n let _codec;\n PeerExchangeQuery.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.numPeers != null) {\n w.uint32(8);\n w.uint64(obj.numPeers);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.numPeers = reader.uint64();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeQuery.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeQuery.codec());\n };\n PeerExchangeQuery.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeQuery.codec(), opts);\n };\n})(PeerExchangeQuery || (PeerExchangeQuery = {}));\nvar PeerExchangeResponse;\n(function (PeerExchangeResponse) {\n let _codec;\n PeerExchangeResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.peerInfos != null) {\n for (const value of obj.peerInfos) {\n w.uint32(10);\n PeerInfo.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n peerInfos: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (opts.limits?.peerInfos != null && obj.peerInfos.length === opts.limits.peerInfos) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"peerInfos\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.peerInfos.push(PeerInfo.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.peerInfos$\n }));\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeResponse.codec());\n };\n PeerExchangeResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeResponse.codec(), opts);\n };\n})(PeerExchangeResponse || (PeerExchangeResponse = {}));\nvar PeerExchangeRPC;\n(function (PeerExchangeRPC) {\n let _codec;\n PeerExchangeRPC.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.query != null) {\n w.uint32(10);\n PeerExchangeQuery.codec().encode(obj.query, w);\n }\n if (obj.response != null) {\n w.uint32(18);\n PeerExchangeResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.query = PeerExchangeQuery.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.query\n });\n break;\n }\n case 2: {\n obj.response = PeerExchangeResponse.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.response\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeRPC.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeRPC.codec());\n };\n PeerExchangeRPC.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeRPC.codec(), opts);\n };\n})(PeerExchangeRPC || (PeerExchangeRPC = {}));\n//# sourceMappingURL=peer_exchange.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/peer_exchange.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/store.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/store.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContentFilter: () => (/* binding */ ContentFilter),\n/* harmony export */ HistoryQuery: () => (/* binding */ HistoryQuery),\n/* harmony export */ HistoryResponse: () => (/* binding */ HistoryResponse),\n/* harmony export */ HistoryRpc: () => (/* binding */ HistoryRpc),\n/* harmony export */ Index: () => (/* binding */ Index),\n/* harmony export */ PagingInfo: () => (/* binding */ PagingInfo),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar Index;\n(function (Index) {\n let _codec;\n Index.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.digest != null && obj.digest.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.digest);\n }\n if ((obj.receiverTime != null && obj.receiverTime !== 0n)) {\n w.uint32(16);\n w.sint64(obj.receiverTime);\n }\n if ((obj.senderTime != null && obj.senderTime !== 0n)) {\n w.uint32(24);\n w.sint64(obj.senderTime);\n }\n if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {\n w.uint32(34);\n w.string(obj.pubsubTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n digest: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n receiverTime: 0n,\n senderTime: 0n,\n pubsubTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.digest = reader.bytes();\n break;\n }\n case 2: {\n obj.receiverTime = reader.sint64();\n break;\n }\n case 3: {\n obj.senderTime = reader.sint64();\n break;\n }\n case 4: {\n obj.pubsubTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Index.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Index.codec());\n };\n Index.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Index.codec(), opts);\n };\n})(Index || (Index = {}));\nvar PagingInfo;\n(function (PagingInfo) {\n let Direction;\n (function (Direction) {\n Direction[\"BACKWARD\"] = \"BACKWARD\";\n Direction[\"FORWARD\"] = \"FORWARD\";\n })(Direction = PagingInfo.Direction || (PagingInfo.Direction = {}));\n let __DirectionValues;\n (function (__DirectionValues) {\n __DirectionValues[__DirectionValues[\"BACKWARD\"] = 0] = \"BACKWARD\";\n __DirectionValues[__DirectionValues[\"FORWARD\"] = 1] = \"FORWARD\";\n })(__DirectionValues || (__DirectionValues = {}));\n (function (Direction) {\n Direction.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__DirectionValues);\n };\n })(Direction = PagingInfo.Direction || (PagingInfo.Direction = {}));\n let _codec;\n PagingInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.pageSize != null) {\n w.uint32(8);\n w.uint64(obj.pageSize);\n }\n if (obj.cursor != null) {\n w.uint32(18);\n Index.codec().encode(obj.cursor, w);\n }\n if (obj.direction != null) {\n w.uint32(24);\n PagingInfo.Direction.codec().encode(obj.direction, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.pageSize = reader.uint64();\n break;\n }\n case 2: {\n obj.cursor = Index.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.cursor\n });\n break;\n }\n case 3: {\n obj.direction = PagingInfo.Direction.codec().decode(reader);\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PagingInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PagingInfo.codec());\n };\n PagingInfo.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PagingInfo.codec(), opts);\n };\n})(PagingInfo || (PagingInfo = {}));\nvar ContentFilter;\n(function (ContentFilter) {\n let _codec;\n ContentFilter.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(10);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.contentTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ContentFilter.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ContentFilter.codec());\n };\n ContentFilter.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ContentFilter.codec(), opts);\n };\n})(ContentFilter || (ContentFilter = {}));\nvar HistoryQuery;\n(function (HistoryQuery) {\n let _codec;\n HistoryQuery.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.pubsubTopic != null) {\n w.uint32(18);\n w.string(obj.pubsubTopic);\n }\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n w.uint32(26);\n ContentFilter.codec().encode(value, w);\n }\n }\n if (obj.pagingInfo != null) {\n w.uint32(34);\n PagingInfo.codec().encode(obj.pagingInfo, w);\n }\n if (obj.startTime != null) {\n w.uint32(40);\n w.sint64(obj.startTime);\n }\n if (obj.endTime != null) {\n w.uint32(48);\n w.sint64(obj.endTime);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentFilters: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2: {\n obj.pubsubTopic = reader.string();\n break;\n }\n case 3: {\n if (opts.limits?.contentFilters != null && obj.contentFilters.length === opts.limits.contentFilters) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"contentFilters\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.contentFilters.push(ContentFilter.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.contentFilters$\n }));\n break;\n }\n case 4: {\n obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.pagingInfo\n });\n break;\n }\n case 5: {\n obj.startTime = reader.sint64();\n break;\n }\n case 6: {\n obj.endTime = reader.sint64();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryQuery.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryQuery.codec());\n };\n HistoryQuery.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryQuery.codec(), opts);\n };\n})(HistoryQuery || (HistoryQuery = {}));\nvar HistoryResponse;\n(function (HistoryResponse) {\n let HistoryError;\n (function (HistoryError) {\n HistoryError[\"NONE\"] = \"NONE\";\n HistoryError[\"INVALID_CURSOR\"] = \"INVALID_CURSOR\";\n HistoryError[\"TOO_MANY_RESULTS\"] = \"TOO_MANY_RESULTS\";\n HistoryError[\"SERVICE_UNAVAILABLE\"] = \"SERVICE_UNAVAILABLE\";\n })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));\n let __HistoryErrorValues;\n (function (__HistoryErrorValues) {\n __HistoryErrorValues[__HistoryErrorValues[\"NONE\"] = 0] = \"NONE\";\n __HistoryErrorValues[__HistoryErrorValues[\"INVALID_CURSOR\"] = 1] = \"INVALID_CURSOR\";\n __HistoryErrorValues[__HistoryErrorValues[\"TOO_MANY_RESULTS\"] = 429] = \"TOO_MANY_RESULTS\";\n __HistoryErrorValues[__HistoryErrorValues[\"SERVICE_UNAVAILABLE\"] = 503] = \"SERVICE_UNAVAILABLE\";\n })(__HistoryErrorValues || (__HistoryErrorValues = {}));\n (function (HistoryError) {\n HistoryError.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__HistoryErrorValues);\n };\n })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));\n let _codec;\n HistoryResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.messages != null) {\n for (const value of obj.messages) {\n w.uint32(18);\n WakuMessage.codec().encode(value, w);\n }\n }\n if (obj.pagingInfo != null) {\n w.uint32(26);\n PagingInfo.codec().encode(obj.pagingInfo, w);\n }\n if (obj.error != null && __HistoryErrorValues[obj.error] !== 0) {\n w.uint32(32);\n HistoryResponse.HistoryError.codec().encode(obj.error, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n messages: [],\n error: HistoryError.NONE\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2: {\n if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"messages\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.messages$\n }));\n break;\n }\n case 3: {\n obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.pagingInfo\n });\n break;\n }\n case 4: {\n obj.error = HistoryResponse.HistoryError.codec().decode(reader);\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryResponse.codec());\n };\n HistoryResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryResponse.codec(), opts);\n };\n})(HistoryResponse || (HistoryResponse = {}));\nvar HistoryRpc;\n(function (HistoryRpc) {\n let _codec;\n HistoryRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.query != null) {\n w.uint32(18);\n HistoryQuery.codec().encode(obj.query, w);\n }\n if (obj.response != null) {\n w.uint32(26);\n HistoryResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.query = HistoryQuery.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.query\n });\n break;\n }\n case 3: {\n obj.response = HistoryResponse.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.response\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryRpc.codec());\n };\n HistoryRpc.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryRpc.codec(), opts);\n };\n})(HistoryRpc || (HistoryRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/store.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/topic_only_message.js":
|
||
/*!************************************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/topic_only_message.js ***!
|
||
\************************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TopicOnlyMessage: () => (/* binding */ TopicOnlyMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar TopicOnlyMessage;\n(function (TopicOnlyMessage) {\n let _codec;\n TopicOnlyMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n TopicOnlyMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, TopicOnlyMessage.codec());\n };\n TopicOnlyMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, TopicOnlyMessage.codec(), opts);\n };\n})(TopicOnlyMessage || (TopicOnlyMessage = {}));\n//# sourceMappingURL=topic_only_message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/topic_only_message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/relay/node_modules/@waku/proto/dist/index.js":
|
||
/*!*************************************************************************!*\
|
||
!*** ./node_modules/@waku/relay/node_modules/@waku/proto/dist/index.js ***!
|
||
\*************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushResponse: () => (/* reexport safe */ _generated_light_push_js__WEBPACK_IMPORTED_MODULE_4__.PushResponse),\n/* harmony export */ TopicOnlyMessage: () => (/* reexport safe */ _generated_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__.TopicOnlyMessage),\n/* harmony export */ WakuMessage: () => (/* reexport safe */ _generated_filter_js__WEBPACK_IMPORTED_MODULE_1__.WakuMessage),\n/* harmony export */ proto_filter: () => (/* reexport module object */ _generated_filter_js__WEBPACK_IMPORTED_MODULE_1__),\n/* harmony export */ proto_filter_v2: () => (/* reexport module object */ _generated_filter_v2_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ proto_lightpush: () => (/* reexport module object */ _generated_light_push_js__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ proto_message: () => (/* reexport module object */ _generated_message_js__WEBPACK_IMPORTED_MODULE_0__),\n/* harmony export */ proto_metadata: () => (/* reexport module object */ _generated_metadata_js__WEBPACK_IMPORTED_MODULE_7__),\n/* harmony export */ proto_peer_exchange: () => (/* reexport module object */ _generated_peer_exchange_js__WEBPACK_IMPORTED_MODULE_6__),\n/* harmony export */ proto_store: () => (/* reexport module object */ _generated_store_js__WEBPACK_IMPORTED_MODULE_5__),\n/* harmony export */ proto_topic_only_message: () => (/* reexport module object */ _generated_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__)\n/* harmony export */ });\n/* harmony import */ var _generated_message_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./generated/message.js */ \"./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/message.js\");\n/* harmony import */ var _generated_filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./generated/filter.js */ \"./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/filter.js\");\n/* harmony import */ var _generated_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./generated/topic_only_message.js */ \"./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/topic_only_message.js\");\n/* harmony import */ var _generated_filter_v2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./generated/filter_v2.js */ \"./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/filter_v2.js\");\n/* harmony import */ var _generated_light_push_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generated/light_push.js */ \"./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/light_push.js\");\n/* harmony import */ var _generated_store_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./generated/store.js */ \"./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/store.js\");\n/* harmony import */ var _generated_peer_exchange_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./generated/peer_exchange.js */ \"./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/peer_exchange.js\");\n/* harmony import */ var _generated_metadata_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./generated/metadata.js */ \"./node_modules/@waku/relay/node_modules/@waku/proto/dist/generated/metadata.js\");\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/relay/node_modules/@waku/proto/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/dist/index.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/@waku/sdk/dist/index.js ***!
|
||
\**********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_CLUSTER_ID: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_10__.DEFAULT_CLUSTER_ID),\n/* harmony export */ DecodedMessage: () => (/* reexport safe */ _waku_core_lib_message_version_0__WEBPACK_IMPORTED_MODULE_1__.DecodedMessage),\n/* harmony export */ Decoder: () => (/* reexport safe */ _waku_core_lib_message_version_0__WEBPACK_IMPORTED_MODULE_1__.Decoder),\n/* harmony export */ DefaultPingKeepAliveValueSecs: () => (/* reexport safe */ _waku_js__WEBPACK_IMPORTED_MODULE_5__.DefaultPingKeepAliveValueSecs),\n/* harmony export */ DefaultPubsubTopic: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_10__.DefaultPubsubTopic),\n/* harmony export */ DefaultRelayKeepAliveValueSecs: () => (/* reexport safe */ _waku_js__WEBPACK_IMPORTED_MODULE_5__.DefaultRelayKeepAliveValueSecs),\n/* harmony export */ DefaultUserAgent: () => (/* reexport safe */ _waku_js__WEBPACK_IMPORTED_MODULE_5__.DefaultUserAgent),\n/* harmony export */ EConnectionStateEvents: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_10__.EConnectionStateEvents),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_10__.EPeersByDiscoveryEvents),\n/* harmony export */ Encoder: () => (/* reexport safe */ _waku_core_lib_message_version_0__WEBPACK_IMPORTED_MODULE_1__.Encoder),\n/* harmony export */ PageDirection: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_10__.PageDirection),\n/* harmony export */ ProtocolError: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_10__.ProtocolError),\n/* harmony export */ Protocols: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_10__.Protocols),\n/* harmony export */ Tags: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_10__.Tags),\n/* harmony export */ WakuNode: () => (/* reexport safe */ _waku_js__WEBPACK_IMPORTED_MODULE_5__.WakuNode),\n/* harmony export */ bytesToUtf8: () => (/* reexport safe */ _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_2__.bytesToUtf8),\n/* harmony export */ createDecoder: () => (/* reexport safe */ _waku_core__WEBPACK_IMPORTED_MODULE_0__.createDecoder),\n/* harmony export */ createEncoder: () => (/* reexport safe */ _waku_core__WEBPACK_IMPORTED_MODULE_0__.createEncoder),\n/* harmony export */ createLightNode: () => (/* reexport safe */ _light_node_index_js__WEBPACK_IMPORTED_MODULE_6__.createLightNode),\n/* harmony export */ createNode: () => (/* reexport safe */ _light_node_index_js__WEBPACK_IMPORTED_MODULE_6__.createNode),\n/* harmony export */ defaultLibp2p: () => (/* reexport safe */ _utils_libp2p_js__WEBPACK_IMPORTED_MODULE_3__.defaultLibp2p),\n/* harmony export */ relay: () => (/* reexport module object */ _waku_relay__WEBPACK_IMPORTED_MODULE_11__),\n/* harmony export */ streamContentTopic: () => (/* reexport safe */ _utils_content_topic_js__WEBPACK_IMPORTED_MODULE_4__.streamContentTopic),\n/* harmony export */ subscribeToContentTopic: () => (/* reexport safe */ _utils_content_topic_js__WEBPACK_IMPORTED_MODULE_4__.subscribeToContentTopic),\n/* harmony export */ utf8ToBytes: () => (/* reexport safe */ _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_2__.utf8ToBytes),\n/* harmony export */ utils: () => (/* reexport module object */ _waku_utils__WEBPACK_IMPORTED_MODULE_9__),\n/* harmony export */ waitForRemotePeer: () => (/* reexport safe */ _waku_core__WEBPACK_IMPORTED_MODULE_0__.waitForRemotePeer),\n/* harmony export */ waku: () => (/* reexport module object */ _waku_core__WEBPACK_IMPORTED_MODULE_0__),\n/* harmony export */ wakuLightPush: () => (/* reexport safe */ _protocols_light_push_js__WEBPACK_IMPORTED_MODULE_7__.wakuLightPush),\n/* harmony export */ wakuStore: () => (/* reexport safe */ _protocols_store_js__WEBPACK_IMPORTED_MODULE_8__.wakuStore)\n/* harmony export */ });\n/* harmony import */ var _waku_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/core */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/index.js\");\n/* harmony import */ var _waku_core_lib_message_version_0__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/core/lib/message/version_0 */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/message/version_0.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _utils_libp2p_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/libp2p.js */ \"./node_modules/@waku/sdk/dist/utils/libp2p.js\");\n/* harmony import */ var _utils_content_topic_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/content_topic.js */ \"./node_modules/@waku/sdk/dist/utils/content_topic.js\");\n/* harmony import */ var _waku_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./waku.js */ \"./node_modules/@waku/sdk/dist/waku.js\");\n/* harmony import */ var _light_node_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./light-node/index.js */ \"./node_modules/@waku/sdk/dist/light-node/index.js\");\n/* harmony import */ var _protocols_light_push_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./protocols/light_push.js */ \"./node_modules/@waku/sdk/dist/protocols/light_push.js\");\n/* harmony import */ var _protocols_store_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./protocols/store.js */ \"./node_modules/@waku/sdk/dist/protocols/store.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_relay__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @waku/relay */ \"./node_modules/@waku/relay/dist/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/dist/light-node/index.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/dist/light-node/index.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createLightNode: () => (/* binding */ createLightNode),\n/* harmony export */ createNode: () => (/* binding */ createNode)\n/* harmony export */ });\n/* harmony import */ var _waku_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/core */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/index.js\");\n/* harmony import */ var _protocols_light_push_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../protocols/light_push.js */ \"./node_modules/@waku/sdk/dist/protocols/light_push.js\");\n/* harmony import */ var _protocols_store_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../protocols/store.js */ \"./node_modules/@waku/sdk/dist/protocols/store.js\");\n/* harmony import */ var _utils_libp2p_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/libp2p.js */ \"./node_modules/@waku/sdk/dist/utils/libp2p.js\");\n/* harmony import */ var _waku_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../waku.js */ \"./node_modules/@waku/sdk/dist/waku.js\");\n\n\n\n\n\n/**\n * Create a Waku node configured to use autosharding or static sharding.\n */\nasync function createNode(options = { pubsubTopics: [] }) {\n if (!options.shardInfo) {\n throw new Error(\"Shard info must be set\");\n }\n const libp2p = await (0,_utils_libp2p_js__WEBPACK_IMPORTED_MODULE_3__.createLibp2pAndUpdateOptions)(options);\n const store = (0,_protocols_store_js__WEBPACK_IMPORTED_MODULE_2__.wakuStore)(options);\n const lightPush = (0,_protocols_light_push_js__WEBPACK_IMPORTED_MODULE_1__.wakuLightPush)(options);\n const filter = (0,_waku_core__WEBPACK_IMPORTED_MODULE_0__.wakuFilter)(options);\n return new _waku_js__WEBPACK_IMPORTED_MODULE_4__.WakuNode(options, libp2p, store, lightPush, filter);\n}\n/**\n * Create a Waku node that uses Waku Light Push, Filter and Store to send and\n * receive messages, enabling low resource consumption.\n * Uses Waku Filter V2 by default.\n */\nasync function createLightNode(options = {}) {\n const libp2p = await (0,_utils_libp2p_js__WEBPACK_IMPORTED_MODULE_3__.createLibp2pAndUpdateOptions)(options);\n const store = (0,_protocols_store_js__WEBPACK_IMPORTED_MODULE_2__.wakuStore)(options);\n const lightPush = (0,_protocols_light_push_js__WEBPACK_IMPORTED_MODULE_1__.wakuLightPush)(options);\n const filter = (0,_waku_core__WEBPACK_IMPORTED_MODULE_0__.wakuFilter)(options);\n return new _waku_js__WEBPACK_IMPORTED_MODULE_4__.WakuNode(options, libp2p, store, lightPush, filter);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/dist/light-node/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/dist/protocols/base_protocol.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/dist/protocols/base_protocol.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BaseProtocolSDK: () => (/* binding */ BaseProtocolSDK)\n/* harmony export */ });\nconst DEFAULT_NUM_PEERS_TO_USE = 3;\nclass BaseProtocolSDK {\n numPeers;\n constructor(options) {\n this.numPeers = options?.numPeersToUse ?? DEFAULT_NUM_PEERS_TO_USE;\n }\n}\n//# sourceMappingURL=base_protocol.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/dist/protocols/base_protocol.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/dist/protocols/light_push.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/dist/protocols/light_push.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LightPushSDK: () => (/* binding */ LightPushSDK),\n/* harmony export */ wakuLightPush: () => (/* binding */ wakuLightPush)\n/* harmony export */ });\n/* harmony import */ var _waku_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/core */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _base_protocol_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./base_protocol.js */ \"./node_modules/@waku/sdk/dist/protocols/base_protocol.js\");\n\n\n\n\nconst DEFAULT_NUM_PEERS = 3;\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_2__.Logger(\"sdk:light-push\");\nclass LightPushSDK extends _base_protocol_js__WEBPACK_IMPORTED_MODULE_3__.BaseProtocolSDK {\n protocol;\n constructor(libp2p, options) {\n super({ numPeersToUse: options?.numPeersToUse ?? DEFAULT_NUM_PEERS });\n this.protocol = new _waku_core__WEBPACK_IMPORTED_MODULE_0__.LightPushCore(libp2p, options);\n }\n async send(encoder, message) {\n const successes = [];\n const failures = [];\n const { pubsubTopic } = encoder;\n try {\n (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.ensurePubsubTopicIsConfigured)(pubsubTopic, this.protocol.pubsubTopics);\n }\n catch (error) {\n log.error(\"Failed to send waku light push: pubsub topic not configured\");\n return {\n failures: [\n {\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.ProtocolError.TOPIC_NOT_CONFIGURED\n }\n ],\n successes: []\n };\n }\n const peers = await this.protocol.getPeers();\n if (!peers.length) {\n return {\n successes,\n failures: [{ error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.ProtocolError.NO_PEER_AVAILABLE }]\n };\n }\n const sendPromises = peers.map((peer) => this.protocol.send(encoder, message, peer));\n const results = await Promise.allSettled(sendPromises);\n for (const result of results) {\n if (result.status === \"fulfilled\") {\n const { failure, success } = result.value;\n if (success) {\n successes.push(success);\n }\n if (failure) {\n failures.push(failure);\n }\n }\n else {\n log.error(\"Failed to send message to peer\", result.reason);\n failures.push({ error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.ProtocolError.GENERIC_FAIL });\n // TODO: handle renewing faulty peers with new peers (https://github.com/waku-org/js-waku/issues/1463)\n }\n }\n return {\n successes,\n failures\n };\n }\n}\nfunction wakuLightPush(init = {}) {\n return (libp2p) => new LightPushSDK(libp2p, init);\n}\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/dist/protocols/light_push.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/dist/protocols/store.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/dist/protocols/store.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultPageSize: () => (/* binding */ DefaultPageSize),\n/* harmony export */ StoreSDK: () => (/* binding */ StoreSDK),\n/* harmony export */ wakuStore: () => (/* binding */ wakuStore)\n/* harmony export */ });\n/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/@noble/hashes/esm/sha256.js\");\n/* harmony import */ var _waku_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/core */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../index.js */ \"./node_modules/@waku/sdk/dist/index.js\");\n/* harmony import */ var _base_protocol_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./base_protocol.js */ \"./node_modules/@waku/sdk/dist/protocols/base_protocol.js\");\n\n\n\n\n\n\n\nconst DefaultPageSize = 10;\nconst DEFAULT_NUM_PEERS = 1;\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_2__.Logger(\"waku:store:protocol\");\nclass StoreSDK extends _base_protocol_js__WEBPACK_IMPORTED_MODULE_5__.BaseProtocolSDK {\n protocol;\n constructor(libp2p, options) {\n // TODO: options.numPeersToUse is disregarded: https://github.com/waku-org/js-waku/issues/1685\n super({ numPeersToUse: DEFAULT_NUM_PEERS });\n this.protocol = new _waku_core__WEBPACK_IMPORTED_MODULE_0__.StoreCore(libp2p, options);\n }\n /**\n * Do a query to a Waku Store to retrieve historical/missed messages.\n *\n * This is a generator, useful if you want most control on how messages\n * are processed.\n *\n * The order of the messages returned by the remote Waku node SHOULD BE\n * as follows:\n * - within a page, messages SHOULD be ordered from oldest to most recent\n * - pages direction depends on { @link QueryOptions.pageDirection }\n * @throws If not able to reach a Waku Store peer to query,\n * or if an error is encountered when processing the reply,\n * or if two decoders with the same content topic are passed.\n *\n * This API only supports querying a single pubsub topic at a time.\n * If multiple decoders are provided, they must all have the same pubsub topic.\n * @throws If multiple decoders with different pubsub topics are provided.\n * @throws If no decoders are provided.\n * @throws If no decoders are found for the provided pubsub topic.\n */\n async *queryGenerator(decoders, options) {\n const { pubsubTopic, contentTopics, decodersAsMap } = this.validateDecodersAndPubsubTopic(decoders, options);\n const queryOpts = this.constructOptions(pubsubTopic, contentTopics, options);\n const peer = (await this.protocol.getPeers({\n numPeers: this.numPeers,\n maxBootstrapPeers: 1\n }))[0];\n if (!peer)\n throw new Error(\"No peers available to query\");\n const responseGenerator = this.protocol.queryPerPage(queryOpts, decodersAsMap, peer);\n for await (const messages of responseGenerator) {\n yield messages;\n }\n }\n /**\n * Do a query to a Waku Store to retrieve historical/missed messages.\n *\n * The callback function takes a `WakuMessage` in input,\n * messages are processed in order:\n * - oldest to latest if `options.pageDirection` == { @link PageDirection.FORWARD }\n * - latest to oldest if `options.pageDirection` == { @link PageDirection.BACKWARD }\n *\n * The ordering may affect performance.\n * The ordering depends on the behavior of the remote store node.\n * If strong ordering is needed, you may need to handle this at application level\n * and set your own timestamps too (the WakuMessage timestamps are not certified).\n *\n * @throws If not able to reach a Waku Store peer to query,\n * or if an error is encountered when processing the reply,\n * or if two decoders with the same content topic are passed.\n */\n async queryWithOrderedCallback(decoders, callback, options) {\n for await (const promises of this.queryGenerator(decoders, options)) {\n if (await this.processMessages(promises, callback, options))\n break;\n }\n }\n /**\n * Do a query to a Waku Store to retrieve historical/missed messages.\n * The callback function takes a `Promise<WakuMessage>` in input,\n * useful if messages need to be decrypted and performance matters.\n *\n * The order of the messages passed to the callback is as follows:\n * - within a page, messages are expected to be ordered from oldest to most recent\n * - pages direction depends on { @link QueryOptions.pageDirection }\n *\n * Do note that the resolution of the `Promise<WakuMessage | undefined` may\n * break the order as it may rely on the browser decryption API, which in turn,\n * may have a different speed depending on the type of decryption.\n *\n * @throws If not able to reach a Waku Store peer to query,\n * or if an error is encountered when processing the reply,\n * or if two decoders with the same content topic are passed.\n */\n async queryWithPromiseCallback(decoders, callback, options) {\n let abort = false;\n for await (const page of this.queryGenerator(decoders, options)) {\n const _promises = page.map(async (msgPromise) => {\n if (abort)\n return;\n abort = Boolean(await callback(msgPromise));\n });\n await Promise.all(_promises);\n if (abort)\n break;\n }\n }\n createCursor(message) {\n if (!message ||\n !message.timestamp ||\n !message.payload ||\n !message.contentTopic) {\n throw new Error(\"Message is missing required fields\");\n }\n const contentTopicBytes = (0,_index_js__WEBPACK_IMPORTED_MODULE_4__.utf8ToBytes)(message.contentTopic);\n const digest = (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_6__.sha256)((0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([contentTopicBytes, message.payload]));\n const messageTime = BigInt(message.timestamp.getTime()) * BigInt(1000000);\n return {\n digest,\n pubsubTopic: message.pubsubTopic,\n senderTime: messageTime,\n receiverTime: messageTime\n };\n }\n validateDecodersAndPubsubTopic(decoders, options) {\n if (decoders.length === 0) {\n throw new Error(\"No decoders provided\");\n }\n // convert array to set to remove duplicates\n const uniquePubsubTopicsInQuery = Array.from(new Set(decoders.map((decoder) => decoder.pubsubTopic)));\n // If multiple pubsub topics are provided, throw an error\n if (uniquePubsubTopicsInQuery.length > 1) {\n throw new Error(\"API does not support querying multiple pubsub topics at once\");\n }\n // we can be certain that there is only one pubsub topic in the query\n const pubsubTopicForQuery = uniquePubsubTopicsInQuery[0];\n (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.ensurePubsubTopicIsConfigured)(pubsubTopicForQuery, this.protocol.pubsubTopics);\n // check that the pubsubTopic from the Cursor and Decoder match\n if (options?.cursor?.pubsubTopic &&\n options.cursor.pubsubTopic !== pubsubTopicForQuery) {\n throw new Error(`Cursor pubsub topic (${options?.cursor?.pubsubTopic}) does not match decoder pubsub topic (${pubsubTopicForQuery})`);\n }\n const decodersAsMap = new Map();\n decoders.forEach((dec) => {\n if (decodersAsMap.has(dec.contentTopic)) {\n throw new Error(\"API does not support different decoder per content topic\");\n }\n decodersAsMap.set(dec.contentTopic, dec);\n });\n const contentTopics = decoders\n .filter((decoder) => decoder.pubsubTopic === pubsubTopicForQuery)\n .map((dec) => dec.contentTopic);\n if (contentTopics.length === 0) {\n throw new Error(\"No decoders found for topic \" + pubsubTopicForQuery);\n }\n return {\n pubsubTopic: pubsubTopicForQuery,\n contentTopics,\n decodersAsMap\n };\n }\n constructOptions(pubsubTopic, contentTopics, options = {}) {\n let startTime, endTime;\n if (options?.timeFilter) {\n startTime = options.timeFilter.startTime;\n endTime = options.timeFilter.endTime;\n }\n if (!startTime) {\n log.warn(\"No start time provided\");\n }\n if (!endTime) {\n log.warn(\"No end time provided\");\n }\n const queryOpts = Object.assign({\n pubsubTopic: pubsubTopic,\n pageDirection: _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.PageDirection.BACKWARD,\n pageSize: DefaultPageSize\n }, options, { contentTopics, startTime, endTime });\n return queryOpts;\n }\n /**\n * Processes messages based on the provided callback and options.\n * @private\n */\n async processMessages(messages, callback, options) {\n let abort = false;\n const messagesOrUndef = await Promise.all(messages);\n let processedMessages = messagesOrUndef.filter(_waku_utils__WEBPACK_IMPORTED_MODULE_2__.isDefined);\n if (this.shouldReverseOrder(options)) {\n processedMessages = processedMessages.reverse();\n }\n await Promise.all(processedMessages.map(async (msg) => {\n if (msg && !abort) {\n abort = Boolean(await callback(msg));\n }\n }));\n return abort;\n }\n /**\n * Determines whether to reverse the order of messages based on the provided options.\n *\n * Messages in pages are ordered from oldest (first) to most recent (last).\n * https://github.com/vacp2p/rfc/issues/533\n *\n * @private\n */\n shouldReverseOrder(options) {\n return (typeof options?.pageDirection === \"undefined\" ||\n options?.pageDirection === _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.PageDirection.BACKWARD);\n }\n}\nfunction wakuStore(init = {}) {\n return (libp2p) => new StoreSDK(libp2p, init);\n}\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/dist/protocols/store.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/dist/utils/content_topic.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/dist/utils/content_topic.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ streamContentTopic: () => (/* binding */ streamContentTopic),\n/* harmony export */ subscribeToContentTopic: () => (/* binding */ subscribeToContentTopic)\n/* harmony export */ });\n/* harmony import */ var _waku_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/core */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _light_node_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../light-node/index.js */ \"./node_modules/@waku/sdk/dist/light-node/index.js\");\n\n\n\n\n// Given a Waku node, peer Multiaddr, and content topic, creates a decoder and\n// subscription for that content topic.\nasync function prepareSubscription(waku, contentTopic, peer) {\n // Validate that the Waku node matches assumptions\n if (!waku.filter) {\n throw new Error(\"Filter protocol missing from Waku node\");\n }\n const { shardInfo } = waku.libp2p.components.metadata;\n if (!shardInfo) {\n throw new Error(\"Shard info missing from Waku node.\");\n }\n // Validate content topic and ensure node is configured for its corresponding pubsub topic\n const pubsubTopics = (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.shardInfoToPubsubTopics)(shardInfo);\n const pubsubTopic = (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.contentTopicToPubsubTopic)(contentTopic);\n if (!pubsubTopics.includes(pubsubTopic))\n throw new Error(\"Content topic does not match any pubsub topic in shard info.\");\n await waku.dial(peer);\n await (0,_waku_core__WEBPACK_IMPORTED_MODULE_0__.waitForRemotePeer)(waku, [_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Protocols.Filter]);\n // Create decoder and subscription\n let decoder = (0,_waku_core__WEBPACK_IMPORTED_MODULE_0__.createDecoder)(contentTopic, pubsubTopic);\n if (decoder)\n decoder = decoder ?? decoder;\n const subscription = await waku.filter.createSubscription(pubsubTopic);\n return { decoder, subscription };\n}\n/**\n * Creates a subscription and streams all new messages for a content topic.\n * Will create a light node configured for the content topic with default settings if a node is not provided in `opts`.\n * Assumes node is using autosharding.\n * @param contentTopic\n * @param opts\n */\nasync function streamContentTopic(contentTopic, opts) {\n opts.waku =\n opts.waku ??\n (await (0,_light_node_index_js__WEBPACK_IMPORTED_MODULE_3__.createLightNode)({\n shardInfo: { contentTopics: [contentTopic] }\n }));\n const { decoder, subscription } = await prepareSubscription(opts.waku, contentTopic, opts.peer);\n // Create a ReadableStream that receives any messages for the content topic\n const messageStream = new ReadableStream({\n async start(controller) {\n await subscription.subscribe(decoder, (message) => {\n controller.enqueue(message);\n });\n },\n cancel() {\n return subscription.unsubscribe([contentTopic]);\n }\n });\n return [messageStream, opts.waku];\n}\n/**\n * Subscribes to new messages for a content topic via callback function.\n * Will create a light node configured for the content topic with default settings if a node is not provided in `opts`.\n * Assumes node is using autosharding.\n * @param contentTopic\n * @param callback Called every time a new message is received on the content topic\n * @param opts\n */\nasync function subscribeToContentTopic(contentTopic, callback, opts) {\n opts.waku =\n opts.waku ??\n (await (0,_light_node_index_js__WEBPACK_IMPORTED_MODULE_3__.createLightNode)({\n shardInfo: { contentTopics: [contentTopic] }\n }));\n const { decoder, subscription } = await prepareSubscription(opts.waku, contentTopic, opts.peer);\n await subscription.subscribe(decoder, callback);\n return { subscription, waku: opts.waku };\n}\n//# sourceMappingURL=content_topic.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/dist/utils/content_topic.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/dist/utils/discovery.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/dist/utils/discovery.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ defaultPeerDiscoveries: () => (/* binding */ defaultPeerDiscoveries)\n/* harmony export */ });\n/* harmony import */ var _waku_discovery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/discovery */ \"./node_modules/@waku/discovery/dist/index.js\");\n\nconst DEFAULT_NODE_REQUIREMENTS = {\n lightPush: 1,\n filter: 1,\n store: 1\n};\nfunction defaultPeerDiscoveries(pubsubTopics) {\n const discoveries = [\n (0,_waku_discovery__WEBPACK_IMPORTED_MODULE_0__.wakuDnsDiscovery)([_waku_discovery__WEBPACK_IMPORTED_MODULE_0__.enrTree[\"SANDBOX\"]], DEFAULT_NODE_REQUIREMENTS),\n (0,_waku_discovery__WEBPACK_IMPORTED_MODULE_0__.wakuLocalPeerCacheDiscovery)(),\n (0,_waku_discovery__WEBPACK_IMPORTED_MODULE_0__.wakuPeerExchangeDiscovery)(pubsubTopics)\n ];\n return discoveries;\n}\n//# sourceMappingURL=discovery.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/dist/utils/discovery.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/dist/utils/libp2p.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/dist/utils/libp2p.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createLibp2pAndUpdateOptions: () => (/* binding */ createLibp2pAndUpdateOptions),\n/* harmony export */ defaultLibp2p: () => (/* binding */ defaultLibp2p)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_libp2p_noise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/libp2p-noise */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/index.js\");\n/* harmony import */ var _libp2p_bootstrap__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @libp2p/bootstrap */ \"./node_modules/@libp2p/bootstrap/dist/src/index.js\");\n/* harmony import */ var _libp2p_identify__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @libp2p/identify */ \"./node_modules/@libp2p/identify/dist/src/index.js\");\n/* harmony import */ var _libp2p_mplex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @libp2p/mplex */ \"./node_modules/@libp2p/mplex/dist/src/index.js\");\n/* harmony import */ var _libp2p_ping__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @libp2p/ping */ \"./node_modules/@libp2p/ping/dist/src/index.js\");\n/* harmony import */ var _libp2p_websockets__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/websockets */ \"./node_modules/@libp2p/websockets/dist/src/index.js\");\n/* harmony import */ var _libp2p_websockets_filters__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @libp2p/websockets/filters */ \"./node_modules/@libp2p/websockets/dist/src/filters.js\");\n/* harmony import */ var _waku_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/core */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_relay__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @waku/relay */ \"./node_modules/@waku/relay/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var libp2p__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! libp2p */ \"./node_modules/libp2p/dist/src/index.js\");\n/* harmony import */ var _waku_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../waku.js */ \"./node_modules/@waku/sdk/dist/waku.js\");\n/* harmony import */ var _discovery_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./discovery.js */ \"./node_modules/@waku/sdk/dist/utils/discovery.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nasync function defaultLibp2p(shardInfo, wakuGossipSub, options, userAgent) {\n if (!options?.hideWebSocketInfo && \"development\" !== \"test\") {\n /* eslint-disable no-console */\n console.info(\"%cIgnore WebSocket connection failures\", \"background: gray; color: white; font-size: x-large\");\n console.info(\"%cWaku tries to discover peers and some of them are expected to fail\", \"background: gray; color: white; font-size: x-large\");\n /* eslint-enable no-console */\n }\n const pubsubService = wakuGossipSub\n ? { pubsub: wakuGossipSub }\n : {};\n const metadataService = shardInfo\n ? { metadata: (0,_waku_core__WEBPACK_IMPORTED_MODULE_1__.wakuMetadata)(shardInfo) }\n : {};\n return (0,libp2p__WEBPACK_IMPORTED_MODULE_7__.createLibp2p)({\n connectionManager: {\n minConnections: 1\n },\n transports: [(0,_libp2p_websockets__WEBPACK_IMPORTED_MODULE_8__.webSockets)({ filter: _libp2p_websockets_filters__WEBPACK_IMPORTED_MODULE_9__.all })],\n streamMuxers: [(0,_libp2p_mplex__WEBPACK_IMPORTED_MODULE_10__.mplex)()],\n connectionEncryption: [(0,_chainsafe_libp2p_noise__WEBPACK_IMPORTED_MODULE_0__.noise)()],\n ...options,\n services: {\n identify: (0,_libp2p_identify__WEBPACK_IMPORTED_MODULE_11__.identify)({\n agentVersion: userAgent ?? _waku_js__WEBPACK_IMPORTED_MODULE_5__.DefaultUserAgent\n }),\n ping: (0,_libp2p_ping__WEBPACK_IMPORTED_MODULE_12__.ping)(),\n ...metadataService,\n ...pubsubService,\n ...options?.services\n }\n }); // TODO: make libp2p include it;\n}\nasync function createLibp2pAndUpdateOptions(options) {\n const shardInfo = options.shardInfo\n ? (0,_waku_utils__WEBPACK_IMPORTED_MODULE_4__.ensureShardingConfigured)(options.shardInfo)\n : undefined;\n options.pubsubTopics = shardInfo?.pubsubTopics ??\n options.pubsubTopics ?? [_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.DefaultPubsubTopic];\n const libp2pOptions = options?.libp2p ?? {};\n const peerDiscovery = libp2pOptions.peerDiscovery ?? [];\n if (options?.defaultBootstrap) {\n peerDiscovery.push(...(0,_discovery_js__WEBPACK_IMPORTED_MODULE_6__.defaultPeerDiscoveries)(options.pubsubTopics));\n }\n if (options?.bootstrapPeers) {\n peerDiscovery.push((0,_libp2p_bootstrap__WEBPACK_IMPORTED_MODULE_13__.bootstrap)({ list: options.bootstrapPeers }));\n }\n libp2pOptions.peerDiscovery = peerDiscovery;\n const libp2p = await defaultLibp2p(shardInfo?.shardInfo, (0,_waku_relay__WEBPACK_IMPORTED_MODULE_3__.wakuGossipSub)(options), libp2pOptions, options?.userAgent);\n return libp2p;\n}\n//# sourceMappingURL=libp2p.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/dist/utils/libp2p.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/dist/waku.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/@waku/sdk/dist/waku.js ***!
|
||
\*********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultPingKeepAliveValueSecs: () => (/* binding */ DefaultPingKeepAliveValueSecs),\n/* harmony export */ DefaultRelayKeepAliveValueSecs: () => (/* binding */ DefaultRelayKeepAliveValueSecs),\n/* harmony export */ DefaultUserAgent: () => (/* binding */ DefaultUserAgent),\n/* harmony export */ WakuNode: () => (/* binding */ WakuNode)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/peer-id/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _waku_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/core */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _utils_content_topic_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/content_topic.js */ \"./node_modules/@waku/sdk/dist/utils/content_topic.js\");\n\n\n\n\n\n\nconst DefaultPingKeepAliveValueSecs = 5 * 60;\nconst DefaultRelayKeepAliveValueSecs = 5 * 60;\nconst DefaultUserAgent = \"js-waku\";\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_3__.Logger(\"waku\");\nclass WakuNode {\n libp2p;\n relay;\n store;\n filter;\n lightPush;\n connectionManager;\n pubsubTopics;\n constructor(options, libp2p, store, lightPush, filter, relay) {\n if (options.pubsubTopics.length == 0) {\n throw new Error(\"At least one pubsub topic must be provided\");\n }\n this.pubsubTopics = options.pubsubTopics;\n this.libp2p = libp2p;\n if (store) {\n this.store = store(libp2p);\n }\n if (filter) {\n this.filter = filter(libp2p);\n }\n if (lightPush) {\n this.lightPush = lightPush(libp2p);\n }\n if (relay) {\n this.relay = relay(libp2p);\n }\n const pingKeepAlive = options.pingKeepAlive || DefaultPingKeepAliveValueSecs;\n const relayKeepAlive = this.relay\n ? options.relayKeepAlive || DefaultRelayKeepAliveValueSecs\n : 0;\n const peerId = this.libp2p.peerId.toString();\n this.connectionManager = _waku_core__WEBPACK_IMPORTED_MODULE_1__.ConnectionManager.create(peerId, libp2p, { pingKeepAlive, relayKeepAlive }, this.pubsubTopics, this.relay);\n log.info(\"Waku node created\", peerId, `relay: ${!!this.relay}, store: ${!!this.store}, light push: ${!!this\n .lightPush}, filter: ${!!this.filter}`);\n }\n /**\n * Dials to the provided peer.\n *\n * @param peer The peer to dial\n * @param protocols Waku protocols we expect from the peer; Defaults to mounted protocols\n */\n async dial(peer, protocols) {\n const _protocols = protocols ?? [];\n const peerId = mapToPeerIdOrMultiaddr(peer);\n if (typeof protocols === \"undefined\") {\n this.relay && _protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Relay);\n this.store && _protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Store);\n this.filter && _protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Filter);\n this.lightPush && _protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.LightPush);\n }\n const codecs = [];\n if (_protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Relay)) {\n if (this.relay) {\n this.relay.gossipSub.multicodecs.forEach((codec) => codecs.push(codec));\n }\n else {\n log.error(\"Relay codec not included in dial codec: protocol not mounted locally\");\n }\n }\n if (_protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Store)) {\n if (this.store) {\n codecs.push(this.store.protocol.multicodec);\n }\n else {\n log.error(\"Store codec not included in dial codec: protocol not mounted locally\");\n }\n }\n if (_protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.LightPush)) {\n if (this.lightPush) {\n codecs.push(this.lightPush.protocol.multicodec);\n }\n else {\n log.error(\"Light Push codec not included in dial codec: protocol not mounted locally\");\n }\n }\n if (_protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Filter)) {\n if (this.filter) {\n codecs.push(this.filter.multicodec);\n }\n else {\n log.error(\"Filter codec not included in dial codec: protocol not mounted locally\");\n }\n }\n log.info(`Dialing to ${peerId.toString()} with protocols ${_protocols}`);\n return this.libp2p.dialProtocol(peerId, codecs);\n }\n async start() {\n await this.libp2p.start();\n }\n async stop() {\n this.connectionManager.stop();\n await this.libp2p.stop();\n }\n async subscribeToContentTopic(contentTopic, peer, callback) {\n return (await (0,_utils_content_topic_js__WEBPACK_IMPORTED_MODULE_4__.subscribeToContentTopic)(contentTopic, callback, {\n waku: this,\n peer\n })).subscription;\n }\n isStarted() {\n return this.libp2p.status == \"started\";\n }\n isConnected() {\n return this.connectionManager.isConnected();\n }\n /**\n * Return the local multiaddr with peer id on which libp2p is listening.\n *\n * @throws if libp2p is not listening on localhost.\n */\n getLocalMultiaddrWithID() {\n const localMultiaddr = this.libp2p\n .getMultiaddrs()\n .find((addr) => addr.toString().match(/127\\.0\\.0\\.1/));\n if (!localMultiaddr || localMultiaddr.toString() === \"\") {\n throw \"Not listening on localhost\";\n }\n return localMultiaddr + \"/p2p/\" + this.libp2p.peerId.toString();\n }\n}\nfunction mapToPeerIdOrMultiaddr(peerId) {\n return (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.isPeerId)(peerId) ? peerId : (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(peerId);\n}\n//# sourceMappingURL=waku.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/dist/waku.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/index.js":
|
||
/*!**********************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/index.js ***!
|
||
\**********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ConnectionManager: () => (/* reexport safe */ _lib_connection_manager_js__WEBPACK_IMPORTED_MODULE_6__.ConnectionManager),\n/* harmony export */ FilterCodecs: () => (/* reexport safe */ _lib_filter_index_js__WEBPACK_IMPORTED_MODULE_2__.FilterCodecs),\n/* harmony export */ KeepAliveManager: () => (/* reexport safe */ _lib_keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_7__.KeepAliveManager),\n/* harmony export */ LightPushCodec: () => (/* reexport safe */ _lib_light_push_index_js__WEBPACK_IMPORTED_MODULE_3__.LightPushCodec),\n/* harmony export */ LightPushCore: () => (/* reexport safe */ _lib_light_push_index_js__WEBPACK_IMPORTED_MODULE_3__.LightPushCore),\n/* harmony export */ MetadataCodec: () => (/* reexport safe */ _lib_metadata_index_js__WEBPACK_IMPORTED_MODULE_9__.MetadataCodec),\n/* harmony export */ PageDirection: () => (/* reexport safe */ _lib_store_index_js__WEBPACK_IMPORTED_MODULE_4__.PageDirection),\n/* harmony export */ StoreCore: () => (/* reexport safe */ _lib_store_index_js__WEBPACK_IMPORTED_MODULE_4__.StoreCore),\n/* harmony export */ StreamManager: () => (/* reexport safe */ _lib_stream_manager_js__WEBPACK_IMPORTED_MODULE_8__.StreamManager),\n/* harmony export */ createDecoder: () => (/* reexport safe */ _lib_message_version_0_js__WEBPACK_IMPORTED_MODULE_0__.createDecoder),\n/* harmony export */ createEncoder: () => (/* reexport safe */ _lib_message_version_0_js__WEBPACK_IMPORTED_MODULE_0__.createEncoder),\n/* harmony export */ message: () => (/* reexport module object */ _lib_message_index_js__WEBPACK_IMPORTED_MODULE_1__),\n/* harmony export */ waitForRemotePeer: () => (/* reexport safe */ _lib_wait_for_remote_peer_js__WEBPACK_IMPORTED_MODULE_5__.waitForRemotePeer),\n/* harmony export */ wakuFilter: () => (/* reexport safe */ _lib_filter_index_js__WEBPACK_IMPORTED_MODULE_2__.wakuFilter),\n/* harmony export */ wakuMetadata: () => (/* reexport safe */ _lib_metadata_index_js__WEBPACK_IMPORTED_MODULE_9__.wakuMetadata),\n/* harmony export */ waku_filter: () => (/* reexport module object */ _lib_filter_index_js__WEBPACK_IMPORTED_MODULE_2__),\n/* harmony export */ waku_light_push: () => (/* reexport module object */ _lib_light_push_index_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ waku_store: () => (/* reexport module object */ _lib_store_index_js__WEBPACK_IMPORTED_MODULE_4__)\n/* harmony export */ });\n/* harmony import */ var _lib_message_version_0_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/message/version_0.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/message/version_0.js\");\n/* harmony import */ var _lib_message_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/message/index.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/message/index.js\");\n/* harmony import */ var _lib_filter_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/filter/index.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filter/index.js\");\n/* harmony import */ var _lib_light_push_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/light_push/index.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/light_push/index.js\");\n/* harmony import */ var _lib_store_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/store/index.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/store/index.js\");\n/* harmony import */ var _lib_wait_for_remote_peer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/wait_for_remote_peer.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/wait_for_remote_peer.js\");\n/* harmony import */ var _lib_connection_manager_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lib/connection_manager.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/connection_manager.js\");\n/* harmony import */ var _lib_keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./lib/keep_alive_manager.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/keep_alive_manager.js\");\n/* harmony import */ var _lib_stream_manager_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./lib/stream_manager.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/stream_manager.js\");\n/* harmony import */ var _lib_metadata_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./lib/metadata/index.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/metadata/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/base_protocol.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/base_protocol.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BaseProtocol: () => (/* binding */ BaseProtocol)\n/* harmony export */ });\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/libp2p */ \"./node_modules/@waku/utils/dist/libp2p/index.js\");\n/* harmony import */ var _filterPeers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./filterPeers.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filterPeers.js\");\n/* harmony import */ var _stream_manager_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stream_manager.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/stream_manager.js\");\n\n\n\n\n/**\n * A class with predefined helpers, to be used as a base to implement Waku\n * Protocols.\n */\nclass BaseProtocol {\n multicodec;\n components;\n log;\n pubsubTopics;\n options;\n addLibp2pEventListener;\n removeLibp2pEventListener;\n streamManager;\n constructor(multicodec, components, log, pubsubTopics, options) {\n this.multicodec = multicodec;\n this.components = components;\n this.log = log;\n this.pubsubTopics = pubsubTopics;\n this.options = options;\n this.addLibp2pEventListener = components.events.addEventListener.bind(components.events);\n this.removeLibp2pEventListener = components.events.removeEventListener.bind(components.events);\n this.streamManager = new _stream_manager_js__WEBPACK_IMPORTED_MODULE_3__.StreamManager(multicodec, components.connectionManager.getConnections.bind(components.connectionManager), this.addLibp2pEventListener);\n }\n async getStream(peer) {\n return this.streamManager.getStream(peer);\n }\n get peerStore() {\n return this.components.peerStore;\n }\n /**\n * Returns known peers from the address book (`libp2p.peerStore`) that support\n * the class protocol. Waku may or may not be currently connected to these\n * peers.\n */\n async allPeers() {\n return (0,_waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__.getPeersForProtocol)(this.peerStore, [this.multicodec]);\n }\n async connectedPeers() {\n const peers = await this.allPeers();\n return peers.filter((peer) => {\n return (this.components.connectionManager.getConnections(peer.id).length > 0);\n });\n }\n /**\n * Retrieves a list of connected peers that support the protocol. The list is sorted by latency.\n *\n * @param numPeers - The total number of peers to retrieve. If 0, all peers are returned.\n * @param maxBootstrapPeers - The maximum number of bootstrap peers to retrieve.\n \n * @returns A list of peers that support the protocol sorted by latency.\n */\n async getPeers({ numPeers, maxBootstrapPeers } = {\n maxBootstrapPeers: 1,\n numPeers: 0\n }) {\n // Retrieve all connected peers that support the protocol & shard (if configured)\n const connectedPeersForProtocolAndShard = await (0,_waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__.getConnectedPeersForProtocolAndShard)(this.components.connectionManager.getConnections(), this.peerStore, [this.multicodec], this.options?.shardInfo\n ? (0,_waku_utils__WEBPACK_IMPORTED_MODULE_0__.ensureShardingConfigured)(this.options.shardInfo).shardInfo\n : undefined);\n // Filter the peers based on discovery & number of peers requested\n const filteredPeers = (0,_filterPeers_js__WEBPACK_IMPORTED_MODULE_2__.filterPeersByDiscovery)(connectedPeersForProtocolAndShard, numPeers, maxBootstrapPeers);\n // Sort the peers by latency\n const sortedFilteredPeers = await (0,_waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__.sortPeersByLatency)(this.peerStore, filteredPeers);\n if (sortedFilteredPeers.length === 0) {\n this.log.warn(\"No peers found. Ensure you have a connection to the network.\");\n }\n if (sortedFilteredPeers.length < numPeers) {\n this.log.warn(`Only ${sortedFilteredPeers.length} peers found. Requested ${numPeers}.`);\n }\n return sortedFilteredPeers;\n }\n}\n//# sourceMappingURL=base_protocol.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/base_protocol.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/connection_manager.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/connection_manager.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ConnectionManager: () => (/* binding */ ConnectionManager),\n/* harmony export */ DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED: () => (/* binding */ DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED),\n/* harmony export */ DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER: () => (/* binding */ DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER),\n/* harmony export */ DEFAULT_MAX_PARALLEL_DIALS: () => (/* binding */ DEFAULT_MAX_PARALLEL_DIALS)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/event-target.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./keep_alive_manager.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/keep_alive_manager.js\");\n\n\n\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_1__.Logger(\"connection-manager\");\nconst DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED = 1;\nconst DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER = 3;\nconst DEFAULT_MAX_PARALLEL_DIALS = 3;\nclass ConnectionManager extends _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.TypedEventEmitter {\n configuredPubsubTopics;\n static instances = new Map();\n keepAliveManager;\n options;\n libp2p;\n dialAttemptsForPeer = new Map();\n dialErrorsForPeer = new Map();\n currentActiveParallelDialCount = 0;\n pendingPeerDialQueue = [];\n online = false;\n isConnected() {\n return this.online;\n }\n toggleOnline() {\n if (!this.online) {\n this.online = true;\n this.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CustomEvent(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.EConnectionStateEvents.CONNECTION_STATUS, {\n detail: this.online\n }));\n }\n }\n toggleOffline() {\n if (this.online && this.libp2p.getConnections().length == 0) {\n this.online = false;\n this.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CustomEvent(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.EConnectionStateEvents.CONNECTION_STATUS, {\n detail: this.online\n }));\n }\n }\n static create(peerId, libp2p, keepAliveOptions, pubsubTopics, relay, options) {\n let instance = ConnectionManager.instances.get(peerId);\n if (!instance) {\n instance = new ConnectionManager(libp2p, keepAliveOptions, pubsubTopics, relay, options);\n ConnectionManager.instances.set(peerId, instance);\n }\n return instance;\n }\n async getPeersByDiscovery() {\n const peersDiscovered = await this.libp2p.peerStore.all();\n const peersConnected = this.libp2p\n .getConnections()\n .map((conn) => conn.remotePeer);\n const peersDiscoveredByBootstrap = [];\n const peersDiscoveredByPeerExchange = [];\n const peersDiscoveredByLocal = [];\n const peersConnectedByBootstrap = [];\n const peersConnectedByPeerExchange = [];\n const peersConnectedByLocal = [];\n for (const peer of peersDiscovered) {\n const tags = await this.getTagNamesForPeer(peer.id);\n if (tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP)) {\n peersDiscoveredByBootstrap.push(peer);\n }\n else if (tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.PEER_EXCHANGE)) {\n peersDiscoveredByPeerExchange.push(peer);\n }\n else if (tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.LOCAL)) {\n peersDiscoveredByLocal.push(peer);\n }\n }\n for (const peerId of peersConnected) {\n const peer = await this.libp2p.peerStore.get(peerId);\n const tags = await this.getTagNamesForPeer(peerId);\n if (tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP)) {\n peersConnectedByBootstrap.push(peer);\n }\n else if (tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.PEER_EXCHANGE)) {\n peersConnectedByPeerExchange.push(peer);\n }\n else if (tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.LOCAL)) {\n peersConnectedByLocal.push(peer);\n }\n }\n return {\n DISCOVERED: {\n [_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP]: peersDiscoveredByBootstrap,\n [_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.PEER_EXCHANGE]: peersDiscoveredByPeerExchange,\n [_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.LOCAL]: peersDiscoveredByLocal\n },\n CONNECTED: {\n [_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP]: peersConnectedByBootstrap,\n [_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.PEER_EXCHANGE]: peersConnectedByPeerExchange,\n [_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.LOCAL]: peersConnectedByLocal\n }\n };\n }\n constructor(libp2p, keepAliveOptions, configuredPubsubTopics, relay, options) {\n super();\n this.configuredPubsubTopics = configuredPubsubTopics;\n this.libp2p = libp2p;\n this.configuredPubsubTopics = configuredPubsubTopics;\n this.options = {\n maxDialAttemptsForPeer: DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER,\n maxBootstrapPeersAllowed: DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED,\n maxParallelDials: DEFAULT_MAX_PARALLEL_DIALS,\n ...options\n };\n this.keepAliveManager = new _keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_2__.KeepAliveManager(keepAliveOptions, relay);\n this.run()\n .then(() => log.info(`Connection Manager is now running`))\n .catch((error) => log.error(`Unexpected error while running service`, error));\n // libp2p emits `peer:discovery` events during its initialization\n // which means that before the ConnectionManager is initialized, some peers may have been discovered\n // we will dial the peers in peerStore ONCE before we start to listen to the `peer:discovery` events within the ConnectionManager\n this.dialPeerStorePeers().catch((error) => log.error(`Unexpected error while dialing peer store peers`, error));\n }\n async dialPeerStorePeers() {\n const peerInfos = await this.libp2p.peerStore.all();\n const dialPromises = [];\n for (const peerInfo of peerInfos) {\n if (this.libp2p.getConnections().find((c) => c.remotePeer === peerInfo.id))\n continue;\n dialPromises.push(this.attemptDial(peerInfo.id));\n }\n try {\n await Promise.all(dialPromises);\n }\n catch (error) {\n log.error(`Unexpected error while dialing peer store peers`, error);\n }\n }\n async run() {\n // start event listeners\n this.startPeerDiscoveryListener();\n this.startPeerConnectionListener();\n this.startPeerDisconnectionListener();\n }\n stop() {\n this.keepAliveManager.stopAll();\n this.libp2p.removeEventListener(\"peer:connect\", this.onEventHandlers[\"peer:connect\"]);\n this.libp2p.removeEventListener(\"peer:disconnect\", this.onEventHandlers[\"peer:disconnect\"]);\n this.libp2p.removeEventListener(\"peer:discovery\", this.onEventHandlers[\"peer:discovery\"]);\n }\n async dialPeer(peerId) {\n this.currentActiveParallelDialCount += 1;\n let dialAttempt = 0;\n while (dialAttempt < this.options.maxDialAttemptsForPeer) {\n try {\n log.info(`Dialing peer ${peerId.toString()} on attempt ${dialAttempt + 1}`);\n await this.libp2p.dial(peerId);\n const tags = await this.getTagNamesForPeer(peerId);\n // add tag to connection describing discovery mechanism\n // don't add duplicate tags\n this.libp2p.getConnections(peerId).forEach((conn) => {\n conn.tags = Array.from(new Set([...conn.tags, ...tags]));\n });\n // instead of deleting the peer from the peer store, we set the dial attempt to -1\n // this helps us keep track of peers that have been dialed before\n this.dialAttemptsForPeer.set(peerId.toString(), -1);\n // Dialing succeeded, break the loop\n break;\n }\n catch (error) {\n if (error instanceof AggregateError) {\n // Handle AggregateError\n log.error(`Error dialing peer ${peerId.toString()} - ${error.errors}`);\n }\n else {\n // Handle generic error\n log.error(`Error dialing peer ${peerId.toString()} - ${error.message}`);\n }\n this.dialErrorsForPeer.set(peerId.toString(), error);\n dialAttempt++;\n this.dialAttemptsForPeer.set(peerId.toString(), dialAttempt);\n }\n }\n // Always decrease the active dial count and process the dial queue\n this.currentActiveParallelDialCount--;\n this.processDialQueue();\n // If max dial attempts reached and dialing failed, delete the peer\n if (dialAttempt === this.options.maxDialAttemptsForPeer) {\n try {\n const error = this.dialErrorsForPeer.get(peerId.toString());\n if (error) {\n let errorMessage;\n if (error instanceof AggregateError) {\n if (!error.errors) {\n log.warn(`No errors array found for AggregateError`);\n }\n else if (error.errors.length === 0) {\n log.warn(`Errors array is empty for AggregateError`);\n }\n else {\n errorMessage = JSON.stringify(error.errors[0]);\n }\n }\n else {\n errorMessage = error.message;\n }\n log.info(`Deleting undialable peer ${peerId.toString()} from peer store. Reason: ${errorMessage}`);\n }\n this.dialErrorsForPeer.delete(peerId.toString());\n await this.libp2p.peerStore.delete(peerId);\n }\n catch (error) {\n throw new Error(`Error deleting undialable peer ${peerId.toString()} from peer store - ${error}`);\n }\n }\n }\n async dropConnection(peerId) {\n try {\n this.keepAliveManager.stop(peerId);\n await this.libp2p.hangUp(peerId);\n log.info(`Dropped connection with peer ${peerId.toString()}`);\n }\n catch (error) {\n log.error(`Error dropping connection with peer ${peerId.toString()} - ${error}`);\n }\n }\n processDialQueue() {\n if (this.pendingPeerDialQueue.length > 0 &&\n this.currentActiveParallelDialCount < this.options.maxParallelDials) {\n const peerId = this.pendingPeerDialQueue.shift();\n if (!peerId)\n return;\n this.attemptDial(peerId).catch((error) => {\n log.error(error);\n });\n }\n }\n startPeerDiscoveryListener() {\n this.libp2p.addEventListener(\"peer:discovery\", this.onEventHandlers[\"peer:discovery\"]);\n }\n startPeerConnectionListener() {\n this.libp2p.addEventListener(\"peer:connect\", this.onEventHandlers[\"peer:connect\"]);\n }\n startPeerDisconnectionListener() {\n // TODO: ensure that these following issues are updated and confirmed\n /**\n * NOTE: Event is not being emitted on closing nor losing a connection.\n * @see https://github.com/libp2p/js-libp2p/issues/939\n * @see https://github.com/status-im/js-waku/issues/252\n *\n * >This event will be triggered anytime we are disconnected from another peer,\n * >regardless of the circumstances of that disconnection.\n * >If we happen to have multiple connections to a peer,\n * >this event will **only** be triggered when the last connection is closed.\n * @see https://github.com/libp2p/js-libp2p/blob/bad9e8c0ff58d60a78314077720c82ae331cc55b/doc/API.md?plain=1#L2100\n */\n this.libp2p.addEventListener(\"peer:disconnect\", this.onEventHandlers[\"peer:disconnect\"]);\n }\n async attemptDial(peerId) {\n if (!(await this.shouldDialPeer(peerId)))\n return;\n if (this.currentActiveParallelDialCount >= this.options.maxParallelDials) {\n this.pendingPeerDialQueue.push(peerId);\n return;\n }\n this.dialPeer(peerId).catch((err) => {\n log.error(`Error dialing peer ${peerId.toString()} : ${err}`);\n });\n }\n onEventHandlers = {\n \"peer:discovery\": (evt) => {\n void (async () => {\n const { id: peerId } = evt.detail;\n await this.dispatchDiscoveryEvent(peerId);\n try {\n await this.attemptDial(peerId);\n }\n catch (error) {\n log.error(`Error dialing peer ${peerId.toString()} : ${error}`);\n }\n })();\n },\n \"peer:connect\": (evt) => {\n void (async () => {\n log.info(`Connected to peer ${evt.detail.toString()}`);\n const peerId = evt.detail;\n this.keepAliveManager.start(peerId, this.libp2p.services.ping, this.libp2p.peerStore);\n const isBootstrap = (await this.getTagNamesForPeer(peerId)).includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP);\n if (isBootstrap) {\n const bootstrapConnections = this.libp2p\n .getConnections()\n .filter((conn) => conn.tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP));\n // If we have too many bootstrap connections, drop one\n if (bootstrapConnections.length > this.options.maxBootstrapPeersAllowed) {\n await this.dropConnection(peerId);\n }\n else {\n this.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CustomEvent(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.EPeersByDiscoveryEvents.PEER_CONNECT_BOOTSTRAP, {\n detail: peerId\n }));\n }\n }\n else {\n this.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CustomEvent(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.EPeersByDiscoveryEvents.PEER_CONNECT_PEER_EXCHANGE, {\n detail: peerId\n }));\n }\n this.toggleOnline();\n })();\n },\n \"peer:disconnect\": (evt) => {\n void (async () => {\n this.keepAliveManager.stop(evt.detail);\n this.toggleOffline();\n })();\n }\n };\n /**\n * Checks if the peer should be dialed based on the following conditions:\n * 1. If the peer is already connected, don't dial\n * 2. If the peer is not part of any of the configured pubsub topics, don't dial\n * 3. If the peer is not dialable based on bootstrap status, don't dial\n * 4. If the peer is already has an active dial attempt, or has been dialed before, don't dial it\n * @returns true if the peer should be dialed, false otherwise\n */\n async shouldDialPeer(peerId) {\n // if we're already connected to the peer, don't dial\n const isConnected = this.libp2p.getConnections(peerId).length > 0;\n if (isConnected) {\n log.warn(`Already connected to peer ${peerId.toString()}. Not dialing.`);\n return false;\n }\n // if the peer is not part of any of the configured pubsub topics, don't dial\n if (!(await this.isPeerTopicConfigured(peerId))) {\n const shardInfo = await this.getPeerShardInfo(peerId, this.libp2p.peerStore);\n log.warn(`Discovered peer ${peerId.toString()} with ShardInfo ${shardInfo} is not part of any of the configured pubsub topics (${this.configuredPubsubTopics}).\n Not dialing.`);\n return false;\n }\n // if the peer is not dialable based on bootstrap status, don't dial\n if (!(await this.isPeerDialableBasedOnBootstrapStatus(peerId))) {\n log.warn(`Peer ${peerId.toString()} is not dialable based on bootstrap status. Not dialing.`);\n return false;\n }\n // If the peer is already already has an active dial attempt, or has been dialed before, don't dial it\n if (this.dialAttemptsForPeer.has(peerId.toString())) {\n log.warn(`Peer ${peerId.toString()} has already been attempted dial before, or already has a dial attempt in progress, skipping dial`);\n return false;\n }\n return true;\n }\n /**\n * Checks if the peer is dialable based on the following conditions:\n * 1. If the peer is a bootstrap peer, it is only dialable if the number of current bootstrap connections is less than the max allowed.\n * 2. If the peer is not a bootstrap peer\n */\n async isPeerDialableBasedOnBootstrapStatus(peerId) {\n const tagNames = await this.getTagNamesForPeer(peerId);\n const isBootstrap = tagNames.some((tagName) => tagName === _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP);\n if (isBootstrap) {\n const currentBootstrapConnections = this.libp2p\n .getConnections()\n .filter((conn) => {\n return conn.tags.find((name) => name === _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP);\n }).length;\n if (currentBootstrapConnections < this.options.maxBootstrapPeersAllowed)\n return true;\n }\n else {\n return true;\n }\n return false;\n }\n async dispatchDiscoveryEvent(peerId) {\n const isBootstrap = (await this.getTagNamesForPeer(peerId)).includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP);\n this.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CustomEvent(isBootstrap\n ? _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.EPeersByDiscoveryEvents.PEER_DISCOVERY_BOOTSTRAP\n : _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.EPeersByDiscoveryEvents.PEER_DISCOVERY_PEER_EXCHANGE, {\n detail: peerId\n }));\n }\n /**\n * Fetches the tag names for a given peer\n */\n async getTagNamesForPeer(peerId) {\n try {\n const peer = await this.libp2p.peerStore.get(peerId);\n return Array.from(peer.tags.keys());\n }\n catch (error) {\n log.error(`Failed to get peer ${peerId}, error: ${error}`);\n return [];\n }\n }\n async isPeerTopicConfigured(peerId) {\n const shardInfo = await this.getPeerShardInfo(peerId, this.libp2p.peerStore);\n // If there's no shard information, simply return true\n if (!shardInfo)\n return true;\n const pubsubTopics = (0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.shardInfoToPubsubTopics)(shardInfo);\n const isTopicConfigured = pubsubTopics.some((topic) => this.configuredPubsubTopics.includes(topic));\n return isTopicConfigured;\n }\n async getPeerShardInfo(peerId, peerStore) {\n const peer = await peerStore.get(peerId);\n const shardInfoBytes = peer.metadata.get(\"shardInfo\");\n if (!shardInfoBytes)\n return undefined;\n return (0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.decodeRelayShard)(shardInfoBytes);\n }\n}\n//# sourceMappingURL=connection_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/connection_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filter/filter_rpc.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filter/filter_rpc.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterPushRpc: () => (/* binding */ FilterPushRpc),\n/* harmony export */ FilterSubscribeResponse: () => (/* binding */ FilterSubscribeResponse),\n/* harmony export */ FilterSubscribeRpc: () => (/* binding */ FilterSubscribeRpc)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/v4.js\");\n\n\n/**\n * FilterPushRPC represents a message conforming to the Waku FilterPush protocol.\n * Protocol documentation: https://rfc.vac.dev/spec/12/\n */\nclass FilterPushRpc {\n proto;\n constructor(proto) {\n this.proto = proto;\n }\n static decode(bytes) {\n const res = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.MessagePush.decode(bytes);\n return new FilterPushRpc(res);\n }\n encode() {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.MessagePush.encode(this.proto);\n }\n get wakuMessage() {\n return this.proto.wakuMessage;\n }\n /**\n * Get the pubsub topic from the FilterPushRpc object.\n * @returns string\n */\n get pubsubTopic() {\n return this.proto.pubsubTopic;\n }\n}\nclass FilterSubscribeRpc {\n proto;\n constructor(proto) {\n this.proto = proto;\n }\n static createSubscribeRequest(pubsubTopic, contentTopics) {\n return new FilterSubscribeRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n filterSubscribeType: _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.FilterSubscribeType.SUBSCRIBE,\n pubsubTopic,\n contentTopics\n });\n }\n static createUnsubscribeRequest(pubsubTopic, contentTopics) {\n return new FilterSubscribeRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n filterSubscribeType: _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.FilterSubscribeType.UNSUBSCRIBE,\n pubsubTopic,\n contentTopics\n });\n }\n static createUnsubscribeAllRequest(pubsubTopic) {\n return new FilterSubscribeRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n filterSubscribeType: _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.FilterSubscribeType.UNSUBSCRIBE_ALL,\n pubsubTopic,\n contentTopics: []\n });\n }\n static createSubscriberPingRequest() {\n return new FilterSubscribeRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n filterSubscribeType: _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.FilterSubscribeType.SUBSCRIBER_PING,\n pubsubTopic: \"\",\n contentTopics: []\n });\n }\n static decode(bytes) {\n const res = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.decode(bytes);\n return new FilterSubscribeRpc(res);\n }\n encode() {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.encode(this.proto);\n }\n get filterSubscribeType() {\n return this.proto.filterSubscribeType;\n }\n get requestId() {\n return this.proto.requestId;\n }\n get pubsubTopic() {\n return this.proto.pubsubTopic;\n }\n get contentTopics() {\n return this.proto.contentTopics;\n }\n}\nclass FilterSubscribeResponse {\n proto;\n constructor(proto) {\n this.proto = proto;\n }\n static decode(bytes) {\n const res = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeResponse.decode(bytes);\n return new FilterSubscribeResponse(res);\n }\n encode() {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeResponse.encode(this.proto);\n }\n get statusCode() {\n return this.proto.statusCode;\n }\n get statusDesc() {\n return this.proto.statusDesc;\n }\n get requestId() {\n return this.proto.requestId;\n }\n}\n//# sourceMappingURL=filter_rpc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filter/filter_rpc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filter/index.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filter/index.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterCodecs: () => (/* binding */ FilterCodecs),\n/* harmony export */ wakuFilter: () => (/* binding */ wakuFilter)\n/* harmony export */ });\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_message_hash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/message-hash */ \"./node_modules/@waku/sdk/node_modules/@waku/message-hash/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var _base_protocol_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../base_protocol.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/base_protocol.js\");\n/* harmony import */ var _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./filter_rpc.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filter/filter_rpc.js\");\n\n\n\n\n\n\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_2__.Logger(\"filter:v2\");\nconst FilterCodecs = {\n SUBSCRIBE: \"/vac/waku/filter-subscribe/2.0.0-beta1\",\n PUSH: \"/vac/waku/filter-push/2.0.0-beta1\"\n};\n/**\n * A subscription object refers to a subscription to a given pubsub topic.\n */\nclass Subscription {\n peers;\n pubsubTopic;\n newStream;\n receivedMessagesHashStr = [];\n subscriptionCallbacks;\n constructor(pubsubTopic, remotePeers, newStream) {\n this.peers = remotePeers;\n this.pubsubTopic = pubsubTopic;\n this.newStream = newStream;\n this.subscriptionCallbacks = new Map();\n }\n async subscribe(decoders, callback) {\n const decodersArray = Array.isArray(decoders) ? decoders : [decoders];\n // check that all decoders are configured for the same pubsub topic as this subscription\n decodersArray.forEach((decoder) => {\n if (decoder.pubsubTopic !== this.pubsubTopic) {\n throw new Error(`Pubsub topic not configured: decoder is configured for pubsub topic ${decoder.pubsubTopic} but this subscription is for pubsub topic ${this.pubsubTopic}. Please create a new Subscription for the different pubsub topic.`);\n }\n });\n const decodersGroupedByCT = (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.groupByContentTopic)(decodersArray);\n const contentTopics = Array.from(decodersGroupedByCT.keys());\n const promises = this.peers.map(async (peer) => {\n const stream = await this.newStream(peer);\n const request = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeRpc.createSubscribeRequest(this.pubsubTopic, contentTopics);\n try {\n const res = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_5__.pipe)([request.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(source));\n if (!res || !res.length) {\n throw Error(`No response received for request ${request.requestId}: ${res}`);\n }\n const { statusCode, requestId, statusDesc } = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeResponse.decode(res[0].slice());\n if (statusCode < 200 || statusCode >= 300) {\n throw new Error(`Filter subscribe request ${requestId} failed with status code ${statusCode}: ${statusDesc}`);\n }\n log.info(\"Subscribed to peer \", peer.id.toString(), \"for content topics\", contentTopics);\n }\n catch (e) {\n throw new Error(\"Error subscribing to peer: \" +\n peer.id.toString() +\n \" for content topics: \" +\n contentTopics +\n \": \" +\n e);\n }\n });\n const results = await Promise.allSettled(promises);\n this.handleErrors(results, \"subscribe\");\n // Save the callback functions by content topics so they\n // can easily be removed (reciprocally replaced) if `unsubscribe` (reciprocally `subscribe`)\n // is called for those content topics\n decodersGroupedByCT.forEach((decoders, contentTopic) => {\n // Cast the type because a given `subscriptionCallbacks` map may hold\n // Decoder that decode to different implementations of `IDecodedMessage`\n const subscriptionCallback = {\n decoders,\n callback\n };\n // The callback and decoder may override previous values, this is on\n // purpose as the user may call `subscribe` to refresh the subscription\n this.subscriptionCallbacks.set(contentTopic, subscriptionCallback);\n });\n }\n async unsubscribe(contentTopics) {\n const promises = this.peers.map(async (peer) => {\n const stream = await this.newStream(peer);\n const unsubscribeRequest = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeRpc.createUnsubscribeRequest(this.pubsubTopic, contentTopics);\n try {\n await (0,it_pipe__WEBPACK_IMPORTED_MODULE_5__.pipe)([unsubscribeRequest.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.encode, stream.sink);\n }\n catch (error) {\n throw new Error(\"Error unsubscribing: \" + error);\n }\n contentTopics.forEach((contentTopic) => {\n this.subscriptionCallbacks.delete(contentTopic);\n });\n });\n const results = await Promise.allSettled(promises);\n this.handleErrors(results, \"unsubscribe\");\n }\n async ping() {\n const promises = this.peers.map(async (peer) => {\n const stream = await this.newStream(peer);\n const request = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeRpc.createSubscriberPingRequest();\n try {\n const res = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_5__.pipe)([request.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(source));\n if (!res || !res.length) {\n throw Error(`No response received for request ${request.requestId}: ${res}`);\n }\n const { statusCode, requestId, statusDesc } = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeResponse.decode(res[0].slice());\n if (statusCode < 200 || statusCode >= 300) {\n throw new Error(`Filter ping request ${requestId} failed with status code ${statusCode}: ${statusDesc}`);\n }\n log.info(`Ping successful for peer ${peer.id.toString()}`);\n }\n catch (error) {\n log.error(\"Error pinging: \", error);\n throw error; // Rethrow the actual error instead of wrapping it\n }\n });\n const results = await Promise.allSettled(promises);\n this.handleErrors(results, \"ping\");\n }\n async unsubscribeAll() {\n const promises = this.peers.map(async (peer) => {\n const stream = await this.newStream(peer);\n const request = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeRpc.createUnsubscribeAllRequest(this.pubsubTopic);\n try {\n const res = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_5__.pipe)([request.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(source));\n if (!res || !res.length) {\n throw Error(`No response received for request ${request.requestId}: ${res}`);\n }\n const { statusCode, requestId, statusDesc } = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeResponse.decode(res[0].slice());\n if (statusCode < 200 || statusCode >= 300) {\n throw new Error(`Filter unsubscribe all request ${requestId} failed with status code ${statusCode}: ${statusDesc}`);\n }\n this.subscriptionCallbacks.clear();\n log.info(`Unsubscribed from all content topics for pubsub topic ${this.pubsubTopic}`);\n }\n catch (error) {\n throw new Error(\"Error unsubscribing from all content topics: \" + error);\n }\n });\n const results = await Promise.allSettled(promises);\n this.handleErrors(results, \"unsubscribeAll\");\n }\n async processMessage(message) {\n const hashedMessageStr = (0,_waku_message_hash__WEBPACK_IMPORTED_MODULE_1__.messageHashStr)(this.pubsubTopic, message);\n if (this.receivedMessagesHashStr.includes(hashedMessageStr)) {\n log.info(\"Message already received, skipping\");\n return;\n }\n this.receivedMessagesHashStr.push(hashedMessageStr);\n const { contentTopic } = message;\n const subscriptionCallback = this.subscriptionCallbacks.get(contentTopic);\n if (!subscriptionCallback) {\n log.error(\"No subscription callback available for \", contentTopic);\n return;\n }\n log.info(\"Processing message with content topic \", contentTopic, \" on pubsub topic \", this.pubsubTopic);\n await pushMessage(subscriptionCallback, this.pubsubTopic, message);\n }\n // Filter out only the rejected promises and extract & handle their reasons\n handleErrors(results, type) {\n const errors = results\n .filter((result) => result.status === \"rejected\")\n .map((rejectedResult) => rejectedResult.reason);\n if (errors.length === this.peers.length) {\n const errorCounts = new Map();\n // TODO: streamline error logging with https://github.com/orgs/waku-org/projects/2/views/1?pane=issue&itemId=42849952\n errors.forEach((error) => {\n const message = error instanceof Error ? error.message : String(error);\n errorCounts.set(message, (errorCounts.get(message) || 0) + 1);\n });\n const uniqueErrorMessages = Array.from(errorCounts, ([message, count]) => `${message} (occurred ${count} times)`).join(\", \");\n throw new Error(`Error ${type} all peers: ${uniqueErrorMessages}`);\n }\n else if (errors.length > 0) {\n // TODO: handle renewing faulty peers with new peers (https://github.com/waku-org/js-waku/issues/1463)\n log.warn(`Some ${type} failed. These will be refreshed with new peers`, errors);\n }\n else {\n log.info(`${type} successful for all peers`);\n }\n }\n}\nconst DEFAULT_NUM_PEERS = 3;\nclass Filter extends _base_protocol_js__WEBPACK_IMPORTED_MODULE_6__.BaseProtocol {\n activeSubscriptions = new Map();\n getActiveSubscription(pubsubTopic) {\n return this.activeSubscriptions.get(pubsubTopic);\n }\n setActiveSubscription(pubsubTopic, subscription) {\n this.activeSubscriptions.set(pubsubTopic, subscription);\n return subscription;\n }\n //TODO: Remove when FilterCore and FilterSDK are introduced\n numPeersToUse;\n constructor(libp2p, options) {\n super(FilterCodecs.SUBSCRIBE, libp2p.components, log, options.pubsubTopics, options);\n this.numPeersToUse = options?.numPeersToUse ?? DEFAULT_NUM_PEERS;\n libp2p.handle(FilterCodecs.PUSH, this.onRequest.bind(this)).catch((e) => {\n log.error(\"Failed to register \", FilterCodecs.PUSH, e);\n });\n this.activeSubscriptions = new Map();\n }\n /**\n * Creates a new subscription to the given pubsub topic.\n * The subscription is made to multiple peers for decentralization.\n * @param pubsubTopicShardInfo The pubsub topic to subscribe to.\n * @returns The subscription object.\n */\n async createSubscription(pubsubTopicShardInfo = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DefaultPubsubTopic) {\n const pubsubTopic = typeof pubsubTopicShardInfo == \"string\"\n ? pubsubTopicShardInfo\n : (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.singleShardInfoToPubsubTopic)(pubsubTopicShardInfo);\n (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.ensurePubsubTopicIsConfigured)(pubsubTopic, this.pubsubTopics);\n const peers = await this.getPeers({\n maxBootstrapPeers: 1,\n numPeers: this.numPeersToUse\n });\n if (peers.length === 0) {\n throw new Error(\"No peer found to initiate subscription.\");\n }\n log.info(`Creating filter subscription with ${peers.length} peers: `, peers.map((peer) => peer.id.toString()));\n const subscription = this.getActiveSubscription(pubsubTopic) ??\n this.setActiveSubscription(pubsubTopic, new Subscription(pubsubTopic, peers, this.getStream.bind(this)));\n return subscription;\n }\n toSubscriptionIterator(decoders) {\n return (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.toAsyncIterator)(this, decoders);\n }\n /**\n * This method is used to satisfy the `IReceiver` interface.\n *\n * @hidden\n *\n * @param decoders The decoders to use for the subscription.\n * @param callback The callback function to use for the subscription.\n * @param opts Optional protocol options for the subscription.\n *\n * @returns A Promise that resolves to a function that unsubscribes from the subscription.\n *\n * @remarks\n * This method should not be used directly.\n * Instead, use `createSubscription` to create a new subscription.\n */\n async subscribe(decoders, callback) {\n const pubsubTopics = this.getPubsubTopics(decoders);\n if (pubsubTopics.length === 0) {\n throw Error(\"Failed to subscribe: no pubsubTopic found on decoders provided.\");\n }\n if (pubsubTopics.length > 1) {\n throw Error(\"Failed to subscribe: all decoders should have the same pubsub topic. Use createSubscription to be more agile.\");\n }\n const subscription = await this.createSubscription(pubsubTopics[0]);\n await subscription.subscribe(decoders, callback);\n const contentTopics = Array.from((0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.groupByContentTopic)(Array.isArray(decoders) ? decoders : [decoders]).keys());\n return async () => {\n await subscription.unsubscribe(contentTopics);\n };\n }\n onRequest(streamData) {\n const { connection, stream } = streamData;\n const { remotePeer } = connection;\n log.info(`Received message from ${remotePeer.toString()}`);\n try {\n (0,it_pipe__WEBPACK_IMPORTED_MODULE_5__.pipe)(stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.decode, async (source) => {\n for await (const bytes of source) {\n const response = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterPushRpc.decode(bytes.slice());\n const { pubsubTopic, wakuMessage } = response;\n if (!wakuMessage) {\n log.error(\"Received empty message\");\n return;\n }\n if (!pubsubTopic) {\n log.error(\"Pubsub topic missing from push message\");\n return;\n }\n const subscription = this.getActiveSubscription(pubsubTopic);\n if (!subscription) {\n log.error(`No subscription locally registered for topic ${pubsubTopic}`);\n return;\n }\n await subscription.processMessage(wakuMessage);\n }\n }).then(() => {\n log.info(\"Receiving pipe closed.\");\n }, (e) => {\n log.error(\"Error with receiving pipe\", e);\n });\n }\n catch (e) {\n log.error(\"Error decoding message\", e);\n }\n }\n getPubsubTopics(decoders) {\n if (!Array.isArray(decoders)) {\n return [decoders.pubsubTopic];\n }\n if (decoders.length === 0) {\n return [];\n }\n const pubsubTopics = new Set(decoders.map((d) => d.pubsubTopic));\n return [...pubsubTopics];\n }\n}\nfunction wakuFilter(init = { pubsubTopics: [] }) {\n return (libp2p) => new Filter(libp2p, init);\n}\nasync function pushMessage(subscriptionCallback, pubsubTopic, message) {\n const { decoders, callback } = subscriptionCallback;\n const { contentTopic } = message;\n if (!contentTopic) {\n log.warn(\"Message has no content topic, skipping\");\n return;\n }\n try {\n const decodePromises = decoders.map((dec) => dec\n .fromProtoObj(pubsubTopic, message)\n .then((decoded) => decoded || Promise.reject(\"Decoding failed\")));\n const decodedMessage = await Promise.any(decodePromises);\n await callback(decodedMessage);\n }\n catch (e) {\n log.error(\"Error decoding message\", e);\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filter/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filterPeers.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filterPeers.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ filterPeersByDiscovery: () => (/* binding */ filterPeersByDiscovery)\n/* harmony export */ });\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n\n/**\n * Retrieves a list of peers based on the specified criteria:\n * 1. If numPeers is 0, return all peers\n * 2. Bootstrap peers are prioritized\n * 3. Non-bootstrap peers are randomly selected to fill up to numPeers\n *\n * @param peers - The list of peers to filter from.\n * @param numPeers - The total number of peers to retrieve. If 0, all peers are returned, irrespective of `maxBootstrapPeers`.\n * @param maxBootstrapPeers - The maximum number of bootstrap peers to retrieve.\n * @returns An array of peers based on the specified criteria.\n */\nfunction filterPeersByDiscovery(peers, numPeers, maxBootstrapPeers) {\n // Collect the bootstrap peers up to the specified maximum\n let bootstrapPeers = peers\n .filter((peer) => peer.tags.has(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP))\n .slice(0, maxBootstrapPeers);\n // If numPeers is less than the number of bootstrap peers, adjust the bootstrapPeers array\n if (numPeers > 0 && numPeers < bootstrapPeers.length) {\n bootstrapPeers = bootstrapPeers.slice(0, numPeers);\n }\n // Collect non-bootstrap peers\n const nonBootstrapPeers = peers.filter((peer) => !peer.tags.has(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Tags.BOOTSTRAP));\n // If numPeers is 0, return all peers\n if (numPeers === 0) {\n return [...bootstrapPeers, ...nonBootstrapPeers];\n }\n // Initialize the list of selected peers with the bootstrap peers\n const selectedPeers = [...bootstrapPeers];\n // Fill up to numPeers with remaining random peers if needed\n while (selectedPeers.length < numPeers && nonBootstrapPeers.length > 0) {\n const randomIndex = Math.floor(Math.random() * nonBootstrapPeers.length);\n const randomPeer = nonBootstrapPeers.splice(randomIndex, 1)[0];\n selectedPeers.push(randomPeer);\n }\n return selectedPeers;\n}\n//# sourceMappingURL=filterPeers.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/filterPeers.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/keep_alive_manager.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/keep_alive_manager.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ KeepAliveManager: () => (/* binding */ KeepAliveManager),\n/* harmony export */ RelayPingContentTopic: () => (/* binding */ RelayPingContentTopic)\n/* harmony export */ });\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _message_version_0_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./message/version_0.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/message/version_0.js\");\n\n\n\nconst RelayPingContentTopic = \"/relay-ping/1/ping/null\";\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_0__.Logger(\"keep-alive\");\nclass KeepAliveManager {\n pingKeepAliveTimers;\n relayKeepAliveTimers;\n options;\n relay;\n constructor(options, relay) {\n this.pingKeepAliveTimers = new Map();\n this.relayKeepAliveTimers = new Map();\n this.options = options;\n this.relay = relay;\n }\n start(peerId, libp2pPing, peerStore) {\n // Just in case a timer already exists for this peer\n this.stop(peerId);\n const { pingKeepAlive: pingPeriodSecs, relayKeepAlive: relayPeriodSecs } = this.options;\n const peerIdStr = peerId.toString();\n // Ping the peer every pingPeriodSecs seconds\n // if pingPeriodSecs is 0, don't ping the peer\n if (pingPeriodSecs !== 0) {\n const interval = setInterval(() => {\n void (async () => {\n let ping;\n try {\n // ping the peer for keep alive\n // also update the peer store with the latency\n try {\n ping = await libp2pPing.ping(peerId);\n log.info(`Ping succeeded (${peerIdStr})`, ping);\n }\n catch (error) {\n log.error(`Ping failed for peer (${peerIdStr}).\n Next ping will be attempted in ${pingPeriodSecs} seconds.\n `);\n return;\n }\n try {\n await peerStore.patch(peerId, {\n metadata: {\n ping: (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(ping.toString())\n }\n });\n }\n catch (e) {\n log.error(\"Failed to update ping\", e);\n }\n }\n catch (e) {\n log.error(`Ping failed (${peerIdStr})`, e);\n }\n })();\n }, pingPeriodSecs * 1000);\n this.pingKeepAliveTimers.set(peerIdStr, interval);\n }\n const relay = this.relay;\n if (relay && relayPeriodSecs !== 0) {\n const intervals = this.scheduleRelayPings(relay, relayPeriodSecs, peerId.toString());\n this.relayKeepAliveTimers.set(peerId, intervals);\n }\n }\n stop(peerId) {\n const peerIdStr = peerId.toString();\n if (this.pingKeepAliveTimers.has(peerIdStr)) {\n clearInterval(this.pingKeepAliveTimers.get(peerIdStr));\n this.pingKeepAliveTimers.delete(peerIdStr);\n }\n if (this.relayKeepAliveTimers.has(peerId)) {\n this.relayKeepAliveTimers.get(peerId)?.map(clearInterval);\n this.relayKeepAliveTimers.delete(peerId);\n }\n }\n stopAll() {\n for (const timer of [\n ...Object.values(this.pingKeepAliveTimers),\n ...Object.values(this.relayKeepAliveTimers)\n ]) {\n clearInterval(timer);\n }\n this.pingKeepAliveTimers.clear();\n this.relayKeepAliveTimers.clear();\n }\n connectionsExist() {\n return (this.pingKeepAliveTimers.size > 0 || this.relayKeepAliveTimers.size > 0);\n }\n scheduleRelayPings(relay, relayPeriodSecs, peerIdStr) {\n // send a ping message to each PubsubTopic the peer is part of\n const intervals = [];\n for (const topic of relay.pubsubTopics) {\n const meshPeers = relay.getMeshPeers(topic);\n if (!meshPeers.includes(peerIdStr))\n continue;\n const encoder = (0,_message_version_0_js__WEBPACK_IMPORTED_MODULE_2__.createEncoder)({\n pubsubTopicShardInfo: (0,_waku_utils__WEBPACK_IMPORTED_MODULE_0__.pubsubTopicToSingleShardInfo)(topic),\n contentTopic: RelayPingContentTopic,\n ephemeral: true\n });\n const interval = setInterval(() => {\n log.info(\"Sending Waku Relay ping message\");\n relay\n .send(encoder, { payload: new Uint8Array([1]) })\n .catch((e) => log.error(\"Failed to send relay ping\", e));\n }, relayPeriodSecs * 1000);\n intervals.push(interval);\n }\n return intervals;\n }\n}\n//# sourceMappingURL=keep_alive_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/keep_alive_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/light_push/index.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/light_push/index.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LightPushCodec: () => (/* binding */ LightPushCodec),\n/* harmony export */ LightPushCore: () => (/* binding */ LightPushCore),\n/* harmony export */ PushResponse: () => (/* reexport safe */ _waku_proto__WEBPACK_IMPORTED_MODULE_1__.PushResponse)\n/* harmony export */ });\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _base_protocol_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../base_protocol.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/base_protocol.js\");\n/* harmony import */ var _push_rpc_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./push_rpc.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/light_push/push_rpc.js\");\n\n\n\n\n\n\n\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_2__.Logger(\"light-push\");\nconst LightPushCodec = \"/vac/waku/lightpush/2.0.0-beta1\";\n\n/**\n * Implements the [Waku v2 Light Push protocol](https://rfc.vac.dev/spec/19/).\n */\nclass LightPushCore extends _base_protocol_js__WEBPACK_IMPORTED_MODULE_7__.BaseProtocol {\n constructor(libp2p, options) {\n super(LightPushCodec, libp2p.components, log, options.pubsubTopics, options);\n }\n async preparePushMessage(encoder, message) {\n try {\n if (!message.payload || message.payload.length === 0) {\n log.error(\"Failed to send waku light push: payload is empty\");\n return { query: null, error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.EMPTY_PAYLOAD };\n }\n if (!(await (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.isMessageSizeUnderCap)(encoder, message))) {\n log.error(\"Failed to send waku light push: message is bigger than 1MB\");\n return { query: null, error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.SIZE_TOO_BIG };\n }\n const protoMessage = await encoder.toProtoObj(message);\n if (!protoMessage) {\n log.error(\"Failed to encode to protoMessage, aborting push\");\n return {\n query: null,\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.ENCODE_FAILED\n };\n }\n const query = _push_rpc_js__WEBPACK_IMPORTED_MODULE_8__.PushRpc.createRequest(protoMessage, encoder.pubsubTopic);\n return { query, error: null };\n }\n catch (error) {\n log.error(\"Failed to prepare push message\", error);\n return {\n query: null,\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.GENERIC_FAIL\n };\n }\n }\n async send(encoder, message, peer) {\n const { query, error: preparationError } = await this.preparePushMessage(encoder, message);\n if (preparationError || !query) {\n return {\n success: null,\n failure: {\n error: preparationError,\n peerId: peer.id\n }\n };\n }\n let stream;\n try {\n stream = await this.getStream(peer);\n }\n catch (err) {\n log.error(`Failed to get a stream for remote peer${peer.id.toString()}`, err);\n return {\n success: null,\n failure: {\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.REMOTE_PEER_FAULT,\n peerId: peer.id\n }\n };\n }\n let res;\n try {\n res = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_5__.pipe)([query.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(source));\n }\n catch (err) {\n log.error(\"Failed to send waku light push request\", err);\n return {\n success: null,\n failure: {\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.GENERIC_FAIL,\n peerId: peer.id\n }\n };\n }\n const bytes = new uint8arraylist__WEBPACK_IMPORTED_MODULE_6__.Uint8ArrayList();\n res.forEach((chunk) => {\n bytes.append(chunk);\n });\n let response;\n try {\n response = _push_rpc_js__WEBPACK_IMPORTED_MODULE_8__.PushRpc.decode(bytes).response;\n }\n catch (err) {\n log.error(\"Failed to decode push reply\", err);\n return {\n success: null,\n failure: {\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.DECODE_FAILED,\n peerId: peer.id\n }\n };\n }\n if (!response) {\n log.error(\"Remote peer fault: No response in PushRPC\");\n return {\n success: null,\n failure: {\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.REMOTE_PEER_FAULT,\n peerId: peer.id\n }\n };\n }\n if (!response.isSuccess) {\n log.error(\"Remote peer rejected the message: \", response.info);\n return {\n success: null,\n failure: {\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.REMOTE_PEER_REJECTED,\n peerId: peer.id\n }\n };\n }\n return { success: peer.id, failure: null };\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/light_push/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/light_push/push_rpc.js":
|
||
/*!****************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/light_push/push_rpc.js ***!
|
||
\****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushRpc: () => (/* binding */ PushRpc)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/v4.js\");\n\n\nclass PushRpc {\n proto;\n constructor(proto) {\n this.proto = proto;\n }\n static createRequest(message, pubsubTopic) {\n return new PushRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n request: {\n message: message,\n pubsubTopic: pubsubTopic\n },\n response: undefined\n });\n }\n static decode(bytes) {\n const res = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_lightpush.PushRpc.decode(bytes);\n return new PushRpc(res);\n }\n encode() {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_lightpush.PushRpc.encode(this.proto);\n }\n get query() {\n return this.proto.request;\n }\n get response() {\n return this.proto.response;\n }\n}\n//# sourceMappingURL=push_rpc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/light_push/push_rpc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/message/index.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/message/index.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version_0: () => (/* reexport module object */ _version_0_js__WEBPACK_IMPORTED_MODULE_0__)\n/* harmony export */ });\n/* harmony import */ var _version_0_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./version_0.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/message/version_0.js\");\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/message/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/message/version_0.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/message/version_0.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DecodedMessage: () => (/* binding */ DecodedMessage),\n/* harmony export */ Decoder: () => (/* binding */ Decoder),\n/* harmony export */ Encoder: () => (/* binding */ Encoder),\n/* harmony export */ Version: () => (/* binding */ Version),\n/* harmony export */ createDecoder: () => (/* binding */ createDecoder),\n/* harmony export */ createEncoder: () => (/* binding */ createEncoder),\n/* harmony export */ proto: () => (/* reexport safe */ _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_message)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_1__.Logger(\"message:version-0\");\nconst OneMillion = BigInt(1_000_000);\nconst Version = 0;\n\nclass DecodedMessage {\n pubsubTopic;\n proto;\n constructor(pubsubTopic, proto) {\n this.pubsubTopic = pubsubTopic;\n this.proto = proto;\n }\n get ephemeral() {\n return Boolean(this.proto.ephemeral);\n }\n get payload() {\n return this.proto.payload;\n }\n get contentTopic() {\n return this.proto.contentTopic;\n }\n get _rawTimestamp() {\n return this.proto.timestamp;\n }\n get timestamp() {\n // In the case we receive a value that is bigger than JS's max number,\n // we catch the error and return undefined.\n try {\n if (this.proto.timestamp) {\n // nanoseconds 10^-9 to milliseconds 10^-3\n const timestamp = this.proto.timestamp / OneMillion;\n return new Date(Number(timestamp));\n }\n return;\n }\n catch (e) {\n return;\n }\n }\n get meta() {\n return this.proto.meta;\n }\n get version() {\n // https://rfc.vac.dev/spec/14/\n // > If omitted, the value SHOULD be interpreted as version 0.\n return this.proto.version ?? 0;\n }\n get rateLimitProof() {\n return this.proto.rateLimitProof;\n }\n}\nclass Encoder {\n contentTopic;\n ephemeral;\n pubsubTopic;\n metaSetter;\n constructor(contentTopic, ephemeral = false, pubsubTopic, metaSetter) {\n this.contentTopic = contentTopic;\n this.ephemeral = ephemeral;\n this.pubsubTopic = pubsubTopic;\n this.metaSetter = metaSetter;\n if (!contentTopic || contentTopic === \"\") {\n throw new Error(\"Content topic must be specified\");\n }\n }\n async toWire(message) {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_message.WakuMessage.encode(await this.toProtoObj(message));\n }\n async toProtoObj(message) {\n const timestamp = message.timestamp ?? new Date();\n const protoMessage = {\n payload: message.payload,\n version: Version,\n contentTopic: this.contentTopic,\n timestamp: BigInt(timestamp.valueOf()) * OneMillion,\n meta: undefined,\n rateLimitProof: message.rateLimitProof,\n ephemeral: this.ephemeral\n };\n if (this.metaSetter) {\n const meta = this.metaSetter(protoMessage);\n return { ...protoMessage, meta };\n }\n return protoMessage;\n }\n}\n/**\n * Creates an encoder that encode messages without Waku level encryption or signature.\n *\n * An encoder is used to encode messages in the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)\n * format to be sent over the Waku network. The resulting encoder can then be\n * pass to { @link @waku/interfaces!ISender.send } to automatically encode outgoing\n * messages.\n */\nfunction createEncoder({ pubsubTopic, pubsubTopicShardInfo, contentTopic, ephemeral, metaSetter }) {\n return new Encoder(contentTopic, ephemeral, (0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.determinePubsubTopic)(contentTopic, pubsubTopic ?? pubsubTopicShardInfo), metaSetter);\n}\nclass Decoder {\n pubsubTopic;\n contentTopic;\n constructor(pubsubTopic, contentTopic) {\n this.pubsubTopic = pubsubTopic;\n this.contentTopic = contentTopic;\n if (!contentTopic || contentTopic === \"\") {\n throw new Error(\"Content topic must be specified\");\n }\n }\n fromWireToProtoObj(bytes) {\n const protoMessage = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_message.WakuMessage.decode(bytes);\n return Promise.resolve({\n payload: protoMessage.payload,\n contentTopic: protoMessage.contentTopic,\n version: protoMessage.version ?? undefined,\n timestamp: protoMessage.timestamp ?? undefined,\n meta: protoMessage.meta ?? undefined,\n rateLimitProof: protoMessage.rateLimitProof ?? undefined,\n ephemeral: protoMessage.ephemeral ?? false\n });\n }\n async fromProtoObj(pubsubTopic, proto) {\n // https://rfc.vac.dev/spec/14/\n // > If omitted, the value SHOULD be interpreted as version 0.\n if (proto.version ?? 0 !== Version) {\n log.error(\"Failed to decode due to incorrect version, expected:\", Version, \", actual:\", proto.version);\n return Promise.resolve(undefined);\n }\n return new DecodedMessage(pubsubTopic, proto);\n }\n}\n/**\n * Creates a decoder that decode messages without Waku level encryption.\n *\n * A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)\n * format when received from the Waku network. The resulting decoder can then be\n * pass to { @link @waku/interfaces!IReceiver.subscribe } to automatically decode incoming\n * messages.\n *\n * @param contentTopic The resulting decoder will only decode messages with this content topic.\n */\nfunction createDecoder(contentTopic, pubsubTopicShardInfo) {\n return new Decoder((0,_waku_utils__WEBPACK_IMPORTED_MODULE_1__.determinePubsubTopic)(contentTopic, pubsubTopicShardInfo), contentTopic);\n}\n//# sourceMappingURL=version_0.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/message/version_0.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/metadata/index.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/metadata/index.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MetadataCodec: () => (/* binding */ MetadataCodec),\n/* harmony export */ wakuMetadata: () => (/* binding */ wakuMetadata)\n/* harmony export */ });\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _base_protocol_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../base_protocol.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/base_protocol.js\");\n\n\n\n\n\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_2__.Logger(\"metadata\");\nconst MetadataCodec = \"/vac/waku/metadata/1.0.0\";\nclass Metadata extends _base_protocol_js__WEBPACK_IMPORTED_MODULE_7__.BaseProtocol {\n shardInfo;\n libp2pComponents;\n handshakesConfirmed = new Map();\n constructor(shardInfo, libp2p) {\n super(MetadataCodec, libp2p.components, log, (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.shardInfoToPubsubTopics)(shardInfo));\n this.shardInfo = shardInfo;\n this.libp2pComponents = libp2p;\n void libp2p.registrar.handle(MetadataCodec, (streamData) => {\n void this.onRequest(streamData);\n });\n }\n /**\n * Handle an incoming metadata request\n */\n async onRequest(streamData) {\n try {\n const { stream, connection } = streamData;\n const encodedShardInfo = _waku_proto__WEBPACK_IMPORTED_MODULE_1__.proto_metadata.WakuMetadataResponse.encode(this.shardInfo);\n const encodedResponse = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_5__.pipe)([encodedShardInfo], it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(source));\n const { error, shardInfo } = this.decodeMetadataResponse(encodedResponse);\n if (error) {\n return;\n }\n await this.savePeerShardInfo(connection.remotePeer, shardInfo);\n }\n catch (error) {\n log.error(\"Error handling metadata request\", error);\n }\n }\n /**\n * Make a metadata query to a peer\n */\n async query(peerId) {\n const request = _waku_proto__WEBPACK_IMPORTED_MODULE_1__.proto_metadata.WakuMetadataRequest.encode(this.shardInfo);\n const peer = await this.peerStore.get(peerId);\n if (!peer) {\n return {\n shardInfo: null,\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.NO_PEER_AVAILABLE\n };\n }\n const stream = await this.getStream(peer);\n const encodedResponse = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_5__.pipe)([request], it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(source));\n const { error, shardInfo } = this.decodeMetadataResponse(encodedResponse);\n if (error) {\n return {\n shardInfo: null,\n error\n };\n }\n await this.savePeerShardInfo(peerId, shardInfo);\n return {\n shardInfo,\n error: null\n };\n }\n async confirmOrAttemptHandshake(peerId) {\n const shardInfo = this.handshakesConfirmed.get(peerId.toString());\n if (shardInfo) {\n return {\n shardInfo,\n error: null\n };\n }\n return await this.query(peerId);\n }\n decodeMetadataResponse(encodedResponse) {\n const bytes = new uint8arraylist__WEBPACK_IMPORTED_MODULE_6__.Uint8ArrayList();\n encodedResponse.forEach((chunk) => {\n bytes.append(chunk);\n });\n const response = _waku_proto__WEBPACK_IMPORTED_MODULE_1__.proto_metadata.WakuMetadataResponse.decode(bytes);\n if (!response) {\n log.error(\"Error decoding metadata response\");\n return {\n shardInfo: null,\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.ProtocolError.DECODE_FAILED\n };\n }\n return {\n shardInfo: response,\n error: null\n };\n }\n async savePeerShardInfo(peerId, shardInfo) {\n // add or update the shardInfo to peer store\n await this.libp2pComponents.peerStore.merge(peerId, {\n metadata: {\n shardInfo: (0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.encodeRelayShard)(shardInfo)\n }\n });\n this.handshakesConfirmed.set(peerId.toString(), shardInfo);\n }\n}\nfunction wakuMetadata(shardInfo) {\n return (components) => new Metadata(shardInfo, components);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/metadata/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/store/history_rpc.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/store/history_rpc.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HistoryRpc: () => (/* binding */ HistoryRpc),\n/* harmony export */ PageDirection: () => (/* binding */ PageDirection)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/v4.js\");\n\n\nconst OneMillion = BigInt(1_000_000);\nvar PageDirection;\n(function (PageDirection) {\n PageDirection[\"BACKWARD\"] = \"backward\";\n PageDirection[\"FORWARD\"] = \"forward\";\n})(PageDirection || (PageDirection = {}));\nclass HistoryRpc {\n proto;\n constructor(proto) {\n this.proto = proto;\n }\n get query() {\n return this.proto.query;\n }\n get response() {\n return this.proto.response;\n }\n /**\n * Create History Query.\n */\n static createQuery(params) {\n const contentFilters = params.contentTopics.map((contentTopic) => {\n return { contentTopic };\n });\n const direction = directionToProto(params.pageDirection);\n const pagingInfo = {\n pageSize: BigInt(params.pageSize),\n cursor: params.cursor,\n direction\n };\n let startTime, endTime;\n if (params.startTime) {\n // milliseconds 10^-3 to nanoseconds 10^-9\n startTime = BigInt(params.startTime.valueOf()) * OneMillion;\n }\n if (params.endTime) {\n // milliseconds 10^-3 to nanoseconds 10^-9\n endTime = BigInt(params.endTime.valueOf()) * OneMillion;\n }\n return new HistoryRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n query: {\n pubsubTopic: params.pubsubTopic,\n contentFilters,\n pagingInfo,\n startTime,\n endTime\n },\n response: undefined\n });\n }\n decode(bytes) {\n const res = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_store.HistoryRpc.decode(bytes);\n return new HistoryRpc(res);\n }\n encode() {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_store.HistoryRpc.encode(this.proto);\n }\n}\nfunction directionToProto(pageDirection) {\n switch (pageDirection) {\n case PageDirection.BACKWARD:\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_store.PagingInfo.Direction.BACKWARD;\n case PageDirection.FORWARD:\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_store.PagingInfo.Direction.FORWARD;\n default:\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_store.PagingInfo.Direction.BACKWARD;\n }\n}\n//# sourceMappingURL=history_rpc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/store/history_rpc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/store/index.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/store/index.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PageDirection: () => (/* reexport safe */ _history_rpc_js__WEBPACK_IMPORTED_MODULE_8__.PageDirection),\n/* harmony export */ StoreCodec: () => (/* binding */ StoreCodec),\n/* harmony export */ StoreCore: () => (/* binding */ StoreCore)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _base_protocol_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../base_protocol.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/base_protocol.js\");\n/* harmony import */ var _to_proto_message_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../to_proto_message.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/to_proto_message.js\");\n/* harmony import */ var _history_rpc_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./history_rpc.js */ \"./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/store/history_rpc.js\");\n\n\n\n\n\n\n\n\n\nvar HistoryError = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_store.HistoryResponse.HistoryError;\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_1__.Logger(\"store\");\nconst StoreCodec = \"/vac/waku/store/2.0.0-beta4\";\n\n/**\n * Implements the [Waku v2 Store protocol](https://rfc.vac.dev/spec/13/).\n *\n * The Waku Store protocol can be used to retrieved historical messages.\n */\nclass StoreCore extends _base_protocol_js__WEBPACK_IMPORTED_MODULE_6__.BaseProtocol {\n constructor(libp2p, options) {\n super(StoreCodec, libp2p.components, log, options.pubsubTopics, options);\n }\n async *queryPerPage(queryOpts, decoders, peer) {\n if (queryOpts.contentTopics.toString() !==\n Array.from(decoders.keys()).toString()) {\n throw new Error(\"Internal error, the decoders should match the query's content topics\");\n }\n let currentCursor = queryOpts.cursor;\n while (true) {\n queryOpts.cursor = currentCursor;\n const historyRpcQuery = _history_rpc_js__WEBPACK_IMPORTED_MODULE_8__.HistoryRpc.createQuery(queryOpts);\n const stream = await this.getStream(peer);\n const res = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_4__.pipe)([historyRpcQuery.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(source));\n const bytes = new uint8arraylist__WEBPACK_IMPORTED_MODULE_5__.Uint8ArrayList();\n res.forEach((chunk) => {\n bytes.append(chunk);\n });\n const reply = historyRpcQuery.decode(bytes);\n if (!reply.response) {\n log.warn(\"Stopping pagination due to store `response` field missing\");\n break;\n }\n const response = reply.response;\n if (response.error && response.error !== HistoryError.NONE) {\n throw \"History response contains an Error: \" + response.error;\n }\n if (!response.messages || !response.messages.length) {\n log.warn(\"Stopping pagination due to store `response.messages` field missing or empty\");\n break;\n }\n log.error(`${response.messages.length} messages retrieved from store`);\n yield response.messages.map((protoMsg) => {\n const contentTopic = protoMsg.contentTopic;\n if (typeof contentTopic !== \"undefined\") {\n const decoder = decoders.get(contentTopic);\n if (decoder) {\n return decoder.fromProtoObj(queryOpts.pubsubTopic, (0,_to_proto_message_js__WEBPACK_IMPORTED_MODULE_7__.toProtoMessage)(protoMsg));\n }\n }\n return Promise.resolve(undefined);\n });\n const nextCursor = response.pagingInfo?.cursor;\n if (typeof nextCursor === \"undefined\") {\n // If the server does not return cursor then there is an issue,\n // Need to abort, or we end up in an infinite loop\n log.warn(\"Stopping pagination due to `response.pagingInfo.cursor` missing from store response\");\n break;\n }\n currentCursor = nextCursor;\n const responsePageSize = response.pagingInfo?.pageSize;\n const queryPageSize = historyRpcQuery.query?.pagingInfo?.pageSize;\n if (\n // Response page size smaller than query, meaning this is the last page\n responsePageSize &&\n queryPageSize &&\n responsePageSize < queryPageSize) {\n break;\n }\n }\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/store/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/stream_manager.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/stream_manager.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ StreamManager: () => (/* binding */ StreamManager)\n/* harmony export */ });\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/libp2p */ \"./node_modules/@waku/utils/dist/libp2p/index.js\");\n\n\nclass StreamManager {\n multicodec;\n getConnections;\n addEventListener;\n streamPool;\n log;\n constructor(multicodec, getConnections, addEventListener) {\n this.multicodec = multicodec;\n this.getConnections = getConnections;\n this.addEventListener = addEventListener;\n this.log = new _waku_utils__WEBPACK_IMPORTED_MODULE_0__.Logger(`stream-manager:${multicodec}`);\n this.addEventListener(\"peer:update\", this.handlePeerUpdateStreamPool.bind(this));\n this.getStream = this.getStream.bind(this);\n this.streamPool = new Map();\n }\n async getStream(peer) {\n const peerIdStr = peer.id.toString();\n const streamPromise = this.streamPool.get(peerIdStr);\n if (!streamPromise) {\n return this.newStream(peer); // fallback by creating a new stream on the spot\n }\n // We have the stream, let's remove it from the map\n this.streamPool.delete(peerIdStr);\n this.prepareNewStream(peer);\n const stream = await streamPromise;\n if (!stream || stream.status === \"closed\") {\n return this.newStream(peer); // fallback by creating a new stream on the spot\n }\n return stream;\n }\n async newStream(peer) {\n const connections = this.getConnections(peer.id);\n const connection = (0,_waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_1__.selectConnection)(connections);\n if (!connection) {\n throw new Error(\"Failed to get a connection to the peer\");\n }\n return connection.newStream(this.multicodec);\n }\n prepareNewStream(peer) {\n const streamPromise = this.newStream(peer).catch(() => {\n // No error thrown as this call is not triggered by the user\n this.log.error(`Failed to prepare a new stream for ${peer.id.toString()}`);\n });\n this.streamPool.set(peer.id.toString(), streamPromise);\n }\n handlePeerUpdateStreamPool = (evt) => {\n const peer = evt.detail.peer;\n if (peer.protocols.includes(this.multicodec)) {\n this.log.info(`Preemptively opening a stream to ${peer.id.toString()}`);\n this.prepareNewStream(peer);\n }\n };\n}\n//# sourceMappingURL=stream_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/stream_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/to_proto_message.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/to_proto_message.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toProtoMessage: () => (/* binding */ toProtoMessage)\n/* harmony export */ });\nconst EmptyMessage = {\n payload: new Uint8Array(),\n contentTopic: \"\",\n version: undefined,\n timestamp: undefined,\n meta: undefined,\n rateLimitProof: undefined,\n ephemeral: undefined\n};\nfunction toProtoMessage(wire) {\n return { ...EmptyMessage, ...wire };\n}\n//# sourceMappingURL=to_proto_message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/to_proto_message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/wait_for_remote_peer.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/wait_for_remote_peer.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ waitForRemotePeer: () => (/* binding */ waitForRemotePeer)\n/* harmony export */ });\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var p_event__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! p-event */ \"./node_modules/@waku/sdk/node_modules/p-event/index.js\");\n\n\n\nconst log = new _waku_utils__WEBPACK_IMPORTED_MODULE_1__.Logger(\"wait-for-remote-peer\");\n//TODO: move this function within the Waku class: https://github.com/waku-org/js-waku/issues/1761\n/**\n * Wait for a remote peer to be ready given the passed protocols.\n * Must be used after attempting to connect to nodes, using\n * {@link @waku/sdk!WakuNode.dial} or a bootstrap method with\n * {@link @waku/sdk!createLightNode}.\n *\n * If the passed protocols is a GossipSub protocol, then it resolves only once\n * a peer is in a mesh, to help ensure that other peers will send and receive\n * message to us.\n *\n * @param waku The Waku Node\n * @param protocols The protocols that need to be enabled by remote peers.\n * @param timeoutMs A timeout value in milliseconds..\n *\n * @returns A promise that **resolves** if all desired protocols are fulfilled by\n * remote nodes, **rejects** if the timeoutMs is reached.\n * @throws If passing a protocol that is not mounted\n * @default Wait for remote peers with protocols enabled locally and no time out is applied.\n */\nasync function waitForRemotePeer(waku, protocols, timeoutMs) {\n protocols = protocols ?? getEnabledProtocols(waku);\n if (!waku.isStarted())\n return Promise.reject(\"Waku node is not started\");\n const promises = [];\n if (protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Relay)) {\n if (!waku.relay)\n throw new Error(\"Cannot wait for Relay peer: protocol not mounted\");\n promises.push(waitForGossipSubPeerInMesh(waku.relay));\n }\n if (protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Store)) {\n if (!waku.store)\n throw new Error(\"Cannot wait for Store peer: protocol not mounted\");\n promises.push(waitForConnectedPeer(waku.store.protocol, waku.libp2p.services.metadata));\n }\n if (protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.LightPush)) {\n if (!waku.lightPush)\n throw new Error(\"Cannot wait for LightPush peer: protocol not mounted\");\n promises.push(waitForConnectedPeer(waku.lightPush.protocol, waku.libp2p.services.metadata));\n }\n if (protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Filter)) {\n if (!waku.filter)\n throw new Error(\"Cannot wait for Filter peer: protocol not mounted\");\n promises.push(waitForConnectedPeer(waku.filter, waku.libp2p.services.metadata));\n }\n if (timeoutMs) {\n await rejectOnTimeout(Promise.all(promises), timeoutMs, \"Timed out waiting for a remote peer.\");\n }\n else {\n await Promise.all(promises);\n }\n}\n//TODO: move this function within protocol SDK class: https://github.com/waku-org/js-waku/issues/1761\n/**\n * Wait for a peer with the given protocol to be connected.\n * If sharding is enabled on the node, it will also wait for the peer to be confirmed by the metadata service.\n */\nasync function waitForConnectedPeer(protocol, metadataService) {\n const codec = protocol.multicodec;\n const peers = await protocol.connectedPeers();\n if (peers.length) {\n if (!metadataService) {\n log.info(`${codec} peer found: `, peers[0].id.toString());\n return;\n }\n // once a peer is connected, we need to confirm the metadata handshake with at least one of those peers if sharding is enabled\n try {\n await Promise.any(peers.map((peer) => metadataService.confirmOrAttemptHandshake(peer.id)));\n return;\n }\n catch (e) {\n if (e.code === \"ERR_CONNECTION_BEING_CLOSED\")\n log.error(`Connection with the peer was closed and possibly because it's on a different shard. Error: ${e}`);\n log.error(`Error waiting for handshake confirmation: ${e}`);\n }\n }\n log.info(`Waiting for ${codec} peer`);\n // else we'll just wait for the next peer to connect\n await new Promise((resolve) => {\n const cb = (evt) => {\n if (evt.detail?.protocols?.includes(codec)) {\n if (metadataService) {\n metadataService\n .confirmOrAttemptHandshake(evt.detail.peerId)\n .then(() => {\n protocol.removeLibp2pEventListener(\"peer:identify\", cb);\n resolve();\n })\n .catch((e) => {\n if (e.code === \"ERR_CONNECTION_BEING_CLOSED\")\n log.error(`Connection with the peer was closed and possibly because it's on a different shard. Error: ${e}`);\n log.error(`Error waiting for handshake confirmation: ${e}`);\n });\n }\n else {\n protocol.removeLibp2pEventListener(\"peer:identify\", cb);\n resolve();\n }\n }\n };\n protocol.addLibp2pEventListener(\"peer:identify\", cb);\n });\n}\n/**\n * Wait for at least one peer with the given protocol to be connected and in the gossipsub\n * mesh for all pubsubTopics.\n */\nasync function waitForGossipSubPeerInMesh(waku) {\n let peers = waku.getMeshPeers();\n const pubsubTopics = waku.pubsubTopics;\n for (const topic of pubsubTopics) {\n while (peers.length == 0) {\n await (0,p_event__WEBPACK_IMPORTED_MODULE_2__.pEvent)(waku.gossipSub, \"gossipsub:heartbeat\");\n peers = waku.getMeshPeers(topic);\n }\n }\n}\nconst awaitTimeout = (ms, rejectReason) => new Promise((_resolve, reject) => setTimeout(() => reject(rejectReason), ms));\nasync function rejectOnTimeout(promise, timeoutMs, rejectReason) {\n await Promise.race([promise, awaitTimeout(timeoutMs, rejectReason)]);\n}\nfunction getEnabledProtocols(waku) {\n const protocols = [];\n if (waku.relay) {\n protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Relay);\n }\n if (waku.filter) {\n protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Filter);\n }\n if (waku.store) {\n protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Store);\n }\n if (waku.lightPush) {\n protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.LightPush);\n }\n return protocols;\n}\n//# sourceMappingURL=wait_for_remote_peer.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/core/dist/lib/wait_for_remote_peer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/connection_manager.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/connection_manager.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EConnectionStateEvents: () => (/* binding */ EConnectionStateEvents),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* binding */ EPeersByDiscoveryEvents),\n/* harmony export */ Tags: () => (/* binding */ Tags)\n/* harmony export */ });\nvar Tags;\n(function (Tags) {\n Tags[\"BOOTSTRAP\"] = \"bootstrap\";\n Tags[\"PEER_EXCHANGE\"] = \"peer-exchange\";\n Tags[\"LOCAL\"] = \"local-peer-cache\";\n})(Tags || (Tags = {}));\nvar EPeersByDiscoveryEvents;\n(function (EPeersByDiscoveryEvents) {\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_BOOTSTRAP\"] = \"peer:discovery:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_PEER_EXCHANGE\"] = \"peer:discovery:peer-exchange\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_BOOTSTRAP\"] = \"peer:connected:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_PEER_EXCHANGE\"] = \"peer:connected:peer-exchange\";\n})(EPeersByDiscoveryEvents || (EPeersByDiscoveryEvents = {}));\nvar EConnectionStateEvents;\n(function (EConnectionStateEvents) {\n EConnectionStateEvents[\"CONNECTION_STATUS\"] = \"waku:connection\";\n})(EConnectionStateEvents || (EConnectionStateEvents = {}));\n//# sourceMappingURL=connection_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/connection_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/constants.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/constants.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_CLUSTER_ID: () => (/* binding */ DEFAULT_CLUSTER_ID),\n/* harmony export */ DefaultPubsubTopic: () => (/* binding */ DefaultPubsubTopic)\n/* harmony export */ });\n/**\n * DefaultPubsubTopic is the default gossipsub topic to use for Waku.\n */\nconst DefaultPubsubTopic = \"/waku/2/default-waku/proto\";\n/**\n * The default cluster ID for The Waku Network\n */\nconst DEFAULT_CLUSTER_ID = 1;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/dns_discovery.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/dns_discovery.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=dns_discovery.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/dns_discovery.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/enr.js":
|
||
/*!**************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/enr.js ***!
|
||
\**************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=enr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/enr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/filter.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/filter.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=filter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/filter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_CLUSTER_ID: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_17__.DEFAULT_CLUSTER_ID),\n/* harmony export */ DefaultPubsubTopic: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_17__.DefaultPubsubTopic),\n/* harmony export */ EConnectionStateEvents: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.EConnectionStateEvents),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.EPeersByDiscoveryEvents),\n/* harmony export */ PageDirection: () => (/* reexport safe */ _store_js__WEBPACK_IMPORTED_MODULE_7__.PageDirection),\n/* harmony export */ ProtocolError: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.ProtocolError),\n/* harmony export */ Protocols: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.Protocols),\n/* harmony export */ Tags: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.Tags)\n/* harmony export */ });\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/enr.js\");\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filter.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/filter.js\");\n/* harmony import */ var _light_push_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./light_push.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/light_push.js\");\n/* harmony import */ var _message_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/message.js\");\n/* harmony import */ var _peer_exchange_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer_exchange.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/peer_exchange.js\");\n/* harmony import */ var _protocols_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./protocols.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/protocols.js\");\n/* harmony import */ var _relay_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./relay.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/relay.js\");\n/* harmony import */ var _store_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./store.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/store.js\");\n/* harmony import */ var _waku_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./waku.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/waku.js\");\n/* harmony import */ var _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./connection_manager.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/connection_manager.js\");\n/* harmony import */ var _sender_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sender.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/sender.js\");\n/* harmony import */ var _receiver_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./receiver.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/receiver.js\");\n/* harmony import */ var _misc_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./misc.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/misc.js\");\n/* harmony import */ var _libp2p_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./libp2p.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/libp2p.js\");\n/* harmony import */ var _keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./keep_alive_manager.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/keep_alive_manager.js\");\n/* harmony import */ var _dns_discovery_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./dns_discovery.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/dns_discovery.js\");\n/* harmony import */ var _metadata_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./metadata.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/metadata.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/constants.js\");\n/* harmony import */ var _local_storage_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./local_storage.js */ \"./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/local_storage.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/keep_alive_manager.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/keep_alive_manager.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=keep_alive_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/keep_alive_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/libp2p.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/libp2p.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=libp2p.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/libp2p.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/light_push.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/light_push.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/light_push.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/local_storage.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/local_storage.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=local_storage.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/local_storage.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/message.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/message.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/metadata.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/metadata.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=metadata.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/metadata.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/misc.js":
|
||
/*!***************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/misc.js ***!
|
||
\***************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=misc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/misc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/peer_exchange.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/peer_exchange.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=peer_exchange.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/peer_exchange.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/protocols.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/protocols.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ProtocolError: () => (/* binding */ ProtocolError),\n/* harmony export */ Protocols: () => (/* binding */ Protocols)\n/* harmony export */ });\nvar Protocols;\n(function (Protocols) {\n Protocols[\"Relay\"] = \"relay\";\n Protocols[\"Store\"] = \"store\";\n Protocols[\"LightPush\"] = \"lightpush\";\n Protocols[\"Filter\"] = \"filter\";\n})(Protocols || (Protocols = {}));\nvar ProtocolError;\n(function (ProtocolError) {\n /** Could not determine the origin of the fault. Best to check connectivity and try again */\n ProtocolError[\"GENERIC_FAIL\"] = \"Generic error\";\n /**\n * Failure to protobuf encode the message. This is not recoverable and needs\n * further investigation.\n */\n ProtocolError[\"ENCODE_FAILED\"] = \"Failed to encode\";\n /**\n * Failure to protobuf decode the message. May be due to a remote peer issue,\n * ensuring that messages are sent via several peer enable mitigation of this error.\n */\n ProtocolError[\"DECODE_FAILED\"] = \"Failed to decode\";\n /**\n * The message payload is empty, making the message invalid. Ensure that a non-empty\n * payload is set on the outgoing message.\n */\n ProtocolError[\"EMPTY_PAYLOAD\"] = \"Payload is empty\";\n /**\n * The message size is above the maximum message size allowed on the Waku Network.\n * Compressing the message or using an alternative strategy for large messages is recommended.\n */\n ProtocolError[\"SIZE_TOO_BIG\"] = \"Size is too big\";\n /**\n * The PubsubTopic passed to the send function is not configured on the Waku node.\n * Please ensure that the PubsubTopic is used when initializing the Waku node.\n */\n ProtocolError[\"TOPIC_NOT_CONFIGURED\"] = \"Topic not configured\";\n /**\n * Failure to find a peer with suitable protocols. This may due to a connection issue.\n * Mitigation can be: retrying after a given time period, display connectivity issue\n * to user or listening for `peer:connected:bootstrap` or `peer:connected:peer-exchange`\n * on the connection manager before retrying.\n */\n ProtocolError[\"NO_PEER_AVAILABLE\"] = \"No peer available\";\n /**\n * The remote peer did not behave as expected. Mitigation for `NO_PEER_AVAILABLE`\n * or `DECODE_FAILED` can be used.\n */\n ProtocolError[\"REMOTE_PEER_FAULT\"] = \"Remote peer fault\";\n /**\n * The remote peer rejected the message. Information provided by the remote peer\n * is logged. Review message validity, or mitigation for `NO_PEER_AVAILABLE`\n * or `DECODE_FAILED` can be used.\n */\n ProtocolError[\"REMOTE_PEER_REJECTED\"] = \"Remote peer rejected\";\n /**\n * The protocol request timed out without a response. This may be due to a connection issue.\n * Mitigation can be: retrying after a given time period\n */\n ProtocolError[\"REQUEST_TIMEOUT\"] = \"Request timeout\";\n})(ProtocolError || (ProtocolError = {}));\n//# sourceMappingURL=protocols.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/protocols.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/receiver.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/receiver.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=receiver.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/receiver.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/relay.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/relay.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=relay.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/relay.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/sender.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/sender.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=sender.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/sender.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/store.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/store.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PageDirection: () => (/* binding */ PageDirection)\n/* harmony export */ });\nvar PageDirection;\n(function (PageDirection) {\n PageDirection[\"BACKWARD\"] = \"backward\";\n PageDirection[\"FORWARD\"] = \"forward\";\n})(PageDirection || (PageDirection = {}));\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/store.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/waku.js":
|
||
/*!***************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/waku.js ***!
|
||
\***************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=waku.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/interfaces/dist/waku.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/message-hash/dist/index.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/message-hash/dist/index.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ messageHash: () => (/* binding */ messageHash),\n/* harmony export */ messageHashStr: () => (/* binding */ messageHashStr)\n/* harmony export */ });\n/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/@noble/hashes/esm/sha256.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n\n\n/**\n * Deterministic Message Hashing as defined in\n * [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/#deterministic-message-hashing)\n */\nfunction messageHash(pubsubTopic, message) {\n const pubsubTopicBytes = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.utf8ToBytes)(pubsubTopic);\n const contentTopicBytes = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.utf8ToBytes)(message.contentTopic);\n let bytes;\n if (message.meta) {\n bytes = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.concat)([\n pubsubTopicBytes,\n message.payload,\n contentTopicBytes,\n message.meta\n ]);\n }\n else {\n bytes = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.concat)([pubsubTopicBytes, message.payload, contentTopicBytes]);\n }\n return (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_1__.sha256)(bytes);\n}\nfunction messageHashStr(pubsubTopic, message) {\n const hash = messageHash(pubsubTopic, message);\n const hashStr = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.bytesToUtf8)(hash);\n return hashStr;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/message-hash/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/filter.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/filter.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterRequest: () => (/* binding */ FilterRequest),\n/* harmony export */ FilterRpc: () => (/* binding */ FilterRpc),\n/* harmony export */ MessagePush: () => (/* binding */ MessagePush),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar FilterRequest;\n(function (FilterRequest) {\n let ContentFilter;\n (function (ContentFilter) {\n let _codec;\n ContentFilter.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(10);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.contentTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ContentFilter.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ContentFilter.codec());\n };\n ContentFilter.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ContentFilter.codec(), opts);\n };\n })(ContentFilter = FilterRequest.ContentFilter || (FilterRequest.ContentFilter = {}));\n let _codec;\n FilterRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.subscribe != null && obj.subscribe !== false)) {\n w.uint32(8);\n w.bool(obj.subscribe);\n }\n if ((obj.topic != null && obj.topic !== '')) {\n w.uint32(18);\n w.string(obj.topic);\n }\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n w.uint32(26);\n FilterRequest.ContentFilter.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n subscribe: false,\n topic: '',\n contentFilters: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.subscribe = reader.bool();\n break;\n }\n case 2: {\n obj.topic = reader.string();\n break;\n }\n case 3: {\n if (opts.limits?.contentFilters != null && obj.contentFilters.length === opts.limits.contentFilters) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"contentFilters\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.contentFilters.push(FilterRequest.ContentFilter.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.contentFilters$\n }));\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterRequest.codec());\n };\n FilterRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterRequest.codec(), opts);\n };\n})(FilterRequest || (FilterRequest = {}));\nvar MessagePush;\n(function (MessagePush) {\n let _codec;\n MessagePush.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.messages != null) {\n for (const value of obj.messages) {\n w.uint32(10);\n WakuMessage.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n messages: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"messages\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.messages$\n }));\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n MessagePush.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, MessagePush.codec());\n };\n MessagePush.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, MessagePush.codec(), opts);\n };\n})(MessagePush || (MessagePush = {}));\nvar FilterRpc;\n(function (FilterRpc) {\n let _codec;\n FilterRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.request != null) {\n w.uint32(18);\n FilterRequest.codec().encode(obj.request, w);\n }\n if (obj.push != null) {\n w.uint32(26);\n MessagePush.codec().encode(obj.push, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.request = FilterRequest.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.request\n });\n break;\n }\n case 3: {\n obj.push = MessagePush.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.push\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterRpc.codec());\n };\n FilterRpc.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterRpc.codec(), opts);\n };\n})(FilterRpc || (FilterRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=filter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/filter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/filter_v2.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/filter_v2.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterSubscribeRequest: () => (/* binding */ FilterSubscribeRequest),\n/* harmony export */ FilterSubscribeResponse: () => (/* binding */ FilterSubscribeResponse),\n/* harmony export */ MessagePush: () => (/* binding */ MessagePush),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar FilterSubscribeRequest;\n(function (FilterSubscribeRequest) {\n let FilterSubscribeType;\n (function (FilterSubscribeType) {\n FilterSubscribeType[\"SUBSCRIBER_PING\"] = \"SUBSCRIBER_PING\";\n FilterSubscribeType[\"SUBSCRIBE\"] = \"SUBSCRIBE\";\n FilterSubscribeType[\"UNSUBSCRIBE\"] = \"UNSUBSCRIBE\";\n FilterSubscribeType[\"UNSUBSCRIBE_ALL\"] = \"UNSUBSCRIBE_ALL\";\n })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));\n let __FilterSubscribeTypeValues;\n (function (__FilterSubscribeTypeValues) {\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"SUBSCRIBER_PING\"] = 0] = \"SUBSCRIBER_PING\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"SUBSCRIBE\"] = 1] = \"SUBSCRIBE\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"UNSUBSCRIBE\"] = 2] = \"UNSUBSCRIBE\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"UNSUBSCRIBE_ALL\"] = 3] = \"UNSUBSCRIBE_ALL\";\n })(__FilterSubscribeTypeValues || (__FilterSubscribeTypeValues = {}));\n (function (FilterSubscribeType) {\n FilterSubscribeType.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__FilterSubscribeTypeValues);\n };\n })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));\n let _codec;\n FilterSubscribeRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.filterSubscribeType != null && __FilterSubscribeTypeValues[obj.filterSubscribeType] !== 0) {\n w.uint32(16);\n FilterSubscribeRequest.FilterSubscribeType.codec().encode(obj.filterSubscribeType, w);\n }\n if (obj.pubsubTopic != null) {\n w.uint32(82);\n w.string(obj.pubsubTopic);\n }\n if (obj.contentTopics != null) {\n for (const value of obj.contentTopics) {\n w.uint32(90);\n w.string(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: '',\n filterSubscribeType: FilterSubscribeType.SUBSCRIBER_PING,\n contentTopics: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.filterSubscribeType = FilterSubscribeRequest.FilterSubscribeType.codec().decode(reader);\n break;\n }\n case 10: {\n obj.pubsubTopic = reader.string();\n break;\n }\n case 11: {\n if (opts.limits?.contentTopics != null && obj.contentTopics.length === opts.limits.contentTopics) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"contentTopics\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.contentTopics.push(reader.string());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterSubscribeRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterSubscribeRequest.codec());\n };\n FilterSubscribeRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterSubscribeRequest.codec(), opts);\n };\n})(FilterSubscribeRequest || (FilterSubscribeRequest = {}));\nvar FilterSubscribeResponse;\n(function (FilterSubscribeResponse) {\n let _codec;\n FilterSubscribeResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if ((obj.statusCode != null && obj.statusCode !== 0)) {\n w.uint32(80);\n w.uint32(obj.statusCode);\n }\n if (obj.statusDesc != null) {\n w.uint32(90);\n w.string(obj.statusDesc);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: '',\n statusCode: 0\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 10: {\n obj.statusCode = reader.uint32();\n break;\n }\n case 11: {\n obj.statusDesc = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterSubscribeResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterSubscribeResponse.codec());\n };\n FilterSubscribeResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterSubscribeResponse.codec(), opts);\n };\n})(FilterSubscribeResponse || (FilterSubscribeResponse = {}));\nvar MessagePush;\n(function (MessagePush) {\n let _codec;\n MessagePush.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.wakuMessage != null) {\n w.uint32(10);\n WakuMessage.codec().encode(obj.wakuMessage, w);\n }\n if (obj.pubsubTopic != null) {\n w.uint32(18);\n w.string(obj.pubsubTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.wakuMessage = WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.wakuMessage\n });\n break;\n }\n case 2: {\n obj.pubsubTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n MessagePush.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, MessagePush.codec());\n };\n MessagePush.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, MessagePush.codec(), opts);\n };\n})(MessagePush || (MessagePush = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=filter_v2.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/filter_v2.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/light_push.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/light_push.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushRequest: () => (/* binding */ PushRequest),\n/* harmony export */ PushResponse: () => (/* binding */ PushResponse),\n/* harmony export */ PushRpc: () => (/* binding */ PushRpc),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar PushRequest;\n(function (PushRequest) {\n let _codec;\n PushRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {\n w.uint32(10);\n w.string(obj.pubsubTopic);\n }\n if (obj.message != null) {\n w.uint32(18);\n WakuMessage.codec().encode(obj.message, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n pubsubTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.pubsubTopic = reader.string();\n break;\n }\n case 2: {\n obj.message = WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.message\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushRequest.codec());\n };\n PushRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushRequest.codec(), opts);\n };\n})(PushRequest || (PushRequest = {}));\nvar PushResponse;\n(function (PushResponse) {\n let _codec;\n PushResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.isSuccess != null && obj.isSuccess !== false)) {\n w.uint32(8);\n w.bool(obj.isSuccess);\n }\n if (obj.info != null) {\n w.uint32(18);\n w.string(obj.info);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n isSuccess: false\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.isSuccess = reader.bool();\n break;\n }\n case 2: {\n obj.info = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushResponse.codec());\n };\n PushResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushResponse.codec(), opts);\n };\n})(PushResponse || (PushResponse = {}));\nvar PushRpc;\n(function (PushRpc) {\n let _codec;\n PushRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.request != null) {\n w.uint32(18);\n PushRequest.codec().encode(obj.request, w);\n }\n if (obj.response != null) {\n w.uint32(26);\n PushResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.request = PushRequest.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.request\n });\n break;\n }\n case 3: {\n obj.response = PushResponse.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.response\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushRpc.codec());\n };\n PushRpc.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushRpc.codec(), opts);\n };\n})(PushRpc || (PushRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/light_push.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/message.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/message.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/metadata.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/metadata.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WakuMetadataRequest: () => (/* binding */ WakuMetadataRequest),\n/* harmony export */ WakuMetadataResponse: () => (/* binding */ WakuMetadataResponse)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar WakuMetadataRequest;\n(function (WakuMetadataRequest) {\n let _codec;\n WakuMetadataRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.clusterId != null) {\n w.uint32(8);\n w.uint32(obj.clusterId);\n }\n if (obj.shards != null) {\n for (const value of obj.shards) {\n w.uint32(16);\n w.uint32(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n shards: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.clusterId = reader.uint32();\n break;\n }\n case 2: {\n if (opts.limits?.shards != null && obj.shards.length === opts.limits.shards) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"shards\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.shards.push(reader.uint32());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMetadataRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMetadataRequest.codec());\n };\n WakuMetadataRequest.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMetadataRequest.codec(), opts);\n };\n})(WakuMetadataRequest || (WakuMetadataRequest = {}));\nvar WakuMetadataResponse;\n(function (WakuMetadataResponse) {\n let _codec;\n WakuMetadataResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.clusterId != null) {\n w.uint32(8);\n w.uint32(obj.clusterId);\n }\n if (obj.shards != null) {\n for (const value of obj.shards) {\n w.uint32(16);\n w.uint32(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n shards: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.clusterId = reader.uint32();\n break;\n }\n case 2: {\n if (opts.limits?.shards != null && obj.shards.length === opts.limits.shards) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"shards\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.shards.push(reader.uint32());\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMetadataResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMetadataResponse.codec());\n };\n WakuMetadataResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMetadataResponse.codec(), opts);\n };\n})(WakuMetadataResponse || (WakuMetadataResponse = {}));\n//# sourceMappingURL=metadata.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/metadata.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/peer_exchange.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/peer_exchange.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerExchangeQuery: () => (/* binding */ PeerExchangeQuery),\n/* harmony export */ PeerExchangeRPC: () => (/* binding */ PeerExchangeRPC),\n/* harmony export */ PeerExchangeResponse: () => (/* binding */ PeerExchangeResponse),\n/* harmony export */ PeerInfo: () => (/* binding */ PeerInfo)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar PeerInfo;\n(function (PeerInfo) {\n let _codec;\n PeerInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.enr != null) {\n w.uint32(10);\n w.bytes(obj.enr);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.enr = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerInfo.codec());\n };\n PeerInfo.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerInfo.codec(), opts);\n };\n})(PeerInfo || (PeerInfo = {}));\nvar PeerExchangeQuery;\n(function (PeerExchangeQuery) {\n let _codec;\n PeerExchangeQuery.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.numPeers != null) {\n w.uint32(8);\n w.uint64(obj.numPeers);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.numPeers = reader.uint64();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeQuery.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeQuery.codec());\n };\n PeerExchangeQuery.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeQuery.codec(), opts);\n };\n})(PeerExchangeQuery || (PeerExchangeQuery = {}));\nvar PeerExchangeResponse;\n(function (PeerExchangeResponse) {\n let _codec;\n PeerExchangeResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.peerInfos != null) {\n for (const value of obj.peerInfos) {\n w.uint32(10);\n PeerInfo.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n peerInfos: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (opts.limits?.peerInfos != null && obj.peerInfos.length === opts.limits.peerInfos) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"peerInfos\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.peerInfos.push(PeerInfo.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.peerInfos$\n }));\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeResponse.codec());\n };\n PeerExchangeResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeResponse.codec(), opts);\n };\n})(PeerExchangeResponse || (PeerExchangeResponse = {}));\nvar PeerExchangeRPC;\n(function (PeerExchangeRPC) {\n let _codec;\n PeerExchangeRPC.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.query != null) {\n w.uint32(10);\n PeerExchangeQuery.codec().encode(obj.query, w);\n }\n if (obj.response != null) {\n w.uint32(18);\n PeerExchangeResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.query = PeerExchangeQuery.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.query\n });\n break;\n }\n case 2: {\n obj.response = PeerExchangeResponse.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.response\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeRPC.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeRPC.codec());\n };\n PeerExchangeRPC.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeRPC.codec(), opts);\n };\n})(PeerExchangeRPC || (PeerExchangeRPC = {}));\n//# sourceMappingURL=peer_exchange.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/peer_exchange.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/store.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/store.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContentFilter: () => (/* binding */ ContentFilter),\n/* harmony export */ HistoryQuery: () => (/* binding */ HistoryQuery),\n/* harmony export */ HistoryResponse: () => (/* binding */ HistoryResponse),\n/* harmony export */ HistoryRpc: () => (/* binding */ HistoryRpc),\n/* harmony export */ Index: () => (/* binding */ Index),\n/* harmony export */ PagingInfo: () => (/* binding */ PagingInfo),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\n\nvar Index;\n(function (Index) {\n let _codec;\n Index.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.digest != null && obj.digest.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.digest);\n }\n if ((obj.receiverTime != null && obj.receiverTime !== 0n)) {\n w.uint32(16);\n w.sint64(obj.receiverTime);\n }\n if ((obj.senderTime != null && obj.senderTime !== 0n)) {\n w.uint32(24);\n w.sint64(obj.senderTime);\n }\n if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {\n w.uint32(34);\n w.string(obj.pubsubTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n digest: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n receiverTime: 0n,\n senderTime: 0n,\n pubsubTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.digest = reader.bytes();\n break;\n }\n case 2: {\n obj.receiverTime = reader.sint64();\n break;\n }\n case 3: {\n obj.senderTime = reader.sint64();\n break;\n }\n case 4: {\n obj.pubsubTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Index.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Index.codec());\n };\n Index.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Index.codec(), opts);\n };\n})(Index || (Index = {}));\nvar PagingInfo;\n(function (PagingInfo) {\n let Direction;\n (function (Direction) {\n Direction[\"BACKWARD\"] = \"BACKWARD\";\n Direction[\"FORWARD\"] = \"FORWARD\";\n })(Direction = PagingInfo.Direction || (PagingInfo.Direction = {}));\n let __DirectionValues;\n (function (__DirectionValues) {\n __DirectionValues[__DirectionValues[\"BACKWARD\"] = 0] = \"BACKWARD\";\n __DirectionValues[__DirectionValues[\"FORWARD\"] = 1] = \"FORWARD\";\n })(__DirectionValues || (__DirectionValues = {}));\n (function (Direction) {\n Direction.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__DirectionValues);\n };\n })(Direction = PagingInfo.Direction || (PagingInfo.Direction = {}));\n let _codec;\n PagingInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.pageSize != null) {\n w.uint32(8);\n w.uint64(obj.pageSize);\n }\n if (obj.cursor != null) {\n w.uint32(18);\n Index.codec().encode(obj.cursor, w);\n }\n if (obj.direction != null) {\n w.uint32(24);\n PagingInfo.Direction.codec().encode(obj.direction, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.pageSize = reader.uint64();\n break;\n }\n case 2: {\n obj.cursor = Index.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.cursor\n });\n break;\n }\n case 3: {\n obj.direction = PagingInfo.Direction.codec().decode(reader);\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PagingInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PagingInfo.codec());\n };\n PagingInfo.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PagingInfo.codec(), opts);\n };\n})(PagingInfo || (PagingInfo = {}));\nvar ContentFilter;\n(function (ContentFilter) {\n let _codec;\n ContentFilter.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(10);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.contentTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ContentFilter.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ContentFilter.codec());\n };\n ContentFilter.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ContentFilter.codec(), opts);\n };\n})(ContentFilter || (ContentFilter = {}));\nvar HistoryQuery;\n(function (HistoryQuery) {\n let _codec;\n HistoryQuery.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.pubsubTopic != null) {\n w.uint32(18);\n w.string(obj.pubsubTopic);\n }\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n w.uint32(26);\n ContentFilter.codec().encode(value, w);\n }\n }\n if (obj.pagingInfo != null) {\n w.uint32(34);\n PagingInfo.codec().encode(obj.pagingInfo, w);\n }\n if (obj.startTime != null) {\n w.uint32(40);\n w.sint64(obj.startTime);\n }\n if (obj.endTime != null) {\n w.uint32(48);\n w.sint64(obj.endTime);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentFilters: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2: {\n obj.pubsubTopic = reader.string();\n break;\n }\n case 3: {\n if (opts.limits?.contentFilters != null && obj.contentFilters.length === opts.limits.contentFilters) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"contentFilters\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.contentFilters.push(ContentFilter.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.contentFilters$\n }));\n break;\n }\n case 4: {\n obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.pagingInfo\n });\n break;\n }\n case 5: {\n obj.startTime = reader.sint64();\n break;\n }\n case 6: {\n obj.endTime = reader.sint64();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryQuery.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryQuery.codec());\n };\n HistoryQuery.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryQuery.codec(), opts);\n };\n})(HistoryQuery || (HistoryQuery = {}));\nvar HistoryResponse;\n(function (HistoryResponse) {\n let HistoryError;\n (function (HistoryError) {\n HistoryError[\"NONE\"] = \"NONE\";\n HistoryError[\"INVALID_CURSOR\"] = \"INVALID_CURSOR\";\n HistoryError[\"TOO_MANY_RESULTS\"] = \"TOO_MANY_RESULTS\";\n HistoryError[\"SERVICE_UNAVAILABLE\"] = \"SERVICE_UNAVAILABLE\";\n })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));\n let __HistoryErrorValues;\n (function (__HistoryErrorValues) {\n __HistoryErrorValues[__HistoryErrorValues[\"NONE\"] = 0] = \"NONE\";\n __HistoryErrorValues[__HistoryErrorValues[\"INVALID_CURSOR\"] = 1] = \"INVALID_CURSOR\";\n __HistoryErrorValues[__HistoryErrorValues[\"TOO_MANY_RESULTS\"] = 429] = \"TOO_MANY_RESULTS\";\n __HistoryErrorValues[__HistoryErrorValues[\"SERVICE_UNAVAILABLE\"] = 503] = \"SERVICE_UNAVAILABLE\";\n })(__HistoryErrorValues || (__HistoryErrorValues = {}));\n (function (HistoryError) {\n HistoryError.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__HistoryErrorValues);\n };\n })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));\n let _codec;\n HistoryResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.messages != null) {\n for (const value of obj.messages) {\n w.uint32(18);\n WakuMessage.codec().encode(value, w);\n }\n }\n if (obj.pagingInfo != null) {\n w.uint32(26);\n PagingInfo.codec().encode(obj.pagingInfo, w);\n }\n if (obj.error != null && __HistoryErrorValues[obj.error] !== 0) {\n w.uint32(32);\n HistoryResponse.HistoryError.codec().encode(obj.error, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n messages: [],\n error: HistoryError.NONE\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2: {\n if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {\n throw new protons_runtime__WEBPACK_IMPORTED_MODULE_0__.CodeError('decode error - map field \"messages\" had too many elements', 'ERR_MAX_LENGTH');\n }\n obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.messages$\n }));\n break;\n }\n case 3: {\n obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.pagingInfo\n });\n break;\n }\n case 4: {\n obj.error = HistoryResponse.HistoryError.codec().decode(reader);\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryResponse.codec());\n };\n HistoryResponse.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryResponse.codec(), opts);\n };\n})(HistoryResponse || (HistoryResponse = {}));\nvar HistoryRpc;\n(function (HistoryRpc) {\n let _codec;\n HistoryRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.requestId != null && obj.requestId !== '')) {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.query != null) {\n w.uint32(18);\n HistoryQuery.codec().encode(obj.query, w);\n }\n if (obj.response != null) {\n w.uint32(26);\n HistoryResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n requestId: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.requestId = reader.string();\n break;\n }\n case 2: {\n obj.query = HistoryQuery.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.query\n });\n break;\n }\n case 3: {\n obj.response = HistoryResponse.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.response\n });\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryRpc.codec());\n };\n HistoryRpc.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryRpc.codec(), opts);\n };\n})(HistoryRpc || (HistoryRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.proof != null && obj.proof.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if ((obj.epoch != null && obj.epoch.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if ((obj.shareX != null && obj.shareX.byteLength > 0)) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if ((obj.shareY != null && obj.shareY.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n proof: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n merkleRoot: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n epoch: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareX: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n shareY: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n nullifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n rlnIdentifier: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.proof = reader.bytes();\n break;\n }\n case 2: {\n obj.merkleRoot = reader.bytes();\n break;\n }\n case 3: {\n obj.epoch = reader.bytes();\n break;\n }\n case 4: {\n obj.shareX = reader.bytes();\n break;\n }\n case 5: {\n obj.shareY = reader.bytes();\n break;\n }\n case 6: {\n obj.nullifier = reader.bytes();\n break;\n }\n case 7: {\n obj.rlnIdentifier = reader.bytes();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec(), opts);\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n payload: (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.alloc)(0),\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n obj.payload = reader.bytes();\n break;\n }\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n case 3: {\n obj.version = reader.uint32();\n break;\n }\n case 10: {\n obj.timestamp = reader.sint64();\n break;\n }\n case 11: {\n obj.meta = reader.bytes();\n break;\n }\n case 21: {\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {\n limits: opts.limits?.rateLimitProof\n });\n break;\n }\n case 31: {\n obj.ephemeral = reader.bool();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec(), opts);\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/store.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/topic_only_message.js":
|
||
/*!**********************************************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/topic_only_message.js ***!
|
||
\**********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TopicOnlyMessage: () => (/* binding */ TopicOnlyMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar TopicOnlyMessage;\n(function (TopicOnlyMessage) {\n let _codec;\n TopicOnlyMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.contentTopic != null && obj.contentTopic !== '')) {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length, opts = {}) => {\n const obj = {\n contentTopic: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2: {\n obj.contentTopic = reader.string();\n break;\n }\n default: {\n reader.skipType(tag & 7);\n break;\n }\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n TopicOnlyMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, TopicOnlyMessage.codec());\n };\n TopicOnlyMessage.decode = (buf, opts) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, TopicOnlyMessage.codec(), opts);\n };\n})(TopicOnlyMessage || (TopicOnlyMessage = {}));\n//# sourceMappingURL=topic_only_message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/topic_only_message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/@waku/proto/dist/index.js":
|
||
/*!***********************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/@waku/proto/dist/index.js ***!
|
||
\***********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushResponse: () => (/* reexport safe */ _generated_light_push_js__WEBPACK_IMPORTED_MODULE_4__.PushResponse),\n/* harmony export */ TopicOnlyMessage: () => (/* reexport safe */ _generated_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__.TopicOnlyMessage),\n/* harmony export */ WakuMessage: () => (/* reexport safe */ _generated_filter_js__WEBPACK_IMPORTED_MODULE_1__.WakuMessage),\n/* harmony export */ proto_filter: () => (/* reexport module object */ _generated_filter_js__WEBPACK_IMPORTED_MODULE_1__),\n/* harmony export */ proto_filter_v2: () => (/* reexport module object */ _generated_filter_v2_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ proto_lightpush: () => (/* reexport module object */ _generated_light_push_js__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ proto_message: () => (/* reexport module object */ _generated_message_js__WEBPACK_IMPORTED_MODULE_0__),\n/* harmony export */ proto_metadata: () => (/* reexport module object */ _generated_metadata_js__WEBPACK_IMPORTED_MODULE_7__),\n/* harmony export */ proto_peer_exchange: () => (/* reexport module object */ _generated_peer_exchange_js__WEBPACK_IMPORTED_MODULE_6__),\n/* harmony export */ proto_store: () => (/* reexport module object */ _generated_store_js__WEBPACK_IMPORTED_MODULE_5__),\n/* harmony export */ proto_topic_only_message: () => (/* reexport module object */ _generated_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__)\n/* harmony export */ });\n/* harmony import */ var _generated_message_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./generated/message.js */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/message.js\");\n/* harmony import */ var _generated_filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./generated/filter.js */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/filter.js\");\n/* harmony import */ var _generated_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./generated/topic_only_message.js */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/topic_only_message.js\");\n/* harmony import */ var _generated_filter_v2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./generated/filter_v2.js */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/filter_v2.js\");\n/* harmony import */ var _generated_light_push_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generated/light_push.js */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/light_push.js\");\n/* harmony import */ var _generated_store_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./generated/store.js */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/store.js\");\n/* harmony import */ var _generated_peer_exchange_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./generated/peer_exchange.js */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/peer_exchange.js\");\n/* harmony import */ var _generated_metadata_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./generated/metadata.js */ \"./node_modules/@waku/sdk/node_modules/@waku/proto/dist/generated/metadata.js\");\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/@waku/proto/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/sdk/node_modules/p-event/index.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/@waku/sdk/node_modules/p-event/index.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TimeoutError: () => (/* reexport safe */ p_timeout__WEBPACK_IMPORTED_MODULE_0__.TimeoutError),\n/* harmony export */ pEvent: () => (/* binding */ pEvent),\n/* harmony export */ pEventIterator: () => (/* binding */ pEventIterator),\n/* harmony export */ pEventMultiple: () => (/* binding */ pEventMultiple)\n/* harmony export */ });\n/* harmony import */ var p_timeout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-timeout */ \"./node_modules/p-timeout/index.js\");\n\n\nconst normalizeEmitter = emitter => {\n\tconst addListener = emitter.addEventListener || emitter.on || emitter.addListener;\n\tconst removeListener = emitter.removeEventListener || emitter.off || emitter.removeListener;\n\n\tif (!addListener || !removeListener) {\n\t\tthrow new TypeError('Emitter is not compatible');\n\t}\n\n\treturn {\n\t\taddListener: addListener.bind(emitter),\n\t\tremoveListener: removeListener.bind(emitter),\n\t};\n};\n\nfunction pEventMultiple(emitter, event, options) {\n\tlet cancel;\n\tconst returnValue = new Promise((resolve, reject) => {\n\t\toptions = {\n\t\t\trejectionEvents: ['error'],\n\t\t\tmultiArgs: false,\n\t\t\tresolveImmediately: false,\n\t\t\t...options,\n\t\t};\n\n\t\tif (!(options.count >= 0 && (options.count === Number.POSITIVE_INFINITY || Number.isInteger(options.count)))) {\n\t\t\tthrow new TypeError('The `count` option should be at least 0 or more');\n\t\t}\n\n\t\toptions.signal?.throwIfAborted();\n\n\t\t// Allow multiple events\n\t\tconst events = [event].flat();\n\n\t\tconst items = [];\n\t\tconst {addListener, removeListener} = normalizeEmitter(emitter);\n\n\t\tconst onItem = (...arguments_) => {\n\t\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\t\t// eslint-disable-next-line unicorn/no-array-callback-reference\n\t\t\tif (options.filter && !options.filter(value)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\titems.push(value);\n\n\t\t\tif (options.count === items.length) {\n\t\t\t\tcancel();\n\t\t\t\tresolve(items);\n\t\t\t}\n\t\t};\n\n\t\tconst rejectHandler = error => {\n\t\t\tcancel();\n\t\t\treject(error);\n\t\t};\n\n\t\tcancel = () => {\n\t\t\tfor (const event of events) {\n\t\t\t\tremoveListener(event, onItem);\n\t\t\t}\n\n\t\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\t\tremoveListener(rejectionEvent, rejectHandler);\n\t\t\t}\n\t\t};\n\n\t\tfor (const event of events) {\n\t\t\taddListener(event, onItem);\n\t\t}\n\n\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\taddListener(rejectionEvent, rejectHandler);\n\t\t}\n\n\t\tif (options.signal) {\n\t\t\toptions.signal.addEventListener('abort', () => {\n\t\t\t\trejectHandler(options.signal.reason);\n\t\t\t}, {once: true});\n\t\t}\n\n\t\tif (options.resolveImmediately) {\n\t\t\tresolve(items);\n\t\t}\n\t});\n\n\treturnValue.cancel = cancel;\n\n\tif (typeof options.timeout === 'number') {\n\t\tconst timeout = (0,p_timeout__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(returnValue, {milliseconds: options.timeout});\n\t\ttimeout.cancel = cancel;\n\t\treturn timeout;\n\t}\n\n\treturn returnValue;\n}\n\nfunction pEvent(emitter, event, options) {\n\tif (typeof options === 'function') {\n\t\toptions = {filter: options};\n\t}\n\n\toptions = {\n\t\t...options,\n\t\tcount: 1,\n\t\tresolveImmediately: false,\n\t};\n\n\tconst arrayPromise = pEventMultiple(emitter, event, options);\n\tconst promise = arrayPromise.then(array => array[0]);\n\tpromise.cancel = arrayPromise.cancel;\n\n\treturn promise;\n}\n\nfunction pEventIterator(emitter, event, options) {\n\tif (typeof options === 'function') {\n\t\toptions = {filter: options};\n\t}\n\n\t// Allow multiple events\n\tconst events = [event].flat();\n\n\toptions = {\n\t\trejectionEvents: ['error'],\n\t\tresolutionEvents: [],\n\t\tlimit: Number.POSITIVE_INFINITY,\n\t\tmultiArgs: false,\n\t\t...options,\n\t};\n\n\tconst {limit} = options;\n\tconst isValidLimit = limit >= 0 && (limit === Number.POSITIVE_INFINITY || Number.isInteger(limit));\n\tif (!isValidLimit) {\n\t\tthrow new TypeError('The `limit` option should be a non-negative integer or Infinity');\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\tif (limit === 0) {\n\t\t// Return an empty async iterator to avoid any further cost\n\t\treturn {\n\t\t\t[Symbol.asyncIterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tasync next() {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t\tvalue: undefined,\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}\n\n\tconst {addListener, removeListener} = normalizeEmitter(emitter);\n\n\tlet isDone = false;\n\tlet error;\n\tlet hasPendingError = false;\n\tconst nextQueue = [];\n\tconst valueQueue = [];\n\tlet eventCount = 0;\n\tlet isLimitReached = false;\n\n\tconst valueHandler = (...arguments_) => {\n\t\teventCount++;\n\t\tisLimitReached = eventCount === limit;\n\n\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\n\t\t\tresolve({done: false, value});\n\n\t\t\tif (isLimitReached) {\n\t\t\t\tcancel();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tvalueQueue.push(value);\n\n\t\tif (isLimitReached) {\n\t\t\tcancel();\n\t\t}\n\t};\n\n\tconst cancel = () => {\n\t\tisDone = true;\n\n\t\tfor (const event of events) {\n\t\t\tremoveListener(event, valueHandler);\n\t\t}\n\n\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\tremoveListener(rejectionEvent, rejectHandler);\n\t\t}\n\n\t\tfor (const resolutionEvent of options.resolutionEvents) {\n\t\t\tremoveListener(resolutionEvent, resolveHandler);\n\t\t}\n\n\t\twhile (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\t\t\tresolve({done: true, value: undefined});\n\t\t}\n\t};\n\n\tconst rejectHandler = (...arguments_) => {\n\t\terror = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {reject} = nextQueue.shift();\n\t\t\treject(error);\n\t\t} else {\n\t\t\thasPendingError = true;\n\t\t}\n\n\t\tcancel();\n\t};\n\n\tconst resolveHandler = (...arguments_) => {\n\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\t// eslint-disable-next-line unicorn/no-array-callback-reference\n\t\tif (options.filter && !options.filter(value)) {\n\t\t\tcancel();\n\t\t\treturn;\n\t\t}\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\t\t\tresolve({done: true, value});\n\t\t} else {\n\t\t\tvalueQueue.push(value);\n\t\t}\n\n\t\tcancel();\n\t};\n\n\tfor (const event of events) {\n\t\taddListener(event, valueHandler);\n\t}\n\n\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\taddListener(rejectionEvent, rejectHandler);\n\t}\n\n\tfor (const resolutionEvent of options.resolutionEvents) {\n\t\taddListener(resolutionEvent, resolveHandler);\n\t}\n\n\tif (options.signal) {\n\t\toptions.signal.addEventListener('abort', () => {\n\t\t\trejectHandler(options.signal.reason);\n\t\t}, {once: true});\n\t}\n\n\treturn {\n\t\t[Symbol.asyncIterator]() {\n\t\t\treturn this;\n\t\t},\n\t\tasync next() {\n\t\t\tif (valueQueue.length > 0) {\n\t\t\t\tconst value = valueQueue.shift();\n\t\t\t\treturn {\n\t\t\t\t\tdone: isDone && valueQueue.length === 0 && !isLimitReached,\n\t\t\t\t\tvalue,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (hasPendingError) {\n\t\t\t\thasPendingError = false;\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tif (isDone) {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t\tvalue: undefined,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tnextQueue.push({resolve, reject});\n\t\t\t});\n\t\t},\n\t\tasync return(value) {\n\t\t\tcancel();\n\t\t\treturn {\n\t\t\t\tdone: isDone,\n\t\t\t\tvalue,\n\t\t\t};\n\t\t},\n\t};\n}\n\n\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/sdk/node_modules/p-event/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/bytes/index.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/bytes/index.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex),\n/* harmony export */ bytesToUtf8: () => (/* binding */ bytesToUtf8),\n/* harmony export */ concat: () => (/* binding */ concat),\n/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes),\n/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/to-string.js\");\n\n\n/**\n * Convert input to a byte array.\n *\n * Handles both `0x` prefixed and non-prefixed strings.\n */\nfunction hexToBytes(hex) {\n if (typeof hex === \"string\") {\n const _hex = hex.replace(/^0x/i, \"\");\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(_hex.toLowerCase(), \"base16\");\n }\n return hex;\n}\n/**\n * Convert byte array to hex string (no `0x` prefix).\n */\nconst bytesToHex = (bytes) => (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(bytes, \"base16\");\n/**\n * Decode byte array to utf-8 string.\n */\nconst bytesToUtf8 = (b) => (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(b, \"utf8\");\n/**\n * Encode utf-8 string to byte array.\n */\nconst utf8ToBytes = (s) => (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(s, \"utf8\");\n/**\n * Concatenate using Uint8Arrays as `Buffer` has a different behavior with `DataView`\n */\nfunction concat(byteArrays, totalLength) {\n const len = totalLength ?? byteArrays.reduce((acc, curr) => acc + curr.length, 0);\n const res = new Uint8Array(len);\n let offset = 0;\n for (const bytes of byteArrays) {\n res.set(bytes, offset);\n offset += bytes.length;\n }\n return res;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/bytes/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/common/group_by.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/common/group_by.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ groupByContentTopic: () => (/* binding */ groupByContentTopic)\n/* harmony export */ });\nfunction groupByContentTopic(values) {\n const groupedDecoders = new Map();\n values.forEach((value) => {\n let decs = groupedDecoders.get(value.contentTopic);\n if (!decs) {\n groupedDecoders.set(value.contentTopic, []);\n decs = groupedDecoders.get(value.contentTopic);\n }\n decs.push(value);\n });\n return groupedDecoders;\n}\n//# sourceMappingURL=group_by.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/common/group_by.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/common/index.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/common/index.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ contentTopicToPubsubTopic: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.contentTopicToPubsubTopic),\n/* harmony export */ contentTopicToShardIndex: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.contentTopicToShardIndex),\n/* harmony export */ contentTopicsByPubsubTopic: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.contentTopicsByPubsubTopic),\n/* harmony export */ decodeRelayShard: () => (/* reexport safe */ _relay_shard_codec_js__WEBPACK_IMPORTED_MODULE_7__.decodeRelayShard),\n/* harmony export */ determinePubsubTopic: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.determinePubsubTopic),\n/* harmony export */ encodeRelayShard: () => (/* reexport safe */ _relay_shard_codec_js__WEBPACK_IMPORTED_MODULE_7__.encodeRelayShard),\n/* harmony export */ ensurePubsubTopicIsConfigured: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.ensurePubsubTopicIsConfigured),\n/* harmony export */ ensureShardingConfigured: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.ensureShardingConfigured),\n/* harmony export */ ensureValidContentTopic: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.ensureValidContentTopic),\n/* harmony export */ getPseudoRandomSubset: () => (/* reexport safe */ _random_subset_js__WEBPACK_IMPORTED_MODULE_1__.getPseudoRandomSubset),\n/* harmony export */ getWsMultiaddrFromMultiaddrs: () => (/* binding */ getWsMultiaddrFromMultiaddrs),\n/* harmony export */ groupByContentTopic: () => (/* reexport safe */ _group_by_js__WEBPACK_IMPORTED_MODULE_2__.groupByContentTopic),\n/* harmony export */ isDefined: () => (/* reexport safe */ _is_defined_js__WEBPACK_IMPORTED_MODULE_0__.isDefined),\n/* harmony export */ isMessageSizeUnderCap: () => (/* reexport safe */ _is_size_valid_js__WEBPACK_IMPORTED_MODULE_4__.isMessageSizeUnderCap),\n/* harmony export */ isWireSizeUnderCap: () => (/* reexport safe */ _is_size_valid_js__WEBPACK_IMPORTED_MODULE_4__.isWireSizeUnderCap),\n/* harmony export */ pubsubTopicToSingleShardInfo: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.pubsubTopicToSingleShardInfo),\n/* harmony export */ pushOrInitMapSet: () => (/* reexport safe */ _push_or_init_map_js__WEBPACK_IMPORTED_MODULE_6__.pushOrInitMapSet),\n/* harmony export */ removeItemFromArray: () => (/* binding */ removeItemFromArray),\n/* harmony export */ shardInfoToPubsubTopics: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.shardInfoToPubsubTopics),\n/* harmony export */ singleShardInfoToPubsubTopic: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.singleShardInfoToPubsubTopic),\n/* harmony export */ singleShardInfosToShardInfo: () => (/* reexport safe */ _sharding_js__WEBPACK_IMPORTED_MODULE_5__.singleShardInfosToShardInfo),\n/* harmony export */ toAsyncIterator: () => (/* reexport safe */ _to_async_iterator_js__WEBPACK_IMPORTED_MODULE_3__.toAsyncIterator)\n/* harmony export */ });\n/* harmony import */ var _is_defined_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is_defined.js */ \"./node_modules/@waku/utils/dist/common/is_defined.js\");\n/* harmony import */ var _random_subset_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./random_subset.js */ \"./node_modules/@waku/utils/dist/common/random_subset.js\");\n/* harmony import */ var _group_by_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./group_by.js */ \"./node_modules/@waku/utils/dist/common/group_by.js\");\n/* harmony import */ var _to_async_iterator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./to_async_iterator.js */ \"./node_modules/@waku/utils/dist/common/to_async_iterator.js\");\n/* harmony import */ var _is_size_valid_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./is_size_valid.js */ \"./node_modules/@waku/utils/dist/common/is_size_valid.js\");\n/* harmony import */ var _sharding_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./sharding.js */ \"./node_modules/@waku/utils/dist/common/sharding.js\");\n/* harmony import */ var _push_or_init_map_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./push_or_init_map.js */ \"./node_modules/@waku/utils/dist/common/push_or_init_map.js\");\n/* harmony import */ var _relay_shard_codec_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./relay_shard_codec.js */ \"./node_modules/@waku/utils/dist/common/relay_shard_codec.js\");\n\n\n\n\n\n\n\n\nfunction removeItemFromArray(arr, value) {\n const index = arr.indexOf(value);\n if (index > -1) {\n arr.splice(index, 1);\n }\n return arr;\n}\nfunction getWsMultiaddrFromMultiaddrs(addresses) {\n const wsMultiaddr = addresses.find((addr) => addr.toString().includes(\"ws\") || addr.toString().includes(\"wss\"));\n if (!wsMultiaddr) {\n throw new Error(\"No ws multiaddr found in the given addresses\");\n }\n return wsMultiaddr;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/common/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/common/is_defined.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/common/is_defined.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isDefined: () => (/* binding */ isDefined)\n/* harmony export */ });\nfunction isDefined(value) {\n return Boolean(value);\n}\n//# sourceMappingURL=is_defined.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/common/is_defined.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/common/is_size_valid.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/common/is_size_valid.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isMessageSizeUnderCap: () => (/* binding */ isMessageSizeUnderCap),\n/* harmony export */ isWireSizeUnderCap: () => (/* binding */ isWireSizeUnderCap)\n/* harmony export */ });\nconst MB = 1024 ** 2;\nconst SIZE_CAP_IN_MB = 1;\n/**\n * Return whether the size of the message is under the upper limit for the network.\n * This performs a protobuf encoding! If you have access to the fully encoded message,\n * use {@link isSizeUnderCapBuf} instead.\n * @param message\n * @param encoder\n */\nasync function isMessageSizeUnderCap(encoder, message) {\n const buf = await encoder.toWire(message);\n if (!buf)\n return false;\n return isWireSizeUnderCap(buf);\n}\nconst isWireSizeUnderCap = (buf) => buf.length / MB <= SIZE_CAP_IN_MB;\n//# sourceMappingURL=is_size_valid.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/common/is_size_valid.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/common/push_or_init_map.js":
|
||
/*!******************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/common/push_or_init_map.js ***!
|
||
\******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pushOrInitMapSet: () => (/* binding */ pushOrInitMapSet)\n/* harmony export */ });\nfunction pushOrInitMapSet(map, key, newValue) {\n let arr = map.get(key);\n if (typeof arr === \"undefined\") {\n map.set(key, new Set());\n arr = map.get(key);\n }\n arr.add(newValue);\n}\n//# sourceMappingURL=push_or_init_map.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/common/push_or_init_map.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/common/random_subset.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/common/random_subset.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getPseudoRandomSubset: () => (/* binding */ getPseudoRandomSubset)\n/* harmony export */ });\n/**\n * Return pseudo random subset of the input.\n */\nfunction getPseudoRandomSubset(values, wantedNumber) {\n if (values.length <= wantedNumber || values.length <= 1) {\n return values;\n }\n return shuffle(values).slice(0, wantedNumber);\n}\nfunction shuffle(arr) {\n if (arr.length <= 1) {\n return arr;\n }\n const randInt = () => {\n return Math.floor(Math.random() * Math.floor(arr.length));\n };\n for (let i = 0; i < arr.length; i++) {\n const j = randInt();\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n return arr;\n}\n//# sourceMappingURL=random_subset.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/common/random_subset.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/common/relay_shard_codec.js":
|
||
/*!*******************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/common/relay_shard_codec.js ***!
|
||
\*******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeRelayShard: () => (/* binding */ decodeRelayShard),\n/* harmony export */ encodeRelayShard: () => (/* binding */ encodeRelayShard)\n/* harmony export */ });\nconst decodeRelayShard = (bytes) => {\n // explicitly converting to Uint8Array to avoid Buffer\n // https://github.com/libp2p/js-libp2p/issues/2146\n bytes = new Uint8Array(bytes);\n if (bytes.length < 3)\n throw new Error(\"Insufficient data\");\n const view = new DataView(bytes.buffer);\n const clusterId = view.getUint16(0);\n const shards = [];\n if (bytes.length === 130) {\n // rsv format (Bit Vector)\n for (let i = 0; i < 1024; i++) {\n const byteIndex = Math.floor(i / 8) + 2; // Adjusted for the 2-byte cluster field\n const bitIndex = 7 - (i % 8);\n if (view.getUint8(byteIndex) & (1 << bitIndex)) {\n shards.push(i);\n }\n }\n }\n else {\n // rs format (Index List)\n const numIndices = view.getUint8(2);\n for (let i = 0, offset = 3; i < numIndices; i++, offset += 2) {\n if (offset + 1 >= bytes.length)\n throw new Error(\"Unexpected end of data\");\n shards.push(view.getUint16(offset));\n }\n }\n return { clusterId, shards };\n};\nconst encodeRelayShard = (shardInfo) => {\n const { clusterId, shards } = shardInfo;\n const totalLength = shards.length >= 64 ? 130 : 3 + 2 * shards.length;\n const buffer = new ArrayBuffer(totalLength);\n const view = new DataView(buffer);\n view.setUint16(0, clusterId);\n if (shards.length >= 64) {\n // rsv format (Bit Vector)\n for (const index of shards) {\n const byteIndex = Math.floor(index / 8) + 2; // Adjusted for the 2-byte cluster field\n const bitIndex = 7 - (index % 8);\n view.setUint8(byteIndex, view.getUint8(byteIndex) | (1 << bitIndex));\n }\n }\n else {\n // rs format (Index List)\n view.setUint8(2, shards.length);\n for (let i = 0, offset = 3; i < shards.length; i++, offset += 2) {\n view.setUint16(offset, shards[i]);\n }\n }\n return new Uint8Array(buffer);\n};\n//# sourceMappingURL=relay_shard_codec.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/common/relay_shard_codec.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/common/sharding.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/common/sharding.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ contentTopicToPubsubTopic: () => (/* binding */ contentTopicToPubsubTopic),\n/* harmony export */ contentTopicToShardIndex: () => (/* binding */ contentTopicToShardIndex),\n/* harmony export */ contentTopicsByPubsubTopic: () => (/* binding */ contentTopicsByPubsubTopic),\n/* harmony export */ determinePubsubTopic: () => (/* binding */ determinePubsubTopic),\n/* harmony export */ ensurePubsubTopicIsConfigured: () => (/* binding */ ensurePubsubTopicIsConfigured),\n/* harmony export */ ensureShardingConfigured: () => (/* binding */ ensureShardingConfigured),\n/* harmony export */ ensureValidContentTopic: () => (/* binding */ ensureValidContentTopic),\n/* harmony export */ pubsubTopicToSingleShardInfo: () => (/* binding */ pubsubTopicToSingleShardInfo),\n/* harmony export */ shardInfoToPubsubTopics: () => (/* binding */ shardInfoToPubsubTopics),\n/* harmony export */ singleShardInfoToPubsubTopic: () => (/* binding */ singleShardInfoToPubsubTopic),\n/* harmony export */ singleShardInfosToShardInfo: () => (/* binding */ singleShardInfosToShardInfo)\n/* harmony export */ });\n/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/@noble/hashes/esm/sha256.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _bytes_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bytes/index.js */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n\n\n\nconst singleShardInfoToPubsubTopic = (shardInfo) => {\n if (shardInfo.clusterId === undefined || shardInfo.shard === undefined)\n throw new Error(\"Invalid shard\");\n return `/waku/2/rs/${shardInfo.clusterId}/${shardInfo.shard}`;\n};\nconst singleShardInfosToShardInfo = (singleShardInfos) => {\n if (singleShardInfos.length === 0)\n throw new Error(\"Invalid shard\");\n const clusterIds = singleShardInfos.map((shardInfo) => shardInfo.clusterId);\n if (new Set(clusterIds).size !== 1) {\n throw new Error(\"Passed shard infos have different clusterIds\");\n }\n const shards = singleShardInfos\n .map((shardInfo) => shardInfo.shard)\n .filter((shard) => shard !== undefined);\n return {\n clusterId: singleShardInfos[0].clusterId,\n shards\n };\n};\nconst shardInfoToPubsubTopics = (shardInfo) => {\n if (\"contentTopics\" in shardInfo && shardInfo.contentTopics) {\n // Autosharding: explicitly defined content topics\n return Array.from(new Set(shardInfo.contentTopics.map((contentTopic) => contentTopicToPubsubTopic(contentTopic, shardInfo.clusterId))));\n }\n else if (\"shards\" in shardInfo) {\n // Static sharding\n if (shardInfo.shards === undefined)\n throw new Error(\"Invalid shard\");\n return Array.from(new Set(shardInfo.shards.map((index) => `/waku/2/rs/${shardInfo.clusterId ?? _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_CLUSTER_ID}/${index}`)));\n }\n else if (\"application\" in shardInfo && \"version\" in shardInfo) {\n // Autosharding: single shard from application and version\n return [\n contentTopicToPubsubTopic(`/${shardInfo.application}/${shardInfo.version}/default/default`, shardInfo.clusterId)\n ];\n }\n else {\n throw new Error(\"Missing required configuration in shard parameters\");\n }\n};\nconst pubsubTopicToSingleShardInfo = (pubsubTopics) => {\n const parts = pubsubTopics.split(\"/\");\n if (parts.length != 6 ||\n parts[1] !== \"waku\" ||\n parts[2] !== \"2\" ||\n parts[3] !== \"rs\")\n throw new Error(\"Invalid pubsub topic\");\n const clusterId = parseInt(parts[4]);\n const shard = parseInt(parts[5]);\n if (isNaN(clusterId) || isNaN(shard))\n throw new Error(\"Invalid clusterId or shard\");\n return {\n clusterId,\n shard\n };\n};\n//TODO: move part of BaseProtocol instead of utils\n// return `ProtocolError.TOPIC_NOT_CONFIGURED` instead of throwing\nfunction ensurePubsubTopicIsConfigured(pubsubTopic, configuredTopics) {\n if (!configuredTopics.includes(pubsubTopic)) {\n throw new Error(`Pubsub topic ${pubsubTopic} has not been configured on this instance. Configured topics are: ${configuredTopics}. Please update your configuration by passing in the topic during Waku node instantiation.`);\n }\n}\n/**\n * Given a string, will throw an error if it is not formatted as a valid content topic for autosharding based on https://rfc.vac.dev/spec/51/\n * @param contentTopic String to validate\n * @returns Object with each content topic field as an attribute\n */\nfunction ensureValidContentTopic(contentTopic) {\n const parts = contentTopic.split(\"/\");\n if (parts.length < 5 || parts.length > 6) {\n throw Error(\"Content topic format is invalid\");\n }\n // Validate generation field if present\n let generation = 0;\n if (parts.length == 6) {\n generation = parseInt(parts[1]);\n if (isNaN(generation)) {\n throw new Error(\"Invalid generation field in content topic\");\n }\n if (generation > 0) {\n throw new Error(\"Generation greater than 0 is not supported\");\n }\n }\n // Validate remaining fields\n const fields = parts.splice(-4);\n // Validate application field\n if (fields[0].length == 0) {\n throw new Error(\"Application field cannot be empty\");\n }\n // Validate version field\n if (fields[1].length == 0) {\n throw new Error(\"Version field cannot be empty\");\n }\n // Validate topic name field\n if (fields[2].length == 0) {\n throw new Error(\"Topic name field cannot be empty\");\n }\n // Validate encoding field\n if (fields[3].length == 0) {\n throw new Error(\"Encoding field cannot be empty\");\n }\n return {\n generation,\n application: fields[0],\n version: fields[1],\n topicName: fields[2],\n encoding: fields[3]\n };\n}\n/**\n * Given a string, determines which autoshard index to use for its pubsub topic.\n * Based on the algorithm described in the RFC: https://rfc.vac.dev/spec/51//#algorithm\n */\nfunction contentTopicToShardIndex(contentTopic, networkShards = 8) {\n const { application, version } = ensureValidContentTopic(contentTopic);\n const digest = (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_2__.sha256)((0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_1__.concat)([(0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(application), (0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(version)]));\n const dataview = new DataView(digest.buffer.slice(-8));\n return Number(dataview.getBigUint64(0, false) % BigInt(networkShards));\n}\nfunction contentTopicToPubsubTopic(contentTopic, clusterId = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_CLUSTER_ID, networkShards = 8) {\n if (!contentTopic) {\n throw Error(\"Content topic must be specified\");\n }\n const shardIndex = contentTopicToShardIndex(contentTopic, networkShards);\n return `/waku/2/rs/${clusterId}/${shardIndex}`;\n}\n/**\n * Given an array of content topics, groups them together by their Pubsub topic as derived using the algorithm for autosharding.\n * If any of the content topics are not properly formatted, the function will throw an error.\n */\nfunction contentTopicsByPubsubTopic(contentTopics, clusterId = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_CLUSTER_ID, networkShards = 8) {\n const groupedContentTopics = new Map();\n for (const contentTopic of contentTopics) {\n const pubsubTopic = contentTopicToPubsubTopic(contentTopic, clusterId, networkShards);\n let topics = groupedContentTopics.get(pubsubTopic);\n if (!topics) {\n groupedContentTopics.set(pubsubTopic, []);\n topics = groupedContentTopics.get(pubsubTopic);\n }\n topics.push(contentTopic);\n }\n return groupedContentTopics;\n}\n/**\n * Used when creating encoders/decoders to determine which pubsub topic to use\n */\nfunction determinePubsubTopic(contentTopic, pubsubTopicShardInfo) {\n if (typeof pubsubTopicShardInfo == \"string\") {\n return pubsubTopicShardInfo;\n }\n return pubsubTopicShardInfo?.shard\n ? singleShardInfoToPubsubTopic(pubsubTopicShardInfo)\n : contentTopicToPubsubTopic(contentTopic, pubsubTopicShardInfo?.clusterId || _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_CLUSTER_ID);\n}\n/**\n * Validates sharding configuration and sets defaults where possible.\n * @returns Validated sharding parameters, with any missing values set to defaults\n */\nconst ensureShardingConfigured = (shardInfo) => {\n const clusterId = shardInfo.clusterId ?? _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_CLUSTER_ID;\n const shards = \"shards\" in shardInfo ? shardInfo.shards : [];\n const contentTopics = \"contentTopics\" in shardInfo ? shardInfo.contentTopics : [];\n const [application, version] = \"application\" in shardInfo && \"version\" in shardInfo\n ? [shardInfo.application, shardInfo.version]\n : [undefined, undefined];\n const isShardsConfigured = shards && shards.length > 0;\n const isContentTopicsConfigured = contentTopics && contentTopics.length > 0;\n const isApplicationVersionConfigured = application && version;\n if (isShardsConfigured) {\n return {\n shardingParams: { clusterId, shards },\n shardInfo: { clusterId, shards },\n pubsubTopics: shardInfoToPubsubTopics({ clusterId, shards })\n };\n }\n if (isContentTopicsConfigured) {\n const pubsubTopics = Array.from(new Set(contentTopics.map((topic) => contentTopicToPubsubTopic(topic, clusterId))));\n const shards = Array.from(new Set(contentTopics.map((topic) => contentTopicToShardIndex(topic))));\n return {\n shardingParams: { clusterId, contentTopics },\n shardInfo: { clusterId, shards },\n pubsubTopics\n };\n }\n if (isApplicationVersionConfigured) {\n const pubsubTopic = contentTopicToPubsubTopic(`/${application}/${version}/default/default`, clusterId);\n return {\n shardingParams: { clusterId, application, version },\n shardInfo: {\n clusterId,\n shards: [pubsubTopicToSingleShardInfo(pubsubTopic).shard]\n },\n pubsubTopics: [pubsubTopic]\n };\n }\n throw new Error(\"Missing minimum required configuration options for static sharding or autosharding.\");\n};\n//# sourceMappingURL=sharding.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/common/sharding.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/common/to_async_iterator.js":
|
||
/*!*******************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/common/to_async_iterator.js ***!
|
||
\*******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toAsyncIterator: () => (/* binding */ toAsyncIterator)\n/* harmony export */ });\nconst FRAME_RATE = 60;\n/**\n * Function that transforms IReceiver subscription to iterable stream of data.\n * @param receiver - object that allows to be subscribed to;\n * @param decoder - parameter to be passed to receiver for subscription;\n * @param options - options for receiver for subscription;\n * @param iteratorOptions - optional configuration for iterator;\n * @returns iterator and stop function to terminate it.\n */\nasync function toAsyncIterator(receiver, decoder, iteratorOptions) {\n const iteratorDelay = iteratorOptions?.iteratorDelay ?? FRAME_RATE;\n const messages = [];\n let unsubscribe;\n unsubscribe = await receiver.subscribe(decoder, (message) => {\n messages.push(message);\n });\n const isWithTimeout = Number.isInteger(iteratorOptions?.timeoutMs);\n const timeoutMs = iteratorOptions?.timeoutMs ?? 0;\n const startTime = Date.now();\n async function* iterator() {\n while (true) {\n if (isWithTimeout && Date.now() - startTime >= timeoutMs) {\n return;\n }\n await wait(iteratorDelay);\n const message = messages.shift();\n if (!unsubscribe && messages.length === 0) {\n return message;\n }\n if (!message && unsubscribe) {\n continue;\n }\n yield message;\n }\n }\n return {\n iterator: iterator(),\n async stop() {\n if (unsubscribe) {\n await unsubscribe();\n unsubscribe = undefined;\n }\n }\n };\n}\nfunction wait(ms) {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n//# sourceMappingURL=to_async_iterator.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/common/to_async_iterator.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/index.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Logger: () => (/* reexport safe */ _logger_index_js__WEBPACK_IMPORTED_MODULE_1__.Logger),\n/* harmony export */ contentTopicToPubsubTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.contentTopicToPubsubTopic),\n/* harmony export */ contentTopicToShardIndex: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.contentTopicToShardIndex),\n/* harmony export */ contentTopicsByPubsubTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.contentTopicsByPubsubTopic),\n/* harmony export */ decodeRelayShard: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.decodeRelayShard),\n/* harmony export */ determinePubsubTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.determinePubsubTopic),\n/* harmony export */ encodeRelayShard: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.encodeRelayShard),\n/* harmony export */ ensurePubsubTopicIsConfigured: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.ensurePubsubTopicIsConfigured),\n/* harmony export */ ensureShardingConfigured: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.ensureShardingConfigured),\n/* harmony export */ ensureValidContentTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.ensureValidContentTopic),\n/* harmony export */ getPseudoRandomSubset: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.getPseudoRandomSubset),\n/* harmony export */ getWsMultiaddrFromMultiaddrs: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.getWsMultiaddrFromMultiaddrs),\n/* harmony export */ groupByContentTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.groupByContentTopic),\n/* harmony export */ isDefined: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.isDefined),\n/* harmony export */ isMessageSizeUnderCap: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.isMessageSizeUnderCap),\n/* harmony export */ isWireSizeUnderCap: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.isWireSizeUnderCap),\n/* harmony export */ pubsubTopicToSingleShardInfo: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.pubsubTopicToSingleShardInfo),\n/* harmony export */ pushOrInitMapSet: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.pushOrInitMapSet),\n/* harmony export */ removeItemFromArray: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.removeItemFromArray),\n/* harmony export */ shardInfoToPubsubTopics: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.shardInfoToPubsubTopics),\n/* harmony export */ singleShardInfoToPubsubTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.singleShardInfoToPubsubTopic),\n/* harmony export */ singleShardInfosToShardInfo: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.singleShardInfosToShardInfo),\n/* harmony export */ toAsyncIterator: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.toAsyncIterator)\n/* harmony export */ });\n/* harmony import */ var _common_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common/index.js */ \"./node_modules/@waku/utils/dist/common/index.js\");\n/* harmony import */ var _logger_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger/index.js */ \"./node_modules/@waku/utils/dist/logger/index.js\");\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/libp2p/index.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/libp2p/index.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getConnectedPeersForProtocolAndShard: () => (/* binding */ getConnectedPeersForProtocolAndShard),\n/* harmony export */ getPeersForProtocol: () => (/* binding */ getPeersForProtocol),\n/* harmony export */ selectConnection: () => (/* binding */ selectConnection),\n/* harmony export */ selectRandomPeer: () => (/* binding */ selectRandomPeer),\n/* harmony export */ sortPeersByLatency: () => (/* binding */ sortPeersByLatency)\n/* harmony export */ });\n/* harmony import */ var _bytes_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes/index.js */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _common_relay_shard_codec_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/relay_shard_codec.js */ \"./node_modules/@waku/utils/dist/common/relay_shard_codec.js\");\n\n\n/**\n * Returns a pseudo-random peer that supports the given protocol.\n * Useful for protocols such as store and light push\n */\nfunction selectRandomPeer(peers) {\n if (peers.length === 0)\n return;\n const index = Math.round(Math.random() * (peers.length - 1));\n return peers[index];\n}\n/**\n * Function to sort peers by latency from lowest to highest\n * @param peerStore - The Libp2p PeerStore\n * @param peers - The list of peers to choose from\n * @returns Sorted array of peers by latency\n */\nasync function sortPeersByLatency(peerStore, peers) {\n if (peers.length === 0)\n return [];\n const results = await Promise.all(peers.map(async (peer) => {\n try {\n const pingBytes = (await peerStore.get(peer.id)).metadata.get(\"ping\");\n if (!pingBytes)\n return { peer, ping: Infinity };\n const ping = Number((0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_0__.bytesToUtf8)(pingBytes));\n return { peer, ping };\n }\n catch (error) {\n return { peer, ping: Infinity };\n }\n }));\n // filter out null values\n const validResults = results.filter((result) => result !== null);\n return validResults\n .sort((a, b) => a.ping - b.ping)\n .map((result) => result.peer);\n}\n/**\n * Returns the list of peers that supports the given protocol.\n */\nasync function getPeersForProtocol(peerStore, protocols) {\n const peers = [];\n await peerStore.forEach((peer) => {\n for (let i = 0; i < protocols.length; i++) {\n if (peer.protocols.includes(protocols[i])) {\n peers.push(peer);\n break;\n }\n }\n });\n return peers;\n}\nasync function getConnectedPeersForProtocolAndShard(connections, peerStore, protocols, shardInfo) {\n const openConnections = connections.filter((connection) => connection.status === \"open\");\n const peerPromises = openConnections.map(async (connection) => {\n const peer = await peerStore.get(connection.remotePeer);\n const supportsProtocol = protocols.some((protocol) => peer.protocols.includes(protocol));\n if (supportsProtocol) {\n if (shardInfo) {\n const encodedPeerShardInfo = peer.metadata.get(\"shardInfo\");\n const peerShardInfo = encodedPeerShardInfo && (0,_common_relay_shard_codec_js__WEBPACK_IMPORTED_MODULE_1__.decodeRelayShard)(encodedPeerShardInfo);\n if (peerShardInfo && shardInfo.clusterId === peerShardInfo.clusterId) {\n return peer;\n }\n }\n else {\n return peer;\n }\n }\n return null;\n });\n const peersWithNulls = await Promise.all(peerPromises);\n return peersWithNulls.filter((peer) => peer !== null);\n}\nfunction selectConnection(connections) {\n if (!connections.length)\n return;\n if (connections.length === 1)\n return connections[0];\n let latestConnection;\n connections.forEach((connection) => {\n if (connection.status === \"open\") {\n if (!latestConnection) {\n latestConnection = connection;\n }\n else if (connection.timeline.open > latestConnection.timeline.open) {\n latestConnection = connection;\n }\n }\n });\n return latestConnection;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/libp2p/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/dist/logger/index.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@waku/utils/dist/logger/index.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Logger: () => (/* binding */ Logger)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n\nconst APP_NAME = \"waku\";\nclass Logger {\n _info;\n _warn;\n _error;\n static createDebugNamespace(level, prefix) {\n return prefix ? `${APP_NAME}:${level}:${prefix}` : `${APP_NAME}:${level}`;\n }\n constructor(prefix) {\n this._info = debug__WEBPACK_IMPORTED_MODULE_0__(Logger.createDebugNamespace(\"info\", prefix));\n this._warn = debug__WEBPACK_IMPORTED_MODULE_0__(Logger.createDebugNamespace(\"warn\", prefix));\n this._error = debug__WEBPACK_IMPORTED_MODULE_0__(Logger.createDebugNamespace(\"error\", prefix));\n }\n get info() {\n return this._info;\n }\n get warn() {\n return this._warn;\n }\n get error() {\n return this._error;\n }\n log(level, ...args) {\n const logger = this[level];\n logger(...args);\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/dist/logger/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/connection_manager.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/connection_manager.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EConnectionStateEvents: () => (/* binding */ EConnectionStateEvents),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* binding */ EPeersByDiscoveryEvents),\n/* harmony export */ Tags: () => (/* binding */ Tags)\n/* harmony export */ });\nvar Tags;\n(function (Tags) {\n Tags[\"BOOTSTRAP\"] = \"bootstrap\";\n Tags[\"PEER_EXCHANGE\"] = \"peer-exchange\";\n Tags[\"LOCAL\"] = \"local-peer-cache\";\n})(Tags || (Tags = {}));\nvar EPeersByDiscoveryEvents;\n(function (EPeersByDiscoveryEvents) {\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_BOOTSTRAP\"] = \"peer:discovery:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_PEER_EXCHANGE\"] = \"peer:discovery:peer-exchange\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_BOOTSTRAP\"] = \"peer:connected:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_PEER_EXCHANGE\"] = \"peer:connected:peer-exchange\";\n})(EPeersByDiscoveryEvents || (EPeersByDiscoveryEvents = {}));\nvar EConnectionStateEvents;\n(function (EConnectionStateEvents) {\n EConnectionStateEvents[\"CONNECTION_STATUS\"] = \"waku:connection\";\n})(EConnectionStateEvents || (EConnectionStateEvents = {}));\n//# sourceMappingURL=connection_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/connection_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/constants.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/constants.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_CLUSTER_ID: () => (/* binding */ DEFAULT_CLUSTER_ID),\n/* harmony export */ DefaultPubsubTopic: () => (/* binding */ DefaultPubsubTopic)\n/* harmony export */ });\n/**\n * DefaultPubsubTopic is the default gossipsub topic to use for Waku.\n */\nconst DefaultPubsubTopic = \"/waku/2/default-waku/proto\";\n/**\n * The default cluster ID for The Waku Network\n */\nconst DEFAULT_CLUSTER_ID = 1;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/dns_discovery.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/dns_discovery.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=dns_discovery.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/dns_discovery.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/enr.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/enr.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=enr.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/enr.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/filter.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/filter.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=filter.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/filter.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/index.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/index.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_CLUSTER_ID: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_17__.DEFAULT_CLUSTER_ID),\n/* harmony export */ DefaultPubsubTopic: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_17__.DefaultPubsubTopic),\n/* harmony export */ EConnectionStateEvents: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.EConnectionStateEvents),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.EPeersByDiscoveryEvents),\n/* harmony export */ PageDirection: () => (/* reexport safe */ _store_js__WEBPACK_IMPORTED_MODULE_7__.PageDirection),\n/* harmony export */ ProtocolError: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.ProtocolError),\n/* harmony export */ Protocols: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.Protocols),\n/* harmony export */ Tags: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.Tags)\n/* harmony export */ });\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/enr.js\");\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filter.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/filter.js\");\n/* harmony import */ var _light_push_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./light_push.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/light_push.js\");\n/* harmony import */ var _message_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/message.js\");\n/* harmony import */ var _peer_exchange_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer_exchange.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/peer_exchange.js\");\n/* harmony import */ var _protocols_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./protocols.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/protocols.js\");\n/* harmony import */ var _relay_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./relay.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/relay.js\");\n/* harmony import */ var _store_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./store.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/store.js\");\n/* harmony import */ var _waku_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./waku.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/waku.js\");\n/* harmony import */ var _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./connection_manager.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/connection_manager.js\");\n/* harmony import */ var _sender_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sender.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/sender.js\");\n/* harmony import */ var _receiver_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./receiver.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/receiver.js\");\n/* harmony import */ var _misc_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./misc.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/misc.js\");\n/* harmony import */ var _libp2p_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./libp2p.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/libp2p.js\");\n/* harmony import */ var _keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./keep_alive_manager.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/keep_alive_manager.js\");\n/* harmony import */ var _dns_discovery_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./dns_discovery.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/dns_discovery.js\");\n/* harmony import */ var _metadata_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./metadata.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/metadata.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/constants.js\");\n/* harmony import */ var _local_storage_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./local_storage.js */ \"./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/local_storage.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/keep_alive_manager.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/keep_alive_manager.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=keep_alive_manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/keep_alive_manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/libp2p.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/libp2p.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=libp2p.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/libp2p.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/light_push.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/light_push.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/light_push.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/local_storage.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/local_storage.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=local_storage.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/local_storage.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/message.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/message.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/metadata.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/metadata.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=metadata.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/metadata.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/misc.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/misc.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=misc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/misc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/peer_exchange.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/peer_exchange.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=peer_exchange.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/peer_exchange.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/protocols.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/protocols.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ProtocolError: () => (/* binding */ ProtocolError),\n/* harmony export */ Protocols: () => (/* binding */ Protocols)\n/* harmony export */ });\nvar Protocols;\n(function (Protocols) {\n Protocols[\"Relay\"] = \"relay\";\n Protocols[\"Store\"] = \"store\";\n Protocols[\"LightPush\"] = \"lightpush\";\n Protocols[\"Filter\"] = \"filter\";\n})(Protocols || (Protocols = {}));\nvar ProtocolError;\n(function (ProtocolError) {\n /** Could not determine the origin of the fault. Best to check connectivity and try again */\n ProtocolError[\"GENERIC_FAIL\"] = \"Generic error\";\n /**\n * Failure to protobuf encode the message. This is not recoverable and needs\n * further investigation.\n */\n ProtocolError[\"ENCODE_FAILED\"] = \"Failed to encode\";\n /**\n * Failure to protobuf decode the message. May be due to a remote peer issue,\n * ensuring that messages are sent via several peer enable mitigation of this error.\n */\n ProtocolError[\"DECODE_FAILED\"] = \"Failed to decode\";\n /**\n * The message payload is empty, making the message invalid. Ensure that a non-empty\n * payload is set on the outgoing message.\n */\n ProtocolError[\"EMPTY_PAYLOAD\"] = \"Payload is empty\";\n /**\n * The message size is above the maximum message size allowed on the Waku Network.\n * Compressing the message or using an alternative strategy for large messages is recommended.\n */\n ProtocolError[\"SIZE_TOO_BIG\"] = \"Size is too big\";\n /**\n * The PubsubTopic passed to the send function is not configured on the Waku node.\n * Please ensure that the PubsubTopic is used when initializing the Waku node.\n */\n ProtocolError[\"TOPIC_NOT_CONFIGURED\"] = \"Topic not configured\";\n /**\n * Failure to find a peer with suitable protocols. This may due to a connection issue.\n * Mitigation can be: retrying after a given time period, display connectivity issue\n * to user or listening for `peer:connected:bootstrap` or `peer:connected:peer-exchange`\n * on the connection manager before retrying.\n */\n ProtocolError[\"NO_PEER_AVAILABLE\"] = \"No peer available\";\n /**\n * The remote peer did not behave as expected. Mitigation for `NO_PEER_AVAILABLE`\n * or `DECODE_FAILED` can be used.\n */\n ProtocolError[\"REMOTE_PEER_FAULT\"] = \"Remote peer fault\";\n /**\n * The remote peer rejected the message. Information provided by the remote peer\n * is logged. Review message validity, or mitigation for `NO_PEER_AVAILABLE`\n * or `DECODE_FAILED` can be used.\n */\n ProtocolError[\"REMOTE_PEER_REJECTED\"] = \"Remote peer rejected\";\n /**\n * The protocol request timed out without a response. This may be due to a connection issue.\n * Mitigation can be: retrying after a given time period\n */\n ProtocolError[\"REQUEST_TIMEOUT\"] = \"Request timeout\";\n})(ProtocolError || (ProtocolError = {}));\n//# sourceMappingURL=protocols.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/protocols.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/receiver.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/receiver.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=receiver.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/receiver.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/relay.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/relay.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=relay.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/relay.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/sender.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/sender.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=sender.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/sender.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/store.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/store.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PageDirection: () => (/* binding */ PageDirection)\n/* harmony export */ });\nvar PageDirection;\n(function (PageDirection) {\n PageDirection[\"BACKWARD\"] = \"backward\";\n PageDirection[\"FORWARD\"] = \"forward\";\n})(PageDirection || (PageDirection = {}));\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/store.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/waku.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/waku.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=waku.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/@waku/interfaces/dist/waku.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/@waku/utils/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/any-signal/dist/src/index.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/any-signal/dist/src/index.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ anySignal: () => (/* binding */ anySignal)\n/* harmony export */ });\n/**\n * Takes an array of AbortSignals and returns a single signal.\n * If any signals are aborted, the returned signal will be aborted.\n */\nfunction anySignal(signals) {\n const controller = new globalThis.AbortController();\n function onAbort() {\n controller.abort();\n for (const signal of signals) {\n if (signal?.removeEventListener != null) {\n signal.removeEventListener('abort', onAbort);\n }\n }\n }\n for (const signal of signals) {\n if (signal?.aborted === true) {\n onAbort();\n break;\n }\n if (signal?.addEventListener != null) {\n signal.addEventListener('abort', onAbort);\n }\n }\n function clear() {\n for (const signal of signals) {\n if (signal?.removeEventListener != null) {\n signal.removeEventListener('abort', onAbort);\n }\n }\n }\n const signal = controller.signal;\n signal.clear = clear;\n return signal;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/any-signal/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/datastore-core/dist/src/base.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/datastore-core/dist/src/base.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BaseDatastore: () => (/* binding */ BaseDatastore)\n/* harmony export */ });\n/* harmony import */ var it_drain__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-drain */ \"./node_modules/it-drain/dist/src/index.js\");\n/* harmony import */ var it_filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-filter */ \"./node_modules/it-filter/dist/src/index.js\");\n/* harmony import */ var it_sort__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-sort */ \"./node_modules/it-sort/dist/src/index.js\");\n/* harmony import */ var it_take__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-take */ \"./node_modules/it-take/dist/src/index.js\");\n\n\n\n\nclass BaseDatastore {\n put(key, val, options) {\n return Promise.reject(new Error('.put is not implemented'));\n }\n get(key, options) {\n return Promise.reject(new Error('.get is not implemented'));\n }\n has(key, options) {\n return Promise.reject(new Error('.has is not implemented'));\n }\n delete(key, options) {\n return Promise.reject(new Error('.delete is not implemented'));\n }\n async *putMany(source, options = {}) {\n for await (const { key, value } of source) {\n await this.put(key, value, options);\n yield key;\n }\n }\n async *getMany(source, options = {}) {\n for await (const key of source) {\n yield {\n key,\n value: await this.get(key, options)\n };\n }\n }\n async *deleteMany(source, options = {}) {\n for await (const key of source) {\n await this.delete(key, options);\n yield key;\n }\n }\n batch() {\n let puts = [];\n let dels = [];\n return {\n put(key, value) {\n puts.push({ key, value });\n },\n delete(key) {\n dels.push(key);\n },\n commit: async (options) => {\n await (0,it_drain__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.putMany(puts, options));\n puts = [];\n await (0,it_drain__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.deleteMany(dels, options));\n dels = [];\n }\n };\n }\n /**\n * Extending classes should override `query` or implement this method\n */\n // eslint-disable-next-line require-yield\n async *_all(q, options) {\n throw new Error('._all is not implemented');\n }\n /**\n * Extending classes should override `queryKeys` or implement this method\n */\n // eslint-disable-next-line require-yield\n async *_allKeys(q, options) {\n throw new Error('._allKeys is not implemented');\n }\n query(q, options) {\n let it = this._all(q, options);\n if (q.prefix != null) {\n const prefix = q.prefix;\n it = (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, (e) => e.key.toString().startsWith(prefix));\n }\n if (Array.isArray(q.filters)) {\n it = q.filters.reduce((it, f) => (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, f), it);\n }\n if (Array.isArray(q.orders)) {\n it = q.orders.reduce((it, f) => (0,it_sort__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(it, f), it);\n }\n if (q.offset != null) {\n let i = 0;\n const offset = q.offset;\n it = (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, () => i++ >= offset);\n }\n if (q.limit != null) {\n it = (0,it_take__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(it, q.limit);\n }\n return it;\n }\n queryKeys(q, options) {\n let it = this._allKeys(q, options);\n if (q.prefix != null) {\n const prefix = q.prefix;\n it = (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, (key) => key.toString().startsWith(prefix));\n }\n if (Array.isArray(q.filters)) {\n it = q.filters.reduce((it, f) => (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, f), it);\n }\n if (Array.isArray(q.orders)) {\n it = q.orders.reduce((it, f) => (0,it_sort__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(it, f), it);\n }\n if (q.offset != null) {\n const offset = q.offset;\n let i = 0;\n it = (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, () => i++ >= offset);\n }\n if (q.limit != null) {\n it = (0,it_take__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(it, q.limit);\n }\n return it;\n }\n}\n//# sourceMappingURL=base.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/datastore-core/dist/src/base.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/datastore-core/dist/src/errors.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/datastore-core/dist/src/errors.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ abortedError: () => (/* binding */ abortedError),\n/* harmony export */ dbDeleteFailedError: () => (/* binding */ dbDeleteFailedError),\n/* harmony export */ dbOpenFailedError: () => (/* binding */ dbOpenFailedError),\n/* harmony export */ dbReadFailedError: () => (/* binding */ dbReadFailedError),\n/* harmony export */ dbWriteFailedError: () => (/* binding */ dbWriteFailedError),\n/* harmony export */ notFoundError: () => (/* binding */ notFoundError)\n/* harmony export */ });\n/* harmony import */ var err_code__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! err-code */ \"./node_modules/err-code/index.js\");\n\nfunction dbOpenFailedError(err) {\n err = err ?? new Error('Cannot open database');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_DB_OPEN_FAILED');\n}\nfunction dbDeleteFailedError(err) {\n err = err ?? new Error('Delete failed');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_DB_DELETE_FAILED');\n}\nfunction dbWriteFailedError(err) {\n err = err ?? new Error('Write failed');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_DB_WRITE_FAILED');\n}\nfunction dbReadFailedError(err) {\n err = err ?? new Error('Read failed');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_DB_READ_FAILED');\n}\nfunction notFoundError(err) {\n err = err ?? new Error('Not Found');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_NOT_FOUND');\n}\nfunction abortedError(err) {\n err = err ?? new Error('Aborted');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_ABORTED');\n}\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/datastore-core/dist/src/errors.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/datastore-core/dist/src/memory.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/datastore-core/dist/src/memory.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MemoryDatastore: () => (/* binding */ MemoryDatastore)\n/* harmony export */ });\n/* harmony import */ var interface_datastore_key__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! interface-datastore/key */ \"./node_modules/interface-datastore/dist/src/key.js\");\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base.js */ \"./node_modules/datastore-core/dist/src/base.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/datastore-core/dist/src/errors.js\");\n\n\n\nclass MemoryDatastore extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseDatastore {\n data;\n constructor() {\n super();\n this.data = new Map();\n }\n put(key, val) {\n this.data.set(key.toString(), val);\n return key;\n }\n get(key) {\n const result = this.data.get(key.toString());\n if (result == null) {\n throw _errors_js__WEBPACK_IMPORTED_MODULE_2__.notFoundError();\n }\n return result;\n }\n has(key) {\n return this.data.has(key.toString());\n }\n delete(key) {\n this.data.delete(key.toString());\n }\n *_all() {\n for (const [key, value] of this.data.entries()) {\n yield { key: new interface_datastore_key__WEBPACK_IMPORTED_MODULE_0__.Key(key), value };\n }\n }\n *_allKeys() {\n for (const key of this.data.keys()) {\n yield new interface_datastore_key__WEBPACK_IMPORTED_MODULE_0__.Key(key);\n }\n }\n}\n//# sourceMappingURL=memory.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/datastore-core/dist/src/memory.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/delay/index.js":
|
||
/*!*************************************!*\
|
||
!*** ./node_modules/delay/index.js ***!
|
||
\*************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clearDelay: () => (/* binding */ clearDelay),\n/* harmony export */ createDelay: () => (/* binding */ createDelay),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ rangeDelay: () => (/* binding */ rangeDelay)\n/* harmony export */ });\n// From https://github.com/sindresorhus/random-int/blob/c37741b56f76b9160b0b63dae4e9c64875128146/index.js#L13-L15\nconst randomInteger = (minimum, maximum) => Math.floor((Math.random() * (maximum - minimum + 1)) + minimum);\n\nconst createAbortError = () => {\n\tconst error = new Error('Delay aborted');\n\terror.name = 'AbortError';\n\treturn error;\n};\n\nconst clearMethods = new WeakMap();\n\nfunction createDelay({clearTimeout: defaultClear, setTimeout: defaultSet} = {}) {\n\t// We cannot use `async` here as we need the promise identity.\n\treturn (milliseconds, {value, signal} = {}) => {\n\t\t// TODO: Use `signal?.throwIfAborted()` when targeting Node.js 18.\n\t\tif (signal?.aborted) {\n\t\t\treturn Promise.reject(createAbortError());\n\t\t}\n\n\t\tlet timeoutId;\n\t\tlet settle;\n\t\tlet rejectFunction;\n\t\tconst clear = defaultClear ?? clearTimeout;\n\n\t\tconst signalListener = () => {\n\t\t\tclear(timeoutId);\n\t\t\trejectFunction(createAbortError());\n\t\t};\n\n\t\tconst cleanup = () => {\n\t\t\tif (signal) {\n\t\t\t\tsignal.removeEventListener('abort', signalListener);\n\t\t\t}\n\t\t};\n\n\t\tconst delayPromise = new Promise((resolve, reject) => {\n\t\t\tsettle = () => {\n\t\t\t\tcleanup();\n\t\t\t\tresolve(value);\n\t\t\t};\n\n\t\t\trejectFunction = reject;\n\t\t\ttimeoutId = (defaultSet ?? setTimeout)(settle, milliseconds);\n\t\t});\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', signalListener, {once: true});\n\t\t}\n\n\t\tclearMethods.set(delayPromise, () => {\n\t\t\tclear(timeoutId);\n\t\t\ttimeoutId = null;\n\t\t\tsettle();\n\t\t});\n\n\t\treturn delayPromise;\n\t};\n}\n\nconst delay = createDelay();\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (delay);\n\nasync function rangeDelay(minimum, maximum, options = {}) {\n\treturn delay(randomInteger(minimum, maximum), options);\n}\n\nfunction clearDelay(promise) {\n\tclearMethods.get(promise)?.();\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/delay/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/dns-query/common.mjs":
|
||
/*!*******************************************!*\
|
||
!*** ./node_modules/dns-query/common.mjs ***!
|
||
\*******************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ BaseEndpoint: () => (/* binding */ BaseEndpoint),\n/* harmony export */ HTTPEndpoint: () => (/* binding */ HTTPEndpoint),\n/* harmony export */ HTTPStatusError: () => (/* binding */ HTTPStatusError),\n/* harmony export */ InvalidProtocolError: () => (/* binding */ InvalidProtocolError),\n/* harmony export */ ResponseError: () => (/* binding */ ResponseError),\n/* harmony export */ TimeoutError: () => (/* binding */ TimeoutError),\n/* harmony export */ UDP4Endpoint: () => (/* binding */ UDP4Endpoint),\n/* harmony export */ UDP6Endpoint: () => (/* binding */ UDP6Endpoint),\n/* harmony export */ UDPEndpoint: () => (/* binding */ UDPEndpoint),\n/* harmony export */ URL: () => (/* binding */ URL),\n/* harmony export */ parseEndpoint: () => (/* binding */ parseEndpoint),\n/* harmony export */ reduceError: () => (/* binding */ reduceError),\n/* harmony export */ supportedProtocols: () => (/* binding */ supportedProtocols),\n/* harmony export */ toEndpoint: () => (/* binding */ toEndpoint)\n/* harmony export */ });\nlet AbortError = typeof global !== 'undefined' ? global.AbortError : typeof window !== 'undefined' ? window.AbortError : null\nif (!AbortError) {\n AbortError = class AbortError extends Error {\n constructor (message = 'Request aborted.') {\n super(message)\n }\n }\n}\nAbortError.prototype.name = 'AbortError'\nAbortError.prototype.code = 'ABORT_ERR'\n\nconst URL = (typeof globalThis !== 'undefined' && globalThis.URL) || require('url').URL\n\n\n\nclass HTTPStatusError extends Error {\n constructor (uri, code, method) {\n super('status=' + code + ' while requesting ' + uri + ' [' + method + ']')\n this.uri = uri\n this.status = code\n this.method = method\n }\n\n toJSON () {\n return {\n code: this.code,\n uri: this.uri,\n status: this.status,\n method: this.method,\n endpoint: this.endpoint\n }\n }\n}\nHTTPStatusError.prototype.name = 'HTTPStatusError'\nHTTPStatusError.prototype.code = 'HTTP_STATUS'\n\nclass ResponseError extends Error {\n constructor (message, cause) {\n super(message)\n this.cause = cause\n }\n\n toJSON () {\n return {\n message: this.message,\n endpoint: this.endpoint,\n code: this.code,\n cause: reduceError(this.cause)\n }\n }\n}\nResponseError.prototype.name = 'ResponseError'\nResponseError.prototype.code = 'RESPONSE_ERR'\n\nclass TimeoutError extends Error {\n constructor (timeout) {\n super('Timeout (t=' + timeout + ').')\n this.timeout = timeout\n }\n\n toJSON () {\n return {\n code: this.code,\n endpoint: this.endpoint,\n timeout: this.timeout\n }\n }\n}\nTimeoutError.prototype.name = 'TimeoutError'\nTimeoutError.prototype.code = 'ETIMEOUT'\n\nconst v4Regex = /^((\\d{1,3}\\.){3,3}\\d{1,3})(:(\\d{2,5}))?$/\nconst v6Regex = /^((::)?(((\\d{1,3}\\.){3}(\\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\\d{2,5}))?$/i\n\nfunction reduceError (err) {\n if (typeof err === 'string') {\n return {\n message: err\n }\n }\n try {\n const json = JSON.stringify(err)\n if (json !== '{}') {\n return JSON.parse(json)\n }\n } catch (e) {}\n const error = {\n message: String(err.message || err)\n }\n if (err.code !== undefined) {\n error.code = String(err.code)\n }\n return error\n}\n\nconst baseParts = /^(([a-z0-9]+:)\\/\\/)?([^/[\\s:]+|\\[[^\\]]+\\])?(:([^/\\s]+))?(\\/[^\\s]*)?(.*)$/\nconst httpFlags = /\\[(post|get|((ipv4|ipv6|name)=([^\\]]+)))\\]/ig\nconst updFlags = /\\[(((pk|name)=([^\\]]+)))\\]/ig\n\nfunction parseEndpoint (endpoint) {\n const parts = baseParts.exec(endpoint)\n const protocol = parts[2] || 'https:'\n const host = parts[3]\n const port = parts[5]\n const path = parts[6]\n const rest = parts[7]\n if (protocol === 'https:' || protocol === 'http:') {\n const flags = parseFlags(rest, httpFlags)\n return {\n name: flags.name,\n protocol,\n ipv4: flags.ipv4,\n ipv6: flags.ipv6,\n host,\n port,\n path,\n method: flags.post ? 'POST' : 'GET'\n }\n }\n if (protocol === 'udp:' || protocol === 'udp4:' || protocol === 'udp6:') {\n const flags = parseFlags(rest, updFlags)\n const v6Parts = /^\\[(.*)\\]$/.exec(host)\n if (v6Parts && protocol === 'udp4:') {\n throw new Error(`Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=${endpoint})`)\n }\n if (!v6Parts && protocol === 'udp6:') {\n throw new Error(`Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=${endpoint})`)\n }\n if (v6Parts) {\n return new UDP6Endpoint({ protocol: 'udp6:', ipv6: v6Parts[1], port, pk: flags.pk, name: flags.name })\n }\n return new UDP4Endpoint({ protocol: 'udp4:', ipv4: host, port, pk: flags.pk, name: flags.name })\n }\n throw new InvalidProtocolError(protocol, endpoint)\n}\n\nfunction parseFlags (rest, regex) {\n regex.lastIndex = 0\n const result = {}\n while (true) {\n const match = regex.exec(rest)\n if (!match) break\n if (match[2]) {\n result[match[3].toLowerCase()] = match[4]\n } else {\n result[match[1].toLowerCase()] = true\n }\n }\n return result\n}\n\nclass InvalidProtocolError extends Error {\n constructor (protocol, endpoint) {\n super(`Invalid Endpoint: unsupported protocol \"${protocol}\" for endpoint: ${endpoint}, supported protocols: ${supportedProtocols.join(', ')}`)\n this.protocol = protocol\n this.endpoint = endpoint\n }\n\n toJSON () {\n return {\n code: this.code,\n endpoint: this.endpoint,\n timeout: this.timeout\n }\n }\n}\nInvalidProtocolError.prototype.name = 'InvalidProtocolError'\nInvalidProtocolError.prototype.code = 'EPROTOCOL'\n\nconst supportedProtocols = ['http:', 'https:', 'udp4:', 'udp6:']\n\nclass BaseEndpoint {\n constructor (opts, isHTTP) {\n this.name = opts.name || null\n this.protocol = opts.protocol\n const port = typeof opts.port === 'string' ? opts.port = parseInt(opts.port, 10) : opts.port\n if (port === undefined || port === null) {\n this.port = isHTTP\n ? (this.protocol === 'https:' ? 443 : 80)\n : (opts.pk ? 443 : 53)\n } else if (typeof port !== 'number' && !isNaN(port)) {\n throw new Error(`Invalid Endpoint: port \"${opts.port}\" needs to be a number: ${JSON.stringify(opts)}`)\n } else {\n this.port = port\n }\n }\n\n toJSON () {\n return this.toString()\n }\n}\n\nclass UDPEndpoint extends BaseEndpoint {\n constructor (opts) {\n super(opts, false)\n this.pk = opts.pk || null\n }\n\n toString () {\n const port = this.port !== (this.pk ? 443 : 53) ? `:${this.port}` : ''\n const pk = this.pk ? ` [pk=${this.pk}]` : ''\n const name = this.name ? ` [name=${this.name}]` : ''\n return `udp://${this.ipv4 || `[${this.ipv6}]`}${port}${pk}${name}`\n }\n}\n\nclass UDP4Endpoint extends UDPEndpoint {\n constructor (opts) {\n super(Object.assign({ protocol: 'udp4:' }, opts))\n if (!opts.ipv4 || typeof opts.ipv4 !== 'string') {\n throw new Error(`Invalid Endpoint: .ipv4 \"${opts.ipv4}\" needs to be set: ${JSON.stringify(opts)}`)\n }\n this.ipv4 = opts.ipv4\n }\n}\n\nclass UDP6Endpoint extends UDPEndpoint {\n constructor (opts) {\n super(Object.assign({ protocol: 'udp6:' }, opts))\n if (!opts.ipv6 || typeof opts.ipv6 !== 'string') {\n throw new Error(`Invalid Endpoint: .ipv6 \"${opts.ipv6}\" needs to be set: ${JSON.stringify(opts)}`)\n }\n this.ipv6 = opts.ipv6\n }\n}\n\nfunction safeHost (host) {\n return v6Regex.test(host) && !v4Regex.test(host) ? `[${host}]` : host\n}\n\nclass HTTPEndpoint extends BaseEndpoint {\n constructor (opts) {\n super(Object.assign({ protocol: 'https:' }, opts), true)\n if (!opts.host) {\n if (opts.ipv4) {\n opts.host = opts.ipv4\n }\n if (opts.ipv6) {\n opts.host = `[${opts.ipv6}]`\n }\n }\n if (!opts.host || typeof opts.host !== 'string') {\n throw new Error(`Invalid Endpoint: host \"${opts.path}\" needs to be set: ${JSON.stringify(opts)}`)\n }\n this.host = opts.host\n this.path = opts.path || '/dns-query'\n this.method = /^post$/i.test(opts.method) ? 'POST' : 'GET'\n this.ipv4 = opts.ipv4\n this.ipv6 = opts.ipv6\n if (!this.ipv6) {\n const v6Parts = v6Regex.exec(this.host)\n if (v6Parts) {\n this.ipv6 = v6Parts[1]\n }\n }\n if (!this.ipv4) {\n if (v4Regex.test(this.host)) {\n this.ipv4 = this.host\n }\n }\n const url = `${this.protocol}//${safeHost(this.host)}:${this.port}${this.path}`\n try {\n this.url = new URL(url)\n } catch (err) {\n throw new Error(err.message + ` [${url}]`)\n }\n }\n\n toString () {\n const protocol = this.protocol === 'https:' ? '' : 'http://'\n const port = this.port !== (this.protocol === 'https:' ? 443 : 80) ? `:${this.port}` : ''\n const method = this.method !== 'GET' ? ' [post]' : ''\n const path = this.path === '/dns-query' ? '' : this.path\n const name = this.name ? ` [name=${this.name}]` : ''\n const ipv4 = this.ipv4 && this.ipv4 !== this.host ? ` [ipv4=${this.ipv4}]` : ''\n const ipv6 = this.ipv6 && this.ipv6 !== this.host ? ` [ipv6=${this.ipv6}]` : ''\n return `${protocol}${safeHost(this.host)}${port}${path}${method}${ipv4}${ipv6}${name}`\n }\n}\n\nfunction toEndpoint (input) {\n let opts\n if (typeof input === 'string') {\n opts = parseEndpoint(input)\n } else {\n if (typeof input !== 'object' || input === null || Array.isArray(input)) {\n throw new Error(`Can not convert ${input} to an endpoint`)\n } else if (input instanceof BaseEndpoint) {\n return input\n }\n opts = input\n }\n if (opts.protocol === null || opts.protocol === undefined) {\n opts.protocol = 'https:'\n }\n const protocol = opts.protocol\n if (protocol === 'udp4:') {\n return new UDP4Endpoint(opts)\n }\n if (protocol === 'udp6:') {\n return new UDP6Endpoint(opts)\n }\n if (protocol === 'https:' || protocol === 'http:') {\n return new HTTPEndpoint(opts)\n }\n throw new InvalidProtocolError(protocol, JSON.stringify(opts))\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/dns-query/common.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/dns-query/index.mjs":
|
||
/*!******************************************!*\
|
||
!*** ./node_modules/dns-query/index.mjs ***!
|
||
\******************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.AbortError),\n/* harmony export */ BaseEndpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.BaseEndpoint),\n/* harmony export */ DNSRcodeError: () => (/* binding */ DNSRcodeError),\n/* harmony export */ DNS_RCODE_ERROR: () => (/* binding */ DNS_RCODE_ERROR),\n/* harmony export */ DNS_RCODE_MESSAGE: () => (/* binding */ DNS_RCODE_MESSAGE),\n/* harmony export */ HTTPEndpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.HTTPEndpoint),\n/* harmony export */ HTTPStatusError: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.HTTPStatusError),\n/* harmony export */ ResponseError: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.ResponseError),\n/* harmony export */ TimeoutError: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.TimeoutError),\n/* harmony export */ UDP4Endpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.UDP4Endpoint),\n/* harmony export */ UDP6Endpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.UDP6Endpoint),\n/* harmony export */ Wellknown: () => (/* binding */ Wellknown),\n/* harmony export */ backup: () => (/* binding */ backup),\n/* harmony export */ combineTXT: () => (/* binding */ combineTXT),\n/* harmony export */ lookupTxt: () => (/* binding */ lookupTxt),\n/* harmony export */ parseEndpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.parseEndpoint),\n/* harmony export */ query: () => (/* binding */ query),\n/* harmony export */ toEndpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.toEndpoint),\n/* harmony export */ validateResponse: () => (/* binding */ validateResponse),\n/* harmony export */ wellknown: () => (/* binding */ wellknown)\n/* harmony export */ });\n/* harmony import */ var _leichtgewicht_dns_packet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @leichtgewicht/dns-packet */ \"./node_modules/@leichtgewicht/dns-packet/index.mjs\");\n/* harmony import */ var _leichtgewicht_dns_packet_rcodes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @leichtgewicht/dns-packet/rcodes.js */ \"./node_modules/@leichtgewicht/dns-packet/rcodes.mjs\");\n/* harmony import */ var utf8_codec__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! utf8-codec */ \"./node_modules/utf8-codec/index.mjs\");\n/* harmony import */ var _lib_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib.mjs */ \"./node_modules/dns-query/lib.browser.mjs\");\n/* harmony import */ var _resolvers_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./resolvers.mjs */ \"./node_modules/dns-query/resolvers.mjs\");\n/* harmony import */ var _common_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./common.mjs */ \"./node_modules/dns-query/common.mjs\");\n\n\n\n\n\n\n\n\n\nconst DNS_RCODE_ERROR = {\n 1: 'FormErr',\n 2: 'ServFail',\n 3: 'NXDomain',\n 4: 'NotImp',\n 5: 'Refused',\n 6: 'YXDomain',\n 7: 'YXRRSet',\n 8: 'NXRRSet',\n 9: 'NotAuth',\n 10: 'NotZone',\n 11: 'DSOTYPENI'\n}\n\nconst DNS_RCODE_MESSAGE = {\n // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6\n 1: 'The name server was unable to interpret the query.',\n 2: 'The name server was unable to process this query due to a problem with the name server.',\n 3: 'Non-Existent Domain.',\n 4: 'The name server does not support the requested kind of query.',\n 5: 'The name server refuses to perform the specified operation for policy reasons.',\n 6: 'Name Exists when it should not.',\n 7: 'RR Set Exists when it should not.',\n 8: 'RR Set that should exist does not.',\n 9: 'Server Not Authoritative for zone / Not Authorized.',\n 10: 'Name not contained in zone.',\n 11: 'DSO-TYPE Not Implemented.'\n}\n\nclass DNSRcodeError extends Error {\n constructor (rcode, question) {\n super(`${(DNS_RCODE_MESSAGE[rcode] || 'Undefined error.')} (rcode=${rcode}${DNS_RCODE_ERROR[rcode] ? `, error=${DNS_RCODE_ERROR[rcode]}` : ''}, question=${JSON.stringify(question)})`)\n this.rcode = rcode\n this.code = `DNS_RCODE_${rcode}`\n this.error = DNS_RCODE_ERROR[rcode]\n this.question = question\n }\n\n toJSON () {\n return {\n code: this.code,\n error: this.error,\n question: this.question,\n endpoint: this.endpoint\n }\n }\n}\n\nfunction validateResponse (data, question) {\n const rcode = (0,_leichtgewicht_dns_packet_rcodes_js__WEBPACK_IMPORTED_MODULE_1__.toRcode)(data.rcode)\n if (rcode !== 0) {\n const err = new DNSRcodeError(rcode, question)\n err.endpoint = data.endpoint\n throw err\n }\n return data\n}\n\nfunction processResolvers (res) {\n const time = (res.time === null || res.time === undefined) ? Date.now() : res.time\n const resolvers = _lib_mjs__WEBPACK_IMPORTED_MODULE_3__.processResolvers(res.data.map(resolver => {\n resolver.endpoint = (0,_common_mjs__WEBPACK_IMPORTED_MODULE_5__.toEndpoint)(Object.assign({ name: resolver.name }, resolver.endpoint))\n return resolver\n }))\n const endpoints = resolvers.map(resolver => resolver.endpoint)\n return {\n data: {\n resolvers,\n resolverByName: resolvers.reduce((byName, resolver) => {\n byName[resolver.name] = resolver\n return byName\n }, {}),\n endpoints,\n endpointByName: endpoints.reduce((byName, endpoint) => {\n byName[endpoint.name] = endpoint\n return byName\n }, {})\n },\n time\n }\n}\n\nconst backup = processResolvers(_resolvers_mjs__WEBPACK_IMPORTED_MODULE_4__.resolvers)\n\nfunction toMultiQuery (singleQuery) {\n const query = Object.assign({\n type: 'query'\n }, singleQuery)\n delete query.question\n query.questions = []\n if (singleQuery.question) {\n query.questions.push(singleQuery.question)\n }\n return query\n}\n\nfunction queryOne (endpoint, query, timeout, abortSignal) {\n if (abortSignal && abortSignal.aborted) {\n return Promise.reject(new _common_mjs__WEBPACK_IMPORTED_MODULE_5__.AbortError())\n }\n if (endpoint.protocol === 'udp4:' || endpoint.protocol === 'udp6:') {\n return _lib_mjs__WEBPACK_IMPORTED_MODULE_3__.queryDns(endpoint, query, timeout, abortSignal)\n }\n return queryDoh(endpoint, query, timeout, abortSignal)\n}\n\nfunction queryDoh (endpoint, query, timeout, abortSignal) {\n return _lib_mjs__WEBPACK_IMPORTED_MODULE_3__.request(\n endpoint.url,\n endpoint.method,\n _leichtgewicht_dns_packet__WEBPACK_IMPORTED_MODULE_0__.encode(Object.assign({\n flags: _leichtgewicht_dns_packet__WEBPACK_IMPORTED_MODULE_0__.RECURSION_DESIRED\n }, query)),\n timeout,\n abortSignal\n ).then(\n function (res) {\n const data = res.data\n const response = res.response\n let error = res.error\n if (error === undefined) {\n if (data.length === 0) {\n error = new _common_mjs__WEBPACK_IMPORTED_MODULE_5__.ResponseError('Empty.')\n } else {\n try {\n const decoded = _leichtgewicht_dns_packet__WEBPACK_IMPORTED_MODULE_0__.decode(data)\n decoded.response = response\n return decoded\n } catch (err) {\n error = new _common_mjs__WEBPACK_IMPORTED_MODULE_5__.ResponseError('Invalid packet (cause=' + err.message + ')', err)\n }\n }\n }\n throw Object.assign(error, { response })\n }\n )\n}\n\nconst UPDATE_URL = new _common_mjs__WEBPACK_IMPORTED_MODULE_5__.URL('https://martinheidegger.github.io/dns-query/resolvers.json')\n\nfunction concatUint8 (arrs) {\n const res = new Uint8Array(\n arrs.reduce((len, arr) => len + arr.length, 0)\n )\n let pos = 0\n for (const arr of arrs) {\n res.set(arr, pos)\n pos += arr.length\n }\n return res\n}\n\nfunction combineTXT (inputs) {\n return (0,utf8_codec__WEBPACK_IMPORTED_MODULE_2__.decode)(concatUint8(inputs))\n}\n\nfunction isNameString (entry) {\n return /^@/.test(entry)\n}\n\nclass Wellknown {\n constructor (opts) {\n this.opts = Object.assign({\n timeout: 5000,\n update: true,\n updateURL: UPDATE_URL,\n persist: false,\n localStoragePrefix: 'dnsquery_',\n maxAge: 300000 // 5 minutes\n }, opts)\n this._dataP = null\n }\n\n _data (force, outdated) {\n if (!force && this._dataP !== null) {\n return this._dataP.then(res => {\n if (res.time < Date.now() - this.opts.maxAge) {\n return this._data(true, res)\n }\n return res\n })\n }\n this._dataP = (!this.opts.update\n ? Promise.resolve(backup)\n : _lib_mjs__WEBPACK_IMPORTED_MODULE_3__.loadJSON(\n this.opts.updateURL,\n this.opts.persist\n ? {\n name: 'resolvers.json',\n localStoragePrefix: this.opts.localStoragePrefix,\n maxTime: Date.now() - this.opts.maxAge\n }\n : null,\n this.opts.timeout\n )\n .then(res => processResolvers({\n data: res.data.resolvers,\n time: res.time\n }))\n .catch(() => outdated || backup)\n )\n return this._dataP\n }\n\n data () {\n return this._data(false).then(data => data.data)\n }\n\n endpoints (input) {\n if (input === null || input === undefined) {\n return this.data().then(data => data.endpoints)\n }\n if (input === 'doh') {\n input = filterDoh\n }\n if (input === 'dns') {\n input = filterDns\n }\n if (typeof input === 'function') {\n return this.data().then(data => data.endpoints.filter(input))\n }\n if (typeof input === 'string' || typeof input[Symbol.iterator] !== 'function') {\n return Promise.reject(new Error(`Endpoints (${input}) needs to be iterable (array).`))\n }\n input = Array.from(input).filter(Boolean)\n if (input.findIndex(isNameString) === -1) {\n try {\n return Promise.resolve(input.map(_common_mjs__WEBPACK_IMPORTED_MODULE_5__.toEndpoint))\n } catch (err) {\n return Promise.reject(err)\n }\n }\n return this.data().then(data =>\n input.map(entry => {\n if (isNameString(entry)) {\n const found = data.endpointByName[entry.substring(1)]\n if (!found) {\n throw new Error(`Endpoint ${entry} is not known.`)\n }\n return found\n }\n return (0,_common_mjs__WEBPACK_IMPORTED_MODULE_5__.toEndpoint)(entry)\n })\n )\n }\n}\n\nconst wellknown = new Wellknown()\n\nfunction isPromise (input) {\n if (input === null) {\n return false\n }\n if (typeof input !== 'object') {\n return false\n }\n return typeof input.then === 'function'\n}\n\nfunction toPromise (input) {\n return isPromise(input) ? input : Promise.resolve(input)\n}\n\nfunction query (q, opts) {\n opts = Object.assign({\n retries: 5,\n timeout: 30000 // 30 seconds\n }, opts)\n if (!q.question) return Promise.reject(new Error('To request data you need to specify a .question!'))\n return toPromise(opts.endpoints)\n .then(endpoints => {\n if (!Array.isArray(endpoints) || endpoints.length === 0) {\n throw new Error('No endpoints defined to lookup dns records.')\n }\n return queryN(endpoints.map(_common_mjs__WEBPACK_IMPORTED_MODULE_5__.toEndpoint), toMultiQuery(q), opts)\n })\n .then(data => {\n data.question = data.questions[0]\n delete data.questions\n return data\n })\n}\n\nfunction lookupTxt (domain, opts) {\n const q = Object.assign({\n question: {\n type: 'TXT',\n name: domain\n }\n }, opts.query)\n return query(q, opts)\n .then(data => {\n validateResponse(data, q)\n return {\n entries: (data.answers || [])\n .filter(answer => answer.type === 'TXT' && answer.data)\n .map(answer => {\n return ({\n data: combineTXT(answer.data),\n ttl: answer.ttl\n })\n })\n .sort((a, b) => {\n if (a.data > b.data) return 1\n if (a.data < b.data) return -1\n return 0\n }),\n endpoint: data.endpoint\n }\n })\n}\n\nfunction queryN (endpoints, q, opts) {\n const endpoint = endpoints.length === 1\n ? endpoints[0]\n : endpoints[Math.floor(Math.random() * endpoints.length) % endpoints.length]\n return queryOne(endpoint, q, opts.timeout, opts.signal)\n .then(\n data => {\n // Add the endpoint to give a chance to identify which endpoint returned the result\n data.endpoint = endpoint.toString()\n return data\n },\n err => {\n if (err.name === 'AbortError' || opts.retries === 0) {\n err.endpoint = endpoint.toString()\n throw err\n }\n if (opts.retries > 0) {\n opts.retries -= 1\n }\n return queryN(endpoints, q, opts)\n }\n )\n}\n\nfunction filterDoh (endpoint) {\n return endpoint.protocol === 'https:' || endpoint.protocol === 'http:'\n}\n\nfunction filterDns (endpoint) {\n return endpoint.protocol === 'udp4:' || endpoint.protocol === 'udp6:'\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/dns-query/index.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/dns-query/lib.browser.mjs":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/dns-query/lib.browser.mjs ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadJSON: () => (/* binding */ loadJSON),\n/* harmony export */ processResolvers: () => (/* binding */ processResolvers),\n/* harmony export */ queryDns: () => (/* binding */ queryDns),\n/* harmony export */ request: () => (/* binding */ request)\n/* harmony export */ });\n/* harmony import */ var utf8_codec__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! utf8-codec */ \"./node_modules/utf8-codec/index.mjs\");\n/* harmony import */ var _leichtgewicht_base64_codec__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @leichtgewicht/base64-codec */ \"./node_modules/@leichtgewicht/base64-codec/index.mjs\");\n/* harmony import */ var _common_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./common.mjs */ \"./node_modules/dns-query/common.mjs\");\n/* global XMLHttpRequest, localStorage */\n\n\n\nconst contentType = 'application/dns-message'\n\nfunction noop () { }\n\nfunction queryDns () {\n throw new Error('Only \"doh\" endpoints are supported in the browser')\n}\n\nasync function loadJSON (url, cache, timeout, abortSignal) {\n const cacheKey = cache ? cache.localStoragePrefix + cache.name : null\n if (cacheKey) {\n try {\n const cached = JSON.parse(localStorage.getItem(cacheKey))\n if (cached && cached.time > cache.maxTime) {\n return cached\n }\n } catch (err) {}\n }\n const { data } = await requestRaw(url, 'GET', null, timeout, abortSignal)\n const result = {\n time: Date.now(),\n data: JSON.parse(utf8_codec__WEBPACK_IMPORTED_MODULE_0__.decode(data))\n }\n if (cacheKey) {\n try {\n localStorage.setItem(cacheKey, JSON.stringify(result))\n } catch (err) {\n result.time = null\n }\n }\n return result\n}\n\nfunction requestRaw (url, method, data, timeout, abortSignal) {\n return new Promise((resolve, reject) => {\n const target = new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.URL(url)\n if (method === 'GET' && data) {\n target.search = '?dns=' + _leichtgewicht_base64_codec__WEBPACK_IMPORTED_MODULE_1__.base64URL.decode(data)\n }\n const uri = target.toString()\n const xhr = new XMLHttpRequest()\n xhr.open(method, uri, true)\n xhr.setRequestHeader('Accept', contentType)\n if (method === 'POST') {\n xhr.setRequestHeader('Content-Type', contentType)\n }\n xhr.responseType = 'arraybuffer'\n xhr.timeout = timeout\n xhr.ontimeout = ontimeout\n xhr.onreadystatechange = onreadystatechange\n xhr.onerror = onerror\n xhr.onload = onload\n if (method === 'POST') {\n xhr.send(data)\n } else {\n xhr.send()\n }\n\n if (abortSignal) {\n abortSignal.addEventListener('abort', onabort)\n }\n\n function ontimeout () {\n finish(new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.TimeoutError(timeout))\n try {\n xhr.abort()\n } catch (e) { }\n }\n\n function onload () {\n if (xhr.status !== 200) {\n finish(new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.HTTPStatusError(uri, xhr.status, method))\n } else {\n let buf\n if (typeof xhr.response === 'string') {\n buf = utf8_codec__WEBPACK_IMPORTED_MODULE_0__.encode(xhr.response)\n } else if (xhr.response instanceof Uint8Array) {\n buf = xhr.response\n } else if (Array.isArray(xhr.response) || xhr.response instanceof ArrayBuffer) {\n buf = new Uint8Array(xhr.response)\n } else {\n throw new Error('Unprocessable response ' + xhr.response)\n }\n finish(null, buf)\n }\n }\n\n function onreadystatechange () {\n if (xhr.readyState > 1 && xhr.status !== 200 && xhr.status !== 0) {\n finish(new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.HTTPStatusError(uri, xhr.status, method))\n try {\n xhr.abort()\n } catch (e) { }\n }\n }\n\n let finish = function (error, data) {\n finish = noop\n if (abortSignal) {\n abortSignal.removeEventListener('abort', onabort)\n }\n if (error) {\n resolve({\n error,\n response: xhr\n })\n } else {\n resolve({\n data,\n response: xhr\n })\n }\n }\n\n function onerror () {\n finish(xhr.status === 200 ? new Error('Inexplicable XHR Error') : new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.HTTPStatusError(uri, xhr.status, method))\n }\n\n function onabort () {\n finish(new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.AbortError())\n try {\n xhr.abort()\n } catch (e) { }\n }\n })\n}\n\nfunction request (url, method, packet, timeout, abortSignal) {\n return requestRaw(url, method, packet, timeout, abortSignal)\n}\n\nfunction processResolvers (resolvers) {\n return resolvers.filter(resolver => resolver.cors || resolver.endpoint.cors)\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/dns-query/lib.browser.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/dns-query/resolvers.mjs":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/dns-query/resolvers.mjs ***!
|
||
\**********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ resolvers: () => (/* binding */ resolvers)\n/* harmony export */ });\nconst resolvers = {\n data: [\n {\n name: 'adfree.usableprivacy.net',\n endpoint: {\n protocol: 'https:',\n host: 'adfree.usableprivacy.net'\n },\n description: 'Public updns DoH service with advertising, tracker and malware filters.\\nHosted in Europe by @usableprivacy, details see: https://docs.usableprivacy.com',\n country: 'Germany',\n location: {\n lat: 51.2993,\n long: 9.491\n },\n filter: true\n },\n {\n name: 'adguard-dns-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns.adguard.com',\n ipv4: '94.140.15.15'\n },\n description: 'Remove ads and protect your computer from malware (over DoH)',\n country: 'France',\n location: {\n lat: 48.8582,\n long: 2.3387\n },\n filter: true\n },\n {\n name: 'adguard-dns-family-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns-family.adguard.com',\n ipv4: '94.140.15.16'\n },\n description: 'Adguard DNS with safesearch and adult content blocking (over DoH)',\n country: 'France',\n location: {\n lat: 48.8582,\n long: 2.3387\n },\n filter: true\n },\n {\n name: 'adguard-dns-unfiltered-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns-unfiltered.adguard.com',\n ipv4: '94.140.14.140'\n },\n description: 'AdGuard public DNS servers without filters (over DoH)',\n country: 'France',\n location: {\n lat: 48.8582,\n long: 2.3387\n }\n },\n {\n name: 'ahadns-doh-chi',\n endpoint: {\n protocol: 'https:',\n host: 'doh.chi.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Chicago, USA. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=chi',\n country: 'United States',\n location: {\n lat: 41.8483,\n long: -87.6517\n },\n filter: true,\n cors: true\n },\n {\n name: 'ahadns-doh-in',\n endpoint: {\n protocol: 'https:',\n host: 'doh.in.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Mumbai, India. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=in',\n country: 'India',\n location: {\n lat: 19.0748,\n long: 72.8856\n },\n filter: true,\n cors: true\n },\n {\n name: 'ahadns-doh-la',\n endpoint: {\n protocol: 'https:',\n host: 'doh.la.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Los Angeles, USA. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=la',\n country: 'United States',\n location: {\n lat: 34.0549,\n long: -118.2578\n },\n filter: true,\n cors: true\n },\n {\n name: 'ahadns-doh-nl',\n endpoint: {\n protocol: 'https:',\n host: 'doh.nl.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Amsterdam, Netherlands. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=nl',\n country: 'Netherlands',\n location: {\n lat: 52.3824,\n long: 4.8995\n },\n filter: true,\n cors: true\n },\n {\n name: 'ahadns-doh-ny',\n endpoint: {\n protocol: 'https:',\n host: 'doh.ny.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in New York. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=ny',\n country: 'United States',\n location: {\n lat: 40.7308,\n long: -73.9975\n },\n filter: true,\n cors: true\n },\n {\n name: 'ahadns-doh-pl',\n endpoint: {\n protocol: 'https:',\n host: 'doh.pl.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Poland. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=pl',\n country: 'Netherlands',\n location: {\n lat: 52.3824,\n long: 4.8995\n },\n filter: true,\n cors: true\n },\n {\n name: 'alidns-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns.alidns.com',\n ipv4: '223.5.5.5',\n cors: true\n },\n description: 'A public DNS resolver that supports DoH/DoT in mainland China, provided by Alibaba-Cloud.\\nWarning: GFW filtering rules are applied by that resolver.\\nHomepage: https://alidns.com/',\n country: 'China',\n location: {\n lat: 34.7725,\n long: 113.7266\n },\n filter: true,\n log: true,\n cors: true\n },\n {\n name: 'ams-ads-doh-nl',\n endpoint: {\n protocol: 'https:',\n host: 'dnsnl-noads.alekberg.net'\n },\n description: 'Resolver in Amsterdam. DoH protocol. Non-logging. Blocks ads, malware and trackers. DNSSEC enabled.',\n country: 'Romania',\n location: {\n lat: 45.9968,\n long: 24.997\n },\n filter: true\n },\n {\n name: 'ams-doh-nl',\n endpoint: {\n protocol: 'https:',\n host: 'dnsnl.alekberg.net'\n },\n description: 'Resolver in Amsterdam. DoH protocol. Non-logging, non-filtering, DNSSEC.',\n country: 'Romania',\n location: {\n lat: 45.9968,\n long: 24.997\n }\n },\n {\n name: 'att',\n endpoint: {\n protocol: 'https:',\n host: 'dohtrial.att.net'\n },\n description: 'AT&T test DoH server.',\n log: true\n },\n {\n name: 'bcn-ads-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dnses-noads.alekberg.net'\n },\n description: 'Resolver in Spain. DoH protocol. Non-logging, remove ads and malware, DNSSEC.',\n country: 'Spain',\n location: {\n lat: 41.3891,\n long: 2.1611\n },\n filter: true\n },\n {\n name: 'bcn-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dnses.alekberg.net'\n },\n description: 'Resolver in Spain. DoH protocol. Non-logging, non-filtering, DNSSEC.',\n country: 'Spain',\n location: {\n lat: 41.3891,\n long: 2.1611\n }\n },\n {\n name: 'brahma-world',\n endpoint: {\n protocol: 'https:',\n host: 'dns.brahma.world'\n },\n description: 'DNS-over-HTTPS server. Non Logging, filters ads, trackers and malware. DNSSEC ready, QNAME Minimization, No EDNS Client-Subnet.\\nHosted in Stockholm, Sweden. (https://dns.brahma.world)',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'cisco-doh',\n endpoint: {\n protocol: 'https:',\n host: 'doh.opendns.com',\n ipv4: '146.112.41.2'\n },\n description: 'Remove your DNS blind spot (DoH protocol)\\nWarning: modifies your queries to include a copy of your network\\naddress when forwarding them to a selection of companies and organizations.',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true,\n log: true\n },\n {\n name: 'cloudflare',\n endpoint: {\n protocol: 'https:',\n host: 'dns.cloudflare.com',\n ipv4: '1.0.0.1',\n cors: true\n },\n description: 'Cloudflare DNS (anycast) - aka 1.1.1.1 / 1.0.0.1',\n country: 'Australia',\n location: {\n lat: -33.494,\n long: 143.2104\n },\n cors: true\n },\n {\n name: 'cloudflare-family',\n endpoint: {\n protocol: 'https:',\n host: 'family.cloudflare-dns.com',\n ipv4: '1.0.0.3',\n cors: true\n },\n description: 'Cloudflare DNS (anycast) with malware protection and parental control - aka 1.1.1.3 / 1.0.0.3',\n country: 'Australia',\n location: {\n lat: -33.494,\n long: 143.2104\n },\n filter: true,\n cors: true\n },\n {\n name: 'cloudflare-ipv6',\n endpoint: {\n protocol: 'https:',\n host: '1dot1dot1dot1.cloudflare-dns.com',\n cors: true\n },\n description: 'Cloudflare DNS over IPv6 (anycast)',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n cors: true\n },\n {\n name: 'cloudflare-security',\n endpoint: {\n protocol: 'https:',\n host: 'security.cloudflare-dns.com',\n ipv4: '1.0.0.2',\n cors: true\n },\n description: 'Cloudflare DNS (anycast) with malware blocking - aka 1.1.1.2 / 1.0.0.2',\n country: 'Australia',\n location: {\n lat: -33.494,\n long: 143.2104\n },\n filter: true,\n cors: true\n },\n {\n name: 'controld-block-malware',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/p1'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis DNS blocks Malware domains.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n },\n filter: true\n },\n {\n name: 'controld-block-malware-ad',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/p2'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis DNS blocks Malware, Ads & Tracking domains.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n },\n filter: true\n },\n {\n name: 'controld-block-malware-ad-social',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/p3'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis DNS blocks Malware, Ads & Tracking and Social Networks domains.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n },\n filter: true\n },\n {\n name: 'controld-family-friendly',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/family'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis DNS blocks Malware, Ads & Tracking, Adult Content and Drugs domains.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n },\n filter: true\n },\n {\n name: 'controld-uncensored',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/uncensored'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis DNS unblocks censored domains from various countries.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n }\n },\n {\n name: 'controld-unfiltered',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/p0'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis is a Unfiltered DNS, no DNS record blocking or manipulation here, if you want to block Malware, Ads & Tracking or Social Network domains, use the other ControlD DNS configs.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n }\n },\n {\n name: 'dns.digitale-gesellschaft.ch',\n endpoint: {\n protocol: 'https:',\n host: 'dns.digitale-gesellschaft.ch'\n },\n description: 'Public DoH resolver operated by the Digital Society (https://www.digitale-gesellschaft.ch).\\nHosted in Zurich, Switzerland.\\nNon-logging, non-filtering, supports DNSSEC.',\n country: 'Switzerland',\n location: {\n lat: 47.1449,\n long: 8.1551\n }\n },\n {\n name: 'dns.ryan-palmer',\n endpoint: {\n protocol: 'https:',\n host: 'dns1.ryan-palmer.com'\n },\n description: 'Non-logging, non-filtering, DNSSEC DoH Server. Hosted in the UK.',\n country: 'United Kingdom',\n location: {\n lat: 51.5164,\n long: -0.093\n }\n },\n {\n name: 'dns.sb',\n endpoint: {\n protocol: 'https:',\n host: 'doh.sb',\n ipv4: '185.222.222.222',\n cors: true\n },\n description: 'DNSSEC-enabled DoH server by https://xtom.com/\\nhttps://dns.sb/doh/',\n country: 'Unknown',\n location: {\n lat: 47,\n long: 8\n },\n cors: true\n },\n {\n name: 'dns.therifleman.name',\n endpoint: {\n protocol: 'https:',\n host: 'dns.therifleman.name'\n },\n description: 'DNS-over-HTTPS DNS forwarder from Mumbai, India. Blocks web and Android trackers and ads.\\nIP addresses are not logged, but queries are logged for 24 hours for debugging.\\nReport issues, send suggestions @ joker349 at protonmail.com.\\nAlso supports DoT (for android) @ dns.therifleman.name and plain DNS @ 172.104.206.174',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'dnsforfamily-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns-doh.dnsforfamily.com'\n },\n description: '(DoH Protocol) (Now supports DNSSEC). Block adult websites, gambling websites, malwares and advertisements.\\nIt also enforces safe search in: Google, YouTube, Bing, DuckDuckGo and Yandex.\\nSocial websites like Facebook and Instagram are not blocked. No DNS queries are logged.\\nAs of 26-May-2022 5.9 million websites are blocked and new websites are added to blacklist daily.\\nCompletely free, no ads or any commercial motive. Operating for 4 years now.\\nProvided by: https://dnsforfamily.com',\n country: 'Finland',\n location: {\n lat: 60.1758,\n long: 24.9349\n },\n filter: true\n },\n {\n name: 'dnsforfamily-doh-no-safe-search',\n endpoint: {\n protocol: 'https:',\n host: 'dns-doh-no-safe-search.dnsforfamily.com'\n },\n description: '(DoH Protocol) (Now supports DNSSEC) Block adult websites, gambling websites, malwares and advertisements.\\nUnlike other dnsforfamily servers, this one does not enforces safe search. So Google, YouTube, Bing, DuckDuckGo and Yandex are completely accessible without any restriction.\\nSocial websites like Facebook and Instagram are not blocked. No DNS queries are logged.\\nAs of 26-May-2022 5.9 million websites are blocked and new websites are added to blacklist daily.\\nCompletely free, no ads or any commercial motive. Operating for 4 years now.\\nWarning: This server is incompatible with anonymization.\\nProvided by: https://dnsforfamily.com',\n country: 'Finland',\n location: {\n lat: 60.1758,\n long: 24.9349\n },\n filter: true\n },\n {\n name: 'dnsforge.de',\n endpoint: {\n protocol: 'https:',\n host: 'dnsforge.de',\n cors: true\n },\n description: 'Public DoH resolver running with Pihole for Adblocking (https://dnsforge.de).\\nNon-logging, AD-filtering, supports DNSSEC. Hosted in Germany.',\n country: 'Germany',\n location: {\n lat: 52.2998,\n long: 9.447\n },\n filter: true,\n cors: true\n },\n {\n name: 'dnshome-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns.dnshome.de'\n },\n description: 'https://www.dnshome.de/ public resolver in Germany'\n },\n {\n name: 'dnspod-doh',\n endpoint: {\n protocol: 'https:',\n host: 'doh.pub',\n cors: true\n },\n description: 'A public DNS resolver in mainland China provided by DNSPod (Tencent Cloud).\\nhttps://www.dnspod.cn/Products/Public.DNS?lang=en',\n filter: true,\n log: true,\n cors: true\n },\n {\n name: 'dnswarden-asia-adblock-dohv4',\n endpoint: {\n protocol: 'https:',\n host: 'doh.asia.dnswarden.com',\n path: '/adblock'\n },\n description: 'Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).',\n country: 'Singapore',\n location: {\n lat: 1.2929,\n long: 103.8547\n },\n filter: true\n },\n {\n name: 'dnswarden-asia-adultfilter-dohv4',\n endpoint: {\n protocol: 'https:',\n host: 'doh.asia.dnswarden.com',\n path: '/adultfilter'\n },\n description: 'Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).',\n country: 'Singapore',\n location: {\n lat: 1.2929,\n long: 103.8547\n },\n filter: true\n },\n {\n name: 'dnswarden-asia-uncensor-dohv4',\n endpoint: {\n protocol: 'https:',\n host: 'doh.asia.dnswarden.com',\n path: '/uncensored'\n },\n description: 'Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).',\n country: 'Singapore',\n location: {\n lat: 1.2929,\n long: 103.8547\n }\n },\n {\n name: 'dnswarden-eu-adblock-dohv4',\n endpoint: {\n protocol: 'https:',\n host: 'doh.eu.dnswarden.com'\n },\n description: 'Hosted in Germany. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).',\n country: 'Germany',\n location: {\n lat: 50.1103,\n long: 8.7147\n },\n filter: true\n },\n {\n name: 'dnswarden-us-adblock-dohv4',\n endpoint: {\n protocol: 'https:',\n host: 'doh.us.dnswarden.com'\n },\n description: 'Hosted in USA (Dallas) . For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).',\n country: 'United States',\n location: {\n lat: 32.7889,\n long: -96.8021\n },\n filter: true\n },\n {\n name: 'doh-ch-blahdns',\n endpoint: {\n protocol: 'https:',\n host: 'doh-ch.blahdns.com',\n cors: true\n },\n description: 'Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Switzerland. By https://blahdns.com/',\n country: 'Netherlands',\n location: {\n lat: 52.3824,\n long: 4.8995\n },\n filter: true,\n cors: true\n },\n {\n name: 'doh-cleanbrowsing-adult',\n endpoint: {\n protocol: 'https:',\n host: 'doh.cleanbrowsing.org',\n path: '/doh/adult-filter/',\n cors: true\n },\n description: 'Blocks access to all adult, pornographic and explicit sites. It does\\nnot block proxy or VPNs, nor mixed-content sites. Sites like Reddit\\nare allowed. Google and Bing are set to the Safe Mode.\\nBy https://cleanbrowsing.org/',\n filter: true,\n cors: true\n },\n {\n name: 'doh-cleanbrowsing-family',\n endpoint: {\n protocol: 'https:',\n host: 'doh.cleanbrowsing.org',\n path: '/doh/family-filter/',\n cors: true\n },\n description: 'Blocks access to all adult, pornographic and explicit sites. It also\\nblocks proxy and VPN domains that are used to bypass the filters.\\nMixed content sites (like Reddit) are also blocked. Google, Bing and\\nYoutube are set to the Safe Mode.\\nBy https://cleanbrowsing.org/',\n filter: true,\n cors: true\n },\n {\n name: 'doh-cleanbrowsing-security',\n endpoint: {\n protocol: 'https:',\n host: 'doh.cleanbrowsing.org',\n path: '/doh/security-filter/',\n cors: true\n },\n description: 'Block access to phishing, malware and malicious domains. It does not block adult content.\\nBy https://cleanbrowsing.org/',\n filter: true,\n cors: true\n },\n {\n name: 'doh-crypto-sx',\n endpoint: {\n protocol: 'https:',\n host: 'doh.crypto.sx',\n cors: true\n },\n description: 'DNS-over-HTTPS server. Anycast, no logs, no censorship, DNSSEC.\\nBackend hosted by Scaleway, globally cached via Cloudflare.\\nMaintained by Frank Denis.',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n cors: true\n },\n {\n name: 'doh-crypto-sx-ipv6',\n endpoint: {\n protocol: 'https:',\n host: 'doh-ipv6.crypto.sx',\n cors: true\n },\n description: 'DNS-over-HTTPS server accessible over IPv6. Anycast, no logs, no censorship, DNSSEC.\\nBackend hosted by Scaleway, globally cached via Cloudflare.\\nMaintained by Frank Denis.',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n cors: true\n },\n {\n name: 'doh-de-blahdns',\n endpoint: {\n protocol: 'https:',\n host: 'doh-de.blahdns.com',\n cors: true\n },\n description: 'Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Germany. By https://blahdns.com/',\n country: 'Germany',\n location: {\n lat: 51.2993,\n long: 9.491\n },\n filter: true,\n cors: true\n },\n {\n name: 'doh-fi-blahdns',\n endpoint: {\n protocol: 'https:',\n host: 'doh-fi.blahdns.com',\n cors: true\n },\n description: 'Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Finland. By https://blahdns.com/',\n country: 'Finland',\n location: {\n lat: 60.1758,\n long: 24.9349\n },\n filter: true,\n cors: true\n },\n {\n name: 'doh-ibksturm',\n endpoint: {\n protocol: 'https:',\n host: 'ibksturm.synology.me'\n },\n description: 'DoH & DoT Server, No Logging, No Filters, DNSSEC\\nRunning privately by ibksturm in Thurgau, Switzerland'\n },\n {\n name: 'doh-jp-blahdns',\n endpoint: {\n protocol: 'https:',\n host: 'doh-jp.blahdns.com',\n cors: true\n },\n description: 'Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Japan. By https://blahdns.com/',\n country: 'Japan',\n location: {\n lat: 35.6882,\n long: 139.7532\n },\n filter: true,\n cors: true\n },\n {\n name: 'doh.ffmuc.net',\n endpoint: {\n protocol: 'https:',\n host: 'doh.ffmuc.net'\n },\n description: 'An open (non-logging, non-filtering, non-censoring) DoH resolver operated by Freifunk Munich with nodes in DE.\\nhttps://ffmuc.net/',\n country: 'Germany',\n location: {\n lat: 51.2993,\n long: 9.491\n }\n },\n {\n name: 'doh.tiarap.org',\n endpoint: {\n protocol: 'https:',\n host: 'doh.tiarap.org'\n },\n description: 'Non-Logging DNS-over-HTTPS server, cached via Cloudflare.\\nFilters out ads, trackers and malware, NO ECS, supports DNSSEC.',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'google',\n endpoint: {\n protocol: 'https:',\n host: 'dns.google',\n ipv4: '8.8.8.8',\n cors: true\n },\n description: 'Google DNS (anycast)',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n log: true,\n cors: true\n },\n {\n name: 'hdns',\n endpoint: {\n protocol: 'https:',\n host: 'query.hdns.io',\n cors: true\n },\n description: 'HDNS is a public DNS resolver that supports Handshake domains.\\nhttps://www.hdns.io',\n country: 'United States',\n location: {\n lat: 37.7771,\n long: -122.406\n },\n cors: true\n },\n {\n name: 'he',\n endpoint: {\n protocol: 'https:',\n host: 'ordns.he.net'\n },\n description: 'Hurricane Electric DoH server (anycast)\\nUnknown logging policy.',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n log: true\n },\n {\n name: 'id-gmail-doh',\n endpoint: {\n protocol: 'https:',\n host: 'doh.tiar.app'\n },\n description: 'Non-Logging DNS-over-HTTPS server located in Singapore.\\nFilters out ads, trackers and malware, supports DNSSEC, provided by id-gmail.',\n country: 'Singapore',\n location: {\n lat: 1.2929,\n long: 103.8547\n },\n filter: true\n },\n {\n name: 'iij',\n endpoint: {\n protocol: 'https:',\n host: 'public.dns.iij.jp'\n },\n description: 'DoH server operated by Internet Initiative Japan in Tokyo.\\nhttps://www.iij.ad.jp/',\n country: 'Japan',\n location: {\n lat: 35.69,\n long: 139.69\n },\n log: true\n },\n {\n name: 'iqdns-doh',\n endpoint: {\n protocol: 'https:',\n host: 'a.passcloud.xyz'\n },\n description: 'Non-logging DoH service runned by V2EX.com user johnsonwil.\\nReturns \"no such domain\" for anti-Chinese government websites. Supports DNSSEC.\\nFor more information: https://www.v2ex.com/t/785666',\n filter: true\n },\n {\n name: 'jp.tiar.app-doh',\n endpoint: {\n protocol: 'https:',\n host: 'jp.tiar.app'\n },\n description: 'Non-Logging, Non-Filtering DNS-over-HTTPS server in Japan.\\nNo ECS, Support DNSSEC',\n country: 'Japan',\n location: {\n lat: 35.6882,\n long: 139.7532\n }\n },\n {\n name: 'jp.tiarap.org',\n endpoint: {\n protocol: 'https:',\n host: 'jp.tiarap.org'\n },\n description: 'DNS-over-HTTPS Server. Non-Logging, Non-Filtering, No ECS, Support DNSSEC.\\nCached via Cloudflare.'\n },\n {\n name: 'libredns',\n endpoint: {\n protocol: 'https:',\n host: 'doh.libredns.gr'\n },\n description: 'DoH server in Germany. No logging, but no DNS padding and no DNSSEC support.\\nhttps://libredns.gr/',\n country: 'Germany',\n location: {\n lat: 51.2993,\n long: 9.491\n }\n },\n {\n name: 'nextdns',\n endpoint: {\n protocol: 'https:',\n host: 'anycsast.dns.nextdns.io'\n },\n description: 'NextDNS is a cloud-based private DNS service that gives you full control\\nover what is allowed and what is blocked on the Internet.\\nDNSSEC, Anycast, Non-logging, NoFilters\\nhttps://www.nextdns.io/',\n country: 'Netherlands',\n location: {\n lat: 52.3891,\n long: 4.6563\n }\n },\n {\n name: 'nextdns-ultralow',\n endpoint: {\n protocol: 'https:',\n host: 'dns.nextdns.io',\n path: '/dnscrypt-proxy'\n },\n description: 'NextDNS is a cloud-based private DNS service that gives you full control\\nover what is allowed and what is blocked on the Internet.\\nhttps://www.nextdns.io/\\nTo select the server location, the \"-ultralow\" variant relies on bootstrap servers\\ninstead of anycast.'\n },\n {\n name: 'njalla-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns.njal.la',\n cors: true\n },\n description: 'Non-logging DoH server in Sweden operated by Njalla.\\nhttps://dns.njal.la/',\n country: 'Sweden',\n location: {\n lat: 59.3247,\n long: 18.056\n },\n cors: true\n },\n {\n name: 'odoh-cloudflare',\n endpoint: {\n protocol: 'https:',\n host: 'odoh.cloudflare-dns.com',\n cors: true\n },\n description: 'Cloudflare ODoH server.\\nhttps://cloudflare.com',\n cors: true\n },\n {\n name: 'odoh-crypto-sx',\n endpoint: {\n protocol: 'https:',\n host: 'odoh.crypto.sx',\n cors: true\n },\n description: 'ODoH target server. Anycast, no logs.\\nBackend hosted by Scaleway. Maintained by Frank Denis.',\n cors: true\n },\n {\n name: 'odoh-id-gmail',\n endpoint: {\n protocol: 'https:',\n host: 'doh.tiar.app',\n path: '/odoh'\n },\n description: 'ODoH target server. Based in Singapore, no logs.\\nFilter ads, trackers and malware.',\n filter: true\n },\n {\n name: 'odoh-jp.tiar.app',\n endpoint: {\n protocol: 'https:',\n host: 'jp.tiar.app',\n path: '/odoh'\n },\n description: 'ODoH target server. no logs.'\n },\n {\n name: 'odoh-jp.tiarap.org',\n endpoint: {\n protocol: 'https:',\n host: 'jp.tiarap.org',\n path: '/odoh'\n },\n description: 'ODoH target server via Cloudflare, no logs.'\n },\n {\n name: 'odoh-resolver4.dns.openinternet.io',\n endpoint: {\n protocol: 'https:',\n host: 'resolver4.dns.openinternet.io'\n },\n description: \"ODoH target server. no logs, no filter, DNSSEC.\\nRunning on dedicated hardware colocated at Sonic.net in Santa Rosa, CA in the United States.\\nUses Sonic's recusrive DNS servers as upstream resolvers (but is not affiliated with Sonic\\nin any way). Provided by https://openinternet.io\"\n },\n {\n name: 'odoh-tiarap.org',\n endpoint: {\n protocol: 'https:',\n host: 'doh.tiarap.org',\n path: '/odoh'\n },\n description: 'ODoH target server via Cloudflare, no logs.\\nFilter ads, trackers and malware.',\n filter: true\n },\n {\n name: 'publicarray-au2-doh',\n endpoint: {\n protocol: 'https:',\n host: 'doh-2.seby.io',\n cors: true\n },\n description: 'DNSSEC • OpenNIC • Non-logging • Uncensored - hosted on ovh.com.au\\nMaintained by publicarray - https://dns.seby.io',\n country: 'Australia',\n location: {\n lat: -33.8591,\n long: 151.2002\n },\n cors: true\n },\n {\n name: 'puredns-doh',\n endpoint: {\n protocol: 'https:',\n host: 'puredns.org',\n ipv4: '146.190.6.13',\n cors: true\n },\n description: 'Public uncensored DNS resolver in Singapore - https://puredns.org\\n** Only available in Indonesia and Singapore **',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n cors: true\n },\n {\n name: 'quad101',\n endpoint: {\n protocol: 'https:',\n host: 'dns.twnic.tw',\n cors: true\n },\n description: 'DNSSEC-aware public resolver by the Taiwan Network Information Center (TWNIC)\\nhttps://101.101.101.101/index_en.html',\n cors: true\n },\n {\n name: 'quad9-doh-ip4-port443-filter-ecs-pri',\n endpoint: {\n protocol: 'https:',\n host: 'dns11.quad9.net',\n ipv4: '149.112.112.11'\n },\n description: 'Quad9 (anycast) dnssec/no-log/filter/ecs 9.9.9.11 - 149.112.112.11',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'quad9-doh-ip4-port443-filter-pri',\n endpoint: {\n protocol: 'https:',\n host: 'dns.quad9.net',\n ipv4: '149.112.112.112'\n },\n description: 'Quad9 (anycast) dnssec/no-log/filter 9.9.9.9 - 149.112.112.9 - 149.112.112.112',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'quad9-doh-ip4-port443-nofilter-ecs-pri',\n endpoint: {\n protocol: 'https:',\n host: 'dns12.quad9.net',\n ipv4: '9.9.9.12'\n },\n description: 'Quad9 (anycast) no-dnssec/no-log/no-filter/ecs 9.9.9.12 - 149.112.112.12',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n }\n },\n {\n name: 'quad9-doh-ip4-port443-nofilter-pri',\n endpoint: {\n protocol: 'https:',\n host: 'dns10.quad9.net',\n ipv4: '149.112.112.10'\n },\n description: 'Quad9 (anycast) no-dnssec/no-log/no-filter 9.9.9.10 - 149.112.112.10',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n }\n },\n {\n name: 'quad9-doh-ip6-port5053-filter-pri',\n endpoint: {\n protocol: 'https:',\n host: 'dns9.quad9.net'\n },\n description: 'Quad9 (anycast) dnssec/no-log/filter 2620:fe::fe - 2620:fe::9 - 2620:fe::fe:9',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'safesurfer-doh',\n endpoint: {\n protocol: 'https:',\n host: 'doh.safesurfer.io'\n },\n description: 'Family safety focused blocklist for over 2 million adult sites, as well as phishing and malware and more.\\nFree to use, paid for customizing blocking for more categories+sites and viewing usage at my.safesurfer.io. Logs taken for viewing\\nusage, data never sold - https://safesurfer.io',\n filter: true,\n log: true\n },\n {\n name: 'sth-ads-doh-se',\n endpoint: {\n protocol: 'https:',\n host: 'dnsse-noads.alekberg.net'\n },\n description: 'Resolver in Stockholm, Sweden. DoH server. Non-logging, remove ads and malware, DNSSEC.',\n country: 'Bulgaria',\n location: {\n lat: 42.696,\n long: 23.332\n },\n filter: true\n },\n {\n name: 'sth-doh-se',\n endpoint: {\n protocol: 'https:',\n host: 'dnsse.alekberg.net'\n },\n description: 'Resolver in Stockholm, Sweden. DoH server. Non-logging, non-filtering, DNSSEC.',\n country: 'Bulgaria',\n location: {\n lat: 42.696,\n long: 23.332\n }\n },\n {\n name: 'switch',\n endpoint: {\n protocol: 'https:',\n host: 'dns.switch.ch'\n },\n description: 'Public DoH service provided by SWITCH in Switzerland\\nhttps://www.switch.ch\\nProvides protection against malware, but does not block ads.',\n filter: true\n },\n {\n name: 'uncensoreddns-dk-ipv4',\n endpoint: {\n protocol: 'https:',\n host: 'unicast.uncensoreddns.org'\n },\n description: 'Also known as censurfridns.\\nDoH, no logs, no filter, DNSSEC, unicast hosted in Denmark - https://blog.uncensoreddns.org',\n country: 'Denmark',\n location: {\n lat: 55.7123,\n long: 12.0564\n }\n },\n {\n name: 'uncensoreddns-ipv4',\n endpoint: {\n protocol: 'https:',\n host: 'anycast.uncensoreddns.org'\n },\n description: 'Also known as censurfridns.\\nDoH, no logs, no filter, DNSSEC, anycast - https://blog.uncensoreddns.org',\n country: 'Denmark',\n location: {\n lat: 55.7123,\n long: 12.0564\n }\n },\n {\n name: 'v.dnscrypt.uk-doh-ipv4',\n endpoint: {\n protocol: 'https:',\n host: 'v.dnscrypt.uk'\n },\n description: 'DoH, no logs, uncensored, DNSSEC. Hosted in London UK on Digital Ocean\\nhttps://www.dnscrypt.uk',\n country: 'United Kingdom',\n location: {\n lat: 51.4964,\n long: -0.1224\n }\n }\n ],\n time: 1654187067783\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/dns-query/resolvers.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/eventemitter3/index.mjs":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/eventemitter3/index.mjs ***!
|
||
\**********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EventEmitter: () => (/* reexport default export from named module */ _index_js__WEBPACK_IMPORTED_MODULE_0__),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./node_modules/eventemitter3/index.js\");\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_index_js__WEBPACK_IMPORTED_MODULE_0__);\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/eventemitter3/index.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/get-iterator/dist/src/index.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/get-iterator/dist/src/index.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getIterator: () => (/* binding */ getIterator)\n/* harmony export */ });\nfunction getIterator(obj) {\n if (obj != null) {\n if (typeof obj[Symbol.iterator] === 'function') {\n return obj[Symbol.iterator]();\n }\n if (typeof obj[Symbol.asyncIterator] === 'function') {\n return obj[Symbol.asyncIterator]();\n }\n if (typeof obj.next === 'function') {\n return obj; // probably an iterator\n }\n }\n throw new Error('argument is not an iterator or iterable');\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/get-iterator/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/interface-datastore/dist/src/key.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/interface-datastore/dist/src/key.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Key: () => (/* binding */ Key)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/to-string.js\");\n\n\nconst pathSepS = '/';\nconst pathSepB = new TextEncoder().encode(pathSepS);\nconst pathSep = pathSepB[0];\n/**\n * A Key represents the unique identifier of an object.\n * Our Key scheme is inspired by file systems and Google App Engine key model.\n * Keys are meant to be unique across a system. Keys are hierarchical,\n * incorporating more and more specific namespaces. Thus keys can be deemed\n * 'children' or 'ancestors' of other keys:\n * - `new Key('/Comedy')`\n * - `new Key('/Comedy/MontyPython')`\n * Also, every namespace can be parametrized to embed relevant object\n * information. For example, the Key `name` (most specific namespace) could\n * include the object type:\n * - `new Key('/Comedy/MontyPython/Actor:JohnCleese')`\n * - `new Key('/Comedy/MontyPython/Sketch:CheeseShop')`\n * - `new Key('/Comedy/MontyPython/Sketch:CheeseShop/Character:Mousebender')`\n *\n */\nclass Key {\n _buf;\n /**\n * @param {string | Uint8Array} s\n * @param {boolean} [clean]\n */\n constructor(s, clean) {\n if (typeof s === 'string') {\n this._buf = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(s);\n }\n else if (s instanceof Uint8Array) {\n this._buf = s;\n }\n else {\n throw new Error('Invalid key, should be String of Uint8Array');\n }\n if (clean == null) {\n clean = true;\n }\n if (clean) {\n this.clean();\n }\n if (this._buf.byteLength === 0 || this._buf[0] !== pathSep) {\n throw new Error('Invalid key');\n }\n }\n /**\n * Convert to the string representation\n *\n * @param {import('uint8arrays/to-string').SupportedEncodings} [encoding='utf8'] - The encoding to use.\n * @returns {string}\n */\n toString(encoding = 'utf8') {\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(this._buf, encoding);\n }\n /**\n * Return the Uint8Array representation of the key\n *\n * @returns {Uint8Array}\n */\n uint8Array() {\n return this._buf;\n }\n /**\n * Return string representation of the key\n *\n * @returns {string}\n */\n get [Symbol.toStringTag]() {\n return `Key(${this.toString()})`;\n }\n /**\n * Constructs a key out of a namespace array.\n *\n * @param {Array<string>} list - The array of namespaces\n * @returns {Key}\n *\n * @example\n * ```js\n * Key.withNamespaces(['one', 'two'])\n * // => Key('/one/two')\n * ```\n */\n static withNamespaces(list) {\n return new Key(list.join(pathSepS));\n }\n /**\n * Returns a randomly (uuid) generated key.\n *\n * @returns {Key}\n *\n * @example\n * ```js\n * Key.random()\n * // => Key('/344502982398')\n * ```\n */\n static random() {\n return new Key(Math.random().toString().substring(2));\n }\n /**\n * @param {*} other\n */\n static asKey(other) {\n if (other instanceof Uint8Array || typeof other === 'string') {\n // we can create a key from this\n return new Key(other);\n }\n if (typeof other.uint8Array === 'function') {\n // this is an older version or may have crossed the esm/cjs boundary\n return new Key(other.uint8Array());\n }\n return null;\n }\n /**\n * Cleanup the current key\n *\n * @returns {void}\n */\n clean() {\n if (this._buf == null || this._buf.byteLength === 0) {\n this._buf = pathSepB;\n }\n if (this._buf[0] !== pathSep) {\n const bytes = new Uint8Array(this._buf.byteLength + 1);\n bytes.fill(pathSep, 0, 1);\n bytes.set(this._buf, 1);\n this._buf = bytes;\n }\n // normalize does not remove trailing slashes\n while (this._buf.byteLength > 1 && this._buf[this._buf.byteLength - 1] === pathSep) {\n this._buf = this._buf.subarray(0, -1);\n }\n }\n /**\n * Check if the given key is sorted lower than ourself.\n *\n * @param {Key} key - The other Key to check against\n * @returns {boolean}\n */\n less(key) {\n const list1 = this.list();\n const list2 = key.list();\n for (let i = 0; i < list1.length; i++) {\n if (list2.length < i + 1) {\n return false;\n }\n const c1 = list1[i];\n const c2 = list2[i];\n if (c1 < c2) {\n return true;\n }\n else if (c1 > c2) {\n return false;\n }\n }\n return list1.length < list2.length;\n }\n /**\n * Returns the key with all parts in reversed order.\n *\n * @returns {Key}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').reverse()\n * // => Key('/Actor:JohnCleese/MontyPython/Comedy')\n * ```\n */\n reverse() {\n return Key.withNamespaces(this.list().slice().reverse());\n }\n /**\n * Returns the `namespaces` making up this Key.\n *\n * @returns {Array<string>}\n */\n namespaces() {\n return this.list();\n }\n /** Returns the \"base\" namespace of this key.\n *\n * @returns {string}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').baseNamespace()\n * // => 'Actor:JohnCleese'\n * ```\n */\n baseNamespace() {\n const ns = this.namespaces();\n return ns[ns.length - 1];\n }\n /**\n * Returns the `list` representation of this key.\n *\n * @returns {Array<string>}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').list()\n * // => ['Comedy', 'MontyPythong', 'Actor:JohnCleese']\n * ```\n */\n list() {\n return this.toString().split(pathSepS).slice(1);\n }\n /**\n * Returns the \"type\" of this key (value of last namespace).\n *\n * @returns {string}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').type()\n * // => 'Actor'\n * ```\n */\n type() {\n return namespaceType(this.baseNamespace());\n }\n /**\n * Returns the \"name\" of this key (field of last namespace).\n *\n * @returns {string}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').name()\n * // => 'JohnCleese'\n * ```\n */\n name() {\n return namespaceValue(this.baseNamespace());\n }\n /**\n * Returns an \"instance\" of this type key (appends value to namespace).\n *\n * @param {string} s - The string to append.\n * @returns {Key}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor').instance('JohnClesse')\n * // => Key('/Comedy/MontyPython/Actor:JohnCleese')\n * ```\n */\n instance(s) {\n return new Key(this.toString() + ':' + s);\n }\n /**\n * Returns the \"path\" of this key (parent + type).\n *\n * @returns {Key}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').path()\n * // => Key('/Comedy/MontyPython/Actor')\n * ```\n */\n path() {\n let p = this.parent().toString();\n if (!p.endsWith(pathSepS)) {\n p += pathSepS;\n }\n p += this.type();\n return new Key(p);\n }\n /**\n * Returns the `parent` Key of this Key.\n *\n * @returns {Key}\n *\n * @example\n * ```js\n * new Key(\"/Comedy/MontyPython/Actor:JohnCleese\").parent()\n * // => Key(\"/Comedy/MontyPython\")\n * ```\n */\n parent() {\n const list = this.list();\n if (list.length === 1) {\n return new Key(pathSepS);\n }\n return new Key(list.slice(0, -1).join(pathSepS));\n }\n /**\n * Returns the `child` Key of this Key.\n *\n * @param {Key} key - The child Key to add\n * @returns {Key}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython').child(new Key('Actor:JohnCleese'))\n * // => Key('/Comedy/MontyPython/Actor:JohnCleese')\n * ```\n */\n child(key) {\n if (this.toString() === pathSepS) {\n return key;\n }\n else if (key.toString() === pathSepS) {\n return this;\n }\n return new Key(this.toString() + key.toString(), false);\n }\n /**\n * Returns whether this key is a prefix of `other`\n *\n * @param {Key} other - The other key to test against\n * @returns {boolean}\n *\n * @example\n * ```js\n * new Key('/Comedy').isAncestorOf('/Comedy/MontyPython')\n * // => true\n * ```\n */\n isAncestorOf(other) {\n if (other.toString() === this.toString()) {\n return false;\n }\n return other.toString().startsWith(this.toString());\n }\n /**\n * Returns whether this key is a contains another as prefix.\n *\n * @param {Key} other - The other Key to test against\n * @returns {boolean}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython').isDecendantOf('/Comedy')\n * // => true\n * ```\n */\n isDecendantOf(other) {\n if (other.toString() === this.toString()) {\n return false;\n }\n return this.toString().startsWith(other.toString());\n }\n /**\n * Checks if this key has only one namespace.\n *\n * @returns {boolean}\n */\n isTopLevel() {\n return this.list().length === 1;\n }\n /**\n * Concats one or more Keys into one new Key.\n *\n * @param {Array<Key>} keys - The array of keys to concatenate\n * @returns {Key}\n */\n concat(...keys) {\n return Key.withNamespaces([...this.namespaces(), ...flatten(keys.map(key => key.namespaces()))]);\n }\n}\n/**\n * The first component of a namespace. `foo` in `foo:bar`\n *\n * @param {string} ns\n * @returns {string}\n */\nfunction namespaceType(ns) {\n const parts = ns.split(':');\n if (parts.length < 2) {\n return '';\n }\n return parts.slice(0, -1).join(':');\n}\n/**\n * The last component of a namespace, `baz` in `foo:bar:baz`.\n *\n * @param {string} ns\n * @returns {string}\n */\nfunction namespaceValue(ns) {\n const parts = ns.split(':');\n return parts[parts.length - 1];\n}\n/**\n * Flatten array of arrays (only one level)\n *\n * @template T\n * @param {Array<any>} arr\n * @returns {T[]}\n */\nfunction flatten(arr) {\n return ([]).concat(...arr);\n}\n//# sourceMappingURL=key.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/interface-datastore/dist/src/key.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!*******************************************************************************************!*\
|
||
!*** ./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\*******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!*****************************************************************************************!*\
|
||
!*** ./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\*****************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!******************************************************************************************!*\
|
||
!*** ./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\******************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/interface-datastore/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-all/dist/src/index.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/it-all/dist/src/index.js ***!
|
||
\***********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/**\n * @packageDocumentation\n *\n * For when you need a one-liner to collect iterable values.\n *\n * @example\n *\n * ```javascript\n * import all from 'it-all'\n *\n * // This can also be an iterator, etc\n * const values = function * () {\n * yield * [0, 1, 2, 3, 4]\n * }\n *\n * const arr = all(values)\n *\n * console.info(arr) // 0, 1, 2, 3, 4\n * ```\n *\n * Async sources must be awaited:\n *\n * ```javascript\n * const values = async function * () {\n * yield * [0, 1, 2, 3, 4]\n * }\n *\n * const arr = await all(values())\n *\n * console.info(arr) // 0, 1, 2, 3, 4\n * ```\n */\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction all(source) {\n if (isAsyncIterable(source)) {\n return (async () => {\n const arr = [];\n for await (const entry of source) {\n arr.push(entry);\n }\n return arr;\n })();\n }\n const arr = [];\n for (const entry of source) {\n arr.push(entry);\n }\n return arr;\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (all);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-all/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-byte-stream/dist/src/index.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/it-byte-stream/dist/src/index.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ CodeError: () => (/* binding */ CodeError),\n/* harmony export */ byteStream: () => (/* binding */ byteStream)\n/* harmony export */ });\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _pushable_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pushable.js */ \"./node_modules/it-byte-stream/dist/src/pushable.js\");\n/**\n * @packageDocumentation\n *\n * This module makes it easy to send and receive bytes over streams.\n *\n * @example\n *\n * ```typescript\n * import { byteStream } from 'it-byte-stream'\n *\n * const stream = byteStream(duplex)\n *\n * // read the next chunk\n * const bytes = await stream.read()\n *\n * // read the next five bytes\n * const fiveBytes = await stream.read(5)\n *\n * // write bytes into the stream\n * await stream.write(Uint8Array.from([0, 1, 2, 3, 4]))\n * ```\n */\n\n\nclass CodeError extends Error {\n code;\n constructor(message, code) {\n super(message);\n this.code = code;\n }\n}\nclass AbortError extends CodeError {\n type;\n constructor(message) {\n super(message, 'ABORT_ERR');\n this.type = 'aborted';\n }\n}\nfunction byteStream(duplex, opts) {\n const write = (0,_pushable_js__WEBPACK_IMPORTED_MODULE_1__.pushable)();\n duplex.sink(write).catch(async (err) => {\n await write.end(err);\n });\n duplex.sink = async (source) => {\n for await (const buf of source) {\n await write.push(buf);\n }\n await write.end();\n };\n let source = duplex.source;\n if (duplex.source[Symbol.iterator] != null) {\n source = duplex.source[Symbol.iterator]();\n }\n else if (duplex.source[Symbol.asyncIterator] != null) {\n source = duplex.source[Symbol.asyncIterator]();\n }\n const readBuffer = new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList();\n const W = {\n read: async (bytes, options) => {\n options?.signal?.throwIfAborted();\n let listener;\n const abortPromise = new Promise((resolve, reject) => {\n listener = () => {\n reject(new AbortError('Read aborted'));\n };\n options?.signal?.addEventListener('abort', listener);\n });\n try {\n if (bytes == null) {\n // just read whatever arrives\n const { done, value } = await Promise.race([\n source.next(),\n abortPromise\n ]);\n if (done === true) {\n return new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList();\n }\n return value;\n }\n while (readBuffer.byteLength < bytes) {\n const { value, done } = await Promise.race([\n source.next(),\n abortPromise\n ]);\n if (done === true) {\n throw new CodeError('unexpected end of input', 'ERR_UNEXPECTED_EOF');\n }\n readBuffer.append(value);\n }\n const buf = readBuffer.sublist(0, bytes);\n readBuffer.consume(bytes);\n return buf;\n }\n finally {\n if (listener != null) {\n options?.signal?.removeEventListener('abort', listener);\n }\n }\n },\n write: async (data, options) => {\n options?.signal?.throwIfAborted();\n // just write\n if (data instanceof Uint8Array) {\n await write.push(data, options);\n }\n else {\n await write.push(data.subarray(), options);\n }\n },\n unwrap: () => {\n if (readBuffer.byteLength > 0) {\n const originalStream = duplex.source;\n duplex.source = (async function* () {\n if (opts?.yieldBytes === false) {\n yield readBuffer;\n }\n else {\n yield* readBuffer;\n }\n yield* originalStream;\n }());\n }\n return duplex;\n }\n };\n return W;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-byte-stream/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-byte-stream/dist/src/pushable.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/it-byte-stream/dist/src/pushable.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pushable: () => (/* binding */ pushable)\n/* harmony export */ });\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/* harmony import */ var race_signal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! race-signal */ \"./node_modules/race-signal/dist/src/index.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.js */ \"./node_modules/it-byte-stream/dist/src/index.js\");\n\n\n\nclass QueuelessPushable {\n readNext;\n haveNext;\n ended;\n nextResult;\n constructor() {\n this.ended = false;\n this.readNext = (0,p_defer__WEBPACK_IMPORTED_MODULE_2__[\"default\"])();\n this.haveNext = (0,p_defer__WEBPACK_IMPORTED_MODULE_2__[\"default\"])();\n }\n [Symbol.asyncIterator]() {\n return this;\n }\n async next() {\n if (this.nextResult == null) {\n // wait for the supplier to push a value\n await this.haveNext.promise;\n }\n if (this.nextResult == null) {\n throw new Error('HaveNext promise resolved but nextResult was undefined');\n }\n const nextResult = this.nextResult;\n this.nextResult = undefined;\n // signal to the supplier that we read the value\n this.readNext.resolve();\n this.readNext = (0,p_defer__WEBPACK_IMPORTED_MODULE_2__[\"default\"])();\n return nextResult;\n }\n async throw(err) {\n this.ended = true;\n if (err != null) {\n this.haveNext.reject(err);\n }\n const result = {\n done: true,\n value: undefined\n };\n return result;\n }\n async return() {\n const result = {\n done: true,\n value: undefined\n };\n await this._push(undefined);\n return result;\n }\n async push(value, options) {\n await this._push(value, options);\n }\n async end(err, options) {\n if (err != null) {\n await this.throw(err);\n }\n else {\n // abortable return\n await this._push(undefined, options);\n }\n }\n async _push(value, options) {\n if (value != null && this.ended) {\n throw new Error('Cannot push value onto an ended pushable');\n }\n // already have a value, wait for it to be read\n if (this.nextResult != null) {\n await this.readNext.promise;\n if (this.nextResult != null) {\n throw new Error('NeedNext promise resolved but nextResult was not consumed');\n }\n }\n if (value != null) {\n this.nextResult = { done: false, value };\n }\n else {\n this.ended = true;\n this.nextResult = { done: true, value: undefined };\n }\n // let the consumer know we have a new value\n this.haveNext.resolve();\n this.haveNext = (0,p_defer__WEBPACK_IMPORTED_MODULE_2__[\"default\"])();\n // wait for the consumer to have finished processing the value and requested\n // the next one or for the passed signal to abort the waiting\n await (0,race_signal__WEBPACK_IMPORTED_MODULE_0__.raceSignal)(this.readNext.promise, options?.signal, options);\n }\n}\nfunction pushable() {\n return new QueuelessPushable();\n}\n//# sourceMappingURL=pushable.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-byte-stream/dist/src/pushable.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-drain/dist/src/index.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/it-drain/dist/src/index.js ***!
|
||
\*************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/**\n * @packageDocumentation\n *\n * Mostly useful for tests or when you want to be explicit about consuming an iterable without doing anything with any yielded values.\n *\n * @example\n *\n * ```javascript\n * import drain from 'it-drain'\n *\n * // This can also be an iterator, generator, etc\n * const values = [0, 1, 2, 3, 4]\n *\n * drain(values)\n * ```\n *\n * Async sources must be awaited:\n *\n * ```javascript\n * import drain from 'it-drain'\n *\n * const values = async function * {\n * yield * [0, 1, 2, 3, 4]\n * }\n *\n * await drain(values())\n * ```\n */\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction drain(source) {\n if (isAsyncIterable(source)) {\n return (async () => {\n for await (const _ of source) { } // eslint-disable-line no-unused-vars,no-empty,@typescript-eslint/no-unused-vars\n })();\n }\n else {\n for (const _ of source) { } // eslint-disable-line no-unused-vars,no-empty,@typescript-eslint/no-unused-vars\n }\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (drain);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-drain/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-filter/dist/src/index.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/it-filter/dist/src/index.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var it_peekable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-peekable */ \"./node_modules/it-peekable/dist/src/index.js\");\n/**\n * @packageDocumentation\n *\n * Filter values out of an (async)iterable\n *\n * @example\n *\n * ```javascript\n * import all from 'it-all'\n * import filter from 'it-filter'\n *\n * // This can also be an iterator, generator, etc\n * const values = [0, 1, 2, 3, 4]\n *\n * const fn = val => val > 2 // Return boolean to keep item\n *\n * const arr = all(filter(values, fn))\n *\n * console.info(arr) // 3, 4\n * ```\n *\n * Async sources and filter functions must be awaited:\n *\n * ```javascript\n * import all from 'it-all'\n * import filter from 'it-filter'\n *\n * const values = async function * () {\n * yield * [0, 1, 2, 3, 4]\n * }\n *\n * const fn = async val => val > 2 // Return boolean or promise of boolean to keep item\n *\n * const arr = await all(filter(values, fn))\n *\n * console.info(arr) // 3, 4\n * ```\n */\n\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction filter(source, fn) {\n if (isAsyncIterable(source)) {\n return (async function* () {\n for await (const entry of source) {\n if (await fn(entry)) {\n yield entry;\n }\n }\n })();\n }\n // if mapping function returns a promise we have to return an async generator\n const peekable = (0,it_peekable__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(source);\n const { value, done } = peekable.next();\n if (done === true) {\n return (function* () { }());\n }\n const res = fn(value);\n // @ts-expect-error .then is not present on O\n if (typeof res.then === 'function') {\n return (async function* () {\n if (await res) {\n yield value;\n }\n for await (const entry of peekable) {\n if (await fn(entry)) {\n yield entry;\n }\n }\n })();\n }\n const func = fn;\n return (function* () {\n if (res === true) {\n yield value;\n }\n for (const entry of peekable) {\n if (func(entry)) {\n yield entry;\n }\n }\n })();\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (filter);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-filter/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-first/dist/src/index.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/it-first/dist/src/index.js ***!
|
||
\*************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/**\n * @packageDocumentation\n *\n * Return the first value in an (async)iterable\n *\n * @example\n *\n * ```javascript\n * import first from 'it-first'\n *\n * // This can also be an iterator, generator, etc\n * const values = [0, 1, 2, 3, 4]\n *\n * const res = first(values)\n *\n * console.info(res) // 0\n * ```\n *\n * Async sources must be awaited:\n *\n * ```javascript\n * import first from 'it-first'\n *\n * const values = async function * () {\n * yield * [0, 1, 2, 3, 4]\n * }\n *\n * const res = await first(values())\n *\n * console.info(res) // 0\n * ```\n */\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction first(source) {\n if (isAsyncIterable(source)) {\n return (async () => {\n for await (const entry of source) { // eslint-disable-line no-unreachable-loop\n return entry;\n }\n return undefined;\n })();\n }\n for (const entry of source) { // eslint-disable-line no-unreachable-loop\n return entry;\n }\n return undefined;\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (first);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-first/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-length-prefixed-stream/dist/src/index.js":
|
||
/*!******************************************************************!*\
|
||
!*** ./node_modules/it-length-prefixed-stream/dist/src/index.js ***!
|
||
\******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ lpStream: () => (/* binding */ lpStream)\n/* harmony export */ });\n/* harmony import */ var it_byte_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-byte-stream */ \"./node_modules/it-byte-stream/dist/src/index.js\");\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/**\n * @packageDocumentation\n *\n * This module makes it easy to send and receive length-prefixed byte arrays over streams.\n *\n * @example\n *\n * ```typescript\n * import { lpStream } from 'it-length-prefixed-stream'\n *\n * const stream = lpStream(duplex)\n *\n * // read the next length-prefixed chunk\n * const bytes = await stream.read()\n *\n * // write a length-prefixed chunk\n * await stream.write(Uint8Array.from([0, 1, 2, 3, 4]))\n *\n * // write several chunks, all individually length-prefixed\n * await stream.writeV([\n * Uint8Array.from([0, 1, 2, 3, 4]),\n * Uint8Array.from([5, 6, 7, 8, 9])\n * ])\n * ```\n */\n\n\n\nclass CodeError extends Error {\n code;\n constructor(message, code) {\n super(message);\n this.code = code;\n }\n}\nfunction lpStream(duplex, opts = {}) {\n const bytes = (0,it_byte_stream__WEBPACK_IMPORTED_MODULE_0__.byteStream)(duplex, opts);\n if (opts.maxDataLength != null && opts.maxLengthLength == null) {\n // if max data length is set but max length length is not, calculate the\n // max length length needed to encode max data length\n opts.maxLengthLength = uint8_varint__WEBPACK_IMPORTED_MODULE_1__.encodingLength(opts.maxDataLength);\n }\n const decodeLength = opts?.lengthDecoder ?? uint8_varint__WEBPACK_IMPORTED_MODULE_1__.decode;\n const encodeLength = opts?.lengthEncoder ?? uint8_varint__WEBPACK_IMPORTED_MODULE_1__.encode;\n const W = {\n read: async (options) => {\n let dataLength = -1;\n const lengthBuffer = new uint8arraylist__WEBPACK_IMPORTED_MODULE_2__.Uint8ArrayList();\n while (true) {\n // read one byte at a time until we can decode a varint\n lengthBuffer.append(await bytes.read(1, options));\n try {\n dataLength = decodeLength(lengthBuffer);\n }\n catch (err) {\n if (err instanceof RangeError) {\n continue;\n }\n throw err;\n }\n if (opts?.maxLengthLength != null && lengthBuffer.byteLength > opts.maxLengthLength) {\n throw new CodeError('message length length too long', 'ERR_MSG_LENGTH_TOO_LONG');\n }\n if (dataLength > -1) {\n break;\n }\n }\n if (opts?.maxDataLength != null && dataLength > opts.maxDataLength) {\n throw new CodeError('message length too long', 'ERR_MSG_DATA_TOO_LONG');\n }\n return bytes.read(dataLength, options);\n },\n write: async (data, options) => {\n // encode, write\n await bytes.write(new uint8arraylist__WEBPACK_IMPORTED_MODULE_2__.Uint8ArrayList(encodeLength(data.byteLength), data), options);\n },\n writeV: async (data, options) => {\n const list = new uint8arraylist__WEBPACK_IMPORTED_MODULE_2__.Uint8ArrayList(...data.flatMap(buf => ([encodeLength(buf.byteLength), buf])));\n // encode, write\n await bytes.write(list, options);\n },\n unwrap: () => {\n return bytes.unwrap();\n }\n };\n return W;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-length-prefixed-stream/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-length-prefixed/dist/src/decode.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/it-length-prefixed/dist/src/decode.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MAX_DATA_LENGTH: () => (/* binding */ MAX_DATA_LENGTH),\n/* harmony export */ MAX_LENGTH_LENGTH: () => (/* binding */ MAX_LENGTH_LENGTH),\n/* harmony export */ decode: () => (/* binding */ decode)\n/* harmony export */ });\n/* harmony import */ var err_code__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! err-code */ \"./node_modules/err-code/index.js\");\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/it-length-prefixed/dist/src/utils.js\");\n/* eslint max-depth: [\"error\", 6] */\n\n\n\n\n// Maximum length of the length section of the message\nconst MAX_LENGTH_LENGTH = 8; // Varint.encode(Number.MAX_SAFE_INTEGER).length\n// Maximum length of the data section of the message\nconst MAX_DATA_LENGTH = 1024 * 1024 * 4;\nvar ReadMode;\n(function (ReadMode) {\n ReadMode[ReadMode[\"LENGTH\"] = 0] = \"LENGTH\";\n ReadMode[ReadMode[\"DATA\"] = 1] = \"DATA\";\n})(ReadMode || (ReadMode = {}));\nconst defaultDecoder = (buf) => {\n const length = uint8_varint__WEBPACK_IMPORTED_MODULE_1__.decode(buf);\n defaultDecoder.bytes = uint8_varint__WEBPACK_IMPORTED_MODULE_1__.encodingLength(length);\n return length;\n};\ndefaultDecoder.bytes = 0;\nfunction decode(source, options) {\n const buffer = new uint8arraylist__WEBPACK_IMPORTED_MODULE_2__.Uint8ArrayList();\n let mode = ReadMode.LENGTH;\n let dataLength = -1;\n const lengthDecoder = options?.lengthDecoder ?? defaultDecoder;\n const maxLengthLength = options?.maxLengthLength ?? MAX_LENGTH_LENGTH;\n const maxDataLength = options?.maxDataLength ?? MAX_DATA_LENGTH;\n function* maybeYield() {\n while (buffer.byteLength > 0) {\n if (mode === ReadMode.LENGTH) {\n // read length, ignore errors for short reads\n try {\n dataLength = lengthDecoder(buffer);\n if (dataLength < 0) {\n throw err_code__WEBPACK_IMPORTED_MODULE_0__(new Error('invalid message length'), 'ERR_INVALID_MSG_LENGTH');\n }\n if (dataLength > maxDataLength) {\n throw err_code__WEBPACK_IMPORTED_MODULE_0__(new Error('message length too long'), 'ERR_MSG_DATA_TOO_LONG');\n }\n const dataLengthLength = lengthDecoder.bytes;\n buffer.consume(dataLengthLength);\n if (options?.onLength != null) {\n options.onLength(dataLength);\n }\n mode = ReadMode.DATA;\n }\n catch (err) {\n if (err instanceof RangeError) {\n if (buffer.byteLength > maxLengthLength) {\n throw err_code__WEBPACK_IMPORTED_MODULE_0__(new Error('message length length too long'), 'ERR_MSG_LENGTH_TOO_LONG');\n }\n break;\n }\n throw err;\n }\n }\n if (mode === ReadMode.DATA) {\n if (buffer.byteLength < dataLength) {\n // not enough data, wait for more\n break;\n }\n const data = buffer.sublist(0, dataLength);\n buffer.consume(dataLength);\n if (options?.onData != null) {\n options.onData(data);\n }\n yield data;\n mode = ReadMode.LENGTH;\n }\n }\n }\n if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.isAsyncIterable)(source)) {\n return (async function* () {\n for await (const buf of source) {\n buffer.append(buf);\n yield* maybeYield();\n }\n if (buffer.byteLength > 0) {\n throw err_code__WEBPACK_IMPORTED_MODULE_0__(new Error('unexpected end of input'), 'ERR_UNEXPECTED_EOF');\n }\n })();\n }\n return (function* () {\n for (const buf of source) {\n buffer.append(buf);\n yield* maybeYield();\n }\n if (buffer.byteLength > 0) {\n throw err_code__WEBPACK_IMPORTED_MODULE_0__(new Error('unexpected end of input'), 'ERR_UNEXPECTED_EOF');\n }\n })();\n}\ndecode.fromReader = (reader, options) => {\n let byteLength = 1; // Read single byte chunks until the length is known\n const varByteSource = (async function* () {\n while (true) {\n try {\n const { done, value } = await reader.next(byteLength);\n if (done === true) {\n return;\n }\n if (value != null) {\n yield value;\n }\n }\n catch (err) {\n if (err.code === 'ERR_UNDER_READ') {\n return { done: true, value: null };\n }\n throw err;\n }\n finally {\n // Reset the byteLength so we continue to check for varints\n byteLength = 1;\n }\n }\n }());\n /**\n * Once the length has been parsed, read chunk for that length\n */\n const onLength = (l) => { byteLength = l; };\n return decode(varByteSource, {\n ...(options ?? {}),\n onLength\n });\n};\n//# sourceMappingURL=decode.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-length-prefixed/dist/src/decode.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-length-prefixed/dist/src/encode.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/it-length-prefixed/dist/src/encode.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/it-length-prefixed/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/it-length-prefixed/dist/src/utils.js\");\n\n\n\n\nconst defaultEncoder = (length) => {\n const lengthLength = uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encodingLength(length);\n const lengthBuf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.allocUnsafe)(lengthLength);\n uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encode(length, lengthBuf);\n defaultEncoder.bytes = lengthLength;\n return lengthBuf;\n};\ndefaultEncoder.bytes = 0;\nfunction encode(source, options) {\n options = options ?? {};\n const encodeLength = options.lengthEncoder ?? defaultEncoder;\n function* maybeYield(chunk) {\n // length + data\n const length = encodeLength(chunk.byteLength);\n // yield only Uint8Arrays\n if (length instanceof Uint8Array) {\n yield length;\n }\n else {\n yield* length;\n }\n // yield only Uint8Arrays\n if (chunk instanceof Uint8Array) {\n yield chunk;\n }\n else {\n yield* chunk;\n }\n }\n if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.isAsyncIterable)(source)) {\n return (async function* () {\n for await (const chunk of source) {\n yield* maybeYield(chunk);\n }\n })();\n }\n return (function* () {\n for (const chunk of source) {\n yield* maybeYield(chunk);\n }\n })();\n}\nencode.single = (chunk, options) => {\n options = options ?? {};\n const encodeLength = options.lengthEncoder ?? defaultEncoder;\n return new uint8arraylist__WEBPACK_IMPORTED_MODULE_1__.Uint8ArrayList(encodeLength(chunk.byteLength), chunk);\n};\n//# sourceMappingURL=encode.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-length-prefixed/dist/src/encode.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-length-prefixed/dist/src/index.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/it-length-prefixed/dist/src/index.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* reexport safe */ _decode_js__WEBPACK_IMPORTED_MODULE_1__.decode),\n/* harmony export */ encode: () => (/* reexport safe */ _encode_js__WEBPACK_IMPORTED_MODULE_0__.encode)\n/* harmony export */ });\n/* harmony import */ var _encode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./encode.js */ \"./node_modules/it-length-prefixed/dist/src/encode.js\");\n/* harmony import */ var _decode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decode.js */ \"./node_modules/it-length-prefixed/dist/src/decode.js\");\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-length-prefixed/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-length-prefixed/dist/src/utils.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/it-length-prefixed/dist/src/utils.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isAsyncIterable: () => (/* binding */ isAsyncIterable)\n/* harmony export */ });\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-length-prefixed/dist/src/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-length-prefixed/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!************************************************************************************!*\
|
||
!*** ./node_modules/it-length-prefixed/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-length-prefixed/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-merge/dist/src/index.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/it-merge/dist/src/index.js ***!
|
||
\*************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/**\n * @packageDocumentation\n *\n * Merge several (async)iterables into one, yield values as they arrive.\n *\n * Nb. sources are iterated over in parallel so the order of emitted items is not guaranteed.\n *\n * @example\n *\n * ```javascript\n * import merge from 'it-merge'\n * import all from 'it-all'\n *\n * // This can also be an iterator, generator, etc\n * const values1 = [0, 1, 2, 3, 4]\n * const values2 = [5, 6, 7, 8, 9]\n *\n * const arr = all(merge(values1, values2))\n *\n * console.info(arr) // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\n * ```\n *\n * Async sources must be awaited:\n *\n * ```javascript\n * import merge from 'it-merge'\n * import all from 'it-all'\n *\n * // This can also be an iterator, async iterator, generator, etc\n * const values1 = async function * () {\n * yield * [0, 1, 2, 3, 4]\n * }\n * const values2 = async function * () {\n * yield * [5, 6, 7, 8, 9]\n * }\n *\n * const arr = await all(merge(values1(), values2()))\n *\n * console.info(arr) // 0, 1, 5, 6, 2, 3, 4, 7, 8, 9 <- nb. order is not guaranteed\n * ```\n */\n\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction merge(...sources) {\n const syncSources = [];\n for (const source of sources) {\n if (!isAsyncIterable(source)) {\n syncSources.push(source);\n }\n }\n if (syncSources.length === sources.length) {\n // all sources are synchronous\n return (function* () {\n for (const source of syncSources) {\n yield* source;\n }\n })();\n }\n return (async function* () {\n const output = (0,it_pushable__WEBPACK_IMPORTED_MODULE_0__.pushable)({\n objectMode: true\n });\n void Promise.resolve().then(async () => {\n try {\n await Promise.all(sources.map(async (source) => {\n for await (const item of source) {\n output.push(item);\n }\n }));\n output.end();\n }\n catch (err) {\n output.end(err);\n }\n });\n yield* output;\n })();\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (merge);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-merge/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-pair/dist/src/duplex.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/it-pair/dist/src/duplex.js ***!
|
||
\*************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ duplexPair: () => (/* binding */ duplexPair)\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./node_modules/it-pair/dist/src/index.js\");\n\n/**\n * Two duplex streams that are attached to each other\n */\nfunction duplexPair() {\n const a = (0,_index_js__WEBPACK_IMPORTED_MODULE_0__.pair)();\n const b = (0,_index_js__WEBPACK_IMPORTED_MODULE_0__.pair)();\n return [\n {\n source: a.source,\n sink: b.sink\n },\n {\n source: b.source,\n sink: a.sink\n }\n ];\n}\n//# sourceMappingURL=duplex.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-pair/dist/src/duplex.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-pair/dist/src/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/it-pair/dist/src/index.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pair: () => (/* binding */ pair)\n/* harmony export */ });\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n\n/**\n * A pair of streams where one drains from the other\n */\nfunction pair() {\n const deferred = (0,p_defer__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n let piped = false;\n return {\n sink: async (source) => {\n if (piped) {\n throw new Error('already piped');\n }\n piped = true;\n deferred.resolve(source);\n },\n source: (async function* () {\n const source = await deferred.promise;\n yield* source;\n }())\n };\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-pair/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-parallel/dist/src/index.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/it-parallel/dist/src/index.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ parallel)\n/* harmony export */ });\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/**\n * @packageDocumentation\n *\n * Takes an (async) iterable that emits promise-returning functions, invokes them in parallel up to the concurrency limit and emits the results as they become available, optionally in the same order as the input\n *\n * @example\n *\n * ```javascript\n * import parallel from 'it-parallel'\n * import all from 'it-all'\n * import delay from 'delay'\n *\n * // This can also be an iterator, async iterator, generator, etc\n * const input = [\n * async () => {\n * console.info('start 1')\n * await delay(500)\n *\n * console.info('end 1')\n * return 1\n * },\n * async () => {\n * console.info('start 2')\n * await delay(200)\n *\n * console.info('end 2')\n * return 2\n * },\n * async () => {\n * console.info('start 3')\n * await delay(100)\n *\n * console.info('end 3')\n * return 3\n * }\n * ]\n *\n * const result = await all(parallel(input, {\n * concurrency: 2\n * }))\n *\n * // output:\n * // start 1\n * // start 2\n * // end 2\n * // start 3\n * // end 3\n * // end 1\n *\n * console.info(result) // [2, 3, 1]\n * ```\n *\n * If order is important, pass `ordered: true` as an option:\n *\n * ```javascript\n * const result = await all(parallel(input, {\n * concurrency: 2,\n * ordered: true\n * }))\n *\n * // output:\n * // start 1\n * // start 2\n * // end 2\n * // start 3\n * // end 3\n * // end 1\n *\n * console.info(result) // [1, 2, 3]\n * ```\n */\n\nconst CustomEvent = globalThis.CustomEvent ?? Event;\n/**\n * Takes an (async) iterator that emits promise-returning functions,\n * invokes them in parallel and emits the results as they become available but\n * in the same order as the input\n */\nasync function* parallel(source, options = {}) {\n let concurrency = options.concurrency ?? Infinity;\n if (concurrency < 1) {\n concurrency = Infinity;\n }\n const ordered = options.ordered == null ? false : options.ordered;\n const emitter = new EventTarget();\n const ops = [];\n let slotAvailable = (0,p_defer__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n let resultAvailable = (0,p_defer__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n let sourceFinished = false;\n let sourceErr;\n let opErred = false;\n emitter.addEventListener('task-complete', () => {\n resultAvailable.resolve();\n });\n void Promise.resolve().then(async () => {\n try {\n for await (const task of source) {\n if (ops.length === concurrency) {\n slotAvailable = (0,p_defer__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n await slotAvailable.promise;\n }\n if (opErred) {\n break;\n }\n const op = {\n done: false\n };\n ops.push(op);\n task()\n .then(result => {\n op.done = true;\n op.ok = true;\n op.value = result;\n emitter.dispatchEvent(new CustomEvent('task-complete'));\n }, err => {\n op.done = true;\n op.err = err;\n emitter.dispatchEvent(new CustomEvent('task-complete'));\n });\n }\n sourceFinished = true;\n emitter.dispatchEvent(new CustomEvent('task-complete'));\n }\n catch (err) {\n sourceErr = err;\n emitter.dispatchEvent(new CustomEvent('task-complete'));\n }\n });\n function valuesAvailable() {\n if (ordered) {\n return ops[0]?.done;\n }\n return Boolean(ops.find(op => op.done));\n }\n function* yieldOrderedValues() {\n while ((ops.length > 0) && ops[0].done) {\n const op = ops[0];\n ops.shift();\n if (op.ok) {\n yield op.value;\n }\n else {\n // allow the source to exit\n opErred = true;\n slotAvailable.resolve();\n throw op.err;\n }\n slotAvailable.resolve();\n }\n }\n function* yieldUnOrderedValues() {\n // more values can become available while we wait for `yield`\n // to return control to this function\n while (valuesAvailable()) {\n for (let i = 0; i < ops.length; i++) {\n if (ops[i].done) {\n const op = ops[i];\n ops.splice(i, 1);\n i--;\n if (op.ok) {\n yield op.value;\n }\n else {\n opErred = true;\n slotAvailable.resolve();\n throw op.err;\n }\n slotAvailable.resolve();\n }\n }\n }\n }\n while (true) {\n if (!valuesAvailable()) {\n resultAvailable = (0,p_defer__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n await resultAvailable.promise;\n }\n if (sourceErr != null) {\n // the source threw an error, propagate it\n throw sourceErr;\n }\n if (ordered) {\n yield* yieldOrderedValues();\n }\n else {\n yield* yieldUnOrderedValues();\n }\n if (sourceFinished && ops.length === 0) {\n // not waiting for any results and no more tasks so we are done\n break;\n }\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-parallel/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-peekable/dist/src/index.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/it-peekable/dist/src/index.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/**\n * @packageDocumentation\n *\n * Lets you look at the contents of an async iterator and decide what to do\n *\n * @example\n *\n * ```javascript\n * import peekable from 'it-peekable'\n *\n * // This can also be an iterator, generator, etc\n * const values = [0, 1, 2, 3, 4]\n *\n * const it = peekable(value)\n *\n * const first = it.peek()\n *\n * console.info(first) // 0\n *\n * it.push(first)\n *\n * console.info([...it])\n * // [ 0, 1, 2, 3, 4 ]\n * ```\n *\n * Async sources must be awaited:\n *\n * ```javascript\n * import peekable from 'it-peekable'\n *\n * const values = async function * () {\n * yield * [0, 1, 2, 3, 4]\n * }\n *\n * const it = peekable(values())\n *\n * const first = await it.peek()\n *\n * console.info(first) // 0\n *\n * it.push(first)\n *\n * console.info(await all(it))\n * // [ 0, 1, 2, 3, 4 ]\n * ```\n */\nfunction peekable(iterable) {\n // @ts-expect-error can't use Symbol.asyncIterator to index iterable since it might be Iterable\n const [iterator, symbol] = iterable[Symbol.asyncIterator] != null\n // @ts-expect-error can't use Symbol.asyncIterator to index iterable since it might be Iterable\n ? [iterable[Symbol.asyncIterator](), Symbol.asyncIterator]\n // @ts-expect-error can't use Symbol.iterator to index iterable since it might be AsyncIterable\n : [iterable[Symbol.iterator](), Symbol.iterator];\n const queue = [];\n // @ts-expect-error can't use symbol to index peekable\n return {\n peek: () => {\n return iterator.next();\n },\n push: (value) => {\n queue.push(value);\n },\n next: () => {\n if (queue.length > 0) {\n return {\n done: false,\n value: queue.shift()\n };\n }\n return iterator.next();\n },\n [symbol]() {\n return this;\n }\n };\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (peekable);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-peekable/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-pipe/dist/src/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/it-pipe/dist/src/index.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pipe: () => (/* binding */ pipe),\n/* harmony export */ rawPipe: () => (/* binding */ rawPipe)\n/* harmony export */ });\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var it_merge__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-merge */ \"./node_modules/it-merge/dist/src/index.js\");\n\n\nfunction pipe(first, ...rest) {\n if (first == null) {\n throw new Error('Empty pipeline');\n }\n // Duplex at start: wrap in function and return duplex source\n if (isDuplex(first)) {\n const duplex = first;\n first = () => duplex.source;\n // Iterable at start: wrap in function\n }\n else if (isIterable(first) || isAsyncIterable(first)) {\n const source = first;\n first = () => source;\n }\n const fns = [first, ...rest];\n if (fns.length > 1) {\n // Duplex at end: use duplex sink\n if (isDuplex(fns[fns.length - 1])) {\n fns[fns.length - 1] = fns[fns.length - 1].sink;\n }\n }\n if (fns.length > 2) {\n // Duplex in the middle, consume source with duplex sink and return duplex source\n for (let i = 1; i < fns.length - 1; i++) {\n if (isDuplex(fns[i])) {\n fns[i] = duplexPipelineFn(fns[i]);\n }\n }\n }\n return rawPipe(...fns);\n}\nconst rawPipe = (...fns) => {\n let res;\n while (fns.length > 0) {\n res = fns.shift()(res);\n }\n return res;\n};\nconst isAsyncIterable = (obj) => {\n return obj?.[Symbol.asyncIterator] != null;\n};\nconst isIterable = (obj) => {\n return obj?.[Symbol.iterator] != null;\n};\nconst isDuplex = (obj) => {\n if (obj == null) {\n return false;\n }\n return obj.sink != null && obj.source != null;\n};\nconst duplexPipelineFn = (duplex) => {\n return (source) => {\n const p = duplex.sink(source);\n if (p?.then != null) {\n const stream = (0,it_pushable__WEBPACK_IMPORTED_MODULE_0__.pushable)({\n objectMode: true\n });\n p.then(() => {\n stream.end();\n }, (err) => {\n stream.end(err);\n });\n let sourceWrap;\n const source = duplex.source;\n if (isAsyncIterable(source)) {\n sourceWrap = async function* () {\n yield* source;\n stream.end();\n };\n }\n else if (isIterable(source)) {\n sourceWrap = function* () {\n yield* source;\n stream.end();\n };\n }\n else {\n throw new Error('Unknown duplex source type - must be Iterable or AsyncIterable');\n }\n return (0,it_merge__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(stream, sourceWrap());\n }\n return duplex.source;\n };\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-pipe/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-protobuf-stream/dist/src/index.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/it-protobuf-stream/dist/src/index.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pbStream: () => (/* binding */ pbStream)\n/* harmony export */ });\n/* harmony import */ var it_length_prefixed_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-length-prefixed-stream */ \"./node_modules/it-length-prefixed-stream/dist/src/index.js\");\n/**\n * @packageDocumentation\n *\n * This module makes it easy to send and receive length-prefixed Protobuf encoded\n * messages over streams.\n *\n * @example\n *\n * ```typescript\n * import { pbStream } from 'it-protobuf-stream'\n * import { MessageType } from './src/my-message-type.js'\n *\n * // RequestType and ResponseType have been generate from `.proto` files and have\n * // `.encode` and `.decode` methods for serialization/deserialization\n *\n * const stream = pbStream(duplex)\n *\n * // write a message to the stream\n * stream.write({\n * foo: 'bar'\n * }, MessageType)\n *\n * // read a message from the stream\n * const res = await stream.read(MessageType)\n * ```\n */\n\nfunction pbStream(duplex, opts) {\n const lp = (0,it_length_prefixed_stream__WEBPACK_IMPORTED_MODULE_0__.lpStream)(duplex, opts);\n const W = {\n read: async (proto, options) => {\n // readLP, decode\n const value = await lp.read(options);\n return proto.decode(value);\n },\n write: async (message, proto, options) => {\n // encode, writeLP\n await lp.write(proto.encode(message), options);\n },\n writeV: async (messages, proto, options) => {\n // encode, writeLP\n await lp.writeV(messages.map(message => proto.encode(message)), options);\n },\n pb: (proto) => {\n return {\n read: async (options) => W.read(proto, options),\n write: async (d, options) => W.write(d, proto, options),\n writeV: async (d, options) => W.writeV(d, proto, options),\n unwrap: () => W\n };\n },\n unwrap: () => {\n return lp.unwrap();\n }\n };\n return W;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-protobuf-stream/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-pushable/dist/src/fifo.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/it-pushable/dist/src/fifo.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FIFO: () => (/* binding */ FIFO)\n/* harmony export */ });\n// ported from https://www.npmjs.com/package/fast-fifo\nclass FixedFIFO {\n buffer;\n mask;\n top;\n btm;\n next;\n constructor(hwm) {\n if (!(hwm > 0) || ((hwm - 1) & hwm) !== 0) {\n throw new Error('Max size for a FixedFIFO should be a power of two');\n }\n this.buffer = new Array(hwm);\n this.mask = hwm - 1;\n this.top = 0;\n this.btm = 0;\n this.next = null;\n }\n push(data) {\n if (this.buffer[this.top] !== undefined) {\n return false;\n }\n this.buffer[this.top] = data;\n this.top = (this.top + 1) & this.mask;\n return true;\n }\n shift() {\n const last = this.buffer[this.btm];\n if (last === undefined) {\n return undefined;\n }\n this.buffer[this.btm] = undefined;\n this.btm = (this.btm + 1) & this.mask;\n return last;\n }\n isEmpty() {\n return this.buffer[this.btm] === undefined;\n }\n}\nclass FIFO {\n size;\n hwm;\n head;\n tail;\n constructor(options = {}) {\n this.hwm = options.splitLimit ?? 16;\n this.head = new FixedFIFO(this.hwm);\n this.tail = this.head;\n this.size = 0;\n }\n calculateSize(obj) {\n if (obj?.byteLength != null) {\n return obj.byteLength;\n }\n return 1;\n }\n push(val) {\n if (val?.value != null) {\n this.size += this.calculateSize(val.value);\n }\n if (!this.head.push(val)) {\n const prev = this.head;\n this.head = prev.next = new FixedFIFO(2 * this.head.buffer.length);\n this.head.push(val);\n }\n }\n shift() {\n let val = this.tail.shift();\n if (val === undefined && (this.tail.next != null)) {\n const next = this.tail.next;\n this.tail.next = null;\n this.tail = next;\n val = this.tail.shift();\n }\n if (val?.value != null) {\n this.size -= this.calculateSize(val.value);\n }\n return val;\n }\n isEmpty() {\n return this.head.isEmpty();\n }\n}\n//# sourceMappingURL=fifo.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-pushable/dist/src/fifo.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-pushable/dist/src/index.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/it-pushable/dist/src/index.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ pushable: () => (/* binding */ pushable),\n/* harmony export */ pushableV: () => (/* binding */ pushableV)\n/* harmony export */ });\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/* harmony import */ var _fifo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fifo.js */ \"./node_modules/it-pushable/dist/src/fifo.js\");\n/**\n * @packageDocumentation\n *\n * An iterable that you can push values into.\n *\n * @example\n *\n * ```js\n * import { pushable } from 'it-pushable'\n *\n * const source = pushable()\n *\n * setTimeout(() => source.push('hello'), 100)\n * setTimeout(() => source.push('world'), 200)\n * setTimeout(() => source.end(), 300)\n *\n * const start = Date.now()\n *\n * for await (const value of source) {\n * console.log(`got \"${value}\" after ${Date.now() - start}ms`)\n * }\n * console.log(`done after ${Date.now() - start}ms`)\n *\n * // Output:\n * // got \"hello\" after 105ms\n * // got \"world\" after 207ms\n * // done after 309ms\n * ```\n *\n * @example\n *\n * ```js\n * import { pushableV } from 'it-pushable'\n * import all from 'it-all'\n *\n * const source = pushableV()\n *\n * source.push(1)\n * source.push(2)\n * source.push(3)\n * source.end()\n *\n * console.info(await all(source))\n *\n * // Output:\n * // [ [1, 2, 3] ]\n * ```\n */\n\n\nclass AbortError extends Error {\n type;\n code;\n constructor(message, code) {\n super(message ?? 'The operation was aborted');\n this.type = 'aborted';\n this.code = code ?? 'ABORT_ERR';\n }\n}\nfunction pushable(options = {}) {\n const getNext = (buffer) => {\n const next = buffer.shift();\n if (next == null) {\n return { done: true };\n }\n if (next.error != null) {\n throw next.error;\n }\n return {\n done: next.done === true,\n // @ts-expect-error if done is false, value will be present\n value: next.value\n };\n };\n return _pushable(getNext, options);\n}\nfunction pushableV(options = {}) {\n const getNext = (buffer) => {\n let next;\n const values = [];\n while (!buffer.isEmpty()) {\n next = buffer.shift();\n if (next == null) {\n break;\n }\n if (next.error != null) {\n throw next.error;\n }\n if (next.done === false) {\n // @ts-expect-error if done is false value should be pushed\n values.push(next.value);\n }\n }\n if (next == null) {\n return { done: true };\n }\n return {\n done: next.done === true,\n value: values\n };\n };\n return _pushable(getNext, options);\n}\nfunction _pushable(getNext, options) {\n options = options ?? {};\n let onEnd = options.onEnd;\n let buffer = new _fifo_js__WEBPACK_IMPORTED_MODULE_0__.FIFO();\n let pushable;\n let onNext;\n let ended;\n let drain = (0,p_defer__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n const waitNext = async () => {\n try {\n if (!buffer.isEmpty()) {\n return getNext(buffer);\n }\n if (ended) {\n return { done: true };\n }\n return await new Promise((resolve, reject) => {\n onNext = (next) => {\n onNext = null;\n buffer.push(next);\n try {\n resolve(getNext(buffer));\n }\n catch (err) {\n reject(err);\n }\n return pushable;\n };\n });\n }\n finally {\n if (buffer.isEmpty()) {\n // settle promise in the microtask queue to give consumers a chance to\n // await after calling .push\n queueMicrotask(() => {\n drain.resolve();\n drain = (0,p_defer__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n });\n }\n }\n };\n const bufferNext = (next) => {\n if (onNext != null) {\n return onNext(next);\n }\n buffer.push(next);\n return pushable;\n };\n const bufferError = (err) => {\n buffer = new _fifo_js__WEBPACK_IMPORTED_MODULE_0__.FIFO();\n if (onNext != null) {\n return onNext({ error: err });\n }\n buffer.push({ error: err });\n return pushable;\n };\n const push = (value) => {\n if (ended) {\n return pushable;\n }\n // @ts-expect-error `byteLength` is not declared on PushType\n if (options?.objectMode !== true && value?.byteLength == null) {\n throw new Error('objectMode was not true but tried to push non-Uint8Array value');\n }\n return bufferNext({ done: false, value });\n };\n const end = (err) => {\n if (ended)\n return pushable;\n ended = true;\n return (err != null) ? bufferError(err) : bufferNext({ done: true });\n };\n const _return = () => {\n buffer = new _fifo_js__WEBPACK_IMPORTED_MODULE_0__.FIFO();\n end();\n return { done: true };\n };\n const _throw = (err) => {\n end(err);\n return { done: true };\n };\n pushable = {\n [Symbol.asyncIterator]() { return this; },\n next: waitNext,\n return: _return,\n throw: _throw,\n push,\n end,\n get readableLength() {\n return buffer.size;\n },\n onEmpty: async (options) => {\n const signal = options?.signal;\n signal?.throwIfAborted();\n if (buffer.isEmpty()) {\n return;\n }\n let cancel;\n let listener;\n if (signal != null) {\n cancel = new Promise((resolve, reject) => {\n listener = () => {\n reject(new AbortError());\n };\n signal.addEventListener('abort', listener);\n });\n }\n try {\n await Promise.race([\n drain.promise,\n cancel\n ]);\n }\n finally {\n if (listener != null && signal != null) {\n signal?.removeEventListener('abort', listener);\n }\n }\n }\n };\n if (onEnd == null) {\n return pushable;\n }\n const _pushable = pushable;\n pushable = {\n [Symbol.asyncIterator]() { return this; },\n next() {\n return _pushable.next();\n },\n throw(err) {\n _pushable.throw(err);\n if (onEnd != null) {\n onEnd(err);\n onEnd = undefined;\n }\n return { done: true };\n },\n return() {\n _pushable.return();\n if (onEnd != null) {\n onEnd();\n onEnd = undefined;\n }\n return { done: true };\n },\n push,\n end(err) {\n _pushable.end(err);\n if (onEnd != null) {\n onEnd(err);\n onEnd = undefined;\n }\n return pushable;\n },\n get readableLength() {\n return _pushable.readableLength;\n },\n onEmpty: (opts) => {\n return _pushable.onEmpty(opts);\n }\n };\n return pushable;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-pushable/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-sort/dist/src/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/it-sort/dist/src/index.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n/**\n * @packageDocumentation\n *\n * Consumes all values from an (async)iterable and returns them sorted by the passed sort function.\n *\n * @example\n *\n * ```javascript\n * import sort from 'it-sort'\n * import all from 'it-all'\n *\n * const sorter = (a, b) => {\n * return a.localeCompare(b)\n * }\n *\n * // This can also be an iterator, generator, etc\n * const values = ['foo', 'bar']\n *\n * const arr = all(sort(values, sorter))\n *\n * console.info(arr) // 'bar', 'foo'\n * ```\n *\n * Async sources must be awaited:\n *\n * ```javascript\n * import sort from 'it-sort'\n * import all from 'it-all'\n *\n * const sorter = (a, b) => {\n * return a.localeCompare(b)\n * }\n *\n * const values = async function * () {\n * yield * ['foo', 'bar']\n * }\n *\n * const arr = await all(sort(values, sorter))\n *\n * console.info(arr) // 'bar', 'foo'\n * ```\n */\n\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction sort(source, sorter) {\n if (isAsyncIterable(source)) {\n return (async function* () {\n const arr = await (0,it_all__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(source);\n yield* arr.sort(sorter);\n })();\n }\n return (function* () {\n const arr = (0,it_all__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(source);\n yield* arr.sort(sorter);\n })();\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (sort);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-sort/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-take/dist/src/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/it-take/dist/src/index.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/**\n * @packageDocumentation\n *\n * For when you only want a few values out of an (async)iterable.\n *\n * @example\n *\n * ```javascript\n * import take from 'it-take'\n * import all from 'it-all'\n *\n * // This can also be an iterator, generator, etc\n * const values = [0, 1, 2, 3, 4]\n *\n * const arr = all(take(values, 2))\n *\n * console.info(arr) // 0, 1\n * ```\n *\n * Async sources must be awaited:\n *\n * ```javascript\n * import take from 'it-take'\n * import all from 'it-all'\n *\n * const values = async function * () {\n * yield * [0, 1, 2, 3, 4]\n * }\n *\n * const arr = await all(take(values(), 2))\n *\n * console.info(arr) // 0, 1\n * ```\n */\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction take(source, limit) {\n if (isAsyncIterable(source)) {\n return (async function* () {\n let items = 0;\n if (limit < 1) {\n return;\n }\n for await (const entry of source) {\n yield entry;\n items++;\n if (items === limit) {\n return;\n }\n }\n })();\n }\n return (function* () {\n let items = 0;\n if (limit < 1) {\n return;\n }\n for (const entry of source) {\n yield entry;\n items++;\n if (items === limit) {\n return;\n }\n }\n })();\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (take);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-take/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-ws/dist/src/client.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/it-ws/dist/src/client.js ***!
|
||
\***********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ connect: () => (/* binding */ connect)\n/* harmony export */ });\n/* harmony import */ var _duplex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./duplex.js */ \"./node_modules/it-ws/dist/src/duplex.js\");\n/* harmony import */ var _web_socket_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./web-socket.js */ \"./node_modules/it-ws/dist/src/web-socket.browser.js\");\n/* harmony import */ var _ws_url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ws-url.js */ \"./node_modules/it-ws/dist/src/ws-url.js\");\n// load websocket library if we are not in the browser\n\n\n\nfunction connect(addr, opts) {\n const location = typeof window === 'undefined' ? undefined : window.location;\n opts = opts ?? {};\n const url = (0,_ws_url_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(addr, location);\n // it's necessary to stringify the URL object otherwise react-native crashes\n const socket = new _web_socket_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](url.toString(), opts.websocket);\n return (0,_duplex_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(socket, opts);\n}\n//# sourceMappingURL=client.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-ws/dist/src/client.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-ws/dist/src/duplex.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/it-ws/dist/src/duplex.js ***!
|
||
\***********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _sink_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sink.js */ \"./node_modules/it-ws/dist/src/sink.js\");\n/* harmony import */ var _source_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./source.js */ \"./node_modules/it-ws/dist/src/source.js\");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((socket, options) => {\n options = options ?? {};\n const connectedSource = (0,_source_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(socket);\n let remoteAddress = options.remoteAddress;\n let remotePort = options.remotePort;\n if (socket.url != null) {\n // only client->server sockets have urls, server->client connections do not\n try {\n const url = new URL(socket.url);\n remoteAddress = url.hostname;\n remotePort = parseInt(url.port, 10);\n }\n catch { }\n }\n if (remoteAddress == null || remotePort == null) {\n throw new Error('Remote connection did not have address and/or port');\n }\n const duplex = {\n sink: (0,_sink_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(socket, options),\n source: connectedSource,\n connected: async () => { await connectedSource.connected(); },\n close: async () => {\n if (socket.readyState === socket.CONNECTING || socket.readyState === socket.OPEN) {\n await new Promise((resolve) => {\n socket.addEventListener('close', () => {\n resolve();\n });\n socket.close();\n });\n }\n },\n destroy: () => {\n if (socket.terminate != null) {\n socket.terminate();\n }\n else {\n socket.close();\n }\n },\n remoteAddress,\n remotePort,\n socket\n };\n return duplex;\n});\n//# sourceMappingURL=duplex.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-ws/dist/src/duplex.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-ws/dist/src/ready.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/it-ws/dist/src/ready.js ***!
|
||
\**********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (async (socket) => {\n // if the socket is closing or closed, return end\n if (socket.readyState >= 2) {\n throw new Error('socket closed');\n }\n // if open, return\n if (socket.readyState === 1) {\n return;\n }\n await new Promise((resolve, reject) => {\n function cleanup() {\n socket.removeEventListener('open', handleOpen);\n socket.removeEventListener('error', handleErr);\n }\n function handleOpen() {\n cleanup();\n resolve();\n }\n function handleErr(event) {\n cleanup();\n reject(event.error ?? new Error(`connect ECONNREFUSED ${socket.url}`));\n }\n socket.addEventListener('open', handleOpen);\n socket.addEventListener('error', handleErr);\n });\n});\n//# sourceMappingURL=ready.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-ws/dist/src/ready.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-ws/dist/src/sink.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/it-ws/dist/src/sink.js ***!
|
||
\*********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _ready_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ready.js */ \"./node_modules/it-ws/dist/src/ready.js\");\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((socket, options) => {\n options = options ?? {};\n options.closeOnEnd = options.closeOnEnd !== false;\n const sink = async (source) => {\n for await (const data of source) {\n try {\n await (0,_ready_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(socket);\n }\n catch (err) {\n if (err.message === 'socket closed')\n break;\n throw err;\n }\n // the ready promise resolved without error but the socket was closing so\n // exit the loop and don't send data\n if (socket.readyState === socket.CLOSING || socket.readyState === socket.CLOSED) {\n break;\n }\n socket.send(data);\n }\n if (options.closeOnEnd != null && socket.readyState <= 1) {\n await new Promise((resolve, reject) => {\n socket.addEventListener('close', event => {\n if (event.wasClean || event.code === 1006) {\n resolve();\n }\n else {\n const err = Object.assign(new Error('ws error'), { event });\n reject(err);\n }\n });\n setTimeout(() => { socket.close(); });\n });\n }\n };\n return sink;\n});\n//# sourceMappingURL=sink.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-ws/dist/src/sink.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-ws/dist/src/source.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/it-ws/dist/src/source.js ***!
|
||
\***********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var event_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! event-iterator */ \"./node_modules/event-iterator/lib/dom.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/it-ws/node_modules/uint8arrays/dist/src/from-string.js\");\n\n\n// copied from github.com/feross/buffer\n// Some ArrayBuffers are not passing the instanceof check, so we need to do a bit more work :(\nfunction isArrayBuffer(obj) {\n return (obj instanceof ArrayBuffer) ||\n (obj?.constructor?.name === 'ArrayBuffer' && typeof obj?.byteLength === 'number');\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((socket) => {\n socket.binaryType = 'arraybuffer';\n const connected = async () => {\n await new Promise((resolve, reject) => {\n if (isConnected) {\n resolve();\n return;\n }\n if (connError != null) {\n reject(connError);\n return;\n }\n const cleanUp = (cont) => {\n socket.removeEventListener('open', onOpen);\n socket.removeEventListener('error', onError);\n cont();\n };\n const onOpen = () => { cleanUp(resolve); };\n const onError = (event) => {\n cleanUp(() => { reject(event.error ?? new Error(`connect ECONNREFUSED ${socket.url}`)); });\n };\n socket.addEventListener('open', onOpen);\n socket.addEventListener('error', onError);\n });\n };\n const source = (async function* () {\n const messages = new event_iterator__WEBPACK_IMPORTED_MODULE_0__.EventIterator(({ push, stop, fail }) => {\n const onMessage = (event) => {\n let data = null;\n if (typeof event.data === 'string') {\n data = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(event.data);\n }\n if (isArrayBuffer(event.data)) {\n data = new Uint8Array(event.data);\n }\n if (event.data instanceof Uint8Array) {\n data = event.data;\n }\n if (data == null) {\n return;\n }\n push(data);\n };\n const onError = (event) => { fail(event.error ?? new Error('Socket error')); };\n socket.addEventListener('message', onMessage);\n socket.addEventListener('error', onError);\n socket.addEventListener('close', stop);\n return () => {\n socket.removeEventListener('message', onMessage);\n socket.removeEventListener('error', onError);\n socket.removeEventListener('close', stop);\n };\n }, { highWaterMark: Infinity });\n await connected();\n for await (const chunk of messages) {\n yield isArrayBuffer(chunk) ? new Uint8Array(chunk) : chunk;\n }\n }());\n let isConnected = socket.readyState === 1;\n let connError;\n socket.addEventListener('open', () => {\n isConnected = true;\n connError = null;\n });\n socket.addEventListener('close', () => {\n isConnected = false;\n connError = null;\n });\n socket.addEventListener('error', event => {\n if (!isConnected) {\n connError = event.error ?? new Error(`connect ECONNREFUSED ${socket.url}`);\n }\n });\n return Object.assign(source, {\n connected\n });\n});\n//# sourceMappingURL=source.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-ws/dist/src/source.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-ws/dist/src/web-socket.browser.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/it-ws/dist/src/web-socket.browser.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* eslint-env browser */\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (WebSocket);\n//# sourceMappingURL=web-socket.browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-ws/dist/src/web-socket.browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-ws/dist/src/ws-url.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/it-ws/dist/src/ws-url.js ***!
|
||
\***********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nconst map = { 'http:': 'ws:', 'https:': 'wss:' };\nconst defaultProtocol = 'ws:';\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((url, location) => {\n if (url.startsWith('//')) {\n url = `${location?.protocol ?? defaultProtocol}${url}`;\n }\n if (url.startsWith('/') && location != null) {\n const proto = location.protocol ?? defaultProtocol;\n const host = location.host;\n const port = location.port != null && host?.endsWith(`:${location.port}`) !== true ? `:${location.port}` : '';\n url = `${proto}//${host}${port}${url}`;\n }\n const wsUrl = new URL(url);\n for (const [httpProto, wsProto] of Object.entries(map)) {\n if (wsUrl.protocol === httpProto) {\n wsUrl.protocol = wsProto;\n }\n }\n return wsUrl;\n});\n//# sourceMappingURL=ws-url.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-ws/dist/src/ws-url.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-ws/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!***********************************************************************!*\
|
||
!*** ./node_modules/it-ws/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\***********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-ws/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-ws/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/it-ws/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/it-ws/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-ws/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/it-ws/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/it-ws/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/it-ws/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/it-ws/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/address-manager/index.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/address-manager/index.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultAddressManager: () => (/* binding */ DefaultAddressManager)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/libp2p/dist/src/address-manager/utils.js\");\n\n\n\nconst defaultAddressFilter = (addrs) => addrs;\n/**\n * If the passed multiaddr contains the passed peer id, remove it\n */\nfunction stripPeerId(ma, peerId) {\n const observedPeerIdStr = ma.getPeerId();\n // strip our peer id if it has been passed\n if (observedPeerIdStr != null) {\n const observedPeerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(observedPeerIdStr);\n // use same encoding for comparison\n if (observedPeerId.equals(peerId)) {\n ma = ma.decapsulate((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(`/p2p/${peerId.toString()}`));\n }\n }\n return ma;\n}\nclass DefaultAddressManager {\n log;\n components;\n // this is an array to allow for duplicates, e.g. multiples of `/ip4/0.0.0.0/tcp/0`\n listen;\n announce;\n observed;\n announceFilter;\n /**\n * Responsible for managing the peer addresses.\n * Peers can specify their listen and announce addresses.\n * The listen addresses will be used by the libp2p transports to listen for new connections,\n * while the announce addresses will be used for the peer addresses' to other peers in the network.\n */\n constructor(components, init = {}) {\n const { listen = [], announce = [] } = init;\n this.components = components;\n this.log = components.logger.forComponent('libp2p:address-manager');\n this.listen = listen.map(ma => ma.toString());\n this.announce = new Set(announce.map(ma => ma.toString()));\n this.observed = new Map();\n this.announceFilter = init.announceFilter ?? defaultAddressFilter;\n // this method gets called repeatedly on startup when transports start listening so\n // debounce it so we don't cause multiple self:peer:update events to be emitted\n this._updatePeerStoreAddresses = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.debounce)(this._updatePeerStoreAddresses.bind(this), 1000);\n // update our stored addresses when new transports listen\n components.events.addEventListener('transport:listening', () => {\n this._updatePeerStoreAddresses();\n });\n // update our stored addresses when existing transports stop listening\n components.events.addEventListener('transport:close', () => {\n this._updatePeerStoreAddresses();\n });\n }\n _updatePeerStoreAddresses() {\n // if announce addresses have been configured, ensure they make it into our peer\n // record for things like identify\n const addrs = this.getAnnounceAddrs()\n .concat(this.components.transportManager.getAddrs())\n .concat([...this.observed.entries()]\n .filter(([_, metadata]) => metadata.confident)\n .map(([str]) => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(str))).map(ma => {\n // strip our peer id if it is present\n if (ma.getPeerId() === this.components.peerId.toString()) {\n return ma.decapsulate(`/p2p/${this.components.peerId.toString()}`);\n }\n return ma;\n });\n this.components.peerStore.patch(this.components.peerId, {\n multiaddrs: addrs\n })\n .catch(err => { this.log.error('error updating addresses', err); });\n }\n /**\n * Get peer listen multiaddrs\n */\n getListenAddrs() {\n return Array.from(this.listen).map((a) => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(a));\n }\n /**\n * Get peer announcing multiaddrs\n */\n getAnnounceAddrs() {\n return Array.from(this.announce).map((a) => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(a));\n }\n /**\n * Get observed multiaddrs\n */\n getObservedAddrs() {\n return Array.from(this.observed).map(([a]) => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(a));\n }\n /**\n * Add peer observed addresses\n */\n addObservedAddr(addr) {\n addr = stripPeerId(addr, this.components.peerId);\n const addrString = addr.toString();\n // do not trigger the change:addresses event if we already know about this address\n if (this.observed.has(addrString)) {\n return;\n }\n this.observed.set(addrString, {\n confident: false\n });\n }\n confirmObservedAddr(addr) {\n addr = stripPeerId(addr, this.components.peerId);\n const addrString = addr.toString();\n const metadata = this.observed.get(addrString) ?? {\n confident: false\n };\n const startingConfidence = metadata.confident;\n this.observed.set(addrString, {\n confident: true\n });\n // only trigger the 'self:peer:update' event if our confidence in an address has changed\n if (!startingConfidence) {\n this._updatePeerStoreAddresses();\n }\n }\n removeObservedAddr(addr) {\n addr = stripPeerId(addr, this.components.peerId);\n const addrString = addr.toString();\n this.observed.delete(addrString);\n }\n getAddresses() {\n let addrs = this.getAnnounceAddrs().map(ma => ma.toString());\n if (addrs.length === 0) {\n // no configured announce addrs, add configured listen addresses\n addrs = this.components.transportManager.getAddrs().map(ma => ma.toString());\n }\n // add observed addresses we are confident in\n addrs = addrs.concat(Array.from(this.observed)\n .filter(([ma, metadata]) => metadata.confident)\n .map(([ma]) => ma));\n // dedupe multiaddrs\n const addrSet = new Set(addrs);\n // Create advertising list\n return this.announceFilter(Array.from(addrSet)\n .map(str => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(str)))\n .map(ma => {\n // do not append our peer id to a path multiaddr as it will become invalid\n if (ma.protos().pop()?.path === true) {\n return ma;\n }\n if (ma.getPeerId() === this.components.peerId.toString()) {\n return ma;\n }\n return ma.encapsulate(`/p2p/${this.components.peerId.toString()}`);\n });\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/address-manager/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/address-manager/utils.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/address-manager/utils.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ debounce: () => (/* binding */ debounce)\n/* harmony export */ });\nfunction debounce(func, wait) {\n let timeout;\n return function () {\n const later = function () {\n timeout = undefined;\n func();\n };\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n };\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/address-manager/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/components.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/components.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ defaultComponents: () => (/* binding */ defaultComponents)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/startable.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n\n\n\nclass DefaultComponents {\n components = {};\n _started = false;\n constructor(init = {}) {\n this.components = {};\n for (const [key, value] of Object.entries(init)) {\n this.components[key] = value;\n }\n if (this.components.logger == null) {\n this.components.logger = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.defaultLogger)();\n }\n }\n isStarted() {\n return this._started;\n }\n async _invokeStartableMethod(methodName) {\n await Promise.all(Object.values(this.components)\n .filter(obj => (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.isStartable)(obj))\n .map(async (startable) => {\n await startable[methodName]?.();\n }));\n }\n async beforeStart() {\n await this._invokeStartableMethod('beforeStart');\n }\n async start() {\n await this._invokeStartableMethod('start');\n this._started = true;\n }\n async afterStart() {\n await this._invokeStartableMethod('afterStart');\n }\n async beforeStop() {\n await this._invokeStartableMethod('beforeStop');\n }\n async stop() {\n await this._invokeStartableMethod('stop');\n this._started = false;\n }\n async afterStop() {\n await this._invokeStartableMethod('afterStop');\n }\n}\nconst OPTIONAL_SERVICES = [\n 'metrics',\n 'connectionProtector',\n 'dns'\n];\nconst NON_SERVICE_PROPERTIES = [\n 'components',\n 'isStarted',\n 'beforeStart',\n 'start',\n 'afterStart',\n 'beforeStop',\n 'stop',\n 'afterStop',\n 'then',\n '_invokeStartableMethod'\n];\nfunction defaultComponents(init = {}) {\n const components = new DefaultComponents(init);\n const proxy = new Proxy(components, {\n get(target, prop, receiver) {\n if (typeof prop === 'string' && !NON_SERVICE_PROPERTIES.includes(prop)) {\n const service = components.components[prop];\n if (service == null && !OPTIONAL_SERVICES.includes(prop)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError(`${prop} not set`, 'ERR_SERVICE_MISSING');\n }\n return service;\n }\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop, value) {\n if (typeof prop === 'string') {\n components.components[prop] = value;\n }\n else {\n Reflect.set(target, prop, value);\n }\n return true;\n }\n });\n // @ts-expect-error component keys are proxied\n return proxy;\n}\n//# sourceMappingURL=components.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/components.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/config.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/config.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ validateConfig: () => (/* binding */ validateConfig)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/transport/index.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/utils/address-sort */ \"./node_modules/@libp2p/utils/dist/src/address-sort.js\");\n/* harmony import */ var _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr/resolvers */ \"./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js\");\n/* harmony import */ var merge_options__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! merge-options */ \"./node_modules/merge-options/index.mjs\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n\n\n\n\n\n\nconst DefaultConfig = {\n addresses: {\n listen: [],\n announce: [],\n noAnnounce: [],\n announceFilter: (multiaddrs) => multiaddrs\n },\n connectionManager: {\n resolvers: {\n dnsaddr: _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_0__.dnsaddrResolver\n },\n addressSorter: _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_2__.defaultAddressSort\n },\n transportManager: {\n faultTolerance: _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.FaultTolerance.FATAL_ALL\n }\n};\nasync function validateConfig(opts) {\n const resultingOptions = (0,merge_options__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(DefaultConfig, opts);\n if (resultingOptions.connectionProtector === null && globalThis.process?.env?.LIBP2P_FORCE_PNET != null) { // eslint-disable-line no-undef\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CodeError(_errors_js__WEBPACK_IMPORTED_MODULE_5__.messages.ERR_PROTECTOR_REQUIRED, _errors_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_PROTECTOR_REQUIRED);\n }\n if (!(await (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_6__.peerIdFromKeys)(resultingOptions.privateKey.public.bytes, resultingOptions.privateKey.bytes)).equals(resultingOptions.peerId)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CodeError('Private key doesn\\'t match peer id', _errors_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_INVALID_KEY);\n }\n return resultingOptions;\n}\n//# sourceMappingURL=config.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/config.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/config/connection-gater.browser.js":
|
||
/*!*************************************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/config/connection-gater.browser.js ***!
|
||
\*************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ connectionGater: () => (/* binding */ connectionGater)\n/* harmony export */ });\n/* harmony import */ var _libp2p_utils_private_ip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/utils/private-ip */ \"./node_modules/@libp2p/utils/dist/src/private-ip.js\");\n\n/**\n * Returns a connection gater that disallows dialling private addresses by\n * default. Browsers are severely limited in their resource usage so don't\n * waste time trying to dial undiallable addresses.\n */\nfunction connectionGater(gater = {}) {\n return {\n denyDialPeer: async () => false,\n denyDialMultiaddr: async (multiaddr) => {\n const tuples = multiaddr.stringTuples();\n if (tuples[0][0] === 4 || tuples[0][0] === 41) {\n return Boolean((0,_libp2p_utils_private_ip__WEBPACK_IMPORTED_MODULE_0__.isPrivateIp)(`${tuples[0][1]}`));\n }\n return false;\n },\n denyInboundConnection: async () => false,\n denyOutboundConnection: async () => false,\n denyInboundEncryptedConnection: async () => false,\n denyOutboundEncryptedConnection: async () => false,\n denyInboundUpgradedConnection: async () => false,\n denyOutboundUpgradedConnection: async () => false,\n filterMultiaddrForPeer: async () => true,\n ...gater\n };\n}\n//# sourceMappingURL=connection-gater.browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/config/connection-gater.browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/connection-manager/auto-dial.js":
|
||
/*!**********************************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/connection-manager/auto-dial.js ***!
|
||
\**********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AutoDial: () => (/* binding */ AutoDial)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/set.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/map.js\");\n/* harmony import */ var _libp2p_utils_peer_queue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/utils/peer-queue */ \"./node_modules/@libp2p/utils/dist/src/peer-queue.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/libp2p/node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.browser.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.defaults.js\");\n\n\n\n\nconst defaultOptions = {\n minConnections: _constants_js__WEBPACK_IMPORTED_MODULE_1__.MIN_CONNECTIONS,\n maxQueueLength: _constants_js__WEBPACK_IMPORTED_MODULE_2__.AUTO_DIAL_MAX_QUEUE_LENGTH,\n autoDialConcurrency: _constants_js__WEBPACK_IMPORTED_MODULE_2__.AUTO_DIAL_CONCURRENCY,\n autoDialPriority: _constants_js__WEBPACK_IMPORTED_MODULE_2__.AUTO_DIAL_PRIORITY,\n autoDialInterval: _constants_js__WEBPACK_IMPORTED_MODULE_2__.AUTO_DIAL_INTERVAL,\n autoDialPeerRetryThreshold: _constants_js__WEBPACK_IMPORTED_MODULE_1__.AUTO_DIAL_PEER_RETRY_THRESHOLD,\n autoDialDiscoveredPeersDebounce: _constants_js__WEBPACK_IMPORTED_MODULE_2__.AUTO_DIAL_DISCOVERED_PEERS_DEBOUNCE\n};\nclass AutoDial {\n connectionManager;\n peerStore;\n queue;\n minConnections;\n autoDialPriority;\n autoDialIntervalMs;\n autoDialMaxQueueLength;\n autoDialPeerRetryThresholdMs;\n autoDialDiscoveredPeersDebounce;\n autoDialInterval;\n started;\n running;\n log;\n /**\n * Proactively tries to connect to known peers stored in the PeerStore.\n * It will keep the number of connections below the upper limit and sort\n * the peers to connect based on whether we know their keys and protocols.\n */\n constructor(components, init) {\n this.connectionManager = components.connectionManager;\n this.peerStore = components.peerStore;\n this.minConnections = init.minConnections ?? defaultOptions.minConnections;\n this.autoDialPriority = init.autoDialPriority ?? defaultOptions.autoDialPriority;\n this.autoDialIntervalMs = init.autoDialInterval ?? defaultOptions.autoDialInterval;\n this.autoDialMaxQueueLength = init.maxQueueLength ?? defaultOptions.maxQueueLength;\n this.autoDialPeerRetryThresholdMs = init.autoDialPeerRetryThreshold ?? defaultOptions.autoDialPeerRetryThreshold;\n this.autoDialDiscoveredPeersDebounce = init.autoDialDiscoveredPeersDebounce ?? defaultOptions.autoDialDiscoveredPeersDebounce;\n this.log = components.logger.forComponent('libp2p:connection-manager:auto-dial');\n this.started = false;\n this.running = false;\n this.queue = new _libp2p_utils_peer_queue__WEBPACK_IMPORTED_MODULE_3__.PeerQueue({\n concurrency: init.autoDialConcurrency ?? defaultOptions.autoDialConcurrency,\n metricName: 'libp2p_autodial_queue',\n metrics: components.metrics\n });\n this.queue.addEventListener('error', (evt) => {\n this.log.error('error during auto-dial', evt.detail);\n });\n // check the min connection limit whenever a peer disconnects\n components.events.addEventListener('connection:close', () => {\n this.autoDial()\n .catch(err => {\n this.log.error(err);\n });\n });\n // sometimes peers are discovered in quick succession so add a small\n // debounce to ensure all eligible peers are autodialed\n let debounce;\n // when new peers are discovered, dial them if we don't have\n // enough connections\n components.events.addEventListener('peer:discovery', () => {\n clearTimeout(debounce);\n debounce = setTimeout(() => {\n this.autoDial()\n .catch(err => {\n this.log.error(err);\n });\n }, this.autoDialDiscoveredPeersDebounce);\n });\n }\n isStarted() {\n return this.started;\n }\n start() {\n this.started = true;\n }\n afterStart() {\n this.autoDial()\n .catch(err => {\n this.log.error('error while autodialing', err);\n });\n }\n stop() {\n // clear the queue\n this.queue.clear();\n clearTimeout(this.autoDialInterval);\n this.started = false;\n this.running = false;\n }\n async autoDial() {\n if (!this.started || this.running) {\n return;\n }\n const connections = this.connectionManager.getConnectionsMap();\n const numConnections = connections.size;\n // already have enough connections\n if (numConnections >= this.minConnections) {\n if (this.minConnections > 0) {\n this.log.trace('have enough connections %d/%d', numConnections, this.minConnections);\n }\n // no need to schedule next autodial as it will be run when on\n // connection:close event\n return;\n }\n if (this.queue.size > this.autoDialMaxQueueLength) {\n this.log('not enough connections %d/%d but auto dial queue is full', numConnections, this.minConnections);\n this.sheduleNextAutodial();\n return;\n }\n this.running = true;\n this.log('not enough connections %d/%d - will dial peers to increase the number of connections', numConnections, this.minConnections);\n const dialQueue = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_4__.PeerSet(\n // @ts-expect-error boolean filter removes falsy peer IDs\n this.connectionManager.getDialQueue()\n .map(queue => queue.peerId)\n .filter(Boolean));\n // sort peers on whether we know protocols or public keys for them\n const peers = await this.peerStore.all({\n filters: [\n // remove some peers\n (peer) => {\n // remove peers without addresses\n if (peer.addresses.length === 0) {\n this.log.trace('not autodialing %p because they have no addresses', peer.id);\n return false;\n }\n // remove peers we are already connected to\n if (connections.has(peer.id)) {\n this.log.trace('not autodialing %p because they are already connected', peer.id);\n return false;\n }\n // remove peers we are already dialling\n if (dialQueue.has(peer.id)) {\n this.log.trace('not autodialing %p because they are already being dialed', peer.id);\n return false;\n }\n // remove peers already in the autodial queue\n if (this.queue.has(peer.id)) {\n this.log.trace('not autodialing %p because they are already being autodialed', peer.id);\n return false;\n }\n return true;\n }\n ]\n });\n // shuffle the peers - this is so peers with the same tag values will be\n // dialled in a different order each time\n const shuffledPeers = peers.sort(() => Math.random() > 0.5 ? 1 : -1);\n // sort shuffled peers by tag value\n const peerValues = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_5__.PeerMap();\n for (const peer of shuffledPeers) {\n if (peerValues.has(peer.id)) {\n continue;\n }\n // sum all tag values\n peerValues.set(peer.id, [...peer.tags.values()].reduce((acc, curr) => {\n return acc + curr.value;\n }, 0));\n }\n // sort by value, highest to lowest\n const sortedPeers = shuffledPeers.sort((a, b) => {\n const peerAValue = peerValues.get(a.id) ?? 0;\n const peerBValue = peerValues.get(b.id) ?? 0;\n if (peerAValue > peerBValue) {\n return -1;\n }\n if (peerAValue < peerBValue) {\n return 1;\n }\n return 0;\n });\n const peersThatHaveNotFailed = sortedPeers.filter(peer => {\n const lastDialFailure = peer.metadata.get(_constants_js__WEBPACK_IMPORTED_MODULE_2__.LAST_DIAL_FAILURE_KEY);\n if (lastDialFailure == null) {\n return true;\n }\n const lastDialFailureTimestamp = parseInt((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(lastDialFailure));\n if (isNaN(lastDialFailureTimestamp)) {\n return true;\n }\n // only dial if the time since the last failure is above the retry threshold\n return Date.now() - lastDialFailureTimestamp > this.autoDialPeerRetryThresholdMs;\n });\n this.log('selected %d/%d peers to dial', peersThatHaveNotFailed.length, peers.length);\n for (const peer of peersThatHaveNotFailed) {\n this.queue.add(async () => {\n const numConnections = this.connectionManager.getConnectionsMap().size;\n // Check to see if we still need to auto dial\n if (numConnections >= this.minConnections) {\n this.log('got enough connections now %d/%d', numConnections, this.minConnections);\n this.queue.clear();\n return;\n }\n this.log('connecting to a peerStore stored peer %p', peer.id);\n await this.connectionManager.openConnection(peer.id, {\n priority: this.autoDialPriority\n });\n }, {\n peerId: peer.id\n }).catch(err => {\n this.log.error('could not connect to peerStore stored peer', err);\n });\n }\n this.running = false;\n this.sheduleNextAutodial();\n }\n sheduleNextAutodial() {\n if (!this.started) {\n return;\n }\n this.autoDialInterval = setTimeout(() => {\n this.autoDial()\n .catch(err => {\n this.log.error('error while autodialing', err);\n });\n }, this.autoDialIntervalMs);\n }\n}\n//# sourceMappingURL=auto-dial.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/connection-manager/auto-dial.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/connection-manager/connection-pruner.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/connection-manager/connection-pruner.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ConnectionPruner: () => (/* binding */ ConnectionPruner)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/map.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.browser.js\");\n\n\nconst defaultOptions = {\n maxConnections: _constants_js__WEBPACK_IMPORTED_MODULE_0__.MAX_CONNECTIONS,\n allow: []\n};\n/**\n * If we go over the max connections limit, choose some connections to close\n */\nclass ConnectionPruner {\n maxConnections;\n connectionManager;\n peerStore;\n allow;\n events;\n log;\n constructor(components, init = {}) {\n this.maxConnections = init.maxConnections ?? defaultOptions.maxConnections;\n this.allow = init.allow ?? defaultOptions.allow;\n this.connectionManager = components.connectionManager;\n this.peerStore = components.peerStore;\n this.events = components.events;\n this.log = components.logger.forComponent('libp2p:connection-manager:connection-pruner');\n // check the max connection limit whenever a peer connects\n components.events.addEventListener('connection:open', () => {\n this.maybePruneConnections()\n .catch(err => {\n this.log.error(err);\n });\n });\n }\n /**\n * If we have more connections than our maximum, select some excess connections\n * to prune based on peer value\n */\n async maybePruneConnections() {\n const connections = this.connectionManager.getConnections();\n const numConnections = connections.length;\n const toPrune = Math.max(numConnections - this.maxConnections, 0);\n this.log('checking max connections limit %d/%d', numConnections, this.maxConnections);\n if (numConnections <= this.maxConnections) {\n return;\n }\n this.log('max connections limit exceeded %d/%d, pruning %d connection(s)', numConnections, this.maxConnections, toPrune);\n const peerValues = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_1__.PeerMap();\n // work out peer values\n for (const connection of connections) {\n const remotePeer = connection.remotePeer;\n if (peerValues.has(remotePeer)) {\n continue;\n }\n peerValues.set(remotePeer, 0);\n try {\n const peer = await this.peerStore.get(remotePeer);\n // sum all tag values\n peerValues.set(remotePeer, [...peer.tags.values()].reduce((acc, curr) => {\n return acc + curr.value;\n }, 0));\n }\n catch (err) {\n if (err.code !== 'ERR_NOT_FOUND') {\n this.log.error('error loading peer tags', err);\n }\n }\n }\n // sort by value, lowest to highest\n const sortedConnections = connections.sort((a, b) => {\n const peerAValue = peerValues.get(a.remotePeer) ?? 0;\n const peerBValue = peerValues.get(b.remotePeer) ?? 0;\n if (peerAValue > peerBValue) {\n return 1;\n }\n if (peerAValue < peerBValue) {\n return -1;\n }\n // if the peers have an equal tag value then we want to close short-lived connections first\n const connectionALifespan = a.timeline.open;\n const connectionBLifespan = b.timeline.open;\n if (connectionALifespan < connectionBLifespan) {\n return 1;\n }\n if (connectionALifespan > connectionBLifespan) {\n return -1;\n }\n return 0;\n });\n // close some connections\n const toClose = [];\n for (const connection of sortedConnections) {\n this.log('too many connections open - closing a connection to %p', connection.remotePeer);\n // check allow list\n const connectionInAllowList = this.allow.some((ma) => {\n return connection.remoteAddr.toString().startsWith(ma.toString());\n });\n // Connections in the allow list should be excluded from pruning\n if (!connectionInAllowList) {\n toClose.push(connection);\n }\n if (toClose.length === toPrune) {\n break;\n }\n }\n // close connections\n await Promise.all(toClose.map(async (connection) => {\n try {\n await connection.close();\n }\n catch (err) {\n this.log.error(err);\n }\n }));\n // despatch prune event\n this.events.safeDispatchEvent('connection:prune', { detail: toClose });\n }\n}\n//# sourceMappingURL=connection-pruner.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/connection-manager/connection-pruner.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/connection-manager/constants.browser.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/connection-manager/constants.browser.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AUTO_DIAL_CONCURRENCY: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.AUTO_DIAL_CONCURRENCY),\n/* harmony export */ AUTO_DIAL_DISCOVERED_PEERS_DEBOUNCE: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.AUTO_DIAL_DISCOVERED_PEERS_DEBOUNCE),\n/* harmony export */ AUTO_DIAL_INTERVAL: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.AUTO_DIAL_INTERVAL),\n/* harmony export */ AUTO_DIAL_MAX_QUEUE_LENGTH: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.AUTO_DIAL_MAX_QUEUE_LENGTH),\n/* harmony export */ AUTO_DIAL_PEER_RETRY_THRESHOLD: () => (/* binding */ AUTO_DIAL_PEER_RETRY_THRESHOLD),\n/* harmony export */ AUTO_DIAL_PRIORITY: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.AUTO_DIAL_PRIORITY),\n/* harmony export */ DIAL_TIMEOUT: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.DIAL_TIMEOUT),\n/* harmony export */ INBOUND_CONNECTION_THRESHOLD: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.INBOUND_CONNECTION_THRESHOLD),\n/* harmony export */ INBOUND_UPGRADE_TIMEOUT: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.INBOUND_UPGRADE_TIMEOUT),\n/* harmony export */ LAST_DIAL_FAILURE_KEY: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.LAST_DIAL_FAILURE_KEY),\n/* harmony export */ MAX_CONNECTIONS: () => (/* binding */ MAX_CONNECTIONS),\n/* harmony export */ MAX_DIAL_QUEUE_LENGTH: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.MAX_DIAL_QUEUE_LENGTH),\n/* harmony export */ MAX_INCOMING_PENDING_CONNECTIONS: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.MAX_INCOMING_PENDING_CONNECTIONS),\n/* harmony export */ MAX_PARALLEL_DIALS: () => (/* binding */ MAX_PARALLEL_DIALS),\n/* harmony export */ MAX_PEER_ADDRS_TO_DIAL: () => (/* reexport safe */ _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__.MAX_PEER_ADDRS_TO_DIAL),\n/* harmony export */ MIN_CONNECTIONS: () => (/* binding */ MIN_CONNECTIONS)\n/* harmony export */ });\n/* harmony import */ var _constants_defaults_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.defaults.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.defaults.js\");\n\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#minConnections\n */\nconst MIN_CONNECTIONS = 5;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxConnections\n */\nconst MAX_CONNECTIONS = 100;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxParallelDials\n */\nconst MAX_PARALLEL_DIALS = 50;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.unknown.ConnectionManagerInit.html#autoDialPeerRetryThreshold\n */\nconst AUTO_DIAL_PEER_RETRY_THRESHOLD = 1000 * 60 * 7;\n//# sourceMappingURL=constants.browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/connection-manager/constants.browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/connection-manager/constants.defaults.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/connection-manager/constants.defaults.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AUTO_DIAL_CONCURRENCY: () => (/* binding */ AUTO_DIAL_CONCURRENCY),\n/* harmony export */ AUTO_DIAL_DISCOVERED_PEERS_DEBOUNCE: () => (/* binding */ AUTO_DIAL_DISCOVERED_PEERS_DEBOUNCE),\n/* harmony export */ AUTO_DIAL_INTERVAL: () => (/* binding */ AUTO_DIAL_INTERVAL),\n/* harmony export */ AUTO_DIAL_MAX_QUEUE_LENGTH: () => (/* binding */ AUTO_DIAL_MAX_QUEUE_LENGTH),\n/* harmony export */ AUTO_DIAL_PRIORITY: () => (/* binding */ AUTO_DIAL_PRIORITY),\n/* harmony export */ DIAL_TIMEOUT: () => (/* binding */ DIAL_TIMEOUT),\n/* harmony export */ INBOUND_CONNECTION_THRESHOLD: () => (/* binding */ INBOUND_CONNECTION_THRESHOLD),\n/* harmony export */ INBOUND_UPGRADE_TIMEOUT: () => (/* binding */ INBOUND_UPGRADE_TIMEOUT),\n/* harmony export */ LAST_DIAL_FAILURE_KEY: () => (/* binding */ LAST_DIAL_FAILURE_KEY),\n/* harmony export */ MAX_DIAL_QUEUE_LENGTH: () => (/* binding */ MAX_DIAL_QUEUE_LENGTH),\n/* harmony export */ MAX_INCOMING_PENDING_CONNECTIONS: () => (/* binding */ MAX_INCOMING_PENDING_CONNECTIONS),\n/* harmony export */ MAX_PEER_ADDRS_TO_DIAL: () => (/* binding */ MAX_PEER_ADDRS_TO_DIAL)\n/* harmony export */ });\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#dialTimeout\n */\nconst DIAL_TIMEOUT = 5e3;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#inboundUpgradeTimeout\n */\nconst INBOUND_UPGRADE_TIMEOUT = 2e3;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxPeerAddrsToDial\n */\nconst MAX_PEER_ADDRS_TO_DIAL = 25;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#autoDialInterval\n */\nconst AUTO_DIAL_INTERVAL = 5000;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#autoDialConcurrency\n */\nconst AUTO_DIAL_CONCURRENCY = 25;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#autoDialPriority\n */\nconst AUTO_DIAL_PRIORITY = 0;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#autoDialMaxQueueLength\n */\nconst AUTO_DIAL_MAX_QUEUE_LENGTH = 100;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.unknown.ConnectionManagerInit.html#autoDialDiscoveredPeersDebounce\n */\nconst AUTO_DIAL_DISCOVERED_PEERS_DEBOUNCE = 10;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#inboundConnectionThreshold\n */\nconst INBOUND_CONNECTION_THRESHOLD = 5;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxIncomingPendingConnections\n */\nconst MAX_INCOMING_PENDING_CONNECTIONS = 10;\n/**\n * Store as part of the peer store metadata for a given peer, the value for this\n * key is a timestamp of the last time a dial attempted failed with the relevant\n * peer stored as a string.\n *\n * Used to insure we do not endlessly try to auto dial peers we have recently\n * failed to dial.\n */\nconst LAST_DIAL_FAILURE_KEY = 'last-dial-failure';\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxDialQueueLength\n */\nconst MAX_DIAL_QUEUE_LENGTH = 500;\n//# sourceMappingURL=constants.defaults.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/connection-manager/constants.defaults.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/connection-manager/dial-queue.js":
|
||
/*!***********************************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/connection-manager/dial-queue.js ***!
|
||
\***********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DialQueue: () => (/* binding */ DialQueue)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/events.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/map.js\");\n/* harmony import */ var _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/utils/address-sort */ \"./node_modules/@libp2p/utils/dist/src/address-sort.js\");\n/* harmony import */ var _libp2p_utils_queue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @libp2p/utils/queue */ \"./node_modules/@libp2p/utils/dist/src/queue/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiformats/multiaddr/resolvers */ \"./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js\");\n/* harmony import */ var _multiformats_multiaddr_matcher__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @multiformats/multiaddr-matcher */ \"./node_modules/@multiformats/multiaddr-matcher/dist/src/index.js\");\n/* harmony import */ var any_signal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! any-signal */ \"./node_modules/any-signal/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/libp2p/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _get_peer_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../get-peer.js */ \"./node_modules/libp2p/dist/src/get-peer.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.browser.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.defaults.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/libp2p/dist/src/connection-manager/utils.js\");\n/* eslint-disable max-depth */\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst defaultOptions = {\n addressSorter: _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_5__.defaultAddressSort,\n maxParallelDials: _constants_js__WEBPACK_IMPORTED_MODULE_6__.MAX_PARALLEL_DIALS,\n maxDialQueueLength: _constants_js__WEBPACK_IMPORTED_MODULE_7__.MAX_DIAL_QUEUE_LENGTH,\n maxPeerAddrsToDial: _constants_js__WEBPACK_IMPORTED_MODULE_7__.MAX_PEER_ADDRS_TO_DIAL,\n dialTimeout: _constants_js__WEBPACK_IMPORTED_MODULE_7__.DIAL_TIMEOUT,\n resolvers: {\n dnsaddr: _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_1__.dnsaddrResolver\n }\n};\nclass DialQueue {\n queue;\n components;\n addressSorter;\n maxPeerAddrsToDial;\n maxDialQueueLength;\n dialTimeout;\n shutDownController;\n connections;\n log;\n constructor(components, init = {}) {\n this.addressSorter = init.addressSorter ?? defaultOptions.addressSorter;\n this.maxPeerAddrsToDial = init.maxPeerAddrsToDial ?? defaultOptions.maxPeerAddrsToDial;\n this.maxDialQueueLength = init.maxDialQueueLength ?? defaultOptions.maxDialQueueLength;\n this.dialTimeout = init.dialTimeout ?? defaultOptions.dialTimeout;\n this.connections = init.connections ?? new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_8__.PeerMap();\n this.log = components.logger.forComponent('libp2p:connection-manager:dial-queue');\n this.components = components;\n this.shutDownController = new AbortController();\n (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.setMaxListeners)(Infinity, this.shutDownController.signal);\n for (const [key, value] of Object.entries(init.resolvers ?? {})) {\n _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.resolvers.set(key, value);\n }\n // controls dial concurrency\n this.queue = new _libp2p_utils_queue__WEBPACK_IMPORTED_MODULE_10__.Queue({\n concurrency: init.maxParallelDials ?? defaultOptions.maxParallelDials,\n metricName: 'libp2p_dial_queue',\n metrics: components.metrics\n });\n // a started job errored\n this.queue.addEventListener('error', (event) => {\n this.log.error('error in dial queue', event.detail);\n });\n }\n start() {\n this.shutDownController = new AbortController();\n (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.setMaxListeners)(Infinity, this.shutDownController.signal);\n }\n /**\n * Clears any pending dials\n */\n stop() {\n this.shutDownController.abort();\n this.queue.abort();\n }\n /**\n * Connects to a given peer, multiaddr or list of multiaddrs.\n *\n * If a peer is passed, all known multiaddrs will be tried. If a multiaddr or\n * multiaddrs are passed only those will be dialled.\n *\n * Where a list of multiaddrs is passed, if any contain a peer id then all\n * multiaddrs in the list must contain the same peer id.\n *\n * The dial to the first address that is successfully able to upgrade a\n * connection will be used, all other dials will be aborted when that happens.\n */\n async dial(peerIdOrMultiaddr, options = {}) {\n const { peerId, multiaddrs } = (0,_get_peer_js__WEBPACK_IMPORTED_MODULE_11__.getPeerAddress)(peerIdOrMultiaddr);\n // make sure we don't have an existing connection to any of the addresses we\n // are about to dial\n const existingConnection = Array.from(this.connections.values()).flat().find(conn => {\n if (options.force === true) {\n return false;\n }\n if (conn.remotePeer.equals(peerId)) {\n return true;\n }\n return multiaddrs.find(addr => {\n return addr.equals(conn.remoteAddr);\n });\n });\n if (existingConnection != null) {\n this.log('already connected to %a', existingConnection.remoteAddr);\n return existingConnection;\n }\n // ready to dial, all async work finished - make sure we don't have any\n // pending dials in progress for this peer or set of multiaddrs\n const existingDial = this.queue.queue.find(job => {\n if (peerId?.equals(job.options.peerId) === true) {\n return true;\n }\n // does the dial contain any of the target multiaddrs?\n const addresses = job.options.multiaddrs;\n if (addresses == null) {\n return false;\n }\n for (const multiaddr of multiaddrs) {\n if (addresses.has(multiaddr.toString())) {\n return true;\n }\n }\n return false;\n });\n if (existingDial != null) {\n this.log('joining existing dial target for %p', peerId);\n // add all multiaddrs to the dial target\n for (const multiaddr of multiaddrs) {\n existingDial.options.multiaddrs.add(multiaddr.toString());\n }\n return existingDial.join(options);\n }\n if (this.queue.size >= this.maxDialQueueLength) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_12__.CodeError('Dial queue is full', 'ERR_DIAL_QUEUE_FULL');\n }\n this.log('creating dial target for %p', peerId, multiaddrs.map(ma => ma.toString()));\n return this.queue.add(async (options) => {\n // create abort conditions - need to do this before `calculateMultiaddrs` as\n // we may be about to resolve a dns addr which can time out\n const signal = this.createDialAbortController(options?.signal);\n let addrsToDial;\n try {\n // load addresses from address book, resolve and dnsaddrs, filter\n // undiallables, add peer IDs, etc\n addrsToDial = await this.calculateMultiaddrs(peerId, options?.multiaddrs, {\n ...options,\n signal\n });\n addrsToDial.map(({ multiaddr }) => multiaddr.toString()).forEach(addr => {\n options?.multiaddrs.add(addr);\n });\n }\n catch (err) {\n signal.clear();\n throw err;\n }\n try {\n let dialed = 0;\n const errors = [];\n for (const address of addrsToDial) {\n if (dialed === this.maxPeerAddrsToDial) {\n this.log('dialed maxPeerAddrsToDial (%d) addresses for %p, not trying any others', dialed, peerId);\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_12__.CodeError('Peer had more than maxPeerAddrsToDial', _errors_js__WEBPACK_IMPORTED_MODULE_13__.codes.ERR_TOO_MANY_ADDRESSES);\n }\n dialed++;\n try {\n const conn = await this.components.transportManager.dial(address.multiaddr, {\n ...options,\n signal\n });\n this.log('dial to %a succeeded', address.multiaddr);\n return conn;\n }\n catch (err) {\n this.log.error('dial failed to %a', address.multiaddr, err);\n if (peerId != null) {\n // record the failed dial\n try {\n await this.components.peerStore.patch(peerId, {\n metadata: {\n [_constants_js__WEBPACK_IMPORTED_MODULE_7__.LAST_DIAL_FAILURE_KEY]: (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(Date.now().toString())\n }\n });\n }\n catch (err) {\n this.log.error('could not update last dial failure key for %p', peerId, err);\n }\n }\n // the user/dial timeout/shutdown controller signal aborted\n if (signal.aborted) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_12__.CodeError(err.message, _libp2p_interface__WEBPACK_IMPORTED_MODULE_12__.ERR_TIMEOUT);\n }\n errors.push(err);\n }\n }\n if (errors.length === 1) {\n throw errors[0];\n }\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_12__.AggregateCodeError(errors, 'All multiaddr dials failed', _errors_js__WEBPACK_IMPORTED_MODULE_13__.codes.ERR_TRANSPORT_DIAL_FAILED);\n }\n finally {\n // clean up abort signals/controllers\n signal.clear();\n }\n }, {\n peerId,\n priority: options.priority,\n multiaddrs: new Set(multiaddrs.map(ma => ma.toString())),\n signal: options.signal\n });\n }\n createDialAbortController(userSignal) {\n // let any signal abort the dial\n const signal = (0,any_signal__WEBPACK_IMPORTED_MODULE_3__.anySignal)([\n AbortSignal.timeout(this.dialTimeout),\n this.shutDownController.signal,\n userSignal\n ]);\n // This emitter gets listened to a lot\n (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_9__.setMaxListeners)(Infinity, signal);\n return signal;\n }\n // eslint-disable-next-line complexity\n async calculateMultiaddrs(peerId, multiaddrs = new Set(), options = {}) {\n const addrs = [...multiaddrs].map(ma => ({\n multiaddr: (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(ma),\n isCertified: false\n }));\n // if a peer id or multiaddr(s) with a peer id, make sure it isn't our peer id and that we are allowed to dial it\n if (peerId != null) {\n if (this.components.peerId.equals(peerId)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_12__.CodeError('Tried to dial self', _errors_js__WEBPACK_IMPORTED_MODULE_13__.codes.ERR_DIALED_SELF);\n }\n if ((await this.components.connectionGater.denyDialPeer?.(peerId)) === true) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_12__.CodeError('The dial request is blocked by gater.allowDialPeer', _errors_js__WEBPACK_IMPORTED_MODULE_13__.codes.ERR_PEER_DIAL_INTERCEPTED);\n }\n // if just a peer id was passed, load available multiaddrs for this peer\n // from the peer store\n if (addrs.length === 0) {\n this.log('loading multiaddrs for %p', peerId);\n try {\n const peer = await this.components.peerStore.get(peerId);\n addrs.push(...peer.addresses);\n this.log('loaded multiaddrs for %p', peerId, addrs.map(({ multiaddr }) => multiaddr.toString()));\n }\n catch (err) {\n if (err.code !== _errors_js__WEBPACK_IMPORTED_MODULE_13__.codes.ERR_NOT_FOUND) {\n throw err;\n }\n }\n }\n // if we still don't have any addresses for this peer, try a lookup\n // using the peer routing\n if (addrs.length === 0) {\n this.log('looking up multiaddrs for %p in the peer routing', peerId);\n try {\n const peerInfo = await this.components.peerRouting.findPeer(peerId);\n this.log('found multiaddrs for %p in the peer routing', peerId, addrs.map(({ multiaddr }) => multiaddr.toString()));\n addrs.push(...peerInfo.multiaddrs.map(multiaddr => ({\n multiaddr,\n isCertified: false\n })));\n }\n catch (err) {\n if (err.code !== _errors_js__WEBPACK_IMPORTED_MODULE_13__.codes.ERR_NO_ROUTERS_AVAILABLE) {\n this.log.error('looking up multiaddrs for %p in the peer routing failed', peerId, err);\n }\n }\n }\n }\n // resolve addresses - this can result in a one-to-many translation when\n // dnsaddrs are resolved\n let resolvedAddresses = (await Promise.all(addrs.map(async (addr) => {\n const result = await (0,_utils_js__WEBPACK_IMPORTED_MODULE_14__.resolveMultiaddrs)(addr.multiaddr, {\n dns: this.components.dns,\n ...options,\n log: this.log\n });\n if (result.length === 1 && result[0].equals(addr.multiaddr)) {\n return addr;\n }\n return result.map(multiaddr => ({\n multiaddr,\n isCertified: false\n }));\n })))\n .flat();\n // ensure the peer id is appended to the multiaddr\n if (peerId != null) {\n const peerIdMultiaddr = `/p2p/${peerId.toString()}`;\n resolvedAddresses = resolvedAddresses.map(addr => {\n const lastProto = addr.multiaddr.protos().pop();\n // do not append peer id to path multiaddrs\n if (lastProto?.path === true) {\n return addr;\n }\n // append peer id to multiaddr if it is not already present\n if (addr.multiaddr.getPeerId() == null) {\n return {\n multiaddr: addr.multiaddr.encapsulate(peerIdMultiaddr),\n isCertified: addr.isCertified\n };\n }\n return addr;\n });\n }\n const filteredAddrs = resolvedAddresses.filter(addr => {\n // filter out any multiaddrs that we do not have transports for\n if (this.components.transportManager.transportForMultiaddr(addr.multiaddr) == null) {\n return false;\n }\n // if the resolved multiaddr has a PeerID but it's the wrong one, ignore it\n // - this can happen with addresses like bootstrap.libp2p.io that resolve\n // to multiple different peers\n const addrPeerId = addr.multiaddr.getPeerId();\n if (peerId != null && addrPeerId != null) {\n return peerId.equals(addrPeerId);\n }\n return true;\n });\n // deduplicate addresses\n const dedupedAddrs = new Map();\n for (const addr of filteredAddrs) {\n const maStr = addr.multiaddr.toString();\n const existing = dedupedAddrs.get(maStr);\n if (existing != null) {\n existing.isCertified = existing.isCertified || addr.isCertified || false;\n continue;\n }\n dedupedAddrs.set(maStr, addr);\n }\n const dedupedMultiaddrs = [...dedupedAddrs.values()];\n // make sure we actually have some addresses to dial\n if (dedupedMultiaddrs.length === 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_12__.CodeError('The dial request has no valid addresses', _errors_js__WEBPACK_IMPORTED_MODULE_13__.codes.ERR_NO_VALID_ADDRESSES);\n }\n const gatedAdrs = [];\n for (const addr of dedupedMultiaddrs) {\n if (this.components.connectionGater.denyDialMultiaddr != null && await this.components.connectionGater.denyDialMultiaddr(addr.multiaddr)) {\n continue;\n }\n gatedAdrs.push(addr);\n }\n const sortedGatedAddrs = gatedAdrs.sort(this.addressSorter);\n // make sure we actually have some addresses to dial\n if (sortedGatedAddrs.length === 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_12__.CodeError('The connection gater denied all addresses in the dial request', _errors_js__WEBPACK_IMPORTED_MODULE_13__.codes.ERR_NO_VALID_ADDRESSES);\n }\n this.log.trace('addresses for %p before filtering', peerId ?? 'unknown peer', resolvedAddresses.map(({ multiaddr }) => multiaddr.toString()));\n this.log.trace('addresses for %p after filtering', peerId ?? 'unknown peer', sortedGatedAddrs.map(({ multiaddr }) => multiaddr.toString()));\n return sortedGatedAddrs;\n }\n async isDialable(multiaddr, options = {}) {\n if (!Array.isArray(multiaddr)) {\n multiaddr = [multiaddr];\n }\n try {\n const addresses = await this.calculateMultiaddrs(undefined, new Set(multiaddr.map(ma => ma.toString())), options);\n if (options.runOnTransientConnection === false) {\n // return true if any resolved multiaddrs are not relay addresses\n return addresses.find(addr => {\n return !_multiformats_multiaddr_matcher__WEBPACK_IMPORTED_MODULE_2__.Circuit.matches(addr.multiaddr);\n }) != null;\n }\n return true;\n }\n catch (err) {\n this.log.trace('error calculating if multiaddr(s) were dialable', err);\n }\n return false;\n }\n}\n//# sourceMappingURL=dial-queue.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/connection-manager/dial-queue.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/connection-manager/index.js":
|
||
/*!******************************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/connection-manager/index.js ***!
|
||
\******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultConnectionManager: () => (/* binding */ DefaultConnectionManager)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/peer-store/tags.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/map.js\");\n/* harmony import */ var _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @libp2p/utils/address-sort */ \"./node_modules/@libp2p/utils/dist/src/address-sort.js\");\n/* harmony import */ var _libp2p_utils_rate_limiter__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @libp2p/utils/rate-limiter */ \"./node_modules/@libp2p/utils/dist/src/rate-limiter.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiformats/multiaddr/resolvers */ \"./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _get_peer_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../get-peer.js */ \"./node_modules/libp2p/dist/src/get-peer.js\");\n/* harmony import */ var _auto_dial_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./auto-dial.js */ \"./node_modules/libp2p/dist/src/connection-manager/auto-dial.js\");\n/* harmony import */ var _connection_pruner_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./connection-pruner.js */ \"./node_modules/libp2p/dist/src/connection-manager/connection-pruner.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.browser.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.defaults.js\");\n/* harmony import */ var _dial_queue_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./dial-queue.js */ \"./node_modules/libp2p/dist/src/connection-manager/dial-queue.js\");\n\n\n\n\n\n\n\n\n\n\n\n\nconst DEFAULT_DIAL_PRIORITY = 50;\nconst defaultOptions = {\n minConnections: _constants_js__WEBPACK_IMPORTED_MODULE_2__.MIN_CONNECTIONS,\n maxConnections: _constants_js__WEBPACK_IMPORTED_MODULE_2__.MAX_CONNECTIONS,\n inboundConnectionThreshold: _constants_js__WEBPACK_IMPORTED_MODULE_3__.INBOUND_CONNECTION_THRESHOLD,\n maxIncomingPendingConnections: _constants_js__WEBPACK_IMPORTED_MODULE_3__.MAX_INCOMING_PENDING_CONNECTIONS,\n autoDialConcurrency: _constants_js__WEBPACK_IMPORTED_MODULE_3__.AUTO_DIAL_CONCURRENCY,\n autoDialPriority: _constants_js__WEBPACK_IMPORTED_MODULE_3__.AUTO_DIAL_PRIORITY,\n autoDialMaxQueueLength: _constants_js__WEBPACK_IMPORTED_MODULE_3__.AUTO_DIAL_MAX_QUEUE_LENGTH\n};\n/**\n * Responsible for managing known connections.\n */\nclass DefaultConnectionManager {\n started;\n connections;\n allow;\n deny;\n maxIncomingPendingConnections;\n incomingPendingConnections;\n maxConnections;\n dialQueue;\n autoDial;\n connectionPruner;\n inboundConnectionRateLimiter;\n peerStore;\n metrics;\n events;\n log;\n constructor(components, init = {}) {\n this.maxConnections = init.maxConnections ?? defaultOptions.maxConnections;\n const minConnections = init.minConnections ?? defaultOptions.minConnections;\n if (this.maxConnections < minConnections) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CodeError('Connection Manager maxConnections must be greater than minConnections', _errors_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_INVALID_PARAMETERS);\n }\n /**\n * Map of connections per peer\n */\n this.connections = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_6__.PeerMap();\n this.started = false;\n this.peerStore = components.peerStore;\n this.metrics = components.metrics;\n this.events = components.events;\n this.log = components.logger.forComponent('libp2p:connection-manager');\n this.onConnect = this.onConnect.bind(this);\n this.onDisconnect = this.onDisconnect.bind(this);\n this.events.addEventListener('connection:open', this.onConnect);\n this.events.addEventListener('connection:close', this.onDisconnect);\n // allow/deny lists\n this.allow = (init.allow ?? []).map(ma => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(ma));\n this.deny = (init.deny ?? []).map(ma => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(ma));\n this.incomingPendingConnections = 0;\n this.maxIncomingPendingConnections = init.maxIncomingPendingConnections ?? defaultOptions.maxIncomingPendingConnections;\n // controls individual peers trying to dial us too quickly\n this.inboundConnectionRateLimiter = new _libp2p_utils_rate_limiter__WEBPACK_IMPORTED_MODULE_7__.RateLimiter({\n points: init.inboundConnectionThreshold ?? defaultOptions.inboundConnectionThreshold,\n duration: 1\n });\n // controls what happens when we don't have enough connections\n this.autoDial = new _auto_dial_js__WEBPACK_IMPORTED_MODULE_8__.AutoDial({\n connectionManager: this,\n peerStore: components.peerStore,\n events: components.events,\n logger: components.logger\n }, {\n minConnections,\n autoDialConcurrency: init.autoDialConcurrency ?? defaultOptions.autoDialConcurrency,\n autoDialPriority: init.autoDialPriority ?? defaultOptions.autoDialPriority,\n maxQueueLength: init.autoDialMaxQueueLength ?? defaultOptions.autoDialMaxQueueLength\n });\n // controls what happens when we have too many connections\n this.connectionPruner = new _connection_pruner_js__WEBPACK_IMPORTED_MODULE_9__.ConnectionPruner({\n connectionManager: this,\n peerStore: components.peerStore,\n events: components.events,\n logger: components.logger\n }, {\n maxConnections: this.maxConnections,\n allow: this.allow\n });\n this.dialQueue = new _dial_queue_js__WEBPACK_IMPORTED_MODULE_10__.DialQueue(components, {\n addressSorter: init.addressSorter ?? _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_11__.defaultAddressSort,\n maxParallelDials: init.maxParallelDials ?? _constants_js__WEBPACK_IMPORTED_MODULE_2__.MAX_PARALLEL_DIALS,\n maxDialQueueLength: init.maxDialQueueLength ?? _constants_js__WEBPACK_IMPORTED_MODULE_3__.MAX_DIAL_QUEUE_LENGTH,\n maxPeerAddrsToDial: init.maxPeerAddrsToDial ?? _constants_js__WEBPACK_IMPORTED_MODULE_3__.MAX_PEER_ADDRS_TO_DIAL,\n dialTimeout: init.dialTimeout ?? _constants_js__WEBPACK_IMPORTED_MODULE_3__.DIAL_TIMEOUT,\n resolvers: init.resolvers ?? {\n dnsaddr: _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_1__.dnsaddrResolver\n },\n connections: this.connections\n });\n }\n isStarted() {\n return this.started;\n }\n /**\n * Starts the Connection Manager. If Metrics are not enabled on libp2p\n * only event loop and connection limits will be monitored.\n */\n async start() {\n // track inbound/outbound connections\n this.metrics?.registerMetricGroup('libp2p_connection_manager_connections', {\n calculate: () => {\n const metric = {\n inbound: 0,\n outbound: 0\n };\n for (const conns of this.connections.values()) {\n for (const conn of conns) {\n if (conn.direction === 'inbound') {\n metric.inbound++;\n }\n else {\n metric.outbound++;\n }\n }\n }\n return metric;\n }\n });\n // track total number of streams per protocol\n this.metrics?.registerMetricGroup('libp2p_protocol_streams_total', {\n label: 'protocol',\n calculate: () => {\n const metric = {};\n for (const conns of this.connections.values()) {\n for (const conn of conns) {\n for (const stream of conn.streams) {\n const key = `${stream.direction} ${stream.protocol ?? 'unnegotiated'}`;\n metric[key] = (metric[key] ?? 0) + 1;\n }\n }\n }\n return metric;\n }\n });\n // track 90th percentile of streams per protocol\n this.metrics?.registerMetricGroup('libp2p_connection_manager_protocol_streams_per_connection_90th_percentile', {\n label: 'protocol',\n calculate: () => {\n const allStreams = {};\n for (const conns of this.connections.values()) {\n for (const conn of conns) {\n const streams = {};\n for (const stream of conn.streams) {\n const key = `${stream.direction} ${stream.protocol ?? 'unnegotiated'}`;\n streams[key] = (streams[key] ?? 0) + 1;\n }\n for (const [protocol, count] of Object.entries(streams)) {\n allStreams[protocol] = allStreams[protocol] ?? [];\n allStreams[protocol].push(count);\n }\n }\n }\n const metric = {};\n for (let [protocol, counts] of Object.entries(allStreams)) {\n counts = counts.sort((a, b) => a - b);\n const index = Math.floor(counts.length * 0.9);\n metric[protocol] = counts[index];\n }\n return metric;\n }\n });\n this.dialQueue.start();\n this.autoDial.start();\n this.started = true;\n this.log('started');\n }\n async afterStart() {\n // re-connect to any peers with the KEEP_ALIVE tag\n void Promise.resolve()\n .then(async () => {\n const keepAlivePeers = await this.peerStore.all({\n filters: [(peer) => {\n return peer.tags.has(_libp2p_interface__WEBPACK_IMPORTED_MODULE_12__.KEEP_ALIVE);\n }]\n });\n await Promise.all(keepAlivePeers.map(async (peer) => {\n await this.openConnection(peer.id)\n .catch(err => {\n this.log.error(err);\n });\n }));\n })\n .catch(err => {\n this.log.error(err);\n });\n this.autoDial.afterStart();\n }\n /**\n * Stops the Connection Manager\n */\n async stop() {\n this.dialQueue.stop();\n this.autoDial.stop();\n // Close all connections we're tracking\n const tasks = [];\n for (const connectionList of this.connections.values()) {\n for (const connection of connectionList) {\n tasks.push((async () => {\n try {\n await connection.close();\n }\n catch (err) {\n this.log.error(err);\n }\n })());\n }\n }\n this.log('closing %d connections', tasks.length);\n await Promise.all(tasks);\n this.connections.clear();\n this.log('stopped');\n }\n onConnect(evt) {\n void this._onConnect(evt).catch(err => {\n this.log.error(err);\n });\n }\n /**\n * Tracks the incoming connection and check the connection limit\n */\n async _onConnect(evt) {\n const { detail: connection } = evt;\n if (!this.started) {\n // This can happen when we are in the process of shutting down the node\n await connection.close();\n return;\n }\n const peerId = connection.remotePeer;\n const storedConns = this.connections.get(peerId);\n let isNewPeer = false;\n if (storedConns != null) {\n storedConns.push(connection);\n }\n else {\n isNewPeer = true;\n this.connections.set(peerId, [connection]);\n }\n // only need to store RSA public keys, all other types are embedded in the peer id\n if (peerId.publicKey != null && peerId.type === 'RSA') {\n await this.peerStore.patch(peerId, {\n publicKey: peerId.publicKey\n });\n }\n if (isNewPeer) {\n this.events.safeDispatchEvent('peer:connect', { detail: connection.remotePeer });\n }\n }\n /**\n * Removes the connection from tracking\n */\n onDisconnect(evt) {\n const { detail: connection } = evt;\n if (!this.started) {\n // This can happen when we are in the process of shutting down the node\n return;\n }\n const peerId = connection.remotePeer;\n let storedConn = this.connections.get(peerId);\n if (storedConn != null && storedConn.length > 1) {\n storedConn = storedConn.filter((conn) => conn.id !== connection.id);\n this.connections.set(peerId, storedConn);\n }\n else if (storedConn != null) {\n this.connections.delete(peerId);\n this.events.safeDispatchEvent('peer:disconnect', { detail: connection.remotePeer });\n }\n }\n getConnections(peerId) {\n if (peerId != null) {\n return this.connections.get(peerId) ?? [];\n }\n let conns = [];\n for (const c of this.connections.values()) {\n conns = conns.concat(c);\n }\n return conns;\n }\n getConnectionsMap() {\n return this.connections;\n }\n async openConnection(peerIdOrMultiaddr, options = {}) {\n if (!this.isStarted()) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CodeError('Not started', _errors_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_NODE_NOT_STARTED);\n }\n options.signal?.throwIfAborted();\n const { peerId } = (0,_get_peer_js__WEBPACK_IMPORTED_MODULE_13__.getPeerAddress)(peerIdOrMultiaddr);\n if (peerId != null && options.force !== true) {\n this.log('dial %p', peerId);\n const existingConnection = this.getConnections(peerId)\n .find(conn => !conn.transient);\n if (existingConnection != null) {\n this.log('had an existing non-transient connection to %p', peerId);\n return existingConnection;\n }\n }\n const connection = await this.dialQueue.dial(peerIdOrMultiaddr, {\n ...options,\n priority: options.priority ?? DEFAULT_DIAL_PRIORITY\n });\n let peerConnections = this.connections.get(connection.remotePeer);\n if (peerConnections == null) {\n peerConnections = [];\n this.connections.set(connection.remotePeer, peerConnections);\n }\n // we get notified of connections via the Upgrader emitting \"connection\"\n // events, double check we aren't already tracking this connection before\n // storing it\n let trackedConnection = false;\n for (const conn of peerConnections) {\n if (conn.id === connection.id) {\n trackedConnection = true;\n }\n }\n if (!trackedConnection) {\n peerConnections.push(connection);\n }\n return connection;\n }\n async closeConnections(peerId, options = {}) {\n const connections = this.connections.get(peerId) ?? [];\n await Promise.all(connections.map(async (connection) => {\n try {\n await connection.close(options);\n }\n catch (err) {\n connection.abort(err);\n }\n }));\n }\n async acceptIncomingConnection(maConn) {\n // check deny list\n const denyConnection = this.deny.some(ma => {\n return maConn.remoteAddr.toString().startsWith(ma.toString());\n });\n if (denyConnection) {\n this.log('connection from %a refused - connection remote address was in deny list', maConn.remoteAddr);\n return false;\n }\n // check allow list\n const allowConnection = this.allow.some(ma => {\n return maConn.remoteAddr.toString().startsWith(ma.toString());\n });\n if (allowConnection) {\n this.incomingPendingConnections++;\n return true;\n }\n // check pending connections\n if (this.incomingPendingConnections === this.maxIncomingPendingConnections) {\n this.log('connection from %a refused - incomingPendingConnections exceeded by host', maConn.remoteAddr);\n return false;\n }\n if (maConn.remoteAddr.isThinWaistAddress()) {\n const host = maConn.remoteAddr.nodeAddress().address;\n try {\n await this.inboundConnectionRateLimiter.consume(host, 1);\n }\n catch {\n this.log('connection from %a refused - inboundConnectionThreshold exceeded by host %s', maConn.remoteAddr, host);\n return false;\n }\n }\n if (this.getConnections().length < this.maxConnections) {\n this.incomingPendingConnections++;\n return true;\n }\n this.log('connection from %a refused - maxConnections exceeded', maConn.remoteAddr);\n return false;\n }\n afterUpgradeInbound() {\n this.incomingPendingConnections--;\n }\n getDialQueue() {\n const statusMap = {\n queued: 'queued',\n running: 'active',\n errored: 'error',\n complete: 'success'\n };\n return this.dialQueue.queue.queue.map(job => {\n return {\n id: job.id,\n status: statusMap[job.status],\n peerId: job.options.peerId,\n multiaddrs: [...job.options.multiaddrs].map(ma => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(ma))\n };\n });\n }\n async isDialable(multiaddr, options = {}) {\n return this.dialQueue.isDialable(multiaddr, options);\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/connection-manager/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/connection-manager/utils.js":
|
||
/*!******************************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/connection-manager/utils.js ***!
|
||
\******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ resolveMultiaddrs: () => (/* binding */ resolveMultiaddrs)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n\n/**\n * Recursively resolve DNSADDR multiaddrs\n */\nasync function resolveMultiaddrs(ma, options) {\n // check multiaddr resolvers\n let resolvable = false;\n for (const key of _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.resolvers.keys()) {\n resolvable = ma.protoNames().includes(key);\n if (resolvable) {\n break;\n }\n }\n // return multiaddr if it is not resolvable\n if (!resolvable) {\n return [ma];\n }\n const output = await ma.resolve(options);\n options.log('resolved %s to', ma, output.map(ma => ma.toString()));\n return output;\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/connection-manager/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/connection/index.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/connection/index.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ConnectionImpl: () => (/* binding */ ConnectionImpl),\n/* harmony export */ createConnection: () => (/* binding */ createConnection)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/connection/index.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/events.js\");\n\nconst CLOSE_TIMEOUT = 500;\n/**\n * An implementation of the js-libp2p connection.\n * Any libp2p transport should use an upgrader to return this connection.\n */\nclass ConnectionImpl {\n /**\n * Connection identifier.\n */\n id;\n /**\n * Observed multiaddr of the remote peer\n */\n remoteAddr;\n /**\n * Remote peer id\n */\n remotePeer;\n direction;\n timeline;\n multiplexer;\n encryption;\n status;\n transient;\n log;\n /**\n * User provided tags\n *\n */\n tags;\n /**\n * Reference to the new stream function of the multiplexer\n */\n _newStream;\n /**\n * Reference to the close function of the raw connection\n */\n _close;\n _abort;\n /**\n * Reference to the getStreams function of the muxer\n */\n _getStreams;\n /**\n * An implementation of the js-libp2p connection.\n * Any libp2p transport should use an upgrader to return this connection.\n */\n constructor(init) {\n const { remoteAddr, remotePeer, newStream, close, abort, getStreams } = init;\n this.id = `${(parseInt(String(Math.random() * 1e9))).toString(36)}${Date.now()}`;\n this.remoteAddr = remoteAddr;\n this.remotePeer = remotePeer;\n this.direction = init.direction;\n this.status = 'open';\n this.timeline = init.timeline;\n this.multiplexer = init.multiplexer;\n this.encryption = init.encryption;\n this.transient = init.transient ?? false;\n this.log = init.logger.forComponent(`libp2p:connection:${this.direction}:${this.id}`);\n if (this.remoteAddr.getPeerId() == null) {\n this.remoteAddr = this.remoteAddr.encapsulate(`/p2p/${this.remotePeer}`);\n }\n this._newStream = newStream;\n this._close = close;\n this._abort = abort;\n this._getStreams = getStreams;\n this.tags = [];\n }\n [Symbol.toStringTag] = 'Connection';\n [_libp2p_interface__WEBPACK_IMPORTED_MODULE_0__.connectionSymbol] = true;\n /**\n * Get all the streams of the muxer\n */\n get streams() {\n return this._getStreams();\n }\n /**\n * Create a new stream from this connection\n */\n async newStream(protocols, options) {\n if (this.status === 'closing') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('the connection is being closed', 'ERR_CONNECTION_BEING_CLOSED');\n }\n if (this.status === 'closed') {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('the connection is closed', 'ERR_CONNECTION_CLOSED');\n }\n if (!Array.isArray(protocols)) {\n protocols = [protocols];\n }\n if (this.transient && options?.runOnTransientConnection !== true) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('Cannot open protocol stream on transient connection', 'ERR_TRANSIENT_CONNECTION');\n }\n const stream = await this._newStream(protocols, options);\n stream.direction = 'outbound';\n return stream;\n }\n /**\n * Close the connection\n */\n async close(options = {}) {\n if (this.status === 'closed' || this.status === 'closing') {\n return;\n }\n this.log('closing connection to %a', this.remoteAddr);\n this.status = 'closing';\n if (options.signal == null) {\n const signal = AbortSignal.timeout(CLOSE_TIMEOUT);\n (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.setMaxListeners)(Infinity, signal);\n options = {\n ...options,\n signal\n };\n }\n try {\n this.log.trace('closing all streams');\n // close all streams gracefully - this can throw if we're not multiplexed\n await Promise.all(this.streams.map(async (s) => s.close(options)));\n this.log.trace('closing underlying transport');\n // close raw connection\n await this._close(options);\n this.log.trace('updating timeline with close time');\n this.status = 'closed';\n this.timeline.close = Date.now();\n }\n catch (err) {\n this.log.error('error encountered during graceful close of connection to %a', this.remoteAddr, err);\n this.abort(err);\n }\n }\n abort(err) {\n this.log.error('aborting connection to %a due to error', this.remoteAddr, err);\n this.status = 'closing';\n this.streams.forEach(s => { s.abort(err); });\n this.log.error('all streams aborted', this.streams.length);\n // Abort raw connection\n this._abort(err);\n this.timeline.close = Date.now();\n this.status = 'closed';\n }\n}\nfunction createConnection(init) {\n return new ConnectionImpl(init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/connection/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/content-routing.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/content-routing.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CompoundContentRouting: () => (/* binding */ CompoundContentRouting)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/set.js\");\n/* harmony import */ var it_merge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-merge */ \"./node_modules/it-merge/dist/src/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n\n\n\n\nclass CompoundContentRouting {\n routers;\n started;\n components;\n constructor(components, init) {\n this.routers = init.routers ?? [];\n this.started = false;\n this.components = components;\n }\n isStarted() {\n return this.started;\n }\n async start() {\n this.started = true;\n }\n async stop() {\n this.started = false;\n }\n /**\n * Iterates over all content routers in parallel to find providers of the given key\n */\n async *findProviders(key, options = {}) {\n if (this.routers.length === 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('No content routers available', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_NO_ROUTERS_AVAILABLE);\n }\n const self = this;\n const seen = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_3__.PeerSet();\n for await (const peer of (0,it_merge__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(...self.routers.map(router => router.findProviders(key, options)))) {\n // the peer was yielded by a content router without multiaddrs and we\n // failed to load them\n if (peer == null) {\n continue;\n }\n // store the addresses for the peer if found\n if (peer.multiaddrs.length > 0) {\n await this.components.peerStore.merge(peer.id, {\n multiaddrs: peer.multiaddrs\n });\n }\n // deduplicate peers\n if (seen.has(peer.id)) {\n continue;\n }\n seen.add(peer.id);\n yield peer;\n }\n }\n /**\n * Iterates over all content routers in parallel to notify it is\n * a provider of the given key\n */\n async provide(key, options = {}) {\n if (this.routers.length === 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('No content routers available', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_NO_ROUTERS_AVAILABLE);\n }\n await Promise.all(this.routers.map(async (router) => {\n await router.provide(key, options);\n }));\n }\n /**\n * Store the given key/value pair in the available content routings\n */\n async put(key, value, options) {\n if (!this.isStarted()) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError(_errors_js__WEBPACK_IMPORTED_MODULE_2__.messages.NOT_STARTED_YET, _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_NODE_NOT_STARTED);\n }\n await Promise.all(this.routers.map(async (router) => {\n await router.put(key, value, options);\n }));\n }\n /**\n * Get the value to the given key.\n * Times out after 1 minute by default.\n */\n async get(key, options) {\n if (!this.isStarted()) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError(_errors_js__WEBPACK_IMPORTED_MODULE_2__.messages.NOT_STARTED_YET, _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_NODE_NOT_STARTED);\n }\n return Promise.any(this.routers.map(async (router) => {\n return router.get(key, options);\n }));\n }\n}\n//# sourceMappingURL=content-routing.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/content-routing.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/errors.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/errors.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes),\n/* harmony export */ messages: () => (/* binding */ messages)\n/* harmony export */ });\nvar messages;\n(function (messages) {\n messages[\"NOT_STARTED_YET\"] = \"The libp2p node is not started yet\";\n messages[\"ERR_PROTECTOR_REQUIRED\"] = \"Private network is enforced, but no protector was provided\";\n messages[\"NOT_FOUND\"] = \"Not found\";\n})(messages || (messages = {}));\nvar codes;\n(function (codes) {\n codes[\"ERR_PROTECTOR_REQUIRED\"] = \"ERR_PROTECTOR_REQUIRED\";\n codes[\"ERR_PEER_DIAL_INTERCEPTED\"] = \"ERR_PEER_DIAL_INTERCEPTED\";\n codes[\"ERR_CONNECTION_INTERCEPTED\"] = \"ERR_CONNECTION_INTERCEPTED\";\n codes[\"ERR_INVALID_PROTOCOLS_FOR_STREAM\"] = \"ERR_INVALID_PROTOCOLS_FOR_STREAM\";\n codes[\"ERR_CONNECTION_ENDED\"] = \"ERR_CONNECTION_ENDED\";\n codes[\"ERR_CONNECTION_FAILED\"] = \"ERR_CONNECTION_FAILED\";\n codes[\"ERR_NODE_NOT_STARTED\"] = \"ERR_NODE_NOT_STARTED\";\n codes[\"ERR_ALREADY_ABORTED\"] = \"ERR_ALREADY_ABORTED\";\n codes[\"ERR_TOO_MANY_ADDRESSES\"] = \"ERR_TOO_MANY_ADDRESSES\";\n codes[\"ERR_NO_VALID_ADDRESSES\"] = \"ERR_NO_VALID_ADDRESSES\";\n codes[\"ERR_RELAYED_DIAL\"] = \"ERR_RELAYED_DIAL\";\n codes[\"ERR_DIALED_SELF\"] = \"ERR_DIALED_SELF\";\n codes[\"ERR_DISCOVERED_SELF\"] = \"ERR_DISCOVERED_SELF\";\n codes[\"ERR_DUPLICATE_TRANSPORT\"] = \"ERR_DUPLICATE_TRANSPORT\";\n codes[\"ERR_ENCRYPTION_FAILED\"] = \"ERR_ENCRYPTION_FAILED\";\n codes[\"ERR_HOP_REQUEST_FAILED\"] = \"ERR_HOP_REQUEST_FAILED\";\n codes[\"ERR_INVALID_KEY\"] = \"ERR_INVALID_KEY\";\n codes[\"ERR_INVALID_MESSAGE\"] = \"ERR_INVALID_MESSAGE\";\n codes[\"ERR_INVALID_PARAMETERS\"] = \"ERR_INVALID_PARAMETERS\";\n codes[\"ERR_INVALID_PEER\"] = \"ERR_INVALID_PEER\";\n codes[\"ERR_MUXER_UNAVAILABLE\"] = \"ERR_MUXER_UNAVAILABLE\";\n codes[\"ERR_NOT_FOUND\"] = \"ERR_NOT_FOUND\";\n codes[\"ERR_TRANSPORT_UNAVAILABLE\"] = \"ERR_TRANSPORT_UNAVAILABLE\";\n codes[\"ERR_TRANSPORT_DIAL_FAILED\"] = \"ERR_TRANSPORT_DIAL_FAILED\";\n codes[\"ERR_UNSUPPORTED_PROTOCOL\"] = \"ERR_UNSUPPORTED_PROTOCOL\";\n codes[\"ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED\"] = \"ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED\";\n codes[\"ERR_INVALID_MULTIADDR\"] = \"ERR_INVALID_MULTIADDR\";\n codes[\"ERR_SIGNATURE_NOT_VALID\"] = \"ERR_SIGNATURE_NOT_VALID\";\n codes[\"ERR_FIND_SELF\"] = \"ERR_FIND_SELF\";\n codes[\"ERR_NO_ROUTERS_AVAILABLE\"] = \"ERR_NO_ROUTERS_AVAILABLE\";\n codes[\"ERR_CONNECTION_NOT_MULTIPLEXED\"] = \"ERR_CONNECTION_NOT_MULTIPLEXED\";\n codes[\"ERR_NO_DIAL_TOKENS\"] = \"ERR_NO_DIAL_TOKENS\";\n codes[\"ERR_INVALID_CMS\"] = \"ERR_INVALID_CMS\";\n codes[\"ERR_MISSING_KEYS\"] = \"ERR_MISSING_KEYS\";\n codes[\"ERR_NO_KEY\"] = \"ERR_NO_KEY\";\n codes[\"ERR_INVALID_KEY_NAME\"] = \"ERR_INVALID_KEY_NAME\";\n codes[\"ERR_INVALID_KEY_TYPE\"] = \"ERR_INVALID_KEY_TYPE\";\n codes[\"ERR_KEY_ALREADY_EXISTS\"] = \"ERR_KEY_ALREADY_EXISTS\";\n codes[\"ERR_INVALID_KEY_SIZE\"] = \"ERR_INVALID_KEY_SIZE\";\n codes[\"ERR_KEY_NOT_FOUND\"] = \"ERR_KEY_NOT_FOUND\";\n codes[\"ERR_OLD_KEY_NAME_INVALID\"] = \"ERR_OLD_KEY_NAME_INVALID\";\n codes[\"ERR_NEW_KEY_NAME_INVALID\"] = \"ERR_NEW_KEY_NAME_INVALID\";\n codes[\"ERR_PASSWORD_REQUIRED\"] = \"ERR_PASSWORD_REQUIRED\";\n codes[\"ERR_PEM_REQUIRED\"] = \"ERR_PEM_REQUIRED\";\n codes[\"ERR_CANNOT_READ_KEY\"] = \"ERR_CANNOT_READ_KEY\";\n codes[\"ERR_MISSING_PRIVATE_KEY\"] = \"ERR_MISSING_PRIVATE_KEY\";\n codes[\"ERR_MISSING_PUBLIC_KEY\"] = \"ERR_MISSING_PUBLIC_KEY\";\n codes[\"ERR_INVALID_OLD_PASS_TYPE\"] = \"ERR_INVALID_OLD_PASS_TYPE\";\n codes[\"ERR_INVALID_NEW_PASS_TYPE\"] = \"ERR_INVALID_NEW_PASS_TYPE\";\n codes[\"ERR_INVALID_PASS_LENGTH\"] = \"ERR_INVALID_PASS_LENGTH\";\n codes[\"ERR_NOT_IMPLEMENTED\"] = \"ERR_NOT_IMPLEMENTED\";\n codes[\"ERR_WRONG_PING_ACK\"] = \"ERR_WRONG_PING_ACK\";\n codes[\"ERR_INVALID_RECORD\"] = \"ERR_INVALID_RECORD\";\n codes[\"ERR_ALREADY_SUCCEEDED\"] = \"ERR_ALREADY_SUCCEEDED\";\n codes[\"ERR_NO_HANDLER_FOR_PROTOCOL\"] = \"ERR_NO_HANDLER_FOR_PROTOCOL\";\n codes[\"ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS\"] = \"ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS\";\n codes[\"ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS\"] = \"ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS\";\n codes[\"ERR_CONNECTION_DENIED\"] = \"ERR_CONNECTION_DENIED\";\n codes[\"ERR_TRANSFER_LIMIT_EXCEEDED\"] = \"ERR_TRANSFER_LIMIT_EXCEEDED\";\n})(codes || (codes = {}));\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/errors.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/get-peer.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/get-peer.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getPeerAddress: () => (/* binding */ getPeerAddress)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/peer-id/index.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n\n\n\n\n/**\n * Extracts a PeerId and/or multiaddr from the passed PeerId or Multiaddr or an array of Multiaddrs\n */\nfunction getPeerAddress(peer) {\n if ((0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.isPeerId)(peer)) {\n return { peerId: peer, multiaddrs: [] };\n }\n if (!Array.isArray(peer)) {\n peer = [peer];\n }\n let peerId;\n if (peer.length > 0) {\n const peerIdStr = peer[0].getPeerId();\n peerId = peerIdStr == null ? undefined : (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromString)(peerIdStr);\n // ensure PeerId is either not set or is consistent\n peer.forEach(ma => {\n if (!(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.isMultiaddr)(ma)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Invalid Multiaddr', _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_INVALID_MULTIADDR);\n }\n const maPeerIdStr = ma.getPeerId();\n if (maPeerIdStr == null) {\n if (peerId != null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Multiaddrs must all have the same peer id or have no peer id', _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_INVALID_PARAMETERS);\n }\n }\n else {\n const maPeerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromString)(maPeerIdStr);\n if (peerId == null || !peerId.equals(maPeerId)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Multiaddrs must all have the same peer id or have no peer id', _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_INVALID_PARAMETERS);\n }\n }\n });\n }\n return {\n peerId,\n multiaddrs: peer\n };\n}\n//# sourceMappingURL=get-peer.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/get-peer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/index.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/index.js ***!
|
||
\***********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createLibp2p: () => (/* binding */ createLibp2p)\n/* harmony export */ });\n/* harmony import */ var _libp2p_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./libp2p.js */ \"./node_modules/libp2p/dist/src/libp2p.js\");\n/**\n * @packageDocumentation\n *\n * Use the `createLibp2p` function to create a libp2p node.\n *\n * @example\n *\n * ```typescript\n * import { createLibp2p } from 'libp2p'\n *\n * const node = await createLibp2p({\n * // ...other options\n * })\n * ```\n */\n\n/**\n * Returns a new instance of the Libp2p interface, generating a new PeerId\n * if one is not passed as part of the options.\n *\n * The node will be started unless `start: false` is passed as an option.\n *\n * @example\n *\n * ```TypeScript\n * import { createLibp2p } from 'libp2p'\n * import { tcp } from '@libp2p/tcp'\n * import { mplex } from '@libp2p/mplex'\n * import { noise } from '@chainsafe/libp2p-noise'\n * import { yamux } from '@chainsafe/libp2p-yamux'\n *\n * // specify options\n * const options = {\n * transports: [tcp()],\n * streamMuxers: [yamux(), mplex()],\n * connectionEncryption: [noise()]\n * }\n *\n * // create libp2p\n * const libp2p = await createLibp2p(options)\n * ```\n */\nasync function createLibp2p(options = {}) {\n const node = await (0,_libp2p_js__WEBPACK_IMPORTED_MODULE_0__.createLibp2pNode)(options);\n if (options.start !== false) {\n await node.start();\n }\n return node;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/libp2p.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/libp2p.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Libp2pNode: () => (/* binding */ Libp2pNode),\n/* harmony export */ createLibp2pNode: () => (/* binding */ createLibp2pNode)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/event-target.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/events.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/content-routing/index.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/peer-routing/index.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/peer-discovery/index.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/set.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id_factory__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! @libp2p/peer-id-factory */ \"./node_modules/@libp2p/peer-id-factory/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_store__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @libp2p/peer-store */ \"./node_modules/@libp2p/peer-store/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var datastore_core_memory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! datastore-core/memory */ \"./node_modules/datastore-core/dist/src/memory.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/libp2p/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/libp2p/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _address_manager_index_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./address-manager/index.js */ \"./node_modules/libp2p/dist/src/address-manager/index.js\");\n/* harmony import */ var _components_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components.js */ \"./node_modules/libp2p/dist/src/components.js\");\n/* harmony import */ var _config_connection_gater_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./config/connection-gater.js */ \"./node_modules/libp2p/dist/src/config/connection-gater.browser.js\");\n/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./config.js */ \"./node_modules/libp2p/dist/src/config.js\");\n/* harmony import */ var _connection_manager_index_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./connection-manager/index.js */ \"./node_modules/libp2p/dist/src/connection-manager/index.js\");\n/* harmony import */ var _content_routing_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./content-routing.js */ \"./node_modules/libp2p/dist/src/content-routing.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _peer_routing_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./peer-routing.js */ \"./node_modules/libp2p/dist/src/peer-routing.js\");\n/* harmony import */ var _registrar_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./registrar.js */ \"./node_modules/libp2p/dist/src/registrar.js\");\n/* harmony import */ var _transport_manager_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./transport-manager.js */ \"./node_modules/libp2p/dist/src/transport-manager.js\");\n/* harmony import */ var _upgrader_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./upgrader.js */ \"./node_modules/libp2p/dist/src/upgrader.js\");\n/* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./version.js */ \"./node_modules/libp2p/dist/src/version.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nclass Libp2pNode extends _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.TypedEventEmitter {\n peerId;\n peerStore;\n contentRouting;\n peerRouting;\n metrics;\n services;\n logger;\n status;\n components;\n log;\n constructor(init) {\n super();\n this.status = 'stopped';\n // event bus - components can listen to this emitter to be notified of system events\n // and also cause them to be emitted\n const events = new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.TypedEventEmitter();\n const originalDispatch = events.dispatchEvent.bind(events);\n events.dispatchEvent = (evt) => {\n const internalResult = originalDispatch(evt);\n const externalResult = this.dispatchEvent(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.CustomEvent(evt.type, { detail: evt.detail }));\n return internalResult || externalResult;\n };\n // This emitter gets listened to a lot\n (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_5__.setMaxListeners)(Infinity, events);\n this.peerId = init.peerId;\n this.logger = init.logger ?? (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_6__.defaultLogger)();\n this.log = this.logger.forComponent('libp2p');\n // @ts-expect-error {} may not be of type T\n this.services = {};\n const components = this.components = (0,_components_js__WEBPACK_IMPORTED_MODULE_7__.defaultComponents)({\n peerId: init.peerId,\n privateKey: init.privateKey,\n nodeInfo: init.nodeInfo ?? {\n name: _version_js__WEBPACK_IMPORTED_MODULE_8__.name,\n version: _version_js__WEBPACK_IMPORTED_MODULE_8__.version\n },\n logger: this.logger,\n events,\n datastore: init.datastore ?? new datastore_core_memory__WEBPACK_IMPORTED_MODULE_1__.MemoryDatastore(),\n connectionGater: (0,_config_connection_gater_js__WEBPACK_IMPORTED_MODULE_9__.connectionGater)(init.connectionGater),\n dns: init.dns\n });\n this.peerStore = this.configureComponent('peerStore', new _libp2p_peer_store__WEBPACK_IMPORTED_MODULE_10__.PersistentPeerStore(components, {\n addressFilter: this.components.connectionGater.filterMultiaddrForPeer,\n ...init.peerStore\n }));\n // Create Metrics\n if (init.metrics != null) {\n this.metrics = this.configureComponent('metrics', init.metrics(this.components));\n }\n components.events.addEventListener('peer:update', evt => {\n // if there was no peer previously in the peer store this is a new peer\n if (evt.detail.previous == null) {\n const peerInfo = {\n id: evt.detail.peer.id,\n multiaddrs: evt.detail.peer.addresses.map(a => a.multiaddr)\n };\n components.events.safeDispatchEvent('peer:discovery', { detail: peerInfo });\n }\n });\n // Set up connection protector if configured\n if (init.connectionProtector != null) {\n this.configureComponent('connectionProtector', init.connectionProtector(components));\n }\n // Set up the Upgrader\n this.components.upgrader = new _upgrader_js__WEBPACK_IMPORTED_MODULE_11__.DefaultUpgrader(this.components, {\n connectionEncryption: (init.connectionEncryption ?? []).map((fn, index) => this.configureComponent(`connection-encryption-${index}`, fn(this.components))),\n muxers: (init.streamMuxers ?? []).map((fn, index) => this.configureComponent(`stream-muxers-${index}`, fn(this.components))),\n inboundUpgradeTimeout: init.connectionManager.inboundUpgradeTimeout\n });\n // Setup the transport manager\n this.configureComponent('transportManager', new _transport_manager_js__WEBPACK_IMPORTED_MODULE_12__.DefaultTransportManager(this.components, init.transportManager));\n // Create the Connection Manager\n this.configureComponent('connectionManager', new _connection_manager_index_js__WEBPACK_IMPORTED_MODULE_13__.DefaultConnectionManager(this.components, init.connectionManager));\n // Create the Registrar\n this.configureComponent('registrar', new _registrar_js__WEBPACK_IMPORTED_MODULE_14__.DefaultRegistrar(this.components));\n // Addresses {listen, announce, noAnnounce}\n this.configureComponent('addressManager', new _address_manager_index_js__WEBPACK_IMPORTED_MODULE_15__.DefaultAddressManager(this.components, init.addresses));\n // Peer routers\n const peerRouters = (init.peerRouters ?? []).map((fn, index) => this.configureComponent(`peer-router-${index}`, fn(this.components)));\n this.peerRouting = this.components.peerRouting = this.configureComponent('peerRouting', new _peer_routing_js__WEBPACK_IMPORTED_MODULE_16__.DefaultPeerRouting(this.components, {\n routers: peerRouters\n }));\n // Content routers\n const contentRouters = (init.contentRouters ?? []).map((fn, index) => this.configureComponent(`content-router-${index}`, fn(this.components)));\n this.contentRouting = this.components.contentRouting = this.configureComponent('contentRouting', new _content_routing_js__WEBPACK_IMPORTED_MODULE_17__.CompoundContentRouting(this.components, {\n routers: contentRouters\n }));\n (init.peerDiscovery ?? []).forEach((fn, index) => {\n const service = this.configureComponent(`peer-discovery-${index}`, fn(this.components));\n service.addEventListener('peer', (evt) => {\n this.#onDiscoveryPeer(evt);\n });\n });\n // Transport modules\n init.transports?.forEach((fn, index) => {\n this.components.transportManager.add(this.configureComponent(`transport-${index}`, fn(this.components)));\n });\n // User defined modules\n if (init.services != null) {\n for (const name of Object.keys(init.services)) {\n const createService = init.services[name];\n const service = createService(this.components);\n if (service == null) {\n this.log.error('service factory %s returned null or undefined instance', name);\n continue;\n }\n this.services[name] = service;\n this.configureComponent(name, service);\n if (service[_libp2p_interface__WEBPACK_IMPORTED_MODULE_18__.contentRoutingSymbol] != null) {\n this.log('registering service %s for content routing', name);\n contentRouters.push(service[_libp2p_interface__WEBPACK_IMPORTED_MODULE_18__.contentRoutingSymbol]);\n }\n if (service[_libp2p_interface__WEBPACK_IMPORTED_MODULE_19__.peerRoutingSymbol] != null) {\n this.log('registering service %s for peer routing', name);\n peerRouters.push(service[_libp2p_interface__WEBPACK_IMPORTED_MODULE_19__.peerRoutingSymbol]);\n }\n if (service[_libp2p_interface__WEBPACK_IMPORTED_MODULE_20__.peerDiscoverySymbol] != null) {\n this.log('registering service %s for peer discovery', name);\n service[_libp2p_interface__WEBPACK_IMPORTED_MODULE_20__.peerDiscoverySymbol].addEventListener?.('peer', (evt) => {\n this.#onDiscoveryPeer(evt);\n });\n }\n }\n }\n }\n configureComponent(name, component) {\n if (component == null) {\n this.log.error('component %s was null or undefined', name);\n }\n this.components[name] = component;\n return component;\n }\n /**\n * Starts the libp2p node and all its subsystems\n */\n async start() {\n if (this.status !== 'stopped') {\n return;\n }\n this.status = 'starting';\n this.log('libp2p is starting');\n try {\n await this.components.beforeStart?.();\n await this.components.start();\n await this.components.afterStart?.();\n this.status = 'started';\n this.safeDispatchEvent('start', { detail: this });\n this.log('libp2p has started');\n }\n catch (err) {\n this.log.error('An error occurred starting libp2p', err);\n // set status to 'started' so this.stop() will stop any running components\n this.status = 'started';\n await this.stop();\n throw err;\n }\n }\n /**\n * Stop the libp2p node by closing its listeners and open connections\n */\n async stop() {\n if (this.status !== 'started') {\n return;\n }\n this.log('libp2p is stopping');\n this.status = 'stopping';\n await this.components.beforeStop?.();\n await this.components.stop();\n await this.components.afterStop?.();\n this.status = 'stopped';\n this.safeDispatchEvent('stop', { detail: this });\n this.log('libp2p has stopped');\n }\n getConnections(peerId) {\n return this.components.connectionManager.getConnections(peerId);\n }\n getDialQueue() {\n return this.components.connectionManager.getDialQueue();\n }\n getPeers() {\n const peerSet = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_21__.PeerSet();\n for (const conn of this.components.connectionManager.getConnections()) {\n peerSet.add(conn.remotePeer);\n }\n return Array.from(peerSet);\n }\n async dial(peer, options = {}) {\n return this.components.connectionManager.openConnection(peer, {\n // ensure any userland dials take top priority in the queue\n priority: 75,\n ...options\n });\n }\n async dialProtocol(peer, protocols, options = {}) {\n if (protocols == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_22__.CodeError('no protocols were provided to open a stream', _errors_js__WEBPACK_IMPORTED_MODULE_23__.codes.ERR_INVALID_PROTOCOLS_FOR_STREAM);\n }\n protocols = Array.isArray(protocols) ? protocols : [protocols];\n if (protocols.length === 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_22__.CodeError('no protocols were provided to open a stream', _errors_js__WEBPACK_IMPORTED_MODULE_23__.codes.ERR_INVALID_PROTOCOLS_FOR_STREAM);\n }\n const connection = await this.dial(peer, options);\n return connection.newStream(protocols, options);\n }\n getMultiaddrs() {\n return this.components.addressManager.getAddresses();\n }\n getProtocols() {\n return this.components.registrar.getProtocols();\n }\n async hangUp(peer, options = {}) {\n if ((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.isMultiaddr)(peer)) {\n peer = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_24__.peerIdFromString)(peer.getPeerId() ?? '');\n }\n await this.components.connectionManager.closeConnections(peer, options);\n }\n /**\n * Get the public key for the given peer id\n */\n async getPublicKey(peer, options = {}) {\n this.log('getPublicKey %p', peer);\n if (peer.publicKey != null) {\n return peer.publicKey;\n }\n try {\n const peerInfo = await this.peerStore.get(peer);\n if (peerInfo.id.publicKey != null) {\n return peerInfo.id.publicKey;\n }\n }\n catch (err) {\n if (err.code !== _errors_js__WEBPACK_IMPORTED_MODULE_23__.codes.ERR_NOT_FOUND) {\n throw err;\n }\n }\n const peerKey = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_2__.concat)([\n (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)('/pk/'),\n peer.multihash.digest\n ]);\n // search any available content routing methods\n const bytes = await this.contentRouting.get(peerKey, options);\n // ensure the returned key is valid\n (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_25__.unmarshalPublicKey)(bytes);\n await this.peerStore.patch(peer, {\n publicKey: bytes\n });\n return bytes;\n }\n async handle(protocols, handler, options) {\n if (!Array.isArray(protocols)) {\n protocols = [protocols];\n }\n await Promise.all(protocols.map(async (protocol) => {\n await this.components.registrar.handle(protocol, handler, options);\n }));\n }\n async unhandle(protocols) {\n if (!Array.isArray(protocols)) {\n protocols = [protocols];\n }\n await Promise.all(protocols.map(async (protocol) => {\n await this.components.registrar.unhandle(protocol);\n }));\n }\n async register(protocol, topology) {\n return this.components.registrar.register(protocol, topology);\n }\n unregister(id) {\n this.components.registrar.unregister(id);\n }\n async isDialable(multiaddr, options = {}) {\n return this.components.connectionManager.isDialable(multiaddr, options);\n }\n /**\n * Called whenever peer discovery services emit `peer` events and adds peers\n * to the peer store.\n */\n #onDiscoveryPeer(evt) {\n const { detail: peer } = evt;\n if (peer.id.toString() === this.peerId.toString()) {\n this.log.error(new Error(_errors_js__WEBPACK_IMPORTED_MODULE_23__.codes.ERR_DISCOVERED_SELF));\n return;\n }\n void this.components.peerStore.merge(peer.id, {\n multiaddrs: peer.multiaddrs\n })\n .catch(err => { this.log.error(err); });\n }\n}\n/**\n * Returns a new Libp2pNode instance - this exposes more of the internals than the\n * libp2p interface and is useful for testing and debugging.\n */\nasync function createLibp2pNode(options = {}) {\n const peerId = options.peerId ??= await (0,_libp2p_peer_id_factory__WEBPACK_IMPORTED_MODULE_26__.createEd25519PeerId)();\n if (peerId.privateKey == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_22__.CodeError('peer id was missing private key', 'ERR_MISSING_PRIVATE_KEY');\n }\n options.privateKey ??= await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_25__.unmarshalPrivateKey)(peerId.privateKey);\n return new Libp2pNode(await (0,_config_js__WEBPACK_IMPORTED_MODULE_27__.validateConfig)(options));\n}\n//# sourceMappingURL=libp2p.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/libp2p.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/peer-routing.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/peer-routing.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultPeerRouting: () => (/* binding */ DefaultPeerRouting)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/set.js\");\n/* harmony import */ var it_merge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-merge */ \"./node_modules/it-merge/dist/src/index.js\");\n/* harmony import */ var it_parallel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-parallel */ \"./node_modules/it-parallel/dist/src/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n\n\n\n\n\nclass DefaultPeerRouting {\n log;\n peerId;\n peerStore;\n routers;\n constructor(components, init = {}) {\n this.log = components.logger.forComponent('libp2p:peer-routing');\n this.peerId = components.peerId;\n this.peerStore = components.peerStore;\n this.routers = init.routers ?? [];\n }\n /**\n * Iterates over all peer routers in parallel to find the given peer\n */\n async findPeer(id, options) {\n if (this.routers.length === 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError('No peer routers available', _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_NO_ROUTERS_AVAILABLE);\n }\n if (id.toString() === this.peerId.toString()) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError('Should not try to find self', _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_FIND_SELF);\n }\n const self = this;\n const source = (0,it_merge__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(...this.routers.map(router => (async function* () {\n try {\n yield await router.findPeer(id, options);\n }\n catch (err) {\n self.log.error(err);\n }\n })()));\n for await (const peer of source) {\n if (peer == null) {\n continue;\n }\n // store the addresses for the peer if found\n if (peer.multiaddrs.length > 0) {\n await this.peerStore.merge(peer.id, {\n multiaddrs: peer.multiaddrs\n });\n }\n return peer;\n }\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError(_errors_js__WEBPACK_IMPORTED_MODULE_3__.messages.NOT_FOUND, _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_NOT_FOUND);\n }\n /**\n * Attempt to find the closest peers on the network to the given key\n */\n async *getClosestPeers(key, options = {}) {\n if (this.routers.length === 0) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError('No peer routers available', _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_NO_ROUTERS_AVAILABLE);\n }\n const self = this;\n const seen = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_4__.PeerSet();\n for await (const peer of (0,it_parallel__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(async function* () {\n const source = (0,it_merge__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(...self.routers.map(router => router.getClosestPeers(key, options)));\n for await (let peer of source) {\n yield async () => {\n // find multiaddrs if they are missing\n if (peer.multiaddrs.length === 0) {\n try {\n peer = await self.findPeer(peer.id, {\n ...options,\n useCache: false\n });\n }\n catch (err) {\n self.log.error('could not find peer multiaddrs', err);\n return;\n }\n }\n return peer;\n };\n }\n }())) {\n if (peer == null) {\n continue;\n }\n // store the addresses for the peer if found\n if (peer.multiaddrs.length > 0) {\n await this.peerStore.merge(peer.id, {\n multiaddrs: peer.multiaddrs\n });\n }\n // deduplicate peers\n if (seen.has(peer.id)) {\n continue;\n }\n seen.add(peer.id);\n yield peer;\n }\n }\n}\n//# sourceMappingURL=peer-routing.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/peer-routing.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/registrar.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/registrar.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_MAX_INBOUND_STREAMS: () => (/* binding */ DEFAULT_MAX_INBOUND_STREAMS),\n/* harmony export */ DEFAULT_MAX_OUTBOUND_STREAMS: () => (/* binding */ DEFAULT_MAX_OUTBOUND_STREAMS),\n/* harmony export */ DefaultRegistrar: () => (/* binding */ DefaultRegistrar)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var merge_options__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! merge-options */ \"./node_modules/merge-options/index.mjs\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n\n\n\nconst DEFAULT_MAX_INBOUND_STREAMS = 32;\nconst DEFAULT_MAX_OUTBOUND_STREAMS = 64;\n/**\n * Responsible for notifying registered protocols of events in the network.\n */\nclass DefaultRegistrar {\n log;\n topologies;\n handlers;\n components;\n constructor(components) {\n this.log = components.logger.forComponent('libp2p:registrar');\n this.topologies = new Map();\n this.handlers = new Map();\n this.components = components;\n this._onDisconnect = this._onDisconnect.bind(this);\n this._onPeerUpdate = this._onPeerUpdate.bind(this);\n this._onPeerIdentify = this._onPeerIdentify.bind(this);\n this.components.events.addEventListener('peer:disconnect', this._onDisconnect);\n this.components.events.addEventListener('peer:update', this._onPeerUpdate);\n this.components.events.addEventListener('peer:identify', this._onPeerIdentify);\n }\n getProtocols() {\n return Array.from(new Set([\n ...this.handlers.keys()\n ])).sort();\n }\n getHandler(protocol) {\n const handler = this.handlers.get(protocol);\n if (handler == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError(`No handler registered for protocol ${protocol}`, _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_NO_HANDLER_FOR_PROTOCOL);\n }\n return handler;\n }\n getTopologies(protocol) {\n const topologies = this.topologies.get(protocol);\n if (topologies == null) {\n return [];\n }\n return [\n ...topologies.values()\n ];\n }\n /**\n * Registers the `handler` for each protocol\n */\n async handle(protocol, handler, opts) {\n if (this.handlers.has(protocol)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError(`Handler already registered for protocol ${protocol}`, _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED);\n }\n const options = merge_options__WEBPACK_IMPORTED_MODULE_0__[\"default\"].bind({ ignoreUndefined: true })({\n maxInboundStreams: DEFAULT_MAX_INBOUND_STREAMS,\n maxOutboundStreams: DEFAULT_MAX_OUTBOUND_STREAMS\n }, opts);\n this.handlers.set(protocol, {\n handler,\n options\n });\n // Add new protocol to self protocols in the peer store\n await this.components.peerStore.merge(this.components.peerId, {\n protocols: [protocol]\n });\n }\n /**\n * Removes the handler for each protocol. The protocol\n * will no longer be supported on streams.\n */\n async unhandle(protocols) {\n const protocolList = Array.isArray(protocols) ? protocols : [protocols];\n protocolList.forEach(protocol => {\n this.handlers.delete(protocol);\n });\n // Update self protocols in the peer store\n await this.components.peerStore.patch(this.components.peerId, {\n protocols: this.getProtocols()\n });\n }\n /**\n * Register handlers for a set of multicodecs given\n */\n async register(protocol, topology) {\n if (topology == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid topology', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n // Create topology\n const id = `${(Math.random() * 1e9).toString(36)}${Date.now()}`;\n let topologies = this.topologies.get(protocol);\n if (topologies == null) {\n topologies = new Map();\n this.topologies.set(protocol, topologies);\n }\n topologies.set(id, topology);\n return id;\n }\n /**\n * Unregister topology\n */\n unregister(id) {\n for (const [protocol, topologies] of this.topologies.entries()) {\n if (topologies.has(id)) {\n topologies.delete(id);\n if (topologies.size === 0) {\n this.topologies.delete(protocol);\n }\n }\n }\n }\n /**\n * Remove a disconnected peer from the record\n */\n _onDisconnect(evt) {\n const remotePeer = evt.detail;\n void this.components.peerStore.get(remotePeer)\n .then(peer => {\n for (const protocol of peer.protocols) {\n const topologies = this.topologies.get(protocol);\n if (topologies == null) {\n // no topologies are interested in this protocol\n continue;\n }\n for (const topology of topologies.values()) {\n topology.onDisconnect?.(remotePeer);\n }\n }\n })\n .catch(err => {\n if (err.code === _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_NOT_FOUND) {\n // peer has not completed identify so they are not in the peer store\n return;\n }\n this.log.error('could not inform topologies of disconnecting peer %p', remotePeer, err);\n });\n }\n /**\n * When a peer is updated, if they have removed supported protocols notify any\n * topologies interested in the removed protocols.\n */\n _onPeerUpdate(evt) {\n const { peer, previous } = evt.detail;\n const removed = (previous?.protocols ?? []).filter(protocol => !peer.protocols.includes(protocol));\n for (const protocol of removed) {\n const topologies = this.topologies.get(protocol);\n if (topologies == null) {\n // no topologies are interested in this protocol\n continue;\n }\n for (const topology of topologies.values()) {\n topology.onDisconnect?.(peer.id);\n }\n }\n }\n /**\n * After identify has completed and we have received the list of supported\n * protocols, notify any topologies interested in those protocols.\n */\n _onPeerIdentify(evt) {\n const protocols = evt.detail.protocols;\n const connection = evt.detail.connection;\n const peerId = evt.detail.peerId;\n for (const protocol of protocols) {\n const topologies = this.topologies.get(protocol);\n if (topologies == null) {\n // no topologies are interested in this protocol\n continue;\n }\n for (const topology of topologies.values()) {\n if (connection.transient && topology.notifyOnTransient !== true) {\n continue;\n }\n topology.onConnect?.(peerId, connection);\n }\n }\n }\n}\n//# sourceMappingURL=registrar.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/registrar.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/transport-manager.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/transport-manager.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultTransportManager: () => (/* binding */ DefaultTransportManager)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/transport/index.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_utils_tracked_map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/utils/tracked-map */ \"./node_modules/@libp2p/utils/dist/src/tracked-map.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n\n\n\nclass DefaultTransportManager {\n log;\n components;\n transports;\n listeners;\n faultTolerance;\n started;\n constructor(components, init = {}) {\n this.log = components.logger.forComponent('libp2p:transports');\n this.components = components;\n this.started = false;\n this.transports = new Map();\n this.listeners = (0,_libp2p_utils_tracked_map__WEBPACK_IMPORTED_MODULE_0__.trackedMap)({\n name: 'libp2p_transport_manager_listeners',\n metrics: this.components.metrics\n });\n this.faultTolerance = init.faultTolerance ?? _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.FaultTolerance.FATAL_ALL;\n }\n /**\n * Adds a `Transport` to the manager\n */\n add(transport) {\n const tag = transport[Symbol.toStringTag];\n if (tag == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError('Transport must have a valid tag', _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_INVALID_KEY);\n }\n if (this.transports.has(tag)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError(`There is already a transport with the tag ${tag}`, _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_DUPLICATE_TRANSPORT);\n }\n this.log('adding transport %s', tag);\n this.transports.set(tag, transport);\n if (!this.listeners.has(tag)) {\n this.listeners.set(tag, []);\n }\n }\n isStarted() {\n return this.started;\n }\n start() {\n this.started = true;\n }\n async afterStart() {\n // Listen on the provided transports for the provided addresses\n const addrs = this.components.addressManager.getListenAddrs();\n await this.listen(addrs);\n }\n /**\n * Stops all listeners\n */\n async stop() {\n const tasks = [];\n for (const [key, listeners] of this.listeners) {\n this.log('closing listeners for %s', key);\n while (listeners.length > 0) {\n const listener = listeners.pop();\n if (listener == null) {\n continue;\n }\n tasks.push(listener.close());\n }\n }\n await Promise.all(tasks);\n this.log('all listeners closed');\n for (const key of this.listeners.keys()) {\n this.listeners.set(key, []);\n }\n this.started = false;\n }\n /**\n * Dials the given Multiaddr over it's supported transport\n */\n async dial(ma, options) {\n const transport = this.transportForMultiaddr(ma);\n if (transport == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError(`No transport available for address ${String(ma)}`, _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_TRANSPORT_UNAVAILABLE);\n }\n try {\n return await transport.dial(ma, {\n ...options,\n upgrader: this.components.upgrader\n });\n }\n catch (err) {\n if (err.code == null) {\n err.code = _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_TRANSPORT_DIAL_FAILED;\n }\n throw err;\n }\n }\n /**\n * Returns all Multiaddr's the listeners are using\n */\n getAddrs() {\n let addrs = [];\n for (const listeners of this.listeners.values()) {\n for (const listener of listeners) {\n addrs = [...addrs, ...listener.getAddrs()];\n }\n }\n return addrs;\n }\n /**\n * Returns all the transports instances\n */\n getTransports() {\n return Array.of(...this.transports.values());\n }\n /**\n * Returns all the listener instances\n */\n getListeners() {\n return Array.of(...this.listeners.values()).flat();\n }\n /**\n * Finds a transport that matches the given Multiaddr\n */\n transportForMultiaddr(ma) {\n for (const transport of this.transports.values()) {\n const addrs = transport.filter([ma]);\n if (addrs.length > 0) {\n return transport;\n }\n }\n }\n /**\n * Starts listeners for each listen Multiaddr\n */\n async listen(addrs) {\n if (!this.isStarted()) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError('Not started', _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_NODE_NOT_STARTED);\n }\n if (addrs == null || addrs.length === 0) {\n this.log('no addresses were provided for listening, this node is dial only');\n return;\n }\n const couldNotListen = [];\n for (const [key, transport] of this.transports.entries()) {\n const supportedAddrs = transport.filter(addrs);\n const tasks = [];\n // For each supported multiaddr, create a listener\n for (const addr of supportedAddrs) {\n this.log('creating listener for %s on %a', key, addr);\n const listener = transport.createListener({\n upgrader: this.components.upgrader\n });\n let listeners = this.listeners.get(key) ?? [];\n if (listeners == null) {\n listeners = [];\n this.listeners.set(key, listeners);\n }\n listeners.push(listener);\n // Track listen/close events\n listener.addEventListener('listening', () => {\n this.components.events.safeDispatchEvent('transport:listening', {\n detail: listener\n });\n });\n listener.addEventListener('close', () => {\n const index = listeners.findIndex(l => l === listener);\n // remove the listener\n listeners.splice(index, 1);\n this.components.events.safeDispatchEvent('transport:close', {\n detail: listener\n });\n });\n // We need to attempt to listen on everything\n tasks.push(listener.listen(addr));\n }\n // Keep track of transports we had no addresses for\n if (tasks.length === 0) {\n couldNotListen.push(key);\n continue;\n }\n const results = await Promise.allSettled(tasks);\n // If we are listening on at least 1 address, succeed.\n // TODO: we should look at adding a retry (`p-retry`) here to better support\n // listening on remote addresses as they may be offline. We could then potentially\n // just wait for any (`p-any`) listener to succeed on each transport before returning\n const isListening = results.find(r => r.status === 'fulfilled');\n if ((isListening == null) && this.faultTolerance !== _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.FaultTolerance.NO_FATAL) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Transport (${key}) could not listen on any available address`, _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_NO_VALID_ADDRESSES);\n }\n }\n // If no transports were able to listen, throw an error. This likely\n // means we were given addresses we do not have transports for\n if (couldNotListen.length === this.transports.size) {\n const message = `no valid addresses were provided for transports [${couldNotListen.join(', ')}]`;\n if (this.faultTolerance === _libp2p_interface__WEBPACK_IMPORTED_MODULE_1__.FaultTolerance.FATAL_ALL) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_2__.CodeError(message, _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_NO_VALID_ADDRESSES);\n }\n this.log(`libp2p in dial mode only: ${message}`);\n }\n }\n /**\n * Removes the given transport from the manager.\n * If a transport has any running listeners, they will be closed.\n */\n async remove(key) {\n const listeners = this.listeners.get(key) ?? [];\n this.log.trace('removing transport %s', key);\n // Close any running listeners\n const tasks = [];\n this.log.trace('closing listeners for %s', key);\n while (listeners.length > 0) {\n const listener = listeners.pop();\n if (listener == null) {\n continue;\n }\n tasks.push(listener.close());\n }\n await Promise.all(tasks);\n this.transports.delete(key);\n this.listeners.delete(key);\n }\n /**\n * Removes all transports from the manager.\n * If any listeners are running, they will be closed.\n *\n * @async\n */\n async removeAll() {\n const tasks = [];\n for (const key of this.transports.keys()) {\n tasks.push(this.remove(key));\n }\n await Promise.all(tasks);\n }\n}\n//# sourceMappingURL=transport-manager.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/transport-manager.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/upgrader.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/upgrader.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultUpgrader: () => (/* binding */ DefaultUpgrader)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/errors.js\");\n/* harmony import */ var _libp2p_interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface */ \"./node_modules/@libp2p/interface/dist/src/events.js\");\n/* harmony import */ var _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @libp2p/multistream-select */ \"./node_modules/@libp2p/multistream-select/dist/src/handle.js\");\n/* harmony import */ var _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @libp2p/multistream-select */ \"./node_modules/@libp2p/multistream-select/dist/src/select.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _connection_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./connection/index.js */ \"./node_modules/libp2p/dist/src/connection/index.js\");\n/* harmony import */ var _connection_manager_constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./connection-manager/constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.defaults.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _registrar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./registrar.js */ \"./node_modules/libp2p/dist/src/registrar.js\");\n\n\n\n\n\n\n\nconst DEFAULT_PROTOCOL_SELECT_TIMEOUT = 30000;\nfunction findIncomingStreamLimit(protocol, registrar) {\n try {\n const { options } = registrar.getHandler(protocol);\n return options.maxInboundStreams;\n }\n catch (err) {\n if (err.code !== _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_NO_HANDLER_FOR_PROTOCOL) {\n throw err;\n }\n }\n return _registrar_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_MAX_INBOUND_STREAMS;\n}\nfunction findOutgoingStreamLimit(protocol, registrar, options = {}) {\n try {\n const { options } = registrar.getHandler(protocol);\n if (options.maxOutboundStreams != null) {\n return options.maxOutboundStreams;\n }\n }\n catch (err) {\n if (err.code !== _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_NO_HANDLER_FOR_PROTOCOL) {\n throw err;\n }\n }\n return options.maxOutboundStreams ?? _registrar_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_MAX_OUTBOUND_STREAMS;\n}\nfunction countStreams(protocol, direction, connection) {\n let streamCount = 0;\n connection.streams.forEach(stream => {\n if (stream.direction === direction && stream.protocol === protocol) {\n streamCount++;\n }\n });\n return streamCount;\n}\nclass DefaultUpgrader {\n components;\n connectionEncryption;\n muxers;\n inboundUpgradeTimeout;\n events;\n constructor(components, init) {\n this.components = components;\n this.connectionEncryption = new Map();\n init.connectionEncryption.forEach(encrypter => {\n this.connectionEncryption.set(encrypter.protocol, encrypter);\n });\n this.muxers = new Map();\n init.muxers.forEach(muxer => {\n this.muxers.set(muxer.protocol, muxer);\n });\n this.inboundUpgradeTimeout = init.inboundUpgradeTimeout ?? _connection_manager_constants_js__WEBPACK_IMPORTED_MODULE_2__.INBOUND_UPGRADE_TIMEOUT;\n this.events = components.events;\n }\n async shouldBlockConnection(remotePeer, maConn, connectionType) {\n const connectionGater = this.components.connectionGater[connectionType];\n if (connectionGater !== undefined) {\n if (await connectionGater(remotePeer, maConn)) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(`The multiaddr connection is blocked by gater.${connectionType}`, _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_CONNECTION_INTERCEPTED);\n }\n }\n }\n /**\n * Upgrades an inbound connection\n */\n async upgradeInbound(maConn, opts) {\n const accept = await this.components.connectionManager.acceptIncomingConnection(maConn);\n if (!accept) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('connection denied', _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_CONNECTION_DENIED);\n }\n let encryptedConn;\n let remotePeer;\n let upgradedConn;\n let muxerFactory;\n let cryptoProtocol;\n const signal = AbortSignal.timeout(this.inboundUpgradeTimeout);\n const onAbort = () => {\n maConn.abort(new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('inbound upgrade timeout', _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.ERR_TIMEOUT));\n };\n signal.addEventListener('abort', onAbort, { once: true });\n (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.setMaxListeners)(Infinity, signal);\n try {\n if ((await this.components.connectionGater.denyInboundConnection?.(maConn)) === true) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('The multiaddr connection is blocked by gater.acceptConnection', _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_CONNECTION_INTERCEPTED);\n }\n this.components.metrics?.trackMultiaddrConnection(maConn);\n maConn.log('starting the inbound connection upgrade');\n // Protect\n let protectedConn = maConn;\n if (opts?.skipProtection !== true) {\n const protector = this.components.connectionProtector;\n if (protector != null) {\n maConn.log('protecting the inbound connection');\n protectedConn = await protector.protect(maConn);\n }\n }\n try {\n // Encrypt the connection\n encryptedConn = protectedConn;\n if (opts?.skipEncryption !== true) {\n ({\n conn: encryptedConn,\n remotePeer,\n protocol: cryptoProtocol\n } = await this._encryptInbound(protectedConn));\n const maConn = {\n ...protectedConn,\n ...encryptedConn\n };\n await this.shouldBlockConnection(remotePeer, maConn, 'denyInboundEncryptedConnection');\n }\n else {\n const idStr = maConn.remoteAddr.getPeerId();\n if (idStr == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('inbound connection that skipped encryption must have a peer id', _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_INVALID_MULTIADDR);\n }\n const remotePeerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_5__.peerIdFromString)(idStr);\n cryptoProtocol = 'native';\n remotePeer = remotePeerId;\n }\n upgradedConn = encryptedConn;\n if (opts?.muxerFactory != null) {\n muxerFactory = opts.muxerFactory;\n }\n else if (this.muxers.size > 0) {\n // Multiplex the connection\n const multiplexed = await this._multiplexInbound({\n ...protectedConn,\n ...encryptedConn\n }, this.muxers);\n muxerFactory = multiplexed.muxerFactory;\n upgradedConn = multiplexed.stream;\n }\n }\n catch (err) {\n maConn.log.error('failed to upgrade inbound connection', err);\n throw err;\n }\n await this.shouldBlockConnection(remotePeer, maConn, 'denyInboundUpgradedConnection');\n maConn.log('successfully upgraded inbound connection');\n return this._createConnection({\n cryptoProtocol,\n direction: 'inbound',\n maConn,\n upgradedConn,\n muxerFactory,\n remotePeer,\n transient: opts?.transient\n });\n }\n finally {\n signal.removeEventListener('abort', onAbort);\n this.components.connectionManager.afterUpgradeInbound();\n }\n }\n /**\n * Upgrades an outbound connection\n */\n async upgradeOutbound(maConn, opts) {\n const idStr = maConn.remoteAddr.getPeerId();\n let remotePeerId;\n if (idStr != null) {\n remotePeerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_5__.peerIdFromString)(idStr);\n await this.shouldBlockConnection(remotePeerId, maConn, 'denyOutboundConnection');\n }\n let encryptedConn;\n let remotePeer;\n let upgradedConn;\n let cryptoProtocol;\n let muxerFactory;\n this.components.metrics?.trackMultiaddrConnection(maConn);\n maConn.log('starting the outbound connection upgrade');\n // If the transport natively supports encryption, skip connection\n // protector and encryption\n // Protect\n let protectedConn = maConn;\n if (opts?.skipProtection !== true) {\n const protector = this.components.connectionProtector;\n if (protector != null) {\n protectedConn = await protector.protect(maConn);\n }\n }\n try {\n // Encrypt the connection\n encryptedConn = protectedConn;\n if (opts?.skipEncryption !== true) {\n ({\n conn: encryptedConn,\n remotePeer,\n protocol: cryptoProtocol\n } = await this._encryptOutbound(protectedConn, remotePeerId));\n const maConn = {\n ...protectedConn,\n ...encryptedConn\n };\n await this.shouldBlockConnection(remotePeer, maConn, 'denyOutboundEncryptedConnection');\n }\n else {\n if (remotePeerId == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Encryption was skipped but no peer id was passed', _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_INVALID_PEER);\n }\n cryptoProtocol = 'native';\n remotePeer = remotePeerId;\n }\n upgradedConn = encryptedConn;\n if (opts?.muxerFactory != null) {\n muxerFactory = opts.muxerFactory;\n }\n else if (this.muxers.size > 0) {\n // Multiplex the connection\n const multiplexed = await this._multiplexOutbound({\n ...protectedConn,\n ...encryptedConn\n }, this.muxers);\n muxerFactory = multiplexed.muxerFactory;\n upgradedConn = multiplexed.stream;\n }\n }\n catch (err) {\n maConn.log.error('failed to upgrade outbound connection', err);\n await maConn.close(err);\n throw err;\n }\n await this.shouldBlockConnection(remotePeer, maConn, 'denyOutboundUpgradedConnection');\n maConn.log('successfully upgraded outbound connection');\n return this._createConnection({\n cryptoProtocol,\n direction: 'outbound',\n maConn,\n upgradedConn,\n muxerFactory,\n remotePeer,\n transient: opts?.transient\n });\n }\n /**\n * A convenience method for generating a new `Connection`\n */\n _createConnection(opts) {\n const { cryptoProtocol, direction, maConn, upgradedConn, remotePeer, muxerFactory, transient } = opts;\n let muxer;\n let newStream;\n let connection; // eslint-disable-line prefer-const\n if (muxerFactory != null) {\n // Create the muxer\n muxer = muxerFactory.createStreamMuxer({\n direction,\n // Run anytime a remote stream is created\n onIncomingStream: muxedStream => {\n if (connection == null) {\n return;\n }\n void Promise.resolve()\n .then(async () => {\n const protocols = this.components.registrar.getProtocols();\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_6__.handle(muxedStream, protocols, {\n log: muxedStream.log,\n yieldBytes: false\n });\n if (connection == null) {\n return;\n }\n connection.log('incoming stream opened on %s', protocol);\n const incomingLimit = findIncomingStreamLimit(protocol, this.components.registrar);\n const streamCount = countStreams(protocol, 'inbound', connection);\n if (streamCount === incomingLimit) {\n const err = new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(`Too many inbound protocol streams for protocol \"${protocol}\" - limit ${incomingLimit}`, _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS);\n muxedStream.abort(err);\n throw err;\n }\n // after the handshake the returned stream can have early data so override\n // the souce/sink\n muxedStream.source = stream.source;\n muxedStream.sink = stream.sink;\n muxedStream.protocol = protocol;\n // allow closing the write end of a not-yet-negotiated stream\n if (stream.closeWrite != null) {\n muxedStream.closeWrite = stream.closeWrite;\n }\n // allow closing the read end of a not-yet-negotiated stream\n if (stream.closeRead != null) {\n muxedStream.closeRead = stream.closeRead;\n }\n // make sure we don't try to negotiate a stream we are closing\n if (stream.close != null) {\n muxedStream.close = stream.close;\n }\n // If a protocol stream has been successfully negotiated and is to be passed to the application,\n // the peerstore should ensure that the peer is registered with that protocol\n await this.components.peerStore.merge(remotePeer, {\n protocols: [protocol]\n });\n this.components.metrics?.trackProtocolStream(muxedStream, connection);\n this._onStream({ connection, stream: muxedStream, protocol });\n })\n .catch(async (err) => {\n connection.log.error('error handling incoming stream id %s', muxedStream.id, err.message, err.code, err.stack);\n if (muxedStream.timeline.close == null) {\n await muxedStream.close();\n }\n });\n }\n });\n newStream = async (protocols, options = {}) => {\n if (muxer == null) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Stream is not multiplexed', _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_MUXER_UNAVAILABLE);\n }\n connection.log('starting new stream for protocols %s', protocols);\n const muxedStream = await muxer.newStream();\n connection.log.trace('started new stream %s for protocols %s', muxedStream.id, protocols);\n try {\n if (options.signal == null) {\n muxedStream.log('no abort signal was passed while trying to negotiate protocols %s falling back to default timeout', protocols);\n const signal = AbortSignal.timeout(DEFAULT_PROTOCOL_SELECT_TIMEOUT);\n (0,_libp2p_interface__WEBPACK_IMPORTED_MODULE_4__.setMaxListeners)(Infinity, signal);\n options = {\n ...options,\n signal\n };\n }\n muxedStream.log.trace('selecting protocol from protocols %s', protocols);\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_7__.select(muxedStream, protocols, {\n ...options,\n log: muxedStream.log,\n yieldBytes: true\n });\n muxedStream.log('selected protocol %s', protocol);\n const outgoingLimit = findOutgoingStreamLimit(protocol, this.components.registrar, options);\n const streamCount = countStreams(protocol, 'outbound', connection);\n if (streamCount >= outgoingLimit) {\n const err = new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(`Too many outbound protocol streams for protocol \"${protocol}\" - limit ${outgoingLimit}`, _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);\n muxedStream.abort(err);\n throw err;\n }\n // If a protocol stream has been successfully negotiated and is to be passed to the application,\n // the peerstore should ensure that the peer is registered with that protocol\n await this.components.peerStore.merge(remotePeer, {\n protocols: [protocol]\n });\n // after the handshake the returned stream can have early data so override\n // the souce/sink\n muxedStream.source = stream.source;\n muxedStream.sink = stream.sink;\n muxedStream.protocol = protocol;\n // allow closing the write end of a not-yet-negotiated stream\n if (stream.closeWrite != null) {\n muxedStream.closeWrite = stream.closeWrite;\n }\n // allow closing the read end of a not-yet-negotiated stream\n if (stream.closeRead != null) {\n muxedStream.closeRead = stream.closeRead;\n }\n // make sure we don't try to negotiate a stream we are closing\n if (stream.close != null) {\n muxedStream.close = stream.close;\n }\n this.components.metrics?.trackProtocolStream(muxedStream, connection);\n return muxedStream;\n }\n catch (err) {\n connection.log.error('could not create new stream for protocols %s', protocols, err);\n if (muxedStream.timeline.close == null) {\n muxedStream.abort(err);\n }\n if (err.code != null) {\n throw err;\n }\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_UNSUPPORTED_PROTOCOL);\n }\n };\n // Pipe all data through the muxer\n void Promise.all([\n muxer.sink(upgradedConn.source),\n upgradedConn.sink(muxer.source)\n ]).catch(err => {\n connection.log.error('error piping data through muxer', err);\n });\n }\n const _timeline = maConn.timeline;\n maConn.timeline = new Proxy(_timeline, {\n set: (...args) => {\n if (connection != null && args[1] === 'close' && args[2] != null && _timeline.close == null) {\n // Wait for close to finish before notifying of the closure\n (async () => {\n try {\n if (connection.status === 'open') {\n await connection.close();\n }\n }\n catch (err) {\n connection.log.error('error closing connection after timeline close', err);\n }\n finally {\n this.events.safeDispatchEvent('connection:close', {\n detail: connection\n });\n }\n })().catch(err => {\n connection.log.error('error thrown while dispatching connection:close event', err);\n });\n }\n return Reflect.set(...args);\n }\n });\n maConn.timeline.upgraded = Date.now();\n const errConnectionNotMultiplexed = () => {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('connection is not multiplexed', _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_CONNECTION_NOT_MULTIPLEXED);\n };\n // Create the connection\n connection = (0,_connection_index_js__WEBPACK_IMPORTED_MODULE_8__.createConnection)({\n remoteAddr: maConn.remoteAddr,\n remotePeer,\n status: 'open',\n direction,\n timeline: maConn.timeline,\n multiplexer: muxer?.protocol,\n encryption: cryptoProtocol,\n transient,\n logger: this.components.logger,\n newStream: newStream ?? errConnectionNotMultiplexed,\n getStreams: () => { if (muxer != null) {\n return muxer.streams;\n }\n else {\n return [];\n } },\n close: async (options) => {\n // Ensure remaining streams are closed gracefully\n if (muxer != null) {\n connection.log.trace('close muxer');\n await muxer.close(options);\n }\n connection.log.trace('close maconn');\n // close the underlying transport\n await maConn.close(options);\n connection.log.trace('closed maconn');\n },\n abort: (err) => {\n maConn.abort(err);\n // Ensure remaining streams are aborted\n if (muxer != null) {\n muxer.abort(err);\n }\n }\n });\n this.events.safeDispatchEvent('connection:open', {\n detail: connection\n });\n return connection;\n }\n /**\n * Routes incoming streams to the correct handler\n */\n _onStream(opts) {\n const { connection, stream, protocol } = opts;\n const { handler, options } = this.components.registrar.getHandler(protocol);\n if (connection.transient && options.runOnTransientConnection !== true) {\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError('Cannot open protocol stream on transient connection', 'ERR_TRANSIENT_CONNECTION');\n }\n handler({ connection, stream });\n }\n /**\n * Attempts to encrypt the incoming `connection` with the provided `cryptos`\n */\n async _encryptInbound(connection) {\n const protocols = Array.from(this.connectionEncryption.keys());\n connection.log('handling inbound crypto protocol selection', protocols);\n try {\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_6__.handle(connection, protocols, {\n log: connection.log\n });\n const encrypter = this.connectionEncryption.get(protocol);\n if (encrypter == null) {\n throw new Error(`no crypto module found for ${protocol}`);\n }\n connection.log('encrypting inbound connection using', protocol);\n return {\n ...await encrypter.secureInbound(this.components.peerId, stream),\n protocol\n };\n }\n catch (err) {\n connection.log.error('encrypting inbound connection to %p failed', err);\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(err.message, _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_ENCRYPTION_FAILED);\n }\n }\n /**\n * Attempts to encrypt the given `connection` with the provided connection encrypters.\n * The first `ConnectionEncrypter` module to succeed will be used\n */\n async _encryptOutbound(connection, remotePeerId) {\n const protocols = Array.from(this.connectionEncryption.keys());\n connection.log('selecting outbound crypto protocol', protocols);\n try {\n connection.log.trace('selecting encrypter from %s', protocols);\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_7__.select(connection, protocols, {\n log: connection.log,\n yieldBytes: true\n });\n const encrypter = this.connectionEncryption.get(protocol);\n if (encrypter == null) {\n throw new Error(`no crypto module found for ${protocol}`);\n }\n connection.log('encrypting outbound connection to %p using %s', remotePeerId, encrypter);\n return {\n ...await encrypter.secureOutbound(this.components.peerId, stream, remotePeerId),\n protocol\n };\n }\n catch (err) {\n connection.log.error('encrypting outbound connection to %p failed', err);\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(err.message, _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_ENCRYPTION_FAILED);\n }\n }\n /**\n * Selects one of the given muxers via multistream-select. That\n * muxer will be used for all future streams on the connection.\n */\n async _multiplexOutbound(connection, muxers) {\n const protocols = Array.from(muxers.keys());\n connection.log('outbound selecting muxer %s', protocols);\n try {\n connection.log.trace('selecting stream muxer from %s', protocols);\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_7__.select(connection, protocols, {\n log: connection.log,\n yieldBytes: true\n });\n connection.log('selected %s as muxer protocol', protocol);\n const muxerFactory = muxers.get(protocol);\n return { stream, muxerFactory };\n }\n catch (err) {\n connection.log.error('error multiplexing outbound connection', err);\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_MUXER_UNAVAILABLE);\n }\n }\n /**\n * Registers support for one of the given muxers via multistream-select. The\n * selected muxer will be used for all future streams on the connection.\n */\n async _multiplexInbound(connection, muxers) {\n const protocols = Array.from(muxers.keys());\n connection.log('inbound handling muxers %s', protocols);\n try {\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_6__.handle(connection, protocols, {\n log: connection.log\n });\n const muxerFactory = muxers.get(protocol);\n return { stream, muxerFactory };\n }\n catch (err) {\n connection.log.error('error multiplexing inbound connection', err);\n throw new _libp2p_interface__WEBPACK_IMPORTED_MODULE_3__.CodeError(String(err), _errors_js__WEBPACK_IMPORTED_MODULE_0__.codes.ERR_MUXER_UNAVAILABLE);\n }\n }\n}\n//# sourceMappingURL=upgrader.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/upgrader.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/dist/src/version.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/libp2p/dist/src/version.js ***!
|
||
\*************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ name: () => (/* binding */ name),\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = '1.4.2';\nconst name = 'libp2p';\n//# sourceMappingURL=version.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/dist/src/version.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!************************************************************************!*\
|
||
!*** ./node_modules/libp2p/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/node_modules/uint8arrays/dist/src/concat.js":
|
||
/*!*************************************************************************!*\
|
||
!*** ./node_modules/libp2p/node_modules/uint8arrays/dist/src/concat.js ***!
|
||
\*************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ concat: () => (/* binding */ concat)\n/* harmony export */ });\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #alloc */ \"./node_modules/libp2p/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #util/as-uint8array */ \"./node_modules/libp2p/node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Uint8Arrays\n */\nfunction concat(arrays, length) {\n if (length == null) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n const output = (0,_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(length);\n let offset = 0;\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n return (0,_util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(output);\n}\n//# sourceMappingURL=concat.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/node_modules/uint8arrays/dist/src/concat.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/libp2p/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/libp2p/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/libp2p/node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/libp2p/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/node_modules/uint8arrays/dist/src/util/as-uint8array.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/libp2p/node_modules/uint8arrays/dist/src/util/as-uint8array.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asUint8Array: () => (/* binding */ asUint8Array)\n/* harmony export */ });\n/**\n * To guarantee Uint8Array semantics, convert nodejs Buffers\n * into vanilla Uint8Arrays\n */\nfunction asUint8Array(buf) {\n return buf;\n}\n//# sourceMappingURL=as-uint8array.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/node_modules/uint8arrays/dist/src/util/as-uint8array.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/libp2p/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/libp2p/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/libp2p/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/libp2p/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/merge-options/index.mjs":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/merge-options/index.mjs ***!
|
||
\**********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./node_modules/merge-options/index.js\");\n/**\n * Thin ESM wrapper for CJS named exports.\n *\n * Ref: https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1\n */\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_index_js__WEBPACK_IMPORTED_MODULE_0__);\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/merge-options/index.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/mortice/dist/src/browser.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/mortice/dist/src/browser.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var observable_webworkers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! observable-webworkers */ \"./node_modules/observable-webworkers/dist/src/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/mortice/dist/src/constants.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/mortice/dist/src/utils.js\");\n\n\n\nconst handleWorkerLockRequest = (emitter, masterEvent, requestType, releaseType, grantType) => {\n return (worker, event) => {\n if (event.data.type !== requestType) {\n return;\n }\n const requestEvent = {\n type: event.data.type,\n name: event.data.name,\n identifier: event.data.identifier\n };\n emitter.dispatchEvent(new MessageEvent(masterEvent, {\n data: {\n name: requestEvent.name,\n handler: async () => {\n // grant lock to worker\n worker.postMessage({\n type: grantType,\n name: requestEvent.name,\n identifier: requestEvent.identifier\n });\n // wait for worker to finish\n await new Promise((resolve) => {\n const releaseEventListener = (event) => {\n if (event == null || event.data == null) {\n return;\n }\n const releaseEvent = {\n type: event.data.type,\n name: event.data.name,\n identifier: event.data.identifier\n };\n if (releaseEvent.type === releaseType && releaseEvent.identifier === requestEvent.identifier) {\n worker.removeEventListener('message', releaseEventListener);\n resolve();\n }\n };\n worker.addEventListener('message', releaseEventListener);\n });\n }\n }\n }));\n };\n};\nconst makeWorkerLockRequest = (name, requestType, grantType, releaseType) => {\n return async () => {\n const id = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.nanoid)();\n globalThis.postMessage({\n type: requestType,\n identifier: id,\n name\n });\n return new Promise((resolve) => {\n const listener = (event) => {\n if (event == null || event.data == null) {\n return;\n }\n const responseEvent = {\n type: event.data.type,\n identifier: event.data.identifier\n };\n if (responseEvent.type === grantType && responseEvent.identifier === id) {\n globalThis.removeEventListener('message', listener);\n // grant lock\n resolve(() => {\n // release lock\n globalThis.postMessage({\n type: releaseType,\n identifier: id,\n name\n });\n });\n }\n };\n globalThis.addEventListener('message', listener);\n });\n };\n};\nconst defaultOptions = {\n singleProcess: false\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((options) => {\n options = Object.assign({}, defaultOptions, options);\n const isPrimary = Boolean(globalThis.document) || options.singleProcess;\n if (isPrimary) {\n const emitter = new EventTarget();\n observable_webworkers__WEBPACK_IMPORTED_MODULE_0__[\"default\"].addEventListener('message', handleWorkerLockRequest(emitter, 'requestReadLock', _constants_js__WEBPACK_IMPORTED_MODULE_1__.WORKER_REQUEST_READ_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_1__.WORKER_RELEASE_READ_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_1__.MASTER_GRANT_READ_LOCK));\n observable_webworkers__WEBPACK_IMPORTED_MODULE_0__[\"default\"].addEventListener('message', handleWorkerLockRequest(emitter, 'requestWriteLock', _constants_js__WEBPACK_IMPORTED_MODULE_1__.WORKER_REQUEST_WRITE_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_1__.WORKER_RELEASE_WRITE_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_1__.MASTER_GRANT_WRITE_LOCK));\n return emitter;\n }\n return {\n isWorker: true,\n readLock: (name) => makeWorkerLockRequest(name, _constants_js__WEBPACK_IMPORTED_MODULE_1__.WORKER_REQUEST_READ_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_1__.MASTER_GRANT_READ_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_1__.WORKER_RELEASE_READ_LOCK),\n writeLock: (name) => makeWorkerLockRequest(name, _constants_js__WEBPACK_IMPORTED_MODULE_1__.WORKER_REQUEST_WRITE_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_1__.MASTER_GRANT_WRITE_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_1__.WORKER_RELEASE_WRITE_LOCK)\n };\n});\n//# sourceMappingURL=browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/mortice/dist/src/browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/mortice/dist/src/constants.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/mortice/dist/src/constants.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MASTER_GRANT_READ_LOCK: () => (/* binding */ MASTER_GRANT_READ_LOCK),\n/* harmony export */ MASTER_GRANT_WRITE_LOCK: () => (/* binding */ MASTER_GRANT_WRITE_LOCK),\n/* harmony export */ WORKER_RELEASE_READ_LOCK: () => (/* binding */ WORKER_RELEASE_READ_LOCK),\n/* harmony export */ WORKER_RELEASE_WRITE_LOCK: () => (/* binding */ WORKER_RELEASE_WRITE_LOCK),\n/* harmony export */ WORKER_REQUEST_READ_LOCK: () => (/* binding */ WORKER_REQUEST_READ_LOCK),\n/* harmony export */ WORKER_REQUEST_WRITE_LOCK: () => (/* binding */ WORKER_REQUEST_WRITE_LOCK)\n/* harmony export */ });\nconst WORKER_REQUEST_READ_LOCK = 'lock:worker:request-read';\nconst WORKER_RELEASE_READ_LOCK = 'lock:worker:release-read';\nconst MASTER_GRANT_READ_LOCK = 'lock:master:grant-read';\nconst WORKER_REQUEST_WRITE_LOCK = 'lock:worker:request-write';\nconst WORKER_RELEASE_WRITE_LOCK = 'lock:worker:release-write';\nconst MASTER_GRANT_WRITE_LOCK = 'lock:master:grant-write';\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/mortice/dist/src/constants.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/mortice/dist/src/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/mortice/dist/src/index.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ createMortice)\n/* harmony export */ });\n/* harmony import */ var p_queue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! p-queue */ \"./node_modules/p-queue/dist/index.js\");\n/* harmony import */ var p_timeout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-timeout */ \"./node_modules/p-timeout/index.js\");\n/* harmony import */ var _node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node.js */ \"./node_modules/mortice/dist/src/browser.js\");\n/**\n * @packageDocumentation\n *\n * - Reads occur concurrently\n * - Writes occur one at a time\n * - No reads occur while a write operation is in progress\n * - Locks can be created with different names\n * - Reads/writes can time out\n *\n * ## Usage\n *\n * ```javascript\n * import mortice from 'mortice'\n * import delay from 'delay'\n *\n * // the lock name & options objects are both optional\n * const mutex = mortice('my-lock', {\n *\n * // how long before write locks time out (default: 24 hours)\n * timeout: 30000,\n *\n * // control how many read operations are executed concurrently (default: Infinity)\n * concurrency: 5,\n *\n * // by default the the lock will be held on the main thread, set this to true if the\n * // a lock should reside on each worker (default: false)\n * singleProcess: false\n * })\n *\n * Promise.all([\n * (async () => {\n * const release = await mutex.readLock()\n *\n * try {\n * console.info('read 1')\n * } finally {\n * release()\n * }\n * })(),\n * (async () => {\n * const release = await mutex.readLock()\n *\n * try {\n * console.info('read 2')\n * } finally {\n * release()\n * }\n * })(),\n * (async () => {\n * const release = await mutex.writeLock()\n *\n * try {\n * await delay(1000)\n *\n * console.info('write 1')\n * } finally {\n * release()\n * }\n * })(),\n * (async () => {\n * const release = await mutex.readLock()\n *\n * try {\n * console.info('read 3')\n * } finally {\n * release()\n * }\n * })()\n * ])\n * ```\n *\n * read 1\n * read 2\n * <small pause>\n * write 1\n * read 3\n *\n * ## Browser\n *\n * Because there's no global way to evesdrop on messages sent by Web Workers, please pass all created Web Workers to the [`observable-webworkers`](https://npmjs.org/package/observable-webworkers) module:\n *\n * ```javascript\n * // main.js\n * import mortice from 'mortice'\n * import observe from 'observable-webworkers'\n *\n * // create our lock on the main thread, it will be held here\n * const mutex = mortice()\n *\n * const worker = new Worker('worker.js')\n *\n * observe(worker)\n * ```\n *\n * ```javascript\n * // worker.js\n * import mortice from 'mortice'\n * import delay from 'delay'\n *\n * const mutex = mortice()\n *\n * let release = await mutex.readLock()\n * // read something\n * release()\n *\n * release = await mutex.writeLock()\n * // write something\n * release()\n * ```\n */\n\n\n\nconst mutexes = {};\nlet implementation;\nasync function createReleaseable(queue, options) {\n let res;\n const p = new Promise((resolve) => {\n res = resolve;\n });\n void queue.add(async () => (0,p_timeout__WEBPACK_IMPORTED_MODULE_0__[\"default\"])((async () => {\n await new Promise((resolve) => {\n res(() => {\n resolve();\n });\n });\n })(), {\n milliseconds: options.timeout\n }));\n return p;\n}\nconst createMutex = (name, options) => {\n if (implementation.isWorker === true) {\n return {\n readLock: implementation.readLock(name, options),\n writeLock: implementation.writeLock(name, options)\n };\n }\n const masterQueue = new p_queue__WEBPACK_IMPORTED_MODULE_2__[\"default\"]({ concurrency: 1 });\n let readQueue;\n return {\n async readLock() {\n // If there's already a read queue, just add the task to it\n if (readQueue != null) {\n return createReleaseable(readQueue, options);\n }\n // Create a new read queue\n readQueue = new p_queue__WEBPACK_IMPORTED_MODULE_2__[\"default\"]({\n concurrency: options.concurrency,\n autoStart: false\n });\n const localReadQueue = readQueue;\n // Add the task to the read queue\n const readPromise = createReleaseable(readQueue, options);\n void masterQueue.add(async () => {\n // Start the task only once the master queue has completed processing\n // any previous tasks\n localReadQueue.start();\n // Once all the tasks in the read queue have completed, remove it so\n // that the next read lock will occur after any write locks that were\n // started in the interim\n await localReadQueue.onIdle()\n .then(() => {\n if (readQueue === localReadQueue) {\n readQueue = null;\n }\n });\n });\n return readPromise;\n },\n async writeLock() {\n // Remove the read queue reference, so that any later read locks will be\n // added to a new queue that starts after this write lock has been\n // released\n readQueue = null;\n return createReleaseable(masterQueue, options);\n }\n };\n};\nconst defaultOptions = {\n name: 'lock',\n concurrency: Infinity,\n timeout: 84600000,\n singleProcess: false\n};\nfunction createMortice(options) {\n const opts = Object.assign({}, defaultOptions, options);\n if (implementation == null) {\n implementation = (0,_node_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(opts);\n if (implementation.isWorker !== true) {\n // we are master, set up worker requests\n implementation.addEventListener('requestReadLock', (event) => {\n if (mutexes[event.data.name] == null) {\n return;\n }\n void mutexes[event.data.name].readLock()\n .then(async (release) => event.data.handler().finally(() => { release(); }));\n });\n implementation.addEventListener('requestWriteLock', async (event) => {\n if (mutexes[event.data.name] == null) {\n return;\n }\n void mutexes[event.data.name].writeLock()\n .then(async (release) => event.data.handler().finally(() => { release(); }));\n });\n }\n }\n if (mutexes[opts.name] == null) {\n mutexes[opts.name] = createMutex(opts.name, opts);\n }\n return mutexes[opts.name];\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/mortice/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/mortice/dist/src/utils.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/mortice/dist/src/utils.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ nanoid: () => (/* binding */ nanoid)\n/* harmony export */ });\nconst nanoid = (size = 21) => {\n return Math.random().toString().substring(2);\n};\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/mortice/dist/src/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/base.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/base.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Codec: () => (/* binding */ Codec),\n/* harmony export */ baseX: () => (/* binding */ baseX),\n/* harmony export */ from: () => (/* binding */ from),\n/* harmony export */ or: () => (/* binding */ or),\n/* harmony export */ rfc4648: () => (/* binding */ rfc4648)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/dist/src/bytes.js\");\n/* harmony import */ var _vendor_base_x_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../vendor/base-x.js */ \"./node_modules/multiformats/dist/src/vendor/base-x.js\");\n\n\n/**\n * Class represents both BaseEncoder and MultibaseEncoder meaning it\n * can be used to encode to multibase or base encode without multibase\n * prefix.\n */\nclass Encoder {\n name;\n prefix;\n baseEncode;\n constructor(name, prefix, baseEncode) {\n this.name = name;\n this.prefix = prefix;\n this.baseEncode = baseEncode;\n }\n encode(bytes) {\n if (bytes instanceof Uint8Array) {\n return `${this.prefix}${this.baseEncode(bytes)}`;\n }\n else {\n throw Error('Unknown type, must be binary type');\n }\n }\n}\n/**\n * Class represents both BaseDecoder and MultibaseDecoder so it could be used\n * to decode multibases (with matching prefix) or just base decode strings\n * with corresponding base encoding.\n */\nclass Decoder {\n name;\n prefix;\n baseDecode;\n prefixCodePoint;\n constructor(name, prefix, baseDecode) {\n this.name = name;\n this.prefix = prefix;\n /* c8 ignore next 3 */\n if (prefix.codePointAt(0) === undefined) {\n throw new Error('Invalid prefix character');\n }\n this.prefixCodePoint = prefix.codePointAt(0);\n this.baseDecode = baseDecode;\n }\n decode(text) {\n if (typeof text === 'string') {\n if (text.codePointAt(0) !== this.prefixCodePoint) {\n throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);\n }\n return this.baseDecode(text.slice(this.prefix.length));\n }\n else {\n throw Error('Can only multibase decode strings');\n }\n }\n or(decoder) {\n return or(this, decoder);\n }\n}\nclass ComposedDecoder {\n decoders;\n constructor(decoders) {\n this.decoders = decoders;\n }\n or(decoder) {\n return or(this, decoder);\n }\n decode(input) {\n const prefix = input[0];\n const decoder = this.decoders[prefix];\n if (decoder != null) {\n return decoder.decode(input);\n }\n else {\n throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`);\n }\n }\n}\nfunction or(left, right) {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n return new ComposedDecoder({\n ...(left.decoders ?? { [left.prefix]: left }),\n ...(right.decoders ?? { [right.prefix]: right })\n });\n}\nclass Codec {\n name;\n prefix;\n baseEncode;\n baseDecode;\n encoder;\n decoder;\n constructor(name, prefix, baseEncode, baseDecode) {\n this.name = name;\n this.prefix = prefix;\n this.baseEncode = baseEncode;\n this.baseDecode = baseDecode;\n this.encoder = new Encoder(name, prefix, baseEncode);\n this.decoder = new Decoder(name, prefix, baseDecode);\n }\n encode(input) {\n return this.encoder.encode(input);\n }\n decode(input) {\n return this.decoder.decode(input);\n }\n}\nfunction from({ name, prefix, encode, decode }) {\n return new Codec(name, prefix, encode, decode);\n}\nfunction baseX({ name, prefix, alphabet }) {\n const { encode, decode } = (0,_vendor_base_x_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(alphabet, name);\n return from({\n prefix,\n name,\n encode,\n decode: (text) => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(decode(text))\n });\n}\nfunction decode(string, alphabet, bitsPerChar, name) {\n // Build the character lookup table:\n const codes = {};\n for (let i = 0; i < alphabet.length; ++i) {\n codes[alphabet[i]] = i;\n }\n // Count the padding bytes:\n let end = string.length;\n while (string[end - 1] === '=') {\n --end;\n }\n // Allocate the output:\n const out = new Uint8Array((end * bitsPerChar / 8) | 0);\n // Parse the data:\n let bits = 0; // Number of bits currently in the buffer\n let buffer = 0; // Bits waiting to be written out, MSB first\n let written = 0; // Next byte to write\n for (let i = 0; i < end; ++i) {\n // Read one character from the string:\n const value = codes[string[i]];\n if (value === undefined) {\n throw new SyntaxError(`Non-${name} character`);\n }\n // Append the bits to the buffer:\n buffer = (buffer << bitsPerChar) | value;\n bits += bitsPerChar;\n // Write out some bits if the buffer has a byte's worth:\n if (bits >= 8) {\n bits -= 8;\n out[written++] = 0xff & (buffer >> bits);\n }\n }\n // Verify that we have received just enough bits:\n if (bits >= bitsPerChar || (0xff & (buffer << (8 - bits))) !== 0) {\n throw new SyntaxError('Unexpected end of data');\n }\n return out;\n}\nfunction encode(data, alphabet, bitsPerChar) {\n const pad = alphabet[alphabet.length - 1] === '=';\n const mask = (1 << bitsPerChar) - 1;\n let out = '';\n let bits = 0; // Number of bits currently in the buffer\n let buffer = 0; // Bits waiting to be written out, MSB first\n for (let i = 0; i < data.length; ++i) {\n // Slurp data into the buffer:\n buffer = (buffer << 8) | data[i];\n bits += 8;\n // Write out as much as we can:\n while (bits > bitsPerChar) {\n bits -= bitsPerChar;\n out += alphabet[mask & (buffer >> bits)];\n }\n }\n // Partial character:\n if (bits !== 0) {\n out += alphabet[mask & (buffer << (bitsPerChar - bits))];\n }\n // Add padding characters until we hit a byte boundary:\n if (pad) {\n while (((out.length * bitsPerChar) & 7) !== 0) {\n out += '=';\n }\n }\n return out;\n}\n/**\n * RFC4648 Factory\n */\nfunction rfc4648({ name, prefix, bitsPerChar, alphabet }) {\n return from({\n prefix,\n name,\n encode(input) {\n return encode(input, alphabet, bitsPerChar);\n },\n decode(input) {\n return decode(input, alphabet, bitsPerChar, name);\n }\n });\n}\n//# sourceMappingURL=base.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/base.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/base10.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/base10.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base10: () => (/* binding */ base10)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/dist/src/bases/base.js\");\n\nconst base10 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: '9',\n name: 'base10',\n alphabet: '0123456789'\n});\n//# sourceMappingURL=base10.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/base10.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/base16.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/base16.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base16: () => (/* binding */ base16),\n/* harmony export */ base16upper: () => (/* binding */ base16upper)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/dist/src/bases/base.js\");\n\nconst base16 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'f',\n name: 'base16',\n alphabet: '0123456789abcdef',\n bitsPerChar: 4\n});\nconst base16upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'F',\n name: 'base16upper',\n alphabet: '0123456789ABCDEF',\n bitsPerChar: 4\n});\n//# sourceMappingURL=base16.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/base16.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/base2.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/base2.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base2: () => (/* binding */ base2)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/dist/src/bases/base.js\");\n\nconst base2 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: '0',\n name: 'base2',\n alphabet: '01',\n bitsPerChar: 1\n});\n//# sourceMappingURL=base2.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/base2.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/base256emoji.js":
|
||
/*!******************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/base256emoji.js ***!
|
||
\******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base256emoji: () => (/* binding */ base256emoji)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/dist/src/bases/base.js\");\n\nconst alphabet = Array.from('🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂');\nconst alphabetBytesToChars = (alphabet.reduce((p, c, i) => { p[i] = c; return p; }, ([])));\nconst alphabetCharsToBytes = (alphabet.reduce((p, c, i) => { p[c.codePointAt(0)] = i; return p; }, ([])));\nfunction encode(data) {\n return data.reduce((p, c) => {\n p += alphabetBytesToChars[c];\n return p;\n }, '');\n}\nfunction decode(str) {\n const byts = [];\n for (const char of str) {\n const byt = alphabetCharsToBytes[char.codePointAt(0)];\n if (byt === undefined) {\n throw new Error(`Non-base256emoji character: ${char}`);\n }\n byts.push(byt);\n }\n return new Uint8Array(byts);\n}\nconst base256emoji = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n prefix: '🚀',\n name: 'base256emoji',\n encode,\n decode\n});\n//# sourceMappingURL=base256emoji.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/base256emoji.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/base32.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/base32.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base32: () => (/* binding */ base32),\n/* harmony export */ base32hex: () => (/* binding */ base32hex),\n/* harmony export */ base32hexpad: () => (/* binding */ base32hexpad),\n/* harmony export */ base32hexpadupper: () => (/* binding */ base32hexpadupper),\n/* harmony export */ base32hexupper: () => (/* binding */ base32hexupper),\n/* harmony export */ base32pad: () => (/* binding */ base32pad),\n/* harmony export */ base32padupper: () => (/* binding */ base32padupper),\n/* harmony export */ base32upper: () => (/* binding */ base32upper),\n/* harmony export */ base32z: () => (/* binding */ base32z)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/dist/src/bases/base.js\");\n\nconst base32 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'b',\n name: 'base32',\n alphabet: 'abcdefghijklmnopqrstuvwxyz234567',\n bitsPerChar: 5\n});\nconst base32upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'B',\n name: 'base32upper',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',\n bitsPerChar: 5\n});\nconst base32pad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'c',\n name: 'base32pad',\n alphabet: 'abcdefghijklmnopqrstuvwxyz234567=',\n bitsPerChar: 5\n});\nconst base32padupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'C',\n name: 'base32padupper',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=',\n bitsPerChar: 5\n});\nconst base32hex = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'v',\n name: 'base32hex',\n alphabet: '0123456789abcdefghijklmnopqrstuv',\n bitsPerChar: 5\n});\nconst base32hexupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'V',\n name: 'base32hexupper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV',\n bitsPerChar: 5\n});\nconst base32hexpad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 't',\n name: 'base32hexpad',\n alphabet: '0123456789abcdefghijklmnopqrstuv=',\n bitsPerChar: 5\n});\nconst base32hexpadupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'T',\n name: 'base32hexpadupper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV=',\n bitsPerChar: 5\n});\nconst base32z = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'h',\n name: 'base32z',\n alphabet: 'ybndrfg8ejkmcpqxot1uwisza345h769',\n bitsPerChar: 5\n});\n//# sourceMappingURL=base32.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/base32.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/base36.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/base36.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base36: () => (/* binding */ base36),\n/* harmony export */ base36upper: () => (/* binding */ base36upper)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/dist/src/bases/base.js\");\n\nconst base36 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: 'k',\n name: 'base36',\n alphabet: '0123456789abcdefghijklmnopqrstuvwxyz'\n});\nconst base36upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: 'K',\n name: 'base36upper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n});\n//# sourceMappingURL=base36.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/base36.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/base58.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/base58.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base58btc: () => (/* binding */ base58btc),\n/* harmony export */ base58flickr: () => (/* binding */ base58flickr)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/dist/src/bases/base.js\");\n\nconst base58btc = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n name: 'base58btc',\n prefix: 'z',\n alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\n});\nconst base58flickr = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n name: 'base58flickr',\n prefix: 'Z',\n alphabet: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'\n});\n//# sourceMappingURL=base58.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/base58.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/base64.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/base64.js ***!
|
||
\************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base64: () => (/* binding */ base64),\n/* harmony export */ base64pad: () => (/* binding */ base64pad),\n/* harmony export */ base64url: () => (/* binding */ base64url),\n/* harmony export */ base64urlpad: () => (/* binding */ base64urlpad)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/dist/src/bases/base.js\");\n\nconst base64 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'm',\n name: 'base64',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\n bitsPerChar: 6\n});\nconst base64pad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'M',\n name: 'base64pad',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',\n bitsPerChar: 6\n});\nconst base64url = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'u',\n name: 'base64url',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',\n bitsPerChar: 6\n});\nconst base64urlpad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'U',\n name: 'base64urlpad',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=',\n bitsPerChar: 6\n});\n//# sourceMappingURL=base64.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/base64.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/base8.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/base8.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base8: () => (/* binding */ base8)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/dist/src/bases/base.js\");\n\nconst base8 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: '7',\n name: 'base8',\n alphabet: '01234567',\n bitsPerChar: 3\n});\n//# sourceMappingURL=base8.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/base8.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/identity.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/identity.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ identity: () => (/* binding */ identity)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/dist/src/bytes.js\");\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/dist/src/bases/base.js\");\n\n\nconst identity = (0,_base_js__WEBPACK_IMPORTED_MODULE_1__.from)({\n prefix: '\\x00',\n name: 'identity',\n encode: (buf) => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.toString)(buf),\n decode: (str) => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.fromString)(str)\n});\n//# sourceMappingURL=identity.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/identity.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bases/interface.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bases/interface.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n// Base encoders / decoders just base encode / decode between binary and\n// textual representation. They are unaware of multibase.\n\n//# sourceMappingURL=interface.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bases/interface.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/basics.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/basics.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.CID),\n/* harmony export */ bases: () => (/* binding */ bases),\n/* harmony export */ bytes: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.bytes),\n/* harmony export */ codecs: () => (/* binding */ codecs),\n/* harmony export */ digest: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.digest),\n/* harmony export */ hasher: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.hasher),\n/* harmony export */ hashes: () => (/* binding */ hashes),\n/* harmony export */ varint: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.varint)\n/* harmony export */ });\n/* harmony import */ var _bases_base10_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bases/base10.js */ \"./node_modules/multiformats/dist/src/bases/base10.js\");\n/* harmony import */ var _bases_base16_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bases/base16.js */ \"./node_modules/multiformats/dist/src/bases/base16.js\");\n/* harmony import */ var _bases_base2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bases/base2.js */ \"./node_modules/multiformats/dist/src/bases/base2.js\");\n/* harmony import */ var _bases_base256emoji_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bases/base256emoji.js */ \"./node_modules/multiformats/dist/src/bases/base256emoji.js\");\n/* harmony import */ var _bases_base32_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bases/base32.js */ \"./node_modules/multiformats/dist/src/bases/base32.js\");\n/* harmony import */ var _bases_base36_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./bases/base36.js */ \"./node_modules/multiformats/dist/src/bases/base36.js\");\n/* harmony import */ var _bases_base58_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./bases/base58.js */ \"./node_modules/multiformats/dist/src/bases/base58.js\");\n/* harmony import */ var _bases_base64_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./bases/base64.js */ \"./node_modules/multiformats/dist/src/bases/base64.js\");\n/* harmony import */ var _bases_base8_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./bases/base8.js */ \"./node_modules/multiformats/dist/src/bases/base8.js\");\n/* harmony import */ var _bases_identity_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./bases/identity.js */ \"./node_modules/multiformats/dist/src/bases/identity.js\");\n/* harmony import */ var _codecs_json_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./codecs/json.js */ \"./node_modules/multiformats/dist/src/codecs/json.js\");\n/* harmony import */ var _codecs_raw_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./codecs/raw.js */ \"./node_modules/multiformats/dist/src/codecs/raw.js\");\n/* harmony import */ var _hashes_identity_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./hashes/identity.js */ \"./node_modules/multiformats/dist/src/hashes/identity.js\");\n/* harmony import */ var _hashes_sha2_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./hashes/sha2.js */ \"./node_modules/multiformats/dist/src/hashes/sha2-browser.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./index.js */ \"./node_modules/multiformats/dist/src/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst bases = { ..._bases_identity_js__WEBPACK_IMPORTED_MODULE_9__, ..._bases_base2_js__WEBPACK_IMPORTED_MODULE_2__, ..._bases_base8_js__WEBPACK_IMPORTED_MODULE_8__, ..._bases_base10_js__WEBPACK_IMPORTED_MODULE_0__, ..._bases_base16_js__WEBPACK_IMPORTED_MODULE_1__, ..._bases_base32_js__WEBPACK_IMPORTED_MODULE_4__, ..._bases_base36_js__WEBPACK_IMPORTED_MODULE_5__, ..._bases_base58_js__WEBPACK_IMPORTED_MODULE_6__, ..._bases_base64_js__WEBPACK_IMPORTED_MODULE_7__, ..._bases_base256emoji_js__WEBPACK_IMPORTED_MODULE_3__ };\nconst hashes = { ..._hashes_sha2_js__WEBPACK_IMPORTED_MODULE_13__, ..._hashes_identity_js__WEBPACK_IMPORTED_MODULE_12__ };\nconst codecs = { raw: _codecs_raw_js__WEBPACK_IMPORTED_MODULE_11__, json: _codecs_json_js__WEBPACK_IMPORTED_MODULE_10__ };\n\n//# sourceMappingURL=basics.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/basics.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/block/interface.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/block/interface.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=interface.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/block/interface.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/bytes.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/bytes.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ coerce: () => (/* binding */ coerce),\n/* harmony export */ empty: () => (/* binding */ empty),\n/* harmony export */ equals: () => (/* binding */ equals),\n/* harmony export */ fromHex: () => (/* binding */ fromHex),\n/* harmony export */ fromString: () => (/* binding */ fromString),\n/* harmony export */ isBinary: () => (/* binding */ isBinary),\n/* harmony export */ toHex: () => (/* binding */ toHex),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\nconst empty = new Uint8Array(0);\nfunction toHex(d) {\n return d.reduce((hex, byte) => hex + byte.toString(16).padStart(2, '0'), '');\n}\nfunction fromHex(hex) {\n const hexes = hex.match(/../g);\n return hexes != null ? new Uint8Array(hexes.map(b => parseInt(b, 16))) : empty;\n}\nfunction equals(aa, bb) {\n if (aa === bb)\n return true;\n if (aa.byteLength !== bb.byteLength) {\n return false;\n }\n for (let ii = 0; ii < aa.byteLength; ii++) {\n if (aa[ii] !== bb[ii]) {\n return false;\n }\n }\n return true;\n}\nfunction coerce(o) {\n if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array')\n return o;\n if (o instanceof ArrayBuffer)\n return new Uint8Array(o);\n if (ArrayBuffer.isView(o)) {\n return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);\n }\n throw new Error('Unknown type, must be binary type');\n}\nfunction isBinary(o) {\n return o instanceof ArrayBuffer || ArrayBuffer.isView(o);\n}\nfunction fromString(str) {\n return new TextEncoder().encode(str);\n}\nfunction toString(b) {\n return new TextDecoder().decode(b);\n}\n//# sourceMappingURL=bytes.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/bytes.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/cid.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/cid.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* binding */ CID),\n/* harmony export */ format: () => (/* binding */ format),\n/* harmony export */ fromJSON: () => (/* binding */ fromJSON),\n/* harmony export */ toJSON: () => (/* binding */ toJSON)\n/* harmony export */ });\n/* harmony import */ var _bases_base32_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bases/base32.js */ \"./node_modules/multiformats/dist/src/bases/base32.js\");\n/* harmony import */ var _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bases/base58.js */ \"./node_modules/multiformats/dist/src/bases/base58.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bytes.js */ \"./node_modules/multiformats/dist/src/bytes.js\");\n/* harmony import */ var _hashes_digest_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hashes/digest.js */ \"./node_modules/multiformats/dist/src/hashes/digest.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./varint.js */ \"./node_modules/multiformats/dist/src/varint.js\");\n/* harmony import */ var _link_interface_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./link/interface.js */ \"./node_modules/multiformats/dist/src/link/interface.js\");\n\n\n\n\n\n// This way TS will also expose all the types from module\n\nfunction format(link, base) {\n const { bytes, version } = link;\n switch (version) {\n case 0:\n return toStringV0(bytes, baseCache(link), base ?? _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.encoder);\n default:\n return toStringV1(bytes, baseCache(link), (base ?? _bases_base32_js__WEBPACK_IMPORTED_MODULE_0__.base32.encoder));\n }\n}\nfunction toJSON(link) {\n return {\n '/': format(link)\n };\n}\nfunction fromJSON(json) {\n return CID.parse(json['/']);\n}\nconst cache = new WeakMap();\nfunction baseCache(cid) {\n const baseCache = cache.get(cid);\n if (baseCache == null) {\n const baseCache = new Map();\n cache.set(cid, baseCache);\n return baseCache;\n }\n return baseCache;\n}\nclass CID {\n code;\n version;\n multihash;\n bytes;\n '/';\n /**\n * @param version - Version of the CID\n * @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv\n * @param multihash - (Multi)hash of the of the content.\n */\n constructor(version, code, multihash, bytes) {\n this.code = code;\n this.version = version;\n this.multihash = multihash;\n this.bytes = bytes;\n // flag to serializers that this is a CID and\n // should be treated specially\n this['/'] = bytes;\n }\n /**\n * Signalling `cid.asCID === cid` has been replaced with `cid['/'] === cid.bytes`\n * please either use `CID.asCID(cid)` or switch to new signalling mechanism\n *\n * @deprecated\n */\n get asCID() {\n return this;\n }\n // ArrayBufferView\n get byteOffset() {\n return this.bytes.byteOffset;\n }\n // ArrayBufferView\n get byteLength() {\n return this.bytes.byteLength;\n }\n toV0() {\n switch (this.version) {\n case 0: {\n return this;\n }\n case 1: {\n const { code, multihash } = this;\n if (code !== DAG_PB_CODE) {\n throw new Error('Cannot convert a non dag-pb CID to CIDv0');\n }\n // sha2-256\n if (multihash.code !== SHA_256_CODE) {\n throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0');\n }\n return (CID.createV0(multihash));\n }\n default: {\n throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`);\n }\n }\n }\n toV1() {\n switch (this.version) {\n case 0: {\n const { code, digest } = this.multihash;\n const multihash = _hashes_digest_js__WEBPACK_IMPORTED_MODULE_3__.create(code, digest);\n return (CID.createV1(this.code, multihash));\n }\n case 1: {\n return this;\n }\n default: {\n throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`);\n }\n }\n }\n equals(other) {\n return CID.equals(this, other);\n }\n static equals(self, other) {\n const unknown = other;\n return (unknown != null &&\n self.code === unknown.code &&\n self.version === unknown.version &&\n _hashes_digest_js__WEBPACK_IMPORTED_MODULE_3__.equals(self.multihash, unknown.multihash));\n }\n toString(base) {\n return format(this, base);\n }\n toJSON() {\n return { '/': format(this) };\n }\n link() {\n return this;\n }\n [Symbol.toStringTag] = 'CID';\n // Legacy\n [Symbol.for('nodejs.util.inspect.custom')]() {\n return `CID(${this.toString()})`;\n }\n /**\n * Takes any input `value` and returns a `CID` instance if it was\n * a `CID` otherwise returns `null`. If `value` is instanceof `CID`\n * it will return value back. If `value` is not instance of this CID\n * class, but is compatible CID it will return new instance of this\n * `CID` class. Otherwise returns null.\n *\n * This allows two different incompatible versions of CID library to\n * co-exist and interop as long as binary interface is compatible.\n */\n static asCID(input) {\n if (input == null) {\n return null;\n }\n const value = input;\n if (value instanceof CID) {\n // If value is instance of CID then we're all set.\n return value;\n }\n else if ((value['/'] != null && value['/'] === value.bytes) || value.asCID === value) {\n // If value isn't instance of this CID class but `this.asCID === this` or\n // `value['/'] === value.bytes` is true it is CID instance coming from a\n // different implementation (diff version or duplicate). In that case we\n // rebase it to this `CID` implementation so caller is guaranteed to get\n // instance with expected API.\n const { version, code, multihash, bytes } = value;\n return new CID(version, code, multihash, bytes ?? encodeCID(version, code, multihash.bytes));\n }\n else if (value[cidSymbol] === true) {\n // If value is a CID from older implementation that used to be tagged via\n // symbol we still rebase it to the this `CID` implementation by\n // delegating that to a constructor.\n const { version, multihash, code } = value;\n const digest = _hashes_digest_js__WEBPACK_IMPORTED_MODULE_3__.decode(multihash);\n return CID.create(version, code, digest);\n }\n else {\n // Otherwise value is not a CID (or an incompatible version of it) in\n // which case we return `null`.\n return null;\n }\n }\n /**\n * @param version - Version of the CID\n * @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv\n * @param digest - (Multi)hash of the of the content.\n */\n static create(version, code, digest) {\n if (typeof code !== 'number') {\n throw new Error('String codecs are no longer supported');\n }\n if (!(digest.bytes instanceof Uint8Array)) {\n throw new Error('Invalid digest');\n }\n switch (version) {\n case 0: {\n if (code !== DAG_PB_CODE) {\n throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);\n }\n else {\n return new CID(version, code, digest, digest.bytes);\n }\n }\n case 1: {\n const bytes = encodeCID(version, code, digest.bytes);\n return new CID(version, code, digest, bytes);\n }\n default: {\n throw new Error('Invalid version');\n }\n }\n }\n /**\n * Simplified version of `create` for CIDv0.\n */\n static createV0(digest) {\n return CID.create(0, DAG_PB_CODE, digest);\n }\n /**\n * Simplified version of `create` for CIDv1.\n *\n * @param code - Content encoding format code.\n * @param digest - Multihash of the content.\n */\n static createV1(code, digest) {\n return CID.create(1, code, digest);\n }\n /**\n * Decoded a CID from its binary representation. The byte array must contain\n * only the CID with no additional bytes.\n *\n * An error will be thrown if the bytes provided do not contain a valid\n * binary representation of a CID.\n */\n static decode(bytes) {\n const [cid, remainder] = CID.decodeFirst(bytes);\n if (remainder.length !== 0) {\n throw new Error('Incorrect length');\n }\n return cid;\n }\n /**\n * Decoded a CID from its binary representation at the beginning of a byte\n * array.\n *\n * Returns an array with the first element containing the CID and the second\n * element containing the remainder of the original byte array. The remainder\n * will be a zero-length byte array if the provided bytes only contained a\n * binary CID representation.\n */\n static decodeFirst(bytes) {\n const specs = CID.inspectBytes(bytes);\n const prefixSize = specs.size - specs.multihashSize;\n const multihashBytes = (0,_bytes_js__WEBPACK_IMPORTED_MODULE_2__.coerce)(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));\n if (multihashBytes.byteLength !== specs.multihashSize) {\n throw new Error('Incorrect length');\n }\n const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);\n const digest = new _hashes_digest_js__WEBPACK_IMPORTED_MODULE_3__.Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);\n const cid = specs.version === 0\n ? CID.createV0(digest)\n : CID.createV1(specs.codec, digest);\n return [cid, bytes.subarray(specs.size)];\n }\n /**\n * Inspect the initial bytes of a CID to determine its properties.\n *\n * Involves decoding up to 4 varints. Typically this will require only 4 to 6\n * bytes but for larger multicodec code values and larger multihash digest\n * lengths these varints can be quite large. It is recommended that at least\n * 10 bytes be made available in the `initialBytes` argument for a complete\n * inspection.\n */\n static inspectBytes(initialBytes) {\n let offset = 0;\n const next = () => {\n const [i, length] = _varint_js__WEBPACK_IMPORTED_MODULE_4__.decode(initialBytes.subarray(offset));\n offset += length;\n return i;\n };\n let version = next();\n let codec = DAG_PB_CODE;\n if (version === 18) {\n // CIDv0\n version = 0;\n offset = 0;\n }\n else {\n codec = next();\n }\n if (version !== 0 && version !== 1) {\n throw new RangeError(`Invalid CID version ${version}`);\n }\n const prefixSize = offset;\n const multihashCode = next(); // multihash code\n const digestSize = next(); // multihash length\n const size = offset + digestSize;\n const multihashSize = size - prefixSize;\n return { version, codec, multihashCode, digestSize, multihashSize, size };\n }\n /**\n * Takes cid in a string representation and creates an instance. If `base`\n * decoder is not provided will use a default from the configuration. It will\n * throw an error if encoding of the CID is not compatible with supplied (or\n * a default decoder).\n */\n static parse(source, base) {\n const [prefix, bytes] = parseCIDtoBytes(source, base);\n const cid = CID.decode(bytes);\n if (cid.version === 0 && source[0] !== 'Q') {\n throw Error('Version 0 CID string must not include multibase prefix');\n }\n // Cache string representation to avoid computing it on `this.toString()`\n baseCache(cid).set(prefix, source);\n return cid;\n }\n}\nfunction parseCIDtoBytes(source, base) {\n switch (source[0]) {\n // CIDv0 is parsed differently\n case 'Q': {\n const decoder = base ?? _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc;\n return [\n _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.prefix,\n decoder.decode(`${_bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.prefix}${source}`)\n ];\n }\n case _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.prefix: {\n const decoder = base ?? _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc;\n return [_bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.prefix, decoder.decode(source)];\n }\n case _bases_base32_js__WEBPACK_IMPORTED_MODULE_0__.base32.prefix: {\n const decoder = base ?? _bases_base32_js__WEBPACK_IMPORTED_MODULE_0__.base32;\n return [_bases_base32_js__WEBPACK_IMPORTED_MODULE_0__.base32.prefix, decoder.decode(source)];\n }\n default: {\n if (base == null) {\n throw Error('To parse non base32 or base58btc encoded CID multibase decoder must be provided');\n }\n return [source[0], base.decode(source)];\n }\n }\n}\nfunction toStringV0(bytes, cache, base) {\n const { prefix } = base;\n if (prefix !== _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.prefix) {\n throw Error(`Cannot string encode V0 in ${base.name} encoding`);\n }\n const cid = cache.get(prefix);\n if (cid == null) {\n const cid = base.encode(bytes).slice(1);\n cache.set(prefix, cid);\n return cid;\n }\n else {\n return cid;\n }\n}\nfunction toStringV1(bytes, cache, base) {\n const { prefix } = base;\n const cid = cache.get(prefix);\n if (cid == null) {\n const cid = base.encode(bytes);\n cache.set(prefix, cid);\n return cid;\n }\n else {\n return cid;\n }\n}\nconst DAG_PB_CODE = 0x70;\nconst SHA_256_CODE = 0x12;\nfunction encodeCID(version, code, multihash) {\n const codeOffset = _varint_js__WEBPACK_IMPORTED_MODULE_4__.encodingLength(version);\n const hashOffset = codeOffset + _varint_js__WEBPACK_IMPORTED_MODULE_4__.encodingLength(code);\n const bytes = new Uint8Array(hashOffset + multihash.byteLength);\n _varint_js__WEBPACK_IMPORTED_MODULE_4__.encodeTo(version, bytes, 0);\n _varint_js__WEBPACK_IMPORTED_MODULE_4__.encodeTo(code, bytes, codeOffset);\n bytes.set(multihash, hashOffset);\n return bytes;\n}\nconst cidSymbol = Symbol.for('@ipld/js-cid/CID');\n//# sourceMappingURL=cid.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/cid.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/codecs/interface.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/codecs/interface.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=interface.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/codecs/interface.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/codecs/json.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/codecs/json.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ code: () => (/* binding */ code),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\nconst textEncoder = new TextEncoder();\nconst textDecoder = new TextDecoder();\nconst name = 'json';\nconst code = 0x0200;\nfunction encode(node) {\n return textEncoder.encode(JSON.stringify(node));\n}\nfunction decode(data) {\n return JSON.parse(textDecoder.decode(data));\n}\n//# sourceMappingURL=json.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/codecs/json.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/codecs/raw.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/codecs/raw.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ code: () => (/* binding */ code),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/dist/src/bytes.js\");\n\nconst name = 'raw';\nconst code = 0x55;\nfunction encode(node) {\n return (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(node);\n}\nfunction decode(data) {\n return (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(data);\n}\n//# sourceMappingURL=raw.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/codecs/raw.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/hashes/digest.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/hashes/digest.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Digest: () => (/* binding */ Digest),\n/* harmony export */ create: () => (/* binding */ create),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/dist/src/bytes.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../varint.js */ \"./node_modules/multiformats/dist/src/varint.js\");\n\n\n/**\n * Creates a multihash digest.\n */\nfunction create(code, digest) {\n const size = digest.byteLength;\n const sizeOffset = _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodingLength(code);\n const digestOffset = sizeOffset + _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodingLength(size);\n const bytes = new Uint8Array(digestOffset + size);\n _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodeTo(code, bytes, 0);\n _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodeTo(size, bytes, sizeOffset);\n bytes.set(digest, digestOffset);\n return new Digest(code, size, digest, bytes);\n}\n/**\n * Turns bytes representation of multihash digest into an instance.\n */\nfunction decode(multihash) {\n const bytes = (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(multihash);\n const [code, sizeOffset] = _varint_js__WEBPACK_IMPORTED_MODULE_1__.decode(bytes);\n const [size, digestOffset] = _varint_js__WEBPACK_IMPORTED_MODULE_1__.decode(bytes.subarray(sizeOffset));\n const digest = bytes.subarray(sizeOffset + digestOffset);\n if (digest.byteLength !== size) {\n throw new Error('Incorrect length');\n }\n return new Digest(code, size, digest, bytes);\n}\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n else {\n const data = b;\n return (a.code === data.code &&\n a.size === data.size &&\n data.bytes instanceof Uint8Array &&\n (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.equals)(a.bytes, data.bytes));\n }\n}\n/**\n * Represents a multihash digest which carries information about the\n * hashing algorithm and an actual hash digest.\n */\nclass Digest {\n code;\n size;\n digest;\n bytes;\n /**\n * Creates a multihash digest.\n */\n constructor(code, size, digest, bytes) {\n this.code = code;\n this.size = size;\n this.digest = digest;\n this.bytes = bytes;\n }\n}\n//# sourceMappingURL=digest.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/hashes/digest.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/hashes/hasher.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/hashes/hasher.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Hasher: () => (/* binding */ Hasher),\n/* harmony export */ from: () => (/* binding */ from)\n/* harmony export */ });\n/* harmony import */ var _digest_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./digest.js */ \"./node_modules/multiformats/dist/src/hashes/digest.js\");\n\nfunction from({ name, code, encode }) {\n return new Hasher(name, code, encode);\n}\n/**\n * Hasher represents a hashing algorithm implementation that produces as\n * `MultihashDigest`.\n */\nclass Hasher {\n name;\n code;\n encode;\n constructor(name, code, encode) {\n this.name = name;\n this.code = code;\n this.encode = encode;\n }\n digest(input) {\n if (input instanceof Uint8Array) {\n const result = this.encode(input);\n return result instanceof Uint8Array\n ? _digest_js__WEBPACK_IMPORTED_MODULE_0__.create(this.code, result)\n /* c8 ignore next 1 */\n : result.then(digest => _digest_js__WEBPACK_IMPORTED_MODULE_0__.create(this.code, digest));\n }\n else {\n throw Error('Unknown type, must be binary type');\n /* c8 ignore next 1 */\n }\n }\n}\n//# sourceMappingURL=hasher.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/hashes/hasher.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/hashes/identity.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/hashes/identity.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ identity: () => (/* binding */ identity)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/dist/src/bytes.js\");\n/* harmony import */ var _digest_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./digest.js */ \"./node_modules/multiformats/dist/src/hashes/digest.js\");\n\n\nconst code = 0x0;\nconst name = 'identity';\nconst encode = _bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce;\nfunction digest(input) {\n return _digest_js__WEBPACK_IMPORTED_MODULE_1__.create(code, encode(input));\n}\nconst identity = { code, name, encode, digest };\n//# sourceMappingURL=identity.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/hashes/identity.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/hashes/interface.js":
|
||
/*!****************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/hashes/interface.js ***!
|
||
\****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n// # Multihash\n\n//# sourceMappingURL=interface.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/hashes/interface.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/hashes/sha2-browser.js":
|
||
/*!*******************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/hashes/sha2-browser.js ***!
|
||
\*******************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ sha256: () => (/* binding */ sha256),\n/* harmony export */ sha512: () => (/* binding */ sha512)\n/* harmony export */ });\n/* harmony import */ var _hasher_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hasher.js */ \"./node_modules/multiformats/dist/src/hashes/hasher.js\");\n/* global crypto */\n\nfunction sha(name) {\n return async (data) => new Uint8Array(await crypto.subtle.digest(name, data));\n}\nconst sha256 = (0,_hasher_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n name: 'sha2-256',\n code: 0x12,\n encode: sha('SHA-256')\n});\nconst sha512 = (0,_hasher_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n name: 'sha2-512',\n code: 0x13,\n encode: sha('SHA-512')\n});\n//# sourceMappingURL=sha2-browser.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/hashes/sha2-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/index.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/index.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* reexport safe */ _cid_js__WEBPACK_IMPORTED_MODULE_1__.CID),\n/* harmony export */ bytes: () => (/* reexport module object */ _bytes_js__WEBPACK_IMPORTED_MODULE_0__),\n/* harmony export */ digest: () => (/* reexport module object */ _hashes_digest_js__WEBPACK_IMPORTED_MODULE_2__),\n/* harmony export */ hasher: () => (/* reexport module object */ _hashes_hasher_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ varint: () => (/* reexport module object */ _varint_js__WEBPACK_IMPORTED_MODULE_4__)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bytes.js */ \"./node_modules/multiformats/dist/src/bytes.js\");\n/* harmony import */ var _cid_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cid.js */ \"./node_modules/multiformats/dist/src/cid.js\");\n/* harmony import */ var _hashes_digest_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hashes/digest.js */ \"./node_modules/multiformats/dist/src/hashes/digest.js\");\n/* harmony import */ var _hashes_hasher_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hashes/hasher.js */ \"./node_modules/multiformats/dist/src/hashes/hasher.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./varint.js */ \"./node_modules/multiformats/dist/src/varint.js\");\n/* harmony import */ var _interface_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./interface.js */ \"./node_modules/multiformats/dist/src/interface.js\");\n/**\n * @packageDocumentation\n *\n * This library defines common interfaces and low level building blocks for various interrelated multiformat technologies (multicodec, multihash, multibase, and CID). They can be used to implement custom base encoders / decoders / codecs, codec encoders /decoders and multihash hashers that comply to the interface that layers above assume.\n *\n * This library provides implementations for most basics and many others can be found in linked repositories.\n *\n * ```TypeScript\n * import { CID } from 'multiformats/cid'\n * import * as json from 'multiformats/codecs/json'\n * import { sha256 } from 'multiformats/hashes/sha2'\n *\n * const bytes = json.encode({ hello: 'world' })\n *\n * const hash = await sha256.digest(bytes)\n * const cid = CID.create(1, json.code, hash)\n * //> CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)\n * ```\n *\n * ## Creating Blocks\n *\n * ```TypeScript\n * import * as Block from 'multiformats/block'\n * import * as codec from '@ipld/dag-cbor'\n * import { sha256 as hasher } from 'multiformats/hashes/sha2'\n *\n * const value = { hello: 'world' }\n *\n * // encode a block\n * let block = await Block.encode({ value, codec, hasher })\n *\n * block.value // { hello: 'world' }\n * block.bytes // Uint8Array\n * block.cid // CID() w/ sha2-256 hash address and dag-cbor codec\n *\n * // you can also decode blocks from their binary state\n * block = await Block.decode({ bytes: block.bytes, codec, hasher })\n *\n * // if you have the cid you can also verify the hash on decode\n * block = await Block.create({ bytes: block.bytes, cid: block.cid, codec, hasher })\n * ```\n *\n * ## Multibase Encoders / Decoders / Codecs\n *\n * CIDs can be serialized to string representation using multibase encoders that implement [`MultibaseEncoder`](https://github.com/multiformats/js-multiformats/blob/master/src/bases/interface.ts) interface. This library provides quite a few implementations that can be imported:\n *\n * ```TypeScript\n * import { base64 } from \"multiformats/bases/base64\"\n * cid.toString(base64.encoder)\n * //> 'mAYAEEiCTojlxqRTl6svwqNJRVM2jCcPBxy+7mRTUfGDzy2gViA'\n * ```\n *\n * Parsing CID string serialized CIDs requires multibase decoder that implements [`MultibaseDecoder`](https://github.com/multiformats/js-multiformats/blob/master/src/bases/interface.ts) interface. This library provides a decoder for every encoder it provides:\n *\n * ```TypeScript\n * CID.parse('mAYAEEiCTojlxqRTl6svwqNJRVM2jCcPBxy+7mRTUfGDzy2gViA', base64.decoder)\n * //> CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)\n * ```\n *\n * Dual of multibase encoder & decoder is defined as multibase codec and it exposes\n * them as `encoder` and `decoder` properties. For added convenience codecs also\n * implement `MultibaseEncoder` and `MultibaseDecoder` interfaces so they could be\n * used as either or both:\n *\n * ```TypeScript\n * cid.toString(base64)\n * CID.parse(cid.toString(base64), base64)\n * ```\n *\n * **Note:** CID implementation comes bundled with `base32` and `base58btc`\n * multibase codecs so that CIDs can be base serialized to (version specific)\n * default base encoding and parsed without having to supply base encoders/decoders:\n *\n * ```TypeScript\n * const v1 = CID.parse('bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea')\n * v1.toString()\n * //> 'bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea'\n *\n * const v0 = CID.parse('QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n * v0.toString()\n * //> 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n'\n * v0.toV1().toString()\n * //> 'bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku'\n * ```\n *\n * ## Multicodec Encoders / Decoders / Codecs\n *\n * This library defines [`BlockEncoder`, `BlockDecoder` and `BlockCodec` interfaces](https://github.com/multiformats/js-multiformats/blob/master/src/codecs/interface.ts).\n * Codec implementations should conform to the `BlockCodec` interface which implements both `BlockEncoder` and `BlockDecoder`.\n * Here is an example implementation of JSON `BlockCodec`.\n *\n * ```TypeScript\n * export const { name, code, encode, decode } = {\n * name: 'json',\n * code: 0x0200,\n * encode: json => new TextEncoder().encode(JSON.stringify(json)),\n * decode: bytes => JSON.parse(new TextDecoder().decode(bytes))\n * }\n * ```\n *\n * ## Multihash Hashers\n *\n * This library defines [`MultihashHasher` and `MultihashDigest` interfaces](https://github.com/multiformats/js-multiformats/blob/master/src/hashes/interface.ts) and convinient function for implementing them:\n *\n * ```TypeScript\n * import * as hasher from 'multiformats/hashes/hasher'\n *\n * const sha256 = hasher.from({\n * // As per multiformats table\n * // https://github.com/multiformats/multicodec/blob/master/table.csv#L9\n * name: 'sha2-256',\n * code: 0x12,\n *\n * encode: (input) => new Uint8Array(crypto.createHash('sha256').update(input).digest())\n * })\n *\n * const hash = await sha256.digest(json.encode({ hello: 'world' }))\n * CID.create(1, json.code, hash)\n *\n * //> CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)\n * ```\n *\n * ## Traversal\n *\n * This library contains higher-order functions for traversing graphs of data easily.\n *\n * `walk()` walks through the links in each block of a DAG calling a user-supplied loader function for each one, in depth-first order with no duplicate block visits. The loader should return a `Block` object and can be used to inspect and collect block ordering for a full DAG walk. The loader should `throw` on error, and return `null` if a block should be skipped by `walk()`.\n *\n * ```TypeScript\n * import { walk } from 'multiformats/traversal'\n * import * as Block from 'multiformats/block'\n * import * as codec from 'multiformats/codecs/json'\n * import { sha256 as hasher } from 'multiformats/hashes/sha2'\n *\n * // build a DAG (a single block for this simple example)\n * const value = { hello: 'world' }\n * const block = await Block.encode({ value, codec, hasher })\n * const { cid } = block\n * console.log(cid)\n * //> CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)\n *\n * // create a loader function that also collects CIDs of blocks in\n * // their traversal order\n * const load = (cid, blocks) => async (cid) => {\n * // fetch a block using its cid\n * // e.g.: const block = await fetchBlockByCID(cid)\n * blocks.push(cid)\n * return block\n * }\n *\n * // collect blocks in this DAG starting from the root `cid`\n * const blocks = []\n * await walk({ cid, load: load(cid, blocks) })\n *\n * console.log(blocks)\n * //> [CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)]\n * ```\n *\n * ## Legacy interface\n *\n * [`blockcodec-to-ipld-format`](https://github.com/ipld/js-blockcodec-to-ipld-format) converts a multiformats [`BlockCodec`](https://github.com/multiformats/js-multiformats/blob/master/src/codecs/interface.ts#L21) into an\n * [`interface-ipld-format`](https://github.com/ipld/interface-ipld-format) for use with the [`ipld`](https://github.com/ipld/ipld) package. This can help bridge IPLD codecs implemented using the structure and interfaces defined here to existing code that assumes, or requires `interface-ipld-format`. This bridge also includes the relevant TypeScript definitions.\n *\n * ## Implementations\n *\n * By default, no base encodings (other than base32 & base58btc), hash functions,\n * or codec implementations are exposed by `multiformats`, you need to\n * import the ones you need yourself.\n *\n * ### Multibase codecs\n *\n * | bases | import | repo |\n * | ------------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------- |\n * | `base16` | `multiformats/bases/base16` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) |\n * | `base32`, `base32pad`, `base32hex`, `base32hexpad`, `base32z` | `multiformats/bases/base32` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) |\n * | `base64`, `base64pad`, `base64url`, `base64urlpad` | `multiformats/bases/base64` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) |\n * | `base58btc`, `base58flick4` | `multiformats/bases/base58` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) |\n *\n * Other (less useful) bases implemented in [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) include: `base2`, `base8`, `base10`, `base36` and `base256emoji`.\n *\n * ### Multihash hashers\n *\n * | hashes | import | repo |\n * | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ |\n * | `sha2-256`, `sha2-512` | `multiformats/hashes/sha2` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/src/hashes) |\n * | `sha3-224`, `sha3-256`, `sha3-384`,`sha3-512`, `shake-128`, `shake-256`, `keccak-224`, `keccak-256`, `keccak-384`, `keccak-512` | `@multiformats/sha3` | [multiformats/js-sha3](https://github.com/multiformats/js-sha3) |\n * | `identity` | `multiformats/hashes/identity` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/src/hashes/identity.js) |\n * | `murmur3-128`, `murmur3-32` | `@multiformats/murmur3` | [multiformats/js-murmur3](https://github.com/multiformats/js-murmur3) |\n * | `blake2b-*`, `blake2s-*` | `@multiformats/blake2` | [multiformats/js-blake2](https://github.com/multiformats/js-blake2) |\n *\n * ### IPLD codecs (multicodec)\n *\n * | codec | import | repo |\n * | ---------- | -------------------------- | ------------------------------------------------------------------------------------------------------ |\n * | `raw` | `multiformats/codecs/raw` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/src/codecs) |\n * | `json` | `multiformats/codecs/json` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/src/codecs) |\n * | `dag-cbor` | `@ipld/dag-cbor` | [ipld/js-dag-cbor](https://github.com/ipld/js-dag-cbor) |\n * | `dag-json` | `@ipld/dag-json` | [ipld/js-dag-json](https://github.com/ipld/js-dag-json) |\n * | `dag-pb` | `@ipld/dag-pb` | [ipld/js-dag-pb](https://github.com/ipld/js-dag-pb) |\n * | `dag-jose` | `dag-jose` | [ceramicnetwork/js-dag-jose](https://github.com/ceramicnetwork/js-dag-jose) |\n */\n\n\n\n\n\n// This way TS will also expose all the types from module\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/interface.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/interface.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bases_interface_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bases/interface.js */ \"./node_modules/multiformats/dist/src/bases/interface.js\");\n/* harmony import */ var _hashes_interface_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hashes/interface.js */ \"./node_modules/multiformats/dist/src/hashes/interface.js\");\n/* harmony import */ var _codecs_interface_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./codecs/interface.js */ \"./node_modules/multiformats/dist/src/codecs/interface.js\");\n/* harmony import */ var _link_interface_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./link/interface.js */ \"./node_modules/multiformats/dist/src/link/interface.js\");\n/* harmony import */ var _block_interface_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block/interface.js */ \"./node_modules/multiformats/dist/src/block/interface.js\");\n\n\n\n\n\n//# sourceMappingURL=interface.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/interface.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/link/interface.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/link/interface.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */\n/* eslint-disable no-use-before-define */\n\n//# sourceMappingURL=interface.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/link/interface.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/varint.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/varint.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encodeTo: () => (/* binding */ encodeTo),\n/* harmony export */ encodingLength: () => (/* binding */ encodingLength)\n/* harmony export */ });\n/* harmony import */ var _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vendor/varint.js */ \"./node_modules/multiformats/dist/src/vendor/varint.js\");\n\nfunction decode(data, offset = 0) {\n const code = _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].decode(data, offset);\n return [code, _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].decode.bytes];\n}\nfunction encodeTo(int, target, offset = 0) {\n _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].encode(int, target, offset);\n return target;\n}\nfunction encodingLength(int) {\n return _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].encodingLength(int);\n}\n//# sourceMappingURL=varint.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/varint.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/vendor/base-x.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/vendor/base-x.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* eslint-disable */\n// base-x encoding / decoding\n// Copyright (c) 2018 base-x contributors\n// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)\n// Distributed under the MIT software license, see the accompanying\n// file LICENSE or http://www.opensource.org/licenses/mit-license.php.\n/**\n * @param {string} ALPHABET\n * @param {any} name\n */\nfunction base(ALPHABET, name) {\n if (ALPHABET.length >= 255) {\n throw new TypeError('Alphabet too long');\n }\n var BASE_MAP = new Uint8Array(256);\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255;\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i);\n var xc = x.charCodeAt(0);\n if (BASE_MAP[xc] !== 255) {\n throw new TypeError(x + ' is ambiguous');\n }\n BASE_MAP[xc] = i;\n }\n var BASE = ALPHABET.length;\n var LEADER = ALPHABET.charAt(0);\n var FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up\n var iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up\n /**\n * @param {any[] | Iterable<number>} source\n */\n function encode(source) {\n // @ts-ignore\n if (source instanceof Uint8Array)\n ;\n else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);\n }\n else if (Array.isArray(source)) {\n source = Uint8Array.from(source);\n }\n if (!(source instanceof Uint8Array)) {\n throw new TypeError('Expected Uint8Array');\n }\n if (source.length === 0) {\n return '';\n }\n // Skip & count leading zeroes.\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n // Allocate enough space in big-endian base58 representation.\n var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;\n var b58 = new Uint8Array(size);\n // Process the bytes.\n while (pbegin !== pend) {\n var carry = source[pbegin];\n // Apply \"b58 = b58 * 256 + ch\".\n var i = 0;\n for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {\n carry += (256 * b58[it1]) >>> 0;\n b58[it1] = (carry % BASE) >>> 0;\n carry = (carry / BASE) >>> 0;\n }\n if (carry !== 0) {\n throw new Error('Non-zero carry');\n }\n length = i;\n pbegin++;\n }\n // Skip leading zeroes in base58 result.\n var it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n // Translate the result into a string.\n var str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) {\n str += ALPHABET.charAt(b58[it2]);\n }\n return str;\n }\n /**\n * @param {string | string[]} source\n */\n function decodeUnsafe(source) {\n if (typeof source !== 'string') {\n throw new TypeError('Expected String');\n }\n if (source.length === 0) {\n return new Uint8Array();\n }\n var psz = 0;\n // Skip leading spaces.\n if (source[psz] === ' ') {\n return;\n }\n // Skip and count leading '1's.\n var zeroes = 0;\n var length = 0;\n while (source[psz] === LEADER) {\n zeroes++;\n psz++;\n }\n // Allocate enough space in big-endian base256 representation.\n var size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.\n var b256 = new Uint8Array(size);\n // Process the characters.\n while (source[psz]) {\n // Decode character\n var carry = BASE_MAP[source.charCodeAt(psz)];\n // Invalid character\n if (carry === 255) {\n return;\n }\n var i = 0;\n for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {\n carry += (BASE * b256[it3]) >>> 0;\n b256[it3] = (carry % 256) >>> 0;\n carry = (carry / 256) >>> 0;\n }\n if (carry !== 0) {\n throw new Error('Non-zero carry');\n }\n length = i;\n psz++;\n }\n // Skip trailing spaces.\n if (source[psz] === ' ') {\n return;\n }\n // Skip leading zeroes in b256.\n var it4 = size - length;\n while (it4 !== size && b256[it4] === 0) {\n it4++;\n }\n var vch = new Uint8Array(zeroes + (size - it4));\n var j = zeroes;\n while (it4 !== size) {\n vch[j++] = b256[it4++];\n }\n return vch;\n }\n /**\n * @param {string | string[]} string\n */\n function decode(string) {\n var buffer = decodeUnsafe(string);\n if (buffer) {\n return buffer;\n }\n throw new Error(`Non-${name} character`);\n }\n return {\n encode: encode,\n decodeUnsafe: decodeUnsafe,\n decode: decode\n };\n}\nvar src = base;\nvar _brrp__multiformats_scope_baseX = src;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_brrp__multiformats_scope_baseX);\n//# sourceMappingURL=base-x.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/vendor/base-x.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/multiformats/dist/src/vendor/varint.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/multiformats/dist/src/vendor/varint.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* eslint-disable */\nvar encode_1 = encode;\nvar MSB = 0x80, REST = 0x7F, MSBALL = ~REST, INT = Math.pow(2, 31);\n/**\n * @param {number} num\n * @param {number[]} out\n * @param {number} offset\n */\nfunction encode(num, out, offset) {\n out = out || [];\n offset = offset || 0;\n var oldOffset = offset;\n while (num >= INT) {\n out[offset++] = (num & 0xFF) | MSB;\n num /= 128;\n }\n while (num & MSBALL) {\n out[offset++] = (num & 0xFF) | MSB;\n num >>>= 7;\n }\n out[offset] = num | 0;\n // @ts-ignore\n encode.bytes = offset - oldOffset + 1;\n return out;\n}\nvar decode = read;\nvar MSB$1 = 0x80, REST$1 = 0x7F;\n/**\n * @param {string | any[]} buf\n * @param {number} offset\n */\nfunction read(buf, offset) {\n var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;\n do {\n if (counter >= l) {\n // @ts-ignore\n read.bytes = 0;\n throw new RangeError('Could not decode varint');\n }\n b = buf[counter++];\n res += shift < 28\n ? (b & REST$1) << shift\n : (b & REST$1) * Math.pow(2, shift);\n shift += 7;\n } while (b >= MSB$1);\n // @ts-ignore\n read.bytes = counter - offset;\n return res;\n}\nvar N1 = Math.pow(2, 7);\nvar N2 = Math.pow(2, 14);\nvar N3 = Math.pow(2, 21);\nvar N4 = Math.pow(2, 28);\nvar N5 = Math.pow(2, 35);\nvar N6 = Math.pow(2, 42);\nvar N7 = Math.pow(2, 49);\nvar N8 = Math.pow(2, 56);\nvar N9 = Math.pow(2, 63);\nvar length = function (/** @type {number} */ value) {\n return (value < N1 ? 1\n : value < N2 ? 2\n : value < N3 ? 3\n : value < N4 ? 4\n : value < N5 ? 5\n : value < N6 ? 6\n : value < N7 ? 7\n : value < N8 ? 8\n : value < N9 ? 9\n : 10);\n};\nvar varint = {\n encode: encode_1,\n decode: decode,\n encodingLength: length\n};\nvar _brrp_varint = varint;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_brrp_varint);\n//# sourceMappingURL=varint.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/multiformats/dist/src/vendor/varint.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/observable-webworkers/dist/src/index.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/observable-webworkers/dist/src/index.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nconst events = {};\nconst observable = (worker) => {\n worker.addEventListener('message', (event) => {\n observable.dispatchEvent('message', worker, event);\n });\n if (worker.port != null) {\n worker.port.addEventListener('message', (event) => {\n observable.dispatchEvent('message', worker, event);\n });\n }\n};\nobservable.addEventListener = (type, fn) => {\n if (events[type] == null) {\n events[type] = [];\n }\n events[type].push(fn);\n};\nobservable.removeEventListener = (type, fn) => {\n if (events[type] == null) {\n return;\n }\n events[type] = events[type]\n .filter(listener => listener === fn);\n};\nobservable.dispatchEvent = function (type, worker, event) {\n if (events[type] == null) {\n return;\n }\n events[type].forEach(fn => fn(worker, event));\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (observable);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/observable-webworkers/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/p-defer/index.js":
|
||
/*!***************************************!*\
|
||
!*** ./node_modules/p-defer/index.js ***!
|
||
\***************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ pDefer)\n/* harmony export */ });\nfunction pDefer() {\n\tconst deferred = {};\n\n\tdeferred.promise = new Promise((resolve, reject) => {\n\t\tdeferred.resolve = resolve;\n\t\tdeferred.reject = reject;\n\t});\n\n\treturn deferred;\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/p-defer/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/p-event/index.js":
|
||
/*!***************************************!*\
|
||
!*** ./node_modules/p-event/index.js ***!
|
||
\***************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TimeoutError: () => (/* reexport safe */ p_timeout__WEBPACK_IMPORTED_MODULE_0__.TimeoutError),\n/* harmony export */ pEvent: () => (/* binding */ pEvent),\n/* harmony export */ pEventIterator: () => (/* binding */ pEventIterator),\n/* harmony export */ pEventMultiple: () => (/* binding */ pEventMultiple)\n/* harmony export */ });\n/* harmony import */ var p_timeout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-timeout */ \"./node_modules/p-event/node_modules/p-timeout/index.js\");\n\n\nconst normalizeEmitter = emitter => {\n\tconst addListener = emitter.on || emitter.addListener || emitter.addEventListener;\n\tconst removeListener = emitter.off || emitter.removeListener || emitter.removeEventListener;\n\n\tif (!addListener || !removeListener) {\n\t\tthrow new TypeError('Emitter is not compatible');\n\t}\n\n\treturn {\n\t\taddListener: addListener.bind(emitter),\n\t\tremoveListener: removeListener.bind(emitter),\n\t};\n};\n\nfunction pEventMultiple(emitter, event, options) {\n\tlet cancel;\n\tconst returnValue = new Promise((resolve, reject) => {\n\t\toptions = {\n\t\t\trejectionEvents: ['error'],\n\t\t\tmultiArgs: false,\n\t\t\tresolveImmediately: false,\n\t\t\t...options,\n\t\t};\n\n\t\tif (!(options.count >= 0 && (options.count === Number.POSITIVE_INFINITY || Number.isInteger(options.count)))) {\n\t\t\tthrow new TypeError('The `count` option should be at least 0 or more');\n\t\t}\n\n\t\t// Allow multiple events\n\t\tconst events = [event].flat();\n\n\t\tconst items = [];\n\t\tconst {addListener, removeListener} = normalizeEmitter(emitter);\n\n\t\tconst onItem = (...arguments_) => {\n\t\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\t\t// eslint-disable-next-line unicorn/no-array-callback-reference\n\t\t\tif (options.filter && !options.filter(value)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\titems.push(value);\n\n\t\t\tif (options.count === items.length) {\n\t\t\t\tcancel();\n\t\t\t\tresolve(items);\n\t\t\t}\n\t\t};\n\n\t\tconst rejectHandler = error => {\n\t\t\tcancel();\n\t\t\treject(error);\n\t\t};\n\n\t\tcancel = () => {\n\t\t\tfor (const event of events) {\n\t\t\t\tremoveListener(event, onItem);\n\t\t\t}\n\n\t\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\t\tremoveListener(rejectionEvent, rejectHandler);\n\t\t\t}\n\t\t};\n\n\t\tfor (const event of events) {\n\t\t\taddListener(event, onItem);\n\t\t}\n\n\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\taddListener(rejectionEvent, rejectHandler);\n\t\t}\n\n\t\tif (options.resolveImmediately) {\n\t\t\tresolve(items);\n\t\t}\n\t});\n\n\treturnValue.cancel = cancel;\n\n\tif (typeof options.timeout === 'number') {\n\t\tconst timeout = (0,p_timeout__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(returnValue, options.timeout);\n\t\ttimeout.cancel = cancel;\n\t\treturn timeout;\n\t}\n\n\treturn returnValue;\n}\n\nfunction pEvent(emitter, event, options) {\n\tif (typeof options === 'function') {\n\t\toptions = {filter: options};\n\t}\n\n\toptions = {\n\t\t...options,\n\t\tcount: 1,\n\t\tresolveImmediately: false,\n\t};\n\n\tconst arrayPromise = pEventMultiple(emitter, event, options);\n\tconst promise = arrayPromise.then(array => array[0]); // eslint-disable-line promise/prefer-await-to-then\n\tpromise.cancel = arrayPromise.cancel;\n\n\treturn promise;\n}\n\nfunction pEventIterator(emitter, event, options) {\n\tif (typeof options === 'function') {\n\t\toptions = {filter: options};\n\t}\n\n\t// Allow multiple events\n\tconst events = [event].flat();\n\n\toptions = {\n\t\trejectionEvents: ['error'],\n\t\tresolutionEvents: [],\n\t\tlimit: Number.POSITIVE_INFINITY,\n\t\tmultiArgs: false,\n\t\t...options,\n\t};\n\n\tconst {limit} = options;\n\tconst isValidLimit = limit >= 0 && (limit === Number.POSITIVE_INFINITY || Number.isInteger(limit));\n\tif (!isValidLimit) {\n\t\tthrow new TypeError('The `limit` option should be a non-negative integer or Infinity');\n\t}\n\n\tif (limit === 0) {\n\t\t// Return an empty async iterator to avoid any further cost\n\t\treturn {\n\t\t\t[Symbol.asyncIterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tasync next() {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t\tvalue: undefined,\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}\n\n\tconst {addListener, removeListener} = normalizeEmitter(emitter);\n\n\tlet isDone = false;\n\tlet error;\n\tlet hasPendingError = false;\n\tconst nextQueue = [];\n\tconst valueQueue = [];\n\tlet eventCount = 0;\n\tlet isLimitReached = false;\n\n\tconst valueHandler = (...arguments_) => {\n\t\teventCount++;\n\t\tisLimitReached = eventCount === limit;\n\n\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\n\t\t\tresolve({done: false, value});\n\n\t\t\tif (isLimitReached) {\n\t\t\t\tcancel();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tvalueQueue.push(value);\n\n\t\tif (isLimitReached) {\n\t\t\tcancel();\n\t\t}\n\t};\n\n\tconst cancel = () => {\n\t\tisDone = true;\n\n\t\tfor (const event of events) {\n\t\t\tremoveListener(event, valueHandler);\n\t\t}\n\n\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\tremoveListener(rejectionEvent, rejectHandler);\n\t\t}\n\n\t\tfor (const resolutionEvent of options.resolutionEvents) {\n\t\t\tremoveListener(resolutionEvent, resolveHandler);\n\t\t}\n\n\t\twhile (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\t\t\tresolve({done: true, value: undefined});\n\t\t}\n\t};\n\n\tconst rejectHandler = (...arguments_) => {\n\t\terror = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {reject} = nextQueue.shift();\n\t\t\treject(error);\n\t\t} else {\n\t\t\thasPendingError = true;\n\t\t}\n\n\t\tcancel();\n\t};\n\n\tconst resolveHandler = (...arguments_) => {\n\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\t// eslint-disable-next-line unicorn/no-array-callback-reference\n\t\tif (options.filter && !options.filter(value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\t\t\tresolve({done: true, value});\n\t\t} else {\n\t\t\tvalueQueue.push(value);\n\t\t}\n\n\t\tcancel();\n\t};\n\n\tfor (const event of events) {\n\t\taddListener(event, valueHandler);\n\t}\n\n\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\taddListener(rejectionEvent, rejectHandler);\n\t}\n\n\tfor (const resolutionEvent of options.resolutionEvents) {\n\t\taddListener(resolutionEvent, resolveHandler);\n\t}\n\n\treturn {\n\t\t[Symbol.asyncIterator]() {\n\t\t\treturn this;\n\t\t},\n\t\tasync next() {\n\t\t\tif (valueQueue.length > 0) {\n\t\t\t\tconst value = valueQueue.shift();\n\t\t\t\treturn {\n\t\t\t\t\tdone: isDone && valueQueue.length === 0 && !isLimitReached,\n\t\t\t\t\tvalue,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (hasPendingError) {\n\t\t\t\thasPendingError = false;\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tif (isDone) {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t\tvalue: undefined,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tnextQueue.push({resolve, reject});\n\t\t\t});\n\t\t},\n\t\tasync return(value) {\n\t\t\tcancel();\n\t\t\treturn {\n\t\t\t\tdone: isDone,\n\t\t\t\tvalue,\n\t\t\t};\n\t\t},\n\t};\n}\n\n\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/p-event/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/p-event/node_modules/p-timeout/index.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/p-event/node_modules/p-timeout/index.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ TimeoutError: () => (/* binding */ TimeoutError),\n/* harmony export */ \"default\": () => (/* binding */ pTimeout)\n/* harmony export */ });\nclass TimeoutError extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\n/**\nAn error to be thrown when the request is aborted by AbortController.\nDOMException is thrown instead of this Error when DOMException is available.\n*/\nclass AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\n/**\nTODO: Remove AbortError and just throw DOMException when targeting Node 18.\n*/\nconst getDOMException = errorMessage => globalThis.DOMException === undefined ?\n\tnew AbortError(errorMessage) :\n\tnew DOMException(errorMessage);\n\n/**\nTODO: Remove below function and just 'reject(signal.reason)' when targeting Node 18.\n*/\nconst getAbortedReason = signal => {\n\tconst reason = signal.reason === undefined ?\n\t\tgetDOMException('This operation was aborted.') :\n\t\tsignal.reason;\n\n\treturn reason instanceof Error ? reason : getDOMException(reason);\n};\n\nfunction pTimeout(promise, milliseconds, fallback, options) {\n\tlet timer;\n\n\tconst cancelablePromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\tresolve(promise);\n\t\t\treturn;\n\t\t}\n\n\t\toptions = {\n\t\t\tcustomTimers: {setTimeout, clearTimeout},\n\t\t\t...options\n\t\t};\n\n\t\tif (options.signal) {\n\t\t\tconst {signal} = options;\n\t\t\tif (signal.aborted) {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t}\n\n\t\t\tsignal.addEventListener('abort', () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t});\n\t\t}\n\n\t\ttimer = options.customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (typeof fallback === 'function') {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst message = typeof fallback === 'string' ? fallback : `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\tconst timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message);\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\treject(timeoutError);\n\t\t}, milliseconds);\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tresolve(await promise);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t} finally {\n\t\t\t\toptions.customTimers.clearTimeout.call(undefined, timer);\n\t\t\t}\n\t\t})();\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\tclearTimeout(timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/p-event/node_modules/p-timeout/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/p-queue/dist/index.js":
|
||
/*!********************************************!*\
|
||
!*** ./node_modules/p-queue/dist/index.js ***!
|
||
\********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ PQueue)\n/* harmony export */ });\n/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.mjs\");\n/* harmony import */ var p_timeout__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! p-timeout */ \"./node_modules/p-timeout/index.js\");\n/* harmony import */ var _priority_queue_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./priority-queue.js */ \"./node_modules/p-queue/dist/priority-queue.js\");\n\n\n\n/**\nPromise queue with concurrency control.\n*/\nclass PQueue extends eventemitter3__WEBPACK_IMPORTED_MODULE_0__.EventEmitter {\n #carryoverConcurrencyCount;\n #isIntervalIgnored;\n #intervalCount = 0;\n #intervalCap;\n #interval;\n #intervalEnd = 0;\n #intervalId;\n #timeoutId;\n #queue;\n #queueClass;\n #pending = 0;\n // The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194\n #concurrency;\n #isPaused;\n #throwOnTimeout;\n /**\n Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.\n\n Applies to each future operation.\n */\n timeout;\n // TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`\n constructor(options) {\n super();\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n options = {\n carryoverConcurrencyCount: false,\n intervalCap: Number.POSITIVE_INFINITY,\n interval: 0,\n concurrency: Number.POSITIVE_INFINITY,\n autoStart: true,\n queueClass: _priority_queue_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"],\n ...options,\n };\n if (!(typeof options.intervalCap === 'number' && options.intervalCap >= 1)) {\n throw new TypeError(`Expected \\`intervalCap\\` to be a number from 1 and up, got \\`${options.intervalCap?.toString() ?? ''}\\` (${typeof options.intervalCap})`);\n }\n if (options.interval === undefined || !(Number.isFinite(options.interval) && options.interval >= 0)) {\n throw new TypeError(`Expected \\`interval\\` to be a finite number >= 0, got \\`${options.interval?.toString() ?? ''}\\` (${typeof options.interval})`);\n }\n this.#carryoverConcurrencyCount = options.carryoverConcurrencyCount;\n this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;\n this.#intervalCap = options.intervalCap;\n this.#interval = options.interval;\n this.#queue = new options.queueClass();\n this.#queueClass = options.queueClass;\n this.concurrency = options.concurrency;\n this.timeout = options.timeout;\n this.#throwOnTimeout = options.throwOnTimeout === true;\n this.#isPaused = options.autoStart === false;\n }\n get #doesIntervalAllowAnother() {\n return this.#isIntervalIgnored || this.#intervalCount < this.#intervalCap;\n }\n get #doesConcurrentAllowAnother() {\n return this.#pending < this.#concurrency;\n }\n #next() {\n this.#pending--;\n this.#tryToStartAnother();\n this.emit('next');\n }\n #onResumeInterval() {\n this.#onInterval();\n this.#initializeIntervalIfNeeded();\n this.#timeoutId = undefined;\n }\n get #isIntervalPaused() {\n const now = Date.now();\n if (this.#intervalId === undefined) {\n const delay = this.#intervalEnd - now;\n if (delay < 0) {\n // Act as the interval was done\n // We don't need to resume it here because it will be resumed on line 160\n this.#intervalCount = (this.#carryoverConcurrencyCount) ? this.#pending : 0;\n }\n else {\n // Act as the interval is pending\n if (this.#timeoutId === undefined) {\n this.#timeoutId = setTimeout(() => {\n this.#onResumeInterval();\n }, delay);\n }\n return true;\n }\n }\n return false;\n }\n #tryToStartAnother() {\n if (this.#queue.size === 0) {\n // We can clear the interval (\"pause\")\n // Because we can redo it later (\"resume\")\n if (this.#intervalId) {\n clearInterval(this.#intervalId);\n }\n this.#intervalId = undefined;\n this.emit('empty');\n if (this.#pending === 0) {\n this.emit('idle');\n }\n return false;\n }\n if (!this.#isPaused) {\n const canInitializeInterval = !this.#isIntervalPaused;\n if (this.#doesIntervalAllowAnother && this.#doesConcurrentAllowAnother) {\n const job = this.#queue.dequeue();\n if (!job) {\n return false;\n }\n this.emit('active');\n job();\n if (canInitializeInterval) {\n this.#initializeIntervalIfNeeded();\n }\n return true;\n }\n }\n return false;\n }\n #initializeIntervalIfNeeded() {\n if (this.#isIntervalIgnored || this.#intervalId !== undefined) {\n return;\n }\n this.#intervalId = setInterval(() => {\n this.#onInterval();\n }, this.#interval);\n this.#intervalEnd = Date.now() + this.#interval;\n }\n #onInterval() {\n if (this.#intervalCount === 0 && this.#pending === 0 && this.#intervalId) {\n clearInterval(this.#intervalId);\n this.#intervalId = undefined;\n }\n this.#intervalCount = this.#carryoverConcurrencyCount ? this.#pending : 0;\n this.#processQueue();\n }\n /**\n Executes all queued functions until it reaches the limit.\n */\n #processQueue() {\n // eslint-disable-next-line no-empty\n while (this.#tryToStartAnother()) { }\n }\n get concurrency() {\n return this.#concurrency;\n }\n set concurrency(newConcurrency) {\n if (!(typeof newConcurrency === 'number' && newConcurrency >= 1)) {\n throw new TypeError(`Expected \\`concurrency\\` to be a number from 1 and up, got \\`${newConcurrency}\\` (${typeof newConcurrency})`);\n }\n this.#concurrency = newConcurrency;\n this.#processQueue();\n }\n async #throwOnAbort(signal) {\n return new Promise((_resolve, reject) => {\n signal.addEventListener('abort', () => {\n reject(signal.reason);\n }, { once: true });\n });\n }\n async add(function_, options = {}) {\n options = {\n timeout: this.timeout,\n throwOnTimeout: this.#throwOnTimeout,\n ...options,\n };\n return new Promise((resolve, reject) => {\n this.#queue.enqueue(async () => {\n this.#pending++;\n this.#intervalCount++;\n try {\n options.signal?.throwIfAborted();\n let operation = function_({ signal: options.signal });\n if (options.timeout) {\n operation = (0,p_timeout__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(Promise.resolve(operation), { milliseconds: options.timeout });\n }\n if (options.signal) {\n operation = Promise.race([operation, this.#throwOnAbort(options.signal)]);\n }\n const result = await operation;\n resolve(result);\n this.emit('completed', result);\n }\n catch (error) {\n if (error instanceof p_timeout__WEBPACK_IMPORTED_MODULE_1__.TimeoutError && !options.throwOnTimeout) {\n resolve();\n return;\n }\n reject(error);\n this.emit('error', error);\n }\n finally {\n this.#next();\n }\n }, options);\n this.emit('add');\n this.#tryToStartAnother();\n });\n }\n async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }\n /**\n Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)\n */\n start() {\n if (!this.#isPaused) {\n return this;\n }\n this.#isPaused = false;\n this.#processQueue();\n return this;\n }\n /**\n Put queue execution on hold.\n */\n pause() {\n this.#isPaused = true;\n }\n /**\n Clear the queue.\n */\n clear() {\n this.#queue = new this.#queueClass();\n }\n /**\n Can be called multiple times. Useful if you for example add additional items at a later time.\n\n @returns A promise that settles when the queue becomes empty.\n */\n async onEmpty() {\n // Instantly resolve if the queue is empty\n if (this.#queue.size === 0) {\n return;\n }\n await this.#onEvent('empty');\n }\n /**\n @returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.\n\n If you want to avoid having the queue grow beyond a certain size you can `await queue.onSizeLessThan()` before adding a new item.\n\n Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.\n */\n async onSizeLessThan(limit) {\n // Instantly resolve if the queue is empty.\n if (this.#queue.size < limit) {\n return;\n }\n await this.#onEvent('next', () => this.#queue.size < limit);\n }\n /**\n The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.\n\n @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.\n */\n async onIdle() {\n // Instantly resolve if none pending and if nothing else is queued\n if (this.#pending === 0 && this.#queue.size === 0) {\n return;\n }\n await this.#onEvent('idle');\n }\n async #onEvent(event, filter) {\n return new Promise(resolve => {\n const listener = () => {\n if (filter && !filter()) {\n return;\n }\n this.off(event, listener);\n resolve();\n };\n this.on(event, listener);\n });\n }\n /**\n Size of the queue, the number of queued items waiting to run.\n */\n get size() {\n return this.#queue.size;\n }\n /**\n Size of the queue, filtered by the given options.\n\n For example, this can be used to find the number of items remaining in the queue with a specific priority level.\n */\n sizeBy(options) {\n // eslint-disable-next-line unicorn/no-array-callback-reference\n return this.#queue.filter(options).length;\n }\n /**\n Number of running items (no longer in the queue).\n */\n get pending() {\n return this.#pending;\n }\n /**\n Whether the queue is currently paused.\n */\n get isPaused() {\n return this.#isPaused;\n }\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/p-queue/dist/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/p-queue/dist/lower-bound.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/p-queue/dist/lower-bound.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ lowerBound)\n/* harmony export */ });\n// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nfunction lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = Math.trunc(count / 2);\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/p-queue/dist/lower-bound.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/p-queue/dist/priority-queue.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/p-queue/dist/priority-queue.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ PriorityQueue)\n/* harmony export */ });\n/* harmony import */ var _lower_bound_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lower-bound.js */ \"./node_modules/p-queue/dist/lower-bound.js\");\n\nclass PriorityQueue {\n #queue = [];\n enqueue(run, options) {\n options = {\n priority: 0,\n ...options,\n };\n const element = {\n priority: options.priority,\n run,\n };\n if (this.size && this.#queue[this.size - 1].priority >= options.priority) {\n this.#queue.push(element);\n return;\n }\n const index = (0,_lower_bound_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.#queue, element, (a, b) => b.priority - a.priority);\n this.#queue.splice(index, 0, element);\n }\n dequeue() {\n const item = this.#queue.shift();\n return item?.run;\n }\n filter(options) {\n return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return this.#queue.length;\n }\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/p-queue/dist/priority-queue.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/p-timeout/index.js":
|
||
/*!*****************************************!*\
|
||
!*** ./node_modules/p-timeout/index.js ***!
|
||
\*****************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ TimeoutError: () => (/* binding */ TimeoutError),\n/* harmony export */ \"default\": () => (/* binding */ pTimeout)\n/* harmony export */ });\nclass TimeoutError extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\n/**\nAn error to be thrown when the request is aborted by AbortController.\nDOMException is thrown instead of this Error when DOMException is available.\n*/\nclass AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\n/**\nTODO: Remove AbortError and just throw DOMException when targeting Node 18.\n*/\nconst getDOMException = errorMessage => globalThis.DOMException === undefined\n\t? new AbortError(errorMessage)\n\t: new DOMException(errorMessage);\n\n/**\nTODO: Remove below function and just 'reject(signal.reason)' when targeting Node 18.\n*/\nconst getAbortedReason = signal => {\n\tconst reason = signal.reason === undefined\n\t\t? getDOMException('This operation was aborted.')\n\t\t: signal.reason;\n\n\treturn reason instanceof Error ? reason : getDOMException(reason);\n};\n\nfunction pTimeout(promise, options) {\n\tconst {\n\t\tmilliseconds,\n\t\tfallback,\n\t\tmessage,\n\t\tcustomTimers = {setTimeout, clearTimeout},\n\t} = options;\n\n\tlet timer;\n\n\tconst wrappedPromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (options.signal) {\n\t\t\tconst {signal} = options;\n\t\t\tif (signal.aborted) {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t}\n\n\t\t\tsignal.addEventListener('abort', () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t});\n\t\t}\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\tpromise.then(resolve, reject);\n\t\t\treturn;\n\t\t}\n\n\t\t// We create the error outside of `setTimeout` to preserve the stack trace.\n\t\tconst timeoutError = new TimeoutError();\n\n\t\ttimer = customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (fallback) {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\tif (message === false) {\n\t\t\t\tresolve();\n\t\t\t} else if (message instanceof Error) {\n\t\t\t\treject(message);\n\t\t\t} else {\n\t\t\t\ttimeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\t\treject(timeoutError);\n\t\t\t}\n\t\t}, milliseconds);\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tresolve(await promise);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\t\t})();\n\t});\n\n\tconst cancelablePromise = wrappedPromise.finally(() => {\n\t\tcancelablePromise.clear();\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/p-timeout/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/progress-events/dist/src/index.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/progress-events/dist/src/index.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CustomProgressEvent: () => (/* binding */ CustomProgressEvent)\n/* harmony export */ });\n/**\n * An implementation of the ProgressEvent interface, this is essentially\n * a typed `CustomEvent` with a `type` property that lets us disambiguate\n * events passed to `progress` callbacks.\n */\nclass CustomProgressEvent extends Event {\n constructor(type, detail) {\n super(type);\n this.detail = detail;\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/progress-events/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/codec.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/codec.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CODEC_TYPES: () => (/* binding */ CODEC_TYPES),\n/* harmony export */ createCodec: () => (/* binding */ createCodec)\n/* harmony export */ });\n// https://developers.google.com/protocol-buffers/docs/encoding#structure\nvar CODEC_TYPES;\n(function (CODEC_TYPES) {\n CODEC_TYPES[CODEC_TYPES[\"VARINT\"] = 0] = \"VARINT\";\n CODEC_TYPES[CODEC_TYPES[\"BIT64\"] = 1] = \"BIT64\";\n CODEC_TYPES[CODEC_TYPES[\"LENGTH_DELIMITED\"] = 2] = \"LENGTH_DELIMITED\";\n CODEC_TYPES[CODEC_TYPES[\"START_GROUP\"] = 3] = \"START_GROUP\";\n CODEC_TYPES[CODEC_TYPES[\"END_GROUP\"] = 4] = \"END_GROUP\";\n CODEC_TYPES[CODEC_TYPES[\"BIT32\"] = 5] = \"BIT32\";\n})(CODEC_TYPES || (CODEC_TYPES = {}));\nfunction createCodec(name, type, encode, decode) {\n return {\n name,\n type,\n encode,\n decode\n };\n}\n//# sourceMappingURL=codec.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/codec.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/codecs/enum.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/codecs/enum.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ enumeration: () => (/* binding */ enumeration)\n/* harmony export */ });\n/* harmony import */ var _codec_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../codec.js */ \"./node_modules/protons-runtime/dist/src/codec.js\");\n\nfunction enumeration(v) {\n function findValue(val) {\n // Use the reverse mapping to look up the enum key for the stored value\n // https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings\n if (v[val.toString()] == null) {\n throw new Error('Invalid enum value');\n }\n return v[val];\n }\n const encode = function enumEncode(val, writer) {\n const enumValue = findValue(val);\n writer.int32(enumValue);\n };\n const decode = function enumDecode(reader) {\n const val = reader.int32();\n return findValue(val);\n };\n // @ts-expect-error yeah yeah\n return (0,_codec_js__WEBPACK_IMPORTED_MODULE_0__.createCodec)('enum', _codec_js__WEBPACK_IMPORTED_MODULE_0__.CODEC_TYPES.VARINT, encode, decode);\n}\n//# sourceMappingURL=enum.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/codecs/enum.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/codecs/message.js":
|
||
/*!*****************************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/codecs/message.js ***!
|
||
\*****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ message: () => (/* binding */ message)\n/* harmony export */ });\n/* harmony import */ var _codec_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../codec.js */ \"./node_modules/protons-runtime/dist/src/codec.js\");\n\nfunction message(encode, decode) {\n return (0,_codec_js__WEBPACK_IMPORTED_MODULE_0__.createCodec)('message', _codec_js__WEBPACK_IMPORTED_MODULE_0__.CODEC_TYPES.LENGTH_DELIMITED, encode, decode);\n}\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/codecs/message.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/decode.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/decode.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeMessage: () => (/* binding */ decodeMessage)\n/* harmony export */ });\n/* harmony import */ var _utils_reader_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/reader.js */ \"./node_modules/protons-runtime/dist/src/utils/reader.js\");\n\nfunction decodeMessage(buf, codec, opts) {\n const reader = (0,_utils_reader_js__WEBPACK_IMPORTED_MODULE_0__.createReader)(buf);\n return codec.decode(reader, undefined, opts);\n}\n//# sourceMappingURL=decode.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/decode.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/encode.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/encode.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ encodeMessage: () => (/* binding */ encodeMessage)\n/* harmony export */ });\n/* harmony import */ var _utils_writer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/writer.js */ \"./node_modules/protons-runtime/dist/src/utils/writer.js\");\n\nfunction encodeMessage(message, codec) {\n const w = (0,_utils_writer_js__WEBPACK_IMPORTED_MODULE_0__.createWriter)();\n codec.encode(message, w, {\n lengthDelimited: false\n });\n return w.finish();\n}\n//# sourceMappingURL=encode.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/encode.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/index.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/index.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CodeError: () => (/* binding */ CodeError),\n/* harmony export */ decodeMessage: () => (/* reexport safe */ _decode_js__WEBPACK_IMPORTED_MODULE_0__.decodeMessage),\n/* harmony export */ encodeMessage: () => (/* reexport safe */ _encode_js__WEBPACK_IMPORTED_MODULE_1__.encodeMessage),\n/* harmony export */ enumeration: () => (/* reexport safe */ _codecs_enum_js__WEBPACK_IMPORTED_MODULE_2__.enumeration),\n/* harmony export */ message: () => (/* reexport safe */ _codecs_message_js__WEBPACK_IMPORTED_MODULE_3__.message),\n/* harmony export */ reader: () => (/* reexport safe */ _utils_reader_js__WEBPACK_IMPORTED_MODULE_4__.createReader),\n/* harmony export */ writer: () => (/* reexport safe */ _utils_writer_js__WEBPACK_IMPORTED_MODULE_5__.createWriter)\n/* harmony export */ });\n/* harmony import */ var _decode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decode.js */ \"./node_modules/protons-runtime/dist/src/decode.js\");\n/* harmony import */ var _encode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./encode.js */ \"./node_modules/protons-runtime/dist/src/encode.js\");\n/* harmony import */ var _codecs_enum_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./codecs/enum.js */ \"./node_modules/protons-runtime/dist/src/codecs/enum.js\");\n/* harmony import */ var _codecs_message_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./codecs/message.js */ \"./node_modules/protons-runtime/dist/src/codecs/message.js\");\n/* harmony import */ var _utils_reader_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/reader.js */ \"./node_modules/protons-runtime/dist/src/utils/reader.js\");\n/* harmony import */ var _utils_writer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/writer.js */ \"./node_modules/protons-runtime/dist/src/utils/writer.js\");\n/**\n * @packageDocumentation\n *\n * This module contains serialization/deserialization code used when encoding/decoding protobufs.\n *\n * It should be declared as a dependency of your project:\n *\n * ```console\n * npm i protons-runtime\n * ```\n */\n\n\n\n\n\n\nclass CodeError extends Error {\n code;\n constructor(message, code, options) {\n super(message, options);\n this.code = code;\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/utils/float.js":
|
||
/*!**************************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/utils/float.js ***!
|
||
\**************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ readDoubleBE: () => (/* binding */ readDoubleBE),\n/* harmony export */ readDoubleLE: () => (/* binding */ readDoubleLE),\n/* harmony export */ readFloatBE: () => (/* binding */ readFloatBE),\n/* harmony export */ readFloatLE: () => (/* binding */ readFloatLE),\n/* harmony export */ writeDoubleBE: () => (/* binding */ writeDoubleBE),\n/* harmony export */ writeDoubleLE: () => (/* binding */ writeDoubleLE),\n/* harmony export */ writeFloatBE: () => (/* binding */ writeFloatBE),\n/* harmony export */ writeFloatLE: () => (/* binding */ writeFloatLE)\n/* harmony export */ });\nconst f32 = new Float32Array([-0]);\nconst f8b = new Uint8Array(f32.buffer);\n/**\n * Writes a 32 bit float to a buffer using little endian byte order\n */\nfunction writeFloatLE(val, buf, pos) {\n f32[0] = val;\n buf[pos] = f8b[0];\n buf[pos + 1] = f8b[1];\n buf[pos + 2] = f8b[2];\n buf[pos + 3] = f8b[3];\n}\n/**\n * Writes a 32 bit float to a buffer using big endian byte order\n */\nfunction writeFloatBE(val, buf, pos) {\n f32[0] = val;\n buf[pos] = f8b[3];\n buf[pos + 1] = f8b[2];\n buf[pos + 2] = f8b[1];\n buf[pos + 3] = f8b[0];\n}\n/**\n * Reads a 32 bit float from a buffer using little endian byte order\n */\nfunction readFloatLE(buf, pos) {\n f8b[0] = buf[pos];\n f8b[1] = buf[pos + 1];\n f8b[2] = buf[pos + 2];\n f8b[3] = buf[pos + 3];\n return f32[0];\n}\n/**\n * Reads a 32 bit float from a buffer using big endian byte order\n */\nfunction readFloatBE(buf, pos) {\n f8b[3] = buf[pos];\n f8b[2] = buf[pos + 1];\n f8b[1] = buf[pos + 2];\n f8b[0] = buf[pos + 3];\n return f32[0];\n}\nconst f64 = new Float64Array([-0]);\nconst d8b = new Uint8Array(f64.buffer);\n/**\n * Writes a 64 bit double to a buffer using little endian byte order\n */\nfunction writeDoubleLE(val, buf, pos) {\n f64[0] = val;\n buf[pos] = d8b[0];\n buf[pos + 1] = d8b[1];\n buf[pos + 2] = d8b[2];\n buf[pos + 3] = d8b[3];\n buf[pos + 4] = d8b[4];\n buf[pos + 5] = d8b[5];\n buf[pos + 6] = d8b[6];\n buf[pos + 7] = d8b[7];\n}\n/**\n * Writes a 64 bit double to a buffer using big endian byte order\n */\nfunction writeDoubleBE(val, buf, pos) {\n f64[0] = val;\n buf[pos] = d8b[7];\n buf[pos + 1] = d8b[6];\n buf[pos + 2] = d8b[5];\n buf[pos + 3] = d8b[4];\n buf[pos + 4] = d8b[3];\n buf[pos + 5] = d8b[2];\n buf[pos + 6] = d8b[1];\n buf[pos + 7] = d8b[0];\n}\n/**\n * Reads a 64 bit double from a buffer using little endian byte order\n */\nfunction readDoubleLE(buf, pos) {\n d8b[0] = buf[pos];\n d8b[1] = buf[pos + 1];\n d8b[2] = buf[pos + 2];\n d8b[3] = buf[pos + 3];\n d8b[4] = buf[pos + 4];\n d8b[5] = buf[pos + 5];\n d8b[6] = buf[pos + 6];\n d8b[7] = buf[pos + 7];\n return f64[0];\n}\n/**\n * Reads a 64 bit double from a buffer using big endian byte order\n */\nfunction readDoubleBE(buf, pos) {\n d8b[7] = buf[pos];\n d8b[6] = buf[pos + 1];\n d8b[5] = buf[pos + 2];\n d8b[4] = buf[pos + 3];\n d8b[3] = buf[pos + 4];\n d8b[2] = buf[pos + 5];\n d8b[1] = buf[pos + 6];\n d8b[0] = buf[pos + 7];\n return f64[0];\n}\n//# sourceMappingURL=float.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/utils/float.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/utils/longbits.js":
|
||
/*!*****************************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/utils/longbits.js ***!
|
||
\*****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LongBits: () => (/* binding */ LongBits)\n/* harmony export */ });\n// the largest BigInt we can safely downcast to a Number\nconst MAX_SAFE_NUMBER_INTEGER = BigInt(Number.MAX_SAFE_INTEGER);\nconst MIN_SAFE_NUMBER_INTEGER = BigInt(Number.MIN_SAFE_INTEGER);\n/**\n * Constructs new long bits.\n *\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @function Object() { [native code] }\n * @param {number} lo - Low 32 bits, unsigned\n * @param {number} hi - High 32 bits, unsigned\n */\nclass LongBits {\n lo;\n hi;\n constructor(lo, hi) {\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n /**\n * Low bits\n */\n this.lo = lo | 0;\n /**\n * High bits\n */\n this.hi = hi | 0;\n }\n /**\n * Converts this long bits to a possibly unsafe JavaScript number\n */\n toNumber(unsigned = false) {\n if (!unsigned && (this.hi >>> 31) > 0) {\n const lo = ~this.lo + 1 >>> 0;\n let hi = ~this.hi >>> 0;\n if (lo === 0) {\n hi = hi + 1 >>> 0;\n }\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n }\n /**\n * Converts this long bits to a bigint\n */\n toBigInt(unsigned = false) {\n if (unsigned) {\n return BigInt(this.lo >>> 0) + (BigInt(this.hi >>> 0) << 32n);\n }\n if ((this.hi >>> 31) !== 0) {\n const lo = ~this.lo + 1 >>> 0;\n let hi = ~this.hi >>> 0;\n if (lo === 0) {\n hi = hi + 1 >>> 0;\n }\n return -(BigInt(lo) + (BigInt(hi) << 32n));\n }\n return BigInt(this.lo >>> 0) + (BigInt(this.hi >>> 0) << 32n);\n }\n /**\n * Converts this long bits to a string\n */\n toString(unsigned = false) {\n return this.toBigInt(unsigned).toString();\n }\n /**\n * Zig-zag encodes this long bits\n */\n zzEncode() {\n const mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = (this.lo << 1 ^ mask) >>> 0;\n return this;\n }\n /**\n * Zig-zag decodes this long bits\n */\n zzDecode() {\n const mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = (this.hi >>> 1 ^ mask) >>> 0;\n return this;\n }\n /**\n * Calculates the length of this longbits when encoded as a varint.\n */\n length() {\n const part0 = this.lo;\n const part1 = (this.lo >>> 28 | this.hi << 4) >>> 0;\n const part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n }\n /**\n * Constructs new long bits from the specified number\n */\n static fromBigInt(value) {\n if (value === 0n) {\n return zero;\n }\n if (value < MAX_SAFE_NUMBER_INTEGER && value > MIN_SAFE_NUMBER_INTEGER) {\n return this.fromNumber(Number(value));\n }\n const negative = value < 0n;\n if (negative) {\n value = -value;\n }\n let hi = value >> 32n;\n let lo = value - (hi << 32n);\n if (negative) {\n hi = ~hi | 0n;\n lo = ~lo | 0n;\n if (++lo > TWO_32) {\n lo = 0n;\n if (++hi > TWO_32) {\n hi = 0n;\n }\n }\n }\n return new LongBits(Number(lo), Number(hi));\n }\n /**\n * Constructs new long bits from the specified number\n */\n static fromNumber(value) {\n if (value === 0) {\n return zero;\n }\n const sign = value < 0;\n if (sign) {\n value = -value;\n }\n let lo = value >>> 0;\n let hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295) {\n hi = 0;\n }\n }\n }\n return new LongBits(lo, hi);\n }\n /**\n * Constructs new long bits from a number, long or string\n */\n static from(value) {\n if (typeof value === 'number') {\n return LongBits.fromNumber(value);\n }\n if (typeof value === 'bigint') {\n return LongBits.fromBigInt(value);\n }\n if (typeof value === 'string') {\n return LongBits.fromBigInt(BigInt(value));\n }\n return value.low != null || value.high != null ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n }\n}\nconst zero = new LongBits(0, 0);\nzero.toBigInt = function () { return 0n; };\nzero.zzEncode = zero.zzDecode = function () { return this; };\nzero.length = function () { return 1; };\nconst TWO_32 = 4294967296n;\n//# sourceMappingURL=longbits.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/utils/longbits.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/utils/pool.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/utils/pool.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ pool)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/alloc.js\");\n\n/**\n * A general purpose buffer pool\n */\nfunction pool(size) {\n const SIZE = size ?? 8192;\n const MAX = SIZE >>> 1;\n let slab;\n let offset = SIZE;\n return function poolAlloc(size) {\n if (size < 1 || size > MAX) {\n return (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(size);\n }\n if (offset + size > SIZE) {\n slab = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(SIZE);\n offset = 0;\n }\n const buf = slab.subarray(offset, offset += size);\n if ((offset & 7) !== 0) {\n // align to 32 bit\n offset = (offset | 7) + 1;\n }\n return buf;\n };\n}\n//# sourceMappingURL=pool.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/utils/pool.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/utils/reader.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/utils/reader.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Uint8ArrayReader: () => (/* binding */ Uint8ArrayReader),\n/* harmony export */ createReader: () => (/* binding */ createReader)\n/* harmony export */ });\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var _float_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./float.js */ \"./node_modules/protons-runtime/dist/src/utils/float.js\");\n/* harmony import */ var _longbits_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./longbits.js */ \"./node_modules/protons-runtime/dist/src/utils/longbits.js\");\n/* harmony import */ var _utf8_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utf8.js */ \"./node_modules/protons-runtime/dist/src/utils/utf8.js\");\n\n\n\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(`index out of range: ${reader.pos} + ${writeLength ?? 1} > ${reader.len}`);\n}\nfunction readFixed32End(buf, end) {\n return (buf[end - 4] |\n buf[end - 3] << 8 |\n buf[end - 2] << 16 |\n buf[end - 1] << 24) >>> 0;\n}\n/**\n * Constructs a new reader instance using the specified buffer.\n */\nclass Uint8ArrayReader {\n buf;\n pos;\n len;\n _slice = Uint8Array.prototype.subarray;\n constructor(buffer) {\n /**\n * Read buffer\n */\n this.buf = buffer;\n /**\n * Read buffer position\n */\n this.pos = 0;\n /**\n * Read buffer length\n */\n this.len = buffer.length;\n }\n /**\n * Reads a varint as an unsigned 32 bit value\n */\n uint32() {\n let value = 4294967295;\n value = (this.buf[this.pos] & 127) >>> 0;\n if (this.buf[this.pos++] < 128)\n return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0;\n if (this.buf[this.pos++] < 128)\n return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0;\n if (this.buf[this.pos++] < 128)\n return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0;\n if (this.buf[this.pos++] < 128)\n return value;\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n }\n /**\n * Reads a varint as a signed 32 bit value\n */\n int32() {\n return this.uint32() | 0;\n }\n /**\n * Reads a zig-zag encoded varint as a signed 32 bit value\n */\n sint32() {\n const value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n }\n /**\n * Reads a varint as a boolean\n */\n bool() {\n return this.uint32() !== 0;\n }\n /**\n * Reads fixed 32 bits as an unsigned 32 bit integer\n */\n fixed32() {\n if (this.pos + 4 > this.len) {\n throw indexOutOfRange(this, 4);\n }\n const res = readFixed32End(this.buf, this.pos += 4);\n return res;\n }\n /**\n * Reads fixed 32 bits as a signed 32 bit integer\n */\n sfixed32() {\n if (this.pos + 4 > this.len) {\n throw indexOutOfRange(this, 4);\n }\n const res = readFixed32End(this.buf, this.pos += 4) | 0;\n return res;\n }\n /**\n * Reads a float (32 bit) as a number\n */\n float() {\n if (this.pos + 4 > this.len) {\n throw indexOutOfRange(this, 4);\n }\n const value = (0,_float_js__WEBPACK_IMPORTED_MODULE_1__.readFloatLE)(this.buf, this.pos);\n this.pos += 4;\n return value;\n }\n /**\n * Reads a double (64 bit float) as a number\n */\n double() {\n /* istanbul ignore if */\n if (this.pos + 8 > this.len) {\n throw indexOutOfRange(this, 4);\n }\n const value = (0,_float_js__WEBPACK_IMPORTED_MODULE_1__.readDoubleLE)(this.buf, this.pos);\n this.pos += 8;\n return value;\n }\n /**\n * Reads a sequence of bytes preceded by its length as a varint\n */\n bytes() {\n const length = this.uint32();\n const start = this.pos;\n const end = this.pos + length;\n /* istanbul ignore if */\n if (end > this.len) {\n throw indexOutOfRange(this, length);\n }\n this.pos += length;\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new Uint8Array(0)\n : this.buf.subarray(start, end);\n }\n /**\n * Reads a string preceded by its byte length as a varint\n */\n string() {\n const bytes = this.bytes();\n return _utf8_js__WEBPACK_IMPORTED_MODULE_3__.read(bytes, 0, bytes.length);\n }\n /**\n * Skips the specified number of bytes if specified, otherwise skips a varint\n */\n skip(length) {\n if (typeof length === 'number') {\n /* istanbul ignore if */\n if (this.pos + length > this.len) {\n throw indexOutOfRange(this, length);\n }\n this.pos += length;\n }\n else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len) {\n throw indexOutOfRange(this);\n }\n } while ((this.buf[this.pos++] & 128) !== 0);\n }\n return this;\n }\n /**\n * Skips the next element of the specified wire type\n */\n skipType(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n /* istanbul ignore next */\n default:\n throw Error(`invalid wire type ${wireType} at offset ${this.pos}`);\n }\n return this;\n }\n readLongVarint() {\n // tends to deopt with local vars for octet etc.\n const bits = new _longbits_js__WEBPACK_IMPORTED_MODULE_2__.LongBits(0, 0);\n let i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128) {\n return bits;\n }\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128) {\n return bits;\n }\n i = 0;\n }\n else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len) {\n throw indexOutOfRange(this);\n }\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128) {\n return bits;\n }\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128) {\n return bits;\n }\n }\n }\n else {\n for (; i < 5; ++i) {\n if (this.pos >= this.len) {\n throw indexOutOfRange(this);\n }\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128) {\n return bits;\n }\n }\n }\n throw Error('invalid varint encoding');\n }\n readFixed64() {\n if (this.pos + 8 > this.len) {\n throw indexOutOfRange(this, 8);\n }\n const lo = readFixed32End(this.buf, this.pos += 4);\n const hi = readFixed32End(this.buf, this.pos += 4);\n return new _longbits_js__WEBPACK_IMPORTED_MODULE_2__.LongBits(lo, hi);\n }\n /**\n * Reads a varint as a signed 64 bit value\n */\n int64() {\n return this.readLongVarint().toBigInt();\n }\n /**\n * Reads a varint as a signed 64 bit value returned as a possibly unsafe\n * JavaScript number\n */\n int64Number() {\n return this.readLongVarint().toNumber();\n }\n /**\n * Reads a varint as a signed 64 bit value returned as a string\n */\n int64String() {\n return this.readLongVarint().toString();\n }\n /**\n * Reads a varint as an unsigned 64 bit value\n */\n uint64() {\n return this.readLongVarint().toBigInt(true);\n }\n /**\n * Reads a varint as an unsigned 64 bit value returned as a possibly unsafe\n * JavaScript number\n */\n uint64Number() {\n const value = (0,uint8_varint__WEBPACK_IMPORTED_MODULE_0__.decodeUint8Array)(this.buf, this.pos);\n this.pos += (0,uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encodingLength)(value);\n return value;\n }\n /**\n * Reads a varint as an unsigned 64 bit value returned as a string\n */\n uint64String() {\n return this.readLongVarint().toString(true);\n }\n /**\n * Reads a zig-zag encoded varint as a signed 64 bit value\n */\n sint64() {\n return this.readLongVarint().zzDecode().toBigInt();\n }\n /**\n * Reads a zig-zag encoded varint as a signed 64 bit value returned as a\n * possibly unsafe JavaScript number\n */\n sint64Number() {\n return this.readLongVarint().zzDecode().toNumber();\n }\n /**\n * Reads a zig-zag encoded varint as a signed 64 bit value returned as a\n * string\n */\n sint64String() {\n return this.readLongVarint().zzDecode().toString();\n }\n /**\n * Reads fixed 64 bits\n */\n fixed64() {\n return this.readFixed64().toBigInt();\n }\n /**\n * Reads fixed 64 bits returned as a possibly unsafe JavaScript number\n */\n fixed64Number() {\n return this.readFixed64().toNumber();\n }\n /**\n * Reads fixed 64 bits returned as a string\n */\n fixed64String() {\n return this.readFixed64().toString();\n }\n /**\n * Reads zig-zag encoded fixed 64 bits\n */\n sfixed64() {\n return this.readFixed64().toBigInt();\n }\n /**\n * Reads zig-zag encoded fixed 64 bits returned as a possibly unsafe\n * JavaScript number\n */\n sfixed64Number() {\n return this.readFixed64().toNumber();\n }\n /**\n * Reads zig-zag encoded fixed 64 bits returned as a string\n */\n sfixed64String() {\n return this.readFixed64().toString();\n }\n}\nfunction createReader(buf) {\n return new Uint8ArrayReader(buf instanceof Uint8Array ? buf : buf.subarray());\n}\n//# sourceMappingURL=reader.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/utils/reader.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/utils/utf8.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/utils/utf8.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ length: () => (/* binding */ length),\n/* harmony export */ read: () => (/* binding */ read),\n/* harmony export */ write: () => (/* binding */ write)\n/* harmony export */ });\n/**\n * Calculates the UTF8 byte length of a string\n */\nfunction length(string) {\n let len = 0;\n let c = 0;\n for (let i = 0; i < string.length; ++i) {\n c = string.charCodeAt(i);\n if (c < 128) {\n len += 1;\n }\n else if (c < 2048) {\n len += 2;\n }\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\n ++i;\n len += 4;\n }\n else {\n len += 3;\n }\n }\n return len;\n}\n/**\n * Reads UTF8 bytes as a string\n */\nfunction read(buffer, start, end) {\n const len = end - start;\n if (len < 1) {\n return '';\n }\n let parts;\n const chunk = [];\n let i = 0; // char offset\n let t; // temporary\n while (start < end) {\n t = buffer[start++];\n if (t < 128) {\n chunk[i++] = t;\n }\n else if (t > 191 && t < 224) {\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\n }\n else if (t > 239 && t < 365) {\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\n chunk[i++] = 0xD800 + (t >> 10);\n chunk[i++] = 0xDC00 + (t & 1023);\n }\n else {\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\n }\n if (i > 8191) {\n (parts ?? (parts = [])).push(String.fromCharCode.apply(String, chunk));\n i = 0;\n }\n }\n if (parts != null) {\n if (i > 0) {\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\n }\n return parts.join('');\n }\n return String.fromCharCode.apply(String, chunk.slice(0, i));\n}\n/**\n * Writes a string as UTF8 bytes\n */\nfunction write(string, buffer, offset) {\n const start = offset;\n let c1; // character 1\n let c2; // character 2\n for (let i = 0; i < string.length; ++i) {\n c1 = string.charCodeAt(i);\n if (c1 < 128) {\n buffer[offset++] = c1;\n }\n else if (c1 < 2048) {\n buffer[offset++] = c1 >> 6 | 192;\n buffer[offset++] = c1 & 63 | 128;\n }\n else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\n ++i;\n buffer[offset++] = c1 >> 18 | 240;\n buffer[offset++] = c1 >> 12 & 63 | 128;\n buffer[offset++] = c1 >> 6 & 63 | 128;\n buffer[offset++] = c1 & 63 | 128;\n }\n else {\n buffer[offset++] = c1 >> 12 | 224;\n buffer[offset++] = c1 >> 6 & 63 | 128;\n buffer[offset++] = c1 & 63 | 128;\n }\n }\n return offset - start;\n}\n//# sourceMappingURL=utf8.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/utils/utf8.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/dist/src/utils/writer.js":
|
||
/*!***************************************************************!*\
|
||
!*** ./node_modules/protons-runtime/dist/src/utils/writer.js ***!
|
||
\***************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createWriter: () => (/* binding */ createWriter)\n/* harmony export */ });\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _float_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./float.js */ \"./node_modules/protons-runtime/dist/src/utils/float.js\");\n/* harmony import */ var _longbits_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./longbits.js */ \"./node_modules/protons-runtime/dist/src/utils/longbits.js\");\n/* harmony import */ var _pool_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pool.js */ \"./node_modules/protons-runtime/dist/src/utils/pool.js\");\n/* harmony import */ var _utf8_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utf8.js */ \"./node_modules/protons-runtime/dist/src/utils/utf8.js\");\n\n\n\n\n\n\n\n/**\n * Constructs a new writer operation instance.\n *\n * @classdesc Scheduled writer operation\n */\nclass Op {\n /**\n * Function to call\n */\n fn;\n /**\n * Value byte length\n */\n len;\n /**\n * Next operation\n */\n next;\n /**\n * Value to write\n */\n val;\n constructor(fn, len, val) {\n this.fn = fn;\n this.len = len;\n this.next = undefined;\n this.val = val; // type varies\n }\n}\n/* istanbul ignore next */\nfunction noop() { } // eslint-disable-line no-empty-function\n/**\n * Constructs a new writer state instance\n */\nclass State {\n /**\n * Current head\n */\n head;\n /**\n * Current tail\n */\n tail;\n /**\n * Current buffer length\n */\n len;\n /**\n * Next state\n */\n next;\n constructor(writer) {\n this.head = writer.head;\n this.tail = writer.tail;\n this.len = writer.len;\n this.next = writer.states;\n }\n}\nconst bufferPool = (0,_pool_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"])();\n/**\n * Allocates a buffer of the specified size\n */\nfunction alloc(size) {\n if (globalThis.Buffer != null) {\n return (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(size);\n }\n return bufferPool(size);\n}\n/**\n * When a value is written, the writer calculates its byte length and puts it into a linked\n * list of operations to perform when finish() is called. This both allows us to allocate\n * buffers of the exact required size and reduces the amount of work we have to do compared\n * to first calculating over objects and then encoding over objects. In our case, the encoding\n * part is just a linked list walk calling operations with already prepared values.\n */\nclass Uint8ArrayWriter {\n /**\n * Current length\n */\n len;\n /**\n * Operations head\n */\n head;\n /**\n * Operations tail\n */\n tail;\n /**\n * Linked forked states\n */\n states;\n constructor() {\n this.len = 0;\n this.head = new Op(noop, 0, 0);\n this.tail = this.head;\n this.states = null;\n }\n /**\n * Pushes a new operation to the queue\n */\n _push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n }\n /**\n * Writes an unsigned 32 bit value as a varint\n */\n uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp((value = value >>> 0) <\n 128\n ? 1\n : value < 16384\n ? 2\n : value < 2097152\n ? 3\n : value < 268435456\n ? 4\n : 5, value)).len;\n return this;\n }\n /**\n * Writes a signed 32 bit value as a varint`\n */\n int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, _longbits_js__WEBPACK_IMPORTED_MODULE_4__.LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n }\n /**\n * Writes a 32 bit value as a varint, zig-zag encoded\n */\n sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n }\n /**\n * Writes an unsigned 64 bit value as a varint\n */\n uint64(value) {\n const bits = _longbits_js__WEBPACK_IMPORTED_MODULE_4__.LongBits.fromBigInt(value);\n return this._push(writeVarint64, bits.length(), bits);\n }\n /**\n * Writes an unsigned 64 bit value as a varint\n */\n uint64Number(value) {\n return this._push(uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encodeUint8Array, (0,uint8_varint__WEBPACK_IMPORTED_MODULE_0__.encodingLength)(value), value);\n }\n /**\n * Writes an unsigned 64 bit value as a varint\n */\n uint64String(value) {\n return this.uint64(BigInt(value));\n }\n /**\n * Writes a signed 64 bit value as a varint\n */\n int64(value) {\n return this.uint64(value);\n }\n /**\n * Writes a signed 64 bit value as a varint\n */\n int64Number(value) {\n return this.uint64Number(value);\n }\n /**\n * Writes a signed 64 bit value as a varint\n */\n int64String(value) {\n return this.uint64String(value);\n }\n /**\n * Writes a signed 64 bit value as a varint, zig-zag encoded\n */\n sint64(value) {\n const bits = _longbits_js__WEBPACK_IMPORTED_MODULE_4__.LongBits.fromBigInt(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n }\n /**\n * Writes a signed 64 bit value as a varint, zig-zag encoded\n */\n sint64Number(value) {\n const bits = _longbits_js__WEBPACK_IMPORTED_MODULE_4__.LongBits.fromNumber(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n }\n /**\n * Writes a signed 64 bit value as a varint, zig-zag encoded\n */\n sint64String(value) {\n return this.sint64(BigInt(value));\n }\n /**\n * Writes a boolish value as a varint\n */\n bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n }\n /**\n * Writes an unsigned 32 bit value as fixed 32 bits\n */\n fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n }\n /**\n * Writes a signed 32 bit value as fixed 32 bits\n */\n sfixed32(value) {\n return this.fixed32(value);\n }\n /**\n * Writes an unsigned 64 bit value as fixed 64 bits\n */\n fixed64(value) {\n const bits = _longbits_js__WEBPACK_IMPORTED_MODULE_4__.LongBits.fromBigInt(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n }\n /**\n * Writes an unsigned 64 bit value as fixed 64 bits\n */\n fixed64Number(value) {\n const bits = _longbits_js__WEBPACK_IMPORTED_MODULE_4__.LongBits.fromNumber(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n }\n /**\n * Writes an unsigned 64 bit value as fixed 64 bits\n */\n fixed64String(value) {\n return this.fixed64(BigInt(value));\n }\n /**\n * Writes a signed 64 bit value as fixed 64 bits\n */\n sfixed64(value) {\n return this.fixed64(value);\n }\n /**\n * Writes a signed 64 bit value as fixed 64 bits\n */\n sfixed64Number(value) {\n return this.fixed64Number(value);\n }\n /**\n * Writes a signed 64 bit value as fixed 64 bits\n */\n sfixed64String(value) {\n return this.fixed64String(value);\n }\n /**\n * Writes a float (32 bit)\n */\n float(value) {\n return this._push(_float_js__WEBPACK_IMPORTED_MODULE_3__.writeFloatLE, 4, value);\n }\n /**\n * Writes a double (64 bit float).\n *\n * @function\n * @param {number} value - Value to write\n * @returns {Writer} `this`\n */\n double(value) {\n return this._push(_float_js__WEBPACK_IMPORTED_MODULE_3__.writeDoubleLE, 8, value);\n }\n /**\n * Writes a sequence of bytes\n */\n bytes(value) {\n const len = value.length >>> 0;\n if (len === 0) {\n return this._push(writeByte, 1, 0);\n }\n return this.uint32(len)._push(writeBytes, len, value);\n }\n /**\n * Writes a string\n */\n string(value) {\n const len = _utf8_js__WEBPACK_IMPORTED_MODULE_6__.length(value);\n return len !== 0\n ? this.uint32(len)._push(_utf8_js__WEBPACK_IMPORTED_MODULE_6__.write, len, value)\n : this._push(writeByte, 1, 0);\n }\n /**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n */\n fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n }\n /**\n * Resets this instance to the last state\n */\n reset() {\n if (this.states != null) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n }\n else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n }\n /**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n */\n ldelim() {\n const head = this.head;\n const tail = this.tail;\n const len = this.len;\n this.reset().uint32(len);\n if (len !== 0) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n }\n /**\n * Finishes the write operation\n */\n finish() {\n let head = this.head.next; // skip noop\n const buf = alloc(this.len);\n let pos = 0;\n while (head != null) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n }\n}\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n/**\n * Constructs a new varint writer operation instance.\n *\n * @classdesc Scheduled varint writer operation\n */\nclass VarintOp extends Op {\n next;\n constructor(len, val) {\n super(writeVarint32, len, val);\n this.next = undefined;\n }\n}\nfunction writeVarint64(val, buf, pos) {\n while (val.hi !== 0) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\nfunction writeFixed32(val, buf, pos) {\n buf[pos] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\nfunction writeBytes(val, buf, pos) {\n buf.set(val, pos);\n}\nif (globalThis.Buffer != null) {\n Uint8ArrayWriter.prototype.bytes = function (value) {\n const len = value.length >>> 0;\n this.uint32(len);\n if (len > 0) {\n this._push(writeBytesBuffer, len, value);\n }\n return this;\n };\n Uint8ArrayWriter.prototype.string = function (value) {\n const len = globalThis.Buffer.byteLength(value);\n this.uint32(len);\n if (len > 0) {\n this._push(writeStringBuffer, len, value);\n }\n return this;\n };\n}\nfunction writeBytesBuffer(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n}\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) {\n // plain js is faster for short strings (probably due to redundant assertions)\n _utf8_js__WEBPACK_IMPORTED_MODULE_6__.write(val, buf, pos);\n // @ts-expect-error buf isn't a Uint8Array?\n }\n else if (buf.utf8Write != null) {\n // @ts-expect-error buf isn't a Uint8Array?\n buf.utf8Write(val, pos);\n }\n else {\n buf.set((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(val), pos);\n }\n}\n/**\n * Creates a new writer\n */\nfunction createWriter() {\n return new Uint8ArrayWriter();\n}\n//# sourceMappingURL=writer.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/dist/src/utils/writer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/dist/src/basics.js\");\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #alloc */ \"./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/protons-runtime/node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/race-event/dist/src/index.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/race-event/dist/src/index.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ raceEvent: () => (/* binding */ raceEvent)\n/* harmony export */ });\n/**\n * @packageDocumentation\n *\n * Race an event against an AbortSignal, taking care to remove any event\n * listeners that were added.\n *\n * @example Getting started\n *\n * ```TypeScript\n * import { raceEvent } from 'race-event'\n *\n * const controller = new AbortController()\n * const emitter = new EventTarget()\n *\n * setTimeout(() => {\n * controller.abort()\n * }, 500)\n *\n * setTimeout(() => {\n * // too late\n * emitter.dispatchEvent(new CustomEvent('event'))\n * }, 1000)\n *\n * // throws an AbortError\n * const resolve = await raceEvent(emitter, 'event', controller.signal)\n * ```\n *\n * @example Customising the thrown AbortError\n *\n * The error message and `.code` property of the thrown `AbortError` can be\n * specified by passing options:\n *\n * ```TypeScript\n * import { raceEvent } from 'race-event'\n *\n * const controller = new AbortController()\n * const emitter = new EventTarget()\n *\n * setTimeout(() => {\n * controller.abort()\n * }, 500)\n *\n * // throws a Error: Oh no!\n * const resolve = await raceEvent(emitter, 'event', controller.signal, {\n * errorMessage: 'Oh no!',\n * errorCode: 'ERR_OH_NO'\n * })\n * ```\n *\n * @example Only resolving on specific events\n *\n * Where multiple events with the same type are emitted, a `filter` function can\n * be passed to only resolve on one of them:\n *\n * ```TypeScript\n * import { raceEvent } from 'race-event'\n *\n * const controller = new AbortController()\n * const emitter = new EventTarget()\n *\n * // throws a Error: Oh no!\n * const resolve = await raceEvent(emitter, 'event', controller.signal, {\n * filter: (evt: Event) => {\n * return evt.detail.foo === 'bar'\n * }\n * })\n * ```\n *\n * @example Terminating early by throwing from the filter\n *\n * You can cause listening for the event to cease and all event listeners to be\n * removed by throwing from the filter:\n *\n * ```TypeScript\n * import { raceEvent } from 'race-event'\n *\n * const controller = new AbortController()\n * const emitter = new EventTarget()\n *\n * // throws Error: Cannot continue\n * const resolve = await raceEvent(emitter, 'event', controller.signal, {\n * filter: (evt) => {\n * if (...reasons) {\n * throw new Error('Cannot continue')\n * }\n *\n * return true\n * }\n * })\n * ```\n */\n/**\n * An abort error class that extends error\n */\nclass AbortError extends Error {\n type;\n code;\n constructor(message, code) {\n super(message ?? 'The operation was aborted');\n this.type = 'aborted';\n this.name = 'AbortError';\n this.code = code ?? 'ABORT_ERR';\n }\n}\n/**\n * Race a promise against an abort signal\n */\nasync function raceEvent(emitter, eventName, signal, opts) {\n // create the error here so we have more context in the stack trace\n const error = new AbortError(opts?.errorMessage, opts?.errorCode);\n if (signal?.aborted === true) {\n return Promise.reject(error);\n }\n return new Promise((resolve, reject) => {\n const eventListener = (evt) => {\n try {\n if (opts?.filter?.(evt) === false) {\n return;\n }\n }\n catch (err) {\n emitter.removeEventListener(eventName, eventListener);\n signal?.removeEventListener('abort', abortListener);\n reject(err);\n return;\n }\n emitter.removeEventListener(eventName, eventListener);\n signal?.removeEventListener('abort', abortListener);\n resolve(evt);\n };\n const abortListener = () => {\n emitter.removeEventListener(eventName, eventListener);\n signal?.removeEventListener('abort', abortListener);\n reject(error);\n };\n emitter.addEventListener(eventName, eventListener);\n signal?.addEventListener('abort', abortListener);\n });\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/race-event/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/race-signal/dist/src/index.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/race-signal/dist/src/index.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ raceSignal: () => (/* binding */ raceSignal)\n/* harmony export */ });\n/**\n * An abort error class that extends error\n */\nclass AbortError extends Error {\n type;\n code;\n constructor(message, code) {\n super(message ?? 'The operation was aborted');\n this.type = 'aborted';\n this.name = 'AbortError';\n this.code = code ?? 'ABORT_ERR';\n }\n}\n/**\n * Race a promise against an abort signal\n */\nasync function raceSignal(promise, signal, opts) {\n if (signal == null) {\n return promise;\n }\n if (signal.aborted) {\n return Promise.reject(new AbortError(opts?.errorMessage, opts?.errorCode));\n }\n let listener;\n // create the error here so we have more context in the stack trace\n const error = new AbortError(opts?.errorMessage, opts?.errorCode);\n try {\n return await Promise.race([\n promise,\n new Promise((resolve, reject) => {\n listener = () => {\n reject(error);\n };\n signal.addEventListener('abort', listener);\n })\n ]);\n }\n finally {\n if (listener != null) {\n signal.removeEventListener('abort', listener);\n }\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/race-signal/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8-varint/dist/src/index.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/uint8-varint/dist/src/index.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ decodeUint8Array: () => (/* binding */ decodeUint8Array),\n/* harmony export */ decodeUint8ArrayList: () => (/* binding */ decodeUint8ArrayList),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ encodeUint8Array: () => (/* binding */ encodeUint8Array),\n/* harmony export */ encodeUint8ArrayList: () => (/* binding */ encodeUint8ArrayList),\n/* harmony export */ encodingLength: () => (/* binding */ encodingLength)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8-varint/node_modules/uint8arrays/dist/src/alloc.js\");\n/* eslint-disable no-fallthrough */\n\nconst N1 = Math.pow(2, 7);\nconst N2 = Math.pow(2, 14);\nconst N3 = Math.pow(2, 21);\nconst N4 = Math.pow(2, 28);\nconst N5 = Math.pow(2, 35);\nconst N6 = Math.pow(2, 42);\nconst N7 = Math.pow(2, 49);\n/** Most significant bit of a byte */\nconst MSB = 0x80;\n/** Rest of the bits in a byte */\nconst REST = 0x7f;\nfunction encodingLength(value) {\n if (value < N1) {\n return 1;\n }\n if (value < N2) {\n return 2;\n }\n if (value < N3) {\n return 3;\n }\n if (value < N4) {\n return 4;\n }\n if (value < N5) {\n return 5;\n }\n if (value < N6) {\n return 6;\n }\n if (value < N7) {\n return 7;\n }\n if (Number.MAX_SAFE_INTEGER != null && value > Number.MAX_SAFE_INTEGER) {\n throw new RangeError('Could not encode varint');\n }\n return 8;\n}\nfunction encodeUint8Array(value, buf, offset = 0) {\n switch (encodingLength(value)) {\n case 8: {\n buf[offset++] = (value & 0xFF) | MSB;\n value /= 128;\n }\n case 7: {\n buf[offset++] = (value & 0xFF) | MSB;\n value /= 128;\n }\n case 6: {\n buf[offset++] = (value & 0xFF) | MSB;\n value /= 128;\n }\n case 5: {\n buf[offset++] = (value & 0xFF) | MSB;\n value /= 128;\n }\n case 4: {\n buf[offset++] = (value & 0xFF) | MSB;\n value >>>= 7;\n }\n case 3: {\n buf[offset++] = (value & 0xFF) | MSB;\n value >>>= 7;\n }\n case 2: {\n buf[offset++] = (value & 0xFF) | MSB;\n value >>>= 7;\n }\n case 1: {\n buf[offset++] = (value & 0xFF);\n value >>>= 7;\n break;\n }\n default: throw new Error('unreachable');\n }\n return buf;\n}\nfunction encodeUint8ArrayList(value, buf, offset = 0) {\n switch (encodingLength(value)) {\n case 8: {\n buf.set(offset++, (value & 0xFF) | MSB);\n value /= 128;\n }\n case 7: {\n buf.set(offset++, (value & 0xFF) | MSB);\n value /= 128;\n }\n case 6: {\n buf.set(offset++, (value & 0xFF) | MSB);\n value /= 128;\n }\n case 5: {\n buf.set(offset++, (value & 0xFF) | MSB);\n value /= 128;\n }\n case 4: {\n buf.set(offset++, (value & 0xFF) | MSB);\n value >>>= 7;\n }\n case 3: {\n buf.set(offset++, (value & 0xFF) | MSB);\n value >>>= 7;\n }\n case 2: {\n buf.set(offset++, (value & 0xFF) | MSB);\n value >>>= 7;\n }\n case 1: {\n buf.set(offset++, (value & 0xFF));\n value >>>= 7;\n break;\n }\n default: throw new Error('unreachable');\n }\n return buf;\n}\nfunction decodeUint8Array(buf, offset) {\n let b = buf[offset];\n let res = 0;\n res += b & REST;\n if (b < MSB) {\n return res;\n }\n b = buf[offset + 1];\n res += (b & REST) << 7;\n if (b < MSB) {\n return res;\n }\n b = buf[offset + 2];\n res += (b & REST) << 14;\n if (b < MSB) {\n return res;\n }\n b = buf[offset + 3];\n res += (b & REST) << 21;\n if (b < MSB) {\n return res;\n }\n b = buf[offset + 4];\n res += (b & REST) * N4;\n if (b < MSB) {\n return res;\n }\n b = buf[offset + 5];\n res += (b & REST) * N5;\n if (b < MSB) {\n return res;\n }\n b = buf[offset + 6];\n res += (b & REST) * N6;\n if (b < MSB) {\n return res;\n }\n b = buf[offset + 7];\n res += (b & REST) * N7;\n if (b < MSB) {\n return res;\n }\n throw new RangeError('Could not decode varint');\n}\nfunction decodeUint8ArrayList(buf, offset) {\n let b = buf.get(offset);\n let res = 0;\n res += b & REST;\n if (b < MSB) {\n return res;\n }\n b = buf.get(offset + 1);\n res += (b & REST) << 7;\n if (b < MSB) {\n return res;\n }\n b = buf.get(offset + 2);\n res += (b & REST) << 14;\n if (b < MSB) {\n return res;\n }\n b = buf.get(offset + 3);\n res += (b & REST) << 21;\n if (b < MSB) {\n return res;\n }\n b = buf.get(offset + 4);\n res += (b & REST) * N4;\n if (b < MSB) {\n return res;\n }\n b = buf.get(offset + 5);\n res += (b & REST) * N5;\n if (b < MSB) {\n return res;\n }\n b = buf.get(offset + 6);\n res += (b & REST) * N6;\n if (b < MSB) {\n return res;\n }\n b = buf.get(offset + 7);\n res += (b & REST) * N7;\n if (b < MSB) {\n return res;\n }\n throw new RangeError('Could not decode varint');\n}\nfunction encode(value, buf, offset = 0) {\n if (buf == null) {\n buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(encodingLength(value));\n }\n if (buf instanceof Uint8Array) {\n return encodeUint8Array(value, buf, offset);\n }\n else {\n return encodeUint8ArrayList(value, buf, offset);\n }\n}\nfunction decode(buf, offset = 0) {\n if (buf instanceof Uint8Array) {\n return decodeUint8Array(buf, offset);\n }\n else {\n return decodeUint8ArrayList(buf, offset);\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8-varint/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8-varint/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/uint8-varint/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8-varint/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arraylist/dist/src/index.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/uint8arraylist/dist/src/index.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Uint8ArrayList: () => (/* binding */ Uint8ArrayList),\n/* harmony export */ isUint8ArrayList: () => (/* binding */ isUint8ArrayList)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/equals.js\");\n/**\n * @packageDocumentation\n *\n * A class that lets you do operations over a list of Uint8Arrays without\n * copying them.\n *\n * ```js\n * import { Uint8ArrayList } from 'uint8arraylist'\n *\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.subarray()\n * // -> Uint8Array([0, 1, 2, 3, 4, 5])\n *\n * list.consume(3)\n * list.subarray()\n * // -> Uint8Array([3, 4, 5])\n *\n * // you can also iterate over the list\n * for (const buf of list) {\n * // ..do something with `buf`\n * }\n *\n * list.subarray(0, 1)\n * // -> Uint8Array([0])\n * ```\n *\n * ## Converting Uint8ArrayLists to Uint8Arrays\n *\n * There are two ways to turn a `Uint8ArrayList` into a `Uint8Array` - `.slice` and `.subarray` and one way to turn a `Uint8ArrayList` into a `Uint8ArrayList` with different contents - `.sublist`.\n *\n * ### slice\n *\n * Slice follows the same semantics as [Uint8Array.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice) in that it creates a new `Uint8Array` and copies bytes into it using an optional offset & length.\n *\n * ```js\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.slice(0, 1)\n * // -> Uint8Array([0])\n * ```\n *\n * ### subarray\n *\n * Subarray attempts to follow the same semantics as [Uint8Array.subarray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray) with one important different - this is a no-copy operation, unless the requested bytes span two internal buffers in which case it is a copy operation.\n *\n * ```js\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.subarray(0, 1)\n * // -> Uint8Array([0]) - no-copy\n *\n * list.subarray(2, 5)\n * // -> Uint8Array([2, 3, 4]) - copy\n * ```\n *\n * ### sublist\n *\n * Sublist creates and returns a new `Uint8ArrayList` that shares the underlying buffers with the original so is always a no-copy operation.\n *\n * ```js\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.sublist(0, 1)\n * // -> Uint8ArrayList([0]) - no-copy\n *\n * list.sublist(2, 5)\n * // -> Uint8ArrayList([2], [3, 4]) - no-copy\n * ```\n *\n * ## Inspiration\n *\n * Borrows liberally from [bl](https://www.npmjs.com/package/bl) but only uses native JS types.\n */\n\n\n\nconst symbol = Symbol.for('@achingbrain/uint8arraylist');\nfunction findBufAndOffset(bufs, index) {\n if (index == null || index < 0) {\n throw new RangeError('index is out of bounds');\n }\n let offset = 0;\n for (const buf of bufs) {\n const bufEnd = offset + buf.byteLength;\n if (index < bufEnd) {\n return {\n buf,\n index: index - offset\n };\n }\n offset = bufEnd;\n }\n throw new RangeError('index is out of bounds');\n}\n/**\n * Check if object is a CID instance\n *\n * @example\n *\n * ```js\n * import { isUint8ArrayList, Uint8ArrayList } from 'uint8arraylist'\n *\n * isUint8ArrayList(true) // false\n * isUint8ArrayList([]) // false\n * isUint8ArrayList(new Uint8ArrayList()) // true\n * ```\n */\nfunction isUint8ArrayList(value) {\n return Boolean(value?.[symbol]);\n}\nclass Uint8ArrayList {\n bufs;\n length;\n [symbol] = true;\n constructor(...data) {\n this.bufs = [];\n this.length = 0;\n if (data.length > 0) {\n this.appendAll(data);\n }\n }\n *[Symbol.iterator]() {\n yield* this.bufs;\n }\n get byteLength() {\n return this.length;\n }\n /**\n * Add one or more `bufs` to the end of this Uint8ArrayList\n */\n append(...bufs) {\n this.appendAll(bufs);\n }\n /**\n * Add all `bufs` to the end of this Uint8ArrayList\n */\n appendAll(bufs) {\n let length = 0;\n for (const buf of bufs) {\n if (buf instanceof Uint8Array) {\n length += buf.byteLength;\n this.bufs.push(buf);\n }\n else if (isUint8ArrayList(buf)) {\n length += buf.byteLength;\n this.bufs.push(...buf.bufs);\n }\n else {\n throw new Error('Could not append value, must be an Uint8Array or a Uint8ArrayList');\n }\n }\n this.length += length;\n }\n /**\n * Add one or more `bufs` to the start of this Uint8ArrayList\n */\n prepend(...bufs) {\n this.prependAll(bufs);\n }\n /**\n * Add all `bufs` to the start of this Uint8ArrayList\n */\n prependAll(bufs) {\n let length = 0;\n for (const buf of bufs.reverse()) {\n if (buf instanceof Uint8Array) {\n length += buf.byteLength;\n this.bufs.unshift(buf);\n }\n else if (isUint8ArrayList(buf)) {\n length += buf.byteLength;\n this.bufs.unshift(...buf.bufs);\n }\n else {\n throw new Error('Could not prepend value, must be an Uint8Array or a Uint8ArrayList');\n }\n }\n this.length += length;\n }\n /**\n * Read the value at `index`\n */\n get(index) {\n const res = findBufAndOffset(this.bufs, index);\n return res.buf[res.index];\n }\n /**\n * Set the value at `index` to `value`\n */\n set(index, value) {\n const res = findBufAndOffset(this.bufs, index);\n res.buf[res.index] = value;\n }\n /**\n * Copy bytes from `buf` to the index specified by `offset`\n */\n write(buf, offset = 0) {\n if (buf instanceof Uint8Array) {\n for (let i = 0; i < buf.length; i++) {\n this.set(offset + i, buf[i]);\n }\n }\n else if (isUint8ArrayList(buf)) {\n for (let i = 0; i < buf.length; i++) {\n this.set(offset + i, buf.get(i));\n }\n }\n else {\n throw new Error('Could not write value, must be an Uint8Array or a Uint8ArrayList');\n }\n }\n /**\n * Remove bytes from the front of the pool\n */\n consume(bytes) {\n // first, normalize the argument, in accordance with how Buffer does it\n bytes = Math.trunc(bytes);\n // do nothing if not a positive number\n if (Number.isNaN(bytes) || bytes <= 0) {\n return;\n }\n // if consuming all bytes, skip iterating\n if (bytes === this.byteLength) {\n this.bufs = [];\n this.length = 0;\n return;\n }\n while (this.bufs.length > 0) {\n if (bytes >= this.bufs[0].byteLength) {\n bytes -= this.bufs[0].byteLength;\n this.length -= this.bufs[0].byteLength;\n this.bufs.shift();\n }\n else {\n this.bufs[0] = this.bufs[0].subarray(bytes);\n this.length -= bytes;\n break;\n }\n }\n }\n /**\n * Extracts a section of an array and returns a new array.\n *\n * This is a copy operation as it is with Uint8Arrays and Arrays\n * - note this is different to the behaviour of Node Buffers.\n */\n slice(beginInclusive, endExclusive) {\n const { bufs, length } = this._subList(beginInclusive, endExclusive);\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__.concat)(bufs, length);\n }\n /**\n * Returns a alloc from the given start and end element index.\n *\n * In the best case where the data extracted comes from a single Uint8Array\n * internally this is a no-copy operation otherwise it is a copy operation.\n */\n subarray(beginInclusive, endExclusive) {\n const { bufs, length } = this._subList(beginInclusive, endExclusive);\n if (bufs.length === 1) {\n return bufs[0];\n }\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__.concat)(bufs, length);\n }\n /**\n * Returns a allocList from the given start and end element index.\n *\n * This is a no-copy operation.\n */\n sublist(beginInclusive, endExclusive) {\n const { bufs, length } = this._subList(beginInclusive, endExclusive);\n const list = new Uint8ArrayList();\n list.length = length;\n // don't loop, just set the bufs\n list.bufs = [...bufs];\n return list;\n }\n _subList(beginInclusive, endExclusive) {\n beginInclusive = beginInclusive ?? 0;\n endExclusive = endExclusive ?? this.length;\n if (beginInclusive < 0) {\n beginInclusive = this.length + beginInclusive;\n }\n if (endExclusive < 0) {\n endExclusive = this.length + endExclusive;\n }\n if (beginInclusive < 0 || endExclusive > this.length) {\n throw new RangeError('index is out of bounds');\n }\n if (beginInclusive === endExclusive) {\n return { bufs: [], length: 0 };\n }\n if (beginInclusive === 0 && endExclusive === this.length) {\n return { bufs: this.bufs, length: this.length };\n }\n const bufs = [];\n let offset = 0;\n for (let i = 0; i < this.bufs.length; i++) {\n const buf = this.bufs[i];\n const bufStart = offset;\n const bufEnd = bufStart + buf.byteLength;\n // for next loop\n offset = bufEnd;\n if (beginInclusive >= bufEnd) {\n // start after this buf\n continue;\n }\n const sliceStartInBuf = beginInclusive >= bufStart && beginInclusive < bufEnd;\n const sliceEndsInBuf = endExclusive > bufStart && endExclusive <= bufEnd;\n if (sliceStartInBuf && sliceEndsInBuf) {\n // slice is wholly contained within this buffer\n if (beginInclusive === bufStart && endExclusive === bufEnd) {\n // requested whole buffer\n bufs.push(buf);\n break;\n }\n // requested part of buffer\n const start = beginInclusive - bufStart;\n bufs.push(buf.subarray(start, start + (endExclusive - beginInclusive)));\n break;\n }\n if (sliceStartInBuf) {\n // slice starts in this buffer\n if (beginInclusive === 0) {\n // requested whole buffer\n bufs.push(buf);\n continue;\n }\n // requested part of buffer\n bufs.push(buf.subarray(beginInclusive - bufStart));\n continue;\n }\n if (sliceEndsInBuf) {\n if (endExclusive === bufEnd) {\n // requested whole buffer\n bufs.push(buf);\n break;\n }\n // requested part of buffer\n bufs.push(buf.subarray(0, endExclusive - bufStart));\n break;\n }\n // slice started before this buffer and ends after it\n bufs.push(buf);\n }\n return { bufs, length: endExclusive - beginInclusive };\n }\n indexOf(search, offset = 0) {\n if (!isUint8ArrayList(search) && !(search instanceof Uint8Array)) {\n throw new TypeError('The \"value\" argument must be a Uint8ArrayList or Uint8Array');\n }\n const needle = search instanceof Uint8Array ? search : search.subarray();\n offset = Number(offset ?? 0);\n if (isNaN(offset)) {\n offset = 0;\n }\n if (offset < 0) {\n offset = this.length + offset;\n }\n if (offset < 0) {\n offset = 0;\n }\n if (search.length === 0) {\n return offset > this.length ? this.length : offset;\n }\n // https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithm\n const M = needle.byteLength;\n if (M === 0) {\n throw new TypeError('search must be at least 1 byte long');\n }\n // radix\n const radix = 256;\n const rightmostPositions = new Int32Array(radix);\n // position of the rightmost occurrence of the byte c in the pattern\n for (let c = 0; c < radix; c++) {\n // -1 for bytes not in pattern\n rightmostPositions[c] = -1;\n }\n for (let j = 0; j < M; j++) {\n // rightmost position for bytes in pattern\n rightmostPositions[needle[j]] = j;\n }\n // Return offset of first match, -1 if no match\n const right = rightmostPositions;\n const lastIndex = this.byteLength - needle.byteLength;\n const lastPatIndex = needle.byteLength - 1;\n let skip;\n for (let i = offset; i <= lastIndex; i += skip) {\n skip = 0;\n for (let j = lastPatIndex; j >= 0; j--) {\n const char = this.get(i + j);\n if (needle[j] !== char) {\n skip = Math.max(1, j - right[char]);\n break;\n }\n }\n if (skip === 0) {\n return i;\n }\n }\n return -1;\n }\n getInt8(byteOffset) {\n const buf = this.subarray(byteOffset, byteOffset + 1);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getInt8(0);\n }\n setInt8(byteOffset, value) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(1);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setInt8(0, value);\n this.write(buf, byteOffset);\n }\n getInt16(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 2);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getInt16(0, littleEndian);\n }\n setInt16(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(2);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setInt16(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getInt32(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getInt32(0, littleEndian);\n }\n setInt32(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setInt32(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getBigInt64(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getBigInt64(0, littleEndian);\n }\n setBigInt64(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setBigInt64(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getUint8(byteOffset) {\n const buf = this.subarray(byteOffset, byteOffset + 1);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getUint8(0);\n }\n setUint8(byteOffset, value) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(1);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setUint8(0, value);\n this.write(buf, byteOffset);\n }\n getUint16(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 2);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getUint16(0, littleEndian);\n }\n setUint16(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(2);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setUint16(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getUint32(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getUint32(0, littleEndian);\n }\n setUint32(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setUint32(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getBigUint64(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getBigUint64(0, littleEndian);\n }\n setBigUint64(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setBigUint64(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getFloat32(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getFloat32(0, littleEndian);\n }\n setFloat32(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setFloat32(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getFloat64(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getFloat64(0, littleEndian);\n }\n setFloat64(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_0__.alloc)(8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setFloat64(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n equals(other) {\n if (other == null) {\n return false;\n }\n if (!(other instanceof Uint8ArrayList)) {\n return false;\n }\n if (other.bufs.length !== this.bufs.length) {\n return false;\n }\n for (let i = 0; i < this.bufs.length; i++) {\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.bufs[i], other.bufs[i])) {\n return false;\n }\n }\n return true;\n }\n /**\n * Create a Uint8ArrayList from a pre-existing list of Uint8Arrays. Use this\n * method if you know the total size of all the Uint8Arrays ahead of time.\n */\n static fromUint8Arrays(bufs, length) {\n const list = new Uint8ArrayList();\n list.bufs = bufs;\n if (length == null) {\n length = bufs.reduce((acc, curr) => acc + curr.byteLength, 0);\n }\n list.length = length;\n return list;\n }\n}\n/*\nfunction indexOf (needle: Uint8Array, haystack: Uint8Array, offset = 0) {\n for (let i = offset; i < haystack.byteLength; i++) {\n for (let j = 0; j < needle.length; j++) {\n if (haystack[i + j] !== needle[j]) {\n break\n }\n\n if (j === needle.byteLength -1) {\n return i\n }\n }\n\n if (haystack.byteLength - i < needle.byteLength) {\n break\n }\n }\n\n return -1\n}\n*/\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arraylist/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/concat.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/concat.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ concat: () => (/* binding */ concat)\n/* harmony export */ });\n/* harmony import */ var _alloc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #alloc */ \"./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! #util/as-uint8array */ \"./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Uint8Arrays\n */\nfunction concat(arrays, length) {\n if (length == null) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n const output = (0,_alloc__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(length);\n let offset = 0;\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n return (0,_util_as_uint8array__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(output);\n}\n//# sourceMappingURL=concat.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/concat.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/equals.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/equals.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/util/as-uint8array.js":
|
||
/*!*********************************************************************************************!*\
|
||
!*** ./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/util/as-uint8array.js ***!
|
||
\*********************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asUint8Array: () => (/* binding */ asUint8Array)\n/* harmony export */ });\n/**\n * To guarantee Uint8Array semantics, convert nodejs Buffers\n * into vanilla Uint8Arrays\n */\nfunction asUint8Array(buf) {\n return buf;\n}\n//# sourceMappingURL=as-uint8array.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arraylist/node_modules/uint8arrays/dist/src/util/as-uint8array.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/dist/src/alloc.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/uint8arrays/dist/src/alloc.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n if (globalThis.Buffer?.alloc != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__.asUint8Array)(globalThis.Buffer.alloc(size));\n }\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n if (globalThis.Buffer?.allocUnsafe != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__.asUint8Array)(globalThis.Buffer.allocUnsafe(size));\n }\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/dist/src/alloc.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/dist/src/compare.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/uint8arrays/dist/src/compare.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compare: () => (/* binding */ compare)\n/* harmony export */ });\n/**\n * Can be used with Array.sort to sort and array with Uint8Array entries\n */\nfunction compare(a, b) {\n if (globalThis.Buffer != null) {\n return globalThis.Buffer.compare(a, b);\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] < b[i]) {\n return -1;\n }\n if (a[i] > b[i]) {\n return 1;\n }\n }\n if (a.byteLength > b.byteLength) {\n return 1;\n }\n if (a.byteLength < b.byteLength) {\n return -1;\n }\n return 0;\n}\n//# sourceMappingURL=compare.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/dist/src/compare.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/dist/src/concat.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/uint8arrays/dist/src/concat.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ concat: () => (/* binding */ concat)\n/* harmony export */ });\n/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./alloc.js */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns a new Uint8Array created by concatenating the passed ArrayLikes\n */\nfunction concat(arrays, length) {\n if (length == null) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n const output = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(length);\n let offset = 0;\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(output);\n}\n//# sourceMappingURL=concat.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/dist/src/concat.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/dist/src/equals.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/uint8arrays/dist/src/equals.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/dist/src/equals.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/dist/src/from-string.js":
|
||
/*!**********************************************************!*\
|
||
!*** ./node_modules/uint8arrays/dist/src/from-string.js ***!
|
||
\**********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/uint8arrays/dist/src/util/bases.js\");\n\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__.asUint8Array)(globalThis.Buffer.from(string, 'utf-8'));\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/dist/src/from-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/dist/src/index.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/uint8arrays/dist/src/index.js ***!
|
||
\****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compare: () => (/* reexport safe */ _compare_js__WEBPACK_IMPORTED_MODULE_0__.compare),\n/* harmony export */ concat: () => (/* reexport safe */ _concat_js__WEBPACK_IMPORTED_MODULE_1__.concat),\n/* harmony export */ equals: () => (/* reexport safe */ _equals_js__WEBPACK_IMPORTED_MODULE_2__.equals),\n/* harmony export */ fromString: () => (/* reexport safe */ _from_string_js__WEBPACK_IMPORTED_MODULE_3__.fromString),\n/* harmony export */ toString: () => (/* reexport safe */ _to_string_js__WEBPACK_IMPORTED_MODULE_4__.toString),\n/* harmony export */ xor: () => (/* reexport safe */ _xor_js__WEBPACK_IMPORTED_MODULE_5__.xor)\n/* harmony export */ });\n/* harmony import */ var _compare_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./compare.js */ \"./node_modules/uint8arrays/dist/src/compare.js\");\n/* harmony import */ var _concat_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./concat.js */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var _equals_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./equals.js */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _from_string_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./from-string.js */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _to_string_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./to-string.js */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _xor_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./xor.js */ \"./node_modules/uint8arrays/dist/src/xor.js\");\n/**\n * @packageDocumentation\n *\n * `Uint8Array`s bring memory-efficient(ish) byte handling to browsers - they are similar to Node.js `Buffer`s but lack a lot of the utility methods present on that class.\n *\n * This module exports a number of function that let you do common operations - joining Uint8Arrays together, seeing if they have the same contents etc.\n *\n * Since Node.js `Buffer`s are also `Uint8Array`s, it falls back to `Buffer` internally where it makes sense for performance reasons.\n *\n * ## alloc(size)\n *\n * Create a new `Uint8Array`. If `globalThis.Buffer` is defined, it will be used in preference to `globalThis.Uint8Array`.\n *\n * ### Example\n *\n * ```js\n * import { alloc } from 'uint8arrays/alloc'\n *\n * const buf = alloc(100)\n * ```\n *\n * ## allocUnsafe(size)\n *\n * Create a new `Uint8Array`. If `globalThis.Buffer` is defined, it will be used in preference to `globalThis.Uint8Array`.\n *\n * On platforms that support it, memory referenced by the returned `Uint8Array` will not be initialized.\n *\n * ### Example\n *\n * ```js\n * import { allocUnsafe } from 'uint8arrays/alloc'\n *\n * const buf = allocUnsafe(100)\n * ```\n *\n * ## compare(a, b)\n *\n * Compare two `Uint8Arrays`\n *\n * ### Example\n *\n * ```js\n * import { compare } from 'uint8arrays/compare'\n *\n * const arrays = [\n * Uint8Array.from([3, 4, 5]),\n * Uint8Array.from([0, 1, 2])\n * ]\n *\n * const sorted = arrays.sort(compare)\n *\n * console.info(sorted)\n * // [\n * // Uint8Array[0, 1, 2]\n * // Uint8Array[3, 4, 5]\n * // ]\n * ```\n *\n * ## concat(arrays, \\[length])\n *\n * Concatenate one or more `Uint8Array`s and return a `Uint8Array` with their contents.\n *\n * If you know the length of the arrays, pass it as a second parameter, otherwise it will be calculated by traversing the list of arrays.\n *\n * ### Example\n *\n * ```js\n * import { concat } from 'uint8arrays/concat'\n *\n * const arrays = [\n * Uint8Array.from([0, 1, 2]),\n * Uint8Array.from([3, 4, 5])\n * ]\n *\n * const all = concat(arrays, 6)\n *\n * console.info(all)\n * // Uint8Array[0, 1, 2, 3, 4, 5]\n * ```\n *\n * ## equals(a, b)\n *\n * Returns true if the two arrays are the same array or if they have the same length and contents.\n *\n * ### Example\n *\n * ```js\n * import { equals } from 'uint8arrays/equals'\n *\n * const a = Uint8Array.from([0, 1, 2])\n * const b = Uint8Array.from([3, 4, 5])\n * const c = Uint8Array.from([0, 1, 2])\n *\n * console.info(equals(a, b)) // false\n * console.info(equals(a, c)) // true\n * console.info(equals(a, a)) // true\n * ```\n *\n * ## fromString(string, encoding = 'utf8')\n *\n * Returns a new `Uint8Array` created from the passed string and interpreted as the passed encoding.\n *\n * Supports `utf8` and any of the [multibase encodings](https://github.com/multiformats/multibase/blob/master/multibase.csv) as implemented by the [multiformats module](https://www.npmjs.com/package/multiformats).\n *\n * ### Example\n *\n * ```js\n * import { fromString } from 'uint8arrays/from-string'\n *\n * console.info(fromString('hello world')) // Uint8Array[104, 101 ...\n * console.info(fromString('00010203aabbcc', 'base16')) // Uint8Array[0, 1 ...\n * console.info(fromString('AAECA6q7zA', 'base64')) // Uint8Array[0, 1 ...\n * console.info(fromString('01234', 'ascii')) // Uint8Array[48, 49 ...\n * ```\n *\n * ## toString(array, encoding = 'utf8')\n *\n * Returns a string created from the passed `Uint8Array` in the passed encoding.\n *\n * Supports `utf8` and any of the [multibase encodings](https://github.com/multiformats/multibase/blob/master/multibase.csv) as implemented by the [multiformats module](https://www.npmjs.com/package/multiformats).\n *\n * ### Example\n *\n * ```js\n * import { toString } from 'uint8arrays/to-string'\n *\n * console.info(toString(Uint8Array.from([104, 101...]))) // 'hello world'\n * console.info(toString(Uint8Array.from([0, 1, 2...]), 'base16')) // '00010203aabbcc'\n * console.info(toString(Uint8Array.from([0, 1, 2...]), 'base64')) // 'AAECA6q7zA'\n * console.info(toString(Uint8Array.from([48, 49, 50...]), 'ascii')) // '01234'\n * ```\n *\n * ## xor(a, b)\n *\n * Returns a `Uint8Array` containing `a` and `b` xored together.\n *\n * ### Example\n *\n * ```js\n * import { xor } from 'uint8arrays/xor'\n *\n * console.info(xor(Uint8Array.from([1, 0]), Uint8Array.from([0, 1]))) // Uint8Array[1, 1]\n * ```\n */\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/dist/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/dist/src/to-string.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/uint8arrays/dist/src/to-string.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) {\n return globalThis.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString('utf8');\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/dist/src/to-string.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/dist/src/util/as-uint8array.js":
|
||
/*!*****************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/dist/src/util/as-uint8array.js ***!
|
||
\*****************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asUint8Array: () => (/* binding */ asUint8Array)\n/* harmony export */ });\n/**\n * To guarantee Uint8Array semantics, convert nodejs Buffers\n * into vanilla Uint8Arrays\n */\nfunction asUint8Array(buf) {\n if (globalThis.Buffer != null) {\n return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n }\n return buf;\n}\n//# sourceMappingURL=as-uint8array.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/dist/src/util/as-uint8array.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/dist/src/util/bases.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/uint8arrays/dist/src/util/bases.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/uint8arrays/node_modules/multiformats/src/basics.js\");\n/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../alloc.js */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/dist/src/util/bases.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/dist/src/xor.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/uint8arrays/dist/src/xor.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ xor: () => (/* binding */ xor)\n/* harmony export */ });\n/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./alloc.js */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns the xor distance between two arrays\n */\nfunction xor(a, b) {\n if (a.length !== b.length) {\n throw new Error('Inputs should have the same length');\n }\n const result = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(a.length);\n for (let i = 0; i < a.length; i++) {\n result[i] = a[i] ^ b[i];\n }\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(result);\n}\n//# sourceMappingURL=xor.js.map\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/dist/src/xor.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Codec: () => (/* binding */ Codec),\n/* harmony export */ baseX: () => (/* binding */ baseX),\n/* harmony export */ from: () => (/* binding */ from),\n/* harmony export */ or: () => (/* binding */ or),\n/* harmony export */ rfc4648: () => (/* binding */ rfc4648)\n/* harmony export */ });\n/* harmony import */ var _vendor_base_x_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../vendor/base-x.js */ \"./node_modules/uint8arrays/node_modules/multiformats/vendor/base-x.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bytes.js\");\n/* harmony import */ var _interface_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interface.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/interface.js\");\n\n\n// Linter can't see that API is used in types.\n// eslint-disable-next-line\n\n\n/**\n * Class represents both BaseEncoder and MultibaseEncoder meaning it\n * can be used to encode to multibase or base encode without multibase\n * prefix.\n *\n * @class\n * @template {string} Base\n * @template {string} Prefix\n * @implements {API.MultibaseEncoder<Prefix>}\n * @implements {API.BaseEncoder}\n */\nclass Encoder {\n /**\n * @param {Base} name\n * @param {Prefix} prefix\n * @param {(bytes:Uint8Array) => string} baseEncode\n */\n constructor (name, prefix, baseEncode) {\n this.name = name\n this.prefix = prefix\n this.baseEncode = baseEncode\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {API.Multibase<Prefix>}\n */\n encode (bytes) {\n if (bytes instanceof Uint8Array) {\n return `${this.prefix}${this.baseEncode(bytes)}`\n } else {\n throw Error('Unknown type, must be binary type')\n }\n }\n}\n\n/**\n * @template {string} Prefix\n */\n/**\n * Class represents both BaseDecoder and MultibaseDecoder so it could be used\n * to decode multibases (with matching prefix) or just base decode strings\n * with corresponding base encoding.\n *\n * @class\n * @template {string} Base\n * @template {string} Prefix\n * @implements {API.MultibaseDecoder<Prefix>}\n * @implements {API.UnibaseDecoder<Prefix>}\n * @implements {API.BaseDecoder}\n */\nclass Decoder {\n /**\n * @param {Base} name\n * @param {Prefix} prefix\n * @param {(text:string) => Uint8Array} baseDecode\n */\n constructor (name, prefix, baseDecode) {\n this.name = name\n this.prefix = prefix\n /* c8 ignore next 3 */\n if (prefix.codePointAt(0) === undefined) {\n throw new Error('Invalid prefix character')\n }\n /** @private */\n this.prefixCodePoint = /** @type {number} */ (prefix.codePointAt(0))\n this.baseDecode = baseDecode\n }\n\n /**\n * @param {string} text\n */\n decode (text) {\n if (typeof text === 'string') {\n if (text.codePointAt(0) !== this.prefixCodePoint) {\n throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)\n }\n return this.baseDecode(text.slice(this.prefix.length))\n } else {\n throw Error('Can only multibase decode strings')\n }\n }\n\n /**\n * @template {string} OtherPrefix\n * @param {API.UnibaseDecoder<OtherPrefix>|ComposedDecoder<OtherPrefix>} decoder\n * @returns {ComposedDecoder<Prefix|OtherPrefix>}\n */\n or (decoder) {\n return or(this, decoder)\n }\n}\n\n/**\n * @template {string} Prefix\n * @typedef {Record<Prefix, API.UnibaseDecoder<Prefix>>} Decoders\n */\n\n/**\n * @template {string} Prefix\n * @implements {API.MultibaseDecoder<Prefix>}\n * @implements {API.CombobaseDecoder<Prefix>}\n */\nclass ComposedDecoder {\n /**\n * @param {Decoders<Prefix>} decoders\n */\n constructor (decoders) {\n this.decoders = decoders\n }\n\n /**\n * @template {string} OtherPrefix\n * @param {API.UnibaseDecoder<OtherPrefix>|ComposedDecoder<OtherPrefix>} decoder\n * @returns {ComposedDecoder<Prefix|OtherPrefix>}\n */\n or (decoder) {\n return or(this, decoder)\n }\n\n /**\n * @param {string} input\n * @returns {Uint8Array}\n */\n decode (input) {\n const prefix = /** @type {Prefix} */ (input[0])\n const decoder = this.decoders[prefix]\n if (decoder) {\n return decoder.decode(input)\n } else {\n throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)\n }\n }\n}\n\n/**\n * @template {string} L\n * @template {string} R\n * @param {API.UnibaseDecoder<L>|API.CombobaseDecoder<L>} left\n * @param {API.UnibaseDecoder<R>|API.CombobaseDecoder<R>} right\n * @returns {ComposedDecoder<L|R>}\n */\nconst or = (left, right) => new ComposedDecoder(/** @type {Decoders<L|R>} */({\n ...(left.decoders || { [/** @type API.UnibaseDecoder<L> */(left).prefix]: left }),\n ...(right.decoders || { [/** @type API.UnibaseDecoder<R> */(right).prefix]: right })\n}))\n\n/**\n * @class\n * @template {string} Base\n * @template {string} Prefix\n * @implements {API.MultibaseCodec<Prefix>}\n * @implements {API.MultibaseEncoder<Prefix>}\n * @implements {API.MultibaseDecoder<Prefix>}\n * @implements {API.BaseCodec}\n * @implements {API.BaseEncoder}\n * @implements {API.BaseDecoder}\n */\nclass Codec {\n /**\n * @param {Base} name\n * @param {Prefix} prefix\n * @param {(bytes:Uint8Array) => string} baseEncode\n * @param {(text:string) => Uint8Array} baseDecode\n */\n constructor (name, prefix, baseEncode, baseDecode) {\n this.name = name\n this.prefix = prefix\n this.baseEncode = baseEncode\n this.baseDecode = baseDecode\n this.encoder = new Encoder(name, prefix, baseEncode)\n this.decoder = new Decoder(name, prefix, baseDecode)\n }\n\n /**\n * @param {Uint8Array} input\n */\n encode (input) {\n return this.encoder.encode(input)\n }\n\n /**\n * @param {string} input\n */\n decode (input) {\n return this.decoder.decode(input)\n }\n}\n\n/**\n * @template {string} Base\n * @template {string} Prefix\n * @param {object} options\n * @param {Base} options.name\n * @param {Prefix} options.prefix\n * @param {(bytes:Uint8Array) => string} options.encode\n * @param {(input:string) => Uint8Array} options.decode\n * @returns {Codec<Base, Prefix>}\n */\nconst from = ({ name, prefix, encode, decode }) =>\n new Codec(name, prefix, encode, decode)\n\n/**\n * @template {string} Base\n * @template {string} Prefix\n * @param {object} options\n * @param {Base} options.name\n * @param {Prefix} options.prefix\n * @param {string} options.alphabet\n * @returns {Codec<Base, Prefix>}\n */\nconst baseX = ({ prefix, name, alphabet }) => {\n const { encode, decode } = (0,_vendor_base_x_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(alphabet, name)\n return from({\n prefix,\n name,\n encode,\n /**\n * @param {string} text\n */\n decode: text => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_1__.coerce)(decode(text))\n })\n}\n\n/**\n * @param {string} string\n * @param {string} alphabet\n * @param {number} bitsPerChar\n * @param {string} name\n * @returns {Uint8Array}\n */\nconst decode = (string, alphabet, bitsPerChar, name) => {\n // Build the character lookup table:\n /** @type {Record<string, number>} */\n const codes = {}\n for (let i = 0; i < alphabet.length; ++i) {\n codes[alphabet[i]] = i\n }\n\n // Count the padding bytes:\n let end = string.length\n while (string[end - 1] === '=') {\n --end\n }\n\n // Allocate the output:\n const out = new Uint8Array((end * bitsPerChar / 8) | 0)\n\n // Parse the data:\n let bits = 0 // Number of bits currently in the buffer\n let buffer = 0 // Bits waiting to be written out, MSB first\n let written = 0 // Next byte to write\n for (let i = 0; i < end; ++i) {\n // Read one character from the string:\n const value = codes[string[i]]\n if (value === undefined) {\n throw new SyntaxError(`Non-${name} character`)\n }\n\n // Append the bits to the buffer:\n buffer = (buffer << bitsPerChar) | value\n bits += bitsPerChar\n\n // Write out some bits if the buffer has a byte's worth:\n if (bits >= 8) {\n bits -= 8\n out[written++] = 0xff & (buffer >> bits)\n }\n }\n\n // Verify that we have received just enough bits:\n if (bits >= bitsPerChar || 0xff & (buffer << (8 - bits))) {\n throw new SyntaxError('Unexpected end of data')\n }\n\n return out\n}\n\n/**\n * @param {Uint8Array} data\n * @param {string} alphabet\n * @param {number} bitsPerChar\n * @returns {string}\n */\nconst encode = (data, alphabet, bitsPerChar) => {\n const pad = alphabet[alphabet.length - 1] === '='\n const mask = (1 << bitsPerChar) - 1\n let out = ''\n\n let bits = 0 // Number of bits currently in the buffer\n let buffer = 0 // Bits waiting to be written out, MSB first\n for (let i = 0; i < data.length; ++i) {\n // Slurp data into the buffer:\n buffer = (buffer << 8) | data[i]\n bits += 8\n\n // Write out as much as we can:\n while (bits > bitsPerChar) {\n bits -= bitsPerChar\n out += alphabet[mask & (buffer >> bits)]\n }\n }\n\n // Partial character:\n if (bits) {\n out += alphabet[mask & (buffer << (bitsPerChar - bits))]\n }\n\n // Add padding characters until we hit a byte boundary:\n if (pad) {\n while ((out.length * bitsPerChar) & 7) {\n out += '='\n }\n }\n\n return out\n}\n\n/**\n * RFC4648 Factory\n *\n * @template {string} Base\n * @template {string} Prefix\n * @param {object} options\n * @param {Base} options.name\n * @param {Prefix} options.prefix\n * @param {string} options.alphabet\n * @param {number} options.bitsPerChar\n */\nconst rfc4648 = ({ name, prefix, bitsPerChar, alphabet }) => {\n return from({\n prefix,\n name,\n encode (input) {\n return encode(input, alphabet, bitsPerChar)\n },\n decode (input) {\n return decode(input, alphabet, bitsPerChar, name)\n }\n })\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/base10.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/base10.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base10: () => (/* binding */ base10)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js\");\n\n\nconst base10 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: '9',\n name: 'base10',\n alphabet: '0123456789'\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/base10.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/base16.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/base16.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base16: () => (/* binding */ base16),\n/* harmony export */ base16upper: () => (/* binding */ base16upper)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js\");\n// @ts-check\n\n\n\nconst base16 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'f',\n name: 'base16',\n alphabet: '0123456789abcdef',\n bitsPerChar: 4\n})\n\nconst base16upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'F',\n name: 'base16upper',\n alphabet: '0123456789ABCDEF',\n bitsPerChar: 4\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/base16.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/base2.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/base2.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base2: () => (/* binding */ base2)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js\");\n// @ts-check\n\n\n\nconst base2 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: '0',\n name: 'base2',\n alphabet: '01',\n bitsPerChar: 1\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/base2.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/base256emoji.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/base256emoji.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base256emoji: () => (/* binding */ base256emoji)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js\");\n\n\nconst alphabet = Array.from('🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂')\nconst alphabetBytesToChars = /** @type {string[]} */ (alphabet.reduce((p, c, i) => { p[i] = c; return p }, /** @type {string[]} */([])))\nconst alphabetCharsToBytes = /** @type {number[]} */ (alphabet.reduce((p, c, i) => { p[/** @type {number} */ (c.codePointAt(0))] = i; return p }, /** @type {number[]} */([])))\n\n/**\n * @param {Uint8Array} data\n * @returns {string}\n */\nfunction encode (data) {\n return data.reduce((p, c) => {\n p += alphabetBytesToChars[c]\n return p\n }, '')\n}\n\n/**\n * @param {string} str\n * @returns {Uint8Array}\n */\nfunction decode (str) {\n const byts = []\n for (const char of str) {\n const byt = alphabetCharsToBytes[/** @type {number} */ (char.codePointAt(0))]\n if (byt === undefined) {\n throw new Error(`Non-base256emoji character: ${char}`)\n }\n byts.push(byt)\n }\n return new Uint8Array(byts)\n}\n\nconst base256emoji = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n prefix: '🚀',\n name: 'base256emoji',\n encode,\n decode\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/base256emoji.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/base32.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/base32.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base32: () => (/* binding */ base32),\n/* harmony export */ base32hex: () => (/* binding */ base32hex),\n/* harmony export */ base32hexpad: () => (/* binding */ base32hexpad),\n/* harmony export */ base32hexpadupper: () => (/* binding */ base32hexpadupper),\n/* harmony export */ base32hexupper: () => (/* binding */ base32hexupper),\n/* harmony export */ base32pad: () => (/* binding */ base32pad),\n/* harmony export */ base32padupper: () => (/* binding */ base32padupper),\n/* harmony export */ base32upper: () => (/* binding */ base32upper),\n/* harmony export */ base32z: () => (/* binding */ base32z)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js\");\n\n\nconst base32 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'b',\n name: 'base32',\n alphabet: 'abcdefghijklmnopqrstuvwxyz234567',\n bitsPerChar: 5\n})\n\nconst base32upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'B',\n name: 'base32upper',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',\n bitsPerChar: 5\n})\n\nconst base32pad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'c',\n name: 'base32pad',\n alphabet: 'abcdefghijklmnopqrstuvwxyz234567=',\n bitsPerChar: 5\n})\n\nconst base32padupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'C',\n name: 'base32padupper',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=',\n bitsPerChar: 5\n})\n\nconst base32hex = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'v',\n name: 'base32hex',\n alphabet: '0123456789abcdefghijklmnopqrstuv',\n bitsPerChar: 5\n})\n\nconst base32hexupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'V',\n name: 'base32hexupper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV',\n bitsPerChar: 5\n})\n\nconst base32hexpad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 't',\n name: 'base32hexpad',\n alphabet: '0123456789abcdefghijklmnopqrstuv=',\n bitsPerChar: 5\n})\n\nconst base32hexpadupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'T',\n name: 'base32hexpadupper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV=',\n bitsPerChar: 5\n})\n\nconst base32z = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'h',\n name: 'base32z',\n alphabet: 'ybndrfg8ejkmcpqxot1uwisza345h769',\n bitsPerChar: 5\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/base32.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/base36.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/base36.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base36: () => (/* binding */ base36),\n/* harmony export */ base36upper: () => (/* binding */ base36upper)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js\");\n\n\nconst base36 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: 'k',\n name: 'base36',\n alphabet: '0123456789abcdefghijklmnopqrstuvwxyz'\n})\n\nconst base36upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: 'K',\n name: 'base36upper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/base36.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/base58.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/base58.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base58btc: () => (/* binding */ base58btc),\n/* harmony export */ base58flickr: () => (/* binding */ base58flickr)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js\");\n\n\nconst base58btc = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n name: 'base58btc',\n prefix: 'z',\n alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\n})\n\nconst base58flickr = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n name: 'base58flickr',\n prefix: 'Z',\n alphabet: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/base58.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/base64.js":
|
||
/*!********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/base64.js ***!
|
||
\********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base64: () => (/* binding */ base64),\n/* harmony export */ base64pad: () => (/* binding */ base64pad),\n/* harmony export */ base64url: () => (/* binding */ base64url),\n/* harmony export */ base64urlpad: () => (/* binding */ base64urlpad)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js\");\n// @ts-check\n\n\n\nconst base64 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'm',\n name: 'base64',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\n bitsPerChar: 6\n})\n\nconst base64pad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'M',\n name: 'base64pad',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',\n bitsPerChar: 6\n})\n\nconst base64url = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'u',\n name: 'base64url',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',\n bitsPerChar: 6\n})\n\nconst base64urlpad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'U',\n name: 'base64urlpad',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=',\n bitsPerChar: 6\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/base64.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/base8.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/base8.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base8: () => (/* binding */ base8)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js\");\n// @ts-check\n\n\n\nconst base8 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: '7',\n name: 'base8',\n alphabet: '01234567',\n bitsPerChar: 3\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/base8.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/identity.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/identity.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ identity: () => (/* binding */ identity)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bytes.js\");\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base.js\");\n// @ts-check\n\n\n\n\nconst identity = (0,_base_js__WEBPACK_IMPORTED_MODULE_1__.from)({\n prefix: '\\x00',\n name: 'identity',\n encode: (buf) => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.toString)(buf),\n decode: (str) => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.fromString)(str)\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/identity.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bases/interface.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bases/interface.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n// this is dummy module overlayed by interface.ts\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bases/interface.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/basics.js":
|
||
/*!**************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/basics.js ***!
|
||
\**************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.CID),\n/* harmony export */ bases: () => (/* binding */ bases),\n/* harmony export */ bytes: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.bytes),\n/* harmony export */ codecs: () => (/* binding */ codecs),\n/* harmony export */ digest: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.digest),\n/* harmony export */ hasher: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.hasher),\n/* harmony export */ hashes: () => (/* binding */ hashes),\n/* harmony export */ varint: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.varint)\n/* harmony export */ });\n/* harmony import */ var _bases_base10_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bases/base10.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base10.js\");\n/* harmony import */ var _bases_base16_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bases/base16.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base16.js\");\n/* harmony import */ var _bases_base2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bases/base2.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base2.js\");\n/* harmony import */ var _bases_base256emoji_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bases/base256emoji.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base256emoji.js\");\n/* harmony import */ var _bases_base32_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bases/base32.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base32.js\");\n/* harmony import */ var _bases_base36_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./bases/base36.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base36.js\");\n/* harmony import */ var _bases_base58_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./bases/base58.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base58.js\");\n/* harmony import */ var _bases_base64_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./bases/base64.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base64.js\");\n/* harmony import */ var _bases_base8_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./bases/base8.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base8.js\");\n/* harmony import */ var _bases_identity_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./bases/identity.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/identity.js\");\n/* harmony import */ var _codecs_json_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./codecs/json.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/codecs/json.js\");\n/* harmony import */ var _codecs_raw_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./codecs/raw.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/codecs/raw.js\");\n/* harmony import */ var _hashes_identity_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./hashes/identity.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/hashes/identity.js\");\n/* harmony import */ var _hashes_sha2_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./hashes/sha2.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/hashes/sha2-browser.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./index.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/index.js\");\n// @ts-check\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst bases = { ..._bases_identity_js__WEBPACK_IMPORTED_MODULE_9__, ..._bases_base2_js__WEBPACK_IMPORTED_MODULE_2__, ..._bases_base8_js__WEBPACK_IMPORTED_MODULE_8__, ..._bases_base10_js__WEBPACK_IMPORTED_MODULE_0__, ..._bases_base16_js__WEBPACK_IMPORTED_MODULE_1__, ..._bases_base32_js__WEBPACK_IMPORTED_MODULE_4__, ..._bases_base36_js__WEBPACK_IMPORTED_MODULE_5__, ..._bases_base58_js__WEBPACK_IMPORTED_MODULE_6__, ..._bases_base64_js__WEBPACK_IMPORTED_MODULE_7__, ..._bases_base256emoji_js__WEBPACK_IMPORTED_MODULE_3__ }\nconst hashes = { ..._hashes_sha2_js__WEBPACK_IMPORTED_MODULE_13__, ..._hashes_identity_js__WEBPACK_IMPORTED_MODULE_12__ }\nconst codecs = { raw: _codecs_raw_js__WEBPACK_IMPORTED_MODULE_11__, json: _codecs_json_js__WEBPACK_IMPORTED_MODULE_10__ }\n\n\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/basics.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/bytes.js":
|
||
/*!*************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/bytes.js ***!
|
||
\*************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ coerce: () => (/* binding */ coerce),\n/* harmony export */ empty: () => (/* binding */ empty),\n/* harmony export */ equals: () => (/* binding */ equals),\n/* harmony export */ fromHex: () => (/* binding */ fromHex),\n/* harmony export */ fromString: () => (/* binding */ fromString),\n/* harmony export */ isBinary: () => (/* binding */ isBinary),\n/* harmony export */ toHex: () => (/* binding */ toHex),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\nconst empty = new Uint8Array(0)\n\n/**\n * @param {Uint8Array} d\n */\nconst toHex = d => d.reduce((hex, byte) => hex + byte.toString(16).padStart(2, '0'), '')\n\n/**\n * @param {string} hex\n */\nconst fromHex = hex => {\n const hexes = hex.match(/../g)\n return hexes ? new Uint8Array(hexes.map(b => parseInt(b, 16))) : empty\n}\n\n/**\n * @param {Uint8Array} aa\n * @param {Uint8Array} bb\n */\nconst equals = (aa, bb) => {\n if (aa === bb) return true\n if (aa.byteLength !== bb.byteLength) {\n return false\n }\n\n for (let ii = 0; ii < aa.byteLength; ii++) {\n if (aa[ii] !== bb[ii]) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * @param {ArrayBufferView|ArrayBuffer|Uint8Array} o\n * @returns {Uint8Array}\n */\nconst coerce = o => {\n if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array') return o\n if (o instanceof ArrayBuffer) return new Uint8Array(o)\n if (ArrayBuffer.isView(o)) {\n return new Uint8Array(o.buffer, o.byteOffset, o.byteLength)\n }\n throw new Error('Unknown type, must be binary type')\n}\n\n/**\n * @param {any} o\n * @returns {o is ArrayBuffer|ArrayBufferView}\n */\nconst isBinary = o =>\n o instanceof ArrayBuffer || ArrayBuffer.isView(o)\n\n/**\n * @param {string} str\n * @returns {Uint8Array}\n */\nconst fromString = str => (new TextEncoder()).encode(str)\n\n/**\n * @param {Uint8Array} b\n * @returns {string}\n */\nconst toString = b => (new TextDecoder()).decode(b)\n\n\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/bytes.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/cid.js":
|
||
/*!***********************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/cid.js ***!
|
||
\***********************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* binding */ CID),\n/* harmony export */ format: () => (/* binding */ format),\n/* harmony export */ fromJSON: () => (/* binding */ fromJSON),\n/* harmony export */ toJSON: () => (/* binding */ toJSON)\n/* harmony export */ });\n/* harmony import */ var _bases_base32_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bases/base32.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base32.js\");\n/* harmony import */ var _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bases/base58.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bases/base58.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bytes.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bytes.js\");\n/* harmony import */ var _hashes_digest_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hashes/digest.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/hashes/digest.js\");\n/* harmony import */ var _link_interface_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./link/interface.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/link/interface.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./varint.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/varint.js\");\n\n\n\n\n// Linter can see that API is used in types.\n// eslint-disable-next-line\n\n\n\n// This way TS will also expose all the types from module\n\n\n/**\n * @template {API.Link<unknown, number, number, API.Version>} T\n * @template {string} Prefix\n * @param {T} link\n * @param {API.MultibaseEncoder<Prefix>} [base]\n * @returns {API.ToString<T, Prefix>}\n */\nconst format = (link, base) => {\n const { bytes, version } = link\n switch (version) {\n case 0:\n return toStringV0(\n bytes,\n baseCache(link),\n /** @type {API.MultibaseEncoder<\"z\">} */ (base) || _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.encoder\n )\n default:\n return toStringV1(\n bytes,\n baseCache(link),\n /** @type {API.MultibaseEncoder<Prefix>} */ (base || _bases_base32_js__WEBPACK_IMPORTED_MODULE_0__.base32.encoder)\n )\n }\n}\n\n/**\n * @template {API.UnknownLink} Link\n * @param {Link} link\n * @returns {API.LinkJSON<Link>}\n */\nconst toJSON = (link) => ({\n '/': format(link)\n})\n\n/**\n * @template {API.UnknownLink} Link\n * @param {API.LinkJSON<Link>} json\n */\nconst fromJSON = (json) =>\n CID.parse(json['/'])\n\n/** @type {WeakMap<API.UnknownLink, Map<string, string>>} */\nconst cache = new WeakMap()\n\n/**\n * @param {API.UnknownLink} cid\n * @returns {Map<string, string>}\n */\nconst baseCache = cid => {\n const baseCache = cache.get(cid)\n if (baseCache == null) {\n const baseCache = new Map()\n cache.set(cid, baseCache)\n return baseCache\n }\n return baseCache\n}\n\n/**\n * @template {unknown} [Data=unknown]\n * @template {number} [Format=number]\n * @template {number} [Alg=number]\n * @template {API.Version} [Version=API.Version]\n * @implements {API.Link<Data, Format, Alg, Version>}\n */\n\nclass CID {\n /**\n * @param {Version} version - Version of the CID\n * @param {Format} code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv\n * @param {API.MultihashDigest<Alg>} multihash - (Multi)hash of the of the content.\n * @param {Uint8Array} bytes\n */\n constructor (version, code, multihash, bytes) {\n /** @readonly */\n this.code = code\n /** @readonly */\n this.version = version\n /** @readonly */\n this.multihash = multihash\n /** @readonly */\n this.bytes = bytes\n\n // flag to serializers that this is a CID and\n // should be treated specially\n /** @readonly */\n this['/'] = bytes\n }\n\n /**\n * Signalling `cid.asCID === cid` has been replaced with `cid['/'] === cid.bytes`\n * please either use `CID.asCID(cid)` or switch to new signalling mechanism\n *\n * @deprecated\n */\n get asCID () {\n return this\n }\n\n // ArrayBufferView\n get byteOffset () {\n return this.bytes.byteOffset\n }\n\n // ArrayBufferView\n get byteLength () {\n return this.bytes.byteLength\n }\n\n /**\n * @returns {CID<Data, API.DAG_PB, API.SHA_256, 0>}\n */\n toV0 () {\n switch (this.version) {\n case 0: {\n return /** @type {CID<Data, API.DAG_PB, API.SHA_256, 0>} */ (this)\n }\n case 1: {\n const { code, multihash } = this\n\n if (code !== DAG_PB_CODE) {\n throw new Error('Cannot convert a non dag-pb CID to CIDv0')\n }\n\n // sha2-256\n if (multihash.code !== SHA_256_CODE) {\n throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0')\n }\n\n return /** @type {CID<Data, API.DAG_PB, API.SHA_256, 0>} */ (\n CID.createV0(\n /** @type {API.MultihashDigest<API.SHA_256>} */ (multihash)\n )\n )\n }\n default: {\n throw Error(\n `Can not convert CID version ${this.version} to version 0. This is a bug please report`\n )\n }\n }\n }\n\n /**\n * @returns {CID<Data, Format, Alg, 1>}\n */\n toV1 () {\n switch (this.version) {\n case 0: {\n const { code, digest } = this.multihash\n const multihash = _hashes_digest_js__WEBPACK_IMPORTED_MODULE_3__.create(code, digest)\n return /** @type {CID<Data, Format, Alg, 1>} */ (\n CID.createV1(this.code, multihash)\n )\n }\n case 1: {\n return /** @type {CID<Data, Format, Alg, 1>} */ (this)\n }\n default: {\n throw Error(\n `Can not convert CID version ${this.version} to version 1. This is a bug please report`\n )\n }\n }\n }\n\n /**\n * @param {unknown} other\n * @returns {other is CID<Data, Format, Alg, Version>}\n */\n equals (other) {\n return CID.equals(this, other)\n }\n\n /**\n * @template {unknown} Data\n * @template {number} Format\n * @template {number} Alg\n * @template {API.Version} Version\n * @param {API.Link<Data, Format, Alg, Version>} self\n * @param {unknown} other\n * @returns {other is CID}\n */\n static equals (self, other) {\n const unknown =\n /** @type {{code?:unknown, version?:unknown, multihash?:unknown}} */ (\n other\n )\n return (\n unknown &&\n self.code === unknown.code &&\n self.version === unknown.version &&\n _hashes_digest_js__WEBPACK_IMPORTED_MODULE_3__.equals(self.multihash, unknown.multihash)\n )\n }\n\n /**\n * @param {API.MultibaseEncoder<string>} [base]\n * @returns {string}\n */\n toString (base) {\n return format(this, base)\n }\n\n /**\n * @returns {API.LinkJSON<this>}\n */\n toJSON () {\n return { '/': format(this) }\n }\n\n link () {\n return this\n }\n\n get [Symbol.toStringTag] () {\n return 'CID'\n }\n\n // Legacy\n\n [Symbol.for('nodejs.util.inspect.custom')] () {\n return `CID(${this.toString()})`\n }\n\n /**\n * Takes any input `value` and returns a `CID` instance if it was\n * a `CID` otherwise returns `null`. If `value` is instanceof `CID`\n * it will return value back. If `value` is not instance of this CID\n * class, but is compatible CID it will return new instance of this\n * `CID` class. Otherwise returns null.\n *\n * This allows two different incompatible versions of CID library to\n * co-exist and interop as long as binary interface is compatible.\n *\n * @template {unknown} Data\n * @template {number} Format\n * @template {number} Alg\n * @template {API.Version} Version\n * @template {unknown} U\n * @param {API.Link<Data, Format, Alg, Version>|U} input\n * @returns {CID<Data, Format, Alg, Version>|null}\n */\n static asCID (input) {\n if (input == null) {\n return null\n }\n\n const value = /** @type {any} */ (input)\n if (value instanceof CID) {\n // If value is instance of CID then we're all set.\n return value\n } else if ((value['/'] != null && value['/'] === value.bytes) || value.asCID === value) {\n // If value isn't instance of this CID class but `this.asCID === this` or\n // `value['/'] === value.bytes` is true it is CID instance coming from a\n // different implementation (diff version or duplicate). In that case we\n // rebase it to this `CID` implementation so caller is guaranteed to get\n // instance with expected API.\n const { version, code, multihash, bytes } = value\n return new CID(\n version,\n code,\n /** @type {API.MultihashDigest<Alg>} */ (multihash),\n bytes || encodeCID(version, code, multihash.bytes)\n )\n } else if (value[cidSymbol] === true) {\n // If value is a CID from older implementation that used to be tagged via\n // symbol we still rebase it to the this `CID` implementation by\n // delegating that to a constructor.\n const { version, multihash, code } = value\n const digest =\n /** @type {API.MultihashDigest<Alg>} */\n (_hashes_digest_js__WEBPACK_IMPORTED_MODULE_3__.decode(multihash))\n return CID.create(version, code, digest)\n } else {\n // Otherwise value is not a CID (or an incompatible version of it) in\n // which case we return `null`.\n return null\n }\n }\n\n /**\n *\n * @template {unknown} Data\n * @template {number} Format\n * @template {number} Alg\n * @template {API.Version} Version\n * @param {Version} version - Version of the CID\n * @param {Format} code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv\n * @param {API.MultihashDigest<Alg>} digest - (Multi)hash of the of the content.\n * @returns {CID<Data, Format, Alg, Version>}\n */\n static create (version, code, digest) {\n if (typeof code !== 'number') {\n throw new Error('String codecs are no longer supported')\n }\n\n if (!(digest.bytes instanceof Uint8Array)) {\n throw new Error('Invalid digest')\n }\n\n switch (version) {\n case 0: {\n if (code !== DAG_PB_CODE) {\n throw new Error(\n `Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`\n )\n } else {\n return new CID(version, code, digest, digest.bytes)\n }\n }\n case 1: {\n const bytes = encodeCID(version, code, digest.bytes)\n return new CID(version, code, digest, bytes)\n }\n default: {\n throw new Error('Invalid version')\n }\n }\n }\n\n /**\n * Simplified version of `create` for CIDv0.\n *\n * @template {unknown} [T=unknown]\n * @param {API.MultihashDigest<typeof SHA_256_CODE>} digest - Multihash.\n * @returns {CID<T, typeof DAG_PB_CODE, typeof SHA_256_CODE, 0>}\n */\n static createV0 (digest) {\n return CID.create(0, DAG_PB_CODE, digest)\n }\n\n /**\n * Simplified version of `create` for CIDv1.\n *\n * @template {unknown} Data\n * @template {number} Code\n * @template {number} Alg\n * @param {Code} code - Content encoding format code.\n * @param {API.MultihashDigest<Alg>} digest - Miltihash of the content.\n * @returns {CID<Data, Code, Alg, 1>}\n */\n static createV1 (code, digest) {\n return CID.create(1, code, digest)\n }\n\n /**\n * Decoded a CID from its binary representation. The byte array must contain\n * only the CID with no additional bytes.\n *\n * An error will be thrown if the bytes provided do not contain a valid\n * binary representation of a CID.\n *\n * @template {unknown} Data\n * @template {number} Code\n * @template {number} Alg\n * @template {API.Version} Ver\n * @param {API.ByteView<API.Link<Data, Code, Alg, Ver>>} bytes\n * @returns {CID<Data, Code, Alg, Ver>}\n */\n static decode (bytes) {\n const [cid, remainder] = CID.decodeFirst(bytes)\n if (remainder.length) {\n throw new Error('Incorrect length')\n }\n return cid\n }\n\n /**\n * Decoded a CID from its binary representation at the beginning of a byte\n * array.\n *\n * Returns an array with the first element containing the CID and the second\n * element containing the remainder of the original byte array. The remainder\n * will be a zero-length byte array if the provided bytes only contained a\n * binary CID representation.\n *\n * @template {unknown} T\n * @template {number} C\n * @template {number} A\n * @template {API.Version} V\n * @param {API.ByteView<API.Link<T, C, A, V>>} bytes\n * @returns {[CID<T, C, A, V>, Uint8Array]}\n */\n static decodeFirst (bytes) {\n const specs = CID.inspectBytes(bytes)\n const prefixSize = specs.size - specs.multihashSize\n const multihashBytes = (0,_bytes_js__WEBPACK_IMPORTED_MODULE_2__.coerce)(\n bytes.subarray(prefixSize, prefixSize + specs.multihashSize)\n )\n if (multihashBytes.byteLength !== specs.multihashSize) {\n throw new Error('Incorrect length')\n }\n const digestBytes = multihashBytes.subarray(\n specs.multihashSize - specs.digestSize\n )\n const digest = new _hashes_digest_js__WEBPACK_IMPORTED_MODULE_3__.Digest(\n specs.multihashCode,\n specs.digestSize,\n digestBytes,\n multihashBytes\n )\n const cid =\n specs.version === 0\n ? CID.createV0(/** @type {API.MultihashDigest<API.SHA_256>} */ (digest))\n : CID.createV1(specs.codec, digest)\n return [/** @type {CID<T, C, A, V>} */(cid), bytes.subarray(specs.size)]\n }\n\n /**\n * Inspect the initial bytes of a CID to determine its properties.\n *\n * Involves decoding up to 4 varints. Typically this will require only 4 to 6\n * bytes but for larger multicodec code values and larger multihash digest\n * lengths these varints can be quite large. It is recommended that at least\n * 10 bytes be made available in the `initialBytes` argument for a complete\n * inspection.\n *\n * @template {unknown} T\n * @template {number} C\n * @template {number} A\n * @template {API.Version} V\n * @param {API.ByteView<API.Link<T, C, A, V>>} initialBytes\n * @returns {{ version:V, codec:C, multihashCode:A, digestSize:number, multihashSize:number, size:number }}\n */\n static inspectBytes (initialBytes) {\n let offset = 0\n const next = () => {\n const [i, length] = _varint_js__WEBPACK_IMPORTED_MODULE_5__.decode(initialBytes.subarray(offset))\n offset += length\n return i\n }\n\n let version = /** @type {V} */ (next())\n let codec = /** @type {C} */ (DAG_PB_CODE)\n if (/** @type {number} */(version) === 18) {\n // CIDv0\n version = /** @type {V} */ (0)\n offset = 0\n } else {\n codec = /** @type {C} */ (next())\n }\n\n if (version !== 0 && version !== 1) {\n throw new RangeError(`Invalid CID version ${version}`)\n }\n\n const prefixSize = offset\n const multihashCode = /** @type {A} */ (next()) // multihash code\n const digestSize = next() // multihash length\n const size = offset + digestSize\n const multihashSize = size - prefixSize\n\n return { version, codec, multihashCode, digestSize, multihashSize, size }\n }\n\n /**\n * Takes cid in a string representation and creates an instance. If `base`\n * decoder is not provided will use a default from the configuration. It will\n * throw an error if encoding of the CID is not compatible with supplied (or\n * a default decoder).\n *\n * @template {string} Prefix\n * @template {unknown} Data\n * @template {number} Code\n * @template {number} Alg\n * @template {API.Version} Ver\n * @param {API.ToString<API.Link<Data, Code, Alg, Ver>, Prefix>} source\n * @param {API.MultibaseDecoder<Prefix>} [base]\n * @returns {CID<Data, Code, Alg, Ver>}\n */\n static parse (source, base) {\n const [prefix, bytes] = parseCIDtoBytes(source, base)\n\n const cid = CID.decode(bytes)\n\n if (cid.version === 0 && source[0] !== 'Q') {\n throw Error('Version 0 CID string must not include multibase prefix')\n }\n\n // Cache string representation to avoid computing it on `this.toString()`\n baseCache(cid).set(prefix, source)\n\n return cid\n }\n}\n\n/**\n * @template {string} Prefix\n * @template {unknown} Data\n * @template {number} Code\n * @template {number} Alg\n * @template {API.Version} Ver\n * @param {API.ToString<API.Link<Data, Code, Alg, Ver>, Prefix>} source\n * @param {API.MultibaseDecoder<Prefix>} [base]\n * @returns {[Prefix, API.ByteView<API.Link<Data, Code, Alg, Ver>>]}\n */\nconst parseCIDtoBytes = (source, base) => {\n switch (source[0]) {\n // CIDv0 is parsed differently\n case 'Q': {\n const decoder = base || _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc\n return [\n /** @type {Prefix} */ (_bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.prefix),\n decoder.decode(`${_bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.prefix}${source}`)\n ]\n }\n case _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.prefix: {\n const decoder = base || _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc\n return [/** @type {Prefix} */(_bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.prefix), decoder.decode(source)]\n }\n case _bases_base32_js__WEBPACK_IMPORTED_MODULE_0__.base32.prefix: {\n const decoder = base || _bases_base32_js__WEBPACK_IMPORTED_MODULE_0__.base32\n return [/** @type {Prefix} */(_bases_base32_js__WEBPACK_IMPORTED_MODULE_0__.base32.prefix), decoder.decode(source)]\n }\n default: {\n if (base == null) {\n throw Error(\n 'To parse non base32 or base58btc encoded CID multibase decoder must be provided'\n )\n }\n return [/** @type {Prefix} */(source[0]), base.decode(source)]\n }\n }\n}\n\n/**\n *\n * @param {Uint8Array} bytes\n * @param {Map<string, string>} cache\n * @param {API.MultibaseEncoder<'z'>} base\n */\nconst toStringV0 = (bytes, cache, base) => {\n const { prefix } = base\n if (prefix !== _bases_base58_js__WEBPACK_IMPORTED_MODULE_1__.base58btc.prefix) {\n throw Error(`Cannot string encode V0 in ${base.name} encoding`)\n }\n\n const cid = cache.get(prefix)\n if (cid == null) {\n const cid = base.encode(bytes).slice(1)\n cache.set(prefix, cid)\n return cid\n } else {\n return cid\n }\n}\n\n/**\n * @template {string} Prefix\n * @param {Uint8Array} bytes\n * @param {Map<string, string>} cache\n * @param {API.MultibaseEncoder<Prefix>} base\n */\nconst toStringV1 = (bytes, cache, base) => {\n const { prefix } = base\n const cid = cache.get(prefix)\n if (cid == null) {\n const cid = base.encode(bytes)\n cache.set(prefix, cid)\n return cid\n } else {\n return cid\n }\n}\n\nconst DAG_PB_CODE = 0x70\nconst SHA_256_CODE = 0x12\n\n/**\n * @param {API.Version} version\n * @param {number} code\n * @param {Uint8Array} multihash\n * @returns {Uint8Array}\n */\nconst encodeCID = (version, code, multihash) => {\n const codeOffset = _varint_js__WEBPACK_IMPORTED_MODULE_5__.encodingLength(version)\n const hashOffset = codeOffset + _varint_js__WEBPACK_IMPORTED_MODULE_5__.encodingLength(code)\n const bytes = new Uint8Array(hashOffset + multihash.byteLength)\n _varint_js__WEBPACK_IMPORTED_MODULE_5__.encodeTo(version, bytes, 0)\n _varint_js__WEBPACK_IMPORTED_MODULE_5__.encodeTo(code, bytes, codeOffset)\n bytes.set(multihash, hashOffset)\n return bytes\n}\n\nconst cidSymbol = Symbol.for('@ipld/js-cid/CID')\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/cid.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/codecs/json.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/codecs/json.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ code: () => (/* binding */ code),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\n// @ts-check\n\n/**\n * @template T\n * @typedef {import('./interface.js').ByteView<T>} ByteView\n */\n\nconst textEncoder = new TextEncoder()\nconst textDecoder = new TextDecoder()\n\nconst name = 'json'\nconst code = 0x0200\n\n/**\n * @template T\n * @param {T} node\n * @returns {ByteView<T>}\n */\nconst encode = (node) => textEncoder.encode(JSON.stringify(node))\n\n/**\n * @template T\n * @param {ByteView<T>} data\n * @returns {T}\n */\nconst decode = (data) => JSON.parse(textDecoder.decode(data))\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/codecs/json.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/codecs/raw.js":
|
||
/*!******************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/codecs/raw.js ***!
|
||
\******************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ code: () => (/* binding */ code),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bytes.js\");\n// @ts-check\n\n\n\n/**\n * @template T\n * @typedef {import('./interface.js').ByteView<T>} ByteView\n */\n\nconst name = 'raw'\nconst code = 0x55\n\n/**\n * @param {Uint8Array} node\n * @returns {ByteView<Uint8Array>}\n */\nconst encode = (node) => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(node)\n\n/**\n * @param {ByteView<Uint8Array>} data\n * @returns {Uint8Array}\n */\nconst decode = (data) => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(data)\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/codecs/raw.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/hashes/digest.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/hashes/digest.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Digest: () => (/* binding */ Digest),\n/* harmony export */ create: () => (/* binding */ create),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bytes.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../varint.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/varint.js\");\n\n\n\n/**\n * Creates a multihash digest.\n *\n * @template {number} Code\n * @param {Code} code\n * @param {Uint8Array} digest\n */\nconst create = (code, digest) => {\n const size = digest.byteLength\n const sizeOffset = _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodingLength(code)\n const digestOffset = sizeOffset + _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodingLength(size)\n\n const bytes = new Uint8Array(digestOffset + size)\n _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodeTo(code, bytes, 0)\n _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodeTo(size, bytes, sizeOffset)\n bytes.set(digest, digestOffset)\n\n return new Digest(code, size, digest, bytes)\n}\n\n/**\n * Turns bytes representation of multihash digest into an instance.\n *\n * @param {Uint8Array} multihash\n * @returns {MultihashDigest}\n */\nconst decode = (multihash) => {\n const bytes = (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(multihash)\n const [code, sizeOffset] = _varint_js__WEBPACK_IMPORTED_MODULE_1__.decode(bytes)\n const [size, digestOffset] = _varint_js__WEBPACK_IMPORTED_MODULE_1__.decode(bytes.subarray(sizeOffset))\n const digest = bytes.subarray(sizeOffset + digestOffset)\n\n if (digest.byteLength !== size) {\n throw new Error('Incorrect length')\n }\n\n return new Digest(code, size, digest, bytes)\n}\n\n/**\n * @param {MultihashDigest} a\n * @param {unknown} b\n * @returns {b is MultihashDigest}\n */\nconst equals = (a, b) => {\n if (a === b) {\n return true\n } else {\n const data = /** @type {{code?:unknown, size?:unknown, bytes?:unknown}} */(b)\n\n return (\n a.code === data.code &&\n a.size === data.size &&\n data.bytes instanceof Uint8Array &&\n (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.equals)(a.bytes, data.bytes)\n )\n }\n}\n\n/**\n * @typedef {import('./interface.js').MultihashDigest} MultihashDigest\n */\n\n/**\n * Represents a multihash digest which carries information about the\n * hashing algorithm and an actual hash digest.\n *\n * @template {number} Code\n * @template {number} Size\n * @class\n * @implements {MultihashDigest}\n */\nclass Digest {\n /**\n * Creates a multihash digest.\n *\n * @param {Code} code\n * @param {Size} size\n * @param {Uint8Array} digest\n * @param {Uint8Array} bytes\n */\n constructor (code, size, digest, bytes) {\n this.code = code\n this.size = size\n this.digest = digest\n this.bytes = bytes\n }\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/hashes/digest.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/hashes/hasher.js":
|
||
/*!*********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/hashes/hasher.js ***!
|
||
\*********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Hasher: () => (/* binding */ Hasher),\n/* harmony export */ from: () => (/* binding */ from)\n/* harmony export */ });\n/* harmony import */ var _digest_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./digest.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/hashes/digest.js\");\n\n\n/**\n * @template {string} Name\n * @template {number} Code\n * @param {object} options\n * @param {Name} options.name\n * @param {Code} options.code\n * @param {(input: Uint8Array) => Await<Uint8Array>} options.encode\n */\nconst from = ({ name, code, encode }) => new Hasher(name, code, encode)\n\n/**\n * Hasher represents a hashing algorithm implementation that produces as\n * `MultihashDigest`.\n *\n * @template {string} Name\n * @template {number} Code\n * @class\n * @implements {MultihashHasher<Code>}\n */\nclass Hasher {\n /**\n *\n * @param {Name} name\n * @param {Code} code\n * @param {(input: Uint8Array) => Await<Uint8Array>} encode\n */\n constructor (name, code, encode) {\n this.name = name\n this.code = code\n this.encode = encode\n }\n\n /**\n * @param {Uint8Array} input\n * @returns {Await<Digest.Digest<Code, number>>}\n */\n digest (input) {\n if (input instanceof Uint8Array) {\n const result = this.encode(input)\n return result instanceof Uint8Array\n ? _digest_js__WEBPACK_IMPORTED_MODULE_0__.create(this.code, result)\n /* c8 ignore next 1 */\n : result.then(digest => _digest_js__WEBPACK_IMPORTED_MODULE_0__.create(this.code, digest))\n } else {\n throw Error('Unknown type, must be binary type')\n /* c8 ignore next 1 */\n }\n }\n}\n\n/**\n * @template {number} Alg\n * @typedef {import('./interface.js').MultihashHasher} MultihashHasher\n */\n\n/**\n * @template T\n * @typedef {Promise<T>|T} Await\n */\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/hashes/hasher.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/hashes/identity.js":
|
||
/*!***********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/hashes/identity.js ***!
|
||
\***********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ identity: () => (/* binding */ identity)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bytes.js\");\n/* harmony import */ var _digest_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./digest.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/hashes/digest.js\");\n\n\n\nconst code = 0x0\nconst name = 'identity'\n\n/** @type {(input:Uint8Array) => Uint8Array} */\nconst encode = _bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce\n\n/**\n * @param {Uint8Array} input\n * @returns {Digest.Digest<typeof code, number>}\n */\nconst digest = (input) => _digest_js__WEBPACK_IMPORTED_MODULE_1__.create(code, encode(input))\n\nconst identity = { code, name, encode, digest }\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/hashes/identity.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/hashes/sha2-browser.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/hashes/sha2-browser.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ sha256: () => (/* binding */ sha256),\n/* harmony export */ sha512: () => (/* binding */ sha512)\n/* harmony export */ });\n/* harmony import */ var _hasher_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hasher.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/hashes/hasher.js\");\n/* global crypto */\n\n\n\n/**\n * @param {AlgorithmIdentifier} name\n */\nconst sha = name =>\n /**\n * @param {Uint8Array} data\n */\n async data => new Uint8Array(await crypto.subtle.digest(name, data))\n\nconst sha256 = (0,_hasher_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n name: 'sha2-256',\n code: 0x12,\n encode: sha('SHA-256')\n})\n\nconst sha512 = (0,_hasher_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n name: 'sha2-512',\n code: 0x13,\n encode: sha('SHA-512')\n})\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/hashes/sha2-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/index.js":
|
||
/*!*************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/index.js ***!
|
||
\*************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* reexport safe */ _cid_js__WEBPACK_IMPORTED_MODULE_1__.CID),\n/* harmony export */ bytes: () => (/* reexport module object */ _bytes_js__WEBPACK_IMPORTED_MODULE_0__),\n/* harmony export */ digest: () => (/* reexport module object */ _hashes_digest_js__WEBPACK_IMPORTED_MODULE_2__),\n/* harmony export */ hasher: () => (/* reexport module object */ _hashes_hasher_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ varint: () => (/* reexport module object */ _varint_js__WEBPACK_IMPORTED_MODULE_4__)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bytes.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/bytes.js\");\n/* harmony import */ var _cid_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cid.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/cid.js\");\n/* harmony import */ var _hashes_digest_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hashes/digest.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/hashes/digest.js\");\n/* harmony import */ var _hashes_hasher_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hashes/hasher.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/hashes/hasher.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./varint.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/varint.js\");\n/* harmony import */ var _interface_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./interface.js */ \"./node_modules/uint8arrays/node_modules/multiformats/src/interface.js\");\n\n\n\n\n\n\n// This way TS will also expose all the types from module\n\n\n\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/interface.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/interface.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n// this is dummy module overlayed by interface.ts\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/interface.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/link/interface.js":
|
||
/*!**********************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/link/interface.js ***!
|
||
\**********************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n// this is dummy module overlayed by interface.ts\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/link/interface.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/src/varint.js":
|
||
/*!**************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/src/varint.js ***!
|
||
\**************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encodeTo: () => (/* binding */ encodeTo),\n/* harmony export */ encodingLength: () => (/* binding */ encodingLength)\n/* harmony export */ });\n/* harmony import */ var _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../vendor/varint.js */ \"./node_modules/uint8arrays/node_modules/multiformats/vendor/varint.js\");\n\n\n/**\n * @param {Uint8Array} data\n * @param {number} [offset=0]\n * @returns {[number, number]}\n */\nconst decode = (data, offset = 0) => {\n const code = _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].decode(data, offset)\n return [code, _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].decode.bytes]\n}\n\n/**\n * @param {number} int\n * @param {Uint8Array} target\n * @param {number} [offset=0]\n */\nconst encodeTo = (int, target, offset = 0) => {\n _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].encode(int, target, offset)\n return target\n}\n\n/**\n * @param {number} int\n * @returns {number}\n */\nconst encodingLength = (int) => {\n return _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].encodingLength(int)\n}\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/src/varint.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/vendor/base-x.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/vendor/base-x.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// base-x encoding / decoding\n// Copyright (c) 2018 base-x contributors\n// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)\n// Distributed under the MIT software license, see the accompanying\n// file LICENSE or http://www.opensource.org/licenses/mit-license.php.\nfunction base (ALPHABET, name) {\n if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }\n var BASE_MAP = new Uint8Array(256);\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255;\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i);\n var xc = x.charCodeAt(0);\n if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }\n BASE_MAP[xc] = i;\n }\n var BASE = ALPHABET.length;\n var LEADER = ALPHABET.charAt(0);\n var FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up\n var iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up\n function encode (source) {\n if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);\n } else if (Array.isArray(source)) {\n source = Uint8Array.from(source);\n }\n if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }\n if (source.length === 0) { return '' }\n // Skip & count leading zeroes.\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n // Allocate enough space in big-endian base58 representation.\n var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;\n var b58 = new Uint8Array(size);\n // Process the bytes.\n while (pbegin !== pend) {\n var carry = source[pbegin];\n // Apply \"b58 = b58 * 256 + ch\".\n var i = 0;\n for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {\n carry += (256 * b58[it1]) >>> 0;\n b58[it1] = (carry % BASE) >>> 0;\n carry = (carry / BASE) >>> 0;\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i;\n pbegin++;\n }\n // Skip leading zeroes in base58 result.\n var it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n // Translate the result into a string.\n var str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }\n return str\n }\n function decodeUnsafe (source) {\n if (typeof source !== 'string') { throw new TypeError('Expected String') }\n if (source.length === 0) { return new Uint8Array() }\n var psz = 0;\n // Skip leading spaces.\n if (source[psz] === ' ') { return }\n // Skip and count leading '1's.\n var zeroes = 0;\n var length = 0;\n while (source[psz] === LEADER) {\n zeroes++;\n psz++;\n }\n // Allocate enough space in big-endian base256 representation.\n var size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.\n var b256 = new Uint8Array(size);\n // Process the characters.\n while (source[psz]) {\n // Decode character\n var carry = BASE_MAP[source.charCodeAt(psz)];\n // Invalid character\n if (carry === 255) { return }\n var i = 0;\n for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {\n carry += (BASE * b256[it3]) >>> 0;\n b256[it3] = (carry % 256) >>> 0;\n carry = (carry / 256) >>> 0;\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i;\n psz++;\n }\n // Skip trailing spaces.\n if (source[psz] === ' ') { return }\n // Skip leading zeroes in b256.\n var it4 = size - length;\n while (it4 !== size && b256[it4] === 0) {\n it4++;\n }\n var vch = new Uint8Array(zeroes + (size - it4));\n var j = zeroes;\n while (it4 !== size) {\n vch[j++] = b256[it4++];\n }\n return vch\n }\n function decode (string) {\n var buffer = decodeUnsafe(string);\n if (buffer) { return buffer }\n throw new Error(`Non-${name} character`)\n }\n return {\n encode: encode,\n decodeUnsafe: decodeUnsafe,\n decode: decode\n }\n}\nvar src = base;\n\nvar _brrp__multiformats_scope_baseX = src;\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_brrp__multiformats_scope_baseX);\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/vendor/base-x.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uint8arrays/node_modules/multiformats/vendor/varint.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/uint8arrays/node_modules/multiformats/vendor/varint.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar encode_1 = encode;\n\nvar MSB = 0x80\n , REST = 0x7F\n , MSBALL = ~REST\n , INT = Math.pow(2, 31);\n\nfunction encode(num, out, offset) {\n out = out || [];\n offset = offset || 0;\n var oldOffset = offset;\n\n while(num >= INT) {\n out[offset++] = (num & 0xFF) | MSB;\n num /= 128;\n }\n while(num & MSBALL) {\n out[offset++] = (num & 0xFF) | MSB;\n num >>>= 7;\n }\n out[offset] = num | 0;\n \n encode.bytes = offset - oldOffset + 1;\n \n return out\n}\n\nvar decode = read;\n\nvar MSB$1 = 0x80\n , REST$1 = 0x7F;\n\nfunction read(buf, offset) {\n var res = 0\n , offset = offset || 0\n , shift = 0\n , counter = offset\n , b\n , l = buf.length;\n\n do {\n if (counter >= l) {\n read.bytes = 0;\n throw new RangeError('Could not decode varint')\n }\n b = buf[counter++];\n res += shift < 28\n ? (b & REST$1) << shift\n : (b & REST$1) * Math.pow(2, shift);\n shift += 7;\n } while (b >= MSB$1)\n\n read.bytes = counter - offset;\n\n return res\n}\n\nvar N1 = Math.pow(2, 7);\nvar N2 = Math.pow(2, 14);\nvar N3 = Math.pow(2, 21);\nvar N4 = Math.pow(2, 28);\nvar N5 = Math.pow(2, 35);\nvar N6 = Math.pow(2, 42);\nvar N7 = Math.pow(2, 49);\nvar N8 = Math.pow(2, 56);\nvar N9 = Math.pow(2, 63);\n\nvar length = function (value) {\n return (\n value < N1 ? 1\n : value < N2 ? 2\n : value < N3 ? 3\n : value < N4 ? 4\n : value < N5 ? 5\n : value < N6 ? 6\n : value < N7 ? 7\n : value < N8 ? 8\n : value < N9 ? 9\n : 10\n )\n};\n\nvar varint = {\n encode: encode_1\n , decode: decode\n , encodingLength: length\n};\n\nvar _brrp_varint = varint;\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_brrp_varint);\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/uint8arrays/node_modules/multiformats/vendor/varint.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/utf8-codec/index.mjs":
|
||
/*!*******************************************!*\
|
||
!*** ./node_modules/utf8-codec/index.mjs ***!
|
||
\*******************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ encodingLength: () => (/* binding */ encodingLength),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\nconst SURROGATE_A = 0b1101100000000000\nconst SURROGATE_B = 0b1101110000000000\n\nconst name = 'utf8'\n\nfunction encodingLength (str) {\n let len = 0\n const strLen = str.length\n for (let i = 0; i < strLen; i += 1) {\n const code = str.charCodeAt(i)\n if (code <= 0x7F) {\n len += 1\n } else if (code <= 0x07FF) {\n len += 2\n } else if ((code & 0xF800) !== SURROGATE_A) {\n len += 3\n } else {\n const next = i + 1\n if (next === strLen || code >= SURROGATE_B) {\n len += 3\n } else {\n const nextCode = str.charCodeAt(next)\n if ((nextCode & 0xFC00) !== SURROGATE_B) {\n len += 3\n } else {\n i = next\n len += 4\n }\n }\n }\n }\n return len\n}\n\nfunction encode (str, buf, offset) {\n const strLen = str.length\n if (offset === undefined || offset === null) {\n offset = 0\n }\n if (buf === undefined) {\n buf = new Uint8Array(encodingLength(str) + offset)\n }\n let off = offset\n for (let i = 0; i < strLen; i += 1) {\n let code = str.charCodeAt(i)\n if (code <= 0x7F) {\n buf[off++] = code\n } else if (code <= 0x07FF) {\n buf[off++] = 0b11000000 | ((code & 0b11111000000) >> 6)\n buf[off++] = 0b10000000 | (code & 0b00000111111)\n } else if ((code & 0xF800) !== SURROGATE_A) {\n buf[off++] = 0b11100000 | ((code & 0b1111000000000000) >> 12)\n buf[off++] = 0b10000000 | ((code & 0b0000111111000000) >> 6)\n buf[off++] = 0b10000000 | (code & 0b0000000000111111)\n } else {\n const next = i + 1\n if (next === strLen || code >= SURROGATE_B) {\n // Incorrectly started surrogate pair\n buf[off++] = 0xef\n buf[off++] = 0xbf\n buf[off++] = 0xbd\n } else {\n const nextCode = str.charCodeAt(next)\n if ((nextCode & 0xFC00) !== SURROGATE_B) {\n // Incorrect surrogate pair\n buf[off++] = 0xef\n buf[off++] = 0xbf\n buf[off++] = 0xbd\n } else {\n i = next\n code = 0b000010000000000000000 |\n ((code & 0b1111111111) << 10) |\n (nextCode & 0b1111111111)\n buf[off++] = 0b11110000 | ((code & 0b111000000000000000000) >> 18)\n buf[off++] = 0b10000000 | ((code & 0b000111111000000000000) >> 12)\n buf[off++] = 0b10000000 | ((code & 0b000000000111111000000) >> 6)\n buf[off++] = 0b10000000 | (code & 0b000000000000000111111)\n }\n }\n }\n }\n encode.bytes = off - offset\n return buf\n}\nencode.bytes = 0\n\nfunction decode (buf, start, end) {\n let result = ''\n if (start === undefined || start === null) {\n start = 0\n }\n if (end === undefined || end === null) {\n end = buf.length\n }\n for (let offset = start; offset < end;) {\n const code = buf[offset++]\n let num\n if (code <= 128) {\n num = code\n } else if (code > 191 && code < 224) {\n num = ((code & 0b11111) << 6) | (buf[offset++] & 0b111111)\n } else if (code > 239 && code < 365) {\n num = (\n ((code & 0b111) << 18) |\n ((buf[offset++] & 0b111111) << 12) |\n ((buf[offset++] & 0b111111) << 6) |\n (buf[offset++] & 0b111111)\n ) - 0x10000\n const numA = SURROGATE_A | ((num >> 10) & 0b1111111111)\n result += String.fromCharCode(numA)\n num = SURROGATE_B | (num & 0b1111111111)\n } else {\n num = ((code & 0b1111) << 12) |\n ((buf[offset++] & 0b111111) << 6) |\n (buf[offset++] & 0b111111)\n }\n result += String.fromCharCode(num)\n }\n decode.bytes = end - start\n return result\n}\ndecode.bytes = 0\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/utf8-codec/index.mjs?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/wherearewe/src/index.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/wherearewe/src/index.js ***!
|
||
\**********************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isBrowser: () => (/* binding */ isBrowser),\n/* harmony export */ isElectron: () => (/* binding */ isElectron),\n/* harmony export */ isElectronMain: () => (/* binding */ isElectronMain),\n/* harmony export */ isElectronRenderer: () => (/* binding */ isElectronRenderer),\n/* harmony export */ isEnvWithDom: () => (/* binding */ isEnvWithDom),\n/* harmony export */ isNode: () => (/* binding */ isNode),\n/* harmony export */ isReactNative: () => (/* binding */ isReactNative),\n/* harmony export */ isTest: () => (/* binding */ isTest),\n/* harmony export */ isWebWorker: () => (/* binding */ isWebWorker)\n/* harmony export */ });\n/* harmony import */ var is_electron__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! is-electron */ \"./node_modules/is-electron/index.js\");\n\n\nconst isEnvWithDom = typeof window === 'object' && typeof document === 'object' && document.nodeType === 9\nconst isElectron = is_electron__WEBPACK_IMPORTED_MODULE_0__()\n\n/**\n * Detects browser main thread **NOT** web worker or service worker\n */\nconst isBrowser = isEnvWithDom && !isElectron\nconst isElectronMain = isElectron && !isEnvWithDom\nconst isElectronRenderer = isElectron && isEnvWithDom\nconst isNode = typeof globalThis.process !== 'undefined' && typeof globalThis.process.release !== 'undefined' && globalThis.process.release.name === 'node' && !isElectron\n// @ts-ignore\n// eslint-disable-next-line no-undef\nconst isWebWorker = typeof importScripts === 'function' && typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope\n\n// defeat bundlers replacing process.env.NODE_ENV with \"development\" or whatever\nconst isTest = typeof globalThis.process !== 'undefined' && typeof globalThis.process.env !== 'undefined' && globalThis.process.env['NODE' + (() => '_')() + 'ENV'] === 'test'\nconst isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative'\n\n\n//# sourceURL=webpack://@waku/noise-rtc/./node_modules/wherearewe/src/index.js?");
|
||
|
||
/***/ })
|
||
|
||
/******/ });
|
||
/************************************************************************/
|
||
/******/ // The module cache
|
||
/******/ var __webpack_module_cache__ = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/ // Check if module is in cache
|
||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||
/******/ if (cachedModule !== undefined) {
|
||
/******/ return cachedModule.exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||
/******/ id: moduleId,
|
||
/******/ loaded: false,
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Flag the module as loaded
|
||
/******/ module.loaded = true;
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/************************************************************************/
|
||
/******/ /* webpack/runtime/amd options */
|
||
/******/ (() => {
|
||
/******/ __webpack_require__.amdO = {};
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/compat get default export */
|
||
/******/ (() => {
|
||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||
/******/ __webpack_require__.n = (module) => {
|
||
/******/ var getter = module && module.__esModule ?
|
||
/******/ () => (module['default']) :
|
||
/******/ () => (module);
|
||
/******/ __webpack_require__.d(getter, { a: getter });
|
||
/******/ return getter;
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/create fake namespace object */
|
||
/******/ (() => {
|
||
/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
|
||
/******/ var leafPrototypes;
|
||
/******/ // create a fake namespace object
|
||
/******/ // mode & 1: value is a module id, require it
|
||
/******/ // mode & 2: merge all properties of value into the ns
|
||
/******/ // mode & 4: return value when already ns object
|
||
/******/ // mode & 16: return value when it's Promise-like
|
||
/******/ // mode & 8|1: behave like require
|
||
/******/ __webpack_require__.t = function(value, mode) {
|
||
/******/ if(mode & 1) value = this(value);
|
||
/******/ if(mode & 8) return value;
|
||
/******/ if(typeof value === 'object' && value) {
|
||
/******/ if((mode & 4) && value.__esModule) return value;
|
||
/******/ if((mode & 16) && typeof value.then === 'function') return value;
|
||
/******/ }
|
||
/******/ var ns = Object.create(null);
|
||
/******/ __webpack_require__.r(ns);
|
||
/******/ var def = {};
|
||
/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
|
||
/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
|
||
/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
|
||
/******/ }
|
||
/******/ def['default'] = () => (value);
|
||
/******/ __webpack_require__.d(ns, def);
|
||
/******/ return ns;
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/define property getters */
|
||
/******/ (() => {
|
||
/******/ // define getter functions for harmony exports
|
||
/******/ __webpack_require__.d = (exports, definition) => {
|
||
/******/ for(var key in definition) {
|
||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||
/******/ }
|
||
/******/ }
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/global */
|
||
/******/ (() => {
|
||
/******/ __webpack_require__.g = (function() {
|
||
/******/ if (typeof globalThis === 'object') return globalThis;
|
||
/******/ try {
|
||
/******/ return this || new Function('return this')();
|
||
/******/ } catch (e) {
|
||
/******/ if (typeof window === 'object') return window;
|
||
/******/ }
|
||
/******/ })();
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||
/******/ (() => {
|
||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/make namespace object */
|
||
/******/ (() => {
|
||
/******/ // define __esModule on exports
|
||
/******/ __webpack_require__.r = (exports) => {
|
||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||
/******/ }
|
||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/node module decorator */
|
||
/******/ (() => {
|
||
/******/ __webpack_require__.nmd = (module) => {
|
||
/******/ module.paths = [];
|
||
/******/ if (!module.children) module.children = [];
|
||
/******/ return module;
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/************************************************************************/
|
||
/******/
|
||
/******/ // startup
|
||
/******/ // Load entry module and return exports
|
||
/******/ // This entry module can't be inlined because the eval devtool is used.
|
||
/******/ var __webpack_exports__ = __webpack_require__("./index.js");
|
||
/******/
|
||
/******/ })()
|
||
; |