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 +4 -4
- data/lib/terminalwire/licensing.rb +9 -5
- data/lib/terminalwire/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75d01d183f7babe341773fad359c35f4ea478430792a2f292f3e1bce52b6b0ec
|
4
|
+
data.tar.gz: 4634c87d3d66e1553d7ae6ddf6198b9a5da72c1a9a2eb597e9bb1c9556effe8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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 =
|
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
|
data/lib/terminalwire/version.rb
CHANGED