Socket
Socket
Sign inDemoInstall

pagecrypt

Package Overview
Dependencies
17
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pagecrypt

A CLI to add client-side password-protection for HTML files


Version published
Weekly downloads
1.3K
increased by23.41%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

1.2.0 - 2021-03-15

Features

  • Expose new encryptHTML() function to easily get the encrypted HTML file contents when using the JS API.
  • Improved documentation

Fixes

  • Cleanup code and move into separate smaller functions
  • dev: Improve test command to always install latest package build

Readme

Source

PageCrypt - Password Protected HTML Pages

A CLI to add client-side password-protection for HTML files

Inspired by MaxLaumeister/PageCrypt. Thanks for sharing an excellent starting point to create this CLI!

Usage

CLI

It's easy to start encrypting a single HTML-file:

npx pagecrypt [input.html] [output.html] [password]

Automate pagecrypt in your build process

npm i -D pagecrypt

package.json:

{
    "devDependencies": {
        "pagecrypt": "^0.1.0"
    },
    "scripts": {
        "build": "...",
        "postbuild": "pagecrypt index.html encrypted.html strong-password"
    }
}

Node.js API

You can use pagecrypt in your Node.js scripts:

encrypt(inputFile: string, outputFile: string, password: string): Promise<void>
import { encrypt } from 'pagecrypt'

// Encrypt a HTML file and write to the filesystem
await encrypt('input.html', 'output.html', 'strong password')
encryptHTML(inputHTML: string, password: string): string
import { encryptHTML } from 'pagecrypt'

// Encrypt a HTML string and return an encrypted HTML string that can be written to a file or sent in a HTTPS response to a browser.
const encryptedHTML = await encryptHTML(
    `<!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="UTF-8">
        </head>
        <body>
            Secret
        </body>
    </html>
`,
    'strong password',
)

Development

The project consists of two parts:

  • /web - Web frontend for public webpage (decrypt-template.html). Built using Snowpack & TailwindCSS.
  • /index.js - pagecrypt CLI.

Testing

npm test will run basic tests for JS API and CLI. Verify results by opening test/out-js.html and test/out-cli.html in your browser.


Welcome to submit your pull requests!

Keywords

FAQs

Last updated on 14 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc