import { Hono } from "jsr:@hono/hono"; import { serveStatic } from "jsr:@hono/hono/deno"; import { marked } from "https://esm.sh/gh/evbogue/bog5@de70376265/lib/marked.esm.js"; import { foot, head } from "./template.js"; const app = new Hono(); const readme = await Deno.readTextFile("./README.md"); app.get("/", async (c) => { const content = `
${await marked(readme)}
`; const html = await head("Index") + content + await foot(); return await c.html(html); }); app.get("/try", async (c) => { const body = `

Try ANProto

An Interactive Demonstration

Step 1. Generate an ed25519 keypair

const kp = await an.gen()

Step 2. Hash your blob with sha256

const hash = await an.hash(content)

Step 3. Sign the ANProto message

const sig = await an.sign(hash, keypair)

Step 4. Open the ANProto message

const opened = await an.open(msg)

Step 5. Retrieve the blob

`; const html = await head("Try it") + body + await foot(); return await c.html(html); }); app.use( "*", serveStatic({ root: "./", onFound: (_path, c) => { c.header("Access-Control-Allow-Origin", "*"); }, }), ); export default app;