mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
python work and network keying work
This commit is contained in:
parent
0c3271b3b9
commit
1cacc547e0
@ -227,7 +227,7 @@ impl NetworkManager {
|
|||||||
Some(
|
Some(
|
||||||
bcs.derive_shared_secret(
|
bcs.derive_shared_secret(
|
||||||
network_key_password.as_bytes(),
|
network_key_password.as_bytes(),
|
||||||
network_key_password.as_bytes(),
|
&bcs.generate_hash(network_key_password.as_bytes()).bytes,
|
||||||
)
|
)
|
||||||
.expect("failed to derive network key"),
|
.expect("failed to derive network key"),
|
||||||
)
|
)
|
||||||
|
@ -57,7 +57,7 @@ def ipc_info() -> str:
|
|||||||
|
|
||||||
# hack to deal with rust's 'directories' crate case-inconsistency
|
# hack to deal with rust's 'directories' crate case-inconsistency
|
||||||
if sys.platform.startswith('darwin'):
|
if sys.platform.startswith('darwin'):
|
||||||
data_dir = appdirs.user_data_dir("Veilid","Veilid")
|
data_dir = appdirs.user_data_dir("org.Veilid.Veilid")
|
||||||
else:
|
else:
|
||||||
data_dir = appdirs.user_data_dir("veilid","veilid")
|
data_dir = appdirs.user_data_dir("veilid","veilid")
|
||||||
ipc_0_path = os.path.join(data_dir, "ipc", "0")
|
ipc_0_path = os.path.join(data_dir, "ipc", "0")
|
||||||
|
@ -195,6 +195,10 @@ async def test_open_writer_dht_value(api_connection: veilid.VeilidAPI):
|
|||||||
with pytest.raises(veilid.VeilidAPIError):
|
with pytest.raises(veilid.VeilidAPIError):
|
||||||
vdtemp = await rc.set_dht_value(key, 0, va)
|
vdtemp = await rc.set_dht_value(key, 0, va)
|
||||||
|
|
||||||
|
# Verify subkey 0 can be set because override with the right writer
|
||||||
|
with pytest.raises(veilid.VeilidAPIError):
|
||||||
|
vdtemp = await rc.set_dht_value(key, 0, va, veilid.KeyPair.from_parts(owner, secret))
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
await rc.close_dht_record(key)
|
await rc.close_dht_record(key)
|
||||||
await rc.delete_dht_record(key)
|
await rc.delete_dht_record(key)
|
||||||
|
@ -55,7 +55,7 @@ class RoutingContext(ABC):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def open_dht_record(
|
async def open_dht_record(
|
||||||
self, key: types.TypedKey, writer: Optional[types.KeyPair]
|
self, key: types.TypedKey, writer: Optional[types.KeyPair] = None
|
||||||
) -> types.DHTRecordDescriptor:
|
) -> types.DHTRecordDescriptor:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ class RoutingContext(ABC):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def set_dht_value(
|
async def set_dht_value(
|
||||||
self, key: types.TypedKey, subkey: types.ValueSubkey, data: bytes, writer: Optional[types.KeyPair]
|
self, key: types.TypedKey, subkey: types.ValueSubkey, data: bytes, writer: Optional[types.KeyPair] = None
|
||||||
) -> Optional[types.ValueData]:
|
) -> Optional[types.ValueData]:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ class _JsonRoutingContext(RoutingContext):
|
|||||||
)
|
)
|
||||||
|
|
||||||
async def open_dht_record(
|
async def open_dht_record(
|
||||||
self, key: TypedKey, writer: Optional[KeyPair]
|
self, key: TypedKey, writer: Optional[KeyPair] = None
|
||||||
) -> DHTRecordDescriptor:
|
) -> DHTRecordDescriptor:
|
||||||
return DHTRecordDescriptor.from_json(
|
return DHTRecordDescriptor.from_json(
|
||||||
raise_api_result(
|
raise_api_result(
|
||||||
@ -626,7 +626,7 @@ class _JsonRoutingContext(RoutingContext):
|
|||||||
return None if ret is None else ValueData.from_json(ret)
|
return None if ret is None else ValueData.from_json(ret)
|
||||||
|
|
||||||
async def set_dht_value(
|
async def set_dht_value(
|
||||||
self, key: TypedKey, subkey: ValueSubkey, data: bytes, writer: Optional[KeyPair]
|
self, key: TypedKey, subkey: ValueSubkey, data: bytes, writer: Optional[KeyPair] = None
|
||||||
) -> Optional[ValueData]:
|
) -> Optional[ValueData]:
|
||||||
ret = raise_api_result(
|
ret = raise_api_result(
|
||||||
await self.api.send_ndjson_request(
|
await self.api.send_ndjson_request(
|
||||||
|
Loading…
Reference in New Issue
Block a user