Permalink
Browse files

salted WAMP-CRA helper; bump version

  • Loading branch information...
1 parent 4f8bf11 commit 3bc341287ee51ba1282ab9af716e98f0a736ece8 @oberstet oberstet committed Mar 11, 2013
Showing with 20 additions and 1 deletion.
  1. +4 −0 CHANGELOG.md
  2. +1 −0 SConstruct
  3. +14 −0 autobahn/autobahn.js
  4. +1 −1 version.txt
View
@@ -1,5 +1,9 @@
# AutobahnJS: Changelog
+## v0.7.5
+ * add option to skip announcing of WebSocket subprotocol (WAMP)
+ * implement `deriveKey` function for salted WAMP-CRA
+
## v0.7.4
* update **whenjs** to v1.8.1
* update **CryptoJS** to v3.1.2
View
@@ -77,6 +77,7 @@ sources = ["autobahn/license.js",
"cryptojs/components/enc-base64.js",
"cryptojs/components/hmac.js",
"cryptojs/components/sha256.js",
+ "cryptojs/components/pbkdf2.js",
"autobahn/autobahn.js",
"autobahn/useragent.js"]
View
@@ -174,6 +174,20 @@ ab.getBrowser = function () {
ab.browserNotSupportedMessage = "Browser does not support WebSockets (RFC6455)";
+// PBKDF2-base key derivation function for salted WAMP-CRA
+ab.deriveKey = function (secret, extra) {
+ if (extra && extra.salt) {
+ var salt = extra.salt;
+ var keylen = extra.keylen || 32;
+ var iterations = extra.iterations || 10000;
+ var key = CryptoJS.PBKDF2(secret, salt, { keySize: keylen / 4, iterations: iterations, hasher: CryptoJS.algo.SHA256 });
+ return key.toString(CryptoJS.enc.Base64);
+ } else {
+ return secret;
+ }
+}
+
+
ab._idchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
ab._idlen = 16;
ab._subprotocol = "wamp";
View
@@ -1 +1 @@
-0.7.4
+0.7.5

0 comments on commit 3bc3412

Please sign in to comment.