Skip to content

Commit

Permalink
Fixing javascript:S2819
Browse files Browse the repository at this point in the history
  • Loading branch information
Lomilar committed Sep 23, 2024
1 parent 3a9f48b commit 400c4ea
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/com/eduworks/ec/crypto/EcAesCtrAsyncWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = class EcAesCtrAsyncWorker {
o["iv"] = iv;
o["text"] = forge.util.encodeUtf8(plaintext);
o["cmd"] = "encryptAesCtr";
return EcRsaOaepAsyncWorker.w[worker].postMessage(o);
return EcRsaOaepAsyncWorker.w[worker].postMessage(o,'cassproject');
}
/**
* Asynchronous form of {{#crossLink
Expand Down Expand Up @@ -83,7 +83,7 @@ module.exports = class EcAesCtrAsyncWorker {
o["iv"] = iv;
o["text"] = ciphertext;
o["cmd"] = "decryptAesCtr";
let p = EcRsaOaepAsyncWorker.w[worker].postMessage(o);
let p = EcRsaOaepAsyncWorker.w[worker].postMessage(o,'cassproject');
p = p.then((decrypted) => {
return forge.util.decodeUtf8(decrypted);
});
Expand Down
12 changes: 6 additions & 6 deletions src/com/eduworks/ec/crypto/EcRsaOaepAsyncWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ module.exports = class EcRsaOaepAsyncWorker {
o["text"] = plaintext;
o["cmd"] = "encryptRsaOaep";

let p = this.w[worker].postMessage(o);
let p = this.w[worker].postMessage(o, 'cassproject');
return cassPromisify(p, success, failure);
}
/**
Expand Down Expand Up @@ -144,7 +144,7 @@ module.exports = class EcRsaOaepAsyncWorker {
o["ppk"] = ppk.toPem();
o["text"] = ciphertext;
o["cmd"] = "decryptRsaOaep";
let p = this.w[worker].postMessage(o);
let p = this.w[worker].postMessage(o, 'cassproject');
p = p.then(function (decrypted) {
return forge.util.decodeUtf8(decrypted);
});
Expand Down Expand Up @@ -184,7 +184,7 @@ module.exports = class EcRsaOaepAsyncWorker {
o["ppk"] = ppk.toPem();
o["text"] = forge.util.encodeUtf8(text);
o["cmd"] = "signRsaOaep";
let p = this.w[worker].postMessage(o);
let p = this.w[worker].postMessage(o, 'cassproject');
return cassPromisify(p, success, failure);
}
/**
Expand Down Expand Up @@ -215,7 +215,7 @@ module.exports = class EcRsaOaepAsyncWorker {
o["ppk"] = ppk.toPem();
o["text"] = forge.util.encodeUtf8(text);
o["cmd"] = "signSha256RsaOaep";
let p = this.w[worker].postMessage(o);
let p = this.w[worker].postMessage(o,'cassproject');
return cassPromisify(p, success, failure);
};
/**
Expand Down Expand Up @@ -247,7 +247,7 @@ module.exports = class EcRsaOaepAsyncWorker {
o["text"] = forge.util.encodeUtf8(text);
o["signature"] = signature;
o["cmd"] = "verifyRsaOaep";
let p = this.w[worker].postMessage(o);
let p = this.w[worker].postMessage(o, 'cassproject');
return cassPromisify(p, success, failure);
}
/**
Expand Down Expand Up @@ -279,7 +279,7 @@ module.exports = class EcRsaOaepAsyncWorker {
o["text"] = forge.util.encodeUtf8(text);
o["signature"] = signature;
o["cmd"] = "verifyRsaOaepSha256";
let p = this.w[worker].postMessage(o);
let p = this.w[worker].postMessage(o, 'cassproject');
return cassPromisify(p, success, failure);
}
};
4 changes: 3 additions & 1 deletion src/com/eduworks/ec/crypto/forgeAsync.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/com/eduworks/ec/crypto/forgeAsyncNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ function registerPromiseWorker(callback) {
}

function onIncomingMessage(e) {
if (e.origin != 'cassproject') return;

var payload = e.data
if (!Array.isArray(payload) || payload.length !== 2) {
// message doens't match communication format; ignore
Expand Down

0 comments on commit 400c4ea

Please sign in to comment.