sixarm_ruby_secure_token 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -0,0 +1,93 @@
1
+ # SixArm.com » Ruby » <br> SecureToken to generate a cryptographic string that is web safe
2
+
3
+ * Docs: <http://sixarm.com/sixarm_ruby_secure_token/doc>
4
+ * Repo: <http://github.com/sixarm/sixarm_ruby_secure_token>
5
+ * Email: Joel Parker Henderson, <joel@sixarm.com>
6
+
7
+
8
+ ## Introduction
9
+
10
+ Secure random token generator to create strong secure text tokens.
11
+
12
+ Example:
13
+
14
+ SecureToken.new
15
+ #=> "kavzwbnxremyqlkwtxoimxzqpofmpove"
16
+
17
+
18
+ For docs go to <http://sixarm.com/sixarm_ruby_secure_token/doc>
19
+
20
+ Want to help? We're happy to get pull requests.
21
+
22
+
23
+ ## Install quickstart
24
+
25
+ Install:
26
+
27
+ gem install sixarm_ruby_secure_token
28
+
29
+ Bundler:
30
+
31
+ gem "sixarm_ruby_secure_token", "~>1.3.0"
32
+
33
+ Require:
34
+
35
+ require "sixarm_ruby_secure_token"
36
+
37
+
38
+ ## Install with security (optional)
39
+
40
+ To enable high security for all our gems:
41
+
42
+ wget http://sixarm.com/sixarm.pem
43
+ gem cert --add sixarm.pem
44
+ gem sources --add http://sixarm.com
45
+
46
+ To install with high security:
47
+
48
+ gem install sixarm_ruby_secure_token --test --trust-policy HighSecurity
49
+
50
+
51
+ ## Details
52
+
53
+ This generates a 32-character token of all lowercase letters,
54
+ using Ruby's securerandom methods.
55
+
56
+ SecureToken is a string, so you can do any string methods on it.
57
+ You can change how tokens are randomly created, however you want.
58
+
59
+
60
+ ## Changes
61
+
62
+ * 2012-03-21 1.4.0 Upgrade for Ruby 1.9.3, minitest/spec, and improved docs.
63
+ * 2011-04-22 1.3.0 Update to 32 characters
64
+ * 2011-04-21 1.2.2 End support for Ruby 1.8.6
65
+
66
+
67
+ ## License
68
+
69
+ You may choose any of these open source licenses:
70
+
71
+ * Apache License
72
+ * BSD License
73
+ * CreativeCommons License, Non-commercial Share Alike
74
+ * GNU General Public License Version 2 (GPL 2)
75
+ * GNU Lesser General Public License (LGPL)
76
+ * MIT License
77
+ * Perl Artistic License
78
+ * Ruby License
79
+
80
+ The software is provided "as is", without warranty of any kind,
81
+ express or implied, including but not limited to the warranties of
82
+ merchantability, fitness for a particular purpose and noninfringement.
83
+
84
+ In no event shall the authors or copyright holders be liable for any
85
+ claim, damages or other liability, whether in an action of contract,
86
+ tort or otherwise, arising from, out of or in connection with the
87
+ software or the use or other dealings in the software.
88
+
89
+ This license is for the included software that is created by SixArm;
90
+ some of the included software may have its own licenses, copyrights,
91
+ authors, etc. and these do take precedence over the SixArm license.
92
+
93
+ Copyright (c) 2005-2013 Joel Parker Henderson
@@ -1,10 +1,20 @@
1
1
  # -*- coding: utf-8 -*-
2
- =begin
3
- Please see README.rdoc
2
+ =begin rdoc
3
+ Please see README
4
4
  =end
5
5
 
6
6
  require 'securerandom'
7
7
 
8
+ if !defined?(SecureRandom)
9
+ begin
10
+ # First we will try to load the Ruby standard library
11
+ require 'securerandom'
12
+ rescue
13
+ # Second we will try to load our own SecureRandom gem library
14
+ require 'sixarm_ruby_secure_random'
15
+ end
16
+ end
17
+
8
18
  class SecureToken < String
9
19
 
10
20
  COUNT = 32
@@ -1,18 +1,26 @@
1
- require 'test/unit'
2
- require 'sixarm_ruby_secure_token'
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
3
  require 'simplecov'
4
4
  SimpleCov.start
5
+ require 'sixarm_ruby_secure_token'
6
+
7
+ describe SecureToken do
8
+
9
+ before do
10
+ S ||= SecureToken.new
11
+ end
12
+
13
+ it "=> String" do
14
+ S.must_be_kind_of String
15
+ end
5
16
 
6
- class Testing < Test::Unit::TestCase
17
+ it "has the right length" do
18
+ S.length.must_equal SecureToken::COUNT
19
+ end
7
20
 
8
- def test_all
9
- 20.times{
10
- x=SecureToken.new
11
- assert(x.is_a?(String))
12
- assert_equal(x.length,SecureToken::COUNT)
13
- assert(x=~/^[a-z]+$/,"lowercase letters:#{x}")
14
- }
15
- end
21
+ it "has the right characters" do
22
+ S.must_match /^[a-z]+$/
23
+ end
16
24
 
17
25
  end
18
26
 
metadata CHANGED
@@ -1,84 +1,79 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sixarm_ruby_secure_token
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.0
4
5
  prerelease:
5
- version: 1.3.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - SixArm
9
9
  autorequire:
10
10
  bindir: bin
11
- cert_chain:
12
- - |
13
- -----BEGIN CERTIFICATE-----
14
- MIIDBDCCAm2gAwIBAgIJAKPwEETU5bHoMA0GCSqGSIb3DQEBBQUAMGAxCzAJBgNV
15
- BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp
16
- c2NvMQ8wDQYDVQQKEwZTaXhBcm0xEzARBgNVBAMTCnNpeGFybS5jb20wHhcNMTAx
17
- MjEzMjMyNzEzWhcNMTMwOTA4MjMyNzEzWjBgMQswCQYDVQQGEwJVUzETMBEGA1UE
18
- CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEPMA0GA1UEChMG
19
- U2l4QXJtMRMwEQYDVQQDEwpzaXhhcm0uY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GN
20
- ADCBiQKBgQC94mD9JDwBsunsOI0VR3CXXbOWg9cWaWciwFyJNFiM7A9I8KPLfXUw
21
- QC4czUe5ZuG4WHvinrWhkrCK+1dWBqoEClxdF/FoKO5a+tonGCjjmfy81JmFjjyx
22
- eTsjsHyvw+Qik9kpf9aj6+pnkNrVswgNHVea2o9yabbEiS6VSeJWoQIDAQABo4HF
23
- MIHCMB0GA1UdDgQWBBQzPJtqmSgc53eDN7aSzDQwr9TALDCBkgYDVR0jBIGKMIGH
24
- gBQzPJtqmSgc53eDN7aSzDQwr9TALKFkpGIwYDELMAkGA1UEBhMCVVMxEzARBgNV
25
- BAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xDzANBgNVBAoT
26
- BlNpeEFybTETMBEGA1UEAxMKc2l4YXJtLmNvbYIJAKPwEETU5bHoMAwGA1UdEwQF
27
- MAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAooEexP/oPam1TP71SyuhxMb+uTrZbSQe
28
- jVB+ExRwWadGwaNPUA56d39qwavwP+iu+3JpeonNMVvbWXF5naCX/dNFIeREHzER
29
- ZDRQYMqru9TEMna6HD9zpcstF7vwThGovlOQ+3Y6plQ4nMzipXcZ9THqs65PIL0q
30
- eabwpCbAopo=
31
- -----END CERTIFICATE-----
32
-
33
- date: 2011-04-22 00:00:00 -07:00
34
- default_executable:
11
+ cert_chain:
12
+ - !binary |-
13
+ LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCRENDQW0yZ0F3SUJB
14
+ Z0lKQUtQd0VFVFU1YkhvTUEwR0NTcUdTSWIzRFFFQkJRVUFNR0F4Q3pBSkJn
15
+ TlYKQkFZVEFsVlRNUk13RVFZRFZRUUlFd3BEWVd4cFptOXlibWxoTVJZd0ZB
16
+ WURWUVFIRXcxVFlXNGdSbkpoYm1OcApjMk52TVE4d0RRWURWUVFLRXdaVGFY
17
+ aEJjbTB4RXpBUkJnTlZCQU1UQ25OcGVHRnliUzVqYjIwd0hoY05NVEF4Ck1q
18
+ RXpNak15TnpFeldoY05NVE13T1RBNE1qTXlOekV6V2pCZ01Rc3dDUVlEVlFR
19
+ R0V3SlZVekVUTUJFR0ExVUUKQ0JNS1EyRnNhV1p2Y201cFlURVdNQlFHQTFV
20
+ RUJ4TU5VMkZ1SUVaeVlXNWphWE5qYnpFUE1BMEdBMVVFQ2hNRwpVMmw0UVhK
21
+ dE1STXdFUVlEVlFRREV3cHphWGhoY20wdVky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21 00:00:00.000000000 Z
35
39
  dependencies: []
36
-
37
40
  description:
38
41
  email: sixarm@sixarm.com
39
42
  executables: []
40
-
41
43
  extensions: []
42
-
43
44
  extra_rdoc_files: []
44
-
45
- files:
45
+ files:
46
46
  - .gemtest
47
- - CHANGELOG.txt
48
- - INSTALL.txt
49
- - LICENSE.txt
50
47
  - Rakefile
51
- - README.rdoc
48
+ - README.md
52
49
  - VERSION
53
50
  - lib/sixarm_ruby_secure_token.rb
54
51
  - test/sixarm_ruby_secure_token_test.rb
55
- has_rdoc: true
56
52
  homepage: http://sixarm.com/
57
53
  licenses: []
58
-
59
54
  post_install_message:
60
55
  rdoc_options: []
61
-
62
- require_paths:
56
+ require_paths:
63
57
  - lib
64
- required_ruby_version: !ruby/object:Gem::Requirement
58
+ required_ruby_version: !ruby/object:Gem::Requirement
65
59
  none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: "0"
70
- required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
65
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: "0"
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
76
70
  requirements: []
77
-
78
71
  rubyforge_project:
79
- rubygems_version: 1.6.2
72
+ rubygems_version: 1.8.19
80
73
  signing_key:
81
74
  specification_version: 3
82
- summary: "SixArm.com \xC2\xBB Ruby \xC2\xBB SecureToken to generate a cryptographic string that is web-friendly and user-friendly"
83
- test_files:
75
+ summary: SixArm.com » Ruby » SecureToken to generate a cryptographic string that is
76
+ web-friendly and user-friendly
77
+ test_files:
84
78
  - test/sixarm_ruby_secure_token_test.rb
79
+ has_rdoc: true
metadata.gz.sig CHANGED
Binary file
@@ -1,5 +0,0 @@
1
- CHANGELOG
2
-
3
- 2011-04-22 1.3.0 Update to 32 characters
4
- 2011-04-21 1.2.2 End support for Ruby 1.8.6
5
-
@@ -1,32 +0,0 @@
1
-
2
- = SixArm.com Ruby Gem Install
3
-
4
-
5
- First-time users: add our gem certificate and source.
6
- When you do this once, it works for all our gems.
7
-
8
- sudo wget http://sixarm.com/sixarm.pem
9
- sudo gem cert --add sixarm.pem
10
- sudo gem sources --add http://sixarm.com
11
-
12
- Install the gem with advanced options.
13
-
14
- sudo gem install sixarm_ruby_secure_token --test --trust-policy HighSecurity
15
-
16
-
17
- == Notes
18
-
19
- Do you have any questions, comments, suggestions, or feedback?
20
- Let us know, we're happy to help. Our email is sixarm@sixarm.com
21
-
22
- Do you want to create your own high security gems?
23
- Learn how at http://www.rubygems.org/read/chapter/21
24
-
25
- To see your current gem certificate list:
26
-
27
- sudo gem cert --list
28
-
29
- Our cert looks like this:
30
-
31
- /C=US/ST=California/L=San Francisco/O=SixArm/CN=sixarm.com
32
-
@@ -1,12 +0,0 @@
1
- LICENSE
2
-
3
- You may choose any of these licenses:
4
-
5
- - CreativeCommons License, Non-commercial Share Alike
6
- - LGPL, GNU Lesser General Public License
7
- - MIT License
8
- - Ruby License
9
-
10
- THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
11
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@@ -1,17 +0,0 @@
1
- = SixArm.com » Ruby » SecureToken to generate a cryptographic string that is web\
2
-
3
- Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com
4
- Copyright:: Copyright (c) 2006-2010 Joel Parker Henderson
5
- License:: See LICENSE.txt
6
-
7
- Secure random token generator to create strong secure text tokens.
8
-
9
- ==Example
10
-
11
- SecureToken.new => "kavzwbnxremyqlkwtxoimxzqpofmpove"
12
-
13
- This generates a 32-character token of all lowercase letters,
14
- using Ruby's securerandom methods.
15
-
16
- SecureToken is a string, so you can do any string methods on it.
17
- You can change how tokens are randomly created, however you want.