Skip to content

Commit e13d076

Browse files
committed
Add wireguard.py module. Create local import in node.py for WgKey.
1 parent 886d6c2 commit e13d076

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/sentinel_sdk/modules/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from sentinel_sdk.transactor.transactor import Transactor
2020
from sentinel_sdk.types import PageRequest, TxParams, NodeType
2121

22-
from pywgkey import WgKey
22+
from .wireguard import WgKey
2323

2424

2525
class NodeModule(Querier, Transactor):

src/sentinel_sdk/modules/wireguard.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from base64 import b64encode
2+
from nacl.public import PrivateKey
3+
4+
class WgKey():
5+
6+
def __init__(self):
7+
self._key = PrivateKey.generate()
8+
9+
@property
10+
def pubkey(self) -> str:
11+
return b64encode(bytes(self._key.public_key)).decode("ascii")
12+
13+
@property
14+
def privkey(self) -> str:
15+
return b64encode(bytes(self._key)).decode("ascii")

0 commit comments

Comments
 (0)