Sha256: 75794dae0f37a2a8609d745e7fb94acf1189bb985727e5320b856d1eac2a900e

Contents?: true

Size: 961 Bytes

Versions: 4

Compression:

Stored size: 961 Bytes

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
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
```

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid-kms-0.0.11 README.md
mongoid-kms-0.0.10 README.md
mongoid-kms-0.0.9 README.md
mongoid-kms-0.0.8 README.md