@hsjs/vault
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

@hsjs/vault

Install

yarn add @hsjs/vault

Usage

import { encrypt, decrypt } from "@hsjs/vault";

encrypt("SecretPassw0rd", "YourPlaintext", { b64Output: true });
// returns "eyJpdiI6...itTdklKeFlmc1RTcz0ifQ=="

decrypt("SecretPassw0rd", "eyJpdiI6...itTdklKeFlmc1RTcz0ifQ==", {
  b64Input: true,
});
// returns "YourPlaintext"

API

encrypt

function encrypt(
  password: string,
  plaintext: string,
  opts: VaultOptions = {}
): string;

type VaultOptions = { b64Input?: boolean; b64Output?: boolean };

decrypt

function decrypt(
  password: string,
  ciphertext: string,
  opts: VaultOptions = {}
): string;

type VaultOptions = { b64Input?: boolean; b64Output?: boolean };

/@hsjs/vault/

    Package Sidebar

    Install

    npm i @hsjs/vault

    Weekly Downloads

    3

    Version

    0.0.6

    License

    MIT

    Unpacked Size

    58.4 kB

    Total Files

    12

    Last publish

    Collaborators

    • haishanh