2015-07-14 12:38:43 +02:00
|
|
|
#! /bin/bash
|
|
|
|
|
2016-05-10 10:14:29 +02:00
|
|
|
OLM="python -m olm"
|
2015-07-14 12:38:43 +02:00
|
|
|
|
|
|
|
ALICE_ACCOUNT=alice.account
|
|
|
|
ALICE_SESSION=alice.session
|
2016-05-17 19:55:39 +02:00
|
|
|
ALICE_GROUP_SESSION=alice.group_session
|
2015-07-14 12:38:43 +02:00
|
|
|
BOB_ACCOUNT=bob.account
|
|
|
|
BOB_SESSION=bob.session
|
2016-05-19 13:01:15 +02:00
|
|
|
BOB_GROUP_SESSION=bob.group_session
|
2015-07-14 12:38:43 +02:00
|
|
|
|
|
|
|
rm $ALICE_ACCOUNT $BOB_ACCOUNT
|
|
|
|
rm $ALICE_SESSION $BOB_SESSION
|
2016-05-19 13:01:15 +02:00
|
|
|
rm $ALICE_GROUP_SESSION $BOB_GROUP_SESSION
|
2015-07-14 12:38:43 +02:00
|
|
|
|
|
|
|
$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 - -
|
2016-05-17 19:55:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
### group sessions
|
|
|
|
|
|
|
|
$OLM outbound_group $ALICE_GROUP_SESSION
|
2016-05-19 13:01:15 +02:00
|
|
|
$OLM group_credentials $ALICE_GROUP_SESSION | $OLM inbound_group $BOB_GROUP_SESSION
|
|
|
|
echo "Hello group" | $OLM group_encrypt $ALICE_GROUP_SESSION - - | $OLM group_decrypt $BOB_GROUP_SESSION
|