README.md in lockbox-0.3.6 vs README.md in lockbox-0.3.7
- old
+ new
@@ -314,22 +314,38 @@
To serve encrypted files, use a controller action.
```ruby
def license
user = User.find(params[:id])
- send_data box.decrypt(user.license.read), type: user.license.mime_type
+ send_data lockbox.decrypt(user.license.read), type: user.license.mime_type
end
```
## Local Files
-Read the file as a binary string
+Generate a key
```ruby
-message = File.binread("file.txt")
+key = Lockbox.generate_key
```
-Then follow the instructions for encrypting a string below.
+Create a lockbox
+
+```ruby
+lockbox = Lockbox.new(key: key)
+```
+
+Encrypt
+
+```ruby
+ciphertext = lockbox.encrypt(File.binread("file.txt"))
+```
+
+Decrypt
+
+```ruby
+lockbox.decrypt(ciphertext)
+```
## Strings
Generate a key