File: test_brython.html

package info (click to toggle)
python-xeddsa 1.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 204 kB
  • sloc: python: 421; makefile: 15; ansic: 15
file content (47 lines) | stat: -rw-r--r-- 1,842 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>

<html>
    <head>
        <meta charset="utf-8">
        <title>python-xeddsa</title>
        <script src="https://raw.githack.com/brython-dev/brython/master/www/src/brython.js" referrerpolicy="no-referrer"></script>
        <script src="https://raw.githack.com/brython-dev/brython/master/www/src/brython_stdlib.js" referrerpolicy="no-referrer"></script>
        <script src="/xeddsa/xeddsa.brython.js"></script>
    </head>
    <body>
        <script>
            var Module = {
                onRuntimeInitialized: function() {
                    const wrapper_script = document.createElement("script");
                    wrapper_script.src = "/libxeddsa/libxeddsa-wrapper.js";
                    document.body.appendChild(wrapper_script);

                    brython();
                }
            };
        </script>
        <script defer src="/libxeddsa/libxeddsa.js"></script>
        <script type="text/python" id="secrets">
            from browser import window

            def token_bytes(nbytes: int) -> bytes:
                result = window.Uint8Array.new(nbytes)
                window.crypto.getRandomValues(result)
                return bytes(window.Array["from"](result))
        </script>
        <script type="text/python" src="/tests/test_conversion_uniqueness.py" id="test_conversion_uniqueness"></script>
        <script type="text/python" src="/tests/test_signing.py" id="test_signing"></script>
        <script type="text/python">
            import test_conversion_uniqueness
            import test_signing

            print("Testing conversion uniqueness...")
            test_conversion_uniqueness.test_conversion_uniqueness()

            print("Testing signing...")
            test_signing.test_signing()

            print("Tests succeeded!")
        </script>
    </body>
</html>