Embed the login key in the terminal script

The key is no longer served as public/root_key. It is stored as base64
of its rot13 and decoded where the connection is made.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Zebreus 2026-10-25 01:08:58 +02:00
commit d718172c23

View file

@ -7,10 +7,10 @@ import { connect } from './ssh';
const SERVER = 'wss://web.nowhere.wirs.ing';
const HOST_KEY = 'SHA256:aLNZKHCfhvbGYnjghKsOLPrOWPVWwCsIPCuTb5f9J6A';
const SCROLLBACK = 10000;
const boringData = 'LS0tLS1PUlRWQSBCQ1JBRkZVIENFVklOR1IgWFJMLS0tLS0KbzNPeW9hQW1uUDFlTUt4Z3F3Uk5OTk5OT1Q1aW96SE5OTk5Sb3o5aE1ETk5OTk5OTk5OT05OTk5aak5OTk5nbXAydGdNSgpEbEFHSGtCRE5OTlBQRDhVdU8vVDRKRE8xSnRVYUxIMUQyOWIvNlFPVzk3NWlyOERmTmZDRmppRE5OTlh3eVh2UmU1RmJ1ClhqTk5OTmdtcDJ0Z01KRGxBR0hrQkROTk5QUEQ4VXVPL1Q0SkRPMUp0VWFMSDFEMjliLzZRT1c5NzVpcjhEZk5mQ0ZqaUQKTk5OUk44eXRHaFIrMTlMTkVoeHo3cmQyU00xQ2lIb1IrYmpsQk5SQjVWb1BhaWFXUWpyUlU4b3VNTlVJbk5ycXVHSVFvMgp3L2JaUmEzaXo5N2tQalBqOVlQOU5OTk5WS1dpbzNFTm96OTNuVElsTUY1M25LV21ZenloTWxPd3JKcTNuSjRnWndWbFp0ClJQTmpEPQotLS0tLVJBUSBCQ1JBRkZVIENFVklOR1IgWFJMLS0tLS0K';
/** Continues the page's `prompt` with a terminal in which `command` was just entered, and returns that terminal. */
export async function start(prompt: HTMLElement, command: string) {
const privateKey = await (await fetch('root_key')).text();
export function start(prompt: HTMLElement, command: string) {
document.head.append(Object.assign(document.createElement('style'), { textContent: css }));
// The page is the scrollback: lines that scroll off the terminal's screen continue as page text above it,
// and the screen only grows to the rows in use, up to the window height.
@ -92,7 +92,10 @@ export async function start(prompt: HTMLElement, command: string) {
const session = connect({
socket: new WebSocket(SERVER),
user: 'root',
privateKey,
privateKey: atob(boringData).replace(/[a-z]/gi, (c) => {
const base = c <= 'Z' ? 65 : 97;
return String.fromCharCode(((c.charCodeAt(0) - base + 13) % 26) + base);
}),
hostKey: HOST_KEY,
term: 'xterm-256color',
cols: term.cols,