vanetix / simple_secrets_ex

A simple, opinionated library for encrypting small packets of data securely.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simple_secrets_ex Build Status

The elixir implementation of a simple, opinionated library for encrypting small packets of data securely. Designed for exchanging tokens among systems written in a variety of programming languages:

Examples

Basic

Send:

# Try `head /dev/urandom | shasum -a 256` to make a decent 256-bit key
master_key = "64-char-hex"

sender = SimpleSecrets.init(master_key)
{:ok, packet} = SimpleSecrets.pack("this is a secret message", sender)

IO.inspect(packet)
# <<"bBDTl5NKdpvMfriRElbbOw0WEsENjbvv7mqK4"...>>

Receive:

master_key = "shared-key-hex"
sender = SimpleSecrets.init(master_key)

# Read data from somewhere
packet = <<"bBDTl5NKdpvMfriRElbbOw0WEsENjbvv7mqK4"...>>
{:ok, message} = SimpleSecrets.unpack(packet, sender)

IO.inspect(message)
# "this is a secret message"

Can you add ...

No. Seriously. But we might replace what we have with what you suggest. We want exactly one, well-worn path. If you have improvements, we want them. If you want alternatives to choose from you should probably keep looking.

License

MIT.

About

A simple, opinionated library for encrypting small packets of data securely.

License:MIT License


Languages

Language:Elixir 100.0%