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

pastore

v0.4.7

Published

keep your password safe

Downloads

15

Readme

pastore

Keep your password safe. It's pastore API. you can write your own app by using this module.

App using pastore

Installation

npm install --save pastore

Usage

import pastore from 'pastore';

Property

needInit

Return: Boolean

Check whether pastore need configuration or not.

Example:

if (pastore.needInit) {
  console.log('You should initialize pastore');
} else {
  console.log('everthing is ready');
}

Methods

init

Usage: pastore.init(password, algorithm)

Return: Promise

Arguments:

  • password: type String, required. It's master password.
  • algorithm: type String, required. Encryption algorithm. Available algorithms: AES, DES, TripleDES, RC4, RC4Drop, Rabbit, RabbitLegacy.

Initialize pastore with your master password.

You only need initializing if needInit is true. In other words, you only need initializing if it's first time and pastore need config, and you must initialize. you can know about first time or not, with pastore.needInit property. if you have not initialized your pastore, module does not work functionally.

Example:

if (pastore.needInit) {
  pastore.init('yourmasterpassword', 'Rabbit').then(() => {
    // Do what you want to do
  }).catch(error => { console.log(error); })
} else {
  console.log('pooof, nothing to do');
}

load

Usage: pastore.load(password)

Return: Promise

Promise will reject if you enter incorrect password.

Arguments:

  • password: type String, required. It's master password.

Load database.

Example:

if (pastore.needInit) {
  pastore.init('yourmasterpassword', 'Rabbit').then(() => {
    // Do what you want to do
  }).catch(error => { console.log(error); })
} else {
  pastore.load('icantremember').then(() => {
    console.log('password was correct');
  }).catch(err => {
    console.log(err);
  });
}

clear

Usage: pastore.clear()

Return: Promise

Reset pastore to default. everything include database, will be removed and reset.

These below methods must run after initializing or loading database.

add

Usage: pastore.add(title, password, [info], [tag]).then(pass).catch(err)

Return: Promise

Arguments:

  • title: type String, required. title of password. title must be unique.
  • password: type String, required. password.
  • info: type String, optional, default null. more information for password like email, site address or etc.
  • tag: type Array, optional, default null. password tag.

Arguments to Promise:

  • pass: type Object. Password object which is saved.
  • err: type TypeError. It will occur if there is a another password with same title.

Add a password.

remove

Usage: pastore.remove(title)

Return: Promise

Arguments:

  • title: type String, required. password title.

Remove a password.

removeByTag

Usage: pastore.removeByTag(tag)

Return: Promise

Arguments:

  • tag: type String, required. password tag.

Remove passwords which they have specified tag.

update

Usage: pastore.update(title, update)

Return: Promise

Arguments:

  • title: type String, required. password title.
  • update: type Object, required. object will be replaced with old stuff.

Update a password.

Example:

import pastore from 'pastore';

pastore.load('something').then(async () => {
  await pastore.add('twitter', '123123');

  pastore.update('twitter', {title: 'tweet', password: '173532'});
});

find

Usage: pastore.find(title)

Return: Object or undefined.

Return undefined when there is no password with the title.

Arguments:

  • title: type String, required. key for searching, like title.

Search and find password by specified title, like searching for a password that it has twitter as title.

Example:

import pastore from 'pastore';

pastore.init('something', 'AES').then(aync () => {
  await pastore.add('twitter', '123123');

  pastore.find('twitter');

  /*
   * return
   *
   *  { title: 'twitter', password: '123123', info: ''},
   *
   */

  pastore.find('facebook');

  /**
   * return undefined
   */
});

findByTag

Usage: pastore.findByTag(tag)

Return: Array

Arguments:

  • tag: type String, required. password tag.

Return passwords which they have specified tag.

findPasswords

Usage: pastore.findPasswords()

Return: Array

Return all passwords.

findTitles

Usage: pastore.findTitles()

Return: Array

Return only titles.

changePassword

Usage: pastore.changePassword(password)

Return: Promise

Arguments:

  • password: type String, required. new password.

Change password, master one.

changeAlgorithm

Usage: pastore.changeAlgorithm(algorithm)

Return: Promise

Arguments:

  • algorithm: type String, required. new algorithm. Available algorithms: AES, DES, TripleDES, RC4, RC4Drop, Rabbit, RabbitLegacy.

Change encryption algorithm.

exportDB

Usage: pastore.exportDB()

Return: String

Export encrypted database.

importDB

Usage: pastore.importDB(db, password, algorithm)

Return: Promise

Arguments:

  • db: type String, required. encrypted database.
  • password: type String, required. db master password.
  • algorithm: type String, required. db algorithm encryption.

Import database.

Contributing

Any ideas and pull requests is appreciated. read CONTRIBUTING.md

LICENSE

MIT