Universa U8 module

The U8 module allows you to run JavaScript code from a separate module. The module provides a guarantee of the immutability of the code and a high level of trust in the code inside the module through the use of a signature. U8 module is a packaged package signed with a special key. The Universa library module has a standard extension - .u8m.

Creating a module

Consider creating a U8 module using the example of creating a module jslib.u8m . The module jslib.u8m can be found in the u8 project. The jslib.u8m module includes all developed subsystems and add-ons for u8, such as: Node, UBotServer, DNS and so on. Using the example of creating the u8 module, the user can create his own module using his subsystem, the name of the module and add the necessary resources (files) to the module.

To create the jslib.u8m module, you must place the /jslib and /u8scripts directories of the u8 project in the zip archive and change the archive extension to .U8m.

Next, to create the U8 module, you need to add a signature to the archive. In order to sign the U8 module, run the following command:

u8 —signmodule <module path> <key path>

Run module

During the launch of the U8 module, u8 checks the signature of the module. All u8 scripts required by the module are searched inside the module. And also U8 has special methods for loading resources (files) from the module.

To run code from the U8 module, you must specify the path to the script inside the module. For example:

u8 ../jslib.zip/u8scripts/examples/testmain.js