Sha256: 3e084cb85c17097fcc5642ccc0835946236d54cc4f1fc1ef63679cc34c5b0b1b

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

# Mongoid::Kms

Easily encrypt your datas using AWS's KSM.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'mongoid-kms'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install mongoid-kms

## Usage

Environmental variables to include:

```
AWS_ACCESS_KEY_ID # an IAM access key
AWS_SECRET_ACCESS_KEY # an IAM access secret
```

Somewhere before your run your application, you will need to add this:

```ruby
require 'mongoid/kms'

Mongoid::Kms.configure({region: "us-east-1", key: "your aws kms key id i.e <02342-234-232-234-234>"})
```

When defining yoru classes, `include Mongoid::Kms`, and use the
`secure_field` to define your fields with a required `:context`.
Context must return a hash.

```ruby
class MyClass
  include Mongoid::Document
  include Mongoid::Kms

  secure_field :secure, type: String, context: lambda { |d| {name: d.name} }
  field :unsecure

  def name
    @name ||= "me-#{Time.now.to_i}"
  end
end
```

## Development and Testing

In development or testing, just require `mongoid/kms/mock` and the
package will use Rot13 for encryption.

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongoid-kms-0.0.16 README.md
mongoid-kms-0.0.15 README.md
mongoid-kms-0.0.14 README.md
mongoid-kms-0.0.13 README.md
mongoid-kms-0.0.12 README.md