Skip to content

Refactor/proto wallet deprecation#164

Open
ALiberalVoluntarist wants to merge 5 commits into
masterfrom
refactor/proto-wallet-deprecation
Open

Refactor/proto wallet deprecation#164
ALiberalVoluntarist wants to merge 5 commits into
masterfrom
refactor/proto-wallet-deprecation

Conversation

@ALiberalVoluntarist
Copy link
Copy Markdown
Collaborator

Description of Changes

Align py-sdk ProtoWallet with TS/Go SDK architecture where ProtoWallet is a standalone cryptographic-operations-only class (9 methods), not a full WalletInterface implementation.

Changes:

  • Remove WalletInterface inheritance from ProtoWallet (class ProtoWallet(WalletInterface):class ProtoWallet:)
  • Add DeprecationWarning to 21 wallet-management methods (e.g. create_action, sign_action, list_outputs, internalize_action, etc.) that don't belong on ProtoWallet per TS/Go SDK design
  • Replace ProtoWallet auto-creation fallbacks in IdentityClient and ContactsManager with ValueError("wallet is required")
  • Replace dummy WalletInterface class in verifiable_certificate.py with the real Protocol import from bsv.wallet.wallet_interface
  • Update affected tests to match new behavior

Kept (9 crypto-core methods, no deprecation):
get_public_key, encrypt, decrypt, create_signature, verify_signature, create_hmac, verify_hmac, reveal_counterparty_key_linkage, reveal_specific_key_linkage

Linked Issues / Tickets

Related to TS/Go SDK architecture alignment. See also: #159 (internalize_action BEEF parse bug caused by ProtoWallet implementing methods it shouldn't own).

Testing Procedure

  • All 21 deprecated methods emit DeprecationWarning with stacklevel=2

  • IdentityClient(wallet=None) and ContactsManager(wallet=None) now raise ValueError

  • verifiable_certificate.py imports the real WalletInterface Protocol

  • I have added new unit tests

  • All tests pass locally (5329 passed, 262 skipped, 0 failed)

  • I have tested manually in my local environment

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have updated CHANGELOG.md with my changes
  • I have run the linter

ALiberalVoluntarist and others added 5 commits June 5, 2026 15:50
…nstruct per-output BEEF

_parse_binary_response used Reader.read_var_int() (returns bytes) instead of
read_var_int_num() (returns int), causing TypeError on any binary output-list
response. Also reconstructs individual BEEF from the trailing combined BEEF
instead of discarding it.

Based on PR #162 by external contributor, with ruff formatting applied.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…md, and PR template

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The JSON response path in HTTPSOverlayLookupFacilitator.lookup() was
calling response.json() but discarding the result, always returning an
empty LookupAnswer. This meant any overlay host returning JSON (rather
than binary) would produce no outputs.

Added _parse_json_response() and _coerce_bytes() to properly handle the
output-list JSON format. The beef field encoding differs across server
implementations:
- TS overlay-express: number[] (JS byte array, e.g. [222, 173, 190, 239])
- Go overlay-services: base64 string (Go []byte JSON default, e.g. "3q2+7w==")
- hex string is also accepted as a fallback

Note: the binary path (application/octet-stream) is triggered by the
X-Aggregation: yes header, which this SDK always sends. The Go overlay
server does not implement the binary path and always returns JSON.
The TS overlay server supports both, selecting based on X-Aggregation.

Tests: 10 cases covering number[], base64, hex, context, freeform, and
edge cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…recate non-crypto methods

Align ProtoWallet with TS/Go SDK architecture where it only provides
cryptographic operations (9 methods). The 21 wallet-management methods
(create_action, sign_action, list_outputs, etc.) now emit
DeprecationWarning. Also replace ProtoWallet fallbacks in identity
modules with ValueError, and fix verifiable_certificate.py to import
the real WalletInterface Protocol.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 5, 2026

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.

1 participant