nist_randomness_beacon 0.1.7 → 0.2.0

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
- SHA1:
3
- metadata.gz: 5fdfa907aecca08fca6ba1dd76638df771a598a8
4
- data.tar.gz: '0191294db5a3b0d67e99cb497140dfe5e19645e4'
2
+ SHA256:
3
+ metadata.gz: 5d84a094e880dfa0cf007c5eee7bca6a25109ad2127373bc2d936a010b302a60
4
+ data.tar.gz: 9741e71ea2db4ee551625ef1ffe3e178fc1933a22492844622b3b7fbb951b86c
5
5
  SHA512:
6
- metadata.gz: 14451d6e739f74a23c6780464536c0024e3e431d3f29b853fcb2749469732e16ec9510762e13f8f1f6d009ab04176a8a693577604c7ca002b286864fa262c5ba
7
- data.tar.gz: 8170463c2f19881212d912c43ddfe3d30cf0207234c4d174d2ea4112af75efa49717f4d807d3f0ebcac58f6a59091caacb2d59a26516b84fccc34db5fab5fbfd
6
+ metadata.gz: 5898938bb0df50eda64dd1541ee5f7c98040840db3bd9ad7f24e17a5cef82d2bed8e02e11b3e807db8b88857be5840e54f5791c31a9572a78eb52817149a6cc4
7
+ data.tar.gz: e294a9451c17cb8e636d20af4e442a22b4cd90ead8233d04af0d8f8f696679573891ec76817e71dab38e083032fce6b0143d6a19a2b84d81568fdcdf78e0a34b
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.5.0
3
4
  - 2.4.0
4
5
  - 2.3.0
5
- - 2.2.0
6
6
  script: bundle exec rspec spec
@@ -0,0 +1,46 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at chase.southard@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
+
45
+ [homepage]: http://contributor-covenant.org
46
+ [version]: http://contributor-covenant.org/version/1/4/
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Chase Southard
1
+ Copyright (c) 2014 Chase Southard except where specified.
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -50,6 +50,18 @@ record.output_value
50
50
  WARNING: DO NOT USE BEACON-GENERATED VALUES AS SECRET CRYPTOGRAPHIC KEYS. See
