57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
import type { PlimiPlugin } from "../../core/plugins/plugin-types";
|
|
import { runHashGenerator } from "./run";
|
|
|
|
export interface HashOptions {
|
|
algorithm: "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512";
|
|
output: "hex" | "base64";
|
|
}
|
|
|
|
export const hashGeneratorPlugin: PlimiPlugin<HashOptions> = {
|
|
manifest: {
|
|
id: "crypto-hash",
|
|
name: "Hash Generator",
|
|
description: "Generate cryptographic hashes securely in your browser.",
|
|
category: "crypto",
|
|
version: "1.0.0",
|
|
tags: ["hash", "sha256", "crypto", "digest"],
|
|
input: { type: "text" },
|
|
output: { type: "text" },
|
|
example: "Hello, Plimi!",
|
|
offlineReady: true,
|
|
},
|
|
|
|
optionsSchema: {
|
|
fields: [
|
|
{
|
|
type: "select",
|
|
key: "algorithm",
|
|
label: "Algorithm",
|
|
defaultValue: "SHA-256",
|
|
options: [
|
|
{ label: "SHA-1", value: "SHA-1" },
|
|
{ label: "SHA-256", value: "SHA-256" },
|
|
{ label: "SHA-384", value: "SHA-384" },
|
|
{ label: "SHA-512", value: "SHA-512" },
|
|
],
|
|
},
|
|
{
|
|
type: "select",
|
|
key: "output",
|
|
label: "Output Format",
|
|
defaultValue: "hex",
|
|
options: [
|
|
{ label: "Hex", value: "hex" },
|
|
{ label: "Base64", value: "base64" },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
|
|
capabilities: {
|
|
cancelable: false,
|
|
worker: false,
|
|
},
|
|
|
|
run: runHashGenerator,
|
|
};
|