Skip to main content

ACE Python SDK

Python SDK for ACE (Aptos Confidential Extension). This package mirrors the core crypto and wire-format surface of @aptos-labs/ace-sdk for Python callers.

The SDK currently includes:

  • BCS helpers for the wire formats ACE uses.
  • Scheme-tagged BLS12-381 G1/G2 group wrappers.
  • Feldman/Shamir VSS helpers.
  • Pedersen polynomial commitments, DKG and DKR state decoders.
  • Public-key encryption schemes used by ACE.
  • Scheme-tagged Ed25519 signing helpers for reconstructor/admin flows.
  • Threshold IBE primitives.
  • Known deployment metadata and network state view decoders.
  • Discovery snapshot decoding for the keyless discovery service.
  • Aptos IBE encryption helpers.
  • Worker decryption request helpers for basic and custom flows.
  • Disaster-recovery master-secret reconstruction helpers.
  • Aptos threshold-VRF request, share verification, and output reconstruction helpers.

Install for local development

python -m venv .venv
.venv/bin/python -m pip install -e '.[dev]'

Quick check

from ace_sdk import pke

encryption_key, decryption_key = pke.keygen()
ciphertext = pke.encrypt(encryption_key, b"hello ace")
plaintext = pke.decrypt(decryption_key, ciphertext).unwrap_or_throw("decrypt failed")
assert plaintext == b"hello ace"

The API follows Python naming conventions (from_bytes, to_hex, derive_encryption_key) while preserving ACE's byte-level compatibility with the TypeScript SDK.

The default PKE scheme is HPKE and does not require native system libraries. The legacy ElGamalOtpRistretto255 scheme requires libsodium >= 1.0.18 with the crypto_core_ristretto255_* APIs. Install it with your system package manager, or set ACE_SDK_LIBSODIUM_PATH to the library path.

Admin IBE validation

The reconstructed master secret printed by the ACE disaster-recovery flow is a 32-byte little-endian Fr scalar. Use it to extract a full identity decryption key and validate a ciphertext:

from ace_sdk import t_ibe

idk = t_ibe.extract(msk_scalar=msk_scalar, identity=label).unwrap_or_throw("extract")
plaintext = t_ibe.decrypt([idk], ciphertext).unwrap_or_throw("decrypt")

For Aptos app encryption, ibe_aptos.encrypt builds the same full decryption domain as the TypeScript SDK before t-IBE encryption.

Benchmarks

The BLS12-381 pairing implementation is pure Python and intentionally kept out of the default test suite. Run its opt-in benchmark with:

python benchmarks/bench_pairing.py --iterations 5

Aptos custom flow

For custom access-control flows, callers provide the application proof payload and the PKE keypair that workers should use to encrypt returned IDK shares:

from ace_sdk import ibe_aptos, pke

enc_pk, enc_sk = pke.keygen()
plaintext = ibe_aptos.decrypt_custom_flow(
    ace_deployment=deployment,
    keypair_id=keypair_id,
    chain_id=chain_id,
    module_addr=module_addr,
    module_name="example",
    label=b"object-id",
    enc_pk=enc_pk,
    enc_sk=enc_sk,
    payload=custom_proof_payload,
    ciphertext=ciphertext_bytes,
).unwrap_or_throw("custom decrypt")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aptos_ace_sdk-3.11.1.tar.gz (59.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aptos_ace_sdk-3.11.1-py3-none-any.whl (78.0 kB view details)

Uploaded Python 3

File details

Details for the file aptos_ace_sdk-3.11.1.tar.gz.

File metadata

  • Download URL: aptos_ace_sdk-3.11.1.tar.gz
  • Upload date:
  • Size: 59.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aptos_ace_sdk-3.11.1.tar.gz
Algorithm Hash digest
SHA256 a44bcf622e67977fd837b7f37b0c180659fc8dea5c764855d0f73a25788c647f
MD5 e76e11a3ea516894d2361d1d90764427
BLAKE2b-256 5b2594dc47ef83eb1d3e68fda3a7ab9bf31606e94300f9ae49d8e12c627df6bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for aptos_ace_sdk-3.11.1.tar.gz:

Publisher: publish-python-sdk.yml on aptos-labs/ace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aptos_ace_sdk-3.11.1-py3-none-any.whl.

File metadata

  • Download URL: aptos_ace_sdk-3.11.1-py3-none-any.whl
  • Upload date:
  • Size: 78.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aptos_ace_sdk-3.11.1-py3-none-any.whl
Algorithm Hash digest
SHA256 70b4bb08bc253166a687917c3eed4a8fc3a18704db7b8917121f2682a8f03129
MD5 7c7122b040eba8831a77114a5273ceb8
BLAKE2b-256 c12638e92cc58ef64e37424c9075af3d6e30aefb5021dd7e584ea963a3f4389d

See more details on using hashes here.

Provenance

The following attestation bundles were made for aptos_ace_sdk-3.11.1-py3-none-any.whl:

Publisher: publish-python-sdk.yml on aptos-labs/ace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page