koi-net 1.1.0b6__py3-none-any.whl → 1.1.0b7__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.

Potentially problematic release.


This version of koi-net might be problematic. Click here for more details.

@@ -119,7 +119,7 @@ class RequestHandler:
119
119
  )
120
120
 
121
121
  try:
122
- result = httpx.post(url, data=signed_envelope.model_dump_json())
122
+ result = httpx.post(url, data=signed_envelope.model_dump_json(exclude_none=True))
123
123
  except httpx.ConnectError as err:
124
124
  logger.debug("Failed to connect")
125
125
  self.error_handler.handle_connection_error(node)
koi_net/protocol/edge.py CHANGED
@@ -2,6 +2,7 @@ from enum import StrEnum
2
2
  from pydantic import BaseModel
3
3
  from rid_lib import RIDType
4
4
  from rid_lib.ext.bundle import Bundle
5
+ from rid_lib.ext.utils import sha256_hash
5
6
  from rid_lib.types import KoiNetEdge, KoiNetNode
6
7
 
7
8
 
@@ -27,7 +28,9 @@ def generate_edge_bundle(
27
28
  rid_types: list[RIDType],
28
29
  edge_type: EdgeType
29
30
  ) -> Bundle:
30
- edge_rid = KoiNetEdge.generate(source, target)
31
+ edge_rid = KoiNetEdge(sha256_hash(
32
+ str(source) + str(target)
33
+ ))
31
34
  edge_profile = EdgeProfile(
32
35
  source=source,
33
36
  target=target,
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
  from typing import Generic, TypeVar
3
- from pydantic import BaseModel
3
+ from pydantic import BaseModel, ConfigDict
4
4
  from rid_lib.types import KoiNetNode
5
5
 
6
6
  from .secure import PrivateKey, PublicKey
@@ -13,6 +13,8 @@ logger = logging.getLogger(__name__)
13
13
  T = TypeVar("T", bound=RequestModels | ResponseModels)
14
14
 
15
15
  class SignedEnvelope(BaseModel, Generic[T]):
16
+ model_config = ConfigDict(exclude_none=True)
17
+
16
18
  payload: T
17
19
  source_node: KoiNetNode
18
20
  target_node: KoiNetNode
@@ -26,24 +28,26 @@ class SignedEnvelope(BaseModel, Generic[T]):
26
28
  target_node=self.target_node
27
29
  )
28
30
 
29
- logger.debug(f"Verifying envelope: {unsigned_envelope.model_dump_json()}")
31
+ logger.debug(f"Verifying envelope: {unsigned_envelope.model_dump_json(exclude_none=True)}")
30
32
 
31
33
  pub_key.verify(
32
34
  self.signature,
33
- unsigned_envelope.model_dump_json().encode()
35
+ unsigned_envelope.model_dump_json(exclude_none=True).encode()
34
36
  )
35
37
 
36
38
  class UnsignedEnvelope(BaseModel, Generic[T]):
39
+ model_config = ConfigDict(exclude_none=True)
40
+
37
41
  payload: T
38
42
  source_node: KoiNetNode
39
43
  target_node: KoiNetNode
40
44
 
41
45
  def sign_with(self, priv_key: PrivateKey) -> SignedEnvelope[T]:
42
- logger.debug(f"Signing envelope: {self.model_dump_json()}")
46
+ logger.debug(f"Signing envelope: {self.model_dump_json(exclude_none=True)}")
43
47
  logger.debug(f"Type: [{type(self.payload)}]")
44
48
 
45
49
  signature = priv_key.sign(
46
- self.model_dump_json().encode()
50
+ self.model_dump_json(exclude_none=True).encode()
47
51
  )
48
52
 
