Skip to content
A password generator compiled as Wasm for use on the CLI, in a custom element, or as a module.
HTML JavaScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
bin update build scripts Jan 16, 2020
lib
service-worker
src @ 1459a31
.gitignore
.gitmodules adding original src Jan 12, 2020
LICENSE
README.md
favicon.ico
index.html
manifest.json
package.json
robots.txt
wapm.toml

README.md

pwgen

A password generator compiled as Wasm for use on the CLI, in a custom element, or as a module.

Use on the CLI with Mac, Windows, and Linux

npm version wapm version

With npx

npx pwgen -sy 20 1

With npm, as a global package

npm i -g pwgen
pwgen -sy 20 1

With wapm

wapm install kherrick/pwgen

wapm run pwgen -sy 20 1

Use as a custom element

With default options (demo)

<x-pwgen></x-pwgen>

<script type="module">
  import 'https://unpkg.com/pwgen'
</script>

With additional options and detail logging (demo)

<x-pwgen composed flags="-sy" length="20" number="1"></x-pwgen>

<script type="module">
  import 'https://unpkg.com/pwgen'

  document.addEventListener(
    'x-pwgen-handle-password',
    ({ detail }) => {
      console.log(detail.msg)
    }
  )
</script>

Use in React

npm i pwgen
import React from 'react';
import 'pwgen';

const App: React.FC = () => {
  return (
    <x-pwgen></x-pwgen>
  )
}

Use from Node.js

const pwgen = require('pwgen')

const flags = '-1sy'
const length = '20'
const number = '10'

pwgen({ arguments: [ flags, length, number ], print: stdout => {
  console.log(`Password: ${stdout}`)
}})

Test the experimental web bundle

Download pwgen.wbn

Read more about web packaging

Develop

Requirements

Clone the project and submodules

git clone https://github.com/kherrick/pwgen && \
  cd pwgen && \
  git submodule update --init --recursive

Start

npm start

Build Wasm

npm run build:node && \
  npm run build:browser
You can’t perform that action at this time.