attestix 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,62 @@
1
+ # Changelog
2
+
3
+ All notable changes to the `attestix` npm package are documented here.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.4.0] - 2026-05-30
9
+
10
+ Version alignment to the Attestix 0.4.0 release line — the JS/TS engine now
11
+ shares its name and version with the Python `attestix` 0.4.0 stable release on
12
+ PyPI and the other verifier ports (Go, Rust, Java, R), so the story is "same
13
+ name, same version, same conformance suite, every ecosystem."
14
+
15
+ ### Changed
16
+
17
+ - Bumped `0.2.0` → `0.4.0` to match the Attestix 0.4.0 release across all engines.
18
+ - `description` now states that the package verifies credentials and delegation
19
+ chains issued by **Attestix 0.4.0** and conforms to the shared `spec/verify/v1`
20
+ vectors.
21
+
22
+ ### Added
23
+
24
+ - **Shared cross-language conformance vectors.** `tests/conformance.test.ts`
25
+ loads the authoritative `vectors.json` from the foundation repo
26
+ (`VibeTensor/attestix:spec/verify/v1`, attestix 0.4.0) and drives every kind
27
+ through the public API — `canonicalize`, `didKeyToPublicKey`,
28
+ `verifyCredential`, and `verifyDelegationChain`. This is the **same** suite the
29
+ Go / Rust / Java / R ports must reproduce byte-for-byte, so the npm engine is
30
+ now on the identical conformance contract. The vectors are vendored at
31
+ `tests/vectors/conformance/vectors.json`.
32
+ - Note: the `canon-001` vector includes `9007199254740993` (2^53 + 1), which a
33
+ JS `number` cannot represent exactly; the test accounts for that known
34
+ runtime limitation and still asserts the rest byte-for-byte.
35
+
36
+ ### Notes
37
+
38
+ - **Publishing is not yet done.** The unscoped `attestix` name is claimed on npm
39
+ but not published; this release is staged for a future token-free publish via
40
+ GitHub Release (OIDC trusted publishing, `.github/workflows/publish.yml`). The
41
+ currently published artifact remains the scoped, stale
42
+ `@vibetensor/attestix@0.2.0`.
43
+
44
+ ## [0.2.0]
45
+
46
+ ### Added
47
+
48
+ - Offline, cross-engine verification of Attestix Ed25519-signed W3C Verifiable
49
+ Credentials / Presentations and UCAN-style delegation chains (`verifyCredential`,
50
+ `verifyPresentation`, `verifyDelegationChain`) plus the lower-level
51
+ `canonicalize`, `did:key` codec, and raw `verifyEd25519` primitives. No network
52
+ access; one small audited dependency (`@noble/curves`). Tracks the cross-engine
53
+ interop work in [attestix#7](https://github.com/VibeTensor/attestix/issues/7).
54
+ - Claimed the bare `attestix` name on npm (renamed from `@vibetensor/attestix`).
55
+
56
+ ## [0.1.0]
57
+
58
+ ### Added
59
+
60
+ - Initial REST client (`AttestixClient`) for the Attestix API: identity,
61
+ credentials, compliance, reputation, provenance, delegation, DID, and
62
+ blockchain anchoring, with typed errors and automatic retry/backoff.
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 VibeTensor Inc.
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,296 @@
1
+ # attestix
2
+
3
+ [![version](https://img.shields.io/badge/version-0.4.0-blue)](https://github.com/VibeTensor/attestix-js)
4
+
5
+ TypeScript SDK and offline verifier for [Attestix](https://github.com/VibeTensor/attestix) - Attestation Infrastructure for AI Agents.
6
+
7
+ This is the JavaScript/TypeScript engine in the Attestix family. Version **0.4.0**
8
+ is aligned with the Attestix 0.4.0 release line: the same name, the same version,
9
+ and the same conformance suite across every ecosystem (Python on PyPI, this package
10
+ on npm, and the Go / Rust / Java / R verifier ports). A credential or delegation
11
+ issued by Attestix 0.4.0 (in any engine) verifies here, byte-for-byte, offline.
12
+
13
+ Provides typed client methods for identity management, verifiable credentials, compliance tracking, reputation scoring, provenance recording, delegation chains, DID operations, and blockchain anchoring.
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install attestix
19
+ ```
20
+
21
+ > **Heads-up on the package name (transition state).** The unscoped `attestix`
22
+ > name on npm is claimed but **not yet published** — the unscoped publish is
23
+ > pending a registry token. Until that lands, the published artifact is the
24
+ > scoped, stale `@vibetensor/attestix@0.2.0`:
25
+ >
26
+ > ```bash
27
+ > npm install @vibetensor/attestix # currently published (0.2.0)
28
+ > ```
29
+ >
30
+ > Once `attestix@0.4.0` is published, `@vibetensor/attestix` will be deprecated
31
+ > with a pointer to the unscoped name. Prefer `attestix` in new code.
32
+
33
+ ## Quick Start
34
+
35
+ ```typescript
36
+ import { AttestixClient } from 'attestix';
37
+
38
+ const client = new AttestixClient({
39
+ baseUrl: 'https://api.attestix.io',
40
+ apiKey: 'your-api-key',
41
+ });
42
+
43
+ // Create an agent identity
44
+ const identity = await client.createIdentity({
45
+ name: 'My AI Agent',
46
+ type: 'autonomous',
47
+ capabilities: ['text-generation', 'code-review'],
48
+ });
49
+
50
+ console.log(identity.agent_id);
51
+
52
+ // Issue a credential
53
+ const credential = await client.issueCredential({
54
+ issuer: identity.agent_id,
55
+ subject: identity.agent_id,
56
+ type: 'SafetyAudit',
57
+ claims: { passed: true, score: 95 },
58
+ });
59
+
60
+ // Verify it
61
+ const result = await client.verifyCredential(credential.credential_id);
62
+ console.log(result.valid); // true
63
+ ```
64
+
65
+ ## Offline verification (cross-engine interop)
66
+
67
+ Since v0.2.0 the package can verify Attestix Ed25519-signed **W3C Verifiable
68
+ Credentials / Presentations** and **UCAN-style delegation chains** entirely
69
+ offline — no API call, in Node or the browser. The canonical-JSON rules,
70
+ `did:key` codec, and signed-field sets are byte-compatible with the Python
71
+ Attestix engine, so a credential or delegation issued by the Python server
72
+ verifies in JS/TS and vice-versa. This is the cross-engine interop path tracked
73
+ in [attestix#7](https://github.com/VibeTensor/attestix/issues/7); the exact wire
74
+ format and canonicalization rules are documented in [`SPEC.md`](./SPEC.md).
75
+
76
+ It adds one small, audited dependency (`@noble/curves`) for Ed25519 and no
77
+ network access.
78
+
79
+ ### Cross-language conformance
80
+
81
+ The verifier is held to the **shared conformance vectors** maintained in the
82
+ foundation repo at
83
+ [`spec/verify/v1`](https://github.com/VibeTensor/attestix/tree/main/spec/verify/v1)
84
+ (canonical-form rules in
85
+ [`README.md`](https://github.com/VibeTensor/attestix/blob/main/spec/verify/v1/README.md),
86
+ verifier surface in
87
+ [`CONFORMANCE.md`](https://github.com/VibeTensor/attestix/blob/main/spec/verify/v1/CONFORMANCE.md)).
88
+ These are the **same** vectors every port (Go, Rust, Java, R, JS) must reproduce
89
+ byte-for-byte. This package runs them in CI
90
+ ([`tests/conformance.test.ts`](./tests/conformance.test.ts)) against the
91
+ `vectors.json` for attestix 0.4.0, so the npm engine stays on the exact same
92
+ suite as the others.
93
+
94
+ ### Verify a credential
95
+
96
+ ```typescript
97
+ import { verifyCredential } from 'attestix';
98
+
99
+ // `vc` is the raw VC JSON (e.g. from issueCredential, a file, or a QR payload)
100
+ const result = verifyCredential(vc);
101
+
102
+ if (result.valid) {
103
+ console.log('Issuer:', result.issuer); // did:key:z...
104
+ console.log('Subject:', result.subject);
105
+ } else {
106
+ console.log('Invalid:', result.reason); // e.g. "Invalid signature"
107
+ }
108
+
109
+ // Per-check detail:
110
+ // result.checks = { structure_valid, signature_valid, not_expired, not_revoked }
111
+ ```
112
+
113
+ `verifyCredential` recomputes the canonical bytes over the signed fields
114
+ (everything except the mutable `proof` and `credentialStatus`), then verifies
115
+ the `Ed25519Signature2020` proof against the issuer's `did:key`. Revocation can
116
+ only be confirmed against the embedded `credentialStatus`; live revocation is a
117
+ server-side lookup, so `not_revoked` reflects only what is present in the
118
+ document offline.
119
+
120
+ ### Verify a delegation chain
121
+
122
+ ```typescript
123
+ import { verifyDelegationChain } from 'attestix';
124
+
125
+ // Pass the leaf JWT (its `prf` parent chain is walked automatically),
126
+ // or an explicit array of tokens ordered leaf..root.
127
+ const result = verifyDelegationChain(leafToken);
128
+
129
+ if (result.valid) {
130
+ console.log('Effective capabilities:', result.capabilities);
131
+ console.log('Chain length:', result.links.length);
132
+ }
133
+ ```
134
+
135
+ `verifyDelegationChain` verifies every link's EdDSA JWS signature against its
136
+ issuer `did:key`, walks the full `prf` proof chain, detects cycles, enforces
137
+ expiry/`nbf`, and re-checks **capability attenuation** (each child's `att` must
138
+ be a subset of its parent's `att`) so a forged chain that escalates scope is
139
+ rejected.
140
+
141
+ ### Lower-level primitives
142
+
143
+ The canonicalizer, `did:key` codec, and raw Ed25519 verify are also exported:
144
+
145
+ ```typescript
146
+ import {
147
+ canonicalize, // JSON value -> canonical UTF-8 bytes (Python-compatible)
148
+ didKeyToPublicKey, // did:key:z... -> 32-byte Ed25519 public key
149
+ publicKeyToDidKey, // 32-byte Ed25519 public key -> did:key:z...
150
+ verifyEd25519, // (signature, message, publicKey) -> boolean
151
+ verifyPresentation, // verify a Verifiable Presentation + its embedded VCs
152
+ } from 'attestix';
153
+ ```
154
+
155
+ ## API Reference
156
+
157
+ ### Identity
158
+
159
+ | Method | Description |
160
+ |--------|-------------|
161
+ | `createIdentity(params)` | Register a new agent identity |
162
+ | `getIdentity(agentId)` | Retrieve an identity by agent ID |
163
+ | `listIdentities(params?)` | List identities with optional filters |
164
+ | `verifyIdentity(agentId)` | Verify an identity's validity |
165
+ | `translateIdentity(agentId, format)` | Translate identity to another format |
166
+ | `revokeIdentity(agentId, reason?)` | Revoke an identity |
167
+ | `purgeAgentData(agentId)` | Delete all data for an agent |
168
+
169
+ ### Credentials
170
+
171
+ | Method | Description |
172
+ |--------|-------------|
173
+ | `issueCredential(params)` | Issue a new verifiable credential |
174
+ | `getCredential(credentialId)` | Retrieve a credential |
175
+ | `listCredentials(params?)` | List credentials with filters |
176
+ | `verifyCredential(credentialId)` | Verify a credential |
177
+ | `verifyExternalCredential(credential)` | Verify an externally-issued credential |
178
+ | `revokeCredential(credentialId, reason?)` | Revoke a credential |
179
+ | `createPresentation(params)` | Create a verifiable presentation |
180
+
181
+ ### Compliance
182
+
183
+ | Method | Description |
184
+ |--------|-------------|
185
+ | `createComplianceProfile(params)` | Create a compliance profile |
186
+ | `getComplianceProfile(profileId)` | Get a compliance profile |
187
+ | `listComplianceProfiles()` | List all compliance profiles |
188
+ | `getComplianceStatus(profileId)` | Get compliance status |
189
+ | `recordAssessment(params)` | Record a compliance assessment |
190
+ | `generateDeclaration(params)` | Generate a declaration of conformity |
191
+
192
+ ### Reputation
193
+
194
+ | Method | Description |
195
+ |--------|-------------|
196
+ | `recordInteraction(params)` | Record an agent interaction |
197
+ | `getReputation(agentId)` | Get reputation score for an agent |
198
+ | `queryReputation(params?)` | Query reputation scores with filters |
199
+
200
+ ### Provenance
201
+
202
+ | Method | Description |
203
+ |--------|-------------|
204
+ | `recordTrainingData(params)` | Record training data provenance |
205
+ | `recordModelLineage(params)` | Record model lineage |
206
+ | `logAction(params)` | Log an auditable action |
207
+ | `getProvenance(agentId)` | Get provenance entries for an agent |
208
+ | `getAuditTrail(params?)` | Query the audit trail |
209
+
210
+ ### Delegation
211
+
212
+ | Method | Description |
213
+ |--------|-------------|
214
+ | `createDelegation(params)` | Create a delegation chain |
215
+ | `listDelegations(params?)` | List delegations |
216
+ | `verifyDelegation(token)` | Verify a delegation token |
217
+ | `revokeDelegation(delegationId)` | Revoke a delegation |
218
+
219
+ ### DID
220
+
221
+ | Method | Description |
222
+ |--------|-------------|
223
+ | `createDidKey()` | Create a did:key document |
224
+ | `createDidWeb(domain)` | Create a did:web document |
225
+ | `resolveDid(did)` | Resolve a DID to its document |
226
+
227
+ ### Blockchain Anchoring
228
+
229
+ | Method | Description |
230
+ |--------|-------------|
231
+ | `anchorIdentity(agentId)` | Anchor an identity on-chain |
232
+ | `anchorCredential(credentialId)` | Anchor a credential on-chain |
233
+ | `anchorAuditBatch(entryIds?)` | Anchor a batch of audit entries |
234
+ | `verifyAnchor(anchorId)` | Verify an on-chain anchor |
235
+ | `getAnchorStatus(anchorId)` | Get anchor status |
236
+ | `estimateAnchorCost()` | Estimate anchoring cost |
237
+
238
+ ### Offline Verification
239
+
240
+ | Function | Description |
241
+ |--------|-------------|
242
+ | `verifyCredential(vc, options?)` | Verify a W3C VC's Ed25519 proof, structure, and expiry offline |
243
+ | `verifyPresentation(vp, options?)` | Verify a VP's holder proof and every embedded credential offline |
244
+ | `verifyDelegationChain(token \| tokens, options?)` | Verify a UCAN/JWT delegation chain (signatures, attenuation, expiry, cycles) |
245
+ | `canonicalize(value)` | Canonical UTF-8 bytes matching the Python engine's JCS form |
246
+ | `didKeyToPublicKey(did)` / `publicKeyToDidKey(bytes)` | did:key (Ed25519) decode / encode |
247
+ | `verifyEd25519(sig, msg, pubKey)` | Raw Ed25519 signature verification |
248
+
249
+ ## Error Handling
250
+
251
+ The SDK throws typed errors based on HTTP status codes:
252
+
253
+ ```typescript
254
+ import {
255
+ AttestixAuthError,
256
+ AttestixNotFoundError,
257
+ AttestixValidationError,
258
+ AttestixRateLimitError,
259
+ } from 'attestix';
260
+
261
+ try {
262
+ await client.getIdentity('nonexistent');
263
+ } catch (error) {
264
+ if (error instanceof AttestixNotFoundError) {
265
+ console.log('Agent not found');
266
+ } else if (error instanceof AttestixAuthError) {
267
+ console.log('Invalid API key');
268
+ } else if (error instanceof AttestixRateLimitError) {
269
+ console.log(`Rate limited, retry after ${error.retryAfter}s`);
270
+ }
271
+ }
272
+ ```
273
+
274
+ ## Configuration
275
+
276
+ ```typescript
277
+ const client = new AttestixClient({
278
+ baseUrl: 'https://api.attestix.io', // Required: API server URL
279
+ apiKey: 'your-api-key', // Required: API key
280
+ timeout: 30000, // Optional: request timeout in ms (default: 30000)
281
+ });
282
+ ```
283
+
284
+ The SDK automatically retries on 429 (rate limit) and 503 (service unavailable) responses with exponential backoff.
285
+
286
+ ## License
287
+
288
+ Apache-2.0
289
+
290
+ ## Links
291
+
292
+ - [Attestix (parent repo)](https://github.com/VibeTensor/attestix) — the Attestix core engine (Python, PyPI)
293
+ - [Verifier conformance spec](https://github.com/VibeTensor/attestix/tree/main/spec/verify/v1) — shared cross-language vectors + canonical-form rules
294
+ - [Attestix Documentation](https://attestix.io/docs)
295
+ - [GitHub (this package)](https://github.com/VibeTensor/attestix-js)
296
+ - [VibeTensor](https://vibetensor.com)