apple_id 1.4.2 → 1.5.1

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: 2fee18e5a9878a0458806d26573fc4434ced6d9cec92700189c8f31077874280
4
- data.tar.gz: 18bbca83bb744fe286e908785418eb0583fa3f3b3f059dbba56f4166be3bb496
3
+ metadata.gz: 30783167b911191c1e590bf91b9377044129a89a4cd97e1af57eb4ccf5f0d27e
4
+ data.tar.gz: 9d1c86ca627ca14b4fd2c37172cb0808398583ffb1a09359fefdb3d8181b012e
5
5
  SHA512:
6
- metadata.gz: 3d01d0cf6e69b4146b58c9d2a5354bdf235bd836b3778fcc90d89d2d760c40272182df367f665cf1e8137a397921867df7d3bfc4fec056bd3b48724773f8b371
7
- data.tar.gz: 8d2410bbd7134dde8a58ab157717d35880b397810c5769ab2bf673f1d6a1b4c11658f781f29e51f6f6d705d3bf8d9bc3763da8ce444969d1f7e6682918029a98
6
+ metadata.gz: 48179d986d4d6a7a94a5f50ac7d832823a6fc5070804a55da8fd309ee43873c97bac0eba0c0732c555a5084882f2a175c85f6ea745384332e426204971fb2610
7
+ data.tar.gz: 91201d90d8a9c6168d0f80da32b8359a9eb9f40e3d00e731ec7851743995a3ff5d3424a86c05aed6beb809f37b2c33d14597e1bdf7f11d6f41ef4eddc8fe2d12
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.2
1
+ 1.5.1
data/apple_id.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ['lib']
20
20
 
21
+ spec.add_runtime_dependency 'json-jwt', '~> 1.15.0'
21
22
  spec.add_runtime_dependency 'rack-oauth2', '~> 1.21.2'
22
23
  spec.add_runtime_dependency 'openid_connect', '~> 1.3.0'
23
24
  spec.add_development_dependency 'bundler'
@@ -1,6 +1,7 @@
1
1
  module AppleID
2
2
  class EventToken::Event < OpenIDConnect::ConnectObject
3
3
  attr_required :type, :sub, :event_time
4
+ attr_optional :email, :is_private_email
4
5
 
5
6
  module Type
6
7
  EMAIL_ENABLED = 'email-enabled'
@@ -26,6 +27,14 @@ module AppleID
26
27
  end
27
28
  alias_method :account_delete?, :account_deleted?
28
29
 
30
+ def is_private_email?
31
+ if is_private_email.is_a? String
32
+ is_private_email == 'true'
33
+ else
34
+ !!is_private_email
35
+ end
36
+ end
37
+
29
38
  class << self
30
39
  def decode(json_string)
31
40
  new JSON.parse(json_string).with_indifferent_access
@@ -6,6 +6,8 @@ module AppleID
6
6
  alias_method :original_jwt, :raw_attributes
7
7
  alias_method :event, :events
8
8
 
9
+ delegate :type, :sub, :event_time, :email_enabled?, :email_disabled?, :consent_revoked?, :account_deleted?, to: :event
10
+
9
11
  def initialize(attributes = {})
10
12
  super
11
13
  @events = Event.decode attributes[:events]
data/lib/apple_id/jwks.rb CHANGED
@@ -1,27 +1,14 @@
1
1
  module AppleID
2
2
  class JWKS < JSON::JWK::Set
3
- class Cache
4
- def fetch(cache_key)
5
- yield
6
- end
7
- end
8
-
9
3
  def self.cache=(cache)
10
- @@cache = cache
4
+ JSON::JWK::Set::Fetcher.cache = cache
11
5
  end
12
6
  def self.cache
13
- @@cache
7
+ JSON::JWK::Set::Fetcher.cache
14
8
  end
15
- self.cache = Cache.new
16
9
 
17
- def self.fetch(cache_key)
18
- jwks = cache.fetch("apple_id:jwks:#{cache_key}") do
19
- new(
20
- JSON.parse(
21
- OpenIDConnect.http_client.get_content(JWKS_URI)
22
- ).with_indifferent_access[:keys]
23
- )
24
- end
10
+ def self.fetch(kid)
11
+ JSON::JWK::Set::Fetcher.fetch JWKS_URI, kid: kid
25
12
  end
26
13
  end
27
14
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apple_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-13 00:00:00.000000000 Z
11
+ date: 2022-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json-jwt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.15.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.15.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rack-oauth2
15
29
  requirement: !ruby/object:Gem::Requirement