Use AMD-aware cryptojs from NPM. Update to 0.2.16

This commit is contained in:
JC Brand 2017-02-14 15:34:32 +00:00
parent 073a95b7e6
commit 70d385bc28
6 changed files with 27 additions and 4362 deletions

1707
3rdparty/bigint.js vendored

File diff suppressed because it is too large Load Diff

22
3rdparty/crypto.js vendored
View File

@ -1,22 +0,0 @@
;(function (root, factory) {
if (typeof define === "function" && define.amd) {
define([
"crypto.core",
"crypto.enc-base64",
"crypto.md5",
"crypto.evpkdf",
"crypto.cipher-core",
"crypto.aes",
"crypto.sha1",
"crypto.sha256",
"crypto.hmac",
"crypto.pad-nopadding",
"crypto.mode-ctr"
], function() {
return CryptoJS;
}
);
} else {
root.CryptoJS = factory();
}
}(this));

2606
3rdparty/otr.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -67,21 +67,23 @@ require.config({
"converse-vcard": "src/converse-vcard", "converse-vcard": "src/converse-vcard",
// Off-the-record-encryption // Off-the-record-encryption
"bigint": "3rdparty/bigint", "bigint": "node_modules/otr/vendor/bigint",
"crypto": "3rdparty/crypto", "crypto": "node_modules/otr/build/dep/crypto",
"crypto.aes": "node_modules/otr/vendor/cryptojs/aes", "aes": "node_modules/crypto-js/aes",
"crypto.cipher-core": "node_modules/otr/vendor/cryptojs/cipher-core", "cipher-core": "node_modules/crypto-js/cipher-core",
"crypto.core": "node_modules/otr/vendor/cryptojs/core", "core": "node_modules/crypto-js/core",
"crypto.enc-base64": "node_modules/otr/vendor/cryptojs/enc-base64", "const": "node_modules/otr/lib/const",
"crypto.evpkdf": "components/crypto-js-evanvosberg/src/evpkdf", "helpers": "node_modules/otr/lib/helpers",
"crypto.hmac": "node_modules/otr/vendor/cryptojs/hmac", "sha1": "node_modules/crypto-js/sha1",
"crypto.md5": "components/crypto-js-evanvosberg/src/md5", "hmac": "node_modules/crypto-js/hmac",
"crypto.mode-ctr": "node_modules/otr/vendor/cryptojs/mode-ctr", "enc-base64": "node_modules/crypto-js/enc-base64",
"crypto.pad-nopadding": "node_modules/otr/vendor/cryptojs/pad-nopadding", "evpkdf": "node_modules/crypto-js/evpkdf",
"crypto.sha1": "node_modules/otr/vendor/cryptojs/sha1", "md5": "node_modules/crypto-js/md5",
"crypto.sha256": "node_modules/otr/vendor/cryptojs/sha256", "mode-ctr": "node_modules/crypto-js/mode-ctr",
"pad-nopadding": "node_modules/crypto-js/pad-nopadding",
"sha256": "node_modules/crypto-js/sha256",
"salsa20": "node_modules/otr/build/dep/salsa20", "salsa20": "node_modules/otr/build/dep/salsa20",
"otr": "3rdparty/otr", "otr": "node_modules/otr/build/otr",
// Locales paths // Locales paths
"locales": "src/locales", "locales": "src/locales",
@ -215,17 +217,6 @@ require.config({
shim: { shim: {
'awesomplete': { exports: 'Awesomplete' }, 'awesomplete': { exports: 'Awesomplete' },
'backbone': { deps: ['underscore'] }, 'backbone': { deps: ['underscore'] },
'bigint': { deps: ['crypto'] },
'crypto.aes': { deps: ['crypto.cipher-core'] },
'crypto.cipher-core': { deps: ['crypto.enc-base64', 'crypto.evpkdf'] },
'crypto.enc-base64': { deps: ['crypto.core'] },
'crypto.evpkdf': { deps: ['crypto.md5'] },
'crypto.hmac': { deps: ['crypto.core'] },
'crypto.md5': { deps: ['crypto.core'] },
'crypto.mode-ctr': { deps: ['crypto.cipher-core'] },
'crypto.pad-nopadding': { deps: ['crypto.cipher-core'] },
'crypto.sha1': { deps: ['crypto.core'] },
'crypto.sha256': { deps: ['crypto.core'] },
'strophe.ping': { deps: ['strophe'] }, 'strophe.ping': { deps: ['strophe'] },
'strophe.register': { deps: ['strophe'] }, 'strophe.register': { deps: ['strophe'] },
'strophe.vcard': { deps: ['strophe'] }, 'strophe.vcard': { deps: ['strophe'] },

View File

@ -830,4 +830,6 @@
}); });
} }
}); });
return converse;
})); }));

View File

@ -10,9 +10,16 @@
* encryption of one-on-one chat messages. * encryption of one-on-one chat messages.
*/ */
(function (root, factory) { (function (root, factory) {
define(["otr", "converse-core", "tpl!toolbar_otr"], factory);
}(this, function (otr, converse, tpl_toolbar_otr) { define(["converse-chatview",
"tpl!toolbar_otr",
'otr',
'crypto',
'aes'
], factory);
}(this, function (converse, tpl_toolbar_otr, otr, CryptoJS) {
"use strict"; "use strict";
// Strophe methods for building stanzas // Strophe methods for building stanzas
var Strophe = converse.env.Strophe, var Strophe = converse.env.Strophe,
utils = converse.env.utils, utils = converse.env.utils,