Skip to content

Commit

Permalink
Fix essr to encrypt sender.
Browse files Browse the repository at this point in the history
Signed-off-by: pfeairheller <[email protected]>
  • Loading branch information
pfeairheller committed Jan 8, 2025
1 parent 4d89f8b commit 7b986e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/peer/test_exchanging.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
tests.peer.test_exchanging module
"""
import json

import pysodium
import pytest

Expand Down Expand Up @@ -57,10 +59,10 @@ def test_essrs():
ims = hab.makeOwnInception()
parsing.Parser().parse(ims=ims, kvy=recHby.kvy)
# create the test message with essr attachment
msg = "This is a test message that must be secured"
msg = dict(msg="This is a test message that must be secured", i=hab.pre)
rkever = recHab.kever
pubkey = pysodium.crypto_sign_pk_to_box_pk(rkever.verfers[0].raw)
raw = pysodium.crypto_box_seal(msg.encode("utf-8"), pubkey)
raw = pysodium.crypto_box_seal(json.dumps(msg).encode("utf-8"), pubkey)

texter = coring.Texter(raw=raw)
diger = coring.Diger(ser=raw, code=MtrDex.Blake3_256)
Expand All @@ -84,7 +86,7 @@ def test_essrs():
# Pull the logged ESSR attachment and verify it is the one attached
texter = recHby.db.essrs.get(keys=(serder.said,))
raw = recHab.decrypt(ser=texter[0].raw)
assert raw.decode("utf-8") == msg
assert json.loads(raw.decode("utf-8")) == msg

# Test with invalid diger
diger = coring.Diger(qb64="EKC8085pwSwzLwUGzh-HrEoFDwZnCJq27bVp5atdMT9o")
Expand Down

0 comments on commit 7b986e9

Please sign in to comment.