{"_id":"@apegio/sdk","_rev":"2-8bcf7f90ac72a2bbdff53f983b8d86df","name":"@apegio/sdk","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@apegio/sdk","version":"1.0.0","author":{"name":"Apegio Networks"},"license":"MIT","_id":"@apegio/sdk@1.0.0","maintainers":[{"name":"mobbii","email":"barakadevs@gmail.com"}],"dist":{"shasum":"1feb6e6304615ef31ebace325e1651010423eae7","tarball":"https://registry.npmjs.org/@apegio/sdk/-/sdk-1.0.0.tgz","fileCount":5,"integrity":"sha512-mZxI22U1M1YTjr14qRpVGZPBhk6MQqxKPZGcasEra9puae2jfymjZrC8ksxTgbqPJFanU1f0c/43la2gVJSPkA==","signatures":[{"sig":"MEUCIQDRj6r7xKSX+cIYPY3tuRwh6UsNlM5qgRSPYC9IytuBGgIgUmrwmMKHaN55jZDn2/30ot+nPvJrIY+pMehdPuDaZ/E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":21287},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc"},"_npmUser":{"name":"mobbii","email":"barakadevs@gmail.com"},"_npmVersion":"11.13.0","description":"Official Isomorphic Client SDK for the Apegio zero-trust routing network","directories":{},"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"@types/ws":"^8.5.10","typescript":"^5.0.0"},"peerDependencies":{"ws":"^8.16.0","wrtc":"^0.4.7"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.0_1781511048758_0.2040530151582416","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@apegio/sdk","version":"1.0.1","description":"Official Isomorphic Client SDK for the Apegio zero-trust routing network","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc"},"peerDependencies":{"ws":"^8.16.0","wrtc":"^0.4.7"},"devDependencies":{"typescript":"^5.0.0","@types/ws":"^8.5.10"},"author":{"name":"Apegio Networks"},"license":"MIT","_id":"@apegio/sdk@1.0.1","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-TXqh5T4jCkPUCATiPJSWvvSps89hVD8MA6oHMARFK3rRe43n/p6y/hDvwdS0iMyCXSXv9UUPewteynl+927A2g==","shasum":"de4350e6d57934cd0f8559027f42665177f6f43a","tarball":"https://registry.npmjs.org/@apegio/sdk/-/sdk-1.0.1.tgz","fileCount":6,"unpackedSize":23515,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCizoi9x/Rt6qSnqUzk+bBcasbQc1tKU7WNqQYXiuC0cAIgEh82qchYB86Dgl5wdA7wU6M0iPyjALnx/lStBCfiRVo="}]},"_npmUser":{"name":"mobbii","email":"barakadevs@gmail.com"},"directories":{},"maintainers":[{"name":"mobbii","email":"barakadevs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.0.1_1781513507776_0.43300649868923946"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-15T08:10:48.492Z","modified":"2026-06-15T08:51:48.053Z","1.0.0":"2026-06-15T08:10:48.903Z","1.0.1":"2026-06-15T08:51:47.913Z"},"author":{"name":"Apegio Networks"},"license":"MIT","description":"Official Isomorphic Client SDK for the Apegio zero-trust routing network","maintainers":[{"name":"mobbii","email":"barakadevs@gmail.com"}],"readme":"# @apegio/sdk\n\nOfficial Isomorphic Client SDK for the Apegio zero-trust routing network. \n\nApegio allows you to securely manage nodes, construct private WebRTC tunnels, and route multi-agent payloads without touching central servers.\n\n## Installation\n\nInstall the SDK package along with its required peer dependencies (\\`ws\\` and \\`wrtc\\`).\n\n```bash\nnpm install @apegio/sdk ws wrtc\n```\n\n## Initialization\n\nImport the client and initialize it using your mesh API key and a unique stable identifier for this node.\n\n```typescript\nimport { ApegioClient } from '@apegio/sdk';\n\n// Initialize the core client\nconst client = new ApegioClient({\n  apiKey: process.env.APEGIO_API_KEY,  // Your Mesh API Key\n  nodeId: 'agent-core-01'              // A unique string for this node\n});\n```\n\n## Usage\n\n### 1. Connect and Listen to Mesh Events\n\nEstablish the connection to connect your agent to the Apegio mesh network. Monitor the network state and handle incoming peer messages.\n\n```typescript\n// Listen for network connectivity state changes\nclient.onConnectionStateChange = (state) => {\n  console.log('Apegio Link State:', state);\n};\n\n// Catch incoming zero-trust payloads from other nodes\nclient.onMessage = (sourceId, protocol, dataSize, data) => {\n  console.log(`Received ${dataSize} bytes from ${sourceId} via ${protocol}`);\n  console.log('Payload:', data);\n};\n\n// Start the connection process\nawait client.connect();\n```\n\n### 2. Route Zero-Trust Payload to Peer\n\nOnce connected, discover and directly construct a secure WebRTC tunnel to send data to another peer. This negotiates a WebRTC data channel that completely bypasses the central signaling servers for true peer-to-peer payload delivery.\n\n```typescript\ntry {\n  // Discovers peer metadata and establishes P2P WebRTC data tunnel\n  // Automatically falls back to relaying if strict NAT prevents P2P\n  const tunnel = await client.discoverAndConnect('target_agent_id');\n\n  // Transmit your payload\n  const payloadStr = JSON.stringify({ action: \"SYNC_DATA\" });\n  await tunnel.transmit('JSON', payloadStr.length, payloadStr);\n  \n  console.log('Successfully routed payload to target node!');\n} catch (err) {\n  console.error('Failed to construct tunnel:', err);\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}