README.md in kms_encrypted-0.1.1 vs README.md in kms_encrypted-0.1.2
- old
+ new
@@ -31,21 +31,21 @@
```ruby
add_column :users, :encrypted_kms_key, :string
```
-Create a [KMS master key](https://console.aws.amazon.com/iam/home#/encryptionKeys) and set it in your environment (we recommend [dotenv](https://github.com/bkeepers/dotenv))
+Create a [KMS master key](https://console.aws.amazon.com/iam/home#/encryptionKeys) and set it in your environment ([dotenv](https://github.com/bkeepers/dotenv) is great for this)
```sh
KMS_KEY_ID=arn:aws:kms:...
```
And update your model
```ruby
class User < ApplicationRecord
- has_kms_key ENV["KMS_KEY_ID"]
+ has_kms_key
attr_encrypted :email, key: :kms_key
end
```
@@ -76,11 +76,11 @@
{"Record" => "#{model_name}/#{id}"}
end
end
```
-We recommend [Amazon Athena](https://aws.amazon.com/athena/) for querying CloudTrail logs. Create a table (thanks to [this post](http://www.1strategy.com/blog/2017/07/25/auditing-aws-activity-with-cloudtrail-and-athena/) for the table structure) with:
+[Amazon Athena](https://aws.amazon.com/athena/) is great for querying CloudTrail logs. Create a table (thanks to [this post](http://www.1strategy.com/blog/2017/07/25/auditing-aws-activity-with-cloudtrail-and-athena/) for the table structure) with:
```sql
CREATE EXTERNAL TABLE cloudtrail_logs (
eventversion STRING,
userIdentity STRUCT<
@@ -157,11 +157,11 @@
KMS_KEY_ID=arn:aws:kms:...
```
and run
-```sh
+```ruby
User.find_each do |user|
user.rotate_kms_key!
end
```
@@ -177,11 +177,11 @@
And update your model
```ruby
class User < ApplicationRecord
- has_kms_key ENV["KMS_KEY_ID"]
- has_kms_key ENV["KMS_KEY_ID"], name: :phone
+ has_kms_key
+ has_kms_key name: :phone, key_id: "..."
attr_encrypted :email, key: :kms_key
attr_encrypted :phone, key: :kms_key_phone
end
```