|
|
@ -43,10 +43,20 @@ define([
|
|
|
|
var c = Crypto.createEncryptor(key);
|
|
|
|
var c = Crypto.createEncryptor(key);
|
|
|
|
cryptor.encrypt = function (href) {
|
|
|
|
cryptor.encrypt = function (href) {
|
|
|
|
// Never encrypt blob href, they are always read-only
|
|
|
|
// Never encrypt blob href, they are always read-only
|
|
|
|
|
|
|
|
try {
|
|
|
|
if (href.slice(0,7) === '/file/#') { return href; }
|
|
|
|
if (href.slice(0,7) === '/file/#') { return href; }
|
|
|
|
return c.encrypt(href);
|
|
|
|
return c.encrypt(href);
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
cryptor.decrypt = function (msg) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
return c.decrypt(msg);
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
cryptor.decrypt = c.decrypt;
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.error(e);
|
|
|
|
console.error(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|