ork-encryption 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d98c6c7652d8bf6ceb94c40a8f32d2dce5135fc
4
- data.tar.gz: 08b286150cdc8a6582d92fa6357811d643e30b57
3
+ metadata.gz: 4ab8fcc5007a9baf05cc108139b3a76fa0abecbc
4
+ data.tar.gz: ed62c92b058f2d84cd5ded7aa4c97543e76dcb99
5
5
  SHA512:
6
- metadata.gz: f10fc38e89d28c5a551013e99b3e5ffe04fb63a02a37865ae7e9add307030d871fc82eb15122171da33e9344e83b8153ab4d424da431976969e1c0151b3d7dff
7
- data.tar.gz: c1ef9588c03f0abc78498ad8b5d20bb9e428f219ae8510bd9e0212483530b443af2389e832d93e2e3b9fe4429f216185768d98b3f0942ccd2bfff87944999d2c
6
+ metadata.gz: c8c2f69a2d242160ec4e6e12a9af9b5772b1f272b57d111c00939153ea875ba0b62ece9d0b3a273de98267b8a7cb32e83d21effa4d6542c303ef2d0f76b0c8c8
7
+ data.tar.gz: 5878497343c05a583ae25c751a7cea9ac242e2f3f1d81c7b14c42b1fd8119a8912488ebd1f46c6f3b94a07fa926fb31bb52865eee91b5de445b93c65a09fc3f7
data/README.md CHANGED
@@ -1,4 +1,82 @@
1
1
  ork-encryption
2
2
  ==============