51
51
  [this StackExchange thread](http://crypto.stackexchange.com/questions/15225/how-useful-is-nists-randomness-beacon-for-cryptographic-use).
52
52
 
53
+ ## Documentation
54
+
55
+ You can generate docs locally with the command `rake yard`.
56
+
57
+ You can [view the docs](http://www.rubydoc.info/gems/nist_randomness_beacon) for the latest release at RubyDoc.info.
58
+
53
59
  ## Contributing
54
60
 
55
61
  Pull requests welcome! Please see the [contribution guide](CONTRIBUTING.md).
62
+
63
+ ## License
64
+
65
+ MIT License
66
+
67
+ Some documents were produced and provided by NIST.
@@ -0,0 +1,14 @@
1
+ # Add underscore string transformation like rails does.
2
+ # http://stackoverflow.com/a/1509939/281699
3
+ #
4
+ module Underscore
5
+ refine String do
6
+ def underscore
7
+ self.gsub(/::/, '/').
8
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
9
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
10
+ tr("-", "_").
11
+ downcase
12
+ end
13
+ end
14
+ end
@@ -2,4 +2,4 @@ require_relative 'nist_randomness_beacon/version'
2
2
  require_relative 'nist_randomness_beacon/client'
3
3
  require_relative 'nist_randomness_beacon/record'
4
4
  require_relative 'nist_randomness_beacon/service_error'
5
- require_relative 'nist_randomness_beacon/underscore'
5
+ require_relative 'core_extensions/string/underscore'
@@ -2,20 +2,20 @@ require 'httparty'
2
2
  require 'json'
3
3
 
4
4
  module NISTRandomnessBeacon
5
- # Client to the Randomness Beacon API
5
+ # Client to the NIST Randomness Beacon API
6
6
  class Client
7
- DEFAULT_URI = 'https://beacon.nist.gov/rest/record'.freeze
7
+ DEFAULT_URI = 'https://beacon.nist.gov/beacon/1.0/pulse'.freeze
8
8
 
9
9
  include HTTParty
10
10
  attr_reader :timestamp, :uri
11
11
 
12
- def initialize time=nil, uri=DEFAULT_URI
12
+ def initialize(time=nil, uri=DEFAULT_URI)
13
13
  @timestamp = (time || Time.now).to_i
14
14
  @uri = uri
15
15
  end
16
16
 
17
- # Returns the Current Record (or next closest)
18
- # https://beacon.nist.gov/rest/record/<timestamp>
17
+ # Returns the Current Record (or next closest AFTER the timestamp)
18
+ # https://<server name>/<context>/beacon/1.0/pulse/<timestamp>
19
19
  #
20
20
  def current
21
21
  response = self.class.get("#@uri/#@timestamp")
@@ -23,7 +23,7 @@ module NISTRandomnessBeacon
23
23
  end
24
24
 
25
25
  # Returns the Previous Record
26
- # https://beacon.nist.gov/rest/record/previous/<timestamp>
26
+ # https://<server name>/<context>/beacon/1.0/pulse/previous/<timestamp>
27
27
  #
28
28
  def previous
29
29
  response = self.class.get("#@uri/previous/#@timestamp")
@@ -31,7 +31,7 @@ module NISTRandomnessBeacon
31
31
  end
32
32
 
33
33
  # Returns the Next Record
34
- # https://beacon.nist.gov/rest/record/next/<timestamp>
34
+ # https://<server name>/<context>/beacon/1.0/pulse/next/<timestamp>
35
35
  #
36
36
  def next
37
37
  response = self.class.get("#@uri/next/#@timestamp")
@@ -39,7 +39,7 @@ module NISTRandomnessBeacon
39
39
  end
40
40
 
41
41
  # Returns the Last Record
42
- # https://beacon.nist.gov/rest/record/last
42
+ # https://<server name>/<context>/beacon/1.0/pulse/last
43
43
  #
44
44
  def last
45
45
  response = self.class.get("#@uri/last")
@@ -47,7 +47,7 @@ module NISTRandomnessBeacon
47
47
  end
48
48
 
49
49
  # Returns the Start Chain Record
50
- # https://beacon.nist.gov/rest/record/start-chain/<timestamp>
50
+ # https://<server name>/<context>/beacon/1.0/pulse/start-chain/<timestamp>
51
51
  #
52
52
  def start_chain
53
53
  response = self.class.get("#@uri/start-chain/#@timestamp")
@@ -56,9 +56,9 @@ module NISTRandomnessBeacon
56
56
 
57
57
  private
58
58
 
59
- def create_new_record response, response_code=200
59
+ def create_new_record(response, response_code=200)
60
60
  raise ServiceError, response.body unless response.code.eql? response_code
61
- NISTRandomnessBeacon::Record.new(response.parsed_response['record'])
61
+ NISTRandomnessBeacon::Record.new(response.parsed_response['pulse'])
62
62
  end
63
63
  end
64
64
  end
@@ -1,13 +1,27 @@
1
1
  module NISTRandomnessBeacon
2
2
  class Record
3
+ require_relative '../core_extensions/string/underscore'
4
+ using Underscore
3
5
  attr_reader :version, :frequency, :time_stamp, :seed_value,
4
- :previous_output_value, :signature_value, :output_value,
5
- :status_code
6
+ :signature_value, :output_value, :status_code, :certificate_id,
7
+ :list_values, :local_random_value, :external,
8
+ :precommitment_value, :signature_value, :humanized_status_code
6
9
 
7
- def initialize args={}
10
+ def initialize(args={})
8
11
  args.each do |k, v|
9
12
  instance_variable_set("@#{k}".underscore, v) unless v.nil?
10
13
  end
11
14
  end
15
+
16
+ def humanized_status_code
17
+ return unless status_code
18
+ codes = {
19
+ 0 => 'Chain intact, values all good',
20
+ 1 => 'Start of a new chain of values, previous hash value will be all zeroes',
21
+ 2 => 'Time between values is greater than the frequency, but the chain is still intact',
22
+ 3 => 'Time between values is greater than the frequency, the chain is intact, but the input of the prior precommitmentValue was lost'
23
+ }
24
+ codes[status_code]
25
+ end
12
26
  end
13
27
  end
@@ -1,3 +1,3 @@
1
1
  module NISTRandomnessBeacon
2
- VERSION = "0.1.7"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,330 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <xs:schema
3
+ xmlns="http://csrc.nist.gov/ns/beacon/pulse/1.0"
4
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
5
+ targetNamespace="http://csrc.nist.gov/ns/beacon/pulse/1.0"
6
+ elementFormDefault="qualified"
7
+ attributeFormDefault="unqualified" version="0.9.2">
8
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="https://www.w3.org/2009/01/xml.xsd">
9
+ <xs:annotation>
10
+ <xs:documentation xml:lang="en-US">Import general XML schema.</xs:documentation>
11
+ </xs:annotation>
12
+ </xs:import>
13
+
14
+ <!--
15
+ Proposed REST calls:
16
+
17
+ Pulse at <timestamp> (or next closest AFTER the provided <timestamp>):
18
+ https://<server name>/<context>/beacon/1.0/pulse/<timestamp>
19
+ Previous Pulse (the first available Pulse prior to the <timestamp>):
20
+ https://<server name>/<context>/beacon/1.0/pulse/previous/<timestamp>
21
+ Next Pulse (the first available Pulse after the <timestamp>):
22
+ https://<server name>/<context>/beacon/1.0/pulse/next/<timestamp>
23
+ Last Pulse (the last available pulse):
24
+ https://<server name>/<context>/beacon/1.0/pulse/last
25
+ Start Chain Pulse (finds the first pulse which starts the chain this Pulse is a part of):
26
+ https://<server name>/<context>/beacon/1.0/pulse/start-chain/<timestamp>
27
+
28
+ The prior calls all return a reponse in the form:
29
+ <response xmlns="http://csrc.nist.gov/ns/beacon/pulse/1.0">
30
+ <pulse>...</pulse>
31
+ </response>
32
+
33
+ or in the case of an error:
34
+ <response xmlns="http://csrc.nist.gov/ns/beacon/pulse/1.0">
35
+ <error>...</error>
36
+ </response>
37
+
38
+ If a request for a next or previous pulse results in no pulse found, a 404 response is returned.
39
+
40
+ Certificate:
41
+ https://<server name>/<context>/beacon/1.0/certificate/<certificate identifier>
42
+ - Returns a BASE 64 encoded RFC 5280 PKIX Certficate (PEM Format)
43
+ - non-existent certificate identifier results in a 404 reponse
44
+ External Source Message
45
+ https://<server name>/<context>/beacon/1.0/external-source/<source identifier>
46
+ - Returns a MIME type text/plain document which is associated with the identifier
47
+ - the identifier is a SHA-512 Hash of this doucment
48
+ - non-existent source identifier results in a 404 reponse
49
+
50
+ Skip List
51
+ https://<server name>/<context>/beacon/1.0/skip-list/<start time stamp>/<end time stamp>
52
+ - Returns a response in the form:
53
+
54
+ <response xmlns="http://csrc.nist.gov/ns/beacon/pulse/1.0">
55
+ <skipList>
56
+ <pulse>...</pulse>
57
+ <pulse type="year">...</pulse>
58
+ <pulse type="month">...</pulse>
59
+ <pulse type="day">...</pulse>
60
+ <pulse type="hour">...</pulse>
61
+ <pulse type="previous">...</pulse>
62
+ </skipList>
63
+ </response>
64
+
65
+ NOTE: there is no restriction on how many of each type and it is more likely than not that
66
+ there will be more than one of each type in a particular response.
67
+
68
+ Which starts with the pulse with the exact <start time stamp> and ends with the exact <end time stamp>.
69
+
70
+ A 404 will be returned if there does not exist a pulse for either the <state time stamp> or the <end time stamp>
71
+
72
+ - Returns an error response if the response exceeeds a server specified threshhold of the form:
73
+ <response xmlns="http://csrc.nist.gov/ns/beacon/pulse/1.0">
74
+ <error>...</error>
75
+ </response>
76
+
77
+ chain:
78
+ https://<server name>/<context>/beacon/1.0/chain/<start time stamp>/<end time stamp>/<type>
79
+ - Returns a response in the form:
80
+
81
+ <response xmlns="http://csrc.nist.gov/ns/beacon/pulse/1.0">
82
+ <skipList>
83
+ <pulse>...</pulse>
84
+ <pulse type="<type>">...</pulse>
85
+ ...
86
+ <pulse type="<type>">...</pulse>
87
+ </skipList>
88
+ </response>
89
+
90
+ Which starts with the pulse with the exact <start time stamp> and ends with the exact <end time stamp> using
91
+ the interval defined by <type>.
92
+
93
+ A 404 will be returned if there does no exist a pulse for either the <state time stamp> or the <end time stamp>
94
+ or if the type input value is not valid.
95
+
96
+ - Returns an error response if the response exceeeds a server specified threshhold of the form:
97
+ <response xmlns="http://csrc.nist.gov/ns/beacon/pulse/1.0">
98
+ <error>...</error>
99
+ </response>
100
+ -->
101
+
102
+ <xs:element name="response">
103
+ <xs:complexType>
104
+ <xs:choice>
105
+ <xs:element name="error" type="errorType">
106
+ <xs:annotation>
107
+ <xs:documentation xml:lang="en-US">An error element containing information about the error</xs:documentation>
108
+ </xs:annotation>
109
+ </xs:element>
110
+ <xs:element name="pulse" type="pulseType" minOccurs="1" maxOccurs="unbounded">
111
+ <xs:annotation>
112
+ <xs:documentation xml:lang="en-US">A single pulse, or a set of pulses which are not directly connected (in other words not a chain or a skipList).</xs:documentation>
113
+ </xs:annotation>
114
+ </xs:element>
115
+ <xs:element name="chain" type="chainType">
116
+ <xs:annotation>
117
+ <xs:documentation xml:lang="en-US">A sequence of pulses with none missing (all the pulses between time T1 and T2).</xs:documentation>
118
+ </xs:annotation>
119
+ </xs:element>
120
+ <xs:element name="skipList" type="chainType">
121
+ <xs:annotation>
122
+ <xs:documentation xml:lang="en-US">A sequence of pulses that contains an intact hash chain, and showing that the pulses at time T1 and T2 are part of the same hash chain.</xs:documentation>
123
+ </xs:annotation>
124
+ </xs:element>
125
+ </xs:choice>
126
+ </xs:complexType>
127
+ </xs:element>
128
+
129
+ <!-- the error type -->
130
+ <xs:complexType name="errorType">
131
+ <xs:annotation>
132
+ <xs:documentation xml:lang="en-US">A type for a beacon error response.</xs:documentation>
133
+ </xs:annotation>
134
+ <xs:sequence>
135
+ <xs:element name="code" type="xs:int">
136
+ <xs:annotation>
137
+ <xs:documentation xml:lang="en-US">A short error code</xs:documentation>
138
+ </xs:annotation>
139
+ </xs:element>
140
+ <xs:element name="description" minOccurs="1" maxOccurs="unbounded">
141
+ <xs:complexType>
142
+ <xs:annotation>
143
+ <xs:documentation xml:lang="en-US">Type for a locale specific error description.</xs:documentation>
144
+ </xs:annotation>
145
+ <xs:simpleContent>
146
+ <xs:extension base="xs:string">
147
+ <xs:attribute ref="xml:lang" use="required"/>
148
+ </xs:extension>
149
+ </xs:simpleContent>
150
+ </xs:complexType>
151
+ </xs:element>
152
+ </xs:sequence>
153
+ </xs:complexType>
154
+
155
+ <!-- the pulse type -->
156
+ <xs:complexType name="pulseType">
157
+ <xs:annotation>
158
+ <xs:documentation xml:lang="en-US">The type for a single pulse.</xs:documentation>
159
+ </xs:annotation>
160
+ <xs:sequence>
161
+ <xs:element name="version">
162
+ <xs:annotation>
163
+ <xs:documentation xml:lang="en-US">The version string, e.g. “0.1.0”</xs:documentation>
164
+ </xs:annotation>
165
+ <xs:simpleType>
166
+ <xs:restriction base="xs:token">
167
+ <xs:maxLength value="32"/>
168
+ </xs:restriction>
169
+ </xs:simpleType>
170
+ </xs:element>
171
+ <xs:element name="frequency" type="xs:int">
172
+ <xs:annotation>
173
+ <xs:documentation xml:lang="en-US">The time interval, in milliseconds, between expected pulses</xs:documentation>
174
+ </xs:annotation>
175
+ </xs:element>
176
+ <xs:element name="certificateId" type="sha512HexString">
177
+ <xs:annotation>
178
+ <xs:documentation xml:lang="en-US">The hash (i.e. SHA512 hash) of the X.509 ASN.1 encoding of the certificate containing the public key which can be used to verify this pulse.</xs:documentation>
179
+ </xs:annotation>
180
+ </xs:element>
181
+ <xs:element name="timeStamp" type="xs:long">
182
+ <xs:annotation>
183
+ <xs:documentation xml:lang="en-US">The time this pulse was released as the number of milli-seconds since January 1, 1970 UTC, not counting leap seconds (UNIX time)</xs:documentation>
184
+ </xs:annotation>
185
+ </xs:element>
186
+ <xs:element name="localRandomValue" type="sha512HexString">
187
+ <xs:annotation>
188
+ <xs:documentation xml:lang="en-US">A local random value represented as a 64 byte (512-bit) hex string value</xs:documentation>
189
+ </xs:annotation>
190
+ </xs:element>
191
+ <xs:element name="external" minOccurs="0">
192
+ <xs:annotation>
193
+ <xs:documentation xml:lang="en-US">A value external to a beacon. This value should be a value outside the control of the operators
194
+ of the beacon which changes unpredictably over time. This value must be able to be verified by users of the beacon.</xs:documentation>
195
+ </xs:annotation>
196
+ <xs:complexType>
197
+ <xs:sequence>
198
+ <xs:element name="sourceId" type="sha512HexString">
199
+ <xs:annotation>
200
+ <xs:documentation xml:lang="en-US">The SHA-512 hash value of a description of the external source.</xs:documentation>
201
+ </xs:annotation>
202
+ </xs:element>
203
+ <xs:element name="statusCode" type="xs:short">
204
+ <xs:annotation>
205
+ <xs:documentation xml:lang="en-US">The status code for retrieval of a value from the source.</xs:documentation>
206
+ </xs:annotation>
207
+ </xs:element>
208
+ <xs:element name="value" type="sha512HexString">
209
+ <xs:annotation>
210
+ <xs:documentation xml:lang="en-US">A SHA-512 hash of a value as described in sourceId</xs:documentation>
211
+ </xs:annotation>
212
+ </xs:element>
213
+ </xs:sequence>
214
+ </xs:complexType>
215
+ </xs:element>
216
+ <xs:element name="listValue" minOccurs="1" maxOccurs="unbounded">
217
+ <xs:annotation>
218
+ <xs:documentation xml:lang="en-US">The SHA-512 hash value of a pulse - 64 byte hex string</xs:documentation>
219
+ </xs:annotation>
220
+ <xs:complexType>
221
+ <xs:simpleContent>
222
+ <xs:extension base="sha512HexString">
223
+ <xs:attribute name="type" type="xs:token" use="required">
224
+ <xs:annotation>
225
+ <xs:documentation xml:lang="en-US">the type of list value:
226
+ previous - the previous pulse value, or 0's if no such pulse exists
227
+ hour - the outputValue of the first pulse of the UTC "hour" of the previous pulse, or 0's if no such pulse exists
228
+ day - the outputValue of the first pulse of the UTC "day" of the previous pulse, or 0's if no such pulse exists
229
+ month - the outputValue of the first pulse of the UTC "month" of the previous pulse, or 0's if no such pulse exists
230
+ year - the outputValue of the first pulse of the UTC "year" of the previous pulse, or 0's if no such pulse exists
231
+ </xs:documentation>
232
+ </xs:annotation>
233
+ </xs:attribute>
234
+ </xs:extension>
235
+ </xs:simpleContent>
236
+ </xs:complexType>
237
+ </xs:element>
238
+ <xs:element name="precommitmentValue" type="sha512HexString" minOccurs="0">
239
+ <xs:annotation>
240
+ <xs:documentation xml:lang="en-US">The SHA-512 hash of the next localRandomValue (a pre-commitment) as a 64 byte hex string. This value may be all '0's if not used.</xs:documentation>
241
+ </xs:annotation>
242
+ </xs:element>
243
+ <xs:element name="statusCode" type="xs:short">
244
+ <xs:annotation>
245
+ <xs:documentation xml:lang="en-US">The status code value:
246
+ 0 - Chain intact, values all good
247
+ 1 - Start of a new chain of values, previous hash value will be all zeroes
248
+ 2 - Time between values is greater than the frequency, but the chain is still intact
249
+ 3 - Time between values is greater than the frequency, the chain is intact, but the input of the prior precommitmentValue was lost</xs:documentation>
250
+ </xs:annotation>
251
+ </xs:element>
252
+ <xs:element name="signatureValue">
253
+ <xs:annotation>
254
+ <xs:documentation xml:lang="en-US">A big-endian hex encoded digital signature using the public key contained in certificateId computed over (in order):
255
+ strlen(version)
256
+ version as a UTF-8 sequence of characters
257
+ Pfrequency as a 4 byte big-endian integer value
258
+ length(certificateId)
259
+ certificateId as a hex-decoded sequence of bytes
260
+ timestamp as an 8 byte big-endian integer value
261
+ length(localRandomValue)
262
+ localRandomValue as a hex-decoded sequence of bytes
263
+ length(external/sourceId)
264
+ external/sourceId as a hex-decoded sequence of bytes
265
+ external/statusCode as a 4 byte big-endian integer value
266
+ length(external/value)
267
+ external/value as a hex-decoded sequence of bytes
268
+ length(listValue[@type=’previous’])
269
+ listValue[@type=’previous’] as a hex-decoded sequence of bytes
270
+ length(listValue[@type=’hour’])
271
+ listValue[@type=’hour’] as a hex-decoded sequence of bytes
272
+ length(listValue[@type=’day’])
273
+ listValue[@type=’day’] as a hex-decoded sequence of bytes
274
+ length(listValue[@type=’month’])
275
+ listValue[@type=’month’] as a hex-decoded sequence of bytes
276
+ length(listValue[@type=’year’])
277
+ listValue[@type=’year’] as a hex-decoded sequence of bytes
278
+ length(precommitmentValue)
279
+ precommitmentValue as a hex-decoded sequence of bytes
280
+ statusCode as a 4 byte big-endian integer value
281
+
282
+ where strlen(x) returns the number of characters in the string, x
283
+ where length(x) returns the number of bytes after x has been hex decoded
284
+
285
+ Different listValue types may be used, but if provided, they must be included in the hash in the order they are provided.
286
+ </xs:documentation>
287
+ </xs:annotation>
288
+ <xs:simpleType>
289
+ <xs:restriction base="xs:token">
290
+ <xs:maxLength value="8192"/>
291
+ </xs:restriction>
292
+ </xs:simpleType>
293
+ </xs:element>
294
+ <xs:element name="outputValue" type="sha512HexString">
295
+ <xs:annotation>
296
+ <xs:documentation xml:lang="en-US">A 64 byte hex string of the SHA-512 hash of the concatenation of the input into the signatureValue and the hex decoded signature as a sequence of bytes</xs:documentation>
297
+ </xs:annotation>
298
+ </xs:element>
299
+ </xs:sequence>
300
+ </xs:complexType>
301
+
302
+ <!-- the chain type -->
303
+ <xs:complexType name="chainType">
304
+ <xs:annotation>
305
+ <xs:documentation xml:lang="en-US">A type for a sequence of pulses.</xs:documentation>
306
+ </xs:annotation>
307
+ <xs:sequence>
308
+ <xs:element name="pulse" minOccurs="1" maxOccurs="unbounded">
309
+ <xs:complexType>
310
+ <xs:complexContent>
311
+ <xs:extension base="pulseType">
312
+ <xs:attribute name="type" type="xs:token" use="optional">
313
+ <xs:annotation>
314
+ <xs:documentation xml:lang="en-US">the type of list value. see documentation in pulseType for more information.</xs:documentation>
315
+ </xs:annotation>
316
+ </xs:attribute>
317
+ </xs:extension>
318
+ </xs:complexContent>
319
+ </xs:complexType>
320
+ </xs:element>
321
+ </xs:sequence>
322
+ </xs:complexType>
323
+
324
+ <xs:simpleType name="sha512HexString">
325
+ <xs:restriction base="xs:token">
326
+ <xs:length value="128"/>
327
+ <xs:pattern value="([0-9]|[a-f]|[A-F])*" />
328
+ </xs:restriction>
329
+ </xs:simpleType>
330
+ </xs:schema>
@@ -0,0 +1,34 @@
1
+ {
2
+ "pulse" : {
3
+ "version" : "Version 2.0",
4
+ "frequency" : 60000,
5
+ "certificateId" : "5501E3D72BC42F3B96E16DE4DCADCB16768E109662BD16D667D5FD9AEE585AF31BBDC5DD4F53592276064B53DDDD76C8F3604B2A41DB6E09F78F82BB5D6569E7",
6
+ "timeStamp" : 1516472940000,
7
+ "localRandomValue" : "4F41CBA5CDC24CF763474AE25B434456F00EF9F8FF51C08DAA5144DECC0FE7A690942EB28DCCBE71362DC138F828DC0236DEDC6117E70124B91FE053646FE086",
8
+ "external" : {
9
+ "sourceId" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
10
+ "statusCode" : 0,
11
+ "value" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
12
+ },
13
+ "listValues" : [ {
14
+ "type" : "previous",
15
+ "value" : "75FD8569B9B95766E5D81D60278EFB4362819CB76478123B9CA8C071FBB696F75DD6909869FD414DABC642A1364A438FDDA3982039201435ED8557049F13547B"
16
+ }, {
17
+ "type" : "hour",
18
+ "value" : "3D96C601F5995FF1D4468E48BA54B9EE97ED7992F75F66E8BB7864D6290F43574425B5622668575F154D9EF472414C6EE9401C5D86140A5BD12CCA1126DD3A04"
19
+ }, {
20
+ "type" : "day",
21
+ "value" : "4982B3486344CD2F0F2B6C8928BB2A7A379FD91615772C92583D31AFFBF0E86109EBA81E2B0B9759CCBA1994FECD55C4E67BAE032469DC1F5D2DB9C6242299D2"
22
+ }, {
23
+ "type" : "month",
24
+ "value" : "19A004AC664AAF02CB6006A0BBD7728CE9CB5C8114E5F5CE422B2A68A7B8770A90E628A69DDF1E2CB6BE2CBC897C7543D519C5388641B8730E8FF202E5120A9E"
25
+ }, {
26
+ "type" : "year",
27
+ "value" : "19A004AC664AAF02CB6006A0BBD7728CE9CB5C8114E5F5CE422B2A68A7B8770A90E628A69DDF1E2CB6BE2CBC897C7543D519C5388641B8730E8FF202E5120A9E"
28
+ } ],
29
+ "precommitmentValue" : "7FE659BAABA57F4A9286C602377C794CDB3D021DA1B388E495746AACEA85032ECB7B773CD17A5773C8EAC959B335A986BCA08A54C8FAE7C606F1C4F54A2D5E81",
30
+ "statusCode" : 0,
31
+ "signatureValue" : "65F66EA8E22C2583CE12D49860BA0904DF15CF487F7862E0D0E724EB07CE44C0706520A7DCD2A84AE3F5087B98F63FFC8AC34AF9CD41909CD673AA9583BEA6E22317C13C91078FFFFE39F364B336982BB76EAD698B8C50CE647554006FC432C553C61919AF629B021194130623D0A5D1F23EEDA99CD9A3B68F6660EDCE1DDC3E55420DACD2EDA3FABA00DCCEBD228EC5D6C8965A8C47975B038F43E35E20E7A2AE33ADF45BC10012B7354EA14E6A14E3F5A85EA7F118742741BB9EAE72F667E5EC952494F09A100D5BBF779CCB81FD9BD09EF7A27EC60D752D902764B8C44B87E2B9D4A3B33DB6727E9D8ECF38759ADF966B23140ADFC92542EF0B47EA25ABE266165BB2706B2CF9A083A45C5B3B3871AC0FECFCF1566DA8C3855427C304D423F7E183A5B0F6CAA6C891F74795D3778EE669DF89DE4C6BA5D74E0DCD2E805BDB28E5D66CC0374C26C53277FA79F37D99833DC0B60BC728021170E8C4E03F81AC3E3FB9F02EDC5D58A05751D1149D760F71D2229D9EED7547D8B17022520B651ED28BDB3A3C5BFC4D437B8FA4AA957287B0BE8E461541D14A4C2B323970E6AB9847A119D95FAB9B103F0F554B833FAABDA3A710BDD9801F06491DE4F1B1B330D9D017D2CA499143E49C58EC86548C6EA4DFDBB150251C0378BBDAC00D2470E58D17394488D67404AB17D3112BCCE8EF660DC7F6A62E2F7E62FF4A6356DD326F41",
32
+ "outputValue" : "40A5544AD038926CA5D2E17B3EEC65BB26E818B92871D84A0DC21740E29C323FF671910B9EC5AF40B29136699EE477F94295525EBDB8D6F5E55896337E35DFC1"
33
+ }
34
+ }
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
- spec.required_ruby_version = ['>= 2.2.0', '< 2.5.0']
20
+ spec.required_ruby_version = ['>= 2.3.0', '<= 2.5.0']
21
21
 
22
22
  spec.add_development_dependency 'bundler', '~> 1.12'
23
23
  spec.add_development_dependency 'rake', '~> 11.2'
@@ -29,6 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'simplecov', '~> 0.12'
30
30
  spec.add_development_dependency 'timecop', '~> 0.8'
31
31
 
32
- spec.add_dependency 'httparty', '~> 0.15.6'
32
+ spec.add_dependency 'httparty', '~> 0.15'
33
33
  spec.add_dependency 'json', '~> 2.1'
34
34
  end
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://beacon.nist.gov/beacon/1.0/pulse/1514764800
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - no-cache, no-store, must-revalidate
23
+ Pragma:
24
+ - no-cache
25
+ Content-Length:
26
+ - '3107'
27
+ Content-Type:
28
+ - application/json;charset=ISO-8859-1
29
+ Expires:
30
+ - Thu, 01 Jan 1970 00:00:00 GMT
31
+ Server:
32
+ - Microsoft-IIS/7.5
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ - SAMEORIGIN
36
+ Strict-Transport-Security:
37
+ - max-age=31536000
38
+ Date:
39
+ - Sun, 28 Jan 2018 22:52:18 GMT
40
+ body:
41
+ encoding: UTF-8
42
+ string: "{\r\n \"pulse\" : {\r\n \"version\" : \"Version 2.0\",\r\n \"frequency\"
43
+ : 60000,\r\n \"certificateId\" : \"5501E3D72BC42F3B96E16DE4DCADCB16768E109662BD16D667D5FD9AEE585AF31BBDC5DD4F53592276064B53DDDD76C8F3604B2A41DB6E09F78F82BB5D6569E7\",\r\n
44
+ \ \"timeStamp\" : 1515601800000,\r\n \"localRandomValue\" : \"3C406EFF43A3FE89927B0AC66B9D192D0E157930D298B898C393390681E29185F837FD487F01546D585CB5C2A8973C841AA1C189D6E21D997EA4FAAB0256A66F\",\r\n
45
+ \ \"external\" : {\r\n \"sourceId\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\r\n
46
+ \ \"statusCode\" : 0,\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
47
+ \ },\r\n \"listValues\" : [ {\r\n \"type\" : \"previous\",\r\n \"value\"
48
+ : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
49
+ \ }, {\r\n \"type\" : \"hour\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
50
+ \ }, {\r\n \"type\" : \"day\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
51
+ \ }, {\r\n \"type\" : \"month\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
52
+ \ }, {\r\n \"type\" : \"year\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
53
+ \ } ],\r\n \"precommitmentValue\" : \"4640BE913CAB1AF68EEE041734F9831FA24F360828BEE0E1422608E6CE5DC6F9FD66A31174BF23EE6CA2187B5EC3CCFD136758DFF4D3B7ED7CC346546D4FFDC5\",\r\n
54
+ \ \"statusCode\" : 1,\r\n \"signatureValue\" : \"9885C6E53E434E4BB7AFC30009C006CC14230B0B786066D88CE37F4FF90AA19A80B48A852269D0CEA5566AB2AB23E6652241511A666C346C29297D137EDB00CB0EDEA8A5EB2917A452F71B117697BF8E06625D765C54F6D1FDFB3FEB9BFD582228BE3E2CBB4A41E3CC237C3C49E02AB6761790873171C9C781141B87FCEB3345ADD17FF1D5F73B32D8C9965D7EF620B65BC7A486CBA513F89E5162FCBE7A9E83D4C4D615BCC4B259CCE17A7D31BD6E34E670E8679521B3D32138B3642B5F49DC6A09F0D2523148882868EC943ADBBD6A123954C61987CD5EE7A096E10092711FE9666998AED19F5CEAF60EEF3FDA53105DBCF6144DD5D4874A57198F2C49352C845AFD782706FBE09AA38F515213E2BD4832D09971E5D4EAD83E5650EC6DE09378DA5124B35B808D0569CD9FCA36CC28B0428E73CA936B6157935C9E0CFF773D7EE083B948342FDF399D24C8E6C55EEABE95B6BE0AFD004A60065EF34DAB41B9B57D735EF31757C7766E33075CF841D66471B2F7A4AC8CB5423ECA9E932174EAF3638A951A3B1726EBAEA6F45F15E300F59A0588BCFDC7743968B596BBA41A8B70F598F7A68785FC350AB8969CC9BA5CE5E438CF21F324F828F849DE5AD1D67197169D82F98301908A829B470D889D2A043A645693EADF4C780F31F6E58AFA563420E20453CD3303FBBA2E6EDDD9EA5E2E5C13E31D667A4FA20D1A7FEF2F952A\",\r\n
55
+ \ \"outputValue\" : \"19A004AC664AAF02CB6006A0BBD7728CE9CB5C8114E5F5CE422B2A68A7B8770A90E628A69DDF1E2CB6BE2CBC897C7543D519C5388641B8730E8FF202E5120A9E\"\r\n
56
+ \ }\r\n}"
57
+ http_version:
58
+ recorded_at: Mon, 01 Jan 2018 00:00:00 GMT
59
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://beacon.nist.gov/beacon/1.0/pulse/last
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - no-cache, no-store, must-revalidate
23
+ Pragma:
24
+ - no-cache
25
+ Content-Length:
26
+ - '3107'
27
+ Content-Type:
28
+ - application/json;charset=ISO-8859-1
29
+ Expires:
30
+ - Thu, 01 Jan 1970 00:00:00 GMT
31
+ Server:
32
+ - Microsoft-IIS/7.5
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ - SAMEORIGIN
36
+ Strict-Transport-Security:
37
+ - max-age=31536000
38
+ Date:
39
+ - Sun, 28 Jan 2018 22:52:17 GMT
40
+ body:
41
+ encoding: UTF-8
42
+ string: "{\r\n \"pulse\" : {\r\n \"version\" : \"Version 2.0\",\r\n \"frequency\"
43
+ : 60000,\r\n \"certificateId\" : \"5501E3D72BC42F3B96E16DE4DCADCB16768E109662BD16D667D5FD9AEE585AF31BBDC5DD4F53592276064B53DDDD76C8F3604B2A41DB6E09F78F82BB5D6569E7\",\r\n
44
+ \ \"timeStamp\" : 1517179920000,\r\n \"localRandomValue\" : \"3CCBCD044039B26F360264BD04E3EE76BD417BCB6ADA162A07750655C773514965A3BD51854CF549F880B62C966D30D4508517DD8F248228D7659A1B6C8B38AC\",\r\n
45
+ \ \"external\" : {\r\n \"sourceId\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\r\n
46
+ \ \"statusCode\" : 0,\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
47
+ \ },\r\n \"listValues\" : [ {\r\n \"type\" : \"previous\",\r\n \"value\"
48
+ : \"F96111C9AC269B5034DD8A3ABE5707A0FB55E707B92011789F8BD23C4B1432121E132052A1330A068291609AC5DAF3D013874CF6063FD7E64ED73E86A6B0E342\"\r\n
49
+ \ }, {\r\n \"type\" : \"hour\",\r\n \"value\" : \"858C21C82E1C83C6C7F929C75644778EEEEF4A799C92820089FB6DA1191CE22ACA15C9C1684AB09833B649AF27D4753ABDBEF0E94C3CD279F07BF6950F882312\"\r\n
50
+ \ }, {\r\n \"type\" : \"day\",\r\n \"value\" : \"857F4486737207F12A93E33DCC5E71FD247E14EA6BA6FC8CA9AE1B00D362A948FD46ACD9E41748BF5A5E5723B8CAE0FB99C335229FD7F0BB15D3FACA819173F8\"\r\n
51
+ \ }, {\r\n \"type\" : \"month\",\r\n \"value\" : \"19A004AC664AAF02CB6006A0BBD7728CE9CB5C8114E5F5CE422B2A68A7B8770A90E628A69DDF1E2CB6BE2CBC897C7543D519C5388641B8730E8FF202E5120A9E\"\r\n
52
+ \ }, {\r\n \"type\" : \"year\",\r\n \"value\" : \"19A004AC664AAF02CB6006A0BBD7728CE9CB5C8114E5F5CE422B2A68A7B8770A90E628A69DDF1E2CB6BE2CBC897C7543D519C5388641B8730E8FF202E5120A9E\"\r\n
53
+ \ } ],\r\n \"precommitmentValue\" : \"DE93893CDBBC4534458BEF9B83044E6B0956B335F6429A73BDB2DDF3FE8D68BB4A3290A58C4357CEBAA0620447BF3E4FD4F47E4CA757A6BA2982831CC18CB6E8\",\r\n
54
+ \ \"statusCode\" : 0,\r\n \"signatureValue\" : \"4986481EFAB11F649D937530F6F7DFA166500074FFE19E63DA8BA38DA50454437FA27A911787F1A98D45CAF8E1A030031F6DE575EE0FD65BB8174E01B12C5850AE321289A2A6CBD5069D2B73E1F082AD89C185A980EDEA6CEABD7472FC57CACB253F49EDDCA5796F3AA1A8A453BE42B838C212A1CF643585B54BCED49C471CB874537775C96DF42EEA1934F59A3D62EE92866D630A17682349F6A4A89798A9938A2DDE8F0E189B36D1454300AD9126FE7500B06D26BB5C5CC838813811F808A33506FDCB49987F392CAA3A81175D69B9826E11B83CF4076C8C41D82D4EE509605984E9D67E36B21AB89E6EECD6A302E669E6BCEAECD53AD104AA661D1E6D7D5ED6747178F9847C7A3DBC89641ECDC249F2AB2685DF4F40A7AEC84AFF024558676D512D4F098D2BCBF85E181A5AA3A74E4991004DC8F7D143C20FD2C286C8CDEF36FA0D773FD75AD424DF8100901BCD494BBDA5A44C1C391B909C955D46A95B361F9EC55FE76ADC5FE80996C40A0C110F572DC082F678D0500445148ACF083C580B2AB264DC8F1A4CB28359FC0D599FC155D49252501C2E7479ACC021D6F076B9CD946935159208AFC2AD710B1B390F31CF5ECF524188D4965047CDFB6C8FCF9C23240D33BAD318AD8F5949401433445C65548D0E198B79F677DE0AAE1AD12178581A757571FB59AEB5CF2ED149753D23C3A9FED97A17DDEE577C2E3C9555232F\",\r\n
55
+ \ \"outputValue\" : \"D1B53A74D0BEE10FAC4373A1C7186DFCE130AC3CEAA86B6F33F93875BAADF28060C60536AFB4AF9D0105FBE74185FAC72C3600FC0020997102D1932B92443803\"\r\n
56
+ \ }\r\n}"
57
+ http_version:
58
+ recorded_at: Mon, 01 Jan 2018 00:00:00 GMT
59
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://beacon.nist.gov/beacon/1.0/pulse/next/1514764800
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - no-cache, no-store, must-revalidate
23
+ Pragma:
24
+ - no-cache
25
+ Content-Length:
26
+ - '3107'
27
+ Content-Type:
28
+ - application/json;charset=ISO-8859-1
29
+ Expires:
30
+ - Thu, 01 Jan 1970 00:00:00 GMT
31
+ Server:
32
+ - Microsoft-IIS/7.5
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ - SAMEORIGIN
36
+ Strict-Transport-Security:
37
+ - max-age=31536000
38
+ Date:
39
+ - Sun, 28 Jan 2018 22:52:18 GMT
40
+ body:
41
+ encoding: UTF-8
42
+ string: "{\r\n \"pulse\" : {\r\n \"version\" : \"Version 2.0\",\r\n \"frequency\"
43
+ : 60000,\r\n \"certificateId\" : \"5501E3D72BC42F3B96E16DE4DCADCB16768E109662BD16D667D5FD9AEE585AF31BBDC5DD4F53592276064B53DDDD76C8F3604B2A41DB6E09F78F82BB5D6569E7\",\r\n
44
+ \ \"timeStamp\" : 1515601800000,\r\n \"localRandomValue\" : \"3C406EFF43A3FE89927B0AC66B9D192D0E157930D298B898C393390681E29185F837FD487F01546D585CB5C2A8973C841AA1C189D6E21D997EA4FAAB0256A66F\",\r\n
45
+ \ \"external\" : {\r\n \"sourceId\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\r\n
46
+ \ \"statusCode\" : 0,\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
47
+ \ },\r\n \"listValues\" : [ {\r\n \"type\" : \"previous\",\r\n \"value\"
48
+ : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
49
+ \ }, {\r\n \"type\" : \"hour\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
50
+ \ }, {\r\n \"type\" : \"day\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
51
+ \ }, {\r\n \"type\" : \"month\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
52
+ \ }, {\r\n \"type\" : \"year\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
53
+ \ } ],\r\n \"precommitmentValue\" : \"4640BE913CAB1AF68EEE041734F9831FA24F360828BEE0E1422608E6CE5DC6F9FD66A31174BF23EE6CA2187B5EC3CCFD136758DFF4D3B7ED7CC346546D4FFDC5\",\r\n
54
+ \ \"statusCode\" : 1,\r\n \"signatureValue\" : \"9885C6E53E434E4BB7AFC30009C006CC14230B0B786066D88CE37F4FF90AA19A80B48A852269D0CEA5566AB2AB23E6652241511A666C346C29297D137EDB00CB0EDEA8A5EB2917A452F71B117697BF8E06625D765C54F6D1FDFB3FEB9BFD582228BE3E2CBB4A41E3CC237C3C49E02AB6761790873171C9C781141B87FCEB3345ADD17FF1D5F73B32D8C9965D7EF620B65BC7A486CBA513F89E5162FCBE7A9E83D4C4D615BCC4B259CCE17A7D31BD6E34E670E8679521B3D32138B3642B5F49DC6A09F0D2523148882868EC943ADBBD6A123954C61987CD5EE7A096E10092711FE9666998AED19F5CEAF60EEF3FDA53105DBCF6144DD5D4874A57198F2C49352C845AFD782706FBE09AA38F515213E2BD4832D09971E5D4EAD83E5650EC6DE09378DA5124B35B808D0569CD9FCA36CC28B0428E73CA936B6157935C9E0CFF773D7EE083B948342FDF399D24C8E6C55EEABE95B6BE0AFD004A60065EF34DAB41B9B57D735EF31757C7766E33075CF841D66471B2F7A4AC8CB5423ECA9E932174EAF3638A951A3B1726EBAEA6F45F15E300F59A0588BCFDC7743968B596BBA41A8B70F598F7A68785FC350AB8969CC9BA5CE5E438CF21F324F828F849DE5AD1D67197169D82F98301908A829B470D889D2A043A645693EADF4C780F31F6E58AFA563420E20453CD3303FBBA2E6EDDD9EA5E2E5C13E31D667A4FA20D1A7FEF2F952A\",\r\n
55
+ \ \"outputValue\" : \"19A004AC664AAF02CB6006A0BBD7728CE9CB5C8114E5F5CE422B2A68A7B8770A90E628A69DDF1E2CB6BE2CBC897C7543D519C5388641B8730E8FF202E5120A9E\"\r\n
56
+ \ }\r\n}"
57
+ http_version:
58
+ recorded_at: Mon, 01 Jan 2018 00:00:00 GMT
59
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://beacon.nist.gov/beacon/1.0/pulse/previous/1517179800000
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - no-cache, no-store, must-revalidate
23
+ Pragma:
24
+ - no-cache
25
+ Content-Length:
26
+ - '3107'
27
+ Content-Type:
28
+ - application/json;charset=ISO-8859-1
29
+ Expires:
30
+ - Thu, 01 Jan 1970 00:00:00 GMT
31
+ Server:
32
+ - Microsoft-IIS/7.5
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ - SAMEORIGIN
36
+ Strict-Transport-Security:
37
+ - max-age=31536000
38
+ Date:
39
+ - Sun, 28 Jan 2018 23:06:54 GMT
40
+ body:
41
+ encoding: UTF-8
42
+ string: "{\r\n \"pulse\" : {\r\n \"version\" : \"Version 2.0\",\r\n \"frequency\"
43
+ : 60000,\r\n \"certificateId\" : \"5501E3D72BC42F3B96E16DE4DCADCB16768E109662BD16D667D5FD9AEE585AF31BBDC5DD4F53592276064B53DDDD76C8F3604B2A41DB6E09F78F82BB5D6569E7\",\r\n
44
+ \ \"timeStamp\" : 1517179740000,\r\n \"localRandomValue\" : \"40F44C4BD1DEE6D27388C13EB0068DE1C91183D4D39F4694659C4F64D523BFD761A38C13A3E0F9037AC83209C2E40EB6BA8FD7047E47F1CEA6F1CA333CE8C278\",\r\n
45
+ \ \"external\" : {\r\n \"sourceId\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\r\n
46
+ \ \"statusCode\" : 0,\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
47
+ \ },\r\n \"listValues\" : [ {\r\n \"type\" : \"previous\",\r\n \"value\"
48
+ : \"6D5F3EAE31F90EDE0CB94DE28894EFC029C87D2DBA03808DB1B48EF22F01327761F67709E336AF2BF0F89208F533CD78391DD878BB6640898DD0D32DF5CB9B6D\"\r\n
49
+ \ }, {\r\n \"type\" : \"hour\",\r\n \"value\" : \"858C21C82E1C83C6C7F929C75644778EEEEF4A799C92820089FB6DA1191CE22ACA15C9C1684AB09833B649AF27D4753ABDBEF0E94C3CD279F07BF6950F882312\"\r\n
50
+ \ }, {\r\n \"type\" : \"day\",\r\n \"value\" : \"857F4486737207F12A93E33DCC5E71FD247E14EA6BA6FC8CA9AE1B00D362A948FD46ACD9E41748BF5A5E5723B8CAE0FB99C335229FD7F0BB15D3FACA819173F8\"\r\n
51
+ \ }, {\r\n \"type\" : \"month\",\r\n \"value\" : \"19A004AC664AAF02CB6006A0BBD7728CE9CB5C8114E5F5CE422B2A68A7B8770A90E628A69DDF1E2CB6BE2CBC897C7543D519C5388641B8730E8FF202E5120A9E\"\r\n
52
+ \ }, {\r\n \"type\" : \"year\",\r\n \"value\" : \"19A004AC664AAF02CB6006A0BBD7728CE9CB5C8114E5F5CE422B2A68A7B8770A90E628A69DDF1E2CB6BE2CBC897C7543D519C5388641B8730E8FF202E5120A9E\"\r\n
53
+ \ } ],\r\n \"precommitmentValue\" : \"D43C2DDD16033EB7F0C570E004E80B078B7DF1BA41FF4E556EA738A4A916E79BA057866128807845035CE648C5DFBBD79BEDEC58C48B453C8288F55B7FA98B91\",\r\n
54
+ \ \"statusCode\" : 0,\r\n \"signatureValue\" : \"439C6CB3205232582D0ECD9D74FD52E9525729432EC86FA709EA975B0D75C08D8B8FC92340113B5070AA1E0462388CCD519A1739A1AAD6E3F913C361074F87E6139582FD4DC44062C8580207409676EEF9E05D119186F4B94E3E25495254D3BD3499F2BDB7FEA93FEA142AFFB9A10B57BBE85253B8C6AF36F06DFA6B72D57C07140E99719B4E276ACDBB4D628145975FA97C42A5120721E5ED9C6F96A329B5126FCDAA85CD5A2F81AED7BC58937C214EB6F16E96A0784737141A5A2F855BA4F167C7B961D552E0BF460BD17B9CBF57E6C6DA3BEC0599A8222B751BA2E7B06B20C181A576C67A4A901484AB7A84FB81E19DF793F654BCA9C00F0BCE89D2E98BC18E98722A38D68C109650EF9238B881A043442D253918214D595A27CE88F46C483F57DBC209B080985CBE67358B8DA1DDBA1E66EBC031656CC35E93B9A71C906CFC0A5C9A918A92E3AC6088CAC3268F2B56BBE37D3595AC5C8219159107204D0D83A742EA8D4C6FE5B9DEC07EC56BD9B63674F2DBB800BE509A47F2FC13550DBC3D41154E50A19EAE97C5D27BD2CA7CC6CFB8195A9D09AB904F94F82851DDA486CB5249C890A75E92D1349B3D8981C7F984F14B2558A70416C74AFC5842221AE157793401C25758744D3062B5C830A822954F9AD47C13BFDF582DCA77E51EB14BE9EEF2E5B5777D43BA8D52C6F28B8DDCB72CC43FEE1488507F4CE4AE2FAF8067\",\r\n
55
+ \ \"outputValue\" : \"52BA0ABADBC263E50BEBF0908C1D10CE46E6FF84A7D7989D72B90D121C8A6016619114C837FEE75B482988FB81407EA0776A3CE39E33C2E38482AE835732120E\"\r\n
56
+ \ }\r\n}"
57
+ http_version:
58
+ recorded_at: Mon, 01 Jan 2018 00:00:00 GMT
59
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://beacon.nist.gov/beacon/1.0/pulse/start-chain/1517179800000
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - no-cache, no-store, must-revalidate
23
+ Pragma:
24
+ - no-cache
25
+ Content-Length:
26
+ - '3107'
27
+ Content-Type:
28
+ - application/json;charset=ISO-8859-1
29
+ Expires:
30
+ - Thu, 01 Jan 1970 00:00:00 GMT
31
+ Server:
32
+ - Microsoft-IIS/7.5
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ - SAMEORIGIN
36
+ Strict-Transport-Security:
37
+ - max-age=31536000
38
+ Date:
39
+ - Sun, 28 Jan 2018 23:07:47 GMT
40
+ body:
41
+ encoding: UTF-8
42
+ string: "{\r\n \"pulse\" : {\r\n \"version\" : \"Version 2.0\",\r\n \"frequency\"
43
+ : 60000,\r\n \"certificateId\" : \"5501E3D72BC42F3B96E16DE4DCADCB16768E109662BD16D667D5FD9AEE585AF31BBDC5DD4F53592276064B53DDDD76C8F3604B2A41DB6E09F78F82BB5D6569E7\",\r\n
44
+ \ \"timeStamp\" : 1515601800000,\r\n \"localRandomValue\" : \"3C406EFF43A3FE89927B0AC66B9D192D0E157930D298B898C393390681E29185F837FD487F01546D585CB5C2A8973C841AA1C189D6E21D997EA4FAAB0256A66F\",\r\n
45
+ \ \"external\" : {\r\n \"sourceId\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\r\n
46
+ \ \"statusCode\" : 0,\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
47
+ \ },\r\n \"listValues\" : [ {\r\n \"type\" : \"previous\",\r\n \"value\"
48
+ : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
49
+ \ }, {\r\n \"type\" : \"hour\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
50
+ \ }, {\r\n \"type\" : \"day\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
51
+ \ }, {\r\n \"type\" : \"month\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
52
+ \ }, {\r\n \"type\" : \"year\",\r\n \"value\" : \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\r\n
53
+ \ } ],\r\n \"precommitmentValue\" : \"4640BE913CAB1AF68EEE041734F9831FA24F360828BEE0E1422608E6CE5DC6F9FD66A31174BF23EE6CA2187B5EC3CCFD136758DFF4D3B7ED7CC346546D4FFDC5\",\r\n
54
+ \ \"statusCode\" : 1,\r\n \"signatureValue\" : \"9885C6E53E434E4BB7AFC30009C006CC14230B0B786066D88CE37F4FF90AA19A80B48A852269D0CEA5566AB2AB23E6652241511A666C346C29297D137EDB00CB0EDEA8A5EB2917A452F71B117697BF8E06625D765C54F6D1FDFB3FEB9BFD582228BE3E2CBB4A41E3CC237C3C49E02AB6761790873171C9C781141B87FCEB3345ADD17FF1D5F73B32D8C9965D7EF620B65BC7A486CBA513F89E5162FCBE7A9E83D4C4D615BCC4B259CCE17A7D31BD6E34E670E8679521B3D32138B3642B5F49DC6A09F0D2523148882868EC943ADBBD6A123954C61987CD5EE7A096E10092711FE9666998AED19F5CEAF60EEF3FDA53105DBCF6144DD5D4874A57198F2C49352C845AFD782706FBE09AA38F515213E2BD4832D09971E5D4EAD83E5650EC6DE09378DA5124B35B808D0569CD9FCA36CC28B0428E73CA936B6157935C9E0CFF773D7EE083B948342FDF399D24C8E6C55EEABE95B6BE0AFD004A60065EF34DAB41B9B57D735EF31757C7766E33075CF841D66471B2F7A4AC8CB5423ECA9E932174EAF3638A951A3B1726EBAEA6F45F15E300F59A0588BCFDC7743968B596BBA41A8B70F598F7A68785FC350AB8969CC9BA5CE5E438CF21F324F828F849DE5AD1D67197169D82F98301908A829B470D889D2A043A645693EADF4C780F31F6E58AFA563420E20453CD3303FBBA2E6EDDD9EA5E2E5C13E31D667A4FA20D1A7FEF2F952A\",\r\n
55
+ \ \"outputValue\" : \"19A004AC664AAF02CB6006A0BBD7728CE9CB5C8114E5F5CE422B2A68A7B8770A90E628A69DDF1E2CB6BE2CBC897C7543D519C5388641B8730E8FF202E5120A9E\"\r\n
56
+ \ }\r\n}"
57
+ http_version:
58
+ recorded_at: Mon, 01 Jan 2018 00:00:00 GMT
59
+ recorded_with: VCR 3.0.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.utc(2014))
6
+ Timecop.freeze(Time.utc(2018))
7
7
  end
8
8
 
9
9
  after do
@@ -13,7 +13,7 @@ describe NISTRandomnessBeacon::Client do
13
13
  describe 'current' do
14
14
  context 'successful response' do
15
15
  subject {
16
- VCR.use_cassette('current') do
16
+ VCR.use_cassette('current_v2') do
17
17
  NISTRandomnessBeacon::Client.new.current
18
18
  end
19
19
  }
@@ -29,8 +29,8 @@ describe NISTRandomnessBeacon::Client do
29
29
  }
30
30
 
31
31
  it 'raises service error' do
32
- stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
33
- expect{subject}.to raise_error
32
+ stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500, body: 'stubbed response')
33
+ expect{subject}.to raise_error(NISTRandomnessBeacon::ServiceError, 'stubbed response')
34
34
  end
35
35
  end
36
36
  end
@@ -38,8 +38,9 @@ describe NISTRandomnessBeacon::Client do
38
38
  describe 'previous' do
39
39
  context 'successful response' do
40
40
  subject {
41
- VCR.use_cassette('previous') do
42
- NISTRandomnessBeacon::Client.new.previous
41
+ VCR.use_cassette('previous_v2') do
42
+ # NOTE(chaserx): using frozen time above results in 404; this magic number works though
43
+ NISTRandomnessBeacon::Client.new(1517179800000).previous
43
44
  end
44
45
  }
