Skip to main content

Backend SDK for Python servers to integrate with the Noxy push notification network

Project description

๐Ÿ“ฆ @noxy-network/python-sdk

Backend SDK for Python servers to integrate with the Noxy push notification network. Send encrypted push notifications to Web3 wallet addresses via the Noxy relay infrastructure.

Overview

This SDK enables server-side applications to:

  • Send push notifications to users by their Web3 wallet address (EVM 0x format)
  • Query quota usage for your application's relay allocation
  • Resolve identity devices to deliver notifications to all registered devices

Communication with the Noxy relay is performed over gRPC using Protocol Buffers. All notifications are encrypted end-to-end on the backend before transmission; decryption occurs only on the recipient's Noxy device. The SDK uses post-quantum encryption (Kyber768) to protect payloads against future quantum attacks.

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     gRPC (TLS)      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     E2E Encrypted     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Your Backend   โ”‚ โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚  Noxy Relay     โ”‚ โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚  Noxy Device    โ”‚
โ”‚  (this SDK)     โ”‚   PushNotification  โ”‚                 โ”‚   Ciphertext only    โ”‚  (decrypts)      โ”‚
โ”‚                 โ”‚   GetQuota          โ”‚                 โ”‚                      โ”‚                 โ”‚
โ”‚                 โ”‚   GetIdentityDevicesโ”‚                 โ”‚                      โ”‚                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • Encryption: Kyber768 (post-quantum KEM) + AES-256-GCM. Each notification is encrypted per-device using the device's post-quantum public key.
  • Transport: gRPC over TLS with Bearer token authentication.
  • Relay: The Noxy relay forwards ciphertext only; it cannot decrypt notification payloads.

Requirements

  • Python >= 3.10
  • C compiler (for kybercffi)

๐Ÿš€ Installation

pip install noxy-sdk

๐Ÿ›  Quick Start

from noxy import NoxyConfig, init_noxy_client

config = NoxyConfig(
    endpoint="https://relay.noxy.network",
    auth_token="your-api-token",
    notification_ttl_seconds=3600,
)

with init_noxy_client(config) as client:
    # Send a push notification to a wallet address
    results = client.send_push(
        "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
        {"title": "New message", "body": "You have a new notification", "data": {"action": "open_chat", "id": "123"}},
    )

    # Check quota usage
    quota = client.get_quota()
    print(f"{quota.quota_remaining} remaining")

Configuration

Option Type Required Description
endpoint str Yes Noxy relay gRPC endpoint (e.g. https://relay.noxy.network). Scheme is stripped; TLS is used by default.
auth_token str Yes Bearer token for relay authentication. Sent in the Authorization header on every request.
notification_ttl_seconds int Yes Time-to-live for notifications in seconds.

API Reference

init_noxy_client(config: NoxyConfig) -> NoxyPushClient

Initializes the SDK client. Normalizes the endpoint and establishes the gRPC connection.

NoxyPushClient

send_push(identity_address, push_notification) -> List[NoxyPushResponse]

Sends a push notification to all devices registered for the given Web3 identity address.

  • identity_address: EVM address in 0x format (e.g. 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1)
  • push_notification: Any JSON-serializable object (e.g. dict). Encrypted before transmission.
  • Returns: List of NoxyPushResponse per device, with status and request_id.

get_quota() -> NoxyGetQuotaResponse

Returns quota usage for your application.

  • Returns: NoxyGetQuotaResponse with request_id, app_name, quota_total, quota_remaining, status.

Types

  • NoxyPushDeliveryStatus: DELIVERED (0) | QUEUED (1) | NO_DEVICES (2) | REJECTED (3) | ERROR (4)
  • NoxyQuotaStatus: QUOTA_ACTIVE (0) | QUOTA_SUSPENDED (1) | QUOTA_DELETED (2)

Encryption Details

  1. Key encapsulation: For each device, the SDK encapsulates a shared secret using the device's Kyber768 post-quantum public key (pq_public_key).
  2. Key derivation: The shared secret is expanded via HKDF-SHA256 to a 256-bit AES key.
  3. Payload encryption: The notification payload (JSON) is encrypted with AES-256-GCM. The ciphertext includes the GCM auth tag appended for integrity verification.
  4. Transmission: Only kyber_ct, nonce, and ciphertext are sent to the relay. The relay cannot decrypt; only the target device (with its secret key) can decrypt.

Building from source

python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
pip install -e .

# Regenerate proto (if proto file changes)
python -m grpc_tools.protoc -I proto --python_out=noxy/grpc --grpc_python_out=noxy/grpc proto/noxy.proto
# Fix import in noxy/grpc/noxy_pb2_grpc.py: change "import noxy_pb2" to "from . import noxy_pb2"

๐Ÿ“„ License

MIT

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

noxy_sdk-1.0.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

noxy_sdk-1.0.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file noxy_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: noxy_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for noxy_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3f30d3405226022e836e6d087f35ccf6c63bcbf5437f442c7863526b6b420fb7
MD5 1da8369b6cd84cf27f85533bfbebbc6b
BLAKE2b-256 4afd8925a5e2fdfc088b87ccccd90beb66fe0e43af215d07355b675c87add5ee

See more details on using hashes here.

File details

Details for the file noxy_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: noxy_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for noxy_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1177d07c0850efb33d90ed948aabb7cbc8601b9049c2ecc1fd111d28b8198b25
MD5 da10f533e5d457a6bed6c8933f222762
BLAKE2b-256 ef4afe930c11af9061e1144e3be8121cd51483651daac8e2476cdd9a011f9f61

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