libolm wrapper for Nim
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Joachim Kruth 72d26918d9 Initial commit 5 days ago
src Initial commit 4 days ago
tests Initial commit 4 days ago
README.md Initial commit 4 days ago
nimolm.nimble Initial commit 4 days ago

README.md

Nim-olm is a Nim wrapper for the libolm library.

It is intentionally not published on Github, read here why.

Nim-olm is distributed as a Nimble package and depends on nimterop to generate the wrappers.

Installing

Nim-olm can be installed via Nimble:

nimble install https://gitea.com/BarrOff/nim-olm

This will download and install nim-olm in the standard Nimble package location, typically ~/.nimble. Once installed, it can be imported into any Nim program.

To use libolm installed in a standard system path like /usr/ or /usr/local the -d:olmStd flag has to be passed when compiling.

To download and build libolm from the official repo, the -d:olmDL flag has to be passed when compiling. The version of libolm to build can be set by -d:olmVersion=<version>, e.g. -d:olmVersion="3.2.1", the current default version to build is 3.1.2.

Usage

Nim-olm currently wraps libolm without any changes to it's C interface. For usage of the API, please refer to it's official documentation.

The maintainer is no expert in cryptography, and therefore won't write a higher-level wrapper. If you are familiar with cryptography, pull requests providing such an implementation are highly welcome.

import nimolm

var
  utilityBuffer: seq[char] = newSeq[char](olm_utility_size())
  utility: ptr OlmUtility = olm_utility(addr(utilityBuffer[0]))

More examples can be found in the tests-directory. These tests have been directly converted from the official testsuite.

Status

Nimterop currently only supports C, even though C++ support is in the works. Using libolm statically is therefore currently not possible, because the static library contains C and C++ code. The compiled binary has to be dynamically linked.

When nimterop stabilizes C++ support, building statically will be added.

Credits

Nim-olm wraps the libolm source code and all licensing terms of libolm apply to the usage of this package.

Without the following people nim-olm wouldn't be possible:

Feedback

Nim-olm is a work in progress and any feedback or suggestions are welcome. It is hosted on Gitea with an MIT license so issues, forks and PRs are most appreciated.