3
+ [![Gem Version](https://badge.fury.io/rb/ork-encryption.png)](http://badge.fury.io/rb/rork-encryption)
4
+ [![Build Status](https://travis-ci.org/emancu/ork-encryption.png)](https://travis-ci.org/emancu/ork-encryption)
5
+ [![Code Climate](https://codeclimate.com/github/emancu/ork-encryption.png)](https://codeclimate.com/github/emancu/ork-encryption)
6
+ [![Coverage Status](https://coveralls.io/repos/emancu/ork-encryption/badge.png)](https://coveralls.io/r/emancu/ork-encryption)
7
+ [![Dependency Status](https://gemnasium.com/emancu/ork-encryption.png)](https://gemnasium.com/emancu/ork-encryption)
3
8
 
4
9
  The ork-encryption gem provides encryption and decryption for Ork models.
10
+
11
+ ## Dependencies
12
+
13
+ `ork-encryption` requires:
14
+
15
+ * Ruby 1.9 or later.
16
+ * `riak-client` to connect to **Riak**.
17
+ * `ork` 0.1.1 or later.
18
+
19
+ Install Dependencies using `dep` is easy as run:
20
+
21
+ $ dep insatll
22
+
23
+ ## Installation
24
+
25
+ Install [Riak](http://basho.com/riak/) with your package manager:
26
+
27
+ $ brew install riak
28
+
29
+ Or download it from [Riak's download page](http://docs.basho.com/riak/latest/downloads/)
30
+
31
+ Once you have it installed, you can execute `riak start` and it will run on `localhost:8098` by default.
32
+
33
+ If you don't have `Ork-encryption`, try this:
34
+
35
+ $ gem install ork-encryption
36
+
37
+ ## Overview
38
+
39
+ Any object that gets saved with content-type 'application/x-json-encrypted'
40
+ the `Ork::Encryption::Serializers::Json` will take care of load or unload the data from **Riak**.
41
+
42
+ `Serializers::Json` stores the encrypted data wrapped in JSON encapsulation so
43
+ that you can still introspect the **Riak** object and see which version of
44
+ this gem was used to encrypt it. As of version 0.0.1, this is now the only
45
+ supported serialization format for JSON data.
46
+
47
+ ## Getting started
48
+
49
+ You must initialize the `Ork::Encryption` module before using it.
50
+ Initialization needs a _configuration hash_ with __key__ and __cipher__ to be used.
51
+ [See how to choose the configuration](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#documentation)
52
+
53
+ ```ruby
54
+ config = {
55
+ cipher: 'AES-256-CBC',
56
+ key: 'fantasticobscurekeygoesherenowty',
57
+ }
58
+
59
+ Ork::Encryption.init config
60
+ ```
61
+
62
+ Then include the Ork::Encryption module in your Ork::Document class:
63
+
64
+ ```ruby
65
+ class SomeDocument
66
+ include Ork::Document
67
+ include Ork::Encryption
68
+
69
+ attribute :message
70
+ end
71
+ ```
72
+
73
+ These documents will now be stored encrypted and also the **IV** used.
74
+
75
+ ## Running the Tests
76
+
77
+ Adjust the variable to point to a test riak database. Default is `http://localhost:8098`
78
+
79
+ ```bash
80
+ $ ORK_RIAK_URL='http://localhost:8198' rake
81
+ ```
82
+
@@ -1,13 +1,12 @@
1
1
  require_relative 'cipher'
2
- require_relative 'errors'
3
2
  require_relative 'serializers/json'
4
3
 
5
4
  module Ork
6
5
  module Encryption
7
- VERSION = '0.0.1'
6
+ VERSION = '0.0.2'
8
7
 
9
8
  def self.included(klass)
10
- raise NotAnOrkDocument unless klass.included_modules.include? Ork::Document
9
+ raise Ork::NotOrkObject unless klass.included_modules.include? Ork::Document
11
10
  klass.content_type Serializers::Json.content_type
12
11
  end
13
12
 
@@ -34,5 +33,7 @@ module Ork
34
33
  Ork::Encryption::Cipher.validate_config @encryption_config = config
35
34
  end
36
35
 
36
+ # Errors
37
+ class MissingConfig < StandardError; end
37
38
  end
38
39
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ork-encryption'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.date = Time.now.strftime('%Y-%m-%d')
5
5
  s.summary = 'Ruby modeling layer for Riak.'
6
6
  s.summary = 'A simple encryption library for Ork::Documents stored in riak.'
@@ -19,10 +19,10 @@ Gem::Specification.new do |s|
19
19
  ]
20
20
  s.test_files = Dir['test/*.*']
21
21
 
22
- s.add_dependency 'riak-client'
23
- s.add_dependency 'ork', "~> 0.1.1"
24
- s.add_development_dependency 'protest'
25
- s.add_development_dependency 'mocha'
26
- s.add_development_dependency 'coveralls'
22
+ s.add_runtime_dependency 'riak-client', '~> 1.4'
23
+ s.add_runtime_dependency 'ork', '~> 0.1', '>= 0.1.4'
24
+ s.add_development_dependency 'protest', '~> 0'
25
+ s.add_development_dependency 'mocha', '~> 0'
26
+ s.add_development_dependency 'coveralls', '~> 0'
27
27
  end
28
28
 
data/test/encrypt_test.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require_relative 'helper'
2
2
  require 'mocha/api'
3
- # require 'json'
4
3
 
5
4
  include(Mocha::API)
6
5
 
@@ -20,7 +19,7 @@ config_hash = {
20
19
  Protest.describe 'Ork::Encryption' do
21
20
  context 'include Ork::Encryption' do
22
21
  test 'raise an error if it is not a Ork::Document' do
23
- assert_raise Ork::Encryption::NotAnOrkDocument do
22
+ assert_raise Ork::NotOrkObject do
24
23
  class NotADocument
25
24
  include Ork::Encryption
26
25
  end
metadata CHANGED
@@ -1,83 +1,89 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ork-encryption
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Mancuso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-10 00:00:00.000000000 Z
11
+ date: 2014-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riak-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ork
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ - - ">="
32
35
  - !ruby/object:Gem::Version
33
- version: 0.1.1
36
+ version: 0.1.4
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - ~>
41
+ - - "~>"
39
42
  - !ruby/object:Gem::Version
40
- version: 0.1.1
43
+ version: '0.1'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.1.4
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: protest
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - '>='
51
+ - - "~>"
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - '>='
58
+ - - "~>"
53
59
  - !ruby/object:Gem::Version
54
60
  version: '0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: mocha
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - '>='
65
+ - - "~>"
60
66
  - !ruby/object:Gem::Version
61
67
  version: '0'
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
- - - '>='
72
+ - - "~>"
67
73
  - !ruby/object:Gem::Version
68
74
  version: '0'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: coveralls
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - '>='
79
+ - - "~>"
74
80
  - !ruby/object:Gem::Version
75
81
  version: '0'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - '>='
86
+ - - "~>"
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0'
83
89
  description: Encrypt documents persisted on Riak DB. Inspired in ripple-encryption
@@ -88,12 +94,11 @@ extensions: []
88
94
  extra_rdoc_files: []
89
95
  files:
90
96
  - README.md
91
- - rakefile
92
97
  - lib/ork/cipher.rb
93
98
  - lib/ork/encryption.rb
94
- - lib/ork/errors.rb
95
99
  - lib/ork/serializers/json.rb
96
100
  - ork-encryption.gemspec
101
+ - rakefile
97
102
  - test/cipher_test.rb
98
103
  - test/encrypt_test.rb
99
104
  - test/helper.rb
@@ -107,17 +112,17 @@ require_paths:
107
112
  - lib
108
113
  required_ruby_version: !ruby/object:Gem::Requirement
109
114
  requirements:
110
- - - '>='
115
+ - - ">="
111
116
  - !ruby/object:Gem::Version
112
117
  version: '0'
113
118
  required_rubygems_version: !ruby/object:Gem::Requirement
114
119
  requirements:
115
- - - '>='
120
+ - - ">="
116
121
  - !ruby/object:Gem::Version
117
122
  version: '0'
118
123
  requirements: []
119
124
  rubyforge_project:
120
- rubygems_version: 2.1.9
125
+ rubygems_version: 2.2.1
121
126
  signing_key:
122
127
  specification_version: 4
123
128
  summary: A simple encryption library for Ork::Documents stored in riak.
data/lib/ork/errors.rb DELETED
@@ -1,8 +0,0 @@
1
- module Ork
2
- module Encryption
3
-
4
- class NotAnOrkDocument < StandardError; end
5
- class MissingConfig < StandardError; end
6
- end
7
- end
8
-