From 9dbfe954b5b522c126a581e84d571c33191afa4f Mon Sep 17 00:00:00 2001 From: speeddragon Date: Thu, 3 Jul 2025 22:18:14 +0100 Subject: [PATCH 1/2] Fix missing :p256dh atom --- lib/web_push/subscription.ex | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/web_push/subscription.ex b/lib/web_push/subscription.ex index 844c0d0..920a207 100644 --- a/lib/web_push/subscription.ex +++ b/lib/web_push/subscription.ex @@ -31,10 +31,12 @@ defmodule WebPushEx.Subscription do key = String.to_existing_atom(key) value = - if key == :endpoint and is_binary(value) do - URI.parse(value) - else - value + cond do + key == :endpoint and is_binary(value) -> + URI.parse(value) + + key in [:p256dh, :auth, :keys] -> + value end [{key, value} | acc] From ec5127433f219c833af4f6f4fc479d9f30a161e6 Mon Sep 17 00:00:00 2001 From: speeddragon Date: Thu, 3 Jul 2025 22:25:36 +0100 Subject: [PATCH 2/2] Fix test --- lib/web_push/subscription.ex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/web_push/subscription.ex b/lib/web_push/subscription.ex index 920a207..722fbb9 100644 --- a/lib/web_push/subscription.ex +++ b/lib/web_push/subscription.ex @@ -37,6 +37,9 @@ defmodule WebPushEx.Subscription do key in [:p256dh, :auth, :keys] -> value + + true -> + value end [{key, value} | acc]