45
46
 
@@ -54,8 +55,8 @@ describe NISTRandomnessBeacon::Client do
54
55
  }
55
56
 
56
57
  it 'raises service error' do
57
- stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
58
- expect{subject}.to raise_error
58
+ stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500, body: 'stubbed response')
59
+ expect{subject}.to raise_error(NISTRandomnessBeacon::ServiceError, 'stubbed response')
59
60
  end
60
61
  end
61
62
  end
@@ -63,7 +64,7 @@ describe NISTRandomnessBeacon::Client do
63
64
  describe 'next' do
64
65
  context 'successful response' do
65
66
  subject {
66
- VCR.use_cassette('next') do
67
+ VCR.use_cassette('next_v2') do
67
68
  NISTRandomnessBeacon::Client.new.next
68
69
  end
69
70
  }
@@ -79,8 +80,8 @@ describe NISTRandomnessBeacon::Client do
79
80
  }
80
81
 
81
82
  it 'raises service error' do
82
- stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
83
- expect{subject}.to raise_error
83
+ stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500, body: 'stubbed response')
84
+ expect{subject}.to raise_error(NISTRandomnessBeacon::ServiceError, 'stubbed response')
84
85
  end
85
86
  end
86
87
  end
@@ -88,7 +89,7 @@ describe NISTRandomnessBeacon::Client do
88
89
  describe 'last' do
