Olm.jl/src/Olm.jl

40 lines
803 B
Julia

module Olm # include("olm.jl")
using Random
using JSON
const libolm = "/gnu/store/ks2szjc82r1wqaxdq4vsy6sq9plwd4fs-libolm-3.1.4/lib/libolm.so"
const error = ccall((:olm_error, libolm), Csize_t, ())
struct OlmAccount
ptr::Ptr{Cvoid}
# Should I store it?
# memory::Vector{UInt}
end
struct OlmSession
ptr::Ptr{Cvoid}
end
struct OlmUtility
ptr::Ptr{Cvoid}
end
include("memory.jl")
include("wrapper.jl")
# # Save/Load account!
# a = OlmAccount()
# generate_one_time_keys(a, 10)
# # deleted after use
# enc_key = "pass" |> collect
# dec_key = deepcopy(enc_key)
# enc_key = dec_key = Char[]
# p = pickle!(a, enc_key)
# write("account.bin", p)
# d = read("account.bin", String) |> collect .|> UInt8
# @assert d == p
# n = OlmAccount(d, dec_key)
# o = OlmAccount(p, dec_key)
end # Olm