diff --git a/docs/demos/example-identity.mdx b/docs/demos/example-identity.mdx index bffaf4d9..073fda3d 100644 --- a/docs/demos/example-identity.mdx +++ b/docs/demos/example-identity.mdx @@ -9,16 +9,14 @@ This example demonstrates an [ACK-ID](https://agentcommercekit.com/ack-id) and [ The API supports issuing, verifying, and revoking two primary credential types: -- **`ControllerCredential`**: proves ownership of DIDs (part of ACK-ID). -- **`PaymentReceiptCredential`**: provides proof of payment meeting a Payment Request (part of ACK-Pay). +- **`ControllerCredential`**: Proves ownership of DIDs as part of ACK-ID. +- **`PaymentReceiptCredential`**: Provides proof of payment that satisfies a Payment Request as part of ACK-Pay. -The issuer implements credential revocation using [Bitstring Status List](https://www.w3.org/TR/vc-bitstring-status-list/), a privacy-preserving and efficient revocation list method. +The issuer implements credential revocation using [Bitstring Status List](https://www.w3.org/TR/vc-bitstring-status-list/), a privacy-preserving and efficient revocation-list method. ## Installation and Setup -Install dependencies and prepare your environment. - -From within the issuer example directory (e.g., from project root: `./examples/issuer`) execute the setup: +Install dependencies and prepare your environment. From within the issuer example directory (for example, `./examples/issuer` from the project root), execute: ```sh pnpm run setup @@ -32,26 +30,26 @@ Start the API server locally: pnpm run dev ``` -The server runs at: [http://localhost:3456](http://localhost:3456) +The server runs at . ## API Endpoints ### Authentication -All endpoints require a **signed payload** (JWT) proving DID ownership. During local development, include the `X-Payload-Issuer` header with a resolvable DID-URI to bypass signature verification. +Mutation endpoints require a signed payload (JWT) proving DID ownership. Read-only GET endpoints do not require a signed payload. ### Response Format -All API responses use this JSON structure: +Credential endpoints use this JSON structure: ```json { "ok": true, - "data": + "data": "" } ``` -or +or: ```json { @@ -60,120 +58,118 @@ or } ``` -### Controller Credential Endpoints +`GET /status/:listId` returns a bare `BitstringStatusListCredential`, and `GET /.well-known/did.json` returns a bare DID document without the `{ ok, data }` envelope. + +## Controller Credential Endpoints -#### `POST /credentials/controller` +### POST /credentials/controller -Issue a ControllerCredential proving DID control. +Issue a `ControllerCredential` proving DID control. -**Sample cURL:** +#### Sample cURL ```sh +# NOTE: Replace this non-runnable placeholder with a valid signed JWT. curl --request POST \ --url http://localhost:3456/credentials/controller \ --header 'Content-Type: application/json' \ - --header 'X-Payload-Issuer: did:web:0.0.0.0%3A3458:controller' \ --data '{ - "controller": "did:web:0.0.0.0%3A3458:controller", - "subject": "did:web:0.0.0.0%3A3458:agent" + "payload": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6d2ViOmV4YW1wbGUuY29tIn0.signature" }' ``` -#### `GET /credentials/controller/:id` +### GET /credentials/controller/:id -Retrieve a ControllerCredential by ID. +Retrieve a `ControllerCredential` by ID. -**Sample cURL:** +#### Sample cURL ```sh curl --request GET \ --url http://localhost:3456/credentials/controller/abc123 ``` -#### `DELETE /credentials/controller` +### DELETE /credentials/controller -Revoke a ControllerCredential by ID. +Revoke a `ControllerCredential` by ID. -**Sample cURL:** +#### Sample cURL ```sh +# NOTE: Replace this non-runnable placeholder with a valid signed JWT. curl --request DELETE \ --url http://localhost:3456/credentials/controller \ --header 'Content-Type: application/json' \ - --header 'X-Payload-Issuer: did:web:0.0.0.0%3A3458:controller' \ --data '{ - "id": "abc123" + "payload": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6d2ViOmV4YW1wbGUuY29tIn0.signature" }' ``` -### Payment Receipt Endpoints +## Payment Receipt Endpoints -#### `POST /credentials/receipts` +### POST /credentials/receipts -Issue a PaymentReceiptCredential. +Issue a `PaymentReceiptCredential`. -**Sample cURL:** +#### Sample cURL ```sh +# NOTE: Replace this non-runnable placeholder with a valid signed JWT. curl --request POST \ --url http://localhost:3456/credentials/receipts \ --header 'Content-Type: application/json' \ - --header 'X-Payload-Issuer: did:web:0.0.0.0%3A3458:wallet' \ --data '{ - "metadata": { "txHash": "0x123abc456def" }, - "payerDid": "did:web:0.0.0.0%3A3458:wallet", - "paymentRequestToken": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9...", - "paymentOptionId": "option1" + "payload": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6d2ViOmV4YW1wbGUuY29tIn0.signature" }' ``` -#### `GET /credentials/receipts/:id` +### GET /credentials/receipts/:id -Retrieve a PaymentReceiptCredential by ID. +Retrieve a `PaymentReceiptCredential` by ID. -**Sample cURL:** +#### Sample cURL ```sh curl --request GET \ --url http://localhost:3456/credentials/receipts/abc123 ``` -#### `DELETE /credentials/receipts` +### DELETE /credentials/receipts -Revoke a PaymentReceiptCredential by ID. +Revoke a `PaymentReceiptCredential` by ID. -**Sample cURL:** +#### Sample cURL ```sh +# NOTE: Replace this non-runnable placeholder with a valid signed JWT. curl --request DELETE \ --url http://localhost:3456/credentials/receipts \ --header 'Content-Type: application/json' \ - --header 'X-Payload-Issuer: did:web:0.0.0.0%3A3458:payee' \ --data '{ - "id": "abc123" + "payload": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6d2ViOmV4YW1wbGUuY29tIn0.signature" }' ``` -### Status List Endpoint +## Status List Endpoint -#### `GET /status/:listId` +### GET /status/:listId -Retrieve Bitstring Status List credential for revocation checks. +Retrieve the Bitstring Status List credential for revocation checks. -**Sample cURL:** +#### Sample cURL ```sh curl --request GET \ - --url http://localhost:3456/status/1 + --url http://localhost:3456/status/0 ``` -### DID Document Endpoint +## DID Document Endpoint -#### `GET /.well-known/did.json` +### GET /.well-known/did.json Retrieve the issuer's DID Document. -**Sample cURL:** +#### Sample cURL ```sh curl --request GET \ @@ -183,4 +179,4 @@ curl --request GET \ ## References - [Verifiable Credentials Data Model Specification](https://www.w3.org/TR/vc-data-model/) -- [This Example's Source Code](https://github.com/agentcommercekit/ack/tree/main/examples/issuer) +- [This example's source code](https://github.com/agentcommercekit/ack/tree/main/examples/issuer) diff --git a/examples/issuer/.env.example b/examples/issuer/.env.example index 167ac780..9e1254ff 100644 --- a/examples/issuer/.env.example +++ b/examples/issuer/.env.example @@ -1,8 +1,2 @@ BASE_URL="http://localhost:3456" NODE_ENV="development" - -# Local-development ONLY: when "true", accept unsigned request payloads with an -# `X-Payload-Issuer` header instead of a signed JWT. This bypasses signature -# verification (authentication), so it is off by default. Never enable it in a -# deployed environment. -# ALLOW_UNSIGNED_PAYLOADS="true" diff --git a/examples/issuer/README.md b/examples/issuer/README.md index 40fd5eaa..f14837ad 100644 --- a/examples/issuer/README.md +++ b/examples/issuer/README.md @@ -5,9 +5,9 @@ This example showcases a **Credential Issuer** for [ACK-ID](https://www.agentcom The API allows for the issuance, verification, and revocation of the following credential types: - `ControllerCredential`: ACK-ID credentials that prove DID ownership hierarchies. -- `PaymentReceiptCredential`: ACK-Pay credentials that provide proof of payment that satisfies a given Payment Request. +- `PaymentReceiptCredential`: ACK-Pay credentials that provide proof of payment satisfying a given Payment Request. -This issuer supports credential revocation using [Bitstring Status List](https://www.w3.org/TR/vc-bitstring-status-list/), which is a privacy-preserving, space-efficient mechanism for maintaining a credential revocation list. +This issuer supports credential revocation using [Bitstring Status List](https://www.w3.org/TR/vc-bitstring-status-list/), a privacy-preserving, space-efficient mechanism for maintaining a credential revocation list. ## Getting Started @@ -15,38 +15,38 @@ This issuer supports credential revocation using [Bitstring Status List](https:/ pnpm run setup ``` -## Running the server +### Running the server + +Start the API server locally: ```sh pnpm run dev ``` -The server will be available at +The server will be available at . -### Database +## Database -To simplify the development experience, this API uses a SQLite database. In a production environment, we recommend using a database with native bitwise operations like PostgreSQL. +To simplify the development experience, this API uses a SQLite database. In a production environment, we recommend using a database with native bitwise operations such as PostgreSQL. ## API Endpoints ### Authentication -All API endpoints require a **signed payload** to prove ownership of the DIDs involved. This payload is a JWT of the request parameters, signed using your DID. - -In local development, you can bypass the signed payload requirement by setting `ALLOW_UNSIGNED_PAYLOADS="true"` in your `.env` and sending an `X-Payload-Issuer` header with a DID-URI as its value. This simulates that you signed the payload, and is **off by default** — never enable it outside local development, as it disables authentication. NOTE: This `did` MUST be resolvable, which makes using the [`local-did-host`](../local-did-host/) server helpful. +Mutation endpoints require a signed payload (JWT) to prove ownership of the DIDs involved. Read-only GET endpoints do not require a signed payload. ### Response format -All API responses respond as JSON objects with the following format: +Credential endpoints use this JSON structure: ```json { "ok": true, - "data": + "data": "" } ``` -or +or: ```json { @@ -55,22 +55,24 @@ or } ``` -### Controller Credential Endpoints +The `GET /status/:listId` and `GET /.well-known/did.json` endpoints return bare responses rather than the `{ ok, data }` envelope. + +## Controller Credential Endpoints -#### POST /credentials/controller +### POST /credentials/controller -Create a new ControllerCredential that proves one DID controls another +Create a new `ControllerCredential` that proves one DID controls another. -**Request Payload**, signed by the controller +#### Request payload, signed by the controller -```ts +```typescript SignedPayload<{ controller: "did:..." subject: "did:..." }> ``` -**Response Body** +#### Response body ```json { @@ -78,30 +80,29 @@ SignedPayload<{ "data": { "credential": { ... - } + }, "jwt": "credential-jwt" } } ``` -**Sample cURL** +#### Sample cURL ```sh +# NOTE: Replace this non-runnable placeholder with a valid signed JWT. curl --request POST \ --url http://localhost:3456/credentials/controller \ --header 'Content-Type: application/json' \ - --header 'X-Payload-Issuer: did:web:0.0.0.0%3A3458:controller' \ --data '{ - "controller": "did:web:0.0.0.0%3A3458:controller", - "subject": "did:web:0.0.0.0%3A3458:agent" + "payload": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6d2ViOmV4YW1wbGUuY29tIn0.signature" }' ``` -#### GET /credentials/controller/:id +### GET /credentials/controller/:id -Retrieve a credential by its identifier +Retrieve a credential by its identifier. -**Response Body** +#### Response body ```json { @@ -109,32 +110,32 @@ Retrieve a credential by its identifier "data": { "credential": { ... - } + }, "jwt": "credential-jwt" } } ``` -**Sample cURL** +#### Sample cURL ```sh curl --request GET \ --url http://localhost:3456/credentials/controller/abc123 ``` -#### DELETE /credentials/controller +### DELETE /credentials/controller -Revoke a credential by its identifier +Revoke a credential by its identifier. -**Request Payload**, signed by the controller +#### Request payload, signed by the controller -```ts +```typescript SignedPayload<{ id: "credential-id" }> ``` -**Response Body** +#### Response body ```json { @@ -143,27 +144,27 @@ SignedPayload<{ } ``` -**Sample cURL** +#### Sample cURL ```sh +# NOTE: Replace this non-runnable placeholder with a valid signed JWT. curl --request DELETE \ --url http://localhost:3456/credentials/controller \ --header 'Content-Type: application/json' \ - --header 'X-Payload-Issuer: did:web:0.0.0.0%3A3458:controller' \ --data '{ - "id": "abc123" + "payload": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6d2ViOmV4YW1wbGUuY29tIn0.signature" }' ``` -### Payment Receipt Endpoints +## Payment Receipt Endpoints -#### POST /credentials/receipts +### POST /credentials/receipts -Generate a payment receipt credential that proves a payment was made +Generate a payment receipt credential that proves a payment was made. -**Request Payload**, signed by the wallet that made the payment: +#### Request payload, signed by the wallet that made the payment -```ts +```typescript SignedPayload<{ metadata: { txHash: "0x123..." @@ -174,7 +175,7 @@ SignedPayload<{ }> ``` -**Response Body** +#### Response body ```json { @@ -182,34 +183,29 @@ SignedPayload<{ "data": { "credential": { ... - } + }, "jwt": "credential-jwt" } } ``` -**Sample cURL** +#### Sample cURL ```sh +# NOTE: Replace this non-runnable placeholder with a valid signed JWT. curl --request POST \ --url http://localhost:3456/credentials/receipts \ --header 'Content-Type: application/json' \ - --header 'X-Payload-Issuer: did:web:0.0.0.0%3A3458:wallet' \ --data '{ - "metadata": { - "txHash": "0x123abc456def" - }, - "payerDid": "did:web:0.0.0.0%3A3458:wallet", - "paymentRequestToken": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9...", - "paymentOptionId": "option1" + "payload": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6d2ViOmV4YW1wbGUuY29tIn0.signature" }' ``` -#### GET /credentials/receipts/:id +### GET /credentials/receipts/:id -Retrieve a payment receipt credential by its identifier +Retrieve a payment receipt credential by its identifier. -**Response Body** +#### Response body ```json { @@ -217,34 +213,32 @@ Retrieve a payment receipt credential by its identifier "data": { "credential": { ... - } + }, "jwt": "credential-jwt" } } ``` -**Sample cURL** +#### Sample cURL ```sh curl --request GET \ --url http://localhost:3456/credentials/receipts/abc123 ``` -#### DELETE /credentials/receipts - -Revokes a payment receipt credential by flipping the bit on the credential's Status List. +### DELETE /credentials/receipts -For demo purposes, we only allow the original payment request token issuer to revoke the receipt. +Revoke a payment receipt credential by flipping the bit on the credential's Status List. For demo purposes, we only allow the original payment request token issuer to revoke the receipt. -**Request Payload**, signed by the original payment request token issuer +#### Request payload, signed by the original payment request token issuer -```ts +```typescript SignedPayload<{ id: "receipt-id" }> ``` -**Response Body** +#### Response body ```json { @@ -253,39 +247,36 @@ SignedPayload<{ } ``` -**Sample cURL** +#### Sample cURL ```sh +# NOTE: Replace this non-runnable placeholder with a valid signed JWT. curl --request DELETE \ --url http://localhost:3456/credentials/receipts \ --header 'Content-Type: application/json' \ - --header 'X-Payload-Issuer: did:web:0.0.0.0%3A3458:payee' \ --data '{ - "id": "abc123" + "payload": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6d2ViOmV4YW1wbGUuY29tIn0.signature" }' ``` -### Status Endpoints +## Status Endpoints -#### GET /status/:listId +### GET /status/:listId Retrieve a Bitstring Status List credential for checking revocation status. -Unlike the other endpoints, this one returns the signed credential directly -rather than in the `{ ok, data }` envelope. Verifiers dereference this URL as -the credential's `statusListCredential` and expect the credential itself; a -wrapped body cannot be verified, so revocation checks would fail. +Unlike the other endpoints, this one returns the signed credential directly rather than in the `{ ok, data }` envelope. Verifiers dereference this URL as the credential's `statusListCredential` and expect the credential itself; a wrapped body cannot be verified, so revocation checks would fail. -**Response Body** +#### Response body ```json { "@context": ["https://www.w3.org/2018/credentials/v1"], - "id": "http://localhost:3456/status/1", + "id": "http://localhost:3456/status/0", "type": ["VerifiableCredential", "BitstringStatusListCredential"], "issuer": { "id": "did:web:..." }, "credentialSubject": { - "id": "http://localhost:3456/status/1#list", + "id": "http://localhost:3456/status/0#list", "type": "BitstringStatusList", "statusPurpose": "revocation", "encodedList": "..." @@ -294,20 +285,20 @@ wrapped body cannot be verified, so revocation checks would fail. } ``` -**Sample cURL** +#### Sample cURL ```sh curl --request GET \ - --url http://localhost:3456/status/1 + --url http://localhost:3456/status/0 ``` -### DID Endpoints +## DID Endpoints -#### GET /.well-known/did.json +### GET /.well-known/did.json -Return the DID document for the issuer +Return the DID document for the issuer. -**Response Body** +#### Response body ```json { @@ -319,7 +310,7 @@ Return the DID document for the issuer } ``` -**Sample cURL** +#### Sample cURL ```sh curl --request GET \ @@ -328,4 +319,4 @@ curl --request GET \ ## License (MIT) -Copyright (c) 2025 [Catena Labs, Inc](https://catenalabs.com). +Copyright (c) 2025 Catena Labs, Inc. diff --git a/packages/ack-id/package.json b/packages/ack-id/package.json index 4b03b484..4bb4ad27 100644 --- a/packages/ack-id/package.json +++ b/packages/ack-id/package.json @@ -1,86 +1,86 @@ -{ - "name": "@agentcommercekit/ack-id", - "version": "0.11.0", - "homepage": "https://github.com/agentcommercekit/ack#readme", - "bugs": "https://github.com/agentcommercekit/ack/issues", - "license": "MIT", - "author": { - "name": "Catena Labs", - "url": "https://catenalabs.com" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/agentcommercekit/ack.git", - "directory": "packages/ack-id" - }, - "files": [ - "dist", - "package.json", - "LICENSE", - "README.md" - ], - "type": "module", - "main": "./dist/index.mjs", - "types": "./dist/index.d.mts", - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "./schemas/valibot": { - "types": "./dist/schemas/valibot.d.mts", - "default": "./dist/schemas/valibot.mjs" - }, - "./schemas/zod": { - "types": "./dist/schemas/zod.d.mts", - "default": "./dist/schemas/zod.mjs" - }, - "./a2a": { - "types": "./dist/a2a/index.d.mts", - "default": "./dist/a2a/index.mjs" - }, - "./a2a/schemas/valibot": { - "types": "./dist/a2a/schemas/valibot.d.mts", - "default": "./dist/a2a/schemas/valibot.mjs" - }, - "./a2a/schemas/zod": { - "types": "./dist/a2a/schemas/zod.d.mts", - "default": "./dist/a2a/schemas/zod.mjs" - } - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "build": "tsdown", - "clean": "git clean -fdX .turbo dist", - "dev": "pnpm build --watch --no-clean", - "test": "vitest" - }, - "dependencies": { - "@agentcommercekit/did": "workspace:*", - "@agentcommercekit/jwt": "workspace:*", - "@agentcommercekit/keys": "workspace:*", - "@agentcommercekit/vc": "workspace:*", - "safe-stable-stringify": "catalog:", - "uuid": "catalog:", - "valibot": "catalog:" - }, - "devDependencies": { - "@a2a-js/sdk": "catalog:", - "zod": "catalog:" - }, - "peerDependencies": { - "@a2a-js/sdk": "^0.3.0", - "zod": "^4.0.0" - }, - "peerDependenciesMeta": { - "@a2a-js/sdk": { - "optional": true - }, - "zod": { - "optional": true - } - } -} +{ + "name": "@agentcommercekit/ack-id", + "version": "0.11.0", + "homepage": "https://github.com/agentcommercekit/ack#readme", + "bugs": "https://github.com/agentcommercekit/ack/issues", + "license": "MIT", + "author": { + "name": "Catena Labs", + "url": "https://catenalabs.com" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/agentcommercekit/ack.git", + "directory": "packages/ack-id" + }, + "files": [ + "dist", + "package.json", + "LICENSE", + "README.md" + ], + "type": "module", + "main": "./dist/index.mjs", + "types": "./dist/index.d.mts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "./schemas/valibot": { + "types": "./dist/schemas/valibot.d.mts", + "default": "./dist/schemas/valibot.mjs" + }, + "./schemas/zod": { + "types": "./dist/schemas/zod.d.mts", + "default": "./dist/schemas/zod.mjs" + }, + "./a2a": { + "types": "./dist/a2a/index.d.mts", + "default": "./dist/a2a/index.mjs" + }, + "./a2a/schemas/valibot": { + "types": "./dist/a2a/schemas/valibot.d.mts", + "default": "./dist/a2a/schemas/valibot.mjs" + }, + "./a2a/schemas/zod": { + "types": "./dist/a2a/schemas/zod.d.mts", + "default": "./dist/a2a/schemas/zod.mjs" + } + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "tsdown --config-loader tsx", + "clean": "git clean -fdX .turbo dist", + "dev": "pnpm build --watch --no-clean", + "test": "vitest" + }, + "dependencies": { + "@agentcommercekit/did": "workspace:*", + "@agentcommercekit/jwt": "workspace:*", + "@agentcommercekit/keys": "workspace:*", + "@agentcommercekit/vc": "workspace:*", + "safe-stable-stringify": "catalog:", + "uuid": "catalog:", + "valibot": "catalog:" + }, + "devDependencies": { + "@a2a-js/sdk": "catalog:", + "zod": "catalog:" + }, + "peerDependencies": { + "@a2a-js/sdk": "^0.3.0", + "zod": "^4.0.0" + }, + "peerDependenciesMeta": { + "@a2a-js/sdk": { + "optional": true + }, + "zod": { + "optional": true + } + } +} diff --git a/packages/ack-pay/package.json b/packages/ack-pay/package.json index 6e30d52e..b78d8cce 100644 --- a/packages/ack-pay/package.json +++ b/packages/ack-pay/package.json @@ -1,67 +1,67 @@ -{ - "name": "@agentcommercekit/ack-pay", - "version": "0.11.0", - "homepage": "https://github.com/agentcommercekit/ack#readme", - "bugs": "https://github.com/agentcommercekit/ack/issues", - "license": "MIT", - "author": { - "name": "Catena Labs", - "url": "https://catenalabs.com" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/agentcommercekit/ack.git", - "directory": "packages/ack-pay" - }, - "files": [ - "dist", - "package.json", - "LICENSE", - "README.md" - ], - "type": "module", - "main": "./dist/index.mjs", - "types": "./dist/index.d.mts", - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "./schemas/zod": { - "types": "./dist/schemas/zod.d.mts", - "default": "./dist/schemas/zod.mjs" - }, - "./schemas/valibot": { - "types": "./dist/schemas/valibot.d.mts", - "default": "./dist/schemas/valibot.mjs" - } - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "build": "tsdown", - "clean": "git clean -fdX .turbo dist", - "dev": "pnpm build --watch --no-clean", - "test": "vitest" - }, - "dependencies": { - "@agentcommercekit/did": "workspace:*", - "@agentcommercekit/jwt": "workspace:*", - "@agentcommercekit/keys": "workspace:*", - "@agentcommercekit/vc": "workspace:*", - "valibot": "catalog:" - }, - "devDependencies": { - "zod": "catalog:" - }, - "peerDependencies": { - "zod": "^4.0.0" - }, - "peerDependenciesMeta": { - "zod": { - "optional": true - } - } -} +{ + "name": "@agentcommercekit/ack-pay", + "version": "0.11.0", + "homepage": "https://github.com/agentcommercekit/ack#readme", + "bugs": "https://github.com/agentcommercekit/ack/issues", + "license": "MIT", + "author": { + "name": "Catena Labs", + "url": "https://catenalabs.com" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/agentcommercekit/ack.git", + "directory": "packages/ack-pay" + }, + "files": [ + "dist", + "package.json", + "LICENSE", + "README.md" + ], + "type": "module", + "main": "./dist/index.mjs", + "types": "./dist/index.d.mts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "./schemas/zod": { + "types": "./dist/schemas/zod.d.mts", + "default": "./dist/schemas/zod.mjs" + }, + "./schemas/valibot": { + "types": "./dist/schemas/valibot.d.mts", + "default": "./dist/schemas/valibot.mjs" + } + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "tsdown --config-loader tsx", + "clean": "git clean -fdX .turbo dist", + "dev": "pnpm build --watch --no-clean", + "test": "vitest" + }, + "dependencies": { + "@agentcommercekit/did": "workspace:*", + "@agentcommercekit/jwt": "workspace:*", + "@agentcommercekit/keys": "workspace:*", + "@agentcommercekit/vc": "workspace:*", + "valibot": "catalog:" + }, + "devDependencies": { + "zod": "catalog:" + }, + "peerDependencies": { + "zod": "^4.0.0" + }, + "peerDependenciesMeta": { + "zod": { + "optional": true + } + } +} diff --git a/packages/agentcommercekit/package.json b/packages/agentcommercekit/package.json index ecf89e4a..c92cd8f4 100644 --- a/packages/agentcommercekit/package.json +++ b/packages/agentcommercekit/package.json @@ -1,91 +1,91 @@ -{ - "name": "agentcommercekit", - "version": "0.11.0", - "homepage": "https://github.com/agentcommercekit/ack#readme", - "bugs": "https://github.com/agentcommercekit/ack/issues", - "license": "MIT", - "author": { - "name": "Catena Labs", - "url": "https://catenalabs.com" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/agentcommercekit/ack.git", - "directory": "packages/agentcommercekit" - }, - "files": [ - "dist", - "package.json", - "LICENSE", - "README.md" - ], - "type": "module", - "main": "./dist/index.mjs", - "types": "./dist/index.d.mts", - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "./schemas/valibot": { - "types": "./dist/schemas/valibot.d.mts", - "default": "./dist/schemas/valibot.mjs" - }, - "./schemas/zod": { - "types": "./dist/schemas/zod.d.mts", - "default": "./dist/schemas/zod.mjs" - }, - "./a2a": { - "types": "./dist/a2a/index.d.mts", - "default": "./dist/a2a/index.mjs" - }, - "./a2a/schemas/valibot": { - "types": "./dist/a2a/schemas/valibot.d.mts", - "default": "./dist/a2a/schemas/valibot.mjs" - }, - "./a2a/schemas/zod": { - "types": "./dist/a2a/schemas/zod.d.mts", - "default": "./dist/a2a/schemas/zod.mjs" - } - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "build": "tsdown", - "clean": "git clean -fdX .turbo dist", - "dev": "pnpm build --watch --no-clean", - "test": "vitest" - }, - "dependencies": { - "@agentcommercekit/ack-id": "workspace:*", - "@agentcommercekit/ack-pay": "workspace:*", - "@agentcommercekit/caip": "workspace:*", - "@agentcommercekit/did": "workspace:*", - "@agentcommercekit/jwt": "workspace:*", - "@agentcommercekit/keys": "workspace:*", - "@agentcommercekit/vc": "workspace:*" - }, - "devDependencies": { - "@a2a-js/sdk": "catalog:", - "valibot": "catalog:", - "zod": "catalog:" - }, - "peerDependencies": { - "@a2a-js/sdk": "^0.3.0", - "valibot": "^1.0.0", - "zod": "^4.0.0" - }, - "peerDependenciesMeta": { - "@a2a-js/sdk": { - "optional": true - }, - "valibot": { - "optional": true - }, - "zod": { - "optional": true - } - } -} +{ + "name": "agentcommercekit", + "version": "0.11.0", + "homepage": "https://github.com/agentcommercekit/ack#readme", + "bugs": "https://github.com/agentcommercekit/ack/issues", + "license": "MIT", + "author": { + "name": "Catena Labs", + "url": "https://catenalabs.com" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/agentcommercekit/ack.git", + "directory": "packages/agentcommercekit" + }, + "files": [ + "dist", + "package.json", + "LICENSE", + "README.md" + ], + "type": "module", + "main": "./dist/index.mjs", + "types": "./dist/index.d.mts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "./schemas/valibot": { + "types": "./dist/schemas/valibot.d.mts", + "default": "./dist/schemas/valibot.mjs" + }, + "./schemas/zod": { + "types": "./dist/schemas/zod.d.mts", + "default": "./dist/schemas/zod.mjs" + }, + "./a2a": { + "types": "./dist/a2a/index.d.mts", + "default": "./dist/a2a/index.mjs" + }, + "./a2a/schemas/valibot": { + "types": "./dist/a2a/schemas/valibot.d.mts", + "default": "./dist/a2a/schemas/valibot.mjs" + }, + "./a2a/schemas/zod": { + "types": "./dist/a2a/schemas/zod.d.mts", + "default": "./dist/a2a/schemas/zod.mjs" + } + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "tsdown --config-loader tsx", + "clean": "git clean -fdX .turbo dist", + "dev": "pnpm build --watch --no-clean", + "test": "vitest" + }, + "dependencies": { + "@agentcommercekit/ack-id": "workspace:*", + "@agentcommercekit/ack-pay": "workspace:*", + "@agentcommercekit/caip": "workspace:*", + "@agentcommercekit/did": "workspace:*", + "@agentcommercekit/jwt": "workspace:*", + "@agentcommercekit/keys": "workspace:*", + "@agentcommercekit/vc": "workspace:*" + }, + "devDependencies": { + "@a2a-js/sdk": "catalog:", + "valibot": "catalog:", + "zod": "catalog:" + }, + "peerDependencies": { + "@a2a-js/sdk": "^0.3.0", + "valibot": "^1.0.0", + "zod": "^4.0.0" + }, + "peerDependenciesMeta": { + "@a2a-js/sdk": { + "optional": true + }, + "valibot": { + "optional": true + }, + "zod": { + "optional": true + } + } +} diff --git a/packages/caip/package.json b/packages/caip/package.json index c4019ae4..c4d451ba 100644 --- a/packages/caip/package.json +++ b/packages/caip/package.json @@ -1,67 +1,67 @@ -{ - "name": "@agentcommercekit/caip", - "version": "0.11.0", - "homepage": "https://github.com/agentcommercekit/ack#readme", - "bugs": "https://github.com/agentcommercekit/ack/issues", - "license": "MIT", - "author": { - "name": "Catena Labs", - "url": "https://catenalabs.com" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/agentcommercekit/ack.git", - "directory": "packages/caip" - }, - "files": [ - "dist", - "package.json", - "LICENSE", - "README.md" - ], - "type": "module", - "main": "./dist/index.mjs", - "types": "./dist/index.d.mts", - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "./schemas/zod": { - "types": "./dist/schemas/zod.d.mts", - "default": "./dist/schemas/zod.mjs" - }, - "./schemas/valibot": { - "types": "./dist/schemas/valibot.d.mts", - "default": "./dist/schemas/valibot.mjs" - } - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "build": "tsdown", - "clean": "git clean -fdX .turbo dist", - "dev": "pnpm build --watch --no-clean", - "test": "vitest" - }, - "dependencies": {}, - "devDependencies": { - "standard-matchers": "catalog:", - "valibot": "catalog:", - "zod": "catalog:" - }, - "peerDependencies": { - "valibot": "^1.1.0", - "zod": "^4.0.0" - }, - "peerDependenciesMeta": { - "valibot": { - "optional": true - }, - "zod": { - "optional": true - } - } -} +{ + "name": "@agentcommercekit/caip", + "version": "0.11.0", + "homepage": "https://github.com/agentcommercekit/ack#readme", + "bugs": "https://github.com/agentcommercekit/ack/issues", + "license": "MIT", + "author": { + "name": "Catena Labs", + "url": "https://catenalabs.com" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/agentcommercekit/ack.git", + "directory": "packages/caip" + }, + "files": [ + "dist", + "package.json", + "LICENSE", + "README.md" + ], + "type": "module", + "main": "./dist/index.mjs", + "types": "./dist/index.d.mts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "./schemas/zod": { + "types": "./dist/schemas/zod.d.mts", + "default": "./dist/schemas/zod.mjs" + }, + "./schemas/valibot": { + "types": "./dist/schemas/valibot.d.mts", + "default": "./dist/schemas/valibot.mjs" + } + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "tsdown --config-loader tsx", + "clean": "git clean -fdX .turbo dist", + "dev": "pnpm build --watch --no-clean", + "test": "vitest" + }, + "dependencies": {}, + "devDependencies": { + "standard-matchers": "catalog:", + "valibot": "catalog:", + "zod": "catalog:" + }, + "peerDependencies": { + "valibot": "^1.1.0", + "zod": "^4.0.0" + }, + "peerDependenciesMeta": { + "valibot": { + "optional": true + }, + "zod": { + "optional": true + } + } +} diff --git a/packages/did/package.json b/packages/did/package.json index 81fc92b3..0637f575 100644 --- a/packages/did/package.json +++ b/packages/did/package.json @@ -1,72 +1,72 @@ -{ - "name": "@agentcommercekit/did", - "version": "0.11.0", - "homepage": "https://github.com/agentcommercekit/ack#readme", - "bugs": "https://github.com/agentcommercekit/ack/issues", - "license": "MIT", - "author": { - "name": "Catena Labs", - "url": "https://catenalabs.com" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/agentcommercekit/ack.git", - "directory": "packages/did" - }, - "files": [ - "dist", - "package.json", - "LICENSE", - "README.md" - ], - "type": "module", - "main": "./dist/index.mjs", - "types": "./dist/index.d.mts", - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "./schemas/zod": { - "types": "./dist/schemas/zod.d.mts", - "default": "./dist/schemas/zod.mjs" - }, - "./schemas/valibot": { - "types": "./dist/schemas/valibot.d.mts", - "default": "./dist/schemas/valibot.mjs" - } - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "build": "tsdown", - "clean": "git clean -fdX .turbo dist", - "dev": "pnpm build --watch --no-clean", - "test": "vitest" - }, - "dependencies": { - "@agentcommercekit/caip": "workspace:*", - "@agentcommercekit/keys": "workspace:*", - "did-resolver": "4.1.0", - "jwks-did-resolver": "1.1.0", - "key-did-resolver": "4.0.0", - "valibot": "catalog:", - "varint": "6.0.0", - "web-identity-schemas": "catalog:" - }, - "devDependencies": { - "@types/varint": "6.0.3", - "standard-matchers": "catalog:", - "zod": "catalog:" - }, - "peerDependencies": { - "zod": "^4.0.0" - }, - "peerDependenciesMeta": { - "zod": { - "optional": true - } - } -} +{ + "name": "@agentcommercekit/did", + "version": "0.11.0", + "homepage": "https://github.com/agentcommercekit/ack#readme", + "bugs": "https://github.com/agentcommercekit/ack/issues", + "license": "MIT", + "author": { + "name": "Catena Labs", + "url": "https://catenalabs.com" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/agentcommercekit/ack.git", + "directory": "packages/did" + }, + "files": [ + "dist", + "package.json", + "LICENSE", + "README.md" + ], + "type": "module", + "main": "./dist/index.mjs", + "types": "./dist/index.d.mts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "./schemas/zod": { + "types": "./dist/schemas/zod.d.mts", + "default": "./dist/schemas/zod.mjs" + }, + "./schemas/valibot": { + "types": "./dist/schemas/valibot.d.mts", + "default": "./dist/schemas/valibot.mjs" + } + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "tsdown --config-loader tsx", + "clean": "git clean -fdX .turbo dist", + "dev": "pnpm build --watch --no-clean", + "test": "vitest" + }, + "dependencies": { + "@agentcommercekit/caip": "workspace:*", + "@agentcommercekit/keys": "workspace:*", + "did-resolver": "4.1.0", + "jwks-did-resolver": "1.1.0", + "key-did-resolver": "4.0.0", + "valibot": "catalog:", + "varint": "6.0.0", + "web-identity-schemas": "catalog:" + }, + "devDependencies": { + "@types/varint": "6.0.3", + "standard-matchers": "catalog:", + "zod": "catalog:" + }, + "peerDependencies": { + "zod": "^4.0.0" + }, + "peerDependenciesMeta": { + "zod": { + "optional": true + } + } +} diff --git a/packages/jwt/package.json b/packages/jwt/package.json index 3cded613..a0156b0d 100644 --- a/packages/jwt/package.json +++ b/packages/jwt/package.json @@ -1,70 +1,70 @@ -{ - "name": "@agentcommercekit/jwt", - "version": "0.11.0", - "homepage": "https://github.com/agentcommercekit/ack#readme", - "bugs": "https://github.com/agentcommercekit/ack/issues", - "license": "MIT", - "author": { - "name": "Catena Labs", - "url": "https://catenalabs.com" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/agentcommercekit/ack.git", - "directory": "packages/jwt" - }, - "files": [ - "dist", - "package.json", - "LICENSE", - "README.md" - ], - "type": "module", - "main": "./dist/index.mjs", - "types": "./dist/index.d.mts", - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "./schemas/zod": { - "types": "./dist/schemas/zod.d.mts", - "default": "./dist/schemas/zod.mjs" - }, - "./schemas/valibot": { - "types": "./dist/schemas/valibot.d.mts", - "default": "./dist/schemas/valibot.mjs" - } - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "build": "tsdown", - "clean": "git clean -fdX .turbo dist", - "dev": "pnpm build --watch --no-clean", - "test": "vitest" - }, - "dependencies": { - "@agentcommercekit/keys": "workspace:*", - "did-jwt": "8.0.18", - "web-identity-schemas": "catalog:" - }, - "devDependencies": { - "valibot": "catalog:", - "zod": "catalog:" - }, - "peerDependencies": { - "valibot": "^1.0.0", - "zod": "^4.0.0" - }, - "peerDependenciesMeta": { - "valibot": { - "optional": true - }, - "zod": { - "optional": true - } - } -} +{ + "name": "@agentcommercekit/jwt", + "version": "0.11.0", + "homepage": "https://github.com/agentcommercekit/ack#readme", + "bugs": "https://github.com/agentcommercekit/ack/issues", + "license": "MIT", + "author": { + "name": "Catena Labs", + "url": "https://catenalabs.com" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/agentcommercekit/ack.git", + "directory": "packages/jwt" + }, + "files": [ + "dist", + "package.json", + "LICENSE", + "README.md" + ], + "type": "module", + "main": "./dist/index.mjs", + "types": "./dist/index.d.mts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "./schemas/zod": { + "types": "./dist/schemas/zod.d.mts", + "default": "./dist/schemas/zod.mjs" + }, + "./schemas/valibot": { + "types": "./dist/schemas/valibot.d.mts", + "default": "./dist/schemas/valibot.mjs" + } + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "tsdown --config-loader tsx", + "clean": "git clean -fdX .turbo dist", + "dev": "pnpm build --watch --no-clean", + "test": "vitest" + }, + "dependencies": { + "@agentcommercekit/keys": "workspace:*", + "did-jwt": "8.0.18", + "web-identity-schemas": "catalog:" + }, + "devDependencies": { + "valibot": "catalog:", + "zod": "catalog:" + }, + "peerDependencies": { + "valibot": "^1.0.0", + "zod": "^4.0.0" + }, + "peerDependenciesMeta": { + "valibot": { + "optional": true + }, + "zod": { + "optional": true + } + } +} diff --git a/packages/keys/package.json b/packages/keys/package.json index 4477df62..d044e872 100644 --- a/packages/keys/package.json +++ b/packages/keys/package.json @@ -1,63 +1,63 @@ -{ - "name": "@agentcommercekit/keys", - "version": "0.11.0", - "homepage": "https://github.com/agentcommercekit/ack#readme", - "bugs": "https://github.com/agentcommercekit/ack/issues", - "license": "MIT", - "author": { - "name": "Catena Labs", - "url": "https://catenalabs.com" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/agentcommercekit/ack.git", - "directory": "packages/keys" - }, - "files": [ - "dist", - "package.json", - "LICENSE", - "README.md" - ], - "type": "module", - "main": "./dist/index.mjs", - "types": "./dist/index.d.mts", - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "./encoding": { - "types": "./dist/encoding/index.d.mts", - "default": "./dist/encoding/index.mjs" - }, - "./ed25519": { - "types": "./dist/curves/ed25519.d.mts", - "default": "./dist/curves/ed25519.mjs" - }, - "./secp256k1": { - "types": "./dist/curves/secp256k1.d.mts", - "default": "./dist/curves/secp256k1.mjs" - }, - "./secp256r1": { - "types": "./dist/curves/secp256r1.d.mts", - "default": "./dist/curves/secp256r1.mjs" - } - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "build": "tsdown", - "clean": "git clean -fdX .turbo dist", - "dev": "pnpm build --watch --no-clean", - "test": "vitest" - }, - "dependencies": { - "@noble/curves": "2.2.0", - "@solana/codecs-strings": "6.10.0", - "multiformats": "14.0.0", - "uint8arrays": "6.1.1" - } -} +{ + "name": "@agentcommercekit/keys", + "version": "0.11.0", + "homepage": "https://github.com/agentcommercekit/ack#readme", + "bugs": "https://github.com/agentcommercekit/ack/issues", + "license": "MIT", + "author": { + "name": "Catena Labs", + "url": "https://catenalabs.com" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/agentcommercekit/ack.git", + "directory": "packages/keys" + }, + "files": [ + "dist", + "package.json", + "LICENSE", + "README.md" + ], + "type": "module", + "main": "./dist/index.mjs", + "types": "./dist/index.d.mts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "./encoding": { + "types": "./dist/encoding/index.d.mts", + "default": "./dist/encoding/index.mjs" + }, + "./ed25519": { + "types": "./dist/curves/ed25519.d.mts", + "default": "./dist/curves/ed25519.mjs" + }, + "./secp256k1": { + "types": "./dist/curves/secp256k1.d.mts", + "default": "./dist/curves/secp256k1.mjs" + }, + "./secp256r1": { + "types": "./dist/curves/secp256r1.d.mts", + "default": "./dist/curves/secp256r1.mjs" + } + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "tsdown --config-loader tsx", + "clean": "git clean -fdX .turbo dist", + "dev": "pnpm build --watch --no-clean", + "test": "vitest" + }, + "dependencies": { + "@noble/curves": "2.2.0", + "@solana/codecs-strings": "6.10.0", + "multiformats": "14.0.0", + "uint8arrays": "6.1.1" + } +} diff --git a/packages/vc/package.json b/packages/vc/package.json index 7d6c643c..9be0fbba 100644 --- a/packages/vc/package.json +++ b/packages/vc/package.json @@ -1,69 +1,69 @@ -{ - "name": "@agentcommercekit/vc", - "version": "0.11.0", - "homepage": "https://github.com/agentcommercekit/ack#readme", - "bugs": "https://github.com/agentcommercekit/ack/issues", - "license": "MIT", - "author": { - "name": "Catena Labs", - "url": "https://catenalabs.com" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/agentcommercekit/ack.git", - "directory": "packages/vc" - }, - "files": [ - "dist", - "package.json", - "LICENSE", - "README.md" - ], - "type": "module", - "main": "./dist/index.mjs", - "types": "./dist/index.d.mts", - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "./schemas/zod": { - "types": "./dist/schemas/zod.d.mts", - "default": "./dist/schemas/zod.mjs" - }, - "./schemas/valibot": { - "types": "./dist/schemas/valibot.d.mts", - "default": "./dist/schemas/valibot.mjs" - } - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "build": "tsdown", - "clean": "git clean -fdX .turbo dist", - "dev": "pnpm build --watch --no-clean", - "test": "vitest" - }, - "dependencies": { - "@agentcommercekit/did": "workspace:*", - "@agentcommercekit/jwt": "workspace:*", - "@agentcommercekit/keys": "workspace:*", - "bit-buffers": "catalog:", - "did-jwt-vc": "4.0.16", - "valibot": "catalog:", - "web-identity-schemas": "catalog:" - }, - "devDependencies": { - "zod": "catalog:" - }, - "peerDependencies": { - "zod": "^4.0.0" - }, - "peerDependenciesMeta": { - "zod": { - "optional": true - } - } -} +{ + "name": "@agentcommercekit/vc", + "version": "0.11.0", + "homepage": "https://github.com/agentcommercekit/ack#readme", + "bugs": "https://github.com/agentcommercekit/ack/issues", + "license": "MIT", + "author": { + "name": "Catena Labs", + "url": "https://catenalabs.com" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/agentcommercekit/ack.git", + "directory": "packages/vc" + }, + "files": [ + "dist", + "package.json", + "LICENSE", + "README.md" + ], + "type": "module", + "main": "./dist/index.mjs", + "types": "./dist/index.d.mts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "./schemas/zod": { + "types": "./dist/schemas/zod.d.mts", + "default": "./dist/schemas/zod.mjs" + }, + "./schemas/valibot": { + "types": "./dist/schemas/valibot.d.mts", + "default": "./dist/schemas/valibot.mjs" + } + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "tsdown --config-loader tsx", + "clean": "git clean -fdX .turbo dist", + "dev": "pnpm build --watch --no-clean", + "test": "vitest" + }, + "dependencies": { + "@agentcommercekit/did": "workspace:*", + "@agentcommercekit/jwt": "workspace:*", + "@agentcommercekit/keys": "workspace:*", + "bit-buffers": "catalog:", + "did-jwt-vc": "4.0.16", + "valibot": "catalog:", + "web-identity-schemas": "catalog:" + }, + "devDependencies": { + "zod": "catalog:" + }, + "peerDependencies": { + "zod": "^4.0.0" + }, + "peerDependenciesMeta": { + "zod": { + "optional": true + } + } +} diff --git a/tools/api-utils/src/middleware/signed-payload-validator.ts b/tools/api-utils/src/middleware/signed-payload-validator.ts index f0111ebf..1007db08 100644 --- a/tools/api-utils/src/middleware/signed-payload-validator.ts +++ b/tools/api-utils/src/middleware/signed-payload-validator.ts @@ -1,103 +1,73 @@ -import { isDidUri, type DidUri, type Resolvable } from "@agentcommercekit/did" -import { isJwtString, type JwtString } from "@agentcommercekit/jwt" -import type { MiddlewareHandler, ValidationTargets } from "hono" -import { env } from "hono/adapter" -import { validator } from "hono/validator" -import * as v from "valibot" - -import { validatePayload } from "../validate-payload" - -interface SignedPayloadEnv { - Variables: { - resolver: Resolvable - } -} - -interface ValidatedSignedPayload { - issuer: DidUri - body: T -} - -const signedPayloadSchema = v.object({ - payload: v.custom( - (input: unknown) => typeof input === "string" && isJwtString(input), - "Invalid JWT format", - ), -}) - -/** - * A validation middleware for signed JWT payloads. This will parse the JWT - * payload, ensure it is properly signed and not expired, and validate it - * against the provided schema. - * - * @example - * ```ts - * app.post("/", signedPayloadValidator("json", bodySchema), (c) => { - * const { parsed, payload } = c.req.valid("json") - * - * parsed.issuer // did:web:example.com - * payload // { name: "John Doe", age: 30 } - * }) - * ``` - */ -export const signedPayloadValidator = ( - target: keyof ValidationTargets, - schema: S, -): MiddlewareHandler< - SignedPayloadEnv, - string, - { out: { json: ValidatedSignedPayload> } } -> => - validator( - target, - async (value, c): Promise>> => { - const didResolver = c.get("resolver") - - try { - const data = v.parse(signedPayloadSchema, value) - const { parsed, body } = await validatePayload( - data.payload, - schema, - didResolver, - ) - - // Enforces a DID for the issuer - if (!isDidUri(parsed.issuer)) { - throw new Error("Invalid issuer") - } - - return { - issuer: parsed.issuer, - body, - } - } catch (error) { - /** - * Local-development escape hatch: allow a raw unsigned payload plus an - * `X-Payload-Issuer` header to bypass the JWT signature check. This is an - * authentication bypass, so it is gated behind an explicit, default-off - * `ALLOW_UNSIGNED_PAYLOADS` flag (NOT `NODE_ENV`, which is commonly set to - * "development" by accident in deployed environments). Never enable it - * outside local development. - */ - if ( - env<{ ALLOW_UNSIGNED_PAYLOADS?: string }>(c) - .ALLOW_UNSIGNED_PAYLOADS === "true" - ) { - const issuer = c.req.header("X-Payload-Issuer") - const parsedPayload = v.safeParse(schema, value) - if (isDidUri(issuer) && parsedPayload.success) { - console.warn( - `[signed-payload-validator] SECURITY: accepting an UNSIGNED payload (issuer "${issuer}" from the X-Payload-Issuer header) because ALLOW_UNSIGNED_PAYLOADS is enabled. Never enable this outside local development.`, - ) - return { - issuer, - body: parsedPayload.output, - } - } - } - - // Otherwise, rethrow the error - throw error - } - }, - ) +import { isDidUri, type DidUri, type Resolvable } from "@agentcommercekit/did" +import { isJwtString, type JwtString } from "@agentcommercekit/jwt" +import type { MiddlewareHandler, ValidationTargets } from "hono" +import { validator } from "hono/validator" +import * as v from "valibot" + +import { validatePayload } from "../validate-payload" +import { unauthorized } from "../exceptions" + +interface SignedPayloadEnv { + Variables: { + resolver: Resolvable + } +} + +interface ValidatedSignedPayload { + issuer: DidUri + body: T +} + +const signedPayloadSchema = v.object({ + payload: v.custom( + (input: unknown) => typeof input === "string" && isJwtString(input), + "Invalid JWT format", + ), +}) + +/** + * A validation middleware for signed JWT payloads. This will parse the JWT + * payload, ensure it is properly signed and not expired, and validate it + * against the provided schema. + * + * @example + * ```ts + * app.post("/", signedPayloadValidator("json", bodySchema), (c) => { + * const { parsed, payload } = c.req.valid("json") + * + * parsed.issuer // did:web:example.com + * payload // { name: "John Doe", age: 30 } + * }) + * ``` + */ +export const signedPayloadValidator = ( + target: keyof ValidationTargets, + schema: S, +): MiddlewareHandler< + SignedPayloadEnv, + string, + { out: { json: ValidatedSignedPayload> } } +> => + validator( + target, + async (value, c): Promise>> => { + const didResolver = c.get("resolver") + + const data = v.parse(signedPayloadSchema, value) + const { parsed, body } = await validatePayload( + data.payload, + schema, + didResolver, + ) + + // Enforces a DID for the issuer + if (!isDidUri(parsed.issuer)) { + throw unauthorized("Invalid issuer") + } + + return { + issuer: parsed.issuer, + body, + } + }, + ) \ No newline at end of file