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

text-security

v3.2.1

Published

Cross-browser alternative to -webkit-text-security

Downloads

181,579

Readme

text-security

Cross-browser alternative to -webkit-text-security. Check out demo at noppa.github.io/text-security.html.

text-security is a simple set of fonts that only consist of 3 different characters. Disc (the shape normally used in password fields), circle and square. For example, setting font-family: "text-security-disc" for an element should then display all the element's characters in a concealed way, like it was a password field. This is useful if you want to get the benefits of input[type="password"] but also combine that with other element types, like input[type="tel"]. In fact, the project was created for this exact purpose as an answer to a StackOverflow question.

The project builds on top of Adobe's similar font projects Adobe Notdef and Adobe Blank 2.

Disclaimer

If you are considering this library to replace a password field with a text field—perhaps to avoid browsers' autofill behavior—please think twice before doing so. Browsers might offer enhanced security features for password fields, like limiting which scripts are allowed to read their values. Opting to use a text field instead will leave your app out of these protections. There are also accessibility issues with this solution, see issue 11. This font simply masks text like a password field would and does not further protect the input. There are legitimate use cases where that's ok (think OTP fields, SSN inputs, etc.), and then there are use cases where it's just not worth it.

Browser support

Tested in recent versions of Chrome (for desktop and mobile), Edge, Firefox, Safari for iOS and IE 11. Opera Mini is not supported, as it does not support @font-face web fonts.

Chrome and Firefox, which support WOFF2 and cmap subtable format 13, will use the optimized WOFF2 font, which is only 0.8 kb in size. Older browsers like IE will automatically load the compatibility fonts whose names are suffixed "-compat" and weigh about 200 kb.

Installation

npm install text-security

You can use the fonts by adding this project as a dependency and including text-security.css in your project.

<link href="node_modules/text-security/text-security.css" rel="stylesheet" type="text/css">

Alternatively, you can grab the fonts you need (most likely text-security-disc and text-security-disc-compat) from the releases page and include your own @font-face definition in CSS.
src/style-template.css should give a pretty good idea how to do that, just change the font name and source path to match your setup.

CSS Example

After the font is loaded, making a field behave like password field is easy.

.my-password-field {
  font-family: text-security-disc;
  /* Use -webkit-text-security if the browser supports it */
  -webkit-text-security: disc;
}

Building with custom modifications

This repository contains the build scripts needed for creating these fonts. If you want to add your own shapes or do other modifications, see Development.md.

License

The published font is licensed with SIL Open Font License. This is the only license you need to care about if you are simply using the prebuilt fonts.

All the code in this repository that is used for generating these fonts (Dockerfile, Python & shell scripts etc.) are licensed MIT.

This project builds on top of Adobe's font projects Adobe Notdef and Adobe Blank 2, which are included as submodules. They are also licensed with SIL.

Also included as submodules are ttf2eot and t1utils. t1utils has a slightly modified MIT license here. ttf2eot is extracted from Chromium project.