standard_id-apple 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7db1f2bf7e9ca298170b1fd939861afa6cc7bfb4f0484d65a99cf06274b95404
4
- data.tar.gz: d4ff95dc965d633f658f94ead84fe29d90e93c4ff7f5afd08e59e75047316fab
3
+ metadata.gz: a2c661ab3219d658644753386d53763d2089d8a34be3ed284aa3accc75dd716e
4
+ data.tar.gz: ff131b184ec7362ba62fbbbb3c221bb526ec85a43bc411191b7be5859585a31d
5
5
  SHA512:
6
- metadata.gz: f3aeae7c8231a8198b5ccaee495df7ecb5b55d2585b8a841e3a7b0acee3b7857494a2a16cf9dea1ffda0ed145d265ef90951e8a2de91b8f9e32a523e5d412d2d
7
- data.tar.gz: 6723a8e130168d7c5c5b5bf4e6a5b7ee9aecf1d0ba223f661ad4a48b4cd1d415965e2e7b5ecab99f311fd2ac4df302c85c1aa3d7e545a4608ff4ba1b327dbe75
6
+ metadata.gz: 59ede2f59e7a426115af1e6fc4f142f8ce7793a6e772f79a44fcd39ec687f0f9048f3b3b62a5c70224519df6d04feaa48bcb9b2acf5c955e1719c26e007eb1d2
7
+ data.tar.gz: 1a235ff4d4d3674fcb6a061f71a6eff606c289e59c595f182f000ba038145763fe5de651f1a2fa31a4df80b5e7e7514c48ab3df4b86fa7f41cabac0f8f21a6ae
data/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.11.0] - 2026-11-25
11
+
12
+ ### Added
13
+
14
+ - **Announces its env vars to standard_health.** With standard_health 0.9+ loaded, the plugin
15
+ contributes its variables through standard_health's load hook, under `standard_id-apple`, so
16
+ apps no longer declare them by hand: `APPLE_CLIENT_ID` and `APPLE_MOBILE_CLIENT_ID`
17
+ (recommended), `APPLE_REDIRECT_URI` (recommended once the provider is on), and the signing triple
18
+ `APPLE_PRIVATE_KEY` / `APPLE_KEY_ID` / `APPLE_TEAM_ID` (required only once `apple_client_id`
19
+ switches the provider on and the app leaves the field to ENV, matching the boot check). Nothing is
20
+ required unconditionally, and an app's own `env_spec` declaration still wins. No dependency on
21
+ standard_health: without it the hook never runs.
22
+
10
23
  ## [0.10.0] - 2026-11-25
11
24
 
12
25
  ### Fixed
data/README.md CHANGED
@@ -97,6 +97,25 @@ token against Apple's JWKS and needs no signing key. A native-only app (mobile
97
97
  client ID set, `apple_client_id` not) is therefore "not enabled" for the web
98
98
  UI while its native sign-in keeps working.
99
99
 
