Skip to content

Commit 2f8d98c

Browse files
committed
Ignore userPublicKey and userAuth if they're empty strings
1 parent c9ccc16 commit 2f8d98c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ function sendNotification(endpoint, params) {
148148
console.warn('You are using the old, deprecated, interface of the `sendNotification` function.'.bold.red);
149149
}
150150

151-
if (typeof userPublicKey !== 'undefined') {
151+
if (userPublicKey) {
152152
if (typeof userPublicKey !== 'string') {
153153
throw new Error('userPublicKey should be a base64-encoded string.');
154154
} else if (urlBase64.decode(userPublicKey).length !== 65) {
155155
throw new Error('userPublicKey should be 65 bytes long.');
156156
}
157157
}
158158

159-
if (typeof userAuth !== 'undefined') {
159+
if (userAuth) {
160160
if (typeof userAuth !== 'string') {
161161
throw new Error('userAuth should be a base64-encoded string.');
162162
} else if (urlBase64.decode(userAuth).length < 12) {

0 commit comments

Comments
 (0)