terminalwire 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b3e02592c8154c835d32f4dc149d47212665f5dd2974d2634746207ced582b3
4
- data.tar.gz: 0a4b15090653b5b54a10a215db6a39ee5465cac9a10c4e1cd29ba7fc0622822a
3
+ metadata.gz: 75d01d183f7babe341773fad359c35f4ea478430792a2f292f3e1bce52b6b0ec
4
+ data.tar.gz: 4634c87d3d66e1553d7ae6ddf6198b9a5da72c1a9a2eb597e9bb1c9556effe8b
5
5
  SHA512:
6
- metadata.gz: d74b1186e46a73eb62de35f0624f20a4f3f90aa8bf24137b772423a87a09bea920886824d7175c5b08bd18c963b3823c4cccbff0e7abd44120bfe186edda84e6
7
- data.tar.gz: 9997f63145801d3ca47476ead70f49ac001f77765cb777063b44b62d96e1b3dfdf266f42897fae01eb0a9a224e8fddeb5e878533e773f11aaafe2e81512a48f4
6
+ metadata.gz: c0588f7064884a7e76b111aee494dd6ee0d694766afac82cf7aee8c420fd5b9b108991ecee6e57f5800fb54752e580ed240129aa2085b2f6134ac85478845ebe
7
+ data.tar.gz: afb0912cdc926020e32a6976562dfe59ff66365a90c17b3b3a35cf45ccd408a41182ba69403b07f10fdcd7538e7bc120379c58fc10f8fc64cca5576980e8b470
@@ -14,6 +14,10 @@ module Terminalwire::Licensing
14
14
  generate_private_key.to_pem
15
15
  end
16
16
 
17
+ def self.time
18
+ Time.now.utc
19
+ end
20
+
17
21
  # Handles encoding data into a license key with prefixes that can be packed and unpacked.
18
22
  module Key
19
23
  # Mix into classes that need to generate or read keys
@@ -84,10 +88,10 @@ module Terminalwire::Licensing
84
88
 
85
89
  VERSION = "1.0".freeze
86
90
 
87
- def initialize(public_key:, license_url:)
91
+ def initialize(public_key:, license_url:, generated_at: Terminalwire::Licensing.time)
88
92
  @public_key = public_key
89
93
  @license_url = URI(license_url)
90
- @generated_at = Time.now.utc
94
+ @generated_at = generated_at
91
95
  end
92
96
 
93
97
  def to_h
@@ -111,7 +115,7 @@ module Terminalwire::Licensing
111
115
 
112
116
  # This means the server will tolerate a 10 minute drift in the generated_at time.
113
117
  def self.drift
114
- now = Time.now.utc
118
+ now = Terminalwire::Licensing.time
115
119
  (now - DRIFT_SECONDS)...(now + DRIFT_SECONDS)
116
120
  end
117
121
 
@@ -147,10 +151,10 @@ module Terminalwire::Licensing
147
151
  include Key::Serialization
148
152
  PREFIX = "client_key_".freeze
149
153
 
150
- def initialize(server_key:)
154
+ def initialize(server_key:, generated_at: Terminalwire::Licensing.time)
151
155
  @data = Issuer::ServerKeyGenerator.deserialize server_key
152
- @generated_at = Time.now.utc
153
156
  @license_url = URI(@data.fetch("license_url"))
157
+ @generated_at = generated_at
154
158
  end
155
159
 
156
160
  def to_h
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Terminalwire
4
- VERSION = "0.1.13"
4
+ VERSION = "0.1.14"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminalwire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler