tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_group_create.html (1201B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for Messaging Layer Security</title>
      5  <!-- SimpleTest Helpers -->
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      8  <!-- Local Helpers -->
      9  <script src="head_mls.js"></script>
     10 </head>
     11 <body>
     12 <pre id="test">
     13 <script class="testbody" type="text/javascript">
     14 
     15 async function test_group_create() {
     16 
     17  const mls = new MLS();
     18 
     19  // Alice: Create signature keypair and credential
     20  const alice = await mls.generateIdentity();
     21  const credential_alice = await mls.generateCredential("alice");
     22 
     23  // Alice: Create a group
     24  const group_alice = await mls.groupCreate(alice, credential_alice);
     25 
     26  // Test: compare the generated group identifier to incorrect values
     27  // Note: there is no deterministic test for this value as it is generated randomly
     28  isnot(byteArrayToHexString(group_alice.groupId), "", "Group Identifier != ''");
     29 
     30  // Test: the generated group epoch is of size 32
     31  is(group_alice.groupId.length, 32, "Group Epoch should be of size 32");
     32 
     33  SimpleTest.finish();
     34 }
     35 
     36 SimpleTest.waitForExplicitFinish();
     37 test_group_create();
     38 
     39 </script>
     40 </pre>
     41 </body>
     42 </html>