Python bindings for the Group Protocol Stack: a layered, end-to-end encrypted group-messaging protocol family built on top of MLS (RFC 9420).
Project description
gbp-stack — Python bindings for the Group Protocol Stack
Python bindings for the Group Protocol Stack: a layered, end-to-end encrypted group-messaging protocol family built on top of MLS (RFC 9420).
This package wraps the native gbp_stack shared library through ctypes.
The wheel for each supported platform bundles the appropriate native binary
under gbp_stack/_native/<rid>/.
Layers
┌── application ──────────────────────────────────────────────────────┐
│ GtpClient · GapClient · GspClient (TCP / UDP / SCTP-like) │
├─────────────────────────────────────────────────────────────────────┤
│ GroupNode (GBP — IP-like base) │
├─────────────────────────────────────────────────────────────────────┤
│ MlsContext (RFC 9420) │
└─────────────────────────────────────────────────────────────────────┘
Sub-protocol toolkits
Beyond the protocol clients, the package ships ready-made helpers:
MessageHistory+Watermark— bounded GTP message log + per-sender high-water mark for serving and consuming resync requests.JitterBuffer— bounded GAP reorder window keyed bymedia_source_id, withpush,pop_in_order,pop_forceand late-frame detection.RoleRegistry+Permissions— bind numeric role ids to permission bit-masks and check them withrequire/has.CapabilitiesNegotiator— track per-member advertisements and query theintersection,union,group_supportsandmissingviews.SFrameSession+SFrameEncryptor— SFrame (draft-ietf-sframe-enc) E2EE for GAP audio frames; per-sender AES-GCM keys derived from MLS exporter, 1024-entry sliding-window replay protection.encode_gbp_frame— low-level helper to construct a raw CBOR GBP frame.lookup_error— return the CBORErrorObjectfor a known error code.
Coordinator events
NodeEvent surfaces three new event kinds for coordinator election:
kind |
Extra fields | Meaning |
|---|---|---|
coordinator_election_needed |
— | The local node should initiate GSP COORDINATOR_CLAIM |
became_coordinator |
— | This node won the election |
coordinator_claim |
claimant |
A peer sent COORDINATOR_CLAIM with this member id |
Install
pip install gbp-stack==1.4.1
Quick start
from gbp_stack import MlsContext, GroupNode, GtpClient
with MlsContext.create("alice") as alice_mls, \
MlsContext.create("bob") as bob_mls:
bob_kp = bob_mls.export_key_package()
welcome = alice_mls.invite(bob_kp) # alice auto-finalizes; epoch advances to 1
bob_mls.accept_welcome(welcome)
group_id = alice_mls.group_id
with GroupNode.create(member_id=1, group_id=group_id) as alice, \
GroupNode.create(member_id=2, group_id=group_id) as bob, \
GtpClient.create() as gtp_alice, \
GtpClient.create() as gtp_bob:
alice.bootstrap_as_creator(alice_mls.epoch)
bob.bootstrap_as_joiner(bob_mls.epoch)
frame = gtp_alice.send(alice, alice_mls, target=2,
message_id=0xCAFE_F00D, text="hello")
for ev in bob.on_wire(bob_mls, frame.wire):
if ev.kind == "payload_received" and ev.stream_type == 2: # StreamType.Text
result = gtp_bob.accept(ev.plaintext, bob_mls.epoch)
print(result.text) # → "hello"
# result.status is "new" (first message from this sender)
# subsequent messages → "new"; duplicates → "duplicate"
GSP signals with per-signal arguments
Signals that target a specific member or resource require CBOR-encoded args.
The send method accepts an optional args: bytes keyword argument.
import struct
from gbp_stack import GspClient, SignalType
# Minimal CBOR helpers
def cbor_uint(n: int) -> bytes:
if n <= 23: return bytes([n])
if n <= 0xFF: return bytes([0x18, n])
if n <= 0xFFFF: return bytes([0x19, n >> 8, n & 0xFF])
return bytes([0x1A, (n>>24)&0xFF, (n>>16)&0xFF, (n>>8)&0xFF, n&0xFF])
def cbor_map1(k: int, v: int) -> bytes:
return bytes([0xA1]) + cbor_uint(k) + cbor_uint(v)
def cbor_map2(k0: int, v0: int, k1: int, v1: int) -> bytes:
return bytes([0xA2]) + cbor_uint(k0) + cbor_uint(v0) + cbor_uint(k1) + cbor_uint(v1)
# Signal-specific args schemas:
# MUTE / UNMUTE → {0: target_member_id}
# ROLE_CHANGE → {0: target_member_id, 1: new_role_id}
# STREAM_START / STREAM_STOP → {0: stream_type}
# CODEC_UPDATE → {0: codec_id}
# JOIN / LEAVE → no args required
with GspClient.create() as gsp_alice:
# Mute member 3 (no role_claim needed for self-moderation)
frame = gsp_alice.send(
alice_node, alice_mls,
target=0, # 0 = broadcast
signal=SignalType.MUTE,
role_claim=0,
request_id=1,
args=cbor_map1(0, 3), # {0: target_member_id=3}
)
MLS multi-member group pattern
When inviting a member to an existing group (not the first invite), use
invite_full so that existing members can process the commit:
# Alice adds Carol to an alice+bob group
commit, welcome = alice_mls.invite_full(carol_mls.export_key_package())
alice_mls.finalize_commit() # alice's epoch advances
bob_mls.process_message(commit) # bob stages the commit
bob_mls.finalize_commit() # bob's epoch advances to match alice
carol_mls.accept_welcome(welcome) # carol joins
assert alice_mls.epoch == bob_mls.epoch == carol_mls.epoch
License
Licensed under Apache License, Version 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gbp_stack-1.4.1.tar.gz.
File metadata
- Download URL: gbp_stack-1.4.1.tar.gz
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84dac4b056b9e5560101be9b03dd142cb65cdaf83846e315990c461710b2a75b
|
|
| MD5 |
2c20e0de56b2c5165cad7024cd038526
|
|
| BLAKE2b-256 |
31816d8c386c13bc9da63475425154287f959e35deceb5a80fb32acda2cc6332
|
Provenance
The following attestation bundles were made for gbp_stack-1.4.1.tar.gz:
Publisher:
release.yml on F000NKKK/Group-Protocol-Stack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gbp_stack-1.4.1.tar.gz -
Subject digest:
84dac4b056b9e5560101be9b03dd142cb65cdaf83846e315990c461710b2a75b - Sigstore transparency entry: 1561328066
- Sigstore integration time:
-
Permalink:
F000NKKK/Group-Protocol-Stack@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Branch / Tag:
refs/tags/v1.4.1 - Owner: https://github.com/F000NKKK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gbp_stack-1.4.1-cp311-cp311-win_arm64.whl.
File metadata
- Download URL: gbp_stack-1.4.1-cp311-cp311-win_arm64.whl
- Upload date:
- Size: 24.0 kB
- Tags: CPython 3.11, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b1ca39b92448e482e9aafee7a1cbbd819427458f67a9bbe65a977cae9bb532a
|
|
| MD5 |
ec8ac280e5510840e86f08238dc63e76
|
|
| BLAKE2b-256 |
71c8fdb93c82bae99d9c7104394d2bf12c10ab136ea257b81b30b8839619e2c6
|
Provenance
The following attestation bundles were made for gbp_stack-1.4.1-cp311-cp311-win_arm64.whl:
Publisher:
release.yml on F000NKKK/Group-Protocol-Stack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gbp_stack-1.4.1-cp311-cp311-win_arm64.whl -
Subject digest:
6b1ca39b92448e482e9aafee7a1cbbd819427458f67a9bbe65a977cae9bb532a - Sigstore transparency entry: 1561328621
- Sigstore integration time:
-
Permalink:
F000NKKK/Group-Protocol-Stack@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Branch / Tag:
refs/tags/v1.4.1 - Owner: https://github.com/F000NKKK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gbp_stack-1.4.1-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: gbp_stack-1.4.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aae37f1e9c1b2a4c1c0248de6a6f03b0adbee578e6cac41d18e3876b8f37f14
|
|
| MD5 |
a60c55d796332f47a9c87ffd69d40345
|
|
| BLAKE2b-256 |
7930bc8e19cfd61a8d772fe098b244cb05581aea7c487642144c32cbcdcff9f4
|
Provenance
The following attestation bundles were made for gbp_stack-1.4.1-cp311-cp311-win_amd64.whl:
Publisher:
release.yml on F000NKKK/Group-Protocol-Stack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gbp_stack-1.4.1-cp311-cp311-win_amd64.whl -
Subject digest:
4aae37f1e9c1b2a4c1c0248de6a6f03b0adbee578e6cac41d18e3876b8f37f14 - Sigstore transparency entry: 1561328407
- Sigstore integration time:
-
Permalink:
F000NKKK/Group-Protocol-Stack@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Branch / Tag:
refs/tags/v1.4.1 - Owner: https://github.com/F000NKKK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gbp_stack-1.4.1-cp311-cp311-manylinux2014_x86_64.whl.
File metadata
- Download URL: gbp_stack-1.4.1-cp311-cp311-manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e2ffb204b6d1aad52e1e3f5a8d9fd1b96d8b01d121f0ea663f39db278e8dff4
|
|
| MD5 |
b8a9ce9d1302ac5a48f86d03fb1da5b2
|
|
| BLAKE2b-256 |
500668156e2f322a8c5d3282a568ccad33c9280fb6a080dd616bd8f85377cecf
|
Provenance
The following attestation bundles were made for gbp_stack-1.4.1-cp311-cp311-manylinux2014_x86_64.whl:
Publisher:
release.yml on F000NKKK/Group-Protocol-Stack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gbp_stack-1.4.1-cp311-cp311-manylinux2014_x86_64.whl -
Subject digest:
5e2ffb204b6d1aad52e1e3f5a8d9fd1b96d8b01d121f0ea663f39db278e8dff4 - Sigstore transparency entry: 1561328154
- Sigstore integration time:
-
Permalink:
F000NKKK/Group-Protocol-Stack@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Branch / Tag:
refs/tags/v1.4.1 - Owner: https://github.com/F000NKKK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gbp_stack-1.4.1-cp311-cp311-manylinux2014_aarch64.whl.
File metadata
- Download URL: gbp_stack-1.4.1-cp311-cp311-manylinux2014_aarch64.whl
- Upload date:
- Size: 23.8 kB
- Tags: CPython 3.11
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb79dcc0b7ade094d09f448ab81f2ef87fd686b0b8ebc4f490a0fbe6270da051
|
|
| MD5 |
3b2c3b2d237a62d271f2c5a883c01dc5
|
|
| BLAKE2b-256 |
2cf2518fe8a46577810957250ed891533123c3aaf9fc81527e4b5e798e915a7a
|
Provenance
The following attestation bundles were made for gbp_stack-1.4.1-cp311-cp311-manylinux2014_aarch64.whl:
Publisher:
release.yml on F000NKKK/Group-Protocol-Stack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gbp_stack-1.4.1-cp311-cp311-manylinux2014_aarch64.whl -
Subject digest:
bb79dcc0b7ade094d09f448ab81f2ef87fd686b0b8ebc4f490a0fbe6270da051 - Sigstore transparency entry: 1561328232
- Sigstore integration time:
-
Permalink:
F000NKKK/Group-Protocol-Stack@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Branch / Tag:
refs/tags/v1.4.1 - Owner: https://github.com/F000NKKK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gbp_stack-1.4.1-cp311-cp311-macosx_11_0_x86_64.whl.
File metadata
- Download URL: gbp_stack-1.4.1-cp311-cp311-macosx_11_0_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.11, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3747e09686a62f8e0ab6df4695c37e900dcda9d631f24e815797e34867629e5e
|
|
| MD5 |
97b7bd0b45bb1c60eb816c6cf34eed76
|
|
| BLAKE2b-256 |
099c6bff9882bb496b7611ea4ed1f678a89a4d6210dc52dd2acd4208d7b3e166
|
Provenance
The following attestation bundles were made for gbp_stack-1.4.1-cp311-cp311-macosx_11_0_x86_64.whl:
Publisher:
release.yml on F000NKKK/Group-Protocol-Stack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gbp_stack-1.4.1-cp311-cp311-macosx_11_0_x86_64.whl -
Subject digest:
3747e09686a62f8e0ab6df4695c37e900dcda9d631f24e815797e34867629e5e - Sigstore transparency entry: 1561328507
- Sigstore integration time:
-
Permalink:
F000NKKK/Group-Protocol-Stack@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Branch / Tag:
refs/tags/v1.4.1 - Owner: https://github.com/F000NKKK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gbp_stack-1.4.1-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: gbp_stack-1.4.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc30d19517aa1754918f0ae8b3b9ffa74fc8487572897fe787938154f22f8a62
|
|
| MD5 |
bdfdf9d8e5073a9b30234ca6307c7707
|
|
| BLAKE2b-256 |
a7468ce3171e78d833abd8e873cab5f2245ca5a37231cfc0c85e8252a9ba5468
|
Provenance
The following attestation bundles were made for gbp_stack-1.4.1-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
release.yml on F000NKKK/Group-Protocol-Stack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gbp_stack-1.4.1-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
cc30d19517aa1754918f0ae8b3b9ffa74fc8487572897fe787938154f22f8a62 - Sigstore transparency entry: 1561328309
- Sigstore integration time:
-
Permalink:
F000NKKK/Group-Protocol-Stack@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Branch / Tag:
refs/tags/v1.4.1 - Owner: https://github.com/F000NKKK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2d9c8def1d90c033ec65aabc073df589f2ab8519 -
Trigger Event:
push
-
Statement type: