{"_id":"@aho-sdk/core","_rev":"3-edbdbd5cf156d1bf0c8483adf2ec9778","name":"@aho-sdk/core","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@aho-sdk/core","version":"0.1.0","keywords":["verifiable-credentials","vc","openid4vci","openid4vp","sdk","aho"],"author":{"name":"Aho","email":"support@aho.com"},"license":"MIT","_id":"@aho-sdk/core@0.1.0","maintainers":[{"name":"aho-support","email":"support@aho.com"}],"homepage":"https://aho.com/developers/typescript-sdk","bugs":{"url":"https://github.com/aho-hq/aho-js/issues"},"dist":{"shasum":"f74343348bd27da9b8f7e78d8da66596ab23d7d8","tarball":"https://registry.npmjs.org/@aho-sdk/core/-/core-0.1.0.tgz","fileCount":21,"integrity":"sha512-AtW4EJyYz87U16pg2epqtM53FS1xVzmLYU+lhw17Q2fIPvKH256riEiWpNNcx6z7cGLdoeJL4qfN7b+Kfl20jQ==","signatures":[{"sig":"MEYCIQCCBKtA/8VdL0UcoHvEUaK5sk04ZXpmWaT5ESP0Url/LQIhAKt0zTLg2J7DIN3LhYkMhSOqxsDwmjFrkzZt5mvIirly","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":834622},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"0232dfe2749cb7141dbe91f62fca85ab7c2485c7","scripts":{"lint":"eslint src tests","test":"jest","build":"tsup src/index.ts --format cjs,esm --dts","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"jest --watch"},"_npmUser":{"name":"aho-support","email":"support@aho.com"},"repository":{"url":"git+https://github.com/aho-hq/aho-js.git","type":"git"},"_npmVersion":"10.7.0","description":"TypeScript/JavaScript SDK for the Aho Verifiable Credentials API","directories":{},"_nodeVersion":"20.14.0","dependencies":{"zod":"^3.23.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tsup":"^8.0.0","ts-jest":"^29.1.0","typescript":"^5.3.0","@types/jest":"^29.5.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/core_0.1.0_1774643908415_0.08087495434046388","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@aho-sdk/core","version":"0.1.1","keywords":["verifiable-credentials","vc","openid4vci","openid4vp","sdk","aho"],"author":{"name":"Aho","email":"support@aho.com"},"license":"MIT","_id":"@aho-sdk/core@0.1.1","maintainers":[{"name":"aho-support","email":"support@aho.com"}],"homepage":"https://api.aho.com/developers/typescript-sdk","bugs":{"url":"https://github.com/aho-hq/aho-js/issues"},"dist":{"shasum":"e67913cf31a554eb6df7a3358ebee588ff410eae","tarball":"https://registry.npmjs.org/@aho-sdk/core/-/core-0.1.1.tgz","fileCount":22,"integrity":"sha512-8QaWsdWRsa6LzY8L86vh4sEjFTfQ0lt7EpkBKNPQhiTiG0i9FIhXcmrRG3+rucTqz3R1NAraduTJg6pxkODcQg==","signatures":[{"sig":"MEUCIQDC1P60O2QTymJpdgboFJGIvgiMSp0mrSvIRmj+fbDSEAIgbJFpPfvEZTlyTHt/VwCc2VqRBujrfj4lNxGRR6vITSw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1067157},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"13d56fac252d4d81852a73c15aabea2b6a633430","scripts":{"lint":"eslint src tests","test":"jest","build":"tsup src/index.ts --format cjs,esm --dts","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"jest --watch"},"_npmUser":{"name":"aho-support","email":"support@aho.com"},"repository":{"url":"git+https://github.com/aho-hq/aho-js.git","type":"git"},"_npmVersion":"10.7.0","description":"TypeScript/JavaScript SDK for the Aho Verifiable Credentials API","directories":{},"_nodeVersion":"20.14.0","dependencies":{"zod":"^3.23.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tsup":"^8.0.0","ts-jest":"^29.1.0","typescript":"^5.3.0","@types/jest":"^29.5.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/core_0.1.1_1776516691273_0.6880599249503048","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@aho-sdk/core","version":"0.1.2","description":"TypeScript/JavaScript SDK for the Aho Verifiable Credentials API","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","typecheck":"tsc --noEmit","test":"jest","test:watch":"jest --watch","lint":"eslint src tests","clean":"rm -rf dist"},"keywords":["verifiable-credentials","vc","openid4vci","openid4vp","sdk","aho"],"author":{"name":"Aho","email":"support@aho.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/aho-hq/aho-js.git"},"homepage":"https://aho.com/docs/sdks/api/typescript","bugs":{"url":"https://github.com/aho-hq/aho-js/issues"},"engines":{"node":">=18.0.0"},"dependencies":{"zod":"^3.23.0"},"devDependencies":{"@types/jest":"^29.5.0","@types/node":"^20.0.0","jest":"^29.7.0","ts-jest":"^29.1.0","tsup":"^8.0.0","typescript":"^5.3.0"},"_id":"@aho-sdk/core@0.1.2","gitHead":"145407b5028691a7dd38c3b1b30c87335f77c1e9","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-BgyG9jtSDLelD0iKNcdt95D9xa6kyLM/yp9jlcGCpNyZ3tUvgVSS4AymimIYnMcrI6XBqd9ODs8hyhSZICihbw==","shasum":"92ba5978c76d629ac7f3502f69c638560d29328b","tarball":"https://registry.npmjs.org/@aho-sdk/core/-/core-0.1.2.tgz","fileCount":22,"unpackedSize":1090131,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDpHcJB06vJP5SSqw29S5T6kEsoK85XfXOUpacZ05XGtgIhAId/tIwWPI5nRAg37ax/T8QWq8IliP5vrpD/86uU46Qt"}]},"_npmUser":{"name":"aho-support","email":"support@aho.com"},"directories":{},"maintainers":[{"name":"aho-support","email":"support@aho.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_0.1.2_1778075533151_0.9734239191614142"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-27T20:38:28.328Z","modified":"2026-05-06T13:52:13.461Z","0.1.0":"2026-03-27T20:38:28.559Z","0.1.1":"2026-04-18T12:51:31.431Z","0.1.2":"2026-05-06T13:52:13.349Z"},"bugs":{"url":"https://github.com/aho-hq/aho-js/issues"},"author":{"name":"Aho","email":"support@aho.com"},"license":"MIT","homepage":"https://aho.com/docs/sdks/api/typescript","keywords":["verifiable-credentials","vc","openid4vci","openid4vp","sdk","aho"],"repository":{"type":"git","url":"git+https://github.com/aho-hq/aho-js.git"},"description":"TypeScript/JavaScript SDK for the Aho Verifiable Credentials API","maintainers":[{"name":"aho-support","email":"support@aho.com"}],"readme":"# AhoSdk TypeScript SDK\n\nOfficial TypeScript/JavaScript SDK for the [Aho](https://aho.com) Verifiable Credentials API.\n\n## Installation\n\n```bash\nnpm install @aho-sdk/core\n# or\nyarn add @aho-sdk/core\n# or\npnpm add @aho-sdk/core\n```\n\n## Quick Start\n\n```typescript\nimport { Issuer } from '@aho-sdk/core';\n\n// Initialize the Issuer client\nconst issuer = new Issuer({ apiKey: process.env.AHO_ISSUER_API_KEY });\n\n// Issue a credential\nconst credential = await issuer.credentials.create({\n  schema_uuid: 'your-schema-uuid',\n  subject_identifier: 'user@example.com',\n  claims: {\n    name: 'Jane Doe',\n    role: 'Engineer'\n  }\n});\n\nconsole.log(credential.uuid);\n```\n\n## Clients\n\nThe SDK provides the following clients:\n\n| Client | Purpose | API Key Type |\n|--------|---------|--------------|\n| `Account` | Manage account settings, domains, and API keys | Account API Key |\n| `System` | System health and status endpoints | System API Key |\n| `Holder` | Manage holder credentials and presentations | Holder API Key |\n| `Verifier` | Create presentation requests and verify credentials | Verifier API Key |\n| `Issuer` | Issue and manage verifiable credentials | Issuer API Key |\n| `Schemas` | Browse and retrieve credential schemas | Schemas API Key |\n| `Unauthenticated` | Public endpoints (no authentication required) | None (public) |\n\n## Usage Examples\n\n### Issuing Credentials\n\n```typescript\nimport { Issuer } from '@aho-sdk/core';\n\nconst issuer = new Issuer({ apiKey: process.env.AHO_ISSUER_API_KEY });\n\n// List all schemas\nconst schemas = await issuer.schemas.list();\nfor await (const schema of schemas) {\n  console.log(schema.name);\n}\n\n// Create a schema\nconst schema = await issuer.schemas.create({\n  name: 'EmployeeBadge',\n  claims: [\n    { name: 'employee_id', type: 'string', required: true },\n    { name: 'department', type: 'string', required: true },\n    { name: 'hire_date', type: 'date', required: false }\n  ]\n});\n\n// Issue a credential\nconst credential = await issuer.credentials.create({\n  schema_uuid: schema.uuid,\n  subject_identifier: 'jane.doe@company.com',\n  claims: {\n    employee_id: 'EMP-12345',\n    department: 'Engineering',\n    hire_date: '2024-01-15'\n  }\n});\n\n// Revoke a credential\nawait issuer.credentials.revoke(credential.uuid, { reason: 'Employee departed' });\n```\n\n### Verifying Credentials\n\n```typescript\nimport { Verifier } from '@aho-sdk/core';\n\nconst verifier = new Verifier({ apiKey: process.env.AHO_VERIFIER_API_KEY });\n\n// Create a presentation request\nconst request = await verifier.requests.create({\n  name: 'Employment Verification',\n  query_format: 'dcql',\n  credentials: [\n    {\n      id: 'employee_badge',\n      format: 'vc+sd-jwt',\n      claims: [\n        { path: ['employee_id'] },\n        { path: ['department'] }\n      ]\n    }\n  ]\n});\n\n// Get the QR code for the request (supports 'png', 'svg' formats)\nconst qr = await verifier.requests.qrCode(request.uuid, 'svg');\n\n// List responses to the request\nconst responses = await verifier.responses.list(request.uuid);\n```\n\n### Managing Holder Credentials\n\n```typescript\nimport { Holder } from '@aho-sdk/core';\n\nconst holder = new Holder({ apiKey: process.env.AHO_HOLDER_API_KEY });\n\n// List credentials\nconst credentials = await holder.credentials.list('active');\n\n// Create a presentation (selective disclosure)\nconst presentation = await holder.presentations.create({\n  credential_uuid: 'credential-uuid',\n  disclosed_claims: ['name', 'department']\n});\n```\n\n### Account Management\n\n```typescript\nimport { Account } from '@aho-sdk/core';\n\nconst account = new Account({ apiKey: process.env.AHO_API_KEY });\n\n// Manage domains\nconst domains = await account.domains.list();\nawait account.domains.verify(domain.id);\n\n// Manage signing keys\nconst keys = await account.signingKeys.list();\nawait account.signingKeys.rotate(key.id);\n\n// Configure webhooks\nawait account.webhooks.create({\n  url: 'https://your-app.com/webhooks/aho',\n  events: ['credential.issued', 'credential.revoked']\n});\n```\n\n## Pagination\n\nList methods return `Page` objects with async iteration support:\n\n```typescript\n// Iterate through all pages automatically\nfor await (const credential of issuer.credentials.list()) {\n  console.log(credential.uuid);\n}\n\n// Or handle pages manually\nlet page = await issuer.credentials.list(1, 50);\nwhile (page) {\n  for (const credential of page.data) {\n    console.log(credential.uuid);\n  }\n  page = await page.nextPage();\n}\n\n// Collect all items\nconst allCredentials = await issuer.credentials.list().toArrayAll();\n```\n\n## File Uploads\n\nFor endpoints that accept file uploads:\n\n```typescript\nimport * as fs from 'fs';\n\n// Upload a file\nawait issuer.media.upload({\n  file: fs.createReadStream('document.pdf'),\n  metadata: { description: 'Employee contract' }\n});\n\n// In the browser, use File or Blob\nconst fileInput = document.querySelector<HTMLInputElement>('#fileInput');\nawait issuer.media.upload({\n  file: fileInput.files[0]\n});\n```\n\n## Binary Responses\n\nSome endpoints return binary data (images, PDFs):\n\n```typescript\nimport * as fs from 'fs';\n\n// Get QR code as PNG (returns ArrayBuffer)\nconst pngData = await verifier.requests.qrCode(uuid, 'png');\nfs.writeFileSync('qr.png', Buffer.from(pngData));\n\n// Get QR code as SVG\nconst svgData = await verifier.requests.qrCode(uuid, 'svg');\nfs.writeFileSync('qr.svg', Buffer.from(svgData));\n```\n\n## Error Handling\n\n```typescript\nimport {\n  Issuer,\n  ValidationError,\n  AuthenticationError,\n  NotFoundError,\n  RateLimitError,\n  ApiError\n} from '@aho-sdk/core';\n\ntry {\n  await issuer.credentials.create(invalidParams);\n} catch (error) {\n  if (error instanceof ValidationError) {\n    // 422 - Validation failed\n    for (const fieldError of error.fieldErrors) {\n      console.log(`${fieldError.field}: ${fieldError.hint}`);\n    }\n  } else if (error instanceof AuthenticationError) {\n    // 401 - Invalid API key\n    console.log('Check your API key');\n  } else if (error instanceof NotFoundError) {\n    // 404 - Resource not found\n    console.log(`Resource not found: ${error.message}`);\n  } else if (error instanceof RateLimitError) {\n    // 429 - Rate limited (SDK auto-retries with exponential backoff)\n    console.log(`Retry after ${error.retryAfter} seconds`);\n  } else if (error instanceof ApiError) {\n    // Other API errors\n    console.log(`Error ${error.statusCode}: ${error.message}`);\n    console.log(`Request ID: ${error.requestId}`);\n  }\n}\n```\n\n### Error Classes\n\n| Error Class | HTTP Status | Description |\n|-------------|-------------|-------------|\n| `AuthenticationError` | 401 | Invalid or missing API key |\n| `ForbiddenError` | 403 | Insufficient permissions |\n| `NotFoundError` | 404 | Resource not found |\n| `ConflictError` | 409 | Resource conflict |\n| `ValidationError` | 422 | Request validation failed |\n| `RateLimitError` | 429 | Rate limit exceeded |\n| `ServerError` | 5xx | Server-side error |\n| `NetworkError` | - | Connection/timeout error |\n| `ApiError` | * | Base class for all API errors |\n\n## Rate Limiting\n\nThe SDK automatically handles rate limits with exponential backoff:\n\n- **Idempotent methods** (GET, DELETE, PUT): Auto-retry up to 3 times\n- **Non-idempotent methods** (POST, PATCH): Only retry with idempotency key\n\n```typescript\n// Use idempotency keys for safe retries on POST/PATCH\nawait issuer.credentials.create({\n  schema_uuid: '...',\n  claims: { ... },\n  idempotencyKey: 'unique-request-id'\n});\n```\n\n## Configuration\n\n```typescript\n// Custom configuration\nconst issuer = new Issuer({\n  apiKey: process.env.AHO_ISSUER_API_KEY,\n  baseUrl: 'https://api.aho.com',  // Custom base URL\n  timeout: 60000,                   // Request timeout in milliseconds\n  logger: {                         // Enable debug logging\n    debug: (msg) => console.debug(msg),\n    warn: (msg) => console.warn(msg)\n  }\n});\n```\n\n## Browser Support\n\nThe SDK uses the Fetch API and works in modern browsers (Chrome, Firefox, Safari, Edge) as well as Node.js 18+.\n\n## TypeScript\n\nThe SDK is written in TypeScript and includes full type definitions:\n\n```typescript\nimport { Issuer, Page } from '@aho-sdk/core';\n\n// Types are inferred\nconst credential = await issuer.credentials.get('uuid');\n// credential: Record<string, unknown> | null\n\nconst page = await issuer.credentials.list();\n// page: Page<Record<string, unknown>>\n```\n\n## Requirements\n\n- Node.js 18+ or modern browser with Fetch API support\n- TypeScript 5.0+ (for TypeScript users)\n\n## License\n\nMIT\n","readmeFilename":"README.md"}