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.2.0.tar.gz (28.8 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.2.0-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aleph_message-1.2.0.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aleph_message-1.2.0.tar.gz
Algorithm Hash digest
SHA256 ada1f4defd55367af4637d105928332e42c110a1fdee88bcdafa4b1c7a31f1ac
MD5 850dd9d5cd3b4b3710a160eb7388d705
BLAKE2b-256 4cd4f98f3e0db2e6a355fba0c777c2930f423796c2a52aa71303463064ce19da

See more details on using hashes here.

Provenance

The following attestation bundles were made for aleph_message-1.2.0.tar.gz:

Publisher: publish.yml on aleph-im/aleph-message

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: aleph_message-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 46.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aleph_message-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f52f9f8ab7f821503ec7f8677de79e732b506792401a96d9c14d8c5278f34e5c
MD5 6a285e7c0ef7ace7e4b8f95209259c5b
BLAKE2b-256 29b7bc10a13d7dd5c3c95114dd2e93299a9f8a34901d19aeec3f3f56406154ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for aleph_message-1.2.0-py3-none-any.whl:

Publisher: publish.yml on aleph-im/aleph-message

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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