mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2026-03-13 20:05:14 +00:00
Remove worker (#1072)
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
/* globals tryTests: true */
|
||||
|
||||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp');
|
||||
|
||||
const chai = require('chai');
|
||||
|
||||
const { expect } = chai;
|
||||
|
||||
const pub_key =
|
||||
['-----BEGIN PGP PUBLIC KEY BLOCK-----',
|
||||
'Version: GnuPG v2.0.19 (GNU/Linux)',
|
||||
'',
|
||||
'mI0EUmEvTgEEANyWtQQMOybQ9JltDqmaX0WnNPJeLILIM36sw6zL0nfTQ5zXSS3+',
|
||||
'fIF6P29lJFxpblWk02PSID5zX/DYU9/zjM2xPO8Oa4xo0cVTOTLj++Ri5mtr//f5',
|
||||
'GLsIXxFrBJhD/ghFsL3Op0GXOeLJ9A5bsOn8th7x6JucNKuaRB6bQbSPABEBAAG0',
|
||||
'JFRlc3QgTWNUZXN0aW5ndG9uIDx0ZXN0QGV4YW1wbGUuY29tPoi5BBMBAgAjBQJS',
|
||||
'YS9OAhsvBwsJCAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQSmNhOk1uQJQwDAP6',
|
||||
'AgrTyqkRlJVqz2pb46TfbDM2TDF7o9CBnBzIGoxBhlRwpqALz7z2kxBDmwpQa+ki',
|
||||
'Bq3jZN/UosY9y8bhwMAlnrDY9jP1gdCo+H0sD48CdXybblNwaYpwqC8VSpDdTndf',
|
||||
'9j2wE/weihGp/DAdy/2kyBCaiOY1sjhUfJ1GogF49rC4jQRSYS9OAQQA6R/PtBFa',
|
||||
'JaT4jq10yqASk4sqwVMsc6HcifM5lSdxzExFP74naUMMyEsKHP53QxTF0Grqusag',
|
||||
'Qg/ZtgT0CN1HUM152y7ACOdp1giKjpMzOTQClqCoclyvWOFB+L/SwGEIJf7LSCEr',
|
||||
'woBuJifJc8xAVr0XX0JthoW+uP91eTQ3XpsAEQEAAYkBPQQYAQIACQUCUmEvTgIb',
|
||||
'LgCoCRBKY2E6TW5AlJ0gBBkBAgAGBQJSYS9OAAoJEOCE90RsICyXuqIEANmmiRCA',
|
||||
'SF7YK7PvFkieJNwzeK0V3F2lGX+uu6Y3Q/Zxdtwc4xR+me/CSBmsURyXTO29OWhP',
|
||||
'GLszPH9zSJU9BdDi6v0yNprmFPX/1Ng0Abn/sCkwetvjxC1YIvTLFwtUL/7v6NS2',
|
||||
'bZpsUxRTg9+cSrMWWSNjiY9qUKajm1tuzPDZXAUEAMNmAN3xXN/Kjyvj2OK2ck0X',
|
||||
'W748sl/tc3qiKPMJ+0AkMF7Pjhmh9nxqE9+QCEl7qinFqqBLjuzgUhBU4QlwX1GD',
|
||||
'AtNTq6ihLMD5v1d82ZC7tNatdlDMGWnIdvEMCv2GZcuIqDQ9rXWs49e7tq1NncLY',
|
||||
'hz3tYjKhoFTKEIq3y3Pp',
|
||||
'=h/aX',
|
||||
'-----END PGP PUBLIC KEY BLOCK-----'].join('\n');
|
||||
|
||||
const plaintext = 'short message\nnext line\n한국어/조선말';
|
||||
let pubKey;
|
||||
|
||||
tryTests('Async Proxy', tests, {
|
||||
if: typeof window !== 'undefined' && window.Worker && window.MessageChannel,
|
||||
before: async function() {
|
||||
try {
|
||||
await openpgp.initWorker({ path:'../dist/openpgp.worker.js' });
|
||||
} catch (e) {
|
||||
openpgp.util.print_debug_error(e);
|
||||
}
|
||||
pubKey = await openpgp.key.readArmored(pub_key);
|
||||
},
|
||||
after: async function() {
|
||||
await openpgp.destroyWorker();
|
||||
}
|
||||
});
|
||||
|
||||
function tests() {
|
||||
|
||||
describe('Random number pipeline', function() {
|
||||
it('Random number buffer automatically reseeded', async function() {
|
||||
const worker = new Worker('../dist/openpgp.worker.js');
|
||||
const wProxy = new openpgp.AsyncProxy();
|
||||
try {
|
||||
await wProxy.init({ path:'../dist/openpgp.worker.js', workers: [worker] });
|
||||
} catch (e) {
|
||||
openpgp.util.print_debug_error(e);
|
||||
return;
|
||||
}
|
||||
return wProxy.delegate('encrypt', { publicKeys:[pubKey], message:openpgp.message.fromText(plaintext) });
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
describe('Web Worker', function () {
|
||||
require('./async_proxy.js');
|
||||
require('./application_worker.js');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user