aboutsummaryrefslogtreecommitdiff
path: root/python/olm/_base.py
blob: 8238957672cc8ca5872987c7207d369bb070d309 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os.path

from ctypes import *

def read_random(n):
    with open("/dev/urandom", "rb") as f:
        return f.read(n)

lib = cdll.LoadLibrary(os.path.join(
    os.path.dirname(__file__), "..", "..", "build", "libolm.so")
)

lib.olm_error.argtypes = []
lib.olm_error.restypes = c_size_t

ERR = lib.olm_error()

class OlmError(Exception):
    pass