89
90
  context 'successful response' do
90
91
  subject {
91
- VCR.use_cassette('last') do
92
+ VCR.use_cassette('last_v2') do
92
93
  NISTRandomnessBeacon::Client.new.last
93
94
  end
94
95
  }
@@ -104,8 +105,8 @@ describe NISTRandomnessBeacon::Client do
104
105
  }
105
106
 
106
107
  it 'raises service error' do
107
- stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
108
- expect{subject}.to raise_error
108
+ stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500, body: 'stubbed response')
109
+ expect{subject}.to raise_error(NISTRandomnessBeacon::ServiceError, 'stubbed response')
109
110
  end
110
111
  end
111
112
  end
@@ -113,8 +114,9 @@ describe NISTRandomnessBeacon::Client do
113
114
  describe 'start chain' do
114
115
  context 'successful response' do
115
116
  subject {
116
- VCR.use_cassette('start_chain') do
117
- NISTRandomnessBeacon::Client.new.start_chain
117
+ VCR.use_cassette('start_chain_v2') do
118
+ # NOTE(chaserx): using frozen time above results in 404; this magic number works though
119
+ NISTRandomnessBeacon::Client.new(1517179800000).start_chain
118
120
  end
119
121
  }
120
122
 
@@ -129,8 +131,8 @@ describe NISTRandomnessBeacon::Client do
129
131
  }
