Skip to content

Commit 2c88fd1

Browse files
Correct the error message for invalid padding (#81)
This is unlikely to be encountered by people using web push, but it's worth getting this right.
1 parent 676b009 commit 2c88fd1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nodejs/ece.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ function unpad(data, last) {
322322
}
323323
} else {
324324
if (data[i] !== 1) {
325-
throw new Error('last record needs to start padding with a 2');
325+
throw new Error('records other than the last need to start padding with a 1');
326326
}
327327
}
328328
return data.slice(0, i);
@@ -455,7 +455,7 @@ function writeHeader(header) {
455455
* receiver. |params.privateKey| is used to establish a shared secret. Key
456456
* pairs can be created using |crypto.createECDH()|.
457457
*/
458-
function encrypt(buffer, params, keyLookupCallback) {
458+
function encrypt(buffer, params, keyLookupCallback) {
459459
if (!Buffer.isBuffer(buffer)) {
460460
throw new Error('buffer argument must be a Buffer');
461461
}

0 commit comments

Comments
 (0)