tba-protocol-workload-spiffe-broker-api 0.4.0.dev2__py3-none-any.whl

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.
@@ -0,0 +1,18 @@
1
+ from .endpoint import validate_endpoint
2
+ from .references import BrokerWorkloadReference, normalize_reference
3
+ from .rpcs import RPC_DEFINITIONS, RPC_NAMES, BrokerRpcDefinition
4
+ from .service import BrokerApiService
5
+ from .versions import CURRENT_VERSION, VERSION_HISTORY, BrokerApiVersion
6
+
7
+ __all__ = [
8
+ "BrokerApiService",
9
+ "BrokerApiVersion",
10
+ "BrokerRpcDefinition",
11
+ "BrokerWorkloadReference",
12
+ "CURRENT_VERSION",
13
+ "RPC_DEFINITIONS",
14
+ "RPC_NAMES",
15
+ "VERSION_HISTORY",
16
+ "normalize_reference",
17
+ "validate_endpoint",
18
+ ]
@@ -0,0 +1,5 @@
1
+ """Capability bindings owned by the versioned protocol package."""
2
+
3
+ PROTOCOL_CAPABILITY_BINDINGS: tuple[str, ...] = ()
4
+
5
+ __all__ = ["PROTOCOL_CAPABILITY_BINDINGS"]
@@ -0,0 +1,5 @@
1
+ """Claim vocabulary selected by the versioned protocol package."""
2
+
3
+ PROTOCOL_CLAIM_NAMES: tuple[str, ...] = ()
4
+
5
+ __all__ = ["PROTOCOL_CLAIM_NAMES"]
@@ -0,0 +1,3 @@
1
+ def require_version(identifier: str) -> None:
2
+ if identifier != "SPIFFE-v1.15.1-Broker-API":
3
+ raise ValueError(f"unsupported Broker API revision: {identifier}")
@@ -0,0 +1,3 @@
1
+ def validate_endpoint(address: str) -> None:
2
+ if not (address.startswith("unix://") or address.startswith("npipe://")):
3
+ raise ValueError("Broker API requires a local Broker Endpoint")
@@ -0,0 +1,8 @@
1
+ """Errors raised by the versioned protocol package."""
2
+
3
+
4
+ class ProtocolProfileError(ValueError):
5
+ """The artifact or request does not satisfy the selected protocol profile."""
6
+
7
+
8
+ __all__ = ["ProtocolProfileError"]
@@ -0,0 +1,10 @@
1
+ FEATURES = frozenset(
2
+ {
3
+ "x509-svid-subscription",
4
+ "x509-bundle-subscription",
5
+ "jwt-svid-fetch",
6
+ "jwt-bundle-subscription",
7
+ "delegated-workload-reference",
8
+ "broker-authorization",
9
+ }
10
+ )
@@ -0,0 +1,8 @@
1
+ def migration_path(
2
+ source: str, target: str = "SPIFFE-v1.15.1-Broker-API"
3
+ ) -> tuple[str, ...]:
4
+ if source == target:
5
+ return ()
6
+ raise ValueError(
7
+ f"manual Incubating Broker API migration required: {source} to {target}"
8
+ )
File without changes
@@ -0,0 +1,18 @@
1
+ from dataclasses import dataclass
2
+ from typing import Mapping
3
+
4
+
5
+ @dataclass(frozen=True, slots=True)
6
+ class BrokerWorkloadReference:
7
+ kind: str
8
+ attributes: Mapping[str, object]
9
+
10
+
11
+ def normalize_reference(
12
+ kind: str, attributes: Mapping[str, object]
13
+ ) -> BrokerWorkloadReference:
14
+ if kind not in {"pid", "kubernetes"}:
15
+ raise ValueError(f"unsupported broker workload reference: {kind}")
16
+ if not attributes:
17
+ raise ValueError("broker workload reference attributes are required")
18
+ return BrokerWorkloadReference(kind, dict(attributes))
@@ -0,0 +1,17 @@
1
+ from dataclasses import dataclass
2
+
3
+
4
+ @dataclass(frozen=True, slots=True)
5
+ class BrokerRpcDefinition:
6
+ name: str
7
+ server_streaming: bool
8
+ profile: str
9
+
10
+
11
+ RPC_DEFINITIONS = (
12
+ BrokerRpcDefinition("SubscribeToX509SVID", True, "x509-svid"),
13
+ BrokerRpcDefinition("SubscribeToX509Bundles", True, "x509-svid"),
14
+ BrokerRpcDefinition("FetchJWTSVID", False, "jwt-svid"),
15
+ BrokerRpcDefinition("SubscribeToJWTBundles", True, "jwt-svid"),
16
+ )
17
+ RPC_NAMES = frozenset(item.name for item in RPC_DEFINITIONS)
@@ -0,0 +1,5 @@
1
+ """Wire-schema inventory owned by the versioned protocol package."""
2
+
3
+ PROTOCOL_WIRE_SCHEMA_NAMES: tuple[str, ...] = ()
4
+
5
+ __all__ = ["PROTOCOL_WIRE_SCHEMA_NAMES"]
@@ -0,0 +1,25 @@
1
+ from collections.abc import Callable, Mapping
2
+ from .rpcs import RPC_NAMES
3
+
4
+
5
+ class BrokerApiService:
6
+ def __init__(
7
+ self,
8
+ *,
9
+ authorize: Callable[[object], bool],
10
+ handlers: Mapping[str, Callable[..., object]],
11
+ ) -> None:
12
+ unknown = set(handlers).difference(RPC_NAMES)
13
+ missing = RPC_NAMES.difference(handlers)
14
+ if unknown or missing:
15
+ raise ValueError(
16
+ f"Broker API handler mismatch; unknown={sorted(unknown)}, missing={sorted(missing)}"
17
+ )
18
+ self._authorize, self._handlers = authorize, dict(handlers)
19
+
20
+ def dispatch(self, actor: object, rpc: str, request: object) -> object:
21
+ if not self._authorize(actor):
22
+ raise PermissionError("broker caller is not authorized")
23
+ if rpc not in RPC_NAMES:
24
+ raise ValueError(f"unknown Broker API RPC: {rpc}")
25
+ return self._handlers[rpc](request)
@@ -0,0 +1,16 @@
1
+ from dataclasses import dataclass
2
+
3
+
4
+ @dataclass(frozen=True, slots=True)
5
+ class BrokerApiVersion:
6
+ identifier: str
7
+ status: str
8
+ specification_uri: str
9
+
10
+
11
+ CURRENT_VERSION = BrokerApiVersion(
12
+ "SPIFFE-v1.15.1-Broker-API",
13
+ "Incubating",
14
+ "https://github.com/spiffe/spiffe/tree/v1.15.1",
15
+ )
16
+ VERSION_HISTORY = (CURRENT_VERSION,)
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: tba-protocol-workload-spiffe-broker-api
3
+ Version: 0.4.0.dev2
4
+ Summary:
5
+ Requires-Python: >=3.10,<3.15
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3.10
8
+ Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Programming Language :: Python :: 3.14
@@ -0,0 +1,17 @@
1
+ tba_protocol_workload_spiffe_broker_api/__init__.py,sha256=WHZgzxzQoD6NT_k8malSXyqi1qKYG0D3KgXozkJLLV4,545
2
+ tba_protocol_workload_spiffe_broker_api/bindings.py,sha256=geO7qbQkZg0dzzGv3daVxr3WhKaDUdlb382DITlWey4,163
3
+ tba_protocol_workload_spiffe_broker_api/claims.py,sha256=WibdHFxqAyKK9njjKwo37vO1RKj76jedqoDQs22LF6U,147
4
+ tba_protocol_workload_spiffe_broker_api/compatibility.py,sha256=lh-5Gyoh_50vKSBVquNrblqzWgAzXzcpE_ZLu_wKy4s,171
5
+ tba_protocol_workload_spiffe_broker_api/endpoint.py,sha256=i-bC9AlrQPczpFdEsvOFTvMOD9m6zn1PaJ4PlcNY3qE,195
6
+ tba_protocol_workload_spiffe_broker_api/errors.py,sha256=KwHVry4N9TO5ZP3zolvxALLJPBFjBOpiNq_-vH4F9lQ,216
7
+ tba_protocol_workload_spiffe_broker_api/features.py,sha256=1Q3LH3JgTBAr0zRJ7xPbWzdUBQq07QR21IVsDLW33Bk,239
8
+ tba_protocol_workload_spiffe_broker_api/migrations.py,sha256=j79c359mE-6V0KhwfAkEPh4PXZwDk6FcErJr-kXMSfI,253
9
+ tba_protocol_workload_spiffe_broker_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ tba_protocol_workload_spiffe_broker_api/references.py,sha256=MOFqXrprFHRdK1diRK1eBHkHgPyv2lRL7wyuiFSgQAw,563
11
+ tba_protocol_workload_spiffe_broker_api/rpcs.py,sha256=5AovNQzdXxjWcZTO1Qs3oKX3k9jyehVsyACUs_OxGwc,507
12
+ tba_protocol_workload_spiffe_broker_api/schemas.py,sha256=QHrkgNjQDZ4CzMQvwCKcenekGhjq2ezTtR8VdgdbcWQ,161
13
+ tba_protocol_workload_spiffe_broker_api/service.py,sha256=q6TDIMY1-KtjL7Y_Gut2zbfopZYm4TNSuVJuWuieiJ0,930
14
+ tba_protocol_workload_spiffe_broker_api/versions.py,sha256=jVA9N_IZtoaL4ptGV3o5JrUTw0nZKzAt-C9D_q2H9dY,340
15
+ tba_protocol_workload_spiffe_broker_api-0.4.0.dev2.dist-info/METADATA,sha256=YGnDzVMVELYUpDP2Ta5CkC8Mb0hpuM1cuICPAKNewDg,431
16
+ tba_protocol_workload_spiffe_broker_api-0.4.0.dev2.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
17
+ tba_protocol_workload_spiffe_broker_api-0.4.0.dev2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.5.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any