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

webpasswordsafe

v1.0.0

Published

A Javascript binding for https://github.com/joshdrummond/webpasswordsafe 's API

Downloads

4

Readme

webpasswordsafe

Simple API Wrapper for WebPasswordSafe, an online Java-based password store.

Requirements

  • Node >= 8.0 (It doesn't use any too modern JavaScript features, but I haven't tried it. Good luck!)
  • Depends on axios for all the heavy networking stuff.

Installation

$ npm install webpasswordsafe

Classes

Password

This is a description of the password objects returned and consumed by the WebPasswordSafe-API.

Kind: global interface
Properties

| Name | Type | Description | | --- | --- | --- | | id | number | Internal ID of the password, primarly used to retrieve it's value after finding it. | | title | string | The password's name. | | username | string | Username this password belongs to. | | notes | string | Additional information users might need to know about, for example how and where to use these credentials. | | tags | Array.<string> | Array of space-seperated tags set for this password. | | active | boolean | Wether or not this password is active and visible. | | value | string | The actual 'value' of the password, the password itself. This is only included by getPassword when the includePassword option is set, otherwise WPS#getPasswordValue should be used. |

WPS

Kind: global class

new WPS(options)

Create an instance of the WebPasswordStore client.

| Param | Type | Description | | --- | --- | --- | | options | | | | options.url | string | URL to a WebPasswordStore. This should not include the final '/rest/' bit of the URL. | | options.username | string | Username to login with. | | options.password | string | Password of the user. Note that this will be sent - as any other passwords - in plain text, so using an https url is strongly recommended. | | options.* | any | Any other arguments are passed into axios.create(). |

Example

const https = require('https');
const wps = require('webpasswordsafe')({
  url: 'https://pwstore.local:8443/',
  username: 'jack',
  password: '*********',

  // pass this to allow self-signed certificates.
  // httpsAgent: new https.Agent({ rejectUnauthorized: false })
});

// search all passwords matching 'npm'
wps.getPasswordList('npm')
  .then(passwords => Promise.all(passwords.map(password =>
    // get the actual password for each of them
    wps.getCurrentPassword(password.id, true)
      .then(value => {
        // convert this value to an object containing the interesting bits
        return {
          title: password.title,
          username: password.username,
          value: value
        };
      })
  )))
  // here we get a promise that is resolved once all password values are converted
  .then(passwordsData => {
    passwordsData.forEach(password => {
      // print all the passwords!
      console.log(password.title, '::', password.username, '::', password.value);
    })
  })

WPS.getPasswordList(query) ⇒ Promise.<Array.<Password>>

Search for passwords on the server. This is equivalent of using the search function in the client app. The passwords returned by this function do not include their value. To get the actual password, use the getPassword or getCurrentPassword functions.

Kind: instance method of WPS
Returns: Promise.<Array.<Password>> - A list of passwords matching query

| Param | Type | Description | | --- | --- | --- | | query | string | Search Query. |

WPS.getPassword(passwordId, [includeValue]) ⇒ Promise.<Password>

Get a single password.

Kind: instance method of WPS
Returns: Promise.<Password> - The password

| Param | Type | Description | | --- | --- | --- | | passwordId | number | The internal ID of the password, for example returned as the password.id field from getPasswordList | | [includeValue] | boolean | If this is a truthy value, an additional request will be made and the resulting Password will have it's value property set. |

WPS.getCurrentPassword(passwordId) ⇒ Promise.<string>

Get only the value of a password.

Kind: instance method of WPS
Returns: Promise.<string> - The password's value.

| Param | Type | Description | | --- | --- | --- | | passwordId | number | The internal ID of the password, for example returned as the password.id field from getPasswordList |

WPS.addPassword(password) ⇒ Promise.<Password>

Add a password to the WebPasswordSafe and grant the logged in user permissions to it. Unfortunately, there is no way to set additional permission using the API.

Kind: instance method of WPS
Returns: Promise.<Password> - The newly safed password, including their id.

| Param | Type | Description | | --- | --- | --- | | password | Password | The password to add. Note that the id field will be ignored. |

WPS.updatePassword(password) ⇒ Promise.<Password>

Update password data. Passwords are matched by their id. Note that this might be broken: https://github.com/joshdrummond/webpasswordsafe/issues/120

Kind: instance method of WPS
Returns: Promise.<Password> - The newly updated password, without the actual value.

| Param | Type | Description | | --- | --- | --- | | password | Password | The password to update. |