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-1.0.5.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

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

aleph_message-1.0.5-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file aleph_message-1.0.5.tar.gz.

File metadata

  • Download URL: aleph_message-1.0.5.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for aleph_message-1.0.5.tar.gz
Algorithm Hash digest
SHA256 571a643a93e13b01014b6a4adabe098662ee7b343fece49bf0b4bee6a3838112
MD5 0fa105ad238fad2a7fc2a12fd4cb11bd
BLAKE2b-256 1828eed11e7ecc17b9a3947356d767aa8dea5e9eb6ce55b62675de75fb57eacc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aleph_message-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 40.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for aleph_message-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 05ea03e0f823f70608a4c42845f35f1c6023a0ba25979d01623939ec0de54987
MD5 c2b631a168815fa7eb7db20840ee2107
BLAKE2b-256 0831395cabc98994486ba6df9fa488227973b3482a8332739cbc28373d9ab358

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