{"_id":"@chittyos/chittyid-client","_rev":"2-8c45a3c3dd9a489a0807c2ab35faf851","name":"@chittyos/chittyid-client","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@chittyos/chittyid-client","version":"1.0.0","keywords":["chittyos","chittyid","identity","blockchain","cloudflare","SERVICE OR FAIL"],"author":{"name":"ChittyOS Foundation","email":"foundation@chitty.cc"},"license":"MIT","_id":"@chittyos/chittyid-client@1.0.0","maintainers":[{"name":"chitcommit","email":"chitcommit@chitty.cc"}],"homepage":"https://github.com/ChittyOS/chittyid-client#readme","bugs":{"url":"https://github.com/ChittyOS/chittyid-client/issues"},"dist":{"shasum":"e353016b4124984ab64731d72586947c52b4f8fe","tarball":"https://registry.npmjs.org/@chittyos/chittyid-client/-/chittyid-client-1.0.0.tgz","fileCount":6,"integrity":"sha512-2Ha/GRHK4cdh91yj4k7eMHy1/g7ILMzww6V+QPTjPhWRWIk4sMOywr20ovN35gqxnKLgY/vYzkGUwUntNsicsA==","signatures":[{"sig":"MEUCIQDPll6F+1Me13zStX2p1WM4yCjxqhtZRP7GRMf4BSi3cwIgWvhYabM2upurgnveJjDNtZt3ICCW2Fr6cxiyliH8RNY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17230},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"gitHead":"ee5118d3a0b88f8bed013e8f3ad00a35929ce9b7","scripts":{"test":"vitest","build":"tsup src/index.ts --format cjs,esm --dts","prepublishOnly":"npm run build"},"_npmUser":{"name":"chitcommit","email":"chitcommit@chitty.cc"},"repository":{"url":"git+https://github.com/ChittyOS/chittyid-client.git","type":"git"},"_npmVersion":"11.5.1","description":"Official ChittyOS client for ChittyID minting - SERVICE OR FAIL principle","directories":{},"_nodeVersion":"24.4.1","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","vitest":"^2.1.9","typescript":"^5.9.3","@types/node":"^20.19.19"},"_npmOperationalInternal":{"tmp":"tmp/chittyid-client_1.0.0_1759537034425_0.280801079788328","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@chittyos/chittyid-client","version":"1.0.1","description":"ChittyID client for minting and validating ChittyOS identifiers","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"scripts":{"build":"tsup src/index.ts --format esm,cjs --dts --clean","dev":"tsup src/index.ts --format esm,cjs --dts --watch","test":"vitest run","test:watch":"vitest","prepublishOnly":"npm run build"},"keywords":["chittyos","chittyid","identity","uuid","minting","validation"],"author":{"name":"ChittyOS Framework"},"license":"MIT","dependencies":{"@chittyos/types":"^1.0.0","@chittyos/env":"^1.0.0","@chittyos/config":"^1.0.0","@chittyos/http-client":"^1.0.0"},"devDependencies":{"@types/node":"^20.0.0","tsup":"^8.0.0","typescript":"^5.3.0","vitest":"^1.0.0"},"publishConfig":{"access":"public"},"sideEffects":false,"_id":"@chittyos/chittyid-client@1.0.1","gitHead":"83fe125ea56ff687681dcdaef46d3fbb9da914cd","_nodeVersion":"24.4.1","_npmVersion":"11.5.1","dist":{"integrity":"sha512-JJJhhDb8L0OWQrFxMiNRlCz2dztuVfrrfJHUMeW1KpadcTOjbFBCiXBrlSKvmRclmsmD410x2CMqvQq/HJ1TrA==","shasum":"fe3a42e7914931242f1e3670c3f2fefa60ccb8a7","tarball":"https://registry.npmjs.org/@chittyos/chittyid-client/-/chittyid-client-1.0.1.tgz","fileCount":6,"unpackedSize":25001,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGdESHbvl3j2AWiIwt+knvYAIef3UbXYHopMT4e0Dx8xAiEAmKwCF5H2k2RUBBoGCtJ1hhjmOC7EtTCEx8qf7/tkJYc="}]},"_npmUser":{"name":"chitcommit","email":"chitcommit@chitty.cc"},"directories":{},"maintainers":[{"name":"chitcommit","email":"chitcommit@chitty.cc"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/chittyid-client_1.0.1_1760307094680_0.33194313673481735"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-04T00:17:13.981Z","modified":"2025-10-12T22:11:35.074Z","1.0.0":"2025-10-04T00:17:14.665Z","1.0.1":"2025-10-12T22:11:34.875Z"},"author":{"name":"ChittyOS Framework"},"license":"MIT","keywords":["chittyos","chittyid","identity","uuid","minting","validation"],"description":"ChittyID client for minting and validating ChittyOS identifiers","maintainers":[{"name":"chitcommit","email":"chitcommit@chitty.cc"}],"readme":"# @chittyos/chittyid-client\n\nChittyID client for minting and validating ChittyOS identifiers.\n\n## Installation\n\n```bash\nnpm install @chittyos/chittyid-client\n```\n\n## Important: Service or Fail Policy\n\nThis client follows ChittyOS **\"service or fail\"** policy:\n- ✅ All ChittyIDs MUST be minted from `https://id.chitty.cc`\n- ❌ NO local ChittyID generation is permitted\n- ❌ NO fallback to local generation on service failure\n- ✅ Proper error handling when service is unavailable\n\n## Usage\n\n### Basic Setup\n\n```typescript\nimport { ChittyIDClient } from '@chittyos/chittyid-client';\n\n// Create client (requires CHITTY_ID_TOKEN environment variable)\nconst client = new ChittyIDClient();\n\n// Or with custom configuration\nconst client = new ChittyIDClient({\n  baseURL: 'https://id.chitty.cc',\n  token: 'your-chitty-id-token',\n  timeout: 30000,\n});\n```\n\n### Mint a Single ChittyID\n\n```typescript\nimport { mintChittyID } from '@chittyos/chittyid-client';\n\n// Mint with convenience function\nconst response = await mintChittyID({\n  entity: 'PEO',              // Person entity\n  trust: 'verified',          // Trust level\n  metadata: {\n    name: 'John Doe',\n    email: 'john@example.com'\n  }\n});\n\nconsole.log(response.chittyId);  // CHITTY-PEO-123456-ABC123\n```\n\n### Mint Multiple ChittyIDs (Batch)\n\n```typescript\nconst client = new ChittyIDClient();\n\nconst response = await client.batchMint({\n  requests: [\n    { entity: 'PEO', trust: 'verified' },\n    { entity: 'PROP', trust: 'self' },\n    { entity: 'EVNT', trust: 'verified' },\n  ]\n});\n\nconsole.log(response.ids);\n// [\n//   'CHITTY-PEO-123456-ABC123',\n//   'CHITTY-PROP-789012-DEF456',\n//   'CHITTY-EVNT-345678-GHI789'\n// ]\n```\n\n### Session-Based Minting\n\n```typescript\nconst client = new ChittyIDClient();\n\n// Create a minting session\nconst session = await client.createSession({\n  batchSize: 100,\n  trust: 'verified',\n  entity: 'PEO'\n});\n\nconsole.log(session.sessionId);  // session-abc123\n\n// Use session for minting\nconst response = await client.mint({\n  entity: 'PEO',\n  sessionId: session.sessionId\n});\n```\n\n### Validate ChittyID Format\n\n```typescript\nimport { validateChittyID } from '@chittyos/chittyid-client';\n\n// Local format validation (no service call)\nconst result = await validateChittyID(\n  'CHITTY-PEO-123456-ABC123',\n  false  // Local validation only\n);\n\nconsole.log(result.valid);  // true\n```\n\n### Validate with Service Verification\n\n```typescript\nconst client = new ChittyIDClient();\n\n// Verify with service (makes API call)\nconst result = await client.validate(\n  'CHITTY-PEO-123456-ABC123',\n  true  // Verify with service\n);\n\nconsole.log(result.valid);    // true\nconsole.log(result.entity);   // 'PEO'\nconsole.log(result.trust);    // 'verified'\n```\n\n### Batch Validation\n\n```typescript\nconst client = new ChittyIDClient();\n\nconst results = await client.batchValidate([\n  'CHITTY-PEO-123456-ABC123',\n  'CHITTY-PROP-789012-DEF456',\n  'invalid-chitty-id',\n]);\n\nresults.forEach((result, i) => {\n  console.log(`ID ${i}: ${result.valid ? 'valid' : 'invalid'}`);\n  if (!result.valid) {\n    console.log(`  Error: ${result.error}`);\n  }\n});\n```\n\n### Check Service Health\n\n```typescript\nconst client = new ChittyIDClient();\n\nconst health = await client.health();\n\nconsole.log(health.status);   // 'healthy'\nconsole.log(health.version);  // '2.0.0'\n```\n\n## Entity Types\n\nSupported ChittyID entity types:\n\n| Entity | Description |\n|--------|-------------|\n| `PEO` | Person |\n| `PLACE` | Physical location |\n| `PROP` | Property/Asset |\n| `EVNT` | Event/Occurrence |\n| `AUTH` | Authentication/Authorization |\n| `INFO` | Information/Data |\n| `FACT` | Fact/Claim |\n| `CONTEXT` | Context/Environment |\n| `ACTOR` | Actor/Agent |\n\n## Trust Levels\n\n| Trust | Description |\n|-------|-------------|\n| `self` | Self-attested, no verification |\n| `verified` | Verified by ChittyOS authority |\n| `certified` | Certified by external authority |\n| `notarized` | Notarized with legal standing |\n\n## Error Handling\n\n```typescript\nimport { ChittyIDError } from '@chittyos/types';\n\ntry {\n  const response = await client.mint({ entity: 'PEO' });\n} catch (error) {\n  if (error instanceof ChittyIDError) {\n    console.error('ChittyID Error:', error.code);\n    console.error('Message:', error.message);\n    console.error('Status:', error.statusCode);\n    console.error('Metadata:', error.metadata);\n  }\n}\n```\n\n## Environment Variables\n\nRequired:\n```bash\n# ChittyID authentication token\nCHITTY_ID_TOKEN=your-chitty-id-token\n```\n\nOptional:\n```bash\n# Override service URL (default: https://id.chitty.cc)\nCHITTYID_SERVICE=https://custom-id.chitty.cc\n```\n\n## Configuration Options\n\n```typescript\ninterface ChittyIDClientConfig {\n  /** ChittyID service base URL */\n  baseURL?: string;\n  /** ChittyID token for authentication */\n  token?: string;\n  /** Request timeout in milliseconds (default: 30000) */\n  timeout?: number;\n  /** Enable automatic retries (default: true) */\n  retryEnabled?: boolean;\n}\n```\n\n## API Reference\n\n### ChittyIDClient\n\n**Constructor**\n```typescript\nnew ChittyIDClient(config?: ChittyIDClientConfig)\n```\n\n**Methods**\n- `createSession(config?: SessionConfig): Promise<MintSessionResponse>`\n- `mint(request: MintRequest): Promise<MintResponse>`\n- `batchMint(request: BatchMintRequest): Promise<BatchMintResponse>`\n- `validate(chittyId: string, verifyWithService?: boolean): Promise<ValidateResponse>`\n- `batchValidate(chittyIds: string[]): Promise<ValidateResponse[]>`\n- `health(): Promise<{ status: string; version: string }>`\n- `getBaseURL(): string`\n\n### Convenience Functions\n\n```typescript\n// Mint single ChittyID\nmintChittyID(request: MintRequest, config?: ChittyIDClientConfig): Promise<MintResponse>\n\n// Validate ChittyID\nvalidateChittyID(chittyId: string, verifyWithService?: boolean, config?: ChittyIDClientConfig): Promise<ValidateResponse>\n\n// Create client\ncreateChittyIDClient(config?: ChittyIDClientConfig): ChittyIDClient\n```\n\n## Features\n\n- ✅ Service-only minting (no local generation)\n- ✅ Batch minting support\n- ✅ Session-based minting for high-volume operations\n- ✅ Format validation (client-side)\n- ✅ Service verification (server-side)\n- ✅ Batch validation\n- ✅ Automatic retry on network errors\n- ✅ Type-safe API with TypeScript\n- ✅ Comprehensive error handling\n- ✅ Health check support\n\n## Dependencies\n\n- `@chittyos/types` - Type definitions\n- `@chittyos/env` - Environment management\n- `@chittyos/config` - Service configuration\n- `@chittyos/http-client` - HTTP client with retry\n\n## Package Size\n\n~45 KB (gzipped: ~12 KB)\n\n## License\n\nMIT\n","readmeFilename":"README.md"}