diff --git a/Gemfile b/Gemfile index e54450d..454e298 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,7 @@ gem 'jbuilder', '~> 2.5' gem 'bcrypt', '~> 3.1.7' gem 'validate_url' +gem 'webpush' # Use ActiveStorage variant # gem 'mini_magick', '~> 4.8' diff --git a/Gemfile.lock b/Gemfile.lock index 31049c0..5eb27d5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -61,12 +61,14 @@ GEM ffi (1.10.0) globalid (0.4.2) activesupport (>= 4.2.0) + hkdf (0.3.0) i18n (1.6.0) concurrent-ruby (~> 1.0) jaro_winkler (1.5.2) jbuilder (2.8.0) activesupport (>= 4.2.0) multi_json (>= 1.2) + jwt (2.2.1) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -161,6 +163,9 @@ GEM validate_url (1.0.8) activemodel (>= 3.0.0) public_suffix + webpush (0.3.8) + hkdf (~> 0.2) + jwt (~> 2.0) websocket-driver (0.7.0) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) @@ -185,6 +190,7 @@ DEPENDENCIES spring-watcher-listen (~> 2.0.0) sqlite3 validate_url + webpush yard RUBY VERSION diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc index 092b2d1..c085c63 100644 --- a/config/credentials.yml.enc +++ b/config/credentials.yml.enc @@ -1 +1 @@ -oAs+MprI5eBtNeeC+76/CfT/juL/JHm0t5l0XK8i1iciVEkdia24pH3vZHENOqPYFjAM6/0qmXFLq2hyikMsKqFfzPRz5weyHKz+Qqh90WNXnTGopU3wZ7ufrqU2+xk7GKqAp4p4XCmEjkDz2CpmEB/oR/+8esjJN+61/fhdi3Pkq8CR2zFzszXHmJRC0JbHgTaxB+TD4b541xhnwXvUpK3J/EJmDgMJ84SwIxKMGA4YxYVzoTH7CR8GOkSuSlIWOcoTSWiYuW6y7IqAfT1C5VH6ZBSCDEtE/SefOloia4ZlrBRoaFJB9rsXHebOaBeXoM4wRf9csjb/gkD4QGzyFTXZlWfPSuiGaUN48JCbikcm1iu8FgyEXJIbJB+qXZppWJ3dFIqJMkWbA1nQErZAdoNcLfv/sP576NtT--ZMdEzyCwtOD6d9/F--xujg4MQrX4bwim+bJ1iZtQ== \ No newline at end of file +vHO0Rs4mUo3cmaEwumbHQ1PgQFrckB7qsLtXLeChO84w1nP9m0GZ3j/8P77cPeDa3fa61EIOp4zvTY7/blZfWTiPNN5xb0o87QEH71SrWwJvJD/iYsEaRORm0ziWdE2rEW69sEsEPuR5wvHRRWDgJZoYlf/BygqnRVGpJlvmisZMW/druYf+MMgnbdFIa25g+OyvVP3iuNh5aMxLcZ2BHc0qn7k8ROCAHQM2jtB810MArUYMyza+uDa/uXCioU0wnPvr/UQzEkvstr0DTeuvNxBQ5NCZ2pseokN7GLkZC2hUjlSirgxZR/EqP2B+CybSyLzRZRdCsVbFr//eDIBGJB0vBSjI0UsRNTNEO2ffOQNdX8Q9kxpuX+NRKrpQyRXt3/ltH8Zh4D5vOuTWd+Nf5mrEIX85imrHB1poOFtue9nBJnc8GmHwAIe4CYtbfYlNZskScubLJmLZzN7/+EOG6Q6LfEs8spz6VQ9qIX9gnUlTo2tBsaj5+2qBTqjUxed8HKRcsZXKUrx45c+8VFxI5IH37xQpkRSxtCCNl2wM5+/7g1hlGaNyv3gQTbuo9p+4rYk3P8zIpT41mqf1MHsGjNSDwS8wzjhsh3olceTCCz4yzm8x+MLd8puL3VrN8tw=--p17cT1Xv6vQyo5ES--dIpGtyQMXy3DY8iG1SThQA== \ No newline at end of file diff --git a/lib/tasks/webpush.rake b/lib/tasks/webpush.rake new file mode 100644 index 0000000..94703fa --- /dev/null +++ b/lib/tasks/webpush.rake @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +namespace :webpush do + desc 'Genera las llaves VAPID' + task vapid: :environment do + vapid = Webpush.generate_key + + puts 'Agrega lo siguiente en `rails credentials:edit`:' + puts 'vapid:' + puts " public_key: #{vapid.public_key}" + puts " private_key: #{vapid.private_key}" + + exit 0 + end +end