134 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			134 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
{% load static %}
 | 
						|
<!DOCTYPE html>
 | 
						|
<!--
 | 
						|
     IMPORTANT! all of the keygen stuff on this page is adapted from
 | 
						|
     https://github.com/PatrickRoumanoff/js-keygen , without which it wouldn't
 | 
						|
     have happened.
 | 
						|
-->
 | 
						|
<html>
 | 
						|
    <head>
 | 
						|
        <meta charset="utf-8">
 | 
						|
        <title>tilde.town magic key machine</title>
 | 
						|
        <script src="{% static 'users/base64url.js' %}"></script>
 | 
						|
        <script src="{% static 'users/ssh-util.js' %}"></script>
 | 
						|
        <script src="{% static 'users/js-keygen-ui.js' %}"></script>
 | 
						|
        <script src="{% static 'users/js-keygen.js' %}"></script>
 | 
						|
        <style>
 | 
						|
         @font-face {
 | 
						|
             font-family: "vt323";
 | 
						|
             src: url("{% static 'common/vt323.ttf' %}");
 | 
						|
         }
 | 
						|
         body {
 | 
						|
             background-color: #871B51;
 | 
						|
             font-family: "vt323";
 | 
						|
         }
 | 
						|
         h1 {
 | 
						|
             font-size:400%;
 | 
						|
         }
 | 
						|
         .preamble {
 | 
						|
             font-size: 150%;
 | 
						|
             background-color: #9AB211;
 | 
						|
             text-align: justify;
 | 
						|
         }
 | 
						|
         #controls {
 | 
						|
             text-align:center;
 | 
						|
         }
 | 
						|
         #controls button {
 | 
						|
             font-size:200%;
 | 
						|
         }
 | 
						|
         a {
 | 
						|
             text-decoration: none;
 | 
						|
             color: rgb(224, 176, 255);
 | 
						|
             background-color:black;
 | 
						|
         }
 | 
						|
         a:hover {
 | 
						|
             text-decoration: underline;
 | 
						|
         }
 | 
						|
         #result {
 | 
						|
             background-color: #9AB211;
 | 
						|
             display: none;
 | 
						|
         }
 | 
						|
         #pubkey {
 | 
						|
             border-right: 4px solid black;
 | 
						|
             }
 | 
						|
        </style>
 | 
						|
    </head>
 | 
						|
    <body>
 | 
						|
        <h1>THE <a href="https://tilde.town">TILDE.TOWN</a> MAGIC KEY MACHINE</h1>
 | 
						|
        <div class="preamble">
 | 
						|
            this machine makes SSH keypairs: a pair of public and private files
 | 
						|
            that let <strong>your computer talk, in perfect secrecy, to other
 | 
						|
            computers</strong>.
 | 
						|
        </div>
 | 
						|
        <p class="preamble">
 | 
						|
            think of the public file as a padlock🔒: you can put it
 | 
						|
            anywhere and no one can get past it. but by using the private half
 | 
						|
            like a key 🔑, which you keep secret, you can unlock your
 | 
						|
            padlock whenever you want.
 | 
						|
        </p>
 | 
						|
        <p class="preamble">
 | 
						|
            SUPER CONFUSINGLY, these "files" are both called keys: your public
 | 
						|
            key and private key. that doesn't make much sense and i apologize.
 | 
						|
        </p>
 | 
						|
        <p id="controls">
 | 
						|
            <button id="generate"><em>-> MACHINE, CLANK AWAY FOR ME! <-</em></button>
 | 
						|
        </p>
 | 
						|
        <table id="result">
 | 
						|
            <tr>
 | 
						|
                <td id="pubkey">
 | 
						|
                    <h2>🔒 public key </h2>
 | 
						|
                    <a class="save" download="id_rsa.pub"><button>save me to a file</button></a>
 | 
						|
                    <br>
 | 
						|
                    <textarea rows="10" cols="50"></textarea>
 | 
						|
                </td>
 | 
						|
                <td id="privkey">
 | 
						|
                    <h2>🔑 private key<em>(KEEP SECRET)</em></h2>
 | 
						|
                    <a class="save" download="id_rsa"><button>save me to a file</button></a>
 | 
						|
                    <br>
 | 
						|
                    <textarea rows="10" cols="50"></textarea>
 | 
						|
                </td>
 | 
						|
            </tr>
 | 
						|
            <tr>
 | 
						|
                <td colspan="2">
 | 
						|
                    <p>
 | 
						|
                        what now? you can now use these files with the ssh
 | 
						|
                        command! if, for example, you have signed up for tilde
 | 
						|
                        town using the public key you generated above and saved
 | 
						|
                        the private key as <code>id_rsa</code> in your Downloads
 | 
						|
                        directory, you can open a terminal and run:
 | 
						|
 | 
						|
                        <pre>
 | 
						|
                           ssh -i Downloads/id_rsa YOUR_USERNAME_HERE@tilde.town
 | 
						|
                        </pre>
 | 
						|
 | 
						|
                        For more information about where to save keys, how to
 | 
						|
                        use them, and how to use terminals (on all platforms),
 | 
						|
                        check out the <a
 | 
						|
                        href="https://tilde.town/wiki/ssh.html">tilde.town ssh
 | 
						|
                        primer</a>.
 | 
						|
                    </p>
 | 
						|
                </td>
 | 
						|
            </tr>
 | 
						|
        </table>
 | 
						|
        <script>
 | 
						|
         $ = document.querySelector.bind(document);
 | 
						|
         var button = $('#generate');
 | 
						|
         var pub_ta = $('#pubkey textarea');
 | 
						|
         var priv_ta = $('#privkey textarea');
 | 
						|
         button.addEventListener('click', function() {
 | 
						|
             generateKeyPair(null, null, 'someone@tilde.town').then(function (keys) {
 | 
						|
                 var private_key = keys[0];
 | 
						|
                 var public_key = keys[1];
 | 
						|
                 pub_ta.textContent = public_key;
 | 
						|
                 priv_ta.textContent = private_key;
 | 
						|
                 $('#result').style.display = 'block';
 | 
						|
                 $('#pubkey a.save').href = buildHref(public_key);
 | 
						|
                 $('#privkey a.save').href = buildHref(private_key);
 | 
						|
             });
 | 
						|
         });
 | 
						|
 | 
						|
        </script>
 | 
						|
    </body>
 | 
						|
</html>
 | 
						|
 
 |