Using the SafeQuard Solution ============================ TL;DR ----- The SafeQuard App Service sets up a file server on Microsoft Azure to host the SafeQuard Module. The SafeQuard Module provides quantum-secure encryption (Kyber ML-KEM-768 + AES-256) functionality for web browsers. The module can be easily integrated into any webpage by importing the `SafeQuard.js` file and calling its functions directly via JavaScript. SafeQuard File Server --------------------- Accessing the SafeQuard File Server ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The file server is accessed through the SafeQuard App Service. Here are the steps to follow: #. Navigate to the `SafeQuard App Service` on Azure Console. #. Move to the `Overview` page and you will be able to see the ``Properties`` tab. #. Under the `Domain` column, click on the URL shown beside `Default Domain`. .. note:: Optionally, you can link your own domain/sub-domain to the SafeQuard App Service. .. image:: ./images/get_domain_url.png #. The URL will open up the file server in your browser, which will look like this: .. image:: ./images/safequard_fs.png Files ^^^^^ These are the files that are deployed as part of the SafeQuard solution. The directory structure of the file server is as follows:: / ├── License ├── SafeQuard.js └── SafeQuard.wasm - The ``License`` contains the terms and conditions for using the SafeQuard solution. - The ``SafeQuard.js`` contains the JavaScript file that handles the logic for SafeQuard. - The ``SafeQuard.wasm`` the WebAssembly file that powers the core functionality of SafeQuard. Using the SafeQuard Module ^^^^^^^^^^^^^^^^^^^^^^^^^^ This section explains how to use the `SafeQuard_enc()` function to encrypt user-provided data. Step 1: Include the SafeQuard Module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ First, add the `SafeQuard.js` file to your webpage by including it in a ` Step 2: Implement Encryption Logic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In your JavaScript code, you can define an asynchronous function, `SafeQuard_enc()`, to handle encryption. This function accepts input from an HTML element (such as a text input), encrypts the plaintext using the SafeQuard module, and then outputs the encrypted result to a JavaScript object. The following snippet provides a simple reference on using the encryption function. .. code-block:: html Example Use Case ---------------- .. code-block:: html

SafeQuard Encryption Example

Notes ----- - The encryption function, `pQCee_SafeQuard_enc`, currently uses a fixed key ("key") in this example. This should be replaced with a secure key management approach for real-world applications. - Ensure that the SafeQuard module (`SafeQuard.js`) is loaded before attempting to use the `Module.ccall` function.