100
+ ### standard_health
101
+
102
+ With [standard_health](https://github.com/rarebit-one/standard_health) 0.9+ in
103
+ the bundle, the plugin declares these variables on `/diagnostics/env` and in
104
+ `Checks::EnvSpecAudit`, grouped under `standard_id-apple`, so apps need not
105
+ list them by hand. Without standard_health nothing happens: the gem does not
106
+ depend on it.
107
+
108
+ | Variable | Level | Applies |
109
+ |---|---|---|
110
+ | `APPLE_CLIENT_ID` | recommended | always (unset leaves the provider off) |
111
+ | `APPLE_MOBILE_CLIENT_ID` | recommended | always (only apps with an iOS client need it) |
112
+ | `APPLE_REDIRECT_URI` | recommended | once the provider is on |
113
+ | `APPLE_PRIVATE_KEY`, `APPLE_KEY_ID`, `APPLE_TEAM_ID` | required | once the provider is on, for each field the app leaves to ENV (and, for the key, while `APPLE_PRIVATE_KEY_PEM` doesn't supply it) |
114
+
115
+ The required rows follow the boot check above: they apply exactly when
116
+ `apple_client_id` is set. An app that declares any of them in its own
117
+ `env_spec` overrides the row here.
118
+
100
119
  ### Flows
101
120
 
102
121
  | Flow | Audience (`client_id`) | Needs signing key |
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Offers the plugin's env vars to standard_health without depending on it.
4
+ # The block runs only when standard_health is loaded (it fires
5
+ # `run_load_hooks(:standard_health, ...)`), whichever gem loads first; without
6
+ # standard_health it never runs. It receives standard_health's contribution
7
+ # registry, of which only `contribute_env_vars` is used here.
8
+ #
9
+ # The provider stays off until apple_client_id is set, so nothing here is
10
+ # required unconditionally: the signing triple (APPLE_PRIVATE_KEY, APPLE_KEY_ID,
11
+ # APPLE_TEAM_ID) becomes required only once the provider is on and the app
12
+ # leaves the field to its ENV fallback, exactly when StandardId's boot check
13
+ # would report it missing. An app that declares any of these vars in its own
14
+ # env_spec overrides the row here.
15
+ ActiveSupport.on_load(:standard_health) do |health|
16
+ apple = StandardId::Providers::Apple
17
+
18
+ # Whether +field+ is left to its ENV fallback: the app never assigned it
19
+ # (standard_id < 0.43 can't tell, so it counts as unassigned) and no
20
+ # deprecated name is supplying it. An app that assigns the field, from
21
+ # credentials say, needs no ENV var for it.
22
+ legacy_env = { apple_private_key: apple::LEGACY_PRIVATE_KEY_ENV }
23
+ from_env = lambda do |field|
24
+ social = StandardId.config.social
25
+ assigned = social.respond_to?(:assigned?) && social.assigned?(field)
26
+ !assigned && (legacy_env[field].nil? || ENV[legacy_env[field]].blank?)
27
+ end
28
+
29
+ health.contribute_env_vars "standard_id-apple" do
30
+ recommended :APPLE_CLIENT_ID,
31
+ description: "Sign in with Apple web Services ID (social.apple_client_id). Setting it switches the provider " \
32
+ "on and makes the APPLE_PRIVATE_KEY / APPLE_KEY_ID / APPLE_TEAM_ID triple required; unset " \
33
+ "leaves the provider off"
34
+ recommended :APPLE_MOBILE_CLIENT_ID,
35
+ description: "App bundle ID for native Sign in with Apple (social.apple_mobile_client_id). Only apps with an " \
36
+ "iOS client need it; the native id_token flow is verified against Apple's JWKS, so it needs no " \
37
+ "signing key"
38
+ recommended :APPLE_REDIRECT_URI, if: -> { apple.enabled? },
39
+ description: "Return URL for a web-flow code exchanged without one (social.apple_redirect_uri), e.g. Android " \
40
+ "signing in through Apple's web flow via the API callback. Optional otherwise"
41
+ required :APPLE_PRIVATE_KEY, if: -> { apple.enabled? && from_env.call(:apple_private_key) },
42
+ description: "Apple EC private key (PEM) that signs the client_secret JWT (social.apple_private_key). A " \
43
+ "secret. Required once APPLE_CLIENT_ID switches the provider on, unless the app assigns the " \
44
+ "field itself; without it the callback fails after the user has authenticated with Apple. " \
45
+ "Replaces the deprecated APPLE_PRIVATE_KEY_PEM"
46
+ required :APPLE_KEY_ID, if: -> { apple.enabled? && from_env.call(:apple_key_id) },
47
+ description: "Key ID (kid) of the Apple private key (social.apple_key_id). Required once APPLE_CLIENT_ID " \
48
+ "switches the provider on, unless the app assigns the field itself"
49
+ required :APPLE_TEAM_ID, if: -> { apple.enabled? && from_env.call(:apple_team_id) },
50
+ description: "Apple Developer Team ID, the client_secret JWT's issuer (social.apple_team_id). Required once " \
51
+ "APPLE_CLIENT_ID switches the provider on, unless the app assigns the field itself"
52
+ end
53
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module StandardId
4
4
  module Apple
5
- VERSION = "0.10.0"
5
+ VERSION = "0.11.0"
6
6
  end
7
7
  end
@@ -3,6 +3,7 @@ require "active_support/core_ext/hash/indifferent_access"
3
3
  require "standard_id"
4
4
  require "standard_id/apple/version"
5
5
  require "standard_id/apple/providers/apple"
6
+ require "standard_id/apple/health_contributions"
6
7
 
7
8
  # Registers the provider from a Railtie's after_initialize (a no-op outside
8
9
  # Rails). Its config fields are declared earlier, before config/initializers,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard_id-apple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rarebit One
@@ -73,6 +73,7 @@ files:
73
73
  - lib/generators/standard_id/apple/install/templates/initializer.rb.erb
74
74
  - lib/standard_id/apple.rb
75
75
  - lib/standard_id/apple/errors.rb
76
+ - lib/standard_id/apple/health_contributions.rb
76
77
  - lib/standard_id/apple/providers/apple.rb
77
78
  - lib/standard_id/apple/version.rb
78
79
  homepage: https://github.com/rarebit-one/standard_id_apple