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

@jondotsoy/vault

v0.2.5

Published

[![Try @jondotsoy/vault on RunKit](https://badge.runkitcdn.com/@jondotsoy/vault.svg)](https://npm.runkit.com/@jondotsoy/vault)

Downloads

13

Readme

📦🔐Vault

Try @jondotsoy/vault on RunKit

Protect your data with a json crypto storage. This is a opensource solution to shared configurations on cloud.

Sample

import { Vault, RemoteStore } from "@jondotsoy/vault"

const vaultPublicKey = process.env.VAULT_PUBLICKEY
const vaultRemoteId = process.env.VAULT_REMOTE_ID
const vaultRemoteReadKey = process.env.VAULT_REMOTE_READKEY

const vault = await Vault.create<{ db: { uri: string } }>({
  store: new RemoteStore({
    id: vaultRemoteId,
    readkey: vaultRemoteReadKey,
  }),
  publicKey: vaultPublicKey,
})

const configs = await vault.readConfigs()

const mongoUri = configs.db.uri
// ...

Quick starter

You can start using vault in 2 steps.

  1. Create your first vault using npx @jondotsoy/vault vault create in your terminal. This command configures and creates the vault in your machine, accessible from $HOME/.vault.
  2. Configure the vault in your project installing vault using npm i @jondotsoy/vault and copy the next code in your source.
import { Vault, RemoteStore } from "@jondotsoy/vault"

const vaultPublicKey = process.env.VAULT_PUBLICKEY
const vaultRemoteId = process.env.VAULT_REMOTE_ID
const vaultRemoteReadKey = process.env.VAULT_REMOTE_READKEY

const vaultPromise = Vault.create({
  store: new RemoteStore({
    id: vaultRemoteId,
    readkey: vaultRemoteReadKey,
  }),
  publicKey: vaultPublicKey,
})

export const getVault = () => vaultPromise

You can obtain the environment values with npx @jondotsoy/vault vault info. While you be are the manager vault, you will use that command without problems.

Remember this is only a sample that uses a singleton instance to read the vault. You can use your own implementation for your project.

How to use (API)

Install with npm

npm i @jondotsoy/vault

and require the vault

import { Vault, FileStore } from "@jondotsoy/vault"
const vault = await Vault.create({
  store: new FileStore({ pathStore: "FILEPATH" }),
  publicKey: publicKey,
})

const configs = await vault.readConfigs() // [MyConfigs]

Create a Vault

const vault = await Vault.create({
  store: new FileStore({ pathStore: "FILEPATH" }),
  modulusLength: 512,
})

const { publicKey, privateKey } = vault.export()

publicKey // MEgCQQC8QHhm1a3TEOO502VTldRTrI9UQ...
privateKey // MIIBOwIBAAJBALxAeGbVrdMQ47nTZVOV1FOsj1RDuKCnud...

await vault.saveConfigs(MyConfigs)

// $ cat FILEPATH
// lWM4ZtHZE...

Use a Vault

const vault = await Vault.create({
  store: new FileStore({ pathStore: "FILEPATH" }),
  publicKey: publicKey,
})

await vault.readConfigs() // [MyConfigs]

Remote Store

Create, share