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

@zenchain-protocol/zazen

v0.0.5

Published

Zenchain snap for securely storing validator cloud access keys within Metamask.

Downloads

7,590

Readme

@zenchain-protocol/zazen

This Metamask snap, Zazen, is intended to store validator cloud access keys in an encrypted, secure manner within Metamask. In the future, it may be used to store other types of data. This snap was forked from the MetaMask manage-state example snap at version 2.2.2.

Snap manifest

Note: Using snap_manageState requires the snap_manageState permissions. Refer to the documentation for more information.

Along with other permissions, the manifest of this snap includes the snap_manageState permission:

{
  "initialPermissions": {
    "snap_manageState": {}
  }
}

This permission does not require any additional configuration.

Snap usage

The state is stored in the snap using the following structure:

type State = {
  staking: {
    nodeCloudAccessKeys: {
      onFinality: {
        accessKey: string;
        secretKey: string;
        workspaceId: string;
      };
    };
  };
};

This snap exposes an onRpcRequest handler, which supports the following JSON-RPC methods:

  • setState - Set the state to the provided parameters. This assumes the new state is an object using the above structure. The state is always stored encrypted.
  • getState - Get the state from the snap. This returns the current state if one is set, or a default state otherwise. The state from the encrypted store is always retrieved.
  • clearState - Reset the state to the default state. The state from the encrypted store is always cleared.

Encrypted storage requires MetaMask to be unlocked.

For more information, you can refer to the end-to-end tests.

Running the Snap Locally

Prerequisites

Make sure you have nvm (Node Version Manager) installed. If not, you can install it by following the instructions here.

Without Docker

  1. Install the correct Node.js version:

    nvm install
    nvm use

    This will use the Node.js version specified in the .nvmrc file.

  2. Install the dependencies:

    yarn install
  3. Build the project:

    yarn build
  4. Start the Snap:

    yarn start
  5. Run tests:

    yarn test

With Docker

You can also build and run this snap locally using Docker.

  1. Build the Docker image

    Navigate to the directory containing the Dockerfile and run:

    docker build -t zazen-snap .
  2. Run the Docker container

    docker run -d -p 8014:8014 zazen-snap

This command will run the container and map port 8081 of the container to port 8081 of your host machine, allowing you to access the snap locally for testing.