Fix add validation to webpush subscription keys (#30542)
This commit is contained in:
parent
5f15a892fa
commit
4655be0da6
4 changed files with 57 additions and 11 deletions
|
@ -2,6 +2,10 @@
|
|||
|
||||
Fabricator(:web_push_subscription, from: Web::PushSubscription) do
|
||||
endpoint Faker::Internet.url
|
||||
key_p256dh Faker::Internet.password
|
||||
key_auth Faker::Internet.password
|
||||
key_p256dh do
|
||||
curve = OpenSSL::PKey::EC.generate('prime256v1')
|
||||
ecdh_key = curve.public_key.to_bn.to_s(2)
|
||||
Base64.urlsafe_encode64(ecdh_key)
|
||||
end
|
||||
key_auth { Base64.urlsafe_encode64(Random.new.bytes(16)) }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue