Encrypting Functions and Classes

Functions and classes may be specified individually in the Protection attribute in the protect.yaml protection definition.

Entries of type function can be parameterized with LicenseListId and Encrypt.

Classes of the type class can also use the protection attribute itself to create nestings.

A class can contain further class, as well as function elements.

Protection:

 - Type: function

   Name: complex_function_3

   LicenseListId: 1

 - Type: function

   Name: test

   LicenseListId: 2

 - Type: class

   Name: MyClass

   Encrypt: false

   Protection:

     - Type: function

       Name: complex_function_3

       LicenseListId: 1000

The matching of the names is done in such a way that the best matching configuration is used. Assuming there is the following pseudo code:

function complex_function_3() {

   console.log("hello global");

  return 1;

}

 

class A {

   complex_function_3() {

       console.log("hello A_cf3");

      return 20;

  }

   test() {

       console.log("hello A_test");

      return 10;

  }

}

 

class MyClass {

   complex_function_3() {

       console.log("hello MyClass");

      return 20;

  }

}

According to the previous protection definition, the global function complexfunction3 and the function complex_function_3 in class A are protected by the LicenseListId 1.

The function test in class A is also protected with license LicenseListId 2. On the other hand, the function complex_function_3 in the class MyClass is protected with the LicenseListId 1000, because there is a specific rule for this.