npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wwpass-frontend

v3.6.0

Published

Frontend WWPass JavaScript Library

Downloads

80

Readme

wwpass-frontend

WWPass authentication and client-side encryption library.

Install

To install library dependencies, run:

npm install

To build a standalone library version, run:

npm run build

Usage

To initialize WWPass QR-code authentication use:

(NPM module, import with namespace)

import * as WWPass from 'wwpass-frontend';

WWPass.authInit({
  qrcode: document.querySelector('#qrcode-container'),
  ticketURL: `${urlBase}getticket.php`,
  callbackURL: `${urlBase}login.php`,
});

(NPM module, cherry-pick)

import { authInit }  from 'wwpass-frontend';

authInit({
  qrcode: document.querySelector('#qrcode-container'),
  ticketURL: `${urlBase}getticket.php`,
  callbackURL: `${urlBase}login.php`,
});

(Standalone script)

<script src="wwpass-frontend.js"></script>
<script>
WWPass.authInit({
  qrcode: document.querySelector('#qrcode'),
  passkey: document.querySelector('#button--login'),
  ticketURL: `${urlBase}getticket.php`,
  callbackURL: `${urlBase}login.php`,
});
</script>

authInit options

  • qrcode: DOM element or query selector for authentication QRCode
  • passkey: OPTIONAL DOM element or query selector that holds button for hardware PassKey authentication. If the element is empty, default "Authenticate with PassKey" button will be rendered.
  • ticketURL: URL to request WWPass ticket for authentication. On request to this URL the server should get new ticket via WWPass server API and return json object with ticket and it's ttl in seconds ex.: {"ticket": "WWPass%20Developers:81f7ba34f27e9707787fd73d43463a3d4b9a0603@p-sp-02-20:16033", "ttl": 600}
  • callbackURL: after successful WWPass authentication the user will be redirected to this URL. Following parameters will be appended to the URL:
    • wwp_version: current version of the protocol. For this library it's always 2
    • wwp_ticket: ticket used for authentication
    • wwp_status and wwp_reason: always 200, "OK" for successful authentications
    • wwp_hw: If it's present and != 0, a hardware WWPass key was used for authentication. waitForRemoval() may be called to detect when the user removes their WWPass key
  • ppx: OPTIONAL Alternative prefix for callbackURL parameters. Defaults to wwp_
  • forcePasskeyButton: OPTIONAL Always show a button for hardware PassKey authentication. If set to true (default for backward compatibility), the button will be always shown. If set to false (recommended), the button will only be shown if any means to communicate with a passKey is detected (WWPass Extention or NPAPI plugin)
  • uiType: OPTIONAL type of UI to show. 'button' for authentication on the same mobile device, 'qrcode' to authenticate on other device, 'auto' (default) to use 'button' if mobile device is detected
  • uiSwitch: OPTIONAL whether to show an option to switch between ui types (see uiType above). 'auto' (default) shows switch element if mobile device is detected, alternatives are 'always' or 'never'
  • uiCallback: OPTIONAL a callback function that will be called when UI-related events happen. Signle argument is the data about the event:
    • { away: true }: User clicked "Login with WWPass button"
    • { refresh: true }: A QR code is about to be refreshed
    • { button: true }: A "Login with WWPass button" is about to be shown
    • { qrcode: true }: A QR code is about to be shown

Support

If you have any questions, contact us [email protected].

License

MIT © WWPass Corporation