Skip to content

Remove Complete message type per updated TAIP specifications #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .claude/agents/tap-expert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
name: tap-expert
description: Use proactively to retrieve and extract relevant information about the TAP spec and TAIPs
tools: Read, Grep, Glob
color: blue
---

You are a specialized information retrieval agent for TAP message specs. Your role is to efficiently fetch and extract relevant content from the TAP spec repo while avoiding duplication.

## Core Responsibilities

1. **Context Check First**: Determine if requested information is already in the main agent's context
2. **Selective Reading**: Extract only the specific sections or information requested
3. **Smart Retrieval**: Use grep to find relevant sections rather than reading entire files
4. **Return Efficiently**: Provide only new information not already in context

## Supported File Types

- Specs: @prds/taips/TAIPs/*.md
- Product docs: @prds/taips/*.md
- Typescript types: @prds/taips/packages/typescript/src/*.ts
- JSON schemas: @prds/taips/schemas/**/*.json

## Workflow

1. Check if the requested information appears to be in context already
2. If not in context, locate the requested file(s)
3. Extract only the relevant sections
4. Return the specific information needed

## Output Format

For new information:
```
📄 Retrieved from [file-path]

[Extracted content]
```

For already-in-context information:
```
✓ Already in context: [brief description of what was requested]
```

## Smart Extraction Examples

Request: "Get the pitch from mission-lite.md"
→ Extract only the pitch section, not the entire file

Request: "Find CSS styling rules from code-style.md"
→ Use grep to find CSS-related sections only

Request: "Get Task 2.1 details from tasks.md"
→ Extract only that specific task and its subtasks

## Important Constraints

- Never return information already visible in current context
- Extract minimal necessary content
- Use grep for targeted searches
- Never modify any files
- Keep responses concise

Example usage:
- "Get the product pitch from mission-lite.md"
- "Find Ruby style rules from code-style.md"
- "Extract Task 3 requirements from the password-reset spec"
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,42 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.5.0] - 2025-08-14

### Added

#### Composable Escrow Support (TAIP-17)
- New `Escrow` message for holding assets on behalf of parties
- New `Capture` message for releasing escrowed funds
- Support for both cryptocurrency assets and fiat currencies in escrows
- Automatic expiry handling for escrows
- Support for payment guarantees, asset swaps, and conditional payments
- Multiple agent roles including dedicated EscrowAgent role
- Full validation ensuring exactly one EscrowAgent per escrow

#### Settlement Address Enhancements
- PayTo URI support (RFC 8905) for traditional payment systems (IBAN, ACH, BIC, UPI)
- `SettlementAddress` enum supporting both CAIP-10 blockchain addresses and PayTo URIs
- `fallbackSettlementAddresses` field in Payment messages for flexible payment options
- Full validation and serialization for PayTo URIs

#### Invoice Product Attributes
- Schema.org/Product attributes to LineItem (name, image, url)
- LineItem builder pattern for easier construction
- Support for product metadata in invoice line items

#### Agent and Party Enhancements
- Schema.org Organization fields for Agent and Party structures
- Added fields: name, url, logo, description, email, telephone, serviceUrl
- Builder methods and accessor functions for all new fields
- Backward compatible with existing IVMS101 data

### Changed
- AuthorizationRequired message updated to match TAIP-4 specification
- Field `url` renamed to `authorizationUrl`
- Field `expires` now required
- Added optional `from` field

## [0.4.0] - 2025-06-17

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.4.0"
version = "0.5.0"
edition = "2021"
authors = ["Pelle Braendgaard <[email protected]>"]
description = "Rust implementation of the Transaction Authorization Protocol (TAP)"
Expand Down
71 changes: 69 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

This repository contains a Rust implementation of the Transaction Authorization Protocol (TAP), a decentralized protocol for securely authorizing blockchain transactions before they are submitted on-chain. TAP-RS targets payment-related use cases, Travel Rule compliance, and secure transaction coordination.

