I am using Ably, specifically Ably's PHP SDK to send a direct push notification via the web:
$ably = new AblyRest(['key' => env('ABLY_KEY'));
// Define the recipient using the subscription endpoint
$recipient = [
'transportType' => 'web',
'endpoint' => $subscriptionEndpoint,
'targetUrl' => 'https://yourdomain.com/push-notifications/subscribe',
'encryptionKey' => ...,
];
For the encryption key, I am not sure exactly what I am supposed to put and what format it's meant to be. I have tried:
'encryptionKey' => \Ably\Utils\Crypto::generateRandomKey(256),
and
'encryptionKey' => bin2hex(\Ably\Utils\Crypto::generateRandomKey(256)),
and
'encryptionKey' => base64encode(\Ably\Utils\Crypto::generateRandomKey(256)),
But no matter what, I keep getting this error in my ably dashboard: "bad encryption key : [..encryption key..]"