sorcery-encryptor 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: 74d3fd120cb5f22b4ab31364d93e8acc3f6d11df
4
- data.tar.gz: 158c51da5ff1b065838e6af1f5ea50e0b89993ba
3
+ metadata.gz: 8d13085d21bb58d6791c2229595aef6e72e44a73
4
+ data.tar.gz: 900af9bdc9c6781144f15eb322fe98df42ca7444
5
5
  SHA512:
6
- metadata.gz: 946538c2223b80fed706651007147d8ec3063c676287018f8300f317e7f38d9dc662bf80bb9aa3b54fdc0076297d6f603a2abdc929a8f29b250399db2af7f862
7
- data.tar.gz: a3c7d3707de81ec8b54b88afdbfc6190d8d64da74a13037575b09e85e127cb6b257eea96501c379387a85893780bb9538899fec5df2505f61b1815a84ee01789
6
+ metadata.gz: 4bed4d3858112f77652ec64c515e110595dac8b7dd06fd46333518ec84107091ec5f11e24eecf56d6d13bcd64ae4a7a6bda2367c908c77adbc88b5f200a3ae7f
7
+ data.tar.gz: 5a567f472cc9bc87316357156da1fee3b766728e78dcb6e0f7f90d4a4d364a0feb3ef0b4927fd03c54ccf69d28e90db5245c9731dd3eed72d23ace88602f4656
data/.simplecov ADDED
@@ -0,0 +1,4 @@
1
+ SimpleCov.start do
2
+ SimpleCov.minimum_coverage 100.0
3
+ add_filter "/vendor"
4
+ end
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 1.9.3
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Sorcery::Encryptor
2
2
 
3
- TODO: Write a gem description
3
+ [![Gem Version](https://badge.fury.io/rb/sorcery-encryptor.png)](http://badge.fury.io/rb/sorcery-encryptor) [![Code Climate](https://codeclimate.com/github/amaabca/sorcery-encryptor.png)](https://codeclimate.com/github/amaabca/sorcery-encryptor) [![Build Status](https://travis-ci.org/amaabca/sorcery-encryptor.png?branch=master)](https://travis-ci.org/amaabca/sorcery-encryptor) [![Dependency Status](https://gemnasium.com/amaabca/sorcery-encryptor.png)](https://gemnasium.com/amaabca/sorcery-encryptor) [![Coverage Status](https://coveralls.io/repos/amaabca/sorcery-encryptor/badge.png)](https://coveralls.io/r/amaabca/sorcery-encryptor)
4
+
5
+ Override SHA1 encryption used by Sorcery to make [Sorcery](http://rubygems.org/gems/sorcery) compatible with [Devise](http://rubygems.org/gems/devise)
4
6
 
5
7
  ## Installation
6
8
 
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task default: :spec
@@ -1,4 +1,5 @@
1
1
  require "sorcery/encryptor/version"
2
+ require "sorcery/encryptor/crypto_providers/sha1"
2
3
 
3
4
  module Sorcery
4
5
  module Encryptor
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ Sorcery::CryptoProviders::SHA1.instance_eval do
4
+
5
+ def encrypt_like_devise(*tokens)
6
+ digest = ''
7
+ password = tokens.first
8
+ salt = tokens.last
9
+ pepper = ''
10
+ stretches.times { digest = secure_digest(salt, digest, password, pepper) }
11
+ digest
12
+ end
13
+
14
+ def secure_digest_like_devise(*tokens)
15
+ Digest::SHA1.hexdigest('--' << tokens.flatten.join('--') << '--')
16
+ end
17
+
18
+ alias encrypt encrypt_like_devise
19
+ alias secure_digest secure_digest_like_devise
20
+
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Sorcery
2
2
  module Encryptor
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["jorbabe@gmail.com"]
11
11
  spec.description = %q{Custom encryption for Sorcery}
12
12
  spec.summary = %q{Custom encryption for Sorcery. This lets you share users between Sorcery and Devise}
13
- spec.homepage = ""
13
+ spec.homepage = "http://github.com/amaabca/sorcery-encryptor"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -18,6 +18,13 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "sorcery", "~> 0.8.5"
22
+
21
23
  spec.add_development_dependency "bundler", "~> 1.3"
22
24
  spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "pry"
27
+ spec.add_development_dependency "rspec"
28
+ spec.add_development_dependency "simplecov"
29
+ spec.add_development_dependency "coveralls"
23
30
  end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sorcery::CryptoProviders::SHA1 do
4
+
5
+ describe '#encrypt_like_devise' do
6
+ it 'modifies the behaviour of #encrypt' do
7
+ Sorcery::CryptoProviders::SHA1.encrypt_like_devise == Sorcery::CryptoProviders::SHA1.encrypt
8
+ end
9
+ end
10
+
11
+ describe '#secure_digest_like_devise' do
12
+ it 'modifies the behaviour of #secure_digest' do
13
+ Sorcery::CryptoProviders::SHA1.secure_digest_like_devise == Sorcery::CryptoProviders::SHA1.secure_digest
14
+ end
15
+ end
16
+
17
+ end
@@ -0,0 +1,12 @@
1
+ require 'simplecov'
2
+ require 'sorcery'
3
+ require 'sorcery/encryptor'
4
+ require 'pry'
5
+ require 'coveralls'
6
+ Coveralls.wear!
7
+
8
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
9
+ SimpleCov::Formatter::HTMLFormatter,
10
+ Coveralls::SimpleCov::Formatter
11
+ ]
12
+ SimpleCov.start
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorcery-encryptor
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
  - Jordan Babe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-18 00:00:00.000000000 Z
11
+ date: 2014-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sorcery
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.8.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.5
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +52,76 @@ dependencies:
38
52
  - - '>='
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: coveralls
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
41
125
  description: Custom encryption for Sorcery
42
126
  email:
43
127
  - jorbabe@gmail.com
@@ -46,14 +130,19 @@ extensions: []
46
130
  extra_rdoc_files: []
47
131
  files:
48
132
  - .gitignore
133
+ - .simplecov
134
+ - .travis.yml
49
135
  - Gemfile
50
136
  - LICENSE.txt
51
137
  - README.md
52
138
  - Rakefile
53
139
  - lib/sorcery/encryptor.rb
140
+ - lib/sorcery/encryptor/crypto_providers/sha1.rb
54
141
  - lib/sorcery/encryptor/version.rb
55
142
  - sorcery-encryptor.gemspec
56
- homepage: ''
143
+ - spec/lib/sha1_spec.rb
144
+ - spec/spec_helper.rb
145
+ homepage: http://github.com/amaabca/sorcery-encryptor
57
146
  licenses:
58
147
  - MIT
59
148
  metadata: {}
@@ -78,4 +167,6 @@ signing_key:
78
167
  specification_version: 4
79
168
  summary: Custom encryption for Sorcery. This lets you share users between Sorcery
80
169
  and Devise
81
- test_files: []
170
+ test_files:
171
+ - spec/lib/sha1_spec.rb
172
+ - spec/spec_helper.rb