diff options
-rwxr-xr-x | python/olm.py (renamed from olm.py) | 2 | ||||
-rwxr-xr-x | python/test_olm.sh | 22 |
2 files changed, 23 insertions, 1 deletions
@@ -4,7 +4,7 @@ import json import os lib = cdll.LoadLibrary(os.path.join( - os.path.dirname(__file__), "build", "libolm.so") + os.path.dirname(__file__), "..", "build", "libolm.so") ) diff --git a/python/test_olm.sh b/python/test_olm.sh new file mode 100755 index 0000000..78cd3c2 --- /dev/null +++ b/python/test_olm.sh @@ -0,0 +1,22 @@ +#! /bin/bash + +OLM="$(dirname $0)/olm.py" + +ALICE_ACCOUNT=alice.account +ALICE_SESSION=alice.session +BOB_ACCOUNT=bob.account +BOB_SESSION=bob.session + +rm $ALICE_ACCOUNT $BOB_ACCOUNT +rm $ALICE_SESSION $BOB_SESSION + +$OLM create_account $ALICE_ACCOUNT +$OLM create_account $BOB_ACCOUNT +$OLM generate_keys $BOB_ACCOUNT 1 + +BOB_IDENTITY_KEY="$($OLM keys --json $BOB_ACCOUNT | jq -r .account_keys.curve25519)" +BOB_ONE_TIME_KEY="$($OLM keys --json $BOB_ACCOUNT | jq -r '.one_time_keys.curve25519|to_entries[0].value')" + +$OLM outbound $ALICE_ACCOUNT $ALICE_SESSION "$BOB_IDENTITY_KEY" "$BOB_ONE_TIME_KEY" + +echo "Hello world" | $OLM encrypt $ALICE_SESSION - - | $OLM inbound $BOB_ACCOUNT $BOB_SESSION - - |