49
53
  return SignedEnvelope(
koi_net/protocol/event.py CHANGED
@@ -15,9 +15,6 @@ class Event(BaseModel):
15
15
  manifest: Manifest | None = None
16
16
  contents: dict | None = None
17
17
 
18
- class Config:
19
- exclude_none = True
20
-
21
18
  def __repr__(self):
22
19
  return f"<Event '{self.rid}' event type: '{self.event_type}'>"
23
20
 
koi_net/server.py CHANGED
@@ -73,7 +73,8 @@ class NodeServer:
73
73
  self.router.add_api_route(
74
74
  path=path,
75
75
  endpoint=self.secure.envelope_handler(func),
76
- methods=["POST"]
76
+ methods=["POST"],
77
+ response_model_exclude_none=True
77
78
  )
78
79
 
79
80
  _add_endpoint(BROADCAST_EVENTS_PATH, self.broadcast_events)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: koi-net
3
- Version: 1.1.0b6
3
+ Version: 1.1.0b7
4
4
  Summary: Implementation of KOI-net protocol in Python
5
5
  Project-URL: Homepage, https://github.com/BlockScience/koi-net/
6
6
  Author-email: Luke Miller <luke@block.science>
@@ -8,13 +8,13 @@ koi_net/identity.py,sha256=FvIWksGTqwM7HCevIwmo_6l-t-2tnYkaaR4CanZatL4,569
8
8
  koi_net/lifecycle.py,sha256=GL2zltmh-aeBuNVg_rbIgsXMch672w7xkWAXCTjxst4,3550
9
9
  koi_net/poller.py,sha256=bIrlqdac5vLQYAid35xiQJLDMR85GnOSPCXSTQ07-Mc,1173
10
10
  koi_net/secure.py,sha256=cGNF2assqCaYq0i0fhQBm7aREoAdpY-XVypDsE1ALaU,3970
11
- koi_net/server.py,sha256=dZfSKrNHqIVD1qc9WkYRO30L4so-A7iW4IsX63oSmlE,4265
11
+ koi_net/server.py,sha256=PrR_cXQV5YMKa6FXwiJXwMZJ52VQVzLPYYPVl-Miuw8,4315
12
12
  koi_net/network/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  koi_net/network/behavior.py,sha256=NZLvWlrxR0uWriE3ZzCXmocUVccQthy7Xx8E_8KBwsg,1208
14
14
  koi_net/network/error_handler.py,sha256=_dAl2ovpUZEVhPc8_dcLA7I-FoMNqQNwFy0QLa4uTSY,1617
15
15
  koi_net/network/event_queue.py,sha256=DWs26C235iYkP4koKcdbhmIOHGZRJ48d072BoNWyiHo,7325
16
16
  koi_net/network/graph.py,sha256=60SLiR3aNXIOGe-URzMGgx8abmMEJtz37EJs6jeImEM,4143
17
- koi_net/network/request_handler.py,sha256=vBXw2GO5vGAYCs18flWbln4kO_HmY1G9uuFu9MYqedY,6852
17
+ koi_net/network/request_handler.py,sha256=_SM5MuYkS636wGJeFkesapQsW5x_kt_1o9KTXB0wksU,6869
18
18
  koi_net/network/resolver.py,sha256=coIp4M6k0-8sUfAy4h2NMx_7zCNroWlCHKOj3AXZVhc,5412
19
19
  koi_net/network/response_handler.py,sha256=__R_EvEpjaMz3PCDvkNgWF_EAHe2nePGk-zK_cT4C4g,2077
20
20
  koi_net/processor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -26,13 +26,13 @@ koi_net/processor/knowledge_pipeline.py,sha256=i7FpCFl0UIOwCI5zhP1i8M4PX4A48VN28
26
26
  koi_net/protocol/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  koi_net/protocol/api_models.py,sha256=jzRZWW_ZB5YsBAiwCom882-WIbr0rPyelJxExRgHZGc,1755
28
28
  koi_net/protocol/consts.py,sha256=bisbVEojPIHlLhkLafBzfIhH25TjNfvTORF1g6YXzIM,243
29
- koi_net/protocol/edge.py,sha256=dQKtI0_eX2E6tD7kMExv6DeJMkqNo2cY-LxJMJbiK0E,963
30
- koi_net/protocol/envelope.py,sha256=BkBabUZXDOiGJnfBJm5BHTQZflsiQ3jBmG1gNOtmeO4,1698
29
+ koi_net/protocol/edge.py,sha256=PzdEhC43T1KO5iMSEu7I4tiz-7sZxtz41dJfWf-oHA0,1034
30
+ koi_net/protocol/envelope.py,sha256=UVHlO2BDyDiP5eixqx9xD6xUsCfFRi0kZyzC4BC-DOw,1886
31
31
  koi_net/protocol/errors.py,sha256=uKPQ-TGLouZuK0xd2pXuCQoRTyu_JFsydSCLml13Cz8,595
32
- koi_net/protocol/event.py,sha256=eGgihEj1gliLoQRk8pVB2q_was0AGo-PbT3Hqnpn3oU,1379
32
+ koi_net/protocol/event.py,sha256=HxzLN-iCXPyr2YzrswMIkgZYeUdFbBpa5v98dAB06lQ,1328
33
33
  koi_net/protocol/node.py,sha256=7GQzHORFr9cP4BqJgir6EGSWCskL-yqmvJksIiLfcWU,409
34
34
  koi_net/protocol/secure.py,sha256=6sRLWxG5EDF0QLBj29gk3hPmZnPXATrTTFdwx39wQfY,5127
35
- koi_net-1.1.0b6.dist-info/METADATA,sha256=G2VwaYEW0oLstoINlbOJlT-f2yAhSXEOZP3shspdgqo,37118
36
- koi_net-1.1.0b6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
37
- koi_net-1.1.0b6.dist-info/licenses/LICENSE,sha256=03mgCL5qth2aD9C3F3qNVs4sFJSpK9kjtYCyOwdSp7s,1069
38
- koi_net-1.1.0b6.dist-info/RECORD,,
35
+ koi_net-1.1.0b7.dist-info/METADATA,sha256=nHdoaFbZodVbTgjEuZeMxi8as2JOWP0Fyhoj05tn7e8,37118
36
+ koi_net-1.1.0b7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
37
+ koi_net-1.1.0b7.dist-info/licenses/LICENSE,sha256=03mgCL5qth2aD9C3F3qNVs4sFJSpK9kjtYCyOwdSp7s,1069
38
+ koi_net-1.1.0b7.dist-info/RECORD,,