aboutsummaryrefslogtreecommitdiffstats
path: root/webclient/lib/sjcl.js
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume@gmail.com>2012-01-18 22:51:23 +0100
committerGuillaume Horel <guillaume@gmail.com>2012-01-18 22:51:23 +0100
commit3f3018f542830b68acaa95714897843624434087 (patch)
tree8326611d59d3c375f2bddbbcee1cf01b849c3da8 /webclient/lib/sjcl.js
parent01e7057e94c6f502b6d283453315e5a718786d04 (diff)
downloadalias-3f3018f542830b68acaa95714897843624434087.tar.gz
Updated sjcl and strop to the latest release
Now the bug fixing starts!
Diffstat (limited to 'webclient/lib/sjcl.js')
-rw-r--r--webclient/lib/sjcl.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/webclient/lib/sjcl.js b/webclient/lib/sjcl.js
index 24d3e3b..9730862 100644
--- a/webclient/lib/sjcl.js
+++ b/webclient/lib/sjcl.js
@@ -67,6 +67,10 @@ var sjcl = {
}
}
};
+
+if(typeof module != 'undefined' && module.exports){
+ module.exports = sjcl;
+}
/** @fileOverview Low-level AES implementation.
*
* This file contains a low-level implementation of AES, optimized for
@@ -1762,7 +1766,7 @@ sjcl.random = {
if (!i.match(/^[a-z0-9]+$/i)) {
throw new sjcl.exception.invalid("json encode: invalid property name");
}
- out += comma + i + ':';
+ out += comma + '"' + i + '"' + ':';
comma = ',';
switch (typeof obj[i]) {
@@ -1800,13 +1804,13 @@ sjcl.random = {
}
var a = str.replace(/^\{|\}$/g, '').split(/,/), out={}, i, m;
for (i=0; i<a.length; i++) {
- if (!(m=a[i].match(/^([a-z][a-z0-9]*):(?:(\d+)|"([a-z0-9+\/%*_.@=\-]*)")$/i))) {
+ if (!(m=a[i].match(/^(?:(["']?)([a-z][a-z0-9]*)\1):(?:(\d+)|"([a-z0-9+\/%*_.@=\-]*)")$/i))) {
throw new sjcl.exception.invalid("json decode: this isn't json!");
}
- if (m[2]) {
- out[m[1]] = parseInt(m[2],10);
+ if (m[3]) {
+ out[m[2]] = parseInt(m[3],10);
} else {
- out[m[1]] = m[1].match(/^(ct|salt|iv)$/) ? sjcl.codec.base64.toBits(m[3]) : unescape(m[3]);
+ out[m[2]] = m[2].match(/^(ct|salt|iv)$/) ? sjcl.codec.base64.toBits(m[4]) : unescape(m[4]);
}
}
return out;