Skip to content

feat(beo): add BEOClient.destroy(beo_id, reason) for TS SDK parity#8

Merged
sirambrosio merged 2 commits into
mainfrom
feat/beo-destroy-parity
Apr 20, 2026
Merged

feat(beo): add BEOClient.destroy(beo_id, reason) for TS SDK parity#8
sirambrosio merged 2 commits into
mainfrom
feat/beo-destroy-parity

Conversation

@sirambrosio
Copy link
Copy Markdown
Contributor

Summary

Matches the TypeScript SDK's BEOClient.destroy() so Python callers can also exercise LGPD Art. 18 / GDPR Art. 17 — right to erasure.

Flow:

  1. Sign a canonical payload {function: "destroyBEO", beoId, nonce, timestamp_secs} with the BEO's Ed25519 private key.
  2. POST /api/relayer/beo/destroy using the v2 API wire format — hex nonce + integer timestamp_secs (matches bsp-registry-api PR #14).
  3. Return {destroyed_at, aptos_tx}.

beo_id accepts int or decimal string; internally normalized to the wire-format string (Move id is u64).

Files changed

  • bsp_sdk/beo.pydestroy() method + _serialize_beo_id() / _now_secs() helpers. Typed union BeoId = int | str. get(beo_id: BeoId).
  • tests/test_beo_destroy.py — 11 new tests:
    • id serialization (int, decimal string, negatives, hex rejection)
    • happy path — asserts canonical signed payload re-verifies locally under the signing key's public half
    • error paths — missing private_key, non-dict response, unsupported beo_id type
  • CHANGELOG.md — unreleased entry.

Test plan

  • python3 -m pytest tests/test_beo_destroy.py -v11 passed.
  • Full suite: python3 -m pytest64 passed (53 existing + 11 new).
  • Signature round-trip: destroy payload produced by SDK verifies under PyNaCl.

Notes

  • destroy() is a destructive operation with no client-side retry — callers should wrap in their own error handling.
  • Reason string (optional) is audit-logged by the API but does not hit Move.

🤖 Generated with Claude Code

sirambrosio and others added 2 commits April 20, 2026 12:24
Matches `bsp-sdk-typescript` BEOClient.destroy() so Python callers can also
exercise LGPD Art. 18 / GDPR Art. 17 right-to-erasure.

Flow:

  1. Sign a canonical payload (`{function: "destroyBEO", beoId, nonce,
     timestamp_secs}`) with the BEO's Ed25519 private key.
  2. POST to `/api/relayer/beo/destroy` using the v2 API wire format —
     hex `nonce` and integer `timestamp_secs` (matches bsp-registry-api v2
     alignment PR).
  3. Return `{destroyed_at, aptos_tx}`.

`beo_id` accepts both `int` and decimal-string; internally serialized to
the canonical wire-format string (Move id is u64).

  * bsp_sdk/beo.py: `destroy()` + `_serialize_beo_id()` + `_now_secs()`
    helpers. Typed union `BeoId = int | str`. `get()` typed with BeoId.
  * tests/test_beo_destroy.py: 11 tests covering id serialisation, happy
    path (asserts canonical signed payload re-verifies locally), error
    paths (missing private key, invalid id type, non-dict response).
  * CHANGELOG.md: unreleased entry.

Full suite: 64 passed (53 existing + 11 new).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sirambrosio sirambrosio merged commit 066058d into main Apr 20, 2026
@sirambrosio sirambrosio deleted the feat/beo-destroy-parity branch April 20, 2026 15:34
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