{"_id":"@aisar-labs/zeptoclaw-sea-shared","_rev":"3-d4b9b90e0ea7a6d64dd9ab42fbd31f91","name":"@aisar-labs/zeptoclaw-sea-shared","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@aisar-labs/zeptoclaw-sea-shared","version":"0.1.0","license":"MIT","_id":"@aisar-labs/zeptoclaw-sea-shared@0.1.0","maintainers":[{"name":"qhkm","email":"qhkmdev90@gmail.com"}],"homepage":"https://github.com/qhkm/zeptoclaw-sea#readme","bugs":{"url":"https://github.com/qhkm/zeptoclaw-sea/issues"},"dist":{"shasum":"c98815edf9b038cc9f3a42a44a19afdbd85d0df3","tarball":"https://registry.npmjs.org/@aisar-labs/zeptoclaw-sea-shared/-/zeptoclaw-sea-shared-0.1.0.tgz","fileCount":21,"integrity":"sha512-KQwZr6Xfsl5FXRR4uKD74/GJTOA6FS/9lyuXtLslpINO213t1Qc4bvlur8d/OSsP5WwqwKfiTrChHV8p22LcJw==","signatures":[{"sig":"MEUCIE6Zc+SkJsBQYqEFem0HlC5qEj4pMVyeYrgfDZkSspkQAiEA7Y10nVczTDQx1G507W2231Q14ULiOBaR4Yis6eZi0s4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9064},"main":"./build/index.js","type":"module","types":"./build/index.d.ts","gitHead":"718924210f82b9dc4da282775f3efd8a12df3116","scripts":{"test":"vitest run","build":"tsc","clean":"rm -rf build"},"_npmUser":{"name":"qhkm","email":"qhkmdev90@gmail.com"},"repository":{"url":"git+https://github.com/qhkm/zeptoclaw-sea.git","type":"git","directory":"mcp-servers/shared"},"_npmVersion":"10.8.2","description":"Shared auth utilities for ZeptoClaw SEA MCP servers","directories":{},"_nodeVersion":"20.19.4","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/zeptoclaw-sea-shared_0.1.0_1772098886503_0.7383821539259203","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@aisar-labs/zeptoclaw-sea-shared","version":"0.1.1","license":"MIT","_id":"@aisar-labs/zeptoclaw-sea-shared@0.1.1","maintainers":[{"name":"qhkm","email":"qhkmdev90@gmail.com"}],"homepage":"https://github.com/aisar-labs/zeptoclaw-sea#readme","bugs":{"url":"https://github.com/aisar-labs/zeptoclaw-sea/issues"},"dist":{"shasum":"23ed096e6c2b4134bc62831177be0231d5beab0f","tarball":"https://registry.npmjs.org/@aisar-labs/zeptoclaw-sea-shared/-/zeptoclaw-sea-shared-0.1.1.tgz","fileCount":59,"integrity":"sha512-yEGzCpQvwUPAbFhwdxRMgVuxEsp7M6+hGD2OxKuSKP1qDfdv6Qrmn/w7g5RV4aw++lHpYNox9n9EOrbBoC36Og==","signatures":[{"sig":"MEQCIF6KpnGUZld1OmYau1slbcL2fgNTm7W946WZ5CL383CFAiBJeOvnx16VYIjlMlsigBLOVFmM0CdGig0P6AChPF6pLA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":52002},"main":"./build/index.js","type":"module","_from":"file:aisar-labs-zeptoclaw-sea-shared-0.1.1.tgz","types":"./build/index.d.ts","scripts":{"test":"vitest run","build":"tsc","clean":"rm -rf build"},"_npmUser":{"name":"qhkm","email":"qhkmdev90@gmail.com"},"_resolved":"/tmp/2667042eb226ac44aa481f83dd3c8d11/aisar-labs-zeptoclaw-sea-shared-0.1.1.tgz","_integrity":"sha512-yEGzCpQvwUPAbFhwdxRMgVuxEsp7M6+hGD2OxKuSKP1qDfdv6Qrmn/w7g5RV4aw++lHpYNox9n9EOrbBoC36Og==","repository":{"url":"git+https://github.com/aisar-labs/zeptoclaw-sea.git","type":"git","directory":"mcp-servers/shared"},"_npmVersion":"10.9.4","description":"Shared auth utilities for ZeptoClaw SEA MCP servers","directories":{},"_nodeVersion":"22.22.0","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/zeptoclaw-sea-shared_0.1.1_1772130676758_0.22908787113411","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@aisar-labs/zeptoclaw-sea-shared","version":"0.1.2","description":"Shared auth utilities for ZeptoClaw SEA MCP servers","type":"module","main":"./build/index.js","types":"./build/index.d.ts","license":"MIT","repository":{"type":"git","url":"git+https://github.com/aisar-labs/zeptoclaw-sea.git","directory":"mcp-servers/shared"},"publishConfig":{"access":"public"},"dependencies":{},"devDependencies":{"typescript":"^5.7.0","vitest":"^3.0.0","@types/node":"^22.0.0"},"scripts":{"build":"tsc","test":"vitest run","clean":"rm -rf build"},"_id":"@aisar-labs/zeptoclaw-sea-shared@0.1.2","bugs":{"url":"https://github.com/aisar-labs/zeptoclaw-sea/issues"},"homepage":"https://github.com/aisar-labs/zeptoclaw-sea#readme","_integrity":"sha512-CD/oT5DJmSXflCaE2TDBQpO/xd35Xjawi1yqJwMWLSfT+FWNPvDpJYakFO7Tgf2oKndk9d4sv3/lcEAyRxUxWQ==","_resolved":"/tmp/066b6659273fbb9f7ff5255a8bc8de38/aisar-labs-zeptoclaw-sea-shared-0.1.2.tgz","_from":"file:aisar-labs-zeptoclaw-sea-shared-0.1.2.tgz","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-CD/oT5DJmSXflCaE2TDBQpO/xd35Xjawi1yqJwMWLSfT+FWNPvDpJYakFO7Tgf2oKndk9d4sv3/lcEAyRxUxWQ==","shasum":"049ad26980a37b88de7c22d4f9aa605c346b5e17","tarball":"https://registry.npmjs.org/@aisar-labs/zeptoclaw-sea-shared/-/zeptoclaw-sea-shared-0.1.2.tgz","fileCount":59,"unpackedSize":52002,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDdFnOu3N57VguMSssMvsKzWHLcX9SFvMedpIH6csW/nwIgdtjOclh+7d3se2FQG140L1oqdPhV2QYTh7TGYfyvCBk="}]},"_npmUser":{"name":"qhkm","email":"qhkmdev90@gmail.com"},"directories":{},"maintainers":[{"name":"qhkm","email":"qhkmdev90@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/zeptoclaw-sea-shared_0.1.2_1772131327651_0.07664734091100822"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-26T09:41:26.384Z","modified":"2026-02-26T18:42:08.221Z","0.1.0":"2026-02-26T09:41:26.647Z","0.1.1":"2026-02-26T18:31:16.925Z","0.1.2":"2026-02-26T18:42:07.790Z"},"bugs":{"url":"https://github.com/aisar-labs/zeptoclaw-sea/issues"},"license":"MIT","homepage":"https://github.com/aisar-labs/zeptoclaw-sea#readme","repository":{"type":"git","url":"git+https://github.com/aisar-labs/zeptoclaw-sea.git","directory":"mcp-servers/shared"},"description":"Shared auth utilities for ZeptoClaw SEA MCP servers","maintainers":[{"name":"qhkm","email":"qhkmdev90@gmail.com"}],"readme":"# @aisar-labs/zeptoclaw-sea-shared\n\nShared auth and utility package for all ZeptoClaw SEA MCP servers.\n\nThis is **not** an MCP server -- it is a shared library used by all `@aisar-labs/*-mcp` packages.\n\n## Install\n\n```bash\nnpm install @aisar-labs/zeptoclaw-sea-shared\n```\n\n## Exports\n\n### Auth Helpers\n\n- `basicAuthHeader(username, password)` -- Build Basic auth header\n- `apiKeyHeader(key, headerName?)` -- Build API key header\n- `OAuth2Client` -- OAuth 2.0 client with token refresh\n\n### Webhook Verification\n\n- `hmacSha256(secret, payload)` -- Compute HMAC-SHA256\n- `verifyWebhookSignature(secret, payload, signature)` -- Verify webhook HMAC signature\n- `verifyHmacWebhook(secret, payload, signature, algorithm?)` -- Verify HMAC webhook (configurable algorithm)\n- `verifyHashWebhook(payload, expectedHash, algorithm?)` -- Verify hash-based webhook\n- `verifyStripeWebhook(secret, payload, signatureHeader)` -- Verify Stripe webhook signature\n- `verifyBillplzCallback(secret, params)` -- Verify Billplz callback\n- `verifyMoMoIpn(secret, params)` -- Verify MoMo IPN signature\n- `verifyQrPaymentCallback(secret, params)` -- Verify QR payment callback\n- `parseWebhookPayload(body, contentType?)` -- Parse webhook body (JSON or form)\n\n### HTTP Utilities\n\n- `fetchWithRetry(url, options, retryConfig?)` -- Fetch with exponential backoff\n- `RateLimiter` -- Token bucket rate limiter\n- `calculateBackoff(attempt, baseMs?, maxMs?)` -- Calculate exponential backoff delay\n\n### MCP Helpers\n\n- `toolResult(content)` -- Format successful tool result\n- `toolError(message)` -- Format tool error result\n- `apiError(status, message)` -- Create API error with status code\n\n## Usage\n\n### Auth Headers\n\n```typescript\nimport { basicAuthHeader, apiKeyHeader } from \"@aisar-labs/zeptoclaw-sea-shared\";\n\nconst headers = {\n  Authorization: basicAuthHeader(\"user\", \"pass\"),\n};\n\nconst apiHeaders = {\n  ...apiKeyHeader(\"sk-abc123\", \"X-API-Key\"),\n};\n```\n\n### Webhook Verification\n\n```typescript\nimport { verifyWebhookSignature } from \"@aisar-labs/zeptoclaw-sea-shared\";\n\nconst isValid = verifyWebhookSignature(\n  process.env.WEBHOOK_SECRET,\n  rawBody,\n  signatureHeader\n);\n```\n\n### Fetch with Retry\n\n```typescript\nimport { fetchWithRetry } from \"@aisar-labs/zeptoclaw-sea-shared\";\n\nconst response = await fetchWithRetry(\"https://api.example.com/data\", {\n  headers: { Authorization: \"Bearer token\" },\n}, { maxRetries: 3, baseDelayMs: 1000 });\n```\n\n### Tool Results\n\n```typescript\nimport { toolResult, toolError } from \"@aisar-labs/zeptoclaw-sea-shared\";\n\n// In a tool handler\nif (success) {\n  return toolResult({ orderId: \"123\", status: \"created\" });\n} else {\n  return toolError(\"Order creation failed: insufficient stock\");\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}