0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby client for simple-secrets, the simple, opinionated library for encrypting small packets of data securely.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.3
>= 0
>= 0

Runtime

>= 0.7.1
 Project Readme

simple-secrets.rb Build Status

The Ruby 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:

require 'simple-secrets'

include SimpleSecrets

# Try `head /dev/urandom | shasum -a 256` to make a decent 256-bit key
sender = Packet.new '<64-char hex string master key (32 bytes, 256 bits)>'
# => #<SimpleSecrets::Packet:0x007fec7c198e60 @master_key="d\xDD\xB5...", @identity="B\xBE...">

packet = sender.pack msg: 'this is a secret message'
# => 'Qr4m7AughkcQIRqQvlyXiB67EwHdBf5n9JD2s_Z9NpO4ksPGvLYjNbDm3HRzvFXFSpV2IqDQw_LTamndMh2c7iOQT0lSp4LstqJPAtoQklU5sb7JHYyTOuf-6W-q7W8gAnq1wCs5'

Receive:

require 'simple-secrets'

include SimpleSecrets

# Same shared key
sender = Packet.new '<64-char hex string master key (32 bytes, 256 bits)>'
# Read data from somewhere
packet = 'OqlG6KVMeyFYmunboS3HIXkvN_nXKTxg2yNkQydZOhvJrZvmfov54hUmkkiZCnlhzyrlwOJkbV7XnPPbqvdzZ6TsFOO5YdmxjxRksZmeIhbhLaMiDbfsOuSY1dBn_ZgtYCw-FRIM'

secret_message = sender.unpack(packet);
# => {"msg"=>"this is a secret message"}

Can you add ...

This implementation follows the spec for the Node.js version for 100% compatibility.

License

MIT.