**New in this release**: Full Travel Rule support with IVMS101 data model implementation, automatic customer data extraction, and compliance workflow automation.
**New in v0.5.0**:
- PayTo URI support (RFC 8905) for traditional payment systems (IBAN, ACH, BIC, UPI)
- Fallback settlement addresses for flexible payment options
- Schema.org Product attributes for invoice line items
- Enhanced Agent and Party structures with Organization fields

## Project Structure

Expand Down Expand Up @@ -116,12 +120,14 @@ See individual tool READMEs for detailed usage instructions.

## Key Features

- **Complete TAP Implementation**: Support for all TAP message types (Transfer, Authorize, Reject, Settle, Complete, etc.)
- **Complete TAP Implementation**: Support for all TAP message types (Transfer, Authorize, Reject, Settle, Cancel, Revert, etc.)
- **DIDComm v2 Integration**: Secure, encrypted messaging with authenticated signatures
- **Chain Agnostic Identifiers**: Implementation of CAIP-2 (ChainID), CAIP-10 (AccountID), and CAIP-19 (AssetID)
- **Settlement Address Flexibility**: Support for both blockchain (CAIP-10) and traditional payment systems (PayTo URI)
- **Multiple DID Methods**: Support for did:key, did:web, did:pkh, and more
- **Travel Rule Compliance**: Full IVMS 101.2023 implementation with automatic data attachment
- **Customer Data Management**: Automatic extraction and storage of party information from TAP messages
- **Enhanced Metadata Support**: Schema.org Organization fields for Agents/Parties and Product attributes for invoices
- **Command-line Tools**: Utilities for DID generation, resolution, and key management
- **Modular Agent Architecture**: Flexible identity and cryptography primitives
- **High-Performance Message Routing**: Efficient node implementation for high-throughput environments
Expand Down Expand Up @@ -179,6 +185,67 @@ let message = transfer.to_didcomm_with_route(

See the [tap-msg README](./tap-msg/README.md) for more detailed examples.

## New in v0.5.0: Settlement Address Flexibility

TAP-RS now supports both blockchain and traditional payment settlement addresses:

```rust
use tap_msg::settlement_address::{SettlementAddress, PayToUri};
use tap_msg::Payment;

// Traditional payment system addresses using PayTo URI (RFC 8905)
let iban_address = SettlementAddress::from_string(
"payto://iban/DE75512108001245126199".to_string()
)?;

let ach_address = SettlementAddress::from_string(
"payto://ach/122000247/111000025".to_string()
)?;

// Blockchain addresses using CAIP-10
let eth_address = SettlementAddress::from_string(
"eip155:1:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb".to_string()
)?;

// Payment with fallback settlement addresses
let payment = Payment::builder()
.amount("100.00".to_string())
.currency_code("USD".to_string())
.merchant(Party::new("did:example:merchant"))
.fallback_settlement_addresses(vec![
iban_address, // Primary: traditional bank transfer
eth_address, // Fallback: Ethereum address
])
.build();
```

## Enhanced Metadata Support

Agents, Parties, and LineItems now support rich metadata:

```rust
use tap_msg::{Agent, LineItem};

// Agent with Organization metadata
let agent = Agent::new("did:example:agent", "PaymentProcessor", "did:example:merchant")
.with_name("Example Payment Services")
.with_url("https://example.com")
.with_email("[email protected]")
.with_telephone("+1-555-0100");

// LineItem with Product attributes
let line_item = LineItem::builder()
.id("item-001".to_string())
.description("Premium Coffee Beans".to_string())
.quantity(2.0)
.unit_price(25.99)
.line_total(51.98)
.name("Colombian Arabica Premium Blend".to_string())
.image("https://example.com/products/coffee.jpg".to_string())
.url("https://example.com/products/coffee".to_string())
.build();
```

## Typed Messages for Type Safety

TAP-RS now supports generic typed messages for compile-time type safety while maintaining 100% backward compatibility:
Expand Down
166 changes: 166 additions & 0 deletions TASKS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# TAP-RS Implementation Tasks - Updated TAIP Specifications

This document tracks the implementation of updated TAIP specifications following the submodule update to align with the latest TAP protocol changes.

## Overview

The TAIPs submodule has been updated with significant enhancements including:
- Schema.org Organization attributes for Agents and Parties
- AuthorizationRequired message moved to TAIP-4
- RFC 8905 PayTo URI support for settlement addresses
- Fallback settlement addresses for Payment messages
- Schema.org Product attributes for invoice line items

## Implementation Tasks (TDD Approach)

### Phase 1: Agent and Party Enhancements

- [x] **Write failing tests for Agent schema.org Organization fields**
- [x] Test Agent with `name` field serialization/deserialization
- [x] Test Agent with `url` field serialization/deserialization
- [x] Test Agent with `logo` field serialization/deserialization
- [x] Test Agent with `description` field serialization/deserialization
- [x] Test Agent with `email` field serialization/deserialization
- [x] Test Agent with `telephone` field serialization/deserialization
- [x] Test Agent with `serviceUrl` field (DIDComm endpoint fallback)
- [x] Test Agent with multiple organization fields combined
- [x] Test Agent JSON-LD compliance with new fields

- [x] **Implement Agent schema.org Organization fields**
- [x] Add accessor methods for `name` field to Agent struct
- [x] Add accessor methods for `url` field to Agent struct
- [x] Add accessor methods for `logo` field to Agent struct
- [x] Add accessor methods for `description` field to Agent struct
- [x] Add accessor methods for `email` field to Agent struct
- [x] Add accessor methods for `telephone` field to Agent struct
- [x] Add accessor methods for `serviceUrl` field to Agent struct
- [x] Add builder methods for new fields
- [x] Ensure all tests pass

- [x] **Write failing tests for Party schema.org Organization fields**
- [x] Test Party with `name` field serialization/deserialization
- [x] Test Party with `url` field serialization/deserialization
- [x] Test Party with `logo` field serialization/deserialization
- [x] Test Party with `description` field serialization/deserialization
- [x] Test Party with `email` field serialization/deserialization
- [x] Test Party with `telephone` field serialization/deserialization
- [x] Test Party with multiple organization fields combined
- [x] Test Party JSON-LD compliance with new fields
- [x] Test Party with IVMS101 and schema.org fields coexistence

- [x] **Implement Party schema.org Organization fields**
- [x] Add accessor methods for `name` field to Party struct
- [x] Add accessor methods for `url` field to Party struct
- [x] Add accessor methods for `logo` field to Party struct
- [x] Add accessor methods for `description` field to Party struct
- [x] Add accessor methods for `email` field to Party struct
- [x] Add accessor methods for `telephone` field to Party struct
- [x] Add builder methods for new fields
- [x] Add `with_metadata_field` builder method
- [x] Ensure all tests pass

### Phase 2: AuthorizationRequired Message Implementation

- [x] **Write failing tests for AuthorizationRequired message**
- [x] Test AuthorizationRequired message creation and structure
- [x] Test field serialization/deserialization (authorizationUrl, expires, from)
- [x] Test optional `from` field with valid party types
- [x] Test validation for required fields
- [x] Test validation for invalid `from` values
- [x] Test ISO 8601 timestamp format validation
- [x] Test AuthorizationRequired JSON compliance with TAIP-4
- [x] Test builder pattern and metadata support

- [x] **Implement AuthorizationRequired message**
- [x] Update existing `AuthorizationRequired` struct in `connection.rs`
- [x] Change `url` field to `authorizationUrl` per TAIP-4
- [x] Make `expires` field required per TAIP-4
- [x] Add optional `from` field for party type
- [x] Update validation logic for new requirements
- [x] Update constructors and builder methods
- [x] Ensure all tests pass

### Phase 3: Settlement Address Enhancements

- [x] **Write failing tests for PayTo URI support**
- [x] Test PayTo URI validation and parsing
- [x] Test settlement address union type (CAIP-10 | PayTo URI)
- [x] Test PayTo URI examples from RFC 8905 (IBAN, ACH, BIC, UPI)
- [x] Test invalid PayTo URI rejection

- [x] **Implement PayTo URI support**
- [x] Create `settlement_address.rs` module in `tap-msg/src/`
- [x] Define `PayToURI` type with validation
- [x] Define `SettlementAddress` enum (CAIP10 | PayToURI)
- [x] Implement serialization/deserialization for SettlementAddress
- [x] Add PayTo URI validation regex
- [x] Ensure all tests pass

- [x] **Write failing tests for fallback settlement addresses**
- [x] Test Payment message with `fallbackSettlementAddresses` array
- [x] Test mixed CAIP-10 and PayTo URI addresses in fallback array
- [x] Test optional fallback field serialization

- [x] **Implement fallback settlement addresses in Payment messages**
- [x] Add optional `fallback_settlement_addresses: Option<Vec<SettlementAddress>>` to Payment
- [x] Update Payment builder methods
- [x] Update Payment serialization/deserialization
- [x] Ensure all tests pass

### Phase 4: Invoice Product Attributes

- [x] **Write failing tests for Product attributes in invoice line items**
- [x] Test LineItem with `name` field (schema.org/Product)
- [x] Test LineItem with `image` field (schema.org/Product)
- [x] Test LineItem with `url` field (schema.org/Product)
- [x] Test LineItem with multiple product fields combined

- [x] **Implement Product attributes in invoice line items**
- [x] Add optional `name: Option<String>` field to LineItem
- [x] Add optional `image: Option<String>` field to LineItem
- [x] Add optional `url: Option<String>` field to LineItem
- [x] Add builder methods for new fields
- [x] Ensure all tests pass

### Phase 5: Integration and Cleanup

- [x] **Update message exports and integration**
- [x] Add AuthorizationRequired to TapMessageEnum (already existed)
- [x] Update message mod.rs exports (settlement_address module added)
- [ ] Update message factory methods
- [ ] Update message validation

- [ ] **Update MCP tools integration**
- [ ] Review MCP tools that may need AuthorizationRequired support
- [ ] Update transaction tools for new settlement address types
- [ ] Test MCP integration with new message types

- [x] **Documentation and examples**
- [x] Update example code for new fields (invoice examples updated)
- [ ] Add AuthorizationRequired usage examples
- [x] Add PayTo URI usage examples (in tests)
- [x] Update CHANGELOG.md

- [x] **Final validation**
- [x] Run full test suite: `cargo test`
- [x] Run clippy: `cargo clippy`
- [x] Run format check: `cargo fmt --check`
- [ ] Validate against TAIP test vectors
- [ ] Performance test new serialization paths

## Test-Driven Development Notes

1. **Write tests first** - Each implementation task should start with failing tests
2. **Red-Green-Refactor** - Ensure tests fail, implement minimum code to pass, then refactor
3. **Test edge cases** - Include validation tests for invalid inputs
4. **JSON compliance** - Ensure all new fields serialize correctly for TAIP compliance
5. **Backward compatibility** - All new fields should be optional to maintain compatibility

## Success Criteria

- [x] All tests pass
- [x] No clippy warnings
- [x] Code is properly formatted
- [ ] TAIP test vectors validate successfully
- [ ] MCP integration works with new message types
- [x] Documentation is updated and examples work
2 changes: 1 addition & 1 deletion prds/taips
Submodule taips updated 86 files
+310 −0 CHANGELOG.md
+31 −0 README.md
+5 −5 TAIPs/taip-1.md
+5 −5 TAIPs/taip-10.md
+7 −9 TAIPs/taip-11.md
+1 −1 TAIPs/taip-12.md
+1 −1 TAIPs/taip-13.md
+97 −19 TAIPs/taip-14.md
+83 −19 TAIPs/taip-15.md
+11 −2 TAIPs/taip-16.md
+509 −0 TAIPs/taip-17.md
+5 −5 TAIPs/taip-2.md
+2 −2 TAIPs/taip-3.md
+53 −17 TAIPs/taip-4.md
+46 −2 TAIPs/taip-5.md
+91 −5 TAIPs/taip-6.md
+2 −2 TAIPs/taip-7.md
+5 −5 TAIPs/taip-8.md
+4 −4 TAIPs/taip-9.md
+2 −0 _config.yml
+2 −0 _layouts/default.html
+25 −1 agents.md
+5 −0 assets/css/main.css
+10 −34 authorization.md
+359 −0 developers.md
+17 −7 index.html
+425 −52 messages.md
+52 −0 packages/purpose_codes/external_category_purpose_code.json
+335 −0 packages/purpose_codes/external_purpose_code.json
+13 −7 packages/typescript/package-lock.json
+4 −3 packages/typescript/package.json
+157 −158 packages/typescript/src/currencies.ts
+2 −0 packages/typescript/src/index.ts
+102 −77 packages/typescript/src/invoice.ts
+780 −0 packages/typescript/src/purpose_codes.ts
+842 −102 packages/typescript/src/tap.ts
+13 −4 parties.md
+105 −0 schemas/README.md
+109 −0 schemas/common/base-types.json
+41 −0 schemas/common/caip-types.json
+143 −0 schemas/common/didcomm-base.json
+14 −0 schemas/common/payto-uri.json
+14 −0 schemas/common/settlement-address.json
+88 −0 schemas/data-structures/agent.json
+227 −0 schemas/data-structures/invoice.json
+77 −0 schemas/data-structures/party.json
+100 −0 schemas/data-structures/policy.json
+59 −0 schemas/data-structures/transaction-constraints.json
+45 −0 schemas/messages/add-agents.json
+71 −0 schemas/messages/authorization-required.json
+47 −0 schemas/messages/authorize.json
+44 −0 schemas/messages/cancel.json
+44 −0 schemas/messages/capture.json
+69 −0 schemas/messages/confirm-relationship.json
+61 −0 schemas/messages/connect.json
+88 −0 schemas/messages/escrow.json
+120 −0 schemas/messages/out-of-band-invitation.json
+106 −0 schemas/messages/payment.json
+35 −0 schemas/messages/reject.json
+40 −0 schemas/messages/remove-agent.json
+45 −0 schemas/messages/replace-agent.json
+39 −0 schemas/messages/revert.json
+45 −0 schemas/messages/settle.json
+83 −0 schemas/messages/transfer.json
+40 −0 schemas/messages/update-agent.json
+45 −0 schemas/messages/update-party.json
+49 −0 schemas/messages/update-policies.json
+93 −0 schemas/package-lock.json
+14 −0 schemas/package.json
+229 −0 schemas/validate-test-vectors.js
+1 −1 test-vectors/authorization-required/invalid-missing-url.json
+2 −2 test-vectors/authorization-required/valid-authorization-required.json
+0 −23 test-vectors/complete/minimal.json
+0 −26 test-vectors/complete/missing-required-fields.json
+0 −25 test-vectors/complete/valid.json
+1 −1 test-vectors/connect/valid-b2b-connect.json
+42 −0 test-vectors/escrow/invalid-missing-beneficiary.json
+45 −0 test-vectors/escrow/valid-escrow.json
+42 −0 test-vectors/payment-request/valid-payto-invoice.json
+46 −0 test-vectors/transfer/valid-with-payto.json
+13 −0 test-vectors/valid-authorize.json
+30 −0 test-vectors/valid-payment-fiat.json
+30 −0 test-vectors/valid-payment.json
+13 −0 test-vectors/valid-revert.json
+14 −0 test-vectors/valid-settle.json
+3 −10 transactions.md
4 changes: 2 additions & 2 deletions tap-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ license.workspace = true
readme = "README.md"

[dependencies]
tap-msg = { version = "0.4.0", path = "../tap-msg" }
tap-caip = { version = "0.4.0", path = "../tap-caip" }
tap-msg = { version = "0.5.0", path = "../tap-msg" }
tap-caip = { version = "0.5.0", path = "../tap-caip" }
async-trait = { workspace = true }
thiserror = "1.0"
serde = { workspace = true }
Expand Down
Loading
Loading