ashryanio-generaterandomsecret.web.val.run
Readme

Hit run and get the secrets!

1
2
3
4
5
6
7
8
9
10
11
12
13
import { randomBytes } from "node:crypto";
export const generateSecret = (req: Request) => {
let length = new URL(req.url).searchParams.get("length");
if (!length || isNaN(+length)) {
length = "32";
}
const secret = randomBytes(+length).toString("hex");
return Response.json({ secret });
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
v8
July 1, 2024