otdf-python 0.1.10__py3-none-any.whl → 0.3.0__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.
Files changed (144) hide show
  1. otdf_python/__init__.py +25 -0
  2. otdf_python/__main__.py +12 -0
  3. otdf_python/address_normalizer.py +84 -0
  4. otdf_python/aesgcm.py +55 -0
  5. otdf_python/assertion_config.py +84 -0
  6. otdf_python/asym_crypto.py +85 -0
  7. otdf_python/asym_decryption.py +53 -0
  8. otdf_python/asym_encryption.py +75 -0
  9. otdf_python/auth_headers.py +21 -0
  10. otdf_python/autoconfigure_utils.py +113 -0
  11. otdf_python/cli.py +570 -0
  12. otdf_python/collection_store.py +41 -0
  13. otdf_python/collection_store_impl.py +22 -0
  14. otdf_python/config.py +69 -0
  15. otdf_python/connect_client.py +0 -0
  16. otdf_python/constants.py +1 -0
  17. otdf_python/crypto_utils.py +78 -0
  18. otdf_python/dpop.py +81 -0
  19. otdf_python/ecc_mode.py +32 -0
  20. otdf_python/eckeypair.py +75 -0
  21. otdf_python/header.py +143 -0
  22. otdf_python/invalid_zip_exception.py +8 -0
  23. otdf_python/kas_client.py +603 -0
  24. otdf_python/kas_connect_rpc_client.py +207 -0
  25. otdf_python/kas_info.py +25 -0
  26. otdf_python/kas_key_cache.py +52 -0
  27. otdf_python/key_type.py +31 -0
  28. otdf_python/key_type_constants.py +43 -0
  29. otdf_python/manifest.py +215 -0
  30. otdf_python/nanotdf.py +553 -0
  31. otdf_python/nanotdf_ecdsa_struct.py +132 -0
  32. otdf_python/nanotdf_type.py +43 -0
  33. otdf_python/policy_binding_serializer.py +39 -0
  34. otdf_python/policy_info.py +78 -0
  35. otdf_python/policy_object.py +22 -0
  36. otdf_python/policy_stub.py +2 -0
  37. otdf_python/resource_locator.py +44 -0
  38. otdf_python/sdk.py +528 -0
  39. otdf_python/sdk_builder.py +448 -0
  40. otdf_python/sdk_exceptions.py +16 -0
  41. otdf_python/symmetric_and_payload_config.py +30 -0
  42. otdf_python/tdf.py +479 -0
  43. otdf_python/tdf_reader.py +153 -0
  44. otdf_python/tdf_writer.py +23 -0
  45. otdf_python/token_source.py +34 -0
  46. otdf_python/version.py +57 -0
  47. otdf_python/zip_reader.py +47 -0
  48. otdf_python/zip_writer.py +70 -0
  49. otdf_python-0.3.0.dist-info/METADATA +231 -0
  50. otdf_python-0.3.0.dist-info/RECORD +137 -0
  51. {otdf_python-0.1.10.dist-info → otdf_python-0.3.0.dist-info}/WHEEL +1 -2
  52. {otdf_python-0.1.10.dist-info → otdf_python-0.3.0.dist-info/licenses}/LICENSE +1 -1
  53. otdf_python_proto/__init__.py +37 -0
  54. otdf_python_proto/authorization/__init__.py +1 -0
  55. otdf_python_proto/authorization/authorization_pb2.py +80 -0
  56. otdf_python_proto/authorization/authorization_pb2.pyi +161 -0
  57. otdf_python_proto/authorization/authorization_pb2_connect.py +191 -0
  58. otdf_python_proto/authorization/v2/authorization_pb2.py +105 -0
  59. otdf_python_proto/authorization/v2/authorization_pb2.pyi +134 -0
  60. otdf_python_proto/authorization/v2/authorization_pb2_connect.py +233 -0
  61. otdf_python_proto/common/__init__.py +1 -0
  62. otdf_python_proto/common/common_pb2.py +52 -0
  63. otdf_python_proto/common/common_pb2.pyi +61 -0
  64. otdf_python_proto/entity/__init__.py +1 -0
  65. otdf_python_proto/entity/entity_pb2.py +47 -0
  66. otdf_python_proto/entity/entity_pb2.pyi +50 -0
  67. otdf_python_proto/entityresolution/__init__.py +1 -0
  68. otdf_python_proto/entityresolution/entity_resolution_pb2.py +57 -0
  69. otdf_python_proto/entityresolution/entity_resolution_pb2.pyi +55 -0
  70. otdf_python_proto/entityresolution/entity_resolution_pb2_connect.py +149 -0
  71. otdf_python_proto/entityresolution/v2/entity_resolution_pb2.py +55 -0
  72. otdf_python_proto/entityresolution/v2/entity_resolution_pb2.pyi +55 -0
  73. otdf_python_proto/entityresolution/v2/entity_resolution_pb2_connect.py +149 -0
  74. otdf_python_proto/kas/__init__.py +9 -0
  75. otdf_python_proto/kas/kas_pb2.py +103 -0
  76. otdf_python_proto/kas/kas_pb2.pyi +170 -0
  77. otdf_python_proto/kas/kas_pb2_connect.py +192 -0
  78. otdf_python_proto/legacy_grpc/__init__.py +1 -0
  79. otdf_python_proto/legacy_grpc/authorization/authorization_pb2_grpc.py +163 -0
  80. otdf_python_proto/legacy_grpc/authorization/v2/authorization_pb2_grpc.py +206 -0
  81. otdf_python_proto/legacy_grpc/common/common_pb2_grpc.py +4 -0
  82. otdf_python_proto/legacy_grpc/entity/entity_pb2_grpc.py +4 -0
  83. otdf_python_proto/legacy_grpc/entityresolution/entity_resolution_pb2_grpc.py +122 -0
  84. otdf_python_proto/legacy_grpc/entityresolution/v2/entity_resolution_pb2_grpc.py +120 -0
  85. otdf_python_proto/legacy_grpc/kas/kas_pb2_grpc.py +172 -0
  86. otdf_python_proto/legacy_grpc/logger/audit/test_pb2_grpc.py +4 -0
  87. otdf_python_proto/legacy_grpc/policy/actions/actions_pb2_grpc.py +249 -0
  88. otdf_python_proto/legacy_grpc/policy/attributes/attributes_pb2_grpc.py +873 -0
  89. otdf_python_proto/legacy_grpc/policy/kasregistry/key_access_server_registry_pb2_grpc.py +602 -0
  90. otdf_python_proto/legacy_grpc/policy/keymanagement/key_management_pb2_grpc.py +251 -0
  91. otdf_python_proto/legacy_grpc/policy/namespaces/namespaces_pb2_grpc.py +427 -0
  92. otdf_python_proto/legacy_grpc/policy/objects_pb2_grpc.py +4 -0
  93. otdf_python_proto/legacy_grpc/policy/registeredresources/registered_resources_pb2_grpc.py +524 -0
  94. otdf_python_proto/legacy_grpc/policy/resourcemapping/resource_mapping_pb2_grpc.py +516 -0
  95. otdf_python_proto/legacy_grpc/policy/selectors_pb2_grpc.py +4 -0
  96. otdf_python_proto/legacy_grpc/policy/subjectmapping/subject_mapping_pb2_grpc.py +551 -0
  97. otdf_python_proto/legacy_grpc/policy/unsafe/unsafe_pb2_grpc.py +485 -0
  98. otdf_python_proto/legacy_grpc/wellknownconfiguration/wellknown_configuration_pb2_grpc.py +77 -0
  99. otdf_python_proto/logger/__init__.py +1 -0
  100. otdf_python_proto/logger/audit/test_pb2.py +43 -0
  101. otdf_python_proto/logger/audit/test_pb2.pyi +45 -0
  102. otdf_python_proto/policy/__init__.py +1 -0
  103. otdf_python_proto/policy/actions/actions_pb2.py +75 -0
  104. otdf_python_proto/policy/actions/actions_pb2.pyi +87 -0
  105. otdf_python_proto/policy/actions/actions_pb2_connect.py +275 -0
  106. otdf_python_proto/policy/attributes/attributes_pb2.py +234 -0
  107. otdf_python_proto/policy/attributes/attributes_pb2.pyi +328 -0
  108. otdf_python_proto/policy/attributes/attributes_pb2_connect.py +863 -0
  109. otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2.py +266 -0
  110. otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2.pyi +450 -0
  111. otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2_connect.py +611 -0
  112. otdf_python_proto/policy/keymanagement/key_management_pb2.py +79 -0
  113. otdf_python_proto/policy/keymanagement/key_management_pb2.pyi +87 -0
  114. otdf_python_proto/policy/keymanagement/key_management_pb2_connect.py +275 -0
  115. otdf_python_proto/policy/namespaces/namespaces_pb2.py +117 -0
  116. otdf_python_proto/policy/namespaces/namespaces_pb2.pyi +147 -0
  117. otdf_python_proto/policy/namespaces/namespaces_pb2_connect.py +443 -0
  118. otdf_python_proto/policy/objects_pb2.py +150 -0
  119. otdf_python_proto/policy/objects_pb2.pyi +464 -0
  120. otdf_python_proto/policy/registeredresources/registered_resources_pb2.py +139 -0
  121. otdf_python_proto/policy/registeredresources/registered_resources_pb2.pyi +196 -0
  122. otdf_python_proto/policy/registeredresources/registered_resources_pb2_connect.py +527 -0
  123. otdf_python_proto/policy/resourcemapping/resource_mapping_pb2.py +139 -0
  124. otdf_python_proto/policy/resourcemapping/resource_mapping_pb2.pyi +194 -0
  125. otdf_python_proto/policy/resourcemapping/resource_mapping_pb2_connect.py +527 -0
  126. otdf_python_proto/policy/selectors_pb2.py +57 -0
  127. otdf_python_proto/policy/selectors_pb2.pyi +90 -0
  128. otdf_python_proto/policy/subjectmapping/subject_mapping_pb2.py +127 -0
  129. otdf_python_proto/policy/subjectmapping/subject_mapping_pb2.pyi +189 -0
  130. otdf_python_proto/policy/subjectmapping/subject_mapping_pb2_connect.py +569 -0
  131. otdf_python_proto/policy/unsafe/unsafe_pb2.py +113 -0
  132. otdf_python_proto/policy/unsafe/unsafe_pb2.pyi +145 -0
  133. otdf_python_proto/policy/unsafe/unsafe_pb2_connect.py +485 -0
  134. otdf_python_proto/wellknownconfiguration/__init__.py +1 -0
  135. otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2.py +51 -0
  136. otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2.pyi +32 -0
  137. otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2_connect.py +107 -0
  138. otdf_python/_gotdf_python.cpython-312-darwin.so +0 -0
  139. otdf_python/build.py +0 -190
  140. otdf_python/go.py +0 -1478
  141. otdf_python/gotdf_python.py +0 -383
  142. otdf_python-0.1.10.dist-info/METADATA +0 -149
  143. otdf_python-0.1.10.dist-info/RECORD +0 -10
  144. otdf_python-0.1.10.dist-info/top_level.txt +0 -1
