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
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
npm run build