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+
  • Bundled native runtime targets:
    • Windows x64
    • Linux x64
    • macOS Intel (x64)
    • macOS Apple Silicon (arm64)

Overrides:

  • P4_CORE_LIB for core 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.3.tar.gz (18.8 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.3-py3-none-any.whl (18.9 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: p4_core-0.2.3.tar.gz
  • Upload date:
  • Size: 18.8 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.3.tar.gz
Algorithm Hash digest
SHA256 a389a5f86361fa96cac70e4f8a613a97ea8c4fa582674c9aa2879bc70f7feead
MD5 43fc02915715c6e1e13f4d5e74914236
BLAKE2b-256 5b046a44fec8f2eb7dd5a53d91361b97620309b6d6f358a55997704c2fc76f18

See more details on using hashes here.

File details

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

File metadata

  • Download URL: p4_core-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 18.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d9b139ff91d29b0e00f455df14476a150c66fa6bb7647ab5d9cb96e7e91d0fb4
MD5 acf2cc2407b541299b17facfe567370a
BLAKE2b-256 dd001aa9c1895c25793f14241dd5b3da6049631fd0c2b25c338b966272cf4610

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