130
132
 
131
133
  it 'raises service error' do
132
- stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
133
- expect{subject}.to raise_error
134
+ stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500, body: 'stubbed response')
135
+ expect{subject}.to raise_error(NISTRandomnessBeacon::ServiceError, 'stubbed response')
134
136
  end
135
137
  end
136
138
  end
@@ -0,0 +1,43 @@
1
+ require_relative '../lib/nist_randomness_beacon/record.rb'
2
+ require 'spec_helper'
3
+
4
+ describe NISTRandomnessBeacon::Record do
5
+ describe 'a new record object' do
6
+ context 'initialized with camelCase args' do
7
+ it 'respond_to with an underscored instance method' do
8
+ record = NISTRandomnessBeacon::Record.new(statusCode: 'foo')
9
+ expect(record).to respond_to(:status_code)
10
+ end
11
+ end
12
+ end
13
+
14
+ describe 'humanized_status_code' do
15
+ context 'status code 0' do
16
+ record = NISTRandomnessBeacon::Record.new(statusCode: 0)
17
+ it 'returns all good' do
18
+ expect(record.humanized_status_code).to eq('Chain intact, values all good')
19
+ end
20
+ end
21
+
22
+ context 'status code 1' do
23
+ record = NISTRandomnessBeacon::Record.new(statusCode: 1)
24
+ it 'start of new chain' do
25
+ expect(record.humanized_status_code).to eq('Start of a new chain of values, previous hash value will be all zeroes')
26
+ end
27
+ end
28
+
29
+ context 'status code 2' do
30
+ record = NISTRandomnessBeacon::Record.new(statusCode: 2)
31
+ it 'time between greater than frequency with intact chain' do
32
+ expect(record.humanized_status_code).to eq('Time between values is greater than the frequency, but the chain is still intact')
33
+ end
34
+ end
35
+
36
+ context 'status code 3' do
37
+ record = NISTRandomnessBeacon::Record.new(statusCode: 3)
38
+ it 'time between greater than frequency with intact chain but precommitmentValue was lost' do
39
+ expect(record.humanized_status_code).to eq('Time between values is greater than the frequency, the chain is intact, but the input of the prior precommitmentValue was lost')
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,44 @@
1
+ require_relative '../lib/core_extensions/string/underscore.rb'
2
+ require 'spec_helper'
3
+ using Underscore
4
+
5
+ describe Underscore do
6
+ describe 'String#underscore' do
7
+ context 'singleword' do
8
+ it 'converts to underscore' do
9
+ expect('foobar'.underscore).to eq('foobar')
10
+ end
11
+ end
12
+
13
+ context 'camelCase' do
14
+ it 'converts to underscore' do
15
+ expect('fooBar'.underscore).to eq('foo_bar')
16
+ end
17
+ end
18
+
19
+ context 'multiWordCamelCase' do
20
+ it 'converts to underscore' do
21
+ expect('fooBarBaz'.underscore).to eq('foo_bar_baz')
22
+ end
23
+ end
24
+
25
+ context 'dashed-case' do
26
+ it 'converts to underscore' do
27
+ expect('foo-bar'.underscore).to eq('foo_bar')
28
+ end
29
+ end
30
+
31
+ context 'Dashed-Case' do
32
+ it 'converts to underscore' do
33
+ expect('Foo-Bar'.underscore).to eq('foo_bar')
34
+ end
35
+ end
36
+
37
+ context 'Nested::Module Case' do
38
+ it 'converts to slashed separator' do
39
+ expect('Foo::Bar'.underscore).to eq('foo/bar')
40
+ end
41
+ end
42
+ end
43
+ end
44
+
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.7
4
+ version: 0.2.0
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: 2017-12-22 00:00:00.000000000 Z
12
+ date: 2018-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -143,14 +143,14 @@ dependencies:
143
143
  requirements:
144
144
  - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: 0.15.6
146
+ version: '0.15'
147
147
  type: :runtime
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: 0.15.6
153
+ version: '0.15'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: json
156
156
  requirement: !ruby/object:Gem::Requirement
@@ -177,25 +177,35 @@ files:
177
177
  - ".gitignore"
178
178
  - ".rspec"
179
179
  - ".travis.yml"
180
+ - CODE_OF_CONDUCT.md
180
181
  - CONTRIBUTING.md
181
182
  - Gemfile
182
183
  - LICENSE.txt
183
184
  - README.md
184
185
  - Rakefile
186
+ - lib/core_extensions/string/underscore.rb
185
187
  - lib/nist_randomness_beacon.rb
186
188
  - lib/nist_randomness_beacon/client.rb
187
189
  - lib/nist_randomness_beacon/record.rb
188
190
  - lib/nist_randomness_beacon/service_error.rb
189
- - lib/nist_randomness_beacon/underscore.rb
190
191
  - lib/nist_randomness_beacon/version.rb
192
+ - nist_docs/beacon_definition_0-9.xml
193
+ - nist_docs/sample_response.json
191
194
  - nist_randomness_beacon.gemspec
192
195
  - spec/cassettes/current.yml
196
+ - spec/cassettes/current_v2.yml
193
197
  - spec/cassettes/last.yml
198
+ - spec/cassettes/last_v2.yml
194
199
  - spec/cassettes/next.yml
200
+ - spec/cassettes/next_v2.yml
195
201
  - spec/cassettes/previous.yml
202
+ - spec/cassettes/previous_v2.yml
196
203
  - spec/cassettes/start_chain.yml
204
+ - spec/cassettes/start_chain_v2.yml
197
205
  - spec/client_spec.rb
206
+ - spec/record_spec.rb
198
207
  - spec/spec_helper.rb
208
+ - spec/underscore_spec.rb
199
209
  homepage: https://github.com/chaserx/nist_randomness_beacon
200
210
  licenses:
201
211
  - MIT
@@ -208,8 +218,8 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
218
  requirements:
209
219
  - - ">="
210
220
  - !ruby/object:Gem::Version
211
- version: 2.2.0
212
- - - "<"
221
+ version: 2.3.0
222
+ - - "<="
213
223
  - !ruby/object:Gem::Version
214
224
  version: 2.5.0
215
225
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -219,16 +229,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
229
  version: '0'
220
230
  requirements: []
221
231
  rubyforge_project:
222
- rubygems_version: 2.6.13
232
+ rubygems_version: 2.7.4
223
233
  signing_key:
224
234
  specification_version: 4
225
235
  summary: A wrapper for the National Institute of Standards and Technology (NIST) Randomness
226
236
  Beacon.
227
237
  test_files:
228
238
  - spec/cassettes/current.yml
239
+ - spec/cassettes/current_v2.yml
229
240
  - spec/cassettes/last.yml
241
+ - spec/cassettes/last_v2.yml
230
242
  - spec/cassettes/next.yml
243
+ - spec/cassettes/next_v2.yml
231
244
  - spec/cassettes/previous.yml
245
+ - spec/cassettes/previous_v2.yml
232
246
  - spec/cassettes/start_chain.yml
247
+ - spec/cassettes/start_chain_v2.yml
233
248
  - spec/client_spec.rb
249
+ - spec/record_spec.rb
234
250
  - spec/spec_helper.rb
251
+ - spec/underscore_spec.rb
@@ -1,12 +0,0 @@
1
- # Add underscore string transformation like rails does.
2
- # http://stackoverflow.com/a/1509939/281699
3
- #
4
- class String
5
- def underscore
6
- self.gsub(/::/, '/').
7
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
8
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
9
- tr("-", "_").
10
- downcase
11
- end
12
- end