intercom-rails 1.0.6 → 1.1.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: 5c9335eca559ae32c3965cf1969443c0e20b65d29b81f1e5c6200d1d9e8d734c
4
- data.tar.gz: 120b0878b7f09a4301c94c2c8dbc0c0376623a91e48948339482aafd203c9b99
3
+ metadata.gz: 274c2855076beb153ba6dcf5ecdc639bcac1a2515bfe74a7042b84df61eab363
4
+ data.tar.gz: 59e0d09f3dca2b46db7e6e3829d39a89f75eef845c1608f690e87bad41505f0f
5
5
  SHA512:
6
- metadata.gz: f584dbf2f062e00f9b3d00b53a5cf8b9bef4406cf79f1afa5af805e106a7ef52402668a01f45f5302c04a15985d808651022d45be8b4af6ec8a52a571c12b7f9
7
- data.tar.gz: cadbf3a8a2927260fc51131f688f8a5ae321af6d5d661db9688efa3c2bf2276608ae28264c0b535494610cac561f551151cdedaca4f78dae9b39f9f0bf1ec2d4
6
+ metadata.gz: eebe74df506580a99a1fbe68857ab6c86c140e1db905c4cc96307aa0baa984b2d5efcf852eff43baaf7e6edb4b0937c2340a26b56f602339014478bf92e5c4bd
7
+ data.tar.gz: f3d98e2f4fa9083ba632faa4852028656e20c4b4c14c931dc3caa6dea429957efd9f0402b84be390dd2a97ee9bf0d002622206f455835277844d13f69e5b8aff
data/README.md CHANGED
@@ -69,6 +69,53 @@ It is possible to enable Identity Verification for the Intercom Messenger and yo
69
69
  ```
70
70
  **Note: This example is just for the sake of simplicity, you should never include this secret in source control. Instead, you should use the Rails [secret config](http://guides.rubyonrails.org/4_1_release_notes.html#config-secrets-yml) feature.**
71
71
 
72
+ ### JWT Authentication
73
+ You can enable JWT authentication for enhanced security with the Intercom Messenger. This feature uses JSON Web Tokens (JWTs) to authenticate users instead of the traditional user_hash method. To enable JWT authentication, add the following to your `config/initializers/intercom.rb`:
74
+
75
+ ```ruby
76
+ config.jwt.enabled = true
77
+ ```
78
+
79
+ #### JWT Expiry
80
+ You can set an expiry time for JWTs. This determines how long the token remains valid:
81
+
82
+ ```ruby
83
+ config.jwt.expiry = 12.hours # Token expires after 12 hours
84
+ ```
85
+
86
+ If no expiry is set, the JWT will not include an expiration claim.
87
+
88
+ #### Signed User Fields
89
+ You can specify which user fields should be included in the JWT payload and removed from the client-side settings for enhanced security:
90
+
91
+ ```ruby
92
+ config.jwt.signed_user_fields = [:email, :name, :plan, :team_id]
93
+ ```
94
+
95
+ With this configuration, these fields will be:
96
+ - Included in the signed JWT payload
97
+ - Removed from the client-side `intercomSettings` object
98
+ - Still available to Intercom through the secure JWT
99
+
100
+ #### Per-Request JWT Configuration
101
+ You can also configure JWT settings on a per-request basis using the `intercom_script_tag` helper:
102
+
103
+ ```erb
104
+ <%= intercom_script_tag({
105
+ :user_id => current_user.id,
106
+ :email => current_user.email
107
+ }, {
108
+ :jwt_enabled => true,
109
+ :jwt_expiry => 1.hour
110
+ }) %>
111
+ ```
112
+
113
+ **Important Notes:**
114
+ - JWT authentication requires an `api_secret` to be configured
115
+ - JWT is only generated when a `user_id` is present
116
+ - When JWT is enabled, the `user_id` is removed from client-side settings and only included in the secure JWT
117
+ - Other configured signed fields are also removed from client-side settings when JWT is used
118
+
72
119
  ### Shutdown
73
120
  We make use of first-party cookies so that we can identify your users the next time they open your messenger. When people share devices with someone else, they might be able to see the most recently logged in user’s conversation history until the cookie expires. Because of this, it’s very important to properly shutdown Intercom when a user’s session on your app ends (either manually or due to an automated logout).
74
121
 
@@ -342,7 +389,7 @@ CSP support for automatic insertion exposes two namespaces that can be defined b
342
389
  - String CoreExtensions::IntercomRails::AutoInclude.csp_nonce_hook(controller)
343
390
  - nil CoreExtensions::IntercomRails::AutoInclude.csp_sha256_hook(controller, SHA-256 whitelist entry)
344
391
 
345
- For instance, a CSP nonce can be inserted using the [Twitter Secure Headers](https://github.com/twitter/secureheaders) gem with the following code:
392
+ For instance, a CSP nonce can be inserted using the [Github Secure Headers](https://github.com/github/secure_headers) gem with the following code:
346
393
  ```ruby
347
394
  module CoreExtensions
348
395
  module IntercomRails
@@ -1,3 +1,3 @@
1
1
  module IntercomRails
2
- VERSION = "1.0.6"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intercom-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben McRedmond
8
8
  - Ciaran Lee
9
9
  - Darragh Curran
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2025-01-13 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: activesupport
@@ -30,14 +29,14 @@ dependencies:
30
29
  name: jwt
31
30
  requirement: !ruby/object:Gem::Requirement
32
31
  requirements:
33
- - - "~>"
32
+ - - ">="
34
33
  - !ruby/object:Gem::Version
35
34
  version: '2.0'
36
35
  type: :runtime
37
36
  prerelease: false
38
37
  version_requirements: !ruby/object:Gem::Requirement
39
38
  requirements:
40
- - - "~>"
39
+ - - ">="
41
40
  - !ruby/object:Gem::Version
42
41
  version: '2.0'
43
42
  - !ruby/object:Gem::Dependency
@@ -187,7 +186,6 @@ homepage: http://www.intercom.io
187
186
  licenses:
188
187
  - MIT
189
188
  metadata: {}
190
- post_install_message:
191
189
  rdoc_options: []
192
190
  require_paths:
193
191
  - lib
@@ -202,8 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
200
  - !ruby/object:Gem::Version
203
201
  version: '0'
204
202
  requirements: []
205
- rubygems_version: 3.5.22
206
- signing_key:
203
+ rubygems_version: 4.0.3
207
204
  specification_version: 4
208
205
  summary: Rails helper for emitting javascript script tags for Intercom
209
206
  test_files: []