feat(beo): add BEOClient.destroy(beo_id, reason) for TS SDK parity#8
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Matches the TypeScript SDK's
BEOClient.destroy()so Python callers can also exercise LGPD Art. 18 / GDPR Art. 17 — right to erasure.Flow:
{function: "destroyBEO", beoId, nonce, timestamp_secs}with the BEO's Ed25519 private key./api/relayer/beo/destroyusing the v2 API wire format — hexnonce+ integertimestamp_secs(matchesbsp-registry-apiPR #14).{destroyed_at, aptos_tx}.beo_idacceptsintor decimal string; internally normalized to the wire-format string (Move id is u64).Files changed
bsp_sdk/beo.py—destroy()method +_serialize_beo_id()/_now_secs()helpers. Typed unionBeoId = int | str.get(beo_id: BeoId).tests/test_beo_destroy.py— 11 new tests:private_key, non-dict response, unsupportedbeo_idtypeCHANGELOG.md— unreleased entry.Test plan
python3 -m pytest tests/test_beo_destroy.py -v→ 11 passed.python3 -m pytest→ 64 passed (53 existing + 11 new).Notes
destroy()is a destructive operation with no client-side retry — callers should wrap in their own error handling.🤖 Generated with Claude Code