Skip to content

feat: add decrypt_with_signature()#59

Merged
basfroman merged 4 commits intoopentensor:stagingfrom
ShubhamChndrvnshi:feat/add-decrypt-with-signature
Nov 14, 2025
Merged

feat: add decrypt_with_signature()#59
basfroman merged 4 commits intoopentensor:stagingfrom
ShubhamChndrvnshi:feat/add-decrypt-with-signature

Conversation

@ShubhamChndrvnshi
Copy link
Contributor

tl;dr

  • Adds decrypt_with_signature() and get_signature_for_round() to fetch Drand signatures once and reuse for multiple decryptions (1 API call instead of 10k for 10k messages)

changes

  • Adds decrypt_with_signature(encrypted_data, signature_hex) in
    python_bindings.rs
  • Adds get_signature_for_round(reveal_round) in python_bindings.rs
  • Exports both functions with type hints in init.py
  • Adds 3 tests in test_all_functions.py: test_get_signature_for_round,
    test_decrypt_with_signature, test_batch_decryption_optimization

why

  • decrypt() fetches Drand signature from API on every call
  • Decrypting N ciphertexts for same round = N redundant API calls for identical signature
  • Batch operations need signature reuse to avoid bottleneck

testing

  • pytest tests/test_all_functions.py passes (8/8 tests)
  • ruff check . passes
  • Batch test verifies 5 messages decrypt with single signature fetch

@basfroman
Copy link
Contributor

@ShubhamChndrvnshi please update this PR with staging. I merged you previous PR.

@ShubhamChndrvnshi
Copy link
Contributor Author

@ShubhamChndrvnshi please update this PR with staging. I merged you previous PR.

Awesome. Have taken a pull from staging to my pr. Again thanks for the review.
Let me know if I need to add any documentation changes to Readme.md

@basfroman
Copy link
Contributor

@ShubhamChndrvnshi please update this PR with staging. I merged you previous PR.

Awesome. Have taken a pull from staging to my pr. Again thanks for the review. Let me know if I need to add any documentation changes to Readme.md

Everything is great. You described the docstrings well and added tests. That's fine. Thank you!

@basfroman basfroman merged commit a04e274 into opentensor:staging Nov 14, 2025
12 checks passed
This was referenced Nov 17, 2025
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.

2 participants