web-push 3.0.0 → 3.0.1

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: c8a683629bc333d1f987fc867dd05b4d0af39179e94cc8dc7c9742dbaddd4c45
4
- data.tar.gz: 1c86dcbfcbec2791df28c45c2dff656ca8385b5a3fb75d900fb731e7472887f9
3
+ metadata.gz: a688b354339ddf4f82d8febb54a2042bb432357dffd77a571c3c9212c107aa2f
4
+ data.tar.gz: 01060b2687a57217cafb2cf96b3925c6e2e39102daf6f796277d06d767ae6a0e
5
5
  SHA512:
6
- metadata.gz: 8e33057f0c869ea54dd952f5b937fe6ca01c49a7d82549a7563fd4b148a315eba627d791f5c39d844834b2418466b21f7c58ae382c310fdc339b1560be508234
7
- data.tar.gz: 813fc19fb5939a5318409ac30651d31050d22e006213305e549899b109cde83ddcc3dfac17a7d1c1abc016ebc6dbb3235f17fd049eff96738be4e2832be55917
6
+ metadata.gz: 2386c18e4fef78c027b2a5dee6a1778dc82d43cf26dcf0468e83feb8ff972eca1b743c87d68612fffee8ea9feb05329bc4a06127599643de72d922b465aca776
7
+ data.tar.gz: b023139054b433c36d32d5a91465e8d0082231a6c7c2e8f0ff79825599457c28b57e51ffcabdf21e7fb03ab5e63a28750c00fddfea74204c3f8da640fd9ffe38
data/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
 
6
6
  This gem makes it possible to send push messages to web browsers from Ruby backends using the [Web Push Protocol](https://datatracker.ietf.org/doc/html/rfc8030). It supports [Message Encryption for Web Push](https://datatracker.ietf.org/doc/html/rfc8291) and [VAPID](https://datatracker.ietf.org/doc/html/rfc8292).
7
7
 
8
+ **Note**: This is an open source gem for Web Push. If you want to send web push notifications from Ruby using Pushpad, you need to use another gem ([pushpad gem](https://github.com/pushpad/pushpad-ruby)).
9
+
8
10
  ## Installation
9
11
 
10
12
  Add this line to the Gemfile:
@@ -178,7 +180,7 @@ WebPush.payload_send(
178
180
  p256dh: "BO/aG9nYXNkZmFkc2ZmZHNmYWRzZmFl...",
179
181
  auth: "aW1hcmthcmFpa3V6ZQ==",
180
182
  vapid: {
181
- subject: "mailto:sender@example.com"
183
+ subject: "mailto:sender@example.com",
182
184
  pem: ENV['VAPID_KEYS']
183
185
  }
184
186
  )
@@ -8,6 +8,7 @@ module WebPush
8
8
  assert_arguments(message, p256dh, auth)
9
9
 
10
10
  group_name = 'prime256v1'
11
+ hash = 'SHA256'
11
12
  salt = Random.new.bytes(16)
12
13
 
13
14
  server = OpenSSL::PKey::EC.generate(group_name)
@@ -25,11 +26,11 @@ module WebPush
25
26
  content_encryption_key_info = "Content-Encoding: aes128gcm\0"
26
27
  nonce_info = "Content-Encoding: nonce\0"
27
28
 
28
- prk = HKDF.new(shared_secret, salt: client_auth_token, algorithm: 'SHA256', info: info).read(32)
29
+ prk = OpenSSL::KDF.hkdf(shared_secret, salt: client_auth_token, info: info, hash: hash, length: 32)
29
30
 
30
- content_encryption_key = HKDF.new(prk, salt: salt, info: content_encryption_key_info).read(16)
31
+ content_encryption_key = OpenSSL::KDF.hkdf(prk, salt: salt, info: content_encryption_key_info, hash: hash, length: 16)
31
32
 
32
- nonce = HKDF.new(prk, salt: salt, info: nonce_info).read(12)
33
+ nonce = OpenSSL::KDF.hkdf(prk, salt: salt, info: nonce_info, hash: hash, length: 12)
33
34
 
34
35
  ciphertext = encrypt_payload(message, content_encryption_key, nonce)
35
36
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WebPush
4
- VERSION = '3.0.0'.freeze
4
+ VERSION = '3.0.1'.freeze
5
5
  end
data/lib/web_push.rb CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'openssl'
4
4
  require 'base64'
5
- require 'hkdf'
6
5
  require 'jwt'
7
6
  require 'uri'
8
7
  require 'net/http'
@@ -65,10 +65,10 @@ describe WebPush::Encryption do
65
65
  content_encryption_key_info = "Content-Encoding: aes128gcm\0"
66
66
  nonce_info = "Content-Encoding: nonce\0"
67
67
 
68
- prk = HKDF.new(shared_secret, salt: client_auth_token, algorithm: 'SHA256', info: info).read(32)
68
+ prk = OpenSSL::KDF.hkdf(shared_secret, salt: client_auth_token, info: info, hash: 'SHA256', length: 32)
69
69
 
70
- content_encryption_key = HKDF.new(prk, salt: salt, info: content_encryption_key_info).read(16)
71
- nonce = HKDF.new(prk, salt: salt, info: nonce_info).read(12)
70
+ content_encryption_key = OpenSSL::KDF.hkdf(prk, salt: salt, info: content_encryption_key_info, hash: 'SHA256', length: 16)
71
+ nonce = OpenSSL::KDF.hkdf(prk, salt: salt, info: nonce_info, hash: 'SHA256', length: 12)
72
72
 
73
73
  decrypt_ciphertext(ciphertext, content_encryption_key, nonce)
74
74
  end
data/web-push.gemspec CHANGED
@@ -14,7 +14,6 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.required_ruby_version = '>= 3.0'
16
16
 
17
- spec.add_dependency 'hkdf', '~> 1.0'
18
17
  spec.add_dependency 'jwt', '~> 2.0'
19
18
  spec.add_dependency 'openssl', '~> 3.0'
20
19
 
metadata CHANGED
@@ -1,30 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web-push
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - zaru
8
8
  - collimarco
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-05 00:00:00.000000000 Z
12
+ date: 2023-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: hkdf
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '1.0'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: '1.0'
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: jwt
30
16
  requirement: !ruby/object:Gem::Requirement
@@ -95,7 +81,7 @@ dependencies:
95
81
  - - "~>"
96
82
  - !ruby/object:Gem::Version
97
83
  version: '3.0'
98
- description:
84
+ description:
99
85
  email:
100
86
  - support@pushpad.xyz
101
87
  executables: []
@@ -124,7 +110,7 @@ homepage: https://github.com/pushpad/web-push
124
110
  licenses:
125
111
  - MIT
126
112
  metadata: {}
127
- post_install_message:
113
+ post_install_message:
128
114
  rdoc_options: []
129
115
  require_paths:
130
116
  - lib
@@ -139,8 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
125
  - !ruby/object:Gem::Version
140
126
  version: '0'
141
127
  requirements: []
142
- rubygems_version: 3.4.1
143
- signing_key:
128
+ rubygems_version: 3.0.3.1
129
+ signing_key:
144
130
  specification_version: 4
145
131
  summary: Web Push library for Ruby (RFC8030)
146
132
  test_files: []