simple-fs-server/keyout.ts

16 lines
512 B
TypeScript

import { Command } from "https://deno.land/x/cliffy@v0.25.6/mod.ts";
import { fromFileUrl, join } from "path/mod.ts";
import { prepareSecretKey } from "./util/secret.ts";
export const key_out_cmd = new Command();
key_out_cmd.name("keyout")
.description("Output the secret key.")
.action(async () => {
const key = await prepareSecretKey();
const out = await crypto.subtle.exportKey("jwk", key);
console.log(JSON.stringify(out));
});
if ( import.meta.main ){
await key_out_cmd.parse(Deno.args);
}