nist_randomness_beacon 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/README.md +2 -0
- data/lib/nist_randomness_beacon/service_error.rb +0 -5
- data/lib/nist_randomness_beacon/version.rb +1 -1
- data/spec/cassettes/current.yml +4 -4
- data/spec/cassettes/last.yml +3 -3
- data/spec/cassettes/next.yml +4 -4
- data/spec/cassettes/previous.yml +4 -4
- data/spec/cassettes/start_chain.yml +3 -3
- data/spec/client_spec.rb +96 -31
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60bec41fd7c12774d5cf87dffad6e2346f365567
|
4
|
+
data.tar.gz: 14adb38c42e3007fc97e5a9ab1e096a209a036e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb10c03c63c4936bcf4bffd10a5ca3efc6f5ba0ca5f0fef5015515c57977113854d4f07a34d853eac2bf8073f3862462cdb13f824a81b76fd97d12d5028ce4c1
|
7
|
+
data.tar.gz: 3491fb797c160755f234e415ffeaa57dab229247a3c86cededed16a074a02ecd813bf8f9198f30ec3ccb3773e0a1922ea9599671198074689a3dd1f884d6048a
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# NIST Randomness Beacon
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/chaserx/nist_randomness_beacon.svg)](https://travis-ci.org/chaserx/nist_randomness_beacon)
|
4
|
+
|
3
5
|
A wrapper for the NIST Randomness Beacon 'cause sometimes you need to get
|
4
6
|
a 512-bit full-entropy bit-string programmatically. You never know.
|
5
7
|
|
data/spec/cassettes/current.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://beacon.nist.gov/rest/record/
|
5
|
+
uri: https://beacon.nist.gov/rest/record/1388534400
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -28,11 +28,11 @@ http_interactions:
|
|
28
28
|
- ARR/2.5
|
29
29
|
- ASP.NET
|
30
30
|
Date:
|
31
|
-
- Wed, 31 Dec 2014
|
31
|
+
- Wed, 31 Dec 2014 17:35:18 GMT
|
32
32
|
body:
|
33
33
|
encoding: UTF-8
|
34
34
|
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><record><version>Version
|
35
|
-
1.0</version><frequency>60</frequency><timeStamp>
|
35
|
+
1.0</version><frequency>60</frequency><timeStamp>1388534400</timeStamp><seedValue>6779AAB4D36251ADD2CBEF5B4E3CB4C6062CEEF2336D241FDDAE74CCE12B01E92DA101D5FA7DEA547CB3985318A0D67643AB865592F3AE46F8EB98B5553767B4</seedValue><previousOutputValue>C0ED0E79055DDE82AF1F81CF7A830774CFB7EA1C1BB996095E0B9CD40D6AC645DE128CD62250360EA9C901C1170F0D993253289BCC93270F62109AB4F443EC92</previousOutputValue><signatureValue>891CFD92B95B00664A5843D33518C47101972A58184376B329BFF17CABF7539DB1E7FAB9115DDFB2A84122DE9B74B6E6994F59313F5499FF20DF56E276A67D735725E919C18263232F64DD6529B4A22515AF14B6D33020F764B0A4ACECD06A8F64A0EF04DDC800E230EA5E756FFFE821638BCF2981CF3276F23F67A11C43668DD167506B55E25D6C57DC2B36AB0FE1E4A255A815F32B45B9972CA632C6639DD1C382687AAA39960528F9EA854791B82D7F55668749F763BB7B02D5145B0D7C20110842811258C3442277CAF44781B580C245D39DB8ACA6E58FD80D0249D9D82145792BD7D7D561AA1BE09EA0F7CFFF193F486C87D56F68FCC37E0D11693C1141</signatureValue><outputValue>AD99BBD71C840D5F2AF85953BD930758F4EB5E6D85EE83209713EDA6D4788B68362B283AACC949ED9E41E0452640F92343D20EBDC6161B1BD7C835FB7CB423CA</outputValue><statusCode>0</statusCode></record>
|
36
36
|
http_version:
|
37
|
-
recorded_at: Wed, 01 Jan 2014
|
37
|
+
recorded_at: Wed, 01 Jan 2014 00:00:00 GMT
|
38
38
|
recorded_with: VCR 2.9.3
|
data/spec/cassettes/last.yml
CHANGED
@@ -28,11 +28,11 @@ http_interactions:
|
|
28
28
|
- ARR/2.5
|
29
29
|
- ASP.NET
|
30
30
|
Date:
|
31
|
-
- Wed, 31 Dec 2014
|
31
|
+
- Wed, 31 Dec 2014 17:35:18 GMT
|
32
32
|
body:
|
33
33
|
encoding: UTF-8
|
34
34
|
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><record><version>Version
|
35
|
-
1.0</version><frequency>60</frequency><timeStamp>
|
35
|
+
1.0</version><frequency>60</frequency><timeStamp>1420047300</timeStamp><seedValue>134CC13A1919C6A4D5B5D59FCFE232E9341E02F1AFBC983EF8AB71B1ED1BC9A8DC236F2AB674D996572AEFD3D35C4935D99458AC505FFAA62975BB7893E3084D</seedValue><previousOutputValue>F5EEB6D7A32B96C65B54D0330184CAE5E766B5C536DBA52F4C772A0251CDD1E1B6A8F5EBABAD088A542128B4D6E7F19C7213AC2ABFFE9A215EDABAD10FDCAE0B</previousOutputValue><signatureValue>566686E928DA02502347A404EB229D2E519B5CE8BF659C2DD2EC410C235DD207112F35E47DBA3BF86A44F29BA1A225FB1684D671BFC23D5E258942381E84C7D56FFF1B635500E5FE5ACFFF88890CB6045D372D48A7F8DF06EBEA7E2545C92D616EB689A856F32503E578A80D6691E17938BF179C3184E369DC6C3C6346DCB6FF814F7B530232CC2BFE3A3C1CC58D475826B29A4A83079A4A5C9D251171960B4FEFFE85532BD5D1D8DE00905BA987B072C8F3107CFE31B5EB3395FAC8E5E23A2037DD21D5CEA68756C872DF62CE73222DABC8205FAAAEFE414AEBE017F277D938669C1AFC5756CB1674FDBF4761C81173A1FDD856E0FEB531829FBAE6A27C4D16</signatureValue><outputValue>7C8704B82E9A0F9D210DF1B20C6B76330B686DEC06B50BCCC279B793810938C19525F699E6B2F74C3CC5DB96A605C4C0795F7EAC342001F417877126AE779943</outputValue><statusCode>0</statusCode></record>
|
36
36
|
http_version:
|
37
|
-
recorded_at: Wed, 01 Jan 2014
|
37
|
+
recorded_at: Wed, 01 Jan 2014 00:00:00 GMT
|
38
38
|
recorded_with: VCR 2.9.3
|
data/spec/cassettes/next.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://beacon.nist.gov/rest/record/next/
|
5
|
+
uri: https://beacon.nist.gov/rest/record/next/1388534400
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -28,11 +28,11 @@ http_interactions:
|
|
28
28
|
- ARR/2.5
|
29
29
|
- ASP.NET
|
30
30
|
Date:
|
31
|
-
- Wed, 31 Dec 2014
|
31
|
+
- Wed, 31 Dec 2014 17:35:17 GMT
|
32
32
|
body:
|
33
33
|
encoding: UTF-8
|
34
34
|
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><record><version>Version
|
35
|
-
1.0</version><frequency>60</frequency><timeStamp>
|
35
|
+
1.0</version><frequency>60</frequency><timeStamp>1388534460</timeStamp><seedValue>18F9020613775ADBAE42380DC6C5B4D14B271ACD127072DD8F6B186043BF12B96E9340A7A43E1EB83A20ED6F1EF3FCEF08A0F6314368D5E578C80AC34CC0D4A8</seedValue><previousOutputValue>AD99BBD71C840D5F2AF85953BD930758F4EB5E6D85EE83209713EDA6D4788B68362B283AACC949ED9E41E0452640F92343D20EBDC6161B1BD7C835FB7CB423CA</previousOutputValue><signatureValue>EB23375728297EC81D3D37C8BCF5BB1590ED9EC4F7A7508FC7141488137A8544D780109224C5595166723AFFD092EF02D89C4AF16F891797338AF1FAB11C37ADE474D8E056646ECADFB1EE54DCCA4941A1D8CE81F40953F835C4DB82E081CBEBCEDACDF33F20A9364A3D4EA11B7230378A8AEBF07CDC232A628DD98685EA6652C3BC82A63602C09C0EEFADEE8D282ADBF20A1717895FAEC06A567C494916FFFFBCE192D0FBEFEBBFAFA8BA7FD7DEB1986042860025CE9DC472352F9B6571A7D87AB12DCB418056C691AF91AE65DF4B825F4C169547E713EE49E2346145880D21E213B030114B1670C8A6B4CDC6830A1196DEF5A92C6251912ECEB4290F4FF887</signatureValue><outputValue>D75C4DDA773D9E3CA2A25EACF891B4162369FE9745A4FB87F11D622F8878533BEAA34A6BAB308AF0954A4808A67C6ABBA20B20CA5EA8591753340200F9BAB2F2</outputValue><statusCode>0</statusCode></record>
|
36
36
|
http_version:
|
37
|
-
recorded_at: Wed, 01 Jan 2014
|
37
|
+
recorded_at: Wed, 01 Jan 2014 00:00:00 GMT
|
38
38
|
recorded_with: VCR 2.9.3
|
data/spec/cassettes/previous.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://beacon.nist.gov/rest/record/previous/
|
5
|
+
uri: https://beacon.nist.gov/rest/record/previous/1388534400
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -28,11 +28,11 @@ http_interactions:
|
|
28
28
|
- ARR/2.5
|
29
29
|
- ASP.NET
|
30
30
|
Date:
|
31
|
-
- Wed, 31 Dec 2014
|
31
|
+
- Wed, 31 Dec 2014 17:35:17 GMT
|
32
32
|
body:
|
33
33
|
encoding: UTF-8
|
34
34
|
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><record><version>Version
|
35
|
-
1.0</version><frequency>60</frequency><timeStamp>
|
35
|
+
1.0</version><frequency>60</frequency><timeStamp>1388534340</timeStamp><seedValue>C06703BB1C9779ECD26C439F415FE0AA8957A1BCF47E0B4F54F9FD422B68FB8DF3A804CE93F8B7650B42A7D364A7A14DE3F682EB38E5E27CB83C17681135D9C7</seedValue><previousOutputValue>94C1596B5B04B4891A77FE45886500094D04DBF7F329B0004EC75B3EC34B50B475D303F0CF05EDA210091A0727E1B5972D0A62C479F5CD32ADDF93FD6CA513D8</previousOutputValue><signatureValue>5766247F2ADEB64853362233A41678448EFE32DF918E6F61FE27B21A62C8713E97B745F536BFD241A98A398D2854E968142240C006163BF5CF59F9E5ACBBC61D99AA6E84E647E32243EFA69DBE8A7699724687F516A60E30400C07E28B344B39D51A8F15A0DEB5AE187DE86DE3BFE2AD959A74C35DA5AD966D5B5932F4A78782F3C30244EE0870DD2BA9CFD0D47541EB8CE1E145CD7C26AD662825EAA0F3DE565545A44AE8572A5FB8FE43B0B43D6F13DF0066BCBD09195AC94EB48DB2D719946EB83D3255EFFEC22DB22D42070DED5C9B5FAE38C6C348AB44C33574CDFE342FD67DD69C815892DD396E0BDE882C4312D0DDBC26EFB0A475AF00CA3F55600A05</signatureValue><outputValue>C0ED0E79055DDE82AF1F81CF7A830774CFB7EA1C1BB996095E0B9CD40D6AC645DE128CD62250360EA9C901C1170F0D993253289BCC93270F62109AB4F443EC92</outputValue><statusCode>0</statusCode></record>
|
36
36
|
http_version:
|
37
|
-
recorded_at: Wed, 01 Jan 2014
|
37
|
+
recorded_at: Wed, 01 Jan 2014 00:00:00 GMT
|
38
38
|
recorded_with: VCR 2.9.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://beacon.nist.gov/rest/record/start-chain/
|
5
|
+
uri: https://beacon.nist.gov/rest/record/start-chain/1388534400
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -28,11 +28,11 @@ http_interactions:
|
|
28
28
|
- ARR/2.5
|
29
29
|
- ASP.NET
|
30
30
|
Date:
|
31
|
-
- Wed, 31 Dec 2014
|
31
|
+
- Wed, 31 Dec 2014 17:35:19 GMT
|
32
32
|
body:
|
33
33
|
encoding: UTF-8
|
34
34
|
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><record><version>Version
|
35
35
|
1.0</version><frequency>60</frequency><timeStamp>1378395540</timeStamp><seedValue>87F49DB997D2EED0B4FDD93BAA4CDFCA49095AF98E54B81F2C39B5C4002EC04B8C9E31FA537E64AC35FA2F038AA80730B054CFCF371AB5584CFB4EFD293280EE</seedValue><previousOutputValue>00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</previousOutputValue><signatureValue>F93BBE5714944F31983AE8187D5D94F87FFEC2F98185F9EB4FE5DB61A9E5119FB0756E9AF4B7112DEBF541E9E53D05346B7358C12FA43A8E0D695BFFAF193B1C3FFC4AE7BCF6651812B6D60190DB8FF23C9364374737F45F1A89F22E1E492B0F373E4DB523274E9D31C86987C64A26F507008828A358B0E166A197D433597480895E9298C60D079673879C3C1AEDA6306C3201991D0A6778B21462BDEBB8D3776CD3D0FA0325AFE99B2D88A7C357E62170320EFB51F9749B5C7B9E7347178AB051BDD097B226664A2D64AF1557BB31540601849F0BE3AAF31D7A25E2B358EEF5A346937ADE34A110722DA8C037F973350B3846DCAB16C9AA125F2027C246FDB3</signatureValue><outputValue>17070B49DBF3BA12BEA427CB6651ECF7860FDC3792268031B77711D63A8610F4CDA551B7FB331103889A62E2CB23C0F85362BBA49B9E0086D1DA0830E4389AB1</outputValue><statusCode>1</statusCode></record>
|
36
36
|
http_version:
|
37
|
-
recorded_at: Wed, 01 Jan 2014
|
37
|
+
recorded_at: Wed, 01 Jan 2014 00:00:00 GMT
|
38
38
|
recorded_with: VCR 2.9.3
|
data/spec/client_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe NISTRandomnessBeacon::Client do
|
5
5
|
before do
|
6
|
-
Timecop.freeze(Time.
|
6
|
+
Timecop.freeze(Time.utc(2014))
|
7
7
|
end
|
8
8
|
|
9
9
|
after do
|
@@ -11,62 +11,127 @@ describe NISTRandomnessBeacon::Client do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'current' do
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
context 'successful response' do
|
15
|
+
subject {
|
16
|
+
VCR.use_cassette('current') do
|
17
|
+
NISTRandomnessBeacon::Client.new.current
|
18
|
+
end
|
19
|
+
}
|
20
|
+
|
21
|
+
it 'returns a record object' do
|
22
|
+
expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
|
17
23
|
end
|
18
|
-
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'problematic response' do
|
27
|
+
subject {
|
28
|
+
NISTRandomnessBeacon::Client.new.current
|
29
|
+
}
|
19
30
|
|
20
|
-
|
21
|
-
|
31
|
+
it 'raises service error' do
|
32
|
+
stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
|
33
|
+
expect{subject}.to raise_error
|
34
|
+
end
|
22
35
|
end
|
23
36
|
end
|
24
37
|
|
25
38
|
describe 'previous' do
|
26
|
-
|
27
|
-
|
28
|
-
|
39
|
+
context 'successful response' do
|
40
|
+
subject {
|
41
|
+
VCR.use_cassette('previous') do
|
42
|
+
NISTRandomnessBeacon::Client.new.previous
|
43
|
+
end
|
44
|
+
}
|
45
|
+
|
46
|
+
it 'returns a record object' do
|
47
|
+
expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
|
29
48
|
end
|
30
|
-
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'problematic response' do
|
52
|
+
subject {
|
53
|
+
NISTRandomnessBeacon::Client.new.previous
|
54
|
+
}
|
31
55
|
|
32
|
-
|
33
|
-
|
56
|
+
it 'raises service error' do
|
57
|
+
stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
|
58
|
+
expect{subject}.to raise_error
|
59
|
+
end
|
34
60
|
end
|
35
61
|
end
|
36
62
|
|
37
63
|
describe 'next' do
|
38
|
-
|
39
|
-
|
40
|
-
|
64
|
+
context 'successful response' do
|
65
|
+
subject {
|
66
|
+
VCR.use_cassette('next') do
|
67
|
+
NISTRandomnessBeacon::Client.new.next
|
68
|
+
end
|
69
|
+
}
|
70
|
+
|
71
|
+
it 'returns a record object' do
|
72
|
+
expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
|
41
73
|
end
|
42
|
-
|
74
|
+
end
|
43
75
|
|
44
|
-
|
45
|
-
|
76
|
+
context 'problematic response' do
|
77
|
+
subject {
|
78
|
+
NISTRandomnessBeacon::Client.new.next
|
79
|
+
}
|
80
|
+
|
81
|
+
it 'raises service error' do
|
82
|
+
stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
|
83
|
+
expect{subject}.to raise_error
|
84
|
+
end
|
46
85
|
end
|
47
86
|
end
|
48
87
|
|
49
88
|
describe 'last' do
|
50
|
-
|
51
|
-
|
52
|
-
|
89
|
+
context 'successful response' do
|
90
|
+
subject {
|
91
|
+
VCR.use_cassette('last') do
|
92
|
+
NISTRandomnessBeacon::Client.new.last
|
93
|
+
end
|
94
|
+
}
|
95
|
+
|
96
|
+
it 'returns a record object' do
|
97
|
+
expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
|
53
98
|
end
|
54
|
-
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'problematic response' do
|
102
|
+
subject {
|
103
|
+
NISTRandomnessBeacon::Client.new.current
|
104
|
+
}
|
55
105
|
|
56
|
-
|
57
|
-
|
106
|
+
it 'raises service error' do
|
107
|
+
stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
|
108
|
+
expect{subject}.to raise_error
|
109
|
+
end
|
58
110
|
end
|
59
111
|
end
|
60
112
|
|
61
113
|
describe 'start chain' do
|
62
|
-
|
63
|
-
|
64
|
-
|
114
|
+
context 'successful response' do
|
115
|
+
subject {
|
116
|
+
VCR.use_cassette('start_chain') do
|
117
|
+
NISTRandomnessBeacon::Client.new.start_chain
|
118
|
+
end
|
119
|
+
}
|
120
|
+
|
121
|
+
it 'returns a record object' do
|
122
|
+
expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
|
65
123
|
end
|
66
|
-
|
124
|
+
end
|
67
125
|
|
68
|
-
|
69
|
-
|
126
|
+
context 'problematic response' do
|
127
|
+
subject {
|
128
|
+
NISTRandomnessBeacon::Client.new.start_chain
|
129
|
+
}
|
130
|
+
|
131
|
+
it 'raises service error' do
|
132
|
+
stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
|
133
|
+
expect{subject}.to raise_error
|
134
|
+
end
|
70
135
|
end
|
71
136
|
end
|
72
137
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nist_randomness_beacon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chase Southard
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -176,6 +176,7 @@ extra_rdoc_files: []
|
|
176
176
|
files:
|
177
177
|
- ".gitignore"
|
178
178
|
- ".rspec"
|
179
|
+
- ".travis.yml"
|
179
180
|
- CONTRIBUTING.md
|
180
181
|
- Gemfile
|
181
182
|
- LICENSE.txt
|