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

keyguard-next

v0.0.1

Published

Secure storage for Nimiq private keys.

Downloads

269

Readme

Nimiq Keyguard(-next)

This README is about setting up your own instances of Nimiq Keyguard.

For information about using the client please refer to the Keyguard Client README.

Development

Install the dev dependencies:

yarn

Then you can:

  • run the build script with yarn build [config].
  • run the tests with yarn test.
  • run the typechecker with yarn typecheck.
  • run the typecheck file watcher with yarn watch.
  • run the linter with yarn lint.
  • automatically fix basic things like spacing, commas, indentation and quotes with yarn lintfix.
  • run yarn pr to run all three checks (typecheck, lint, test) as they would for a PR.

Note that it is mostly not necessary to run the build script for development purposes, as the code in src is fully functional and you can use it as an endpoint.

Coding Style

  • Code style is enforced with ESLint. Run yarn lint to see errors.
  • Folder names are in Kebab Case: sign-transaction.
  • Class files are named in Pascal Case: PinInput.js, RpcServer.js.
  • JSDoc @type and @param annotations must have a hyphen between the argument name and description:
/**
 * @param {string} address - The address to search for
 */
  • Folder structure:
- src
    - lib
    - components
    - request
- types
- tests
- config
- tools
- demos
- client
    - src
    - types

Configuration

You can configure the following values by either environment variables or configuration files:

  • KEYGUARD_ALLOWED_ORIGIN: The origin from which requests are accepted. '*' allows all origins. Be aware that slashes have to be masked by \. Defaults to 'https://accounts.nimiq-testnet.com'.
  • KEYGUARD_CDN: The CDN (content delivery network) from which the core library is served. Defaults to 'https://cdn.nimiq-testnet.com'.

The best way is to use a configuration file, which has to be placed in the config folder, and pass its name as an argument to the build script. yarn build local uses local.conf. Some sample files are provided.

If you have a CI (Continuous Integration) which builds on your webserver, you can also set those values in your server's configuration via environment variables. Please refer to your server's configuration, e.g. [https://httpd.apache.org/docs/2.4/env.html] for Apache.

In any case, please note that those settings are compile-time, so you have to rebuild to update them.

I18n usage

Setup

First, import the I18n.js lib in your HTML's head section. Then, setup your dictionary (details see below) and initialize I18n passing your dictionary and the fallback language that should be used if no translation in the current language has been found.

var myDictionary = {
    'en': {
        ...
    }
};

I18n.initialize(myDictionary, 'en');

I18n will automatically use the language set up in the user's browser.

Translate tag content

<div data-i18n="my-translation">My content</div>

When the I18n gets started, or when the language has been switched, it will look for tags with the data-i18n attribute and put in the appropriate translation. My content will be replaced.

Translate placeholders and value

<input data-i18n-placeholder="my-placeholder-translation"/>
<input data-i18n-value="my-value-translation"/>

Similarily, I18n will translate the texts for value and placeholder.

Dictionary

Format:

{
    "en": {
        "my-translation": "Content in English"
    },
    "de": {
        "my-translation": "Inhalt auf Deutsch"
    }
}

Language picker

Add LanguagePicker.js to your head and then add a language picker widget to your page:

    const languagePicker = new LanguagePicker();
    document.body.appendChild(languagePicker.getElement());