aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/tests')
-rw-r--r--packages/meshbay-node/tests/test_hub_client.py5
-rw-r--r--packages/meshbay-node/tests/test_multi_group.py3
-rw-r--r--packages/meshbay-node/tests/test_quic_transport.py4
-rw-r--r--packages/meshbay-node/tests/test_webrtc_transport.py4
4 files changed, 11 insertions, 5 deletions
diff --git a/packages/meshbay-node/tests/test_hub_client.py b/packages/meshbay-node/tests/test_hub_client.py
index e733610..95c93c7 100644
--- a/packages/meshbay-node/tests/test_hub_client.py
+++ b/packages/meshbay-node/tests/test_hub_client.py
@@ -10,6 +10,7 @@ import pytest
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey
+from meshbay_common.tokens import HUB_API_AUD
from meshbay_node.hub_client import HubClient, HubConfig
from meshbay_node.keystore import NodeKeys
@@ -52,7 +53,7 @@ def make_node_token(sk_pem, user_id, pk_user_b64, hub_id="fake-hub", ttl=3600):
return jwt.encode({
"iss": hub_id, "sub": user_id, "pk_user": pk_user_b64,
"hub_id": hub_id, "jti": "test-jti", "scope": "node",
- "iat": now, "exp": now + ttl,
+ "iat": now, "exp": now + ttl, "aud": HUB_API_AUD,
}, sk_pem, algorithm="EdDSA")
@@ -89,7 +90,7 @@ async def test_login_rejects_missing_jti(hub_keys, node_keys, hub_config):
sk_hub, sk_hub_pem, pk_hub_pem = hub_keys
bad_token = jwt.encode({
"iss": "fake-hub", "sub": "uid", "pk_user": node_keys.pk_ed25519_b64,
- "hub_id": "fake-hub", "scope": "node",
+ "hub_id": "fake-hub", "scope": "node", "aud": HUB_API_AUD,
"iat": int(time.time()), "exp": int(time.time()) + 3600,
}, sk_hub_pem, algorithm="EdDSA")
diff --git a/packages/meshbay-node/tests/test_multi_group.py b/packages/meshbay-node/tests/test_multi_group.py
index b75bad0..01b2abc 100644
--- a/packages/meshbay-node/tests/test_multi_group.py
+++ b/packages/meshbay-node/tests/test_multi_group.py
@@ -7,6 +7,7 @@ Verifies that:
- A user in both groups can access both
"""
+from meshbay_common.tokens import MNP_AUD
import time
import jwt
@@ -63,7 +64,7 @@ def make_jwt(sk_hub, pk_node_b64, groups, user_id="user-001", ttl=3600):
"iss": "test-hub", "sub": user_id,
"pk_user": pk_node_b64, "hub_id": "test-hub",
"jti": "test-jti", "iat": now, "exp": now + ttl,
- "groups": groups,
+ "groups": groups, "scope": "user", "aud": MNP_AUD,
}, sk_pem, algorithm="EdDSA")
diff --git a/packages/meshbay-node/tests/test_quic_transport.py b/packages/meshbay-node/tests/test_quic_transport.py
index 8eb0622..a32402a 100644
--- a/packages/meshbay-node/tests/test_quic_transport.py
+++ b/packages/meshbay-node/tests/test_quic_transport.py
@@ -3,6 +3,7 @@ Integration test: QuicChunkServer ↔ QuicChunkClient over QUIC/UDP loopback.
Same structure as test_transport.py but uses QUIC instead of TCP+TLS.
"""
+from meshbay_common.tokens import MNP_AUD
import asyncio
import os
import time
@@ -51,7 +52,8 @@ def make_jwt(sk_hub, pk_node_b64, ttl=3600, groups=None):
"pk_user": pk_node_b64, "hub_id": "test-hub",
"jti": "test-jti", "iat": now, "exp": now + ttl,
# group_id is mandatory (M1), so default tokens are members of "g".
- "groups": groups if groups is not None else ["g"],
+ "groups": groups if groups is not None else ["g"], "scope": "user",
+ "aud": MNP_AUD,
}, sk_pem, algorithm="EdDSA")
diff --git a/packages/meshbay-node/tests/test_webrtc_transport.py b/packages/meshbay-node/tests/test_webrtc_transport.py
index 0245c4e..990b1da 100644
--- a/packages/meshbay-node/tests/test_webrtc_transport.py
+++ b/packages/meshbay-node/tests/test_webrtc_transport.py
@@ -7,6 +7,7 @@ for MNP protocol exchange (handshake, index_sync, file_request, file_chunk).
Uses local loopback (no STUN/ICE needed for localhost).
"""
+from meshbay_common.tokens import MNP_AUD
import asyncio
import base64
import hashlib
@@ -115,6 +116,7 @@ def _make_jwt(sk_hub, groups=None, pk_user="test"):
"pk_user": pk_user, "hub_id": "test-hub",
"jti": "test-jti-webrtc", "iat": now, "exp": now + 3600,
"groups": groups if groups is not None else [TEST_GROUP],
+ "scope": "user", "aud": MNP_AUD,
}, sk_pem, algorithm="EdDSA")
@@ -218,7 +220,7 @@ def _token(sk_hub, jwt_sub, peer_id, group_id, pk_user="test"):
"iss": "test-hub", "sub": jwt_sub,
"pk_user": pk_user, "hub_id": "test-hub",
"jti": f"jti-{peer_id}", "iat": now, "exp": now + 3600,
- "groups": [group_id], "scope": "user",
+ "groups": [group_id], "scope": "user", "aud": MNP_AUD,
}, sk_h_pem, algorithm="EdDSA")