Skip to content

feat: PSKChannel high-level API and client integration#16

Closed
corvid-agent wants to merge 2 commits intomainfrom
feat/psk-channel-integration
Closed

feat: PSKChannel high-level API and client integration#16
corvid-agent wants to merge 2 commits intomainfrom
feat/psk-channel-integration

Conversation

@corvid-agent
Copy link
Copy Markdown
Contributor

Summary

Closes #11 — adds PSK v1.1 support to the Python SDK matching the ts-algochat PSKManager API.

  • PSKChannel class: High-level conversation manager wrapping all PSK v1.1 primitives — automatic counter management, key rotation with grace period, peer key auto-discovery, txid deduplication, message callbacks, and state persistence/restoration
  • Client integration: AlgoChat.create_psk_channel, encrypt_psk, decrypt_psk methods + process_transaction auto-detects PSK v1.1 messages
  • 29 new tests: Round-trips, replay protection, key rotation grace period fallback, session boundary crossing, bidirectional self-decrypt, out-of-order delivery, callbacks, state persistence

Test plan

  • All 29 new PSKChannel tests pass
  • All 33 existing PSK primitive tests pass
  • Full suite: 165 passed, 44 skipped (cross-impl envelope files), 0 failures
  • CI validation

🤖 Generated with Claude Code

corvid-agent and others added 2 commits March 21, 2026 05:08
Adds PSKChannel class that wraps PSK v1.1 primitives into a complete
conversation manager — matching ts-algochat's PSKManager API surface.

New features:
- PSKChannel: encrypt/decrypt with automatic counter management
- Key rotation with grace period for in-flight messages
- Peer public key auto-discovery from first received message
- Transaction deduplication via txid tracking
- Message callbacks for event-driven usage
- State persistence/restoration support
- Exchange URI creation from channel

Client integration:
- AlgoChat.create_psk_channel / get_psk_channel / is_psk_contact
- AlgoChat.encrypt_psk / decrypt_psk convenience methods
- process_transaction now auto-detects PSK v1.1 messages

29 new tests covering round-trips, replay protection, key rotation,
session boundaries, bidirectional decrypt, and state persistence.

Closes #11

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@corvid-agent
Copy link
Copy Markdown
Contributor Author

Closing in favor of #15. The PSKChannel abstraction (key rotation grace period, callbacks, peer discovery) is valuable but can be layered on top of #15's foundation in a follow-up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: PSK v1.1 support — pre-shared key encrypted messaging

1 participant