@@ -0,0 +1,170 @@
1
+ from google.api import annotations_pb2 as _annotations_pb2
2
+ from google.protobuf import struct_pb2 as _struct_pb2
3
+ from google.protobuf import wrappers_pb2 as _wrappers_pb2
4
+ from protoc_gen_openapiv2.options import annotations_pb2 as _annotations_pb2_1
5
+ from google.protobuf.internal import containers as _containers
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import message as _message
8
+ from collections.abc import Iterable as _Iterable, Mapping as _Mapping
9
+ from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
10
+
11
+ DESCRIPTOR: _descriptor.FileDescriptor
12
+
13
+ class InfoRequest(_message.Message):
14
+ __slots__ = ()
15
+ def __init__(self) -> None: ...
16
+
17
+ class InfoResponse(_message.Message):
18
+ __slots__ = ("version",)
19
+ VERSION_FIELD_NUMBER: _ClassVar[int]
20
+ version: str
21
+ def __init__(self, version: _Optional[str] = ...) -> None: ...
22
+
23
+ class LegacyPublicKeyRequest(_message.Message):
24
+ __slots__ = ("algorithm",)
25
+ ALGORITHM_FIELD_NUMBER: _ClassVar[int]
26
+ algorithm: str
27
+ def __init__(self, algorithm: _Optional[str] = ...) -> None: ...
28
+
29
+ class PolicyBinding(_message.Message):
30
+ __slots__ = ("algorithm", "hash")
31
+ ALGORITHM_FIELD_NUMBER: _ClassVar[int]
32
+ HASH_FIELD_NUMBER: _ClassVar[int]
33
+ algorithm: str
34
+ hash: str
35
+ def __init__(self, algorithm: _Optional[str] = ..., hash: _Optional[str] = ...) -> None: ...
36
+
37
+ class KeyAccess(_message.Message):
38
+ __slots__ = ("encrypted_metadata", "policy_binding", "protocol", "key_type", "kas_url", "kid", "split_id", "wrapped_key", "header", "ephemeral_public_key")
39
+ ENCRYPTED_METADATA_FIELD_NUMBER: _ClassVar[int]
40
+ POLICY_BINDING_FIELD_NUMBER: _ClassVar[int]
41
+ PROTOCOL_FIELD_NUMBER: _ClassVar[int]
42
+ KEY_TYPE_FIELD_NUMBER: _ClassVar[int]
43
+ KAS_URL_FIELD_NUMBER: _ClassVar[int]
44
+ KID_FIELD_NUMBER: _ClassVar[int]
45
+ SPLIT_ID_FIELD_NUMBER: _ClassVar[int]
46
+ WRAPPED_KEY_FIELD_NUMBER: _ClassVar[int]
47
+ HEADER_FIELD_NUMBER: _ClassVar[int]
48
+ EPHEMERAL_PUBLIC_KEY_FIELD_NUMBER: _ClassVar[int]
49
+ encrypted_metadata: str
50
+ policy_binding: PolicyBinding
51
+ protocol: str
52
+ key_type: str
53
+ kas_url: str
54
+ kid: str
55
+ split_id: str
56
+ wrapped_key: bytes
57
+ header: bytes
58
+ ephemeral_public_key: str
59
+ def __init__(self, encrypted_metadata: _Optional[str] = ..., policy_binding: _Optional[_Union[PolicyBinding, _Mapping]] = ..., protocol: _Optional[str] = ..., key_type: _Optional[str] = ..., kas_url: _Optional[str] = ..., kid: _Optional[str] = ..., split_id: _Optional[str] = ..., wrapped_key: _Optional[bytes] = ..., header: _Optional[bytes] = ..., ephemeral_public_key: _Optional[str] = ...) -> None: ...
60
+
61
+ class UnsignedRewrapRequest(_message.Message):
62
+ __slots__ = ("client_public_key", "requests", "key_access", "policy", "algorithm")
63
+ class WithPolicy(_message.Message):
64
+ __slots__ = ("id", "body")
65
+ ID_FIELD_NUMBER: _ClassVar[int]
66
+ BODY_FIELD_NUMBER: _ClassVar[int]
67
+ id: str
68
+ body: str
69
+ def __init__(self, id: _Optional[str] = ..., body: _Optional[str] = ...) -> None: ...
70
+ class WithKeyAccessObject(_message.Message):
71
+ __slots__ = ("key_access_object_id", "key_access_object")
72
+ KEY_ACCESS_OBJECT_ID_FIELD_NUMBER: _ClassVar[int]
73
+ KEY_ACCESS_OBJECT_FIELD_NUMBER: _ClassVar[int]
74
+ key_access_object_id: str
75
+ key_access_object: KeyAccess
76
+ def __init__(self, key_access_object_id: _Optional[str] = ..., key_access_object: _Optional[_Union[KeyAccess, _Mapping]] = ...) -> None: ...
77
+ class WithPolicyRequest(_message.Message):
78
+ __slots__ = ("key_access_objects", "policy", "algorithm")
79
+ KEY_ACCESS_OBJECTS_FIELD_NUMBER: _ClassVar[int]
80
+ POLICY_FIELD_NUMBER: _ClassVar[int]
81
+ ALGORITHM_FIELD_NUMBER: _ClassVar[int]
82
+ key_access_objects: _containers.RepeatedCompositeFieldContainer[UnsignedRewrapRequest.WithKeyAccessObject]
83
+ policy: UnsignedRewrapRequest.WithPolicy
84
+ algorithm: str
85
+ def __init__(self, key_access_objects: _Optional[_Iterable[_Union[UnsignedRewrapRequest.WithKeyAccessObject, _Mapping]]] = ..., policy: _Optional[_Union[UnsignedRewrapRequest.WithPolicy, _Mapping]] = ..., algorithm: _Optional[str] = ...) -> None: ...
86
+ CLIENT_PUBLIC_KEY_FIELD_NUMBER: _ClassVar[int]
87
+ REQUESTS_FIELD_NUMBER: _ClassVar[int]
88
+ KEY_ACCESS_FIELD_NUMBER: _ClassVar[int]
89
+ POLICY_FIELD_NUMBER: _ClassVar[int]
90
+ ALGORITHM_FIELD_NUMBER: _ClassVar[int]
91
+ client_public_key: str
92
+ requests: _containers.RepeatedCompositeFieldContainer[UnsignedRewrapRequest.WithPolicyRequest]
93
+ key_access: KeyAccess
94
+ policy: str
95
+ algorithm: str
96
+ def __init__(self, client_public_key: _Optional[str] = ..., requests: _Optional[_Iterable[_Union[UnsignedRewrapRequest.WithPolicyRequest, _Mapping]]] = ..., key_access: _Optional[_Union[KeyAccess, _Mapping]] = ..., policy: _Optional[str] = ..., algorithm: _Optional[str] = ...) -> None: ...
97
+
98
+ class PublicKeyRequest(_message.Message):
99
+ __slots__ = ("algorithm", "fmt", "v")
100
+ ALGORITHM_FIELD_NUMBER: _ClassVar[int]
101
+ FMT_FIELD_NUMBER: _ClassVar[int]
102
+ V_FIELD_NUMBER: _ClassVar[int]
103
+ algorithm: str
104
+ fmt: str
105
+ v: str
106
+ def __init__(self, algorithm: _Optional[str] = ..., fmt: _Optional[str] = ..., v: _Optional[str] = ...) -> None: ...
107
+
108
+ class PublicKeyResponse(_message.Message):
109
+ __slots__ = ("public_key", "kid")
110
+ PUBLIC_KEY_FIELD_NUMBER: _ClassVar[int]
111
+ KID_FIELD_NUMBER: _ClassVar[int]
112
+ public_key: str
113
+ kid: str
114
+ def __init__(self, public_key: _Optional[str] = ..., kid: _Optional[str] = ...) -> None: ...
115
+
116
+ class RewrapRequest(_message.Message):
117
+ __slots__ = ("signed_request_token",)
118
+ SIGNED_REQUEST_TOKEN_FIELD_NUMBER: _ClassVar[int]
119
+ signed_request_token: str
120
+ def __init__(self, signed_request_token: _Optional[str] = ...) -> None: ...
121
+
122
+ class KeyAccessRewrapResult(_message.Message):
123
+ __slots__ = ("metadata", "key_access_object_id", "status", "kas_wrapped_key", "error")
124
+ class MetadataEntry(_message.Message):
125
+ __slots__ = ("key", "value")
126
+ KEY_FIELD_NUMBER: _ClassVar[int]
127
+ VALUE_FIELD_NUMBER: _ClassVar[int]
128
+ key: str
129
+ value: _struct_pb2.Value
130
+ def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[_struct_pb2.Value, _Mapping]] = ...) -> None: ...
131
+ METADATA_FIELD_NUMBER: _ClassVar[int]
132
+ KEY_ACCESS_OBJECT_ID_FIELD_NUMBER: _ClassVar[int]
133
+ STATUS_FIELD_NUMBER: _ClassVar[int]
134
+ KAS_WRAPPED_KEY_FIELD_NUMBER: _ClassVar[int]
135
+ ERROR_FIELD_NUMBER: _ClassVar[int]
136
+ metadata: _containers.MessageMap[str, _struct_pb2.Value]
137
+ key_access_object_id: str
138
+ status: str
139
+ kas_wrapped_key: bytes
140
+ error: str
141
+ def __init__(self, metadata: _Optional[_Mapping[str, _struct_pb2.Value]] = ..., key_access_object_id: _Optional[str] = ..., status: _Optional[str] = ..., kas_wrapped_key: _Optional[bytes] = ..., error: _Optional[str] = ...) -> None: ...
142
+
143
+ class PolicyRewrapResult(_message.Message):
144
+ __slots__ = ("policy_id", "results")
145
+ POLICY_ID_FIELD_NUMBER: _ClassVar[int]
146
+ RESULTS_FIELD_NUMBER: _ClassVar[int]
147
+ policy_id: str
148
+ results: _containers.RepeatedCompositeFieldContainer[KeyAccessRewrapResult]
149
+ def __init__(self, policy_id: _Optional[str] = ..., results: _Optional[_Iterable[_Union[KeyAccessRewrapResult, _Mapping]]] = ...) -> None: ...
150
+
151
+ class RewrapResponse(_message.Message):
152
+ __slots__ = ("metadata", "entity_wrapped_key", "session_public_key", "schema_version", "responses")
153
+ class MetadataEntry(_message.Message):
154
+ __slots__ = ("key", "value")
155
+ KEY_FIELD_NUMBER: _ClassVar[int]
156
+ VALUE_FIELD_NUMBER: _ClassVar[int]
157
+ key: str
158
+ value: _struct_pb2.Value
159
+ def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[_struct_pb2.Value, _Mapping]] = ...) -> None: ...
160
+ METADATA_FIELD_NUMBER: _ClassVar[int]
161
+ ENTITY_WRAPPED_KEY_FIELD_NUMBER: _ClassVar[int]
162
+ SESSION_PUBLIC_KEY_FIELD_NUMBER: _ClassVar[int]
163
+ SCHEMA_VERSION_FIELD_NUMBER: _ClassVar[int]
164
+ RESPONSES_FIELD_NUMBER: _ClassVar[int]
165
+ metadata: _containers.MessageMap[str, _struct_pb2.Value]
166
+ entity_wrapped_key: bytes
167
+ session_public_key: str
168
+ schema_version: str
169
+ responses: _containers.RepeatedCompositeFieldContainer[PolicyRewrapResult]
170
+ def __init__(self, metadata: _Optional[_Mapping[str, _struct_pb2.Value]] = ..., entity_wrapped_key: _Optional[bytes] = ..., session_public_key: _Optional[str] = ..., schema_version: _Optional[str] = ..., responses: _Optional[_Iterable[_Union[PolicyRewrapResult, _Mapping]]] = ...) -> None: ...
@@ -0,0 +1,192 @@
1
+ # Generated Connect client code
2
+
3
+ from __future__ import annotations
4
+ from collections.abc import AsyncIterator
5
+ from collections.abc import Iterator
6
+ from collections.abc import Iterable
7
+ import aiohttp
8
+ import urllib3
9
+ import typing
10
+ import sys
11
+
12
+ from connectrpc.client_async import AsyncConnectClient
13
+ from connectrpc.client_sync import ConnectClient
14
+ from connectrpc.client_protocol import ConnectProtocol
15
+ from connectrpc.client_connect import ConnectProtocolError
16
+ from connectrpc.headers import HeaderInput
17
+ from connectrpc.server import ClientRequest
18
+ from connectrpc.server import ClientStream
19
+ from connectrpc.server import ServerResponse
20
+ from connectrpc.server import ServerStream
21
+ from connectrpc.server_sync import ConnectWSGI
22
+ from connectrpc.streams import StreamInput
23
+ from connectrpc.streams import AsyncStreamOutput
24
+ from connectrpc.streams import StreamOutput
25
+ from connectrpc.unary import UnaryOutput
26
+ from connectrpc.unary import ClientStreamingOutput
27
+
28
+ if typing.TYPE_CHECKING:
29
+ # wsgiref.types was added in Python 3.11.
30
+ if sys.version_info >= (3, 11):
31
+ from wsgiref.types import WSGIApplication
32
+ else:
33
+ from _typeshed.wsgi import WSGIApplication
34
+
35
+ import google.protobuf.wrappers_pb2
36
+ from . import kas_pb2
37
+
38
+ class AccessServiceClient:
39
+ def __init__(
40
+ self,
41
+ base_url: str,
42
+ http_client: urllib3.PoolManager | None = None,
43
+ protocol: ConnectProtocol = ConnectProtocol.CONNECT_PROTOBUF,
44
+ ):
45
+ self.base_url = base_url
46
+ self._connect_client = ConnectClient(http_client, protocol)
47
+ def call_public_key(
48
+ self, req: kas_pb2.PublicKeyRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
49
+ ) -> UnaryOutput[kas_pb2.PublicKeyResponse]:
50
+ """Low-level method to call PublicKey, granting access to errors and metadata"""
51
+ url = self.base_url + "/kas.AccessService/PublicKey"
52
+ return self._connect_client.call_unary(url, req, kas_pb2.PublicKeyResponse,extra_headers, timeout_seconds)
53
+
54
+
55
+ def public_key(
56
+ self, req: kas_pb2.PublicKeyRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
57
+ ) -> kas_pb2.PublicKeyResponse:
58
+ response = self.call_public_key(req, extra_headers, timeout_seconds)
59
+ err = response.error()
60
+ if err is not None:
61
+ raise err
62
+ msg = response.message()
63
+ if msg is None:
64
+ raise ConnectProtocolError('missing response message')
65
+ return msg
66
+
67
+ def call_legacy_public_key(
68
+ self, req: kas_pb2.LegacyPublicKeyRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
69
+ ) -> UnaryOutput[google.protobuf.wrappers_pb2.StringValue]:
70
+ """Low-level method to call LegacyPublicKey, granting access to errors and metadata"""
71
+ url = self.base_url + "/kas.AccessService/LegacyPublicKey"
72
+ return self._connect_client.call_unary(url, req, google.protobuf.wrappers_pb2.StringValue,extra_headers, timeout_seconds)
73
+
74
+
75
+ def legacy_public_key(
76
+ self, req: kas_pb2.LegacyPublicKeyRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
77
+ ) -> google.protobuf.wrappers_pb2.StringValue:
78
+ response = self.call_legacy_public_key(req, extra_headers, timeout_seconds)
79
+ err = response.error()
80
+ if err is not None:
81
+ raise err
82
+ msg = response.message()
83
+ if msg is None:
84
+ raise ConnectProtocolError('missing response message')
85
+ return msg
86
+
87
+ def call_rewrap(
88
+ self, req: kas_pb2.RewrapRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
89
+ ) -> UnaryOutput[kas_pb2.RewrapResponse]:
90
+ """Low-level method to call Rewrap, granting access to errors and metadata"""
91
+ url = self.base_url + "/kas.AccessService/Rewrap"
92
+ return self._connect_client.call_unary(url, req, kas_pb2.RewrapResponse,extra_headers, timeout_seconds)
93
+
94
+
95
+ def rewrap(
96
+ self, req: kas_pb2.RewrapRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
97
+ ) -> kas_pb2.RewrapResponse:
98
+ response = self.call_rewrap(req, extra_headers, timeout_seconds)
99
+ err = response.error()
100
+ if err is not None:
101
+ raise err
102
+ msg = response.message()
103
+ if msg is None:
104
+ raise ConnectProtocolError('missing response message')
105
+ return msg
106
+
107
+
108
+ class AsyncAccessServiceClient:
109
+ def __init__(
110
+ self,
111
+ base_url: str,
112
+ http_client: aiohttp.ClientSession,
113
+ protocol: ConnectProtocol = ConnectProtocol.CONNECT_PROTOBUF,
114
+ ):
115
+ self.base_url = base_url
116
+ self._connect_client = AsyncConnectClient(http_client, protocol)
117
+
118
+ async def call_public_key(
119
+ self, req: kas_pb2.PublicKeyRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
120
+ ) -> UnaryOutput[kas_pb2.PublicKeyResponse]:
121
+ """Low-level method to call PublicKey, granting access to errors and metadata"""
122
+ url = self.base_url + "/kas.AccessService/PublicKey"
123
+ return await self._connect_client.call_unary(url, req, kas_pb2.PublicKeyResponse,extra_headers, timeout_seconds)
124
+
125
+ async def public_key(
126
+ self, req: kas_pb2.PublicKeyRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
127
+ ) -> kas_pb2.PublicKeyResponse:
128
+ response = await self.call_public_key(req, extra_headers, timeout_seconds)
129
+ err = response.error()
130
+ if err is not None:
131
+ raise err
132
+ msg = response.message()
133
+ if msg is None:
134
+ raise ConnectProtocolError('missing response message')
135
+ return msg
136
+
137
+ async def call_legacy_public_key(
138
+ self, req: kas_pb2.LegacyPublicKeyRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
139
+ ) -> UnaryOutput[google.protobuf.wrappers_pb2.StringValue]:
140
+ """Low-level method to call LegacyPublicKey, granting access to errors and metadata"""
141
+ url = self.base_url + "/kas.AccessService/LegacyPublicKey"
142
+ return await self._connect_client.call_unary(url, req, google.protobuf.wrappers_pb2.StringValue,extra_headers, timeout_seconds)
143
+
144
+ async def legacy_public_key(
145
+ self, req: kas_pb2.LegacyPublicKeyRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
146
+ ) -> google.protobuf.wrappers_pb2.StringValue:
147
+ response = await self.call_legacy_public_key(req, extra_headers, timeout_seconds)
148
+ err = response.error()
149
+ if err is not None:
150
+ raise err
151
+ msg = response.message()
152
+ if msg is None:
153
+ raise ConnectProtocolError('missing response message')
154
+ return msg
155
+
156
+ async def call_rewrap(
157
+ self, req: kas_pb2.RewrapRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
158
+ ) -> UnaryOutput[kas_pb2.RewrapResponse]:
159
+ """Low-level method to call Rewrap, granting access to errors and metadata"""
160
+ url = self.base_url + "/kas.AccessService/Rewrap"
161
+ return await self._connect_client.call_unary(url, req, kas_pb2.RewrapResponse,extra_headers, timeout_seconds)
162
+
163
+ async def rewrap(
164
+ self, req: kas_pb2.RewrapRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
165
+ ) -> kas_pb2.RewrapResponse:
166
+ response = await self.call_rewrap(req, extra_headers, timeout_seconds)
167
+ err = response.error()
168
+ if err is not None:
169
+ raise err
170
+ msg = response.message()
171
+ if msg is None:
172
+ raise ConnectProtocolError('missing response message')
173
+ return msg
174
+
175
+
176
+ @typing.runtime_checkable
177
+ class AccessServiceProtocol(typing.Protocol):
178
+ def public_key(self, req: ClientRequest[kas_pb2.PublicKeyRequest]) -> ServerResponse[kas_pb2.PublicKeyResponse]:
179
+ ...
180
+ def legacy_public_key(self, req: ClientRequest[kas_pb2.LegacyPublicKeyRequest]) -> ServerResponse[google.protobuf.wrappers_pb2.StringValue]:
181
+ ...
182
+ def rewrap(self, req: ClientRequest[kas_pb2.RewrapRequest]) -> ServerResponse[kas_pb2.RewrapResponse]:
183
+ ...
184
+
185
+ ACCESS_SERVICE_PATH_PREFIX = "/kas.AccessService"
186
+
187
+ def wsgi_access_service(implementation: AccessServiceProtocol) -> WSGIApplication:
188
+ app = ConnectWSGI()
189
+ app.register_unary_rpc("/kas.AccessService/PublicKey", implementation.public_key, kas_pb2.PublicKeyRequest)
190
+ app.register_unary_rpc("/kas.AccessService/LegacyPublicKey", implementation.legacy_public_key, kas_pb2.LegacyPublicKeyRequest)
191
+ app.register_unary_rpc("/kas.AccessService/Rewrap", implementation.rewrap, kas_pb2.RewrapRequest)
192
+ return app
@@ -0,0 +1 @@
1
+ """legacy_grpc protobuf definitions."""
@@ -0,0 +1,163 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+
5
+ from authorization import authorization_pb2 as authorization_dot_authorization__pb2
6
+
7
+
8
+ class AuthorizationServiceStub(object):
9
+ """Missing associated documentation comment in .proto file."""
10
+
11
+ def __init__(self, channel):
12
+ """Constructor.
13
+
14
+ Args:
15
+ channel: A grpc.Channel.
16
+ """
17
+ self.GetDecisions = channel.unary_unary(
18
+ '/authorization.AuthorizationService/GetDecisions',
19
+ request_serializer=authorization_dot_authorization__pb2.GetDecisionsRequest.SerializeToString,
20
+ response_deserializer=authorization_dot_authorization__pb2.GetDecisionsResponse.FromString,
21
+ _registered_method=True)
22
+ self.GetDecisionsByToken = channel.unary_unary(
23
+ '/authorization.AuthorizationService/GetDecisionsByToken',
24
+ request_serializer=authorization_dot_authorization__pb2.GetDecisionsByTokenRequest.SerializeToString,
25
+ response_deserializer=authorization_dot_authorization__pb2.GetDecisionsByTokenResponse.FromString,
26
+ _registered_method=True)
27
+ self.GetEntitlements = channel.unary_unary(
28
+ '/authorization.AuthorizationService/GetEntitlements',
29
+ request_serializer=authorization_dot_authorization__pb2.GetEntitlementsRequest.SerializeToString,
30
+ response_deserializer=authorization_dot_authorization__pb2.GetEntitlementsResponse.FromString,
31
+ _registered_method=True)
32
+
33
+
34
+ class AuthorizationServiceServicer(object):
35
+ """Missing associated documentation comment in .proto file."""
36
+
37
+ def GetDecisions(self, request, context):
38
+ """Missing associated documentation comment in .proto file."""
39
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
40
+ context.set_details('Method not implemented!')
41
+ raise NotImplementedError('Method not implemented!')
42
+
43
+ def GetDecisionsByToken(self, request, context):
44
+ """Missing associated documentation comment in .proto file."""
45
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
46
+ context.set_details('Method not implemented!')
47
+ raise NotImplementedError('Method not implemented!')
48
+
49
+ def GetEntitlements(self, request, context):
50
+ """Missing associated documentation comment in .proto file."""
51
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
52
+ context.set_details('Method not implemented!')
53
+ raise NotImplementedError('Method not implemented!')
54
+
55
+
56
+ def add_AuthorizationServiceServicer_to_server(servicer, server):
57
+ rpc_method_handlers = {
58
+ 'GetDecisions': grpc.unary_unary_rpc_method_handler(
59
+ servicer.GetDecisions,
60
+ request_deserializer=authorization_dot_authorization__pb2.GetDecisionsRequest.FromString,
61
+ response_serializer=authorization_dot_authorization__pb2.GetDecisionsResponse.SerializeToString,
62
+ ),
63
+ 'GetDecisionsByToken': grpc.unary_unary_rpc_method_handler(
64
+ servicer.GetDecisionsByToken,
65
+ request_deserializer=authorization_dot_authorization__pb2.GetDecisionsByTokenRequest.FromString,
66
+ response_serializer=authorization_dot_authorization__pb2.GetDecisionsByTokenResponse.SerializeToString,
67
+ ),
68
+ 'GetEntitlements': grpc.unary_unary_rpc_method_handler(
69
+ servicer.GetEntitlements,
70
+ request_deserializer=authorization_dot_authorization__pb2.GetEntitlementsRequest.FromString,
71
+ response_serializer=authorization_dot_authorization__pb2.GetEntitlementsResponse.SerializeToString,
72
+ ),
73
+ }
74
+ generic_handler = grpc.method_handlers_generic_handler(
75
+ 'authorization.AuthorizationService', rpc_method_handlers)
76
+ server.add_generic_rpc_handlers((generic_handler,))
77
+ server.add_registered_method_handlers('authorization.AuthorizationService', rpc_method_handlers)
78
+
79
+
80
+ # This class is part of an EXPERIMENTAL API.
81
+ class AuthorizationService(object):
82
+ """Missing associated documentation comment in .proto file."""
83
+
84
+ @staticmethod
85
+ def GetDecisions(request,
86
+ target,
87
+ options=(),
88
+ channel_credentials=None,
89
+ call_credentials=None,
90
+ insecure=False,
91
+ compression=None,
92
+ wait_for_ready=None,
93
+ timeout=None,
94
+ metadata=None):
95
+ return grpc.experimental.unary_unary(
96
+ request,
97
+ target,
98
+ '/authorization.AuthorizationService/GetDecisions',
99
+ authorization_dot_authorization__pb2.GetDecisionsRequest.SerializeToString,
100
+ authorization_dot_authorization__pb2.GetDecisionsResponse.FromString,
101
+ options,
102
+ channel_credentials,
103
+ insecure,
104
+ call_credentials,
105
+ compression,
106
+ wait_for_ready,
107
+ timeout,
108
+ metadata,
109
+ _registered_method=True)
110
+
111
+ @staticmethod
112
+ def GetDecisionsByToken(request,
113
+ target,
114
+ options=(),
115
+ channel_credentials=None,
116
+ call_credentials=None,
117
+ insecure=False,
118
+ compression=None,
119
+ wait_for_ready=None,
120
+ timeout=None,
121
+ metadata=None):
122
+ return grpc.experimental.unary_unary(
123
+ request,
124
+ target,
125
+ '/authorization.AuthorizationService/GetDecisionsByToken',
126
+ authorization_dot_authorization__pb2.GetDecisionsByTokenRequest.SerializeToString,
127
+ authorization_dot_authorization__pb2.GetDecisionsByTokenResponse.FromString,
128
+ options,
129
+ channel_credentials,
130
+ insecure,
131
+ call_credentials,
132
+ compression,
133
+ wait_for_ready,
134
+ timeout,
135
+ metadata,
136
+ _registered_method=True)
137
+
138
+ @staticmethod
139
+ def GetEntitlements(request,
140
+ target,
141
+ options=(),
142
+ channel_credentials=None,
143
+ call_credentials=None,
144
+ insecure=False,
145
+ compression=None,
146
+ wait_for_ready=None,
147
+ timeout=None,
148
+ metadata=None):
149
+ return grpc.experimental.unary_unary(
150
+ request,
151
+ target,
152
+ '/authorization.AuthorizationService/GetEntitlements',
153
+ authorization_dot_authorization__pb2.GetEntitlementsRequest.SerializeToString,
154
+ authorization_dot_authorization__pb2.GetEntitlementsResponse.FromString,
155
+ options,
156
+ channel_credentials,
157
+ insecure,
158
+ call_credentials,
159
+ compression,
160
+ wait_for_ready,
161
+ timeout,
162
+ metadata,
163
+ _registered_method=True)