update to use new style crypto module

This commit is contained in:
ansuz
2016-06-21 15:17:09 +02:00
parent f94c06abc0
commit 849683d586
9 changed files with 64 additions and 108 deletions

View File

@@ -209,8 +209,6 @@ define([
var applyHjson = function (shjson) {
var userDocStateDom = hjsonToDom(JSON.parse(shjson));
// we *might* be able to remove this now
// changes to hyperscript fixed this bug *maybe* --ansuz
userDocStateDom.setAttribute("contenteditable", "true"); // lol wtf
var patch = (DD).diff(inner, userDocStateDom);
(DD).apply(inner, patch);
@@ -238,14 +236,24 @@ define([
// method which allows us to get the id of the user
setMyID: setMyID,
// Crypto object to avoid loading it twice in Cryptpad
crypto: Crypto,
// Pass in encrypt and decrypt methods
crypto: Crypto.createEncryptor(secret.key),
// really basic operational transform
transformFunction : JsonOT.validate,
// cryptpad debug logging (default is 1)
// logLevel: 0,
validateContent: function (content) {
try {
JSON.parse(content);
return true;
} catch (e) {
console.log("Failed to parse, rejecting patch");
return false;
}
}
};
var updateUserList = function(shjson) {