8000 GitHub - istyna/py-pletyvo: Typed, async‑first Python client for the Pletyvo decentralized platform and it's protocols (Python ≥ 3.9).
[go: up one dir, main page]

Skip to content

Typed, async‑first Python client for the Pletyvo decentralized platform and it's protocols (Python ≥ 3.9).

License

Notifications You must be signed in to change notification settings

istyna/py-pletyvo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning

This is an unstable version. Changes may be backwards incompatible

py-pletyvo

PyPI - Version PyPI - License PyPI - Python Version

Typed, async‑first Python client for the Pletyvo decentralized platform and it's protocols (Python ≥ 3.9)

Install

pip install -U pletyvo

Usage

Engine

To begin using the client, you need to create an engine — the core component responsible for all communication with the Pletyvo gateway. You can create one using pletyvo.DefaultEngine:

import pletyvo

engine: pletyvo.traits.Engine = pletyvo.DefaultEngine(
    url="http://testnet.pletyvo.osyah.com",
    network="AAEAAAAB",
)

The pletyvo.DefaultEngine accepts:

  • url: The gateway endpoint.
  • network | None: the network identifier encoded as a base64 string. By default, has an already set network on the node side

Service

A service is a high-level interface that aggregates protocol-specific HTTP services. This top-level object internally composes pletyvo.DAppService & pletyvo.DeliveryService. The service requires a signer — an object responsible for producing cryptographic signatures over event bodies. The signer must implement the pletyvo.traits.Signer interface.

import pletyvo

service = pletyvo.Service.di(
    engine=engine,
    signer=signer,
)

Want full control?

You can instantiate each service manually by passing required dependencies.

import pletyvo

service = pletyvo.Service(
    dapp=pletyvo.DAppService(
        hash=pletyvo.HashService(...),
        event=pletyvo.EventService(...),
    ),
    delivery=pletyvo.DeliveryService(
        channel=pl
8DA1
etyvo.ChannelService(...),
        post=pletyvo.PostService(...),
        message=pletyvo.MessageService(...),
    )
)

Dependency graph

pletyvo-dependency-graph

dApp

Platform docs: dApp

The dApp protocol defines how signed events are created, verified, and published on the Pletyvo network. Each dapp.Event consists of dapp.EventBody and a corresponding signature, both of which are required for persistence. You can create a dApp service using either the shorthand or manual constructor:

The dApp service itself does not construct or validate signatures — it only transmits fully-formed signed events.

import pletyvo

dapp_service = pletyvo.DAppService.di(
    engine=engine,
)
dapp_service = pletyvo.DAppService(
    hash=pletyvo.HashService(...),
    event=pletyvo.EventService(...),
)

Cryptography: signing with dapp.AuthHeader

Most dApp calls that create or update data must be signed with an ED25519 keypair; read‑only requests work without it.

py‑pletyvo lets you obtain a keypair from a random seed, raw bytes, or a file. If you prefer BIP‑39 mnemonics, generate a seed with an external helper such as osyah/homin and load it into the signer.

import pletyvo

signer: pletyvo.traits.Signer

signer = pletyvo.ED25519.gen()
signer = pletyvo.ED25519.from_file(...)
signer = pletyvo.ED25519(...)

Pletyvo: decentralized applications (UA)

Delivery

Platform docs: Delivery

The delivery layer exposes three narrow services — pletyvo.ChannelService, pletyvo.PostService, and pletyvo.MessageService — bundled under pletyvo.DeliveryService.

import pletyvo

delivery_service = pletyvo.DeliveryService.di(
    engine=engine,
    signer=signer,
    event=event_service,
)
delivery_service = pletyvo.DeliveryService(
    channel=pletyvo.ChannelService(...),
    post=pletyvo.PostService(...),
    message=pletyvo.MessageService(...),
)

About

Typed, async‑first Python client for the Pletyvo decentralized platform and it's protocols (Python ≥ 3.9).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0