Commit 0f2f7a2c authored by Romain Courteaud's avatar Romain Courteaud

CryptStorage: catch decrypt exception

parent d9d5519b
...@@ -149,6 +149,8 @@ ...@@ -149,6 +149,8 @@
coded = coded.currentTarget.result; coded = coded.currentTarget.result;
initializaton_vector = new Uint8Array(coded.slice(0, 12)); initializaton_vector = new Uint8Array(coded.slice(0, 12));
return new RSVP.Queue()
.push(function () {
return crypto.subtle.decrypt({ return crypto.subtle.decrypt({
name : "AES-GCM", name : "AES-GCM",
iv : initializaton_vector iv : initializaton_vector
...@@ -158,14 +160,14 @@ ...@@ -158,14 +160,14 @@
.push(function (arr) { .push(function (arr) {
//arraybuffer->string //arraybuffer->string
arr = String.fromCharCode.apply(null, new Uint8Array(arr)); arr = String.fromCharCode.apply(null, new Uint8Array(arr));
try {
return jIO.util.dataURItoBlob(arr); return jIO.util.dataURItoBlob(arr);
} catch (error) { })
.push(undefined, function (error) {
if (error instanceof DOMException) { if (error instanceof DOMException) {
return blob; return blob;
} }
throw error; throw error;
} });
}); });
}); });
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment