UNPKG

tughra

Version:

The Tughra Library offers robust End-to-End Encryption (E2EE), ensuring that data remains private and secure from the point it leaves the sender to the moment it reaches the intended recipient. With E2EE, data is encrypted on the sender's device, transmit

21 lines (16 loc) 637 B
// worker.js importScripts('tughra.js'); // Import your Tughra library here if necessary self.onmessage = function(e) { const { text, cycles, baseCharset, mode, useBaseEncoding, algorithm, encryptionKey } = e.data; try { // Initialize the Tughra object const tughra = new Tughra(mode, baseCharset, algorithm, encryptionKey, useBaseEncoding); // Process the text const resultText = tughra.process(text, cycles); // Send the result back to the main thread self.postMessage({ result: resultText, error: null }); } catch (error) { // Send any errors back to the main thread self.postMessage({ result: null, error: error.message }); } };