mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-08-01 03:06:06 -04:00
improve route selection and add generate_shared_secret
This commit is contained in:
parent
d49e78d931
commit
800348451e
18 changed files with 317 additions and 6 deletions
|
@ -44,3 +44,26 @@ async def test_hash_and_verify_password(api_connection: veilid.VeilidAPI):
|
|||
# Password mismatch
|
||||
phash2 = await cs.hash_password(b"abc1234", salt)
|
||||
assert not await cs.verify_password(b"abc12345", phash)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_generate_shared_secret(api_connection: veilid.VeilidAPI):
|
||||
cs = await api_connection.best_crypto_system()
|
||||
async with cs:
|
||||
kp1 = await cs.generate_key_pair()
|
||||
kp2 = await cs.generate_key_pair()
|
||||
kp3 = await cs.generate_key_pair()
|
||||
|
||||
ssA = await cs.generate_shared_secret(kp1.key(), kp2.secret(), b"abc123")
|
||||
ssB = await cs.generate_shared_secret(kp2.key(), kp1.secret(), b"abc123")
|
||||
|
||||
assert ssA == ssB
|
||||
|
||||
ssC = await cs.generate_shared_secret(kp2.key(), kp1.secret(), b"abc1234")
|
||||
|
||||
assert ssA != ssC
|
||||
|
||||
ssD = await cs.generate_shared_secret(kp3.key(), kp1.secret(), b"abc123")
|
||||
|
||||
assert ssA != ssD
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue