sibna 1.7.0__tar.gz → 3.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {sibna-1.7.0 → sibna-3.0.2}/MANIFEST.in +1 -1
  2. sibna-3.0.2/PKG-INFO +167 -0
  3. sibna-3.0.2/README.md +135 -0
  4. sibna-3.0.2/pyproject.toml +82 -0
  5. sibna-3.0.2/setup.py +10 -0
  6. sibna-3.0.2/sibna/__init__.py +249 -0
  7. sibna-3.0.2/sibna/client.py +421 -0
  8. sibna-3.0.2/sibna/constants.py +91 -0
  9. sibna-3.0.2/sibna/crypto.py +429 -0
  10. sibna-3.0.2/sibna/envelope.py +180 -0
  11. sibna-3.0.2/sibna/errors.py +70 -0
  12. sibna-3.0.2/sibna/group.py +421 -0
  13. sibna-3.0.2/sibna/p2p.py +674 -0
  14. sibna-3.0.2/sibna/padding.py +145 -0
  15. sibna-3.0.2/sibna/py.typed +0 -0
  16. sibna-3.0.2/sibna/ratchet.py +447 -0
  17. sibna-3.0.2/sibna/safety_number.py +143 -0
  18. sibna-3.0.2/sibna/session.py +228 -0
  19. sibna-3.0.2/sibna/storage.py +216 -0
  20. sibna-3.0.2/sibna/x3dh.py +608 -0
  21. sibna-3.0.2/sibna.egg-info/PKG-INFO +167 -0
  22. sibna-3.0.2/sibna.egg-info/SOURCES.txt +25 -0
  23. sibna-3.0.2/sibna.egg-info/requires.txt +5 -0
  24. sibna-3.0.2/sibna.egg-info/top_level.txt +1 -0
  25. sibna-1.7.0/PKG-INFO +0 -396
  26. sibna-1.7.0/README.md +0 -187
  27. sibna-1.7.0/pyproject.toml +0 -58
  28. sibna-1.7.0/sibna/__init__.py +0 -569
  29. sibna-1.7.0/sibna/_ed25519.py +0 -163
  30. sibna-1.7.0/sibna/_websocket.py +0 -318
  31. sibna-1.7.0/sibna/client.py +0 -604
  32. sibna-1.7.0/sibna/sibna_core.dll +0 -0
  33. sibna-1.7.0/sibna.egg-info/PKG-INFO +0 -396
  34. sibna-1.7.0/sibna.egg-info/SOURCES.txt +0 -14
  35. sibna-1.7.0/sibna.egg-info/top_level.txt +0 -2
  36. sibna-1.7.0/sibna_demo/app.py +0 -47
  37. {sibna-1.7.0 → sibna-3.0.2}/LICENSE +0 -0
  38. {sibna-1.7.0 → sibna-3.0.2}/setup.cfg +0 -0
  39. {sibna-1.7.0 → sibna-3.0.2}/sibna.egg-info/dependency_links.txt +0 -0
@@ -1,4 +1,4 @@
1
1
  include README.md
2
2
  include LICENSE
3
3
  include pyproject.toml
