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 +4 -4
- data/README.md +3 -1
- data/lib/web_push/encryption.rb +4 -3
- data/lib/web_push/version.rb +1 -1
- data/lib/web_push.rb +0 -1
- data/spec/web_push/encryption_spec.rb +3 -3
- data/web-push.gemspec +0 -1
- metadata +7 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a688b354339ddf4f82d8febb54a2042bb432357dffd77a571c3c9212c107aa2f
|
4
|
+
data.tar.gz: 01060b2687a57217cafb2cf96b3925c6e2e39102daf6f796277d06d767ae6a0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
)
|
data/lib/web_push/encryption.rb
CHANGED
@@ -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 =
|
29
|
+
prk = OpenSSL::KDF.hkdf(shared_secret, salt: client_auth_token, info: info, hash: hash, length: 32)
|
29
30
|
|
30
|
-
content_encryption_key =
|
31
|
+
content_encryption_key = OpenSSL::KDF.hkdf(prk, salt: salt, info: content_encryption_key_info, hash: hash, length: 16)
|
31
32
|
|
32
|
-
nonce =
|
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
|
|
data/lib/web_push/version.rb
CHANGED
data/lib/web_push.rb
CHANGED
@@ -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 =
|
68
|
+
prk = OpenSSL::KDF.hkdf(shared_secret, salt: client_auth_token, info: info, hash: 'SHA256', length: 32)
|
69
69
|
|
70
|
-
content_encryption_key =
|
71
|
-
nonce =
|
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
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.
|
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-
|
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.
|
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: []
|