You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/koi_net/identity.py
+9-37Lines changed: 9 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -1,69 +1,41 @@
1
1
importlogging
2
-
frompydanticimportBaseModel
3
2
fromrid_lib.ext.bundleimportBundle
4
3
fromrid_lib.ext.cacheimportCache
5
4
fromrid_lib.types.koi_net_nodeimportKoiNetNode
5
+
6
+
from .configimportConfig
6
7
from .protocol.nodeimportNodeProfile
7
8
8
9
logger=logging.getLogger(__name__)
9
10
10
-
11
-
classNodeIdentityModel(BaseModel):
12
-
rid: KoiNetNode
13
-
profile: NodeProfile
14
11
15
12
classNodeIdentity:
16
13
"""Represents a node's identity (RID, profile, bundle)."""
17
14
18
-
_identity: NodeIdentityModel
19
-
file_path: str
15
+
config: Config
20
16
cache: Cache
21
17
22
18
def__init__(
23
-
self,
24
-
name: str,
25
-
profile: NodeProfile,
26
-
cache: Cache,
27
-
file_path: str="identity.json"
19
+
self,
20
+
config: Config,
21
+
cache: Cache
28
22
):
29
23
"""Initializes node identity from a name and profile.
30
24
31
25
Attempts to read identity from storage. If it doesn't already exist, a new RID is generated from the provided name, and that RID and profile are written to storage. Changes to the name or profile will update the stored identity.
32
26
33
27
WARNING: If the name is changed, the RID will be overwritten which will have consequences for the rest of the network.
0 commit comments