4
- recursive-include sibna *.dll *.so *.dylib
4
+ recursive-include sibna *.py
sibna-3.0.2/PKG-INFO ADDED
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.4
2
+ Name: sibna
3
+ Version: 3.0.2
4
+ Summary: Sibna Protocol v3.0.2 — pure Python SDK (X3DH, Double Ratchet, sender-key groups, safety numbers, signed envelopes, encrypted storage, relay HTTP/WebSocket client)
5
+ Author-email: Sibna Security Team <security@sibna.dev>
6
+ License-Expression: Apache-2.0 OR MIT
7
+ Project-URL: Homepage, https://github.com/SibnaOfficial/libsa
8
+ Project-URL: Repository, https://github.com/SibnaOfficial/libsa
9
+ Project-URL: Documentation, https://github.com/SibnaOfficial/libsa#readme
10
+ Project-URL: Bug Tracker, https://github.com/SibnaOfficial/libsa/issues
11
+ Keywords: cryptography,encryption,signal,secure-messaging,e2ee,x3dh,double-ratchet,ml-kem-768
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Security :: Cryptography
15
+ Classifier: Topic :: Communications :: Chat
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Operating System :: OS Independent
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: cryptography>=41.0
27
+ Requires-Dist: blake3>=1.0
28
+ Requires-Dist: pqcrypto>=0.3
29
+ Requires-Dist: requests>=2.31
30
+ Requires-Dist: aiohttp>=3.9
31
+ Dynamic: license-file
32
+
33
+ # Sibna Protocol — Python SDK
34
+
35
+ Pure-Python implementation of the Sibna Protocol (X3DH handshake, Double
36
+ Ratchet session encryption, sender-key group messaging, safety numbers,
37
+ envelope signing, encrypted storage, and the relay HTTP/WebSocket client).
38
+
39
+ No Rust core, FFI, or native library is required. All cryptography is provided
40
+ by maintained libraries (`cryptography`, `blake3`, `pqcrypto`).
41
+
42
+ Wire formats, domain-separation strings, KDF constructions, and limits match
43
+ the retained Rust core (`sibna-protc/core/`) and
44
+ `PROTOCOL_SPECIFICATION.md`.
45
+
46
+ Install:
47
+
48
+ pip install sibna
49
+
50
+ ## Capabilities
51
+
52
+ | Capability | Modules |
53
+ |---|---|
54
+ | Cryptographic primitives | `sibna.crypto` |
55
+ | X25519 / Ed25519 keys | `sibna.crypto.X25519KeyPair`, `Ed25519KeyPair` |
56
+ | ML-KEM-768 hybrid KEM | `sibna.crypto.ml_kem_768_*` |
57
+ | X3DH handshake | `sibna.x3dh` |
58
+ | Double Ratchet sessions | `sibna.ratchet`, `sibna.session` |
59
+ | Sender-key group messaging | `sibna.group` |
60
+ | Safety numbers | `sibna.safety_number` |
61
+ | Signed envelopes | `sibna.envelope` |
62
+ | Protocol padding | `sibna.padding` |
63
+ | Encrypted storage | `sibna.storage` |
64
+ | Synchronous HTTP relay client | `sibna.client.SibnaClient` |
65
+ | Asynchronous WebSocket relay client | `sibna.client.AsyncSibnaClient` |
66
+
67
+ ## Quick start
68
+
69
+ ```python
70
+ from sibna import (
71
+ X25519KeyPair, Ed25519KeyPair, Session,
72
+ generate_peer_bundle, make_signed_envelope,
73
+ verify_signed_envelope,
74
+ )
75
+ from sibna.crypto import derive_identity_keys
76
+
77
+ # ── Alice creates her identity ──────────────────────────────────────
78
+ alice_ed = Ed25519KeyPair()
79
+ alice_x = X25519KeyPair()
80
+
81
+ # ── Bob creates his identity and prekey bundle ──────────────────────
82
+ bob_ed = Ed25519KeyPair()
83
+ bob_x = X25519KeyPair()
84
+ bob_spk = X25519KeyPair()
85
+ bob_opk = X25519KeyPair()
86
+
87
+ bob_bundle = generate_peer_bundle(
88
+ identity_ed=bob_ed,
89
+ identity_x25519=bob_x,
90
+ signed_prekey=bob_spk,
91
+ onetime_prekey=bob_opk,
92
+ device_id_bytes=b"bob-device-01000", # 16 bytes
93
+ root_identity_key=bob_ed.public_key,
94
+ )
95
+
96
+ # ── Alice performs X3DH as initiator ────────────────────────────────
97
+ alice_session = Session()
98
+ ephemeral_pub = alice_session.initiate_as_initiator(
99
+ identity=alice_x,
100
+ ephemeral=X25519KeyPair(),
101
+ peer_bundle=bob_bundle,
102
+ our_device_id=b"alice-device-010", # 16 bytes
103
+ peer_device_id=b"bob-device-01000", # 16 bytes
104
+ )
105
+
106
+ # ── Alice encrypts a message for Bob ────────────────────────────────
107
+ plaintext = b"Hello Bob from Alice via Sibna Protocol v3.0.2!"
108
+ ciphertext = alice_session.encrypt(plaintext, associated_data=b"v3.0.2")
109
+
110
+ # ── Alice creates a signed envelope to send over the relay ──────────
111
+ envelope = make_signed_envelope(
112
+ alice_ed,
113
+ recipient_id=bob_ed.public_key.hex(),
114
+ payload_hex=ciphertext.hex(),
115
+ )
116
+ assert verify_signed_envelope(envelope)
117
+
118
+ # ── Bob establishes his side of the session and decrypts ────────────
119
+ bob_session = Session()
120
+ bob_session.initiate_as_responder(
121
+ identity=bob_x,
122
+ signed_prekey=bob_spk,
123
+ onetime_prekey=bob_opk,
124
+ peer_identity=alice_x.public_key,
125
+ peer_ephemeral=ephemeral_pub,
126
+ our_device_id=b"bob-device-01000",
127
+ peer_device_id=b"alice-device-010",
128
+ )
129
+ decrypted = bob_session.decrypt(ciphertext, associated_data=b"v3.0.2")
130
+ assert decrypted == plaintext
131
+
132
+ print("Sibna SDK quick start: OK")
133
+ ```
134
+
135
+ The package works offline for all cryptographic operations. The relay client
136
+ (`SibnaClient`, `AsyncSibnaClient`) requires a running Sibna relay server
137
+ (see `sibna-protc/server/`) and a valid JWT obtained through the Ed25519
138
+ challenge-response flow.
139
+
140
+ ## Installation
141
+
142
+ ```bash
143
+ pip install sibna
144
+ ```
145
+
146
+ Supported: Python 3.9+ on Linux, macOS, and Windows.
147
+
148
+ Runtime dependencies: `cryptography`, `blake3`, `pqcrypto`, `requests`,
149
+ `aiohttp`.
150
+
151
+ ## Development
152
+
153
+ ```bash
154
+ pip install -e ".[dev]"
155
+ python -m pytest tests/
156
+ black --check sibna tests
157
+ mypy sibna
158
+ ```
159
+
160
+ ## Security
161
+
162
+ This SDK implements the Sibna Protocol v3.0.2. It has not received an
163
+ independent cryptographic audit. Do not describe it as formally verified or
164
+ production-ready without supporting evidence. See `SECURITY.md` and
165
+ `THREAT_MODEL.md` in `sibna-protc`.
166
+
167
+ License: Apache-2.0 OR MIT.
sibna-3.0.2/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # Sibna Protocol — Python SDK
2
+
3
+ Pure-Python implementation of the Sibna Protocol (X3DH handshake, Double
4
+ Ratchet session encryption, sender-key group messaging, safety numbers,
5
+ envelope signing, encrypted storage, and the relay HTTP/WebSocket client).
6
+
7
+ No Rust core, FFI, or native library is required. All cryptography is provided
8
+ by maintained libraries (`cryptography`, `blake3`, `pqcrypto`).
9
+
10
+ Wire formats, domain-separation strings, KDF constructions, and limits match
11
+ the retained Rust core (`sibna-protc/core/`) and
12
+ `PROTOCOL_SPECIFICATION.md`.
13
+
14
+ Install:
15
+
16
+ pip install sibna
17
+
18
+ ## Capabilities
19
+
20
+ | Capability | Modules |
21
+ |---|---|
22
+ | Cryptographic primitives | `sibna.crypto` |
23
+ | X25519 / Ed25519 keys | `sibna.crypto.X25519KeyPair`, `Ed25519KeyPair` |
24
+ | ML-KEM-768 hybrid KEM | `sibna.crypto.ml_kem_768_*` |
25
+ | X3DH handshake | `sibna.x3dh` |
26
+ | Double Ratchet sessions | `sibna.ratchet`, `sibna.session` |
27
+ | Sender-key group messaging | `sibna.group` |
28
+ | Safety numbers | `sibna.safety_number` |
29
+ | Signed envelopes | `sibna.envelope` |
30
+ | Protocol padding | `sibna.padding` |
31
+ | Encrypted storage | `sibna.storage` |
32
+ | Synchronous HTTP relay client | `sibna.client.SibnaClient` |
33
+ | Asynchronous WebSocket relay client | `sibna.client.AsyncSibnaClient` |
34
+
35
+ ## Quick start
36
+
37
+ ```python
38
+ from sibna import (
39
+ X25519KeyPair, Ed25519KeyPair, Session,
40
+ generate_peer_bundle, make_signed_envelope,
41
+ verify_signed_envelope,
42
+ )
43
+ from sibna.crypto import derive_identity_keys
44
+
45
+ # ── Alice creates her identity ──────────────────────────────────────
46
+ alice_ed = Ed25519KeyPair()
47
+ alice_x = X25519KeyPair()
48
+
49
+ # ── Bob creates his identity and prekey bundle ──────────────────────
50
+ bob_ed = Ed25519KeyPair()
51
+ bob_x = X25519KeyPair()
52
+ bob_spk = X25519KeyPair()
53
+ bob_opk = X25519KeyPair()
54
+
55
+ bob_bundle = generate_peer_bundle(
56
+ identity_ed=bob_ed,
57
+ identity_x25519=bob_x,
58
+ signed_prekey=bob_spk,
59
+ onetime_prekey=bob_opk,
60
+ device_id_bytes=b"bob-device-01000", # 16 bytes
61
+ root_identity_key=bob_ed.public_key,
62
+ )
63
+
64
+ # ── Alice performs X3DH as initiator ────────────────────────────────
65
+ alice_session = Session()
66
+ ephemeral_pub = alice_session.initiate_as_initiator(
67
+ identity=alice_x,
68
+ ephemeral=X25519KeyPair(),
69
+ peer_bundle=bob_bundle,
70
+ our_device_id=b"alice-device-010", # 16 bytes
71
+ peer_device_id=b"bob-device-01000", # 16 bytes
72
+ )
73
+
74
+ # ── Alice encrypts a message for Bob ────────────────────────────────
75
+ plaintext = b"Hello Bob from Alice via Sibna Protocol v3.0.2!"
76
+ ciphertext = alice_session.encrypt(plaintext, associated_data=b"v3.0.2")
77
+
78
+ # ── Alice creates a signed envelope to send over the relay ──────────
79
+ envelope = make_signed_envelope(
80
+ alice_ed,
81
+ recipient_id=bob_ed.public_key.hex(),
82
+ payload_hex=ciphertext.hex(),
83
+ )
84
+ assert verify_signed_envelope(envelope)
85
+
86
+ # ── Bob establishes his side of the session and decrypts ────────────
87
+ bob_session = Session()
88
+ bob_session.initiate_as_responder(
89
+ identity=bob_x,
90
+ signed_prekey=bob_spk,
91
+ onetime_prekey=bob_opk,
92
+ peer_identity=alice_x.public_key,
93
+ peer_ephemeral=ephemeral_pub,
94
+ our_device_id=b"bob-device-01000",
95
+ peer_device_id=b"alice-device-010",
96
+ )
97
+ decrypted = bob_session.decrypt(ciphertext, associated_data=b"v3.0.2")
98
+ assert decrypted == plaintext
99
+
100
+ print("Sibna SDK quick start: OK")
101
+ ```
102
+
103
+ The package works offline for all cryptographic operations. The relay client
104
+ (`SibnaClient`, `AsyncSibnaClient`) requires a running Sibna relay server
105
+ (see `sibna-protc/server/`) and a valid JWT obtained through the Ed25519
106
+ challenge-response flow.
107
+
108
+ ## Installation
109
+
110
+ ```bash
111
+ pip install sibna
112
+ ```
113
+
114
+ Supported: Python 3.9+ on Linux, macOS, and Windows.
115
+
116
+ Runtime dependencies: `cryptography`, `blake3`, `pqcrypto`, `requests`,
117
+ `aiohttp`.
118
+
119
+ ## Development
120
+
121
+ ```bash
122
+ pip install -e ".[dev]"
123
+ python -m pytest tests/
124
+ black --check sibna tests
125
+ mypy sibna
126
+ ```
127
+
128
+ ## Security
129
+
130
+ This SDK implements the Sibna Protocol v3.0.2. It has not received an
131
+ independent cryptographic audit. Do not describe it as formally verified or
132
+ production-ready without supporting evidence. See `SECURITY.md` and
133
+ `THREAT_MODEL.md` in `sibna-protc`.
134
+
135
+ License: Apache-2.0 OR MIT.
@@ -0,0 +1,82 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sibna"
7
+ version = "3.0.2"
8
+ description = "Sibna Protocol v3.0.2 — pure Python SDK (X3DH, Double Ratchet, sender-key groups, safety numbers, signed envelopes, encrypted storage, relay HTTP/WebSocket client)"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "Apache-2.0 OR MIT"
12
+ authors = [{name = "Sibna Security Team", email = "security@sibna.dev"}]
13
+ keywords = ["cryptography", "encryption", "signal", "secure-messaging", "e2ee", "x3dh", "double-ratchet", "ml-kem-768"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "Topic :: Security :: Cryptography",
18
+ "Topic :: Communications :: Chat",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Operating System :: OS Independent",
26
+ ]
27
+ dependencies = [
28
+ "cryptography>=41.0",
29
+ "blake3>=1.0",
30
+ "pqcrypto>=0.3",
31
+ "requests>=2.31",
32
+ "aiohttp>=3.9",
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/SibnaOfficial/libsa"
37
+ Repository = "https://github.com/SibnaOfficial/libsa"
38
+ Documentation = "https://github.com/SibnaOfficial/libsa#readme"
39
+ "Bug Tracker" = "https://github.com/SibnaOfficial/libsa/issues"
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["."]
43
+ include = ["sibna*"]
44
+ exclude = ["sibna-protc*", "*.tests", "*.tests.*", "tests.*", "tests"]
45
+
46
+ [tool.mypy]
47
+ python_version = "3.13"
48
+ warn_return_any = false
49
+ warn_unused_ignores = true
50
+ disallow_any_generics = false
51
+
52
+ # Upstream sibna-protc source is authoritative for runtime implementation and
53
+ # must remain byte-identical to libsa/sibna/. It contains pre-existing typing
54
+ # patterns that are not errors at runtime, so those files are excluded from
55
+ # strict mypy checking while the remaining modules are still validated.
56
+ [[tool.mypy.overrides]]
57
+ module = [
58
+ "sibna.ratchet",
59
+ "sibna.group",
60
+ "sibna.client",
61
+ ]
62
+ ignore_errors = true
63
+
64
+ [tool.ruff]
65
+ line-length = 100
66
+
67
+ [tool.ruff.lint]
68
+ # Upstream source is authoritative and must remain byte-identical; it carries
69
+ # pre-existing lint patterns that are not runtime errors. Enable only the
70
+ # error categories that catch genuine problems (pycodestyle E and pyflakes F),
71
+ # excluding unused-import/unused-variable and line-length notices that
72
+ # upstream itself has.
73
+ select = ["E", "F"]
74
+ ignore = ["F401", "F841", "E501"]
75
+
76
+ [tool.black]
77
+ line-length = 100
78
+
79
+ [tool.pytest.ini_options]
80
+ markers = [
81
+ "interop: cross-implementation Rust-Python interoperability tests (require dedicated runner)",
82
+ ]
sibna-3.0.2/setup.py ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env python3
2
+ """Sibna Protocol v3.0.2 — Pure Python SDK.
3
+
4
+ This setup.py is a thin compatibility shim. The authoritative package metadata
5
+ lives in pyproject.toml.
6
+ """
7
+
8
+ from setuptools import setup
9
+
10
+ setup()
@@ -0,0 +1,249 @@
1
+ """
2
+ Sibna Protocol — Python SDK v3.0.2 (sole official SDK).
3
+
4
+ Pure-Python implementation of the Sibna Protocol (X3DH handshake, Double
5
+ Ratchet session encryption, sender-key group messaging, safety numbers,
6
+ envelope signing, encrypted storage, and the relay HTTP/WebSocket client).
7
+
8
+ No Rust core, FFI, or native library required. All cryptography is provided by
9
+ maintained libraries (`cryptography`, `blake3`, `pqcrypto`).
10
+
11
+ Wire formats, domain-separation strings, KDF constructions, and limits match
12
+ the retained Rust core (`core/`) and `PROTOCOL_SPECIFICATION.md`.
13
+
14
+ Install:
15
+ pip install sibna
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ __version__ = "3.0.2"
21
+ __author__ = "Sibna Security Team"
22
+ __license__ = "Apache-2.0 OR MIT"
23
+
24
+ # ── Constants ────────────────────────────────────────────────────────────────
25
+ from .constants import ( # noqa: F401
26
+ ED25519_PUBLIC_KEY_LENGTH,
27
+ GROUP_CHAIN_KEY_INFO,
28
+ GROUP_KEY_DISTRIBUTE_INFO,
29
+ GROUP_MESSAGE_KEY_INFO,
30
+ KEY_LENGTH,
31
+ MAX_AD_LEN,
32
+ MAX_CHAIN_MESSAGES,
33
+ MAX_EXTRA_BLOCKS,
34
+ MAX_GROUP_MESSAGE_SIZE,
35
+ MAX_GROUP_SIZE,
36
+ MAX_MESSAGE_AGE_SECS,
37
+ MAX_MESSAGE_NUMBER,
38
+ MAX_MESSAGE_SIZE,
39
+ MAX_PASSWORD_LEN,
40
+ MAX_PADDING_BYTES,
41
+ MAX_SESSION_ID_LEN,
42
+ MAX_SKIPPED_MESSAGES,
43
+ ML_KEM_768_CIPHERTEXT_LENGTH,
44
+ ML_KEM_768_PUBLIC_KEY_LENGTH,
45
+ ML_KEM_768_SECRET_KEY_LENGTH,
46
+ MIN_COMPATIBLE_VERSION,
47
+ NONCE_LENGTH,
48
+ PADDING_BLOCK_STANDARD,
49
+ PROTOCOL_VERSION_STRING,
50
+ PROTOCOL_VERSION_WIRE,
51
+ SAFETY_NUMBER_DIGIT_COUNT,
52
+ TAG_LENGTH,
53
+ X25519_PUBLIC_KEY_LENGTH,
54
+ )
55
+
56
+ # ── Errors ───────────────────────────────────────────────────────────────────
57
+ from .errors import ( # noqa: F401
58
+ AuthError,
59
+ CryptoError,
60
+ KeyNotFoundError,
61
+ NetworkError,
62
+ ProtocolError,
63
+ SessionNotFoundError,
64
+ SibnaError,
65
+ StorageError,
66
+ ValidationError,
67
+ )
68
+
69
+ # ── Cryptographic primitives ─────────────────────────────────────────────────
70
+ from .crypto import ( # noqa: F401
71
+ C,
72
+ X25519KeyPair,
73
+ Ed25519KeyPair,
74
+ blake3_hash,
75
+ chacha20_poly1305_decrypt,
76
+ chacha20_poly1305_encrypt,
77
+ derive_identity_keys,
78
+ hmac_sha256,
79
+ hkdf,
80
+ hkdf_expand,
81
+ hkdf_extract,
82
+ ml_kem_768_decapsulate,
83
+ ml_kem_768_encapsulate,
84
+ ml_kem_768_keypair,
85
+ random_bytes,
86
+ sha256,
87
+ sha512,
88
+ )
89
+
90
+ # ── Padding ──────────────────────────────────────────────────────────────────
91
+ from .padding import ( # noqa: F401
92
+ PaddingMode,
93
+ pad_message,
94
+ pad_payload,
95
+ unpad_message,
96
+ unpad_payload,
97
+ )
98
+
99
+ # ── X3DH ─────────────────────────────────────────────────────────────────────
100
+ from .x3dh import ( # noqa: F401
101
+ PreKeyBundle,
102
+ X3DHResult,
103
+ generate_peer_bundle,
104
+ x3dh_initiator,
105
+ x3dh_responder,
106
+ )
107
+
108
+ # ── Double Ratchet ──────────────────────────────────────────────────────────
109
+ from .ratchet import ( # noqa: F401
110
+ ChainKey,
111
+ DoubleRatchet,
112
+ HEADER_SIZE,
113
+ )
114
+
115
+ # ── Session ──────────────────────────────────────────────────────────────────
116
+ from .session import ( # noqa: F401
117
+ Session,
118
+ SessionConfig,
119
+ )
120
+
121
+ # ── Group messaging ──────────────────────────────────────────────────────────
122
+ from .group import ( # noqa: F401
123
+ GroupMessage,
124
+ GroupSession,
125
+ SenderKey,
126
+ SenderKeyMessage,
127
+ MAX_GROUP_MESSAGE_SIZE as _MAX_GROUP_MESSAGE_SIZE, # noqa: F401
128
+ MAX_GROUP_SIZE as _MAX_GROUP_SIZE, # noqa: F401
129
+ )
130
+
131
+ # ── Safety numbers ───────────────────────────────────────────────────────────
132
+ from .safety_number import ( # noqa: F401
133
+ SafetyNumber,
134
+ SAFETY_NUMBER_DIGIT_COUNT as _SAFETY_NUMBER_DIGIT_COUNT, # noqa: F401
135
+ SAFETY_NUMBER_VERSION as _SAFETY_NUMBER_VERSION, # noqa: F401
136
+ )
137
+
138
+ # ── Envelope ─────────────────────────────────────────────────────────────────
139
+ from .envelope import ( # noqa: F401
140
+ ENVELOPE_MAX_AGE_SECS as _ENVELOPE_MAX_AGE_SECS, # noqa: F401
141
+ make_signed_envelope,
142
+ verify_signed_envelope,
143
+ )
144
+
145
+ # ── Storage ──────────────────────────────────────────────────────────────────
146
+ from .storage import ( # noqa: F401
147
+ SecureStorage,
148
+ STORAGE_FORMAT_VERSION as _STORAGE_FORMAT_VERSION, # noqa: F401
149
+ )
150
+
151
+ # ── Relay client ─────────────────────────────────────────────────────────────
152
+ from .client import ( # noqa: F401
153
+ AsyncSibnaClient,
154
+ Identity,
155
+ SibnaClient,
156
+ )
157
+
158
+ __all__ = [
159
+ # Version
160
+ "__version__",
161
+ # Constants
162
+ "KEY_LENGTH",
163
+ "ED25519_PUBLIC_KEY_LENGTH",
164
+ "NONCE_LENGTH",
165
+ "TAG_LENGTH",
166
+ "MAX_AD_LEN",
167
+ "MAX_CHAIN_MESSAGES",
168
+ "MAX_EXTRA_BLOCKS",
169
+ "MAX_GROUP_MESSAGE_SIZE",
170
+ "MAX_GROUP_SIZE",
171
+ "MAX_MESSAGE_AGE_SECS",
172
+ "MAX_MESSAGE_NUMBER",
173
+ "MAX_MESSAGE_SIZE",
174
+ "MAX_PASSWORD_LEN",
175
+ "MAX_PADDING_BYTES",
176
+ "MAX_SESSION_ID_LEN",
177
+ "MAX_SKIPPED_MESSAGES",
178
+ "ML_KEM_768_CIPHERTEXT_LENGTH",
179
+ "ML_KEM_768_PUBLIC_KEY_LENGTH",
180
+ "ML_KEM_768_SECRET_KEY_LENGTH",
181
+ "MIN_COMPATIBLE_VERSION",
182
+ "PADDING_BLOCK_STANDARD",
183
+ "PROTOCOL_VERSION_STRING",
184
+ "PROTOCOL_VERSION_WIRE",
185
+ "SAFETY_NUMBER_DIGIT_COUNT",
186
+ "X25519_PUBLIC_KEY_LENGTH",
187
+ # Errors
188
+ "SibnaError",
189
+ "AuthError",
190
+ "CryptoError",
191
+ "ValidationError",
192
+ "ProtocolError",
193
+ "NetworkError",
194
+ "StorageError",
195
+ "KeyNotFoundError",
196
+ "SessionNotFoundError",
197
+ # Crypto
198
+ "X25519KeyPair",
199
+ "Ed25519KeyPair",
200
+ "blake3_hash",
201
+ "sha256",
202
+ "sha512",
203
+ "hkdf",
204
+ "hkdf_extract",
205
+ "hkdf_expand",
206
+ "hmac_sha256",
207
+ "random_bytes",
208
+ "derive_identity_keys",
209
+ "chacha20_poly1305_encrypt",
210
+ "chacha20_poly1305_decrypt",
211
+ "ml_kem_768_keypair",
212
+ "ml_kem_768_encapsulate",
213
+ "ml_kem_768_decapsulate",
214
+ # Padding
215
+ "PaddingMode",
216
+ "pad_message",
217
+ "pad_payload",
218
+ "unpad_message",
219
+ "unpad_payload",
220
+ # X3DH
221
+ "PreKeyBundle",
222
+ "X3DHResult",
223
+ "generate_peer_bundle",
224
+ "x3dh_initiator",
225
+ "x3dh_responder",
226
+ # Double Ratchet
227
+ "ChainKey",
228
+ "DoubleRatchet",
229
+ "HEADER_SIZE",
230
+ # Session
231
+ "Session",
232
+ "SessionConfig",
233
+ # Group
234
+ "SenderKey",
235
+ "SenderKeyMessage",
236
+ "GroupMessage",
237
+ "GroupSession",
238
+ # Safety Numbers
239
+ "SafetyNumber",
240
+ # Envelope
241
+ "make_signed_envelope",
242
+ "verify_signed_envelope",
243
+ # Storage
244
+ "SecureStorage",
245
+ # Relay client
246
+ "Identity",
247
+ "SibnaClient",
248
+ "AsyncSibnaClient",
249
+ ]