web_push_encryption v0.2.1 WebPushEncryption.Encrypt View Source
Module to encrypt notification payloads.
See the following links for details about the encryption process.
https://developers.google.com/web/updates/2016/03/web-push-encryption?hl=en
Link to this section Summary
Functions
Encrypts a web push notification body
Link to this section Functions
Link to this function
encrypt(message, subscription, padding_length \\ 0)
View Source
encrypt( message :: binary(), subscription :: map(), padding_length :: non_neg_integer() ) :: map()
Encrypts a web push notification body.
Arguments
message
the body to encryptsubscription
: SeeWebPushEncryption.Push.send_web_push/3
padding_length
: An optional padding length
Return value
Returns the encrypted body as well as the necessary information in the following form:
%{ciphertext: ciphertext, # the encrypted payload
salt: salt, # the generated salt used during the encryption
server_public_key: server_public_key} # the generated public key used during encryption