json-jwt 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of json-jwt might be problematic. Click here for more details.

Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/json/jwk.rb +20 -0
  3. data/lib/json/jwt.rb +1 -0
  4. metadata +3 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/lib/json/jwk.rb ADDED
@@ -0,0 +1,20 @@
1
+ module JSON
2
+ class JWK
3
+ class << self
4
+ def encode(public_key, kid = nil)
5
+ json = case public_key
6
+ when OpenSSL::PKey::RSA
7
+ {
8
+ alg: :RSA,
9
+ exp: UrlSafeBase64.encode64(public_key.e.to_s(2)),
10
+ mod: UrlSafeBase64.encode64(public_key.n.to_s(2))
11
+ }
12
+ else
13
+ raise "Only OpenSSL::PKey::RSA is supported now"
14
+ end
15
+ json[:kid] = kid if kid.present?
16
+ json
17
+ end
18
+ end
19
+ end
20
+ end
data/lib/json/jwt.rb CHANGED
@@ -82,3 +82,4 @@ end
82
82
 
83
83
  require 'json/jws'
84
84
  require 'json/jwe'
85
+ require 'json/jwt'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-05 00:00:00.000000000 Z
12
+ date: 2012-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -142,6 +142,7 @@ files:
142
142
  - VERSION
143
143
  - json-jwt.gemspec
144
144
  - lib/json/jwe.rb
145
+ - lib/json/jwk.rb
145
146
  - lib/json/jws.rb
146
147
  - lib/json/jwt.rb
147
148
  - spec/fixtures/rsa/private_key.pem