aboutsummaryrefslogtreecommitdiff
path: root/python/test_olm.sh
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-07-14 11:38:43 +0100
committerMark Haines <mark.haines@matrix.org>2015-07-14 11:38:43 +0100
commit36d17d1cb248db595a2318cd6af6fc4a1952cbb2 (patch)
tree68474bec2815ba4f5502ae61b1c0feeac2de1250 /python/test_olm.sh
parenta59fbdfe7fefcca1baefdbfda379d5dc9383210b (diff)
Move olm.py to a python subdirectory. Add a script for testing the olm.py script
Diffstat (limited to 'python/test_olm.sh')
-rwxr-xr-xpython/test_olm.sh22
1 files changed, 22 insertions, 0 deletions
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 - -