Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Commit

Permalink
Update based on final spec changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wibblymat committed Feb 23, 2016
1 parent 117af9d commit d170a6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Push Encryption (node)
----------------------

This library provides the functions neccessary to encrypt a payload for sending
This library provides the functions necessary to encrypt a payload for sending
with the Web Push protocol. It also includes a helper function for actually
send the message to the Web Push endpoint.

Expand Down
5 changes: 2 additions & 3 deletions encrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

const crypto = require('crypto');

const PADDING_BUFFER = new Buffer(1).fill(0);
const PADDING_BUFFER = new Buffer(2).fill(0);
const ONE_BUFFER = new Buffer(1).fill(1);
const AUTH_INFO = new Buffer('Content-Encoding: auth\0', 'utf8');
const MAX_PAYLOAD_LENGTH = 4080;
Expand Down Expand Up @@ -68,7 +68,7 @@ function encrypt(message, subscription) {
const context = createContext(clientPublicKey, serverPublicKey);

// Derive the Content Encryption Key
const contentEncryptionKeyInfo = createInfo('aesgcm128', context);
const contentEncryptionKeyInfo = createInfo('aesgcm', context);
const contentEncryptionKey = hkdf(salt, prk, contentEncryptionKeyInfo, 16);

// Derive the Nonce
Expand Down Expand Up @@ -121,7 +121,6 @@ function createContext(clientPublicKey, serverPublicKey) {
return context;
};


/**
* Returns an info record. See sections 3.2 and 3.3 of
* {@link https://tools.ietf.org/html/draft-ietf-httpbis-encryption-encoding-00}
Expand Down

0 comments on commit d170a6e

Please sign in to comment.