Skip to main content

Aleph.im message specification

Project description

Aleph.im Message Specification

This library aims to provide an easy way to create, update and manipulate messages from Aleph.im.

It mainly consists in pydantic models that provide field type validation and IDE autocompletion for messages.

This library provides:

  • schema validation when parsing messages.
  • cryptographic hash validation that the item_hash matches the content of the message.
  • type validation using type checkers such as mypy in development environments.
  • autocompletion support in development editors.

The item_hash is commonly used as unique message identifier on Aleph.im.

Cryptographic signatures are out of scope of this library and part of the aleph-sdk-python project, due to their extended scope and dependency on cryptographic libraries.

This library is used in both client and node software of Aleph.im.

Usage

pip install aleph-message
import requests
from aleph_message import parse_message
from pydantic import ValidationError

ALEPH_API_SERVER = "https://official.aleph.cloud"
MESSAGE_ITEM_HASH = "9b21eb870d01bf64d23e1d4475e342c8f958fcd544adc37db07d8281da070b00"

message_dict = requests.get(ALEPH_API_SERVER + "/api/v0/messages.json?hashes=" + MESSAGE_ITEM_HASH).json()

try:
    message = parse_message(message_dict["messages"][0])
    print(message.sender)
except ValidationError as e:
    print(e.json(indent=4))

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

aleph-message-0.4.8.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

aleph_message-0.4.8-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file aleph-message-0.4.8.tar.gz.

File metadata

  • Download URL: aleph-message-0.4.8.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for aleph-message-0.4.8.tar.gz
Algorithm Hash digest
SHA256 43a696840799b603695c9d184f8c44b592eacd6a5023fddd83b9d5af30b5fd13
MD5 fe68a2aa6df3793232ff0d0d945b959d
BLAKE2b-256 2c7f28c684287a7e538eb3038408dd543c707ae6e6bc15d6ac96389d8bc6d34e

See more details on using hashes here.

Provenance

File details

Details for the file aleph_message-0.4.8-py3-none-any.whl.

File metadata

File hashes

Hashes for aleph_message-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f4320f7fb3c90238034f84405d7ea712db10527506e95c5f86d5dca8d501f0df
MD5 b0cc3b07f1bd03a68dc9fbf2623cd2b3
BLAKE2b-256 08dbd3093596dd8f1902893fce2b987108ac18c4a44bcb5a08afa2ee6dadae0b

See more details on using hashes here.

Provenance

Supported by

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