Merge commit '54d4301' into logging_enabled
This commit is contained in:
commit
c7a2359639
5 changed files with 52 additions and 6 deletions
3
Makefile
3
Makefile
|
@ -31,7 +31,8 @@ JS_PRE := $(wildcard javascript/*pre.js)
|
||||||
JS_POST := $(wildcard javascript/*post.js)
|
JS_POST := $(wildcard javascript/*post.js)
|
||||||
|
|
||||||
CPPFLAGS += -Iinclude -Ilib
|
CPPFLAGS += -Iinclude -Ilib
|
||||||
CFLAGS += -Wall -Werror -std=c89 -fPIC
|
# we rely on <stdint.h>, which was introduced in C99
|
||||||
|
CFLAGS += -Wall -Werror -std=c99 -fPIC
|
||||||
CXXFLAGS += -Wall -Werror -std=c++11 -fPIC
|
CXXFLAGS += -Wall -Werror -std=c++11 -fPIC
|
||||||
LDFLAGS += -Wall -Werror
|
LDFLAGS += -Wall -Werror
|
||||||
|
|
||||||
|
|
9
jenkins.sh
Executable file
9
jenkins.sh
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
make clean
|
||||||
|
make lib
|
||||||
|
make test
|
||||||
|
|
||||||
|
./python/test_olm.sh
|
|
@ -1,5 +1,7 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
@ -8,6 +10,7 @@ import yaml
|
||||||
|
|
||||||
from . import *
|
from . import *
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("--key", help="Account encryption key", default="")
|
parser.add_argument("--key", help="Account encryption key", default="")
|
||||||
|
@ -51,6 +54,39 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
keys.set_defaults(func=do_keys)
|
keys.set_defaults(func=do_keys)
|
||||||
|
|
||||||
|
def do_id_key(args):
|
||||||
|
account = Account()
|
||||||
|
with open(args.account_file, "rb") as f:
|
||||||
|
account.unpickle(args.key, f.read())
|
||||||
|
print(account.identity_keys()['curve25519'])
|
||||||
|
|
||||||
|
id_key = commands.add_parser("identity_key", help="Get the identity key for an account")
|
||||||
|
id_key.add_argument("account_file", help="Local account file")
|
||||||
|
id_key.set_defaults(func=do_id_key)
|
||||||
|
|
||||||
|
def do_one_time_key(args):
|
||||||
|
account = Account()
|
||||||
|
with open(args.account_file, "rb") as f:
|
||||||
|
account.unpickle(args.key, f.read())
|
||||||
|
keys = account.one_time_keys()['curve25519'].values()
|
||||||
|
key_num = args.key_num
|
||||||
|
if key_num < 1 or key_num > len(keys):
|
||||||
|
print(
|
||||||
|
"Invalid key number %i: %i keys available" %
|
||||||
|
(key_num, len(keys)),
|
||||||
|
file=sys.stderr
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
print (keys[key_num-1])
|
||||||
|
|
||||||
|
one_time_key = commands.add_parser("one_time_key",
|
||||||
|
help="Get a one-time key for the account")
|
||||||
|
one_time_key.add_argument("account_file", help="Local account file")
|
||||||
|
one_time_key.add_argument("--key-num", "-n", type=int, default=1,
|
||||||
|
help="Index of key to retrieve (default: 1)")
|
||||||
|
one_time_key.set_defaults(func=do_one_time_key)
|
||||||
|
|
||||||
|
|
||||||
sign = commands.add_parser("sign", help="Sign a message")
|
sign = commands.add_parser("sign", help="Sign a message")
|
||||||
sign.add_argument("account_file", help="Local account file")
|
sign.add_argument("account_file", help="Local account file")
|
||||||
sign.add_argument("message_file", help="Message to sign")
|
sign.add_argument("message_file", help="Message to sign")
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
|
cd `dirname $0`
|
||||||
|
|
||||||
OLM="python -m olm"
|
OLM="python -m olm"
|
||||||
|
|
||||||
ALICE_ACCOUNT=alice.account
|
ALICE_ACCOUNT=alice.account
|
||||||
|
@ -14,8 +16,8 @@ $OLM create_account $ALICE_ACCOUNT
|
||||||
$OLM create_account $BOB_ACCOUNT
|
$OLM create_account $BOB_ACCOUNT
|
||||||
$OLM generate_keys $BOB_ACCOUNT 1
|
$OLM generate_keys $BOB_ACCOUNT 1
|
||||||
|
|
||||||
BOB_IDENTITY_KEY="$($OLM keys --json $BOB_ACCOUNT | jq -r .account_keys.curve25519)"
|
BOB_IDENTITY_KEY="$($OLM identity_key $BOB_ACCOUNT)"
|
||||||
BOB_ONE_TIME_KEY="$($OLM keys --json $BOB_ACCOUNT | jq -r '.one_time_keys.curve25519|to_entries[0].value')"
|
BOB_ONE_TIME_KEY="$($OLM one_time_key $BOB_ACCOUNT)"
|
||||||
|
|
||||||
$OLM outbound $ALICE_ACCOUNT $ALICE_SESSION "$BOB_IDENTITY_KEY" "$BOB_ONE_TIME_KEY"
|
$OLM outbound $ALICE_ACCOUNT $ALICE_SESSION "$BOB_IDENTITY_KEY" "$BOB_ONE_TIME_KEY"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright 2015 OpenMarket Ltd
|
/* Copyright 2015-6 OpenMarket Ltd
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -12,7 +12,6 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
extern "C" {
|
|
||||||
#include "crypto-algorithms/sha256.c"
|
#include "crypto-algorithms/sha256.c"
|
||||||
#include "crypto-algorithms/aes.c"
|
#include "crypto-algorithms/aes.c"
|
||||||
#include "curve25519-donna/curve25519-donna.c"
|
#include "curve25519-donna/curve25519-donna.c"
|
||||||
|
@ -24,4 +23,3 @@ extern "C" {
|
||||||
#include "ed25519/src/verify.c"
|
#include "ed25519/src/verify.c"
|
||||||
#include "ed25519/src/sign.c"
|
#include "ed25519/src/sign.c"
|
||||||
#include "ed25519_additions.c"
|
#include "ed25519_additions.c"
|
||||||
}
|
|
Loading…
Reference in a new issue