updated Usage in README and cleaned up libsodium bindings

This commit is contained in:
Dave 2018-02-11 23:18:45 -08:00
parent 3fa19b57e3
commit e65a47a4ac
2 changed files with 24 additions and 10 deletions

View File

@ -39,6 +39,19 @@ nonce, encrypted = Cox.encrypt(data, bob.public, alice.secret)
decrypted = Cox.decrypt(encrypted, nonce, alice.public, bob.secret) decrypted = Cox.decrypt(encrypted, nonce, alice.public, bob.secret)
String.new(decrypted) # => "Hello World!" String.new(decrypted) # => "Hello World!"
# Public key signing
message = "Hello World!"
signing_pair = Cox::SignKeyPair.new
# Sign the message
signature = Cox.sign(message, signing_pair.secret)
# And verify
Cox.verify(signature, message, signing_pair.public) # => true
``` ```
## Contributing ## Contributing
@ -52,3 +65,4 @@ String.new(decrypted) # => "Hello World!"
## Contributors ## Contributors
- [andrewhamon](https://github.com/andrewhamon) Andrew Hamon - creator, maintainer - [andrewhamon](https://github.com/andrewhamon) Andrew Hamon - creator, maintainer
- [dorkrawk](https://github.com/dorkrawk) Dave Schwantes - contributor