sixarm_ruby_xid 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gemtest +0 -0
- data/CONTRIBUTING.md +28 -0
- data/README.md +113 -0
- data/Rakefile +10 -0
- data/VERSION +1 -0
- data/lib/sixarm_ruby_xid.rb +14 -0
- data/test/sixarm_ruby_xid_test.rb +28 -0
- metadata +79 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4eb5fb0a077dc0f211a20f10c65c65b5f6a7745e
|
4
|
+
data.tar.gz: d2f7fb50c2a0363c308e31d054338ccfc696fdb6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 63f43cd85cf5c7ae3a0a53dad2605494dece765a44bbaab1c0b5116d7dcf1a52360fa2d24c1ae20223a64962bafdde768cae64ab50b064ce80e5a0eb5a95437b
|
7
|
+
data.tar.gz: 7bbbf160d7499466bad2e12e4e52fc73a7be39184c884732a7c653797fd85263bb98126bef6a736723d60ea464f9b22fe7d268d5571bd7af5701b1fb32a89ac7
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/.gemtest
ADDED
File without changes
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
Thank you for contributing!
|
4
|
+
|
5
|
+
If you would like to contribute a donation, an easy way is to use PayPal to sixarm@sixarm.com.
|
6
|
+
|
7
|
+
If you would like to contribute help, the next section is for you.
|
8
|
+
|
9
|
+
|
10
|
+
## Contributing to the source
|
11
|
+
|
12
|
+
We love pull requests for improvments to the source code and documentation.
|
13
|
+
|
14
|
+
There are three easy steps:
|
15
|
+
|
16
|
+
1. Fork the repo.
|
17
|
+
|
18
|
+
* Before you do any work please run our existing tests to make sure the code runs cleanly.
|
19
|
+
|
20
|
+
2. Work as you like.
|
21
|
+
|
22
|
+
* Please create tests. This helps us know that all your code runs cleanly.
|
23
|
+
|
24
|
+
3. Push to your fork and submit a pull request.
|
25
|
+
|
26
|
+
* We'll take a look as soon as we can; this is typically within a business day.
|
27
|
+
|
28
|
+
Thank you again!
|
data/README.md
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# SixArm.com » Ruby » <br> SecureToken to generate a random string
|
2
|
+
|
3
|
+
[![Code Climate](https://codeclimate.com/github/SixArm/xid.png)](https://codeclimate.com/github/SixArm/xid)
|
4
|
+
[![Build Status](https://travis-ci.org/SixArm/xid.png)](https://travis-ci.org/SixArm/xid)
|
5
|
+
|
6
|
+
* Doc: <http://sixarm.com/sixarm_ruby_xid/doc>
|
7
|
+
* Gem: <http://rubygems.org/gems/sixarm_ruby_xid>
|
8
|
+
* Repo: <http://github.com/sixarm/sixarm_ruby_xid>
|
9
|
+
* Email: Joel Parker Henderson, <joel@sixarm.com>
|
10
|
+
|
11
|
+
|
12
|
+
## Introduction
|
13
|
+
|
14
|
+
XID is a secure identifier string. It is much like a UUID (Universally Unique Identifier). The XID has a more-specific specfication, faster creation algorithms, faster comparison algorithms, and is fully translatable to a UUID if necessary.
|
15
|
+
|
16
|
+
XID specification:
|
17
|
+
|
18
|
+
* 128 bit.
|
19
|
+
* Completely random.
|
20
|
+
* Generated with a secure random generator.
|
21
|
+
* The string representation is entirely hexidecimal: digits 0-9 and lowercase a-f.
|
22
|
+
|
23
|
+
Comparison with UUID:
|
24
|
+
|
25
|
+
* The XID and UUID are both 128 bit.
|
26
|
+
* The XID has one form. The UUID has multiple forms, called variants and versions.
|
27
|
+
* The XID is completely random. The UUID may have non-random pieces, such as a MAC sequence, and a fixed bit for the variant and version.
|
28
|
+
* The XID specification requires the use of a secure random generator. The UUID has no guarantee.
|
29
|
+
* The XID uses digits 0-9 and lowecase a-f. The UUID canoncical form uses dashes to separate sequencies, and can use uppercase or lowercase.
|
30
|
+
|
31
|
+
Example:
|
32
|
+
|
33
|
+
XID.new
|
34
|
+
#=> "90f44e35a062479289ff75ab2abc0ed3"
|
35
|
+
|
36
|
+
|
37
|
+
For docs go to <http://sixarm.com/sixarm_ruby_xid/doc>
|
38
|
+
|
39
|
+
Want to help? We're happy to get pull requests.
|
40
|
+
|
41
|
+
|
42
|
+
## Install quickstart
|
43
|
+
|
44
|
+
Install:
|
45
|
+
|
46
|
+
gem install sixarm_ruby_xid
|
47
|
+
|
48
|
+
Bundler:
|
49
|
+
|
50
|
+
gem "sixarm_ruby_xid", ">=3.0.0", "<4"
|
51
|
+
|
52
|
+
Require:
|
53
|
+
|
54
|
+
require "sixarm_ruby_xid"
|
55
|
+
|
56
|
+
|
57
|
+
## Install with security (optional)
|
58
|
+
|
59
|
+
To enable high security for all our gems:
|
60
|
+
|
61
|
+
wget http://sixarm.com/sixarm.pem
|
62
|
+
gem cert --add sixarm.pem
|
63
|
+
gem sources --add http://sixarm.com
|
64
|
+
|
65
|
+
To install with high security:
|
66
|
+
|
67
|
+
gem install sixarm_ruby_xid --trust-policy HighSecurity
|
68
|
+
|
69
|
+
|
70
|
+
## Details
|
71
|
+
|
72
|
+
This uses Ruby's SecureRandom methods for strong security.
|
73
|
+
|
74
|
+
SecureToken is a string, so you can do any string methods on it.
|
75
|
+
|
76
|
+
|
77
|
+
## Changes
|
78
|
+
|
79
|
+
* 2015-02-11 3.0.0 Upgrade to XID
|
80
|
+
* 2013-08-20 2.1.0 Add #next to enable using this as an enumeration.
|
81
|
+
* 2013-08-18 2.0.0 Upgrade for Ruby 2.0.0; add .length and .choices methods.
|
82
|
+
* 2012-03-21 1.4.0 Upgrade for Ruby 1.9.3, minitest/spec, and improved docs.
|
83
|
+
* 2011-04-22 1.3.0 Update to 32 characters
|
84
|
+
* 2011-04-21 1.2.2 End support for Ruby 1.8.6
|
85
|
+
|
86
|
+
|
87
|
+
## License
|
88
|
+
|
89
|
+
You may choose any of these open source licenses:
|
90
|
+
|
91
|
+
* Apache License
|
92
|
+
* BSD License
|
93
|
+
* CreativeCommons License, Non-commercial Share Alike
|
94
|
+
* GNU General Public License Version 2 (GPL 2)
|
95
|
+
* GNU Lesser General Public License (LGPL)
|
96
|
+
* MIT License
|
97
|
+
* Perl Artistic License
|
98
|
+
* Ruby License
|
99
|
+
|
100
|
+
The software is provided "as is", without warranty of any kind,
|
101
|
+
express or implied, including but not limited to the warranties of
|
102
|
+
merchantability, fitness for a particular purpose and noninfringement.
|
103
|
+
|
104
|
+
In no event shall the authors or copyright holders be liable for any
|
105
|
+
claim, damages or other liability, whether in an action of contract,
|
106
|
+
tort or otherwise, arising from, out of or in connection with the
|
107
|
+
software or the use or other dealings in the software.
|
108
|
+
|
109
|
+
This license is for the included software that is created by SixArm;
|
110
|
+
some of the included software may have its own licenses, copyrights,
|
111
|
+
authors, etc. and these do take precedence over the SixArm license.
|
112
|
+
|
113
|
+
Copyright (c) 2005-2015 Joel Parker Henderson
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.0
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'minitest/autorun'
|
3
|
+
Minitest::Test ||= MiniTest::Unit::TestCase
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start
|
6
|
+
require 'xid'
|
7
|
+
|
8
|
+
describe XID do
|
9
|
+
|
10
|
+
describe "#new" do
|
11
|
+
|
12
|
+
it "is a string with the correct length and characters" do
|
13
|
+
xid = XID.new
|
14
|
+
xid.must_match /\A[0-9a-z]{32}\Z/
|
15
|
+
end
|
16
|
+
|
17
|
+
it "is always different" do
|
18
|
+
seen = Set.new
|
19
|
+
999999.times.each{
|
20
|
+
xid = XID.new
|
21
|
+
seen.include?(xid).must_equal false
|
22
|
+
seen.add(xid)
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sixarm_ruby_xid
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- SixArm
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDbDCCAlSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQ8wDQYDVQQDDAZzaXhh
|
14
|
+
cm0xFjAUBgoJkiaJk/IsZAEZFgZzaXhhcm0xEzARBgoJkiaJk/IsZAEZFgNjb20w
|
15
|
+
HhcNMTQwMzEzMDQyMjE4WhcNMTUwMzEzMDQyMjE4WjA+MQ8wDQYDVQQDDAZzaXhh
|
16
|
+
cm0xFjAUBgoJkiaJk/IsZAEZFgZzaXhhcm0xEzARBgoJkiaJk/IsZAEZFgNjb20w
|
17
|
+
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC5MZYB72Amo9DyeqBdJeEx
|
18
|
+
r4togM0+diNuL1nCH2FSO/+LX5L9mTPEEW5gexYCasmlOfmk5255EToJNtu1JUM/
|
19
|
+
dMqUbNS5LZ1srFVcyDzIe/wQ9f2OSmb+lAGmlnFLfYSpduMv9fPNISlcs5nFYSR9
|
20
|
+
mpS0kTWcXQPLNDl2cfnkYYjDsuyJ8FmDyG7TTF0c4OWJNLxNDE8To2n8GmmDSwr3
|
21
|
+
0K71F278CJlFoIaSSjnhKxkH8/l+z/Vs58KkjX/7M6nwNgNZMQaFBIO02UDtCi2F
|
22
|
+
ICVtDuWdK0YLv3JnIzvSQPQsfArrw2s8RVKjXlelPMeHJIcCEZcS4K6HIg7vQCkP
|
23
|
+
AgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQrbLvF
|
24
|
+
TNv9r72z+hpCl3BkTPbzwTAcBgNVHREEFTATgRFzaXhhcm1Ac2l4YXJtLmNvbTAc
|
25
|
+
BgNVHRIEFTATgRFzaXhhcm1Ac2l4YXJtLmNvbTANBgkqhkiG9w0BAQUFAAOCAQEA
|
26
|
+
H08J7cTJyfm4mXpdM0FFr/f/syQSl2ymJWtcosuKA79A/vYMZ+n9B1gpuJmegjNt
|
27
|
+
lmYByeU50jJJ7JNdkvkTagHCZaxtzclWx6AR5gTd8V/sBKbTWtHe72pOWz/stQs2
|
28
|
+
xD8tQZvdAuBtRXx4ys6e3vigvYjdmTHUR9tT/NGCwmWj7KTk3mwNKBmuQGWTVWrV
|
29
|
+
h6r4cFMt3X5Zu+euYxHqDuwWyub9hp4s30/ea38CoYNdIZcSFtpGuvhwVDU0x5dg
|
30
|
+
sWRVEyjnjnNuAeLP9zv43IDXjS22L2efhap7IOinYjcecpfXJgQaU+6BFAY4sdkQ
|
31
|
+
S1STYSfs3qySBxxAeEyZTw==
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2015-02-11 00:00:00.000000000 Z
|
34
|
+
dependencies: []
|
35
|
+
description: XID.new generates a new string suitable for security, authentication,
|
36
|
+
tracking, etc.
|
37
|
+
email: sixarm@sixarm.com
|
38
|
+
executables: []
|
39
|
+
extensions: []
|
40
|
+
extra_rdoc_files: []
|
41
|
+
files:
|
42
|
+
- ".gemtest"
|
43
|
+
- CONTRIBUTING.md
|
44
|
+
- README.md
|
45
|
+
- Rakefile
|
46
|
+
- VERSION
|
47
|
+
- lib/sixarm_ruby_xid.rb
|
48
|
+
- test/sixarm_ruby_xid_test.rb
|
49
|
+
homepage: http://sixarm.com/
|
50
|
+
licenses:
|
51
|
+
- BSD
|
52
|
+
- GPL
|
53
|
+
- MIT
|
54
|
+
- PAL
|
55
|
+
- Various
|
56
|
+
metadata: {}
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 2.4.5
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: SixArm.com » Ruby » XID secure identifier
|
77
|
+
test_files:
|
78
|
+
- test/sixarm_ruby_xid_test.rb
|
79
|
+
has_rdoc: true
|
metadata.gz.sig
ADDED
Binary file
|