-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract encryption module #4
Conversation
|
||
group = OpenSSL::PKey::EC::Group.new(group_name) | ||
client_public_key_bn = OpenSSL::BN.new(Base64.urlsafe_decode64(p256dh), 2) | ||
client_public_key = OpenSSL::PKey::EC::Point.new(group, client_public_key_bn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creation of the client_public_key
was simplified by using Base64.urlsafe_decode64(p256dh), 2
to construct the the OpenSSL::BN
object.
Add ece as development dependency Update gemspec
Includes spec against third party implementation of the http encrypted content encoding - the ece gem
1ef7131
to
20dfb09
Compare
[key.to_s(16)].pack("H*") | ||
end | ||
|
||
def unescape_base64(base64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method was removed in the new module. It's no longer needed since the client keys are decoded with Base64.urlsafe_decode64
@rossta |
@zaru Great! Thanks for the quick review, merge, and new release. |
This PR adds a test for the encryption functionality. The methods specific to encrypting the payload including
#encrypt
have been extracted to a new moduleWebpush::Encryption
(separation of concerns, testing, etc).