|
8 | 8 | import java.security.NoSuchProviderException; |
9 | 9 | import java.security.PublicKey; |
10 | 10 | import java.security.spec.InvalidKeySpecException; |
| 11 | +import java.util.Base64; |
11 | 12 |
|
12 | 13 | import static java.nio.charset.StandardCharsets.UTF_8; |
13 | 14 |
|
@@ -71,23 +72,23 @@ public Notification(String endpoint, PublicKey userPublicKey, byte[] userAuth, b |
71 | 72 | } |
72 | 73 |
|
73 | 74 | public Notification(String endpoint, String userPublicKey, String userAuth, byte[] payload, int ttl) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException { |
74 | | - this(endpoint, Utils.loadPublicKey(userPublicKey), Base64Encoder.decode(userAuth), payload, ttl); |
| 75 | + this(endpoint, Utils.loadPublicKey(userPublicKey), Base64.getUrlDecoder().decode(userAuth), payload, ttl); |
75 | 76 | } |
76 | 77 |
|
77 | 78 | public Notification(String endpoint, PublicKey userPublicKey, byte[] userAuth, byte[] payload) { |
78 | 79 | this(endpoint, userPublicKey, userAuth, payload, DEFAULT_TTL); |
79 | 80 | } |
80 | 81 |
|
81 | 82 | public Notification(String endpoint, String userPublicKey, String userAuth, byte[] payload) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException { |
82 | | - this(endpoint, Utils.loadPublicKey(userPublicKey), Base64Encoder.decode(userAuth), payload); |
| 83 | + this(endpoint, Utils.loadPublicKey(userPublicKey), Base64.getUrlDecoder().decode(userAuth), payload); |
83 | 84 | } |
84 | 85 |
|
85 | 86 | public Notification(String endpoint, String userPublicKey, String userAuth, String payload) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException { |
86 | | - this(endpoint, Utils.loadPublicKey(userPublicKey), Base64Encoder.decode(userAuth), payload.getBytes(UTF_8)); |
| 87 | + this(endpoint, Utils.loadPublicKey(userPublicKey), Base64.getUrlDecoder().decode(userAuth), payload.getBytes(UTF_8)); |
87 | 88 | } |
88 | 89 |
|
89 | 90 | public Notification(String endpoint, String userPublicKey, String userAuth, String payload, Urgency urgency) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException { |
90 | | - this(endpoint, Utils.loadPublicKey(userPublicKey), Base64Encoder.decode(userAuth), payload.getBytes(UTF_8)); |
| 91 | + this(endpoint, Utils.loadPublicKey(userPublicKey), Base64.getUrlDecoder().decode(userAuth), payload.getBytes(UTF_8)); |
91 | 92 | this.urgency = urgency; |
92 | 93 | } |
93 | 94 |
|
@@ -200,7 +201,7 @@ public NotificationBuilder userPublicKey(byte[] publicKey) throws NoSuchAlgorith |
200 | 201 | } |
201 | 202 |
|
202 | 203 | public NotificationBuilder userAuth(String userAuth) { |
203 | | - this.userAuth = Base64Encoder.decode(userAuth); |
| 204 | + this.userAuth = Base64.getUrlDecoder().decode(userAuth); |
204 | 205 | return this; |
205 | 206 | } |
206 | 207 |
|
|
0 commit comments