jwtear 1.0.7 → 1.1.7

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: 2681c86bec09d95803c8051feae4f7a647f2fda293425c5b01c25e8d7b97977b
4
- data.tar.gz: 20db1a8f7aea19fe20e96d736e0df7b83626e73c9cf7df8e9033fbe55f9459ee
3
+ metadata.gz: ec80cbd22ceeba8225079c072f491c14489d9621921257c57ff7663ee4626ae8
4
+ data.tar.gz: aca681e7e119897223b99ac347c6eeadf8c90525d16a80b46e76d871f4ce9d04
5
5
  SHA512:
6
- metadata.gz: 20c40cce0192a37fc2924799597d584a891a192c81f31376f02edf24f944c22378eb253e799569fce6ea6e2926e7c15af3e5acb5672d6470f7e355f6179eb3f1
7
- data.tar.gz: ca85ee1cb1b2a6a1ea6267b0a952bf5586fbf92d215069d5739d5642bf80a5456849be75ea9205869249a7cb4ee15fa94a109f4321a1dcb2cead8b790bf293bf
6
+ metadata.gz: 59045d652e34c71a8cd451f723bf11e86faf506644c394d3012898a1836dbee7ee51896719499aa3e4191aca34e6d1383e3fb518a5758521527adb41d7a8312d
7
+ data.tar.gz: d1b6f5ca3bee6d04ad0e3623c88e54444f17357aececc0b2a5bb6ef3ee9bf8026df5288dbdeaea885afaad5bda186ebb7a9b7fb4cff2123cc776c4a13dff4447
@@ -1,3 +1,3 @@
1
1
  module JWTear
2
- VERSION = "1.0.7"
2
+ VERSION = "1.1.7"
3
3
  end
data/plugins/parse.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'time'
2
+
1
3
  module JWTear
2
4
  module CLI
3
5
  extend GLI::App
@@ -83,10 +85,28 @@ module JWTear
83
85
  def print_jws_payload(payload)
84
86
  print_h2 "Payload"
85
87
  payload.each do |k, v|
86
- print_h3 "#{k}" , "#{v}"
88
+ if k == "iat" || k == "nbf"
89
+ print_h3 "#{k}" , "#{v}", "\tTIMESTAMP = #{Time.at(v)}".green
90
+ elsif k == "exp"
91
+ compare_time_with_now(k,v)
92
+ else
93
+ print_h3 "#{k}" , "#{v}"
94
+ end
87
95
  end
88
96
  end
89
97
 
98
+ def compare_time_with_now(k, timestamp)
99
+ if timestamp.nil?
100
+ return
101
+ end
102
+ readable_time = Time.at(timestamp)
103
+ if readable_time < Time.now
104
+ print_h3 "#{k}", "#{timestamp}", "\tTIMESTAMP = #{readable_time}\t(EXPIRED)".red
105
+ else
106
+ print_h3 "#{k}", "#{timestamp}", "\tTIMESTAMP = #{readable_time}".green
107
+ end
108
+ end
109
+
90
110
  def print_jws_sig(signature)
91
111
  print_h2 "Signature - B64 encoded"
92
112
  puts Base64.urlsafe_encode64(@token.signature, padding: false)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jwtear
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - KING SABRI