{"_id":"@chrom-ar/waku-client","_rev":"3-1aaa3aa9a4f76d2c6a2c163592434d00","name":"@chrom-ar/waku-client","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@chrom-ar/waku-client","version":"1.0.0","license":"MIT","_id":"@chrom-ar/waku-client@1.0.0","maintainers":[{"name":"batudo","email":"batudo@2pi.network"},{"name":"shelvak","email":"nestor.coppi@gmail.com"}],"dist":{"shasum":"cab4d9b790aa02e5668a03c234d2f86378c7ab0e","tarball":"https://registry.npmjs.org/@chrom-ar/waku-client/-/waku-client-1.0.0.tgz","fileCount":14,"integrity":"sha512-X7yXTKUAjT/fu/9hj6GPpwC6e7TJWo96iMH9Td7jGHVyTqsGDUfpUOVYHWuRigFnE7ON0Jo5idhCBM7raMcITw==","signatures":[{"sig":"MEUCIAZMXf050/Jitp2KzO6jpG4y8mXvvXfO8cQYwhLIF+TQAiEAloWrwY25aSrn2xnNdfrUir/zzPiR/7ALOvzgFxbDunA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24472},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"7188d3fbd8950e0b9c9d8e411c8abedd12c7544d","scripts":{"dev":"tsc --watch","lint":"eslint .","test":"echo \"Error: no test specified\" && exit 1","build":"tsc","lint:fix":"eslint --fix .","prepublishOnly":"npm run build"},"_npmUser":{"name":"shelvak","email":"nestor.coppi@gmail.com"},"_npmVersion":"10.9.2","description":"![Version](https://img.shields.io/badge/version-1.0.0-blue.svg) ![License](https://img.shields.io/badge/license-MIT-green.svg)","directories":{},"_nodeVersion":"23.5.0","dependencies":{"zod":"3.24.1","@waku/sdk":"0.0.30","protobufjs":"7.4.0","@libp2p/tcp":"10.1.9","@waku/utils":"0.0.22","@libp2p/bootstrap":"11.0.33","@waku/message-encryption":"0.0.32"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"5.8.3"},"_npmOperationalInternal":{"tmp":"tmp/waku-client_1.0.0_1744916427794_0.4179103297977087","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@chrom-ar/waku-client","version":"1.0.1","license":"MIT","_id":"@chrom-ar/waku-client@1.0.1","maintainers":[{"name":"batudo","email":"batudo@2pi.network"},{"name":"shelvak","email":"nestor.coppi@gmail.com"}],"dist":{"shasum":"bebd48758937f1b88daaa85896ad0e831e8e3a87","tarball":"https://registry.npmjs.org/@chrom-ar/waku-client/-/waku-client-1.0.1.tgz","fileCount":14,"integrity":"sha512-GypAlGVjjUYST57b7hAF2HkDz3+fxbUQzBtaiPCs+Ybw+8wmjWWyaGA0aDns3vgHppf94zWTkkeV/D08QmGE8A==","signatures":[{"sig":"MEUCICIOboiJQL7VPxaSOD9gCviVlnvsYYOiSH156llSjbZeAiEAmd4WnR9B8S6LSM5JjqQSPmZWJ2HtYhyU8puaeRt+57w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29769},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","gitHead":"089a6b42a7d7e9c97f3fe9304e544421ef931b96","scripts":{"dev":"tsc --watch","lint":"eslint .","test":"echo \"Error: no test specified\" && exit 1","build":"tsc","lint:fix":"eslint --fix .","prepublishOnly":"npm run build"},"_npmUser":{"name":"batudo","email":"batudo@2pi.network"},"_npmVersion":"10.9.2","description":"![Version](https://img.shields.io/badge/version-1.0.0-blue.svg) ![License](https://img.shields.io/badge/license-MIT-green.svg)","directories":{},"_nodeVersion":"23.11.0","dependencies":{"zod":"3.24.4","@waku/sdk":"0.0.31","protobufjs":"7.5.2","@libp2p/tcp":"10.1.10","@waku/utils":"0.0.23","@libp2p/bootstrap":"11.0.35","@waku/message-encryption":"0.0.33"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jiti":"^2.4.2","eslint":"^9.27.0","@eslint/js":"^9.27.0","typescript":"^5.8.3","typescript-eslint":"^8.32.1"},"_npmOperationalInternal":{"tmp":"tmp/waku-client_1.0.1_1747513186804_0.3970039522537072","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@chrom-ar/waku-client","version":"1.0.2","main":"dist/index.js","license":"MIT","types":"dist/index.d.ts","module":"dist/index.js","type":"module","dependencies":{"@chrom-ar/utils":"0.1.2","@libp2p/bootstrap":"11.0.35","@libp2p/tcp":"10.1.10","@waku/message-encryption":"0.0.33","@waku/sdk":"0.0.31","@waku/utils":"0.0.23","protobufjs":"7.5.2","zod":"3.24.4"},"devDependencies":{"@eslint/js":"^9.27.0","eslint":"^9.27.0","jiti":"^2.4.2","typescript":"^5.8.3","typescript-eslint":"^8.32.1"},"publishConfig":{"access":"public"},"scripts":{"build":"tsc","dev":"tsc --watch","lint":"eslint .","lint:fix":"eslint --fix .","prepublishOnly":"npm run build","test":"echo \"Error: no test specified\" && exit 1"},"_id":"@chrom-ar/waku-client@1.0.2","gitHead":"7eb39b0f30fc8cd13e2d30b8bf94bec14fc3f362","description":"![Version](https://img.shields.io/badge/version-1.0.0-blue.svg) ![License](https://img.shields.io/badge/license-MIT-green.svg)","_nodeVersion":"23.11.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-soGiiQ8jF1P55m3SV2VETKrynmLZ4FuKI5pf7kGKdDS4vzq0AMHGLYavm78Srw25hU7/T9KWG13yQzkbGrYJLw==","shasum":"d1596811edf683d5efea0591b8f9486776d18f88","tarball":"https://registry.npmjs.org/@chrom-ar/waku-client/-/waku-client-1.0.2.tgz","fileCount":14,"unpackedSize":29365,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDLFCaTa13PUMXQ2Mx25Twft0v5HzNaQmuFpqh/ujAsmAiEAxh797OjKD1JEWzFXsaoxPZZ1nfw6LwTEDlZ7z5JtYTM="}]},"_npmUser":{"name":"batudo","email":"batudo@2pi.network"},"directories":{},"maintainers":[{"name":"batudo","email":"batudo@2pi.network"},{"name":"shelvak","email":"nestor.coppi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/waku-client_1.0.2_1747607294095_0.5516891327699889"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-17T19:00:27.694Z","modified":"2025-05-18T22:28:14.437Z","1.0.0":"2025-04-17T19:00:27.961Z","1.0.1":"2025-05-17T20:19:47.012Z","1.0.2":"2025-05-18T22:28:14.272Z"},"license":"MIT","description":"![Version](https://img.shields.io/badge/version-1.0.0-blue.svg) ![License](https://img.shields.io/badge/license-MIT-green.svg)","maintainers":[{"name":"batudo","email":"batudo@2pi.network"},{"name":"shelvak","email":"nestor.coppi@gmail.com"}],"readme":"# @chrom-ar/waku-client\n\n![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)\n![License](https://img.shields.io/badge/license-MIT-green.svg)\n\nA TypeScript client library for the Waku protocol, simplifying decentralized communication with end-to-end encryption support.\n\n## Overview\n\n`@chrom-ar/waku-client` provides a simplified interface to connect, subscribe, and publish messages to the [Waku](https://waku.org/) network - a family of privacy-preserving, peer-to-peer messaging protocols built on libp2p. This client makes it easy to integrate Waku's decentralized communication capabilities into your applications.\n\n## Features\n\n- 🔄 Easy connection to Waku nodes\n- 📬 Simple subscribe/publish messaging patterns\n- 🔒 End-to-end encryption (ECIES) support\n- 🌐 Custom topic namespacing\n- 🔁 Automatic reconnection handling\n- 📝 Comprehensive logging\n- 🧩 TypeScript support\n\n## Installation\n\n```bash\nnpm install @chrom-ar/waku-client\n# or\nyarn add @chrom-ar/waku-client\n```\n\n## Quick Start\n\n```typescript\nimport WakuClient from '@chrom-ar/waku-client';\n\n// Configure environment variables for Waku\nprocess.env.WAKU_TOPIC_PLACEHOLDER = '/placeholder/';\nprocess.env.WAKU_TOPIC_DEFAULT = '/myapp/v1';\nprocess.env.WAKU_STATIC_PEERS = '/dns4/node-01.do-ams3.waku.connect.storage/tcp/443/wss/p2p/16Uiu2HAm6HVpMpSFe9w7WJ7TYY3WxzqZMiDPn6PeVkxQTbuGkTgb';\n\n// Initialize the client\nconst client = await WakuClient.start();\n\n// Subscribe to a topic\nawait client.subscribe('chat', (message) => {\n  console.log('Received message:', message.body);\n}, { expirationSeconds: 60 });\n\n// Send a message\nawait client.sendMessage(\n  { text: 'Hello, Waku world!' },\n  'chat', \n  '' // replyTo (optional)\n);\n\n// Unsubscribe when done\nawait client.unsubscribe('chat');\n\n// Stop the client when your application exits\nawait client.stop();\n```\n\n## Configuration\n\nThe client can be configured through environment variables:\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `WAKU_TOPIC_PLACEHOLDER` | Placeholder for topic substitution | Required |\n| `WAKU_TOPIC_DEFAULT` | Default topic value | Required |\n| `WAKU_PING_COUNT` | Number of connection attempts | 5 |\n| `WAKU_STATIC_PEERS` | Comma-separated list of peer addresses | Empty string |\n| `WAKU_STATIC_CLUSTER_ID` | Waku cluster ID | -1 |\n| `WAKU_STATIC_SHARD` | Waku shard number | -1 |\n| `WAKU_ENCRYPTION_PRIVATE_KEY` | Hex-encoded private key for message encryption | Optional |\n\nYou can also pass a custom configuration getter to the `start` method:\n\n```typescript\nconst client = await WakuClient.start((key) => {\n  // Custom logic to retrieve configuration values\n  return myConfigStore[key];\n});\n```\n\n## Encryption\n\nTo enable end-to-end encryption:\n\n1. Generate a private key (or use an existing one)\n2. Set the `WAKU_ENCRYPTION_PRIVATE_KEY` environment variable\n3. Enable encryption when subscribing:\n\n```typescript\n// Subscribe with encryption enabled\nawait client.subscribe('private-chat', (message) => {\n  console.log('Received encrypted message:', message.body);\n}, { encrypted: true });\n\n// Send an encrypted message to a specific recipient\nawait client.sendMessage(\n  { text: 'Secret message!' },\n  'private-chat',\n  '',\n  recipientPublicKey // The recipient's public key\n);\n```\n\n## API Reference\n\n### `WakuClient`\n\n#### Static Methods\n\n- `start(settingGetter?: Function): Promise<WakuClient>`  \n  Initialize and connect a new WakuClient.\n\n#### Instance Methods\n\n- `subscribe(topic: string, callback: Function, options?: Object): Promise<void>`  \n  Subscribe to messages on a specific topic.\n\n- `sendMessage(body: object, topic: string, replyTo: string, encryptionPubKey?: string): Promise<void>`  \n  Send a message to a specific topic.\n\n- `unsubscribe(topic: string): Promise<void>`  \n  Unsubscribe from a topic.\n\n- `stop(): Promise<void>`  \n  Disconnect and clean up resources.\n\n- `setLogger(logger: Logger): void`  \n  Set a custom logger.\n\n- `defaultIntentsTopic(): string`  \n  Get the default topic for intents.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","readmeFilename":"README.md"}