Skip to main content

Python ctypes SDK for the P4 Rust core

Project description

Python SDK

This package is a ctypes bridge over the P4 Rust C ABI.

Install

pip install p4_core

Runtime requirements

  • Python 3.9+
  • Supported bundled-native targets:
    • Windows x64
    • Linux x64
    • macOS Intel (x64)
    • macOS Apple Silicon (arm64)

For unsupported targets, set P4_CORE_LIB to a compatible native library path.

Example

from p4_core import P4Core

core = P4Core()
alice = core.generate_identity()
bob = core.generate_identity()

env = core.sign_envelope(
    private_key_b64=alice["private_key_b64"],
    sender_peer_id=alice["peer_id"],
    recipient_peer_id=bob["peer_id"],
    payload={"type": "hello", "text": "hi"},
    nonce="n1",
)
core.verify_envelope(env, signer_public_key_b64=alice["public_key_b64"])
print("ok")

Project details


Download files

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

Source Distribution

p4_core-0.2.2.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

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

p4_core-0.2.2-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file p4_core-0.2.2.tar.gz.

File metadata

  • Download URL: p4_core-0.2.2.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for p4_core-0.2.2.tar.gz
Algorithm Hash digest
SHA256 bbe9981e431e2ca2e9924624fe4c6a307aa14a17eacc9252e3d845564a504adf
MD5 22ddd0052c1251f4059f80b3a0f442b6
BLAKE2b-256 d9be4ccba8d6558fdc16629deec834bbf60eb49607b7aa27e25c525ed4594f7d

See more details on using hashes here.

File details

Details for the file p4_core-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: p4_core-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for p4_core-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b3560edd8135b3ef8def6894d1409d62d2af826dcd044ff933ea2e57ba427cf9
MD5 0f4f104190c38f1325cc865f7457fbb4
BLAKE2b-256 a28a59b75f3333e6130db2340190da8c923b179934aac31694f21dd9d35bbe45

See more details on using hashes here.

Supported by

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