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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@smontero/hashed-confidential-docs

v0.2.27

Published

Client API that handles in browser encryption and interacts with the hashed confidential docs pallet

Readme

Hashed Confidential Docs Client API

Enables the usage of the Hashed Confidential docs services by client applications.

To install the hashed private client api run the following command:

npm i --save @smontero/hashed-confidential-docs

Access to most of the functionality is done through the HashedConfidentailDocs object which enables its configuration and provides access to the different API objects:

import { HashedConfidentialDocs } from '@smontero/hashed-confidential-docs'

A new instance of the HashedConfidentialDocs class has to be created passing in the ipfs url, ipfs auth header, polkadot service class instance and a faucet instance:

const hcd = new HashedConfidentialDocs({
    ipfsURL: 'https://ipfs.infura.io:5001',
    ipfsAuthHeader: `Basic ${Buffer.from(`${process.env.IPFS_PROJECT_ID}:${process.env.IPFS_PROJECT_SECRET}`).toString('base64')}`,
    polkadot,
    faucet
  })

Then the user has to be logged in to hashed confidential docs, to login the user a VaultAuthProvider is required, the VaultAuthProvider used depends on how the user is login in to the system ex. username/password, google sign in or a native wallet, the current auth channels are:

The creation and initialization of a vaultAuthProvider is done through creation methods which are exported from this package while the classes themselves are not.

  const vaultAuthProvider = await createPasswordVaultAuthProvider({
        authName, // the name to identify this auth channel
        jwt, // the JSON Web Token generated by the authentication channel
        faucetServerUrl, //the url for the hashed faucet server
        password
      })
const vaultAuthProvider = await createGoogleVaultAuthProvider({
      authName, // the name to identify this auth channel
      jwt, // the JSON Web Token generated by the authentication channel
      faucetServerUrl, //the url for the hashed faucet server
      googleDrive //instance of the google drive service class
    })

During the VaultAuthProvider creation, the jwt token is verified, after the creation of the VaultAuthProvider the decoded can be accessed as follows:

vaultAuthProvider.decodedJWT

await hcd.login(vaultAuthProvider)

Its important to note that the polkadot service class instance passed in to the hashed confidential docs will be configured with a VaultWallet when the user is logged in, that will enable this instance to be used to call extrinsics and sign on behalf of the user.

Once logged in the services provided by the OwnedData,SharedData and Group objects can be accessed.

OwnedData services

  • add: Store a payload(object or File) in the hashed private service
const ownedData = await hcd.ownedData().add({
    name: 'name1',
    description: 'desc1',
    payload: {
      prop1: 1,
      prop2: 'str1'
    }
  })
  • viewByCID: View a stored payload by owned data cid, returns the deciphered payload(object or File)
const ownedData = await hcd.ownedData().viewByCID(cid)

SharedData services

  • share: Share the specified existing owned data record with another user
let sharedData = await hp.sharedData().share({
  toUserAddress: '5FSuxe2q7qCYKie8yqmM56U4ovD1YtBb3DoPzGKjwZ98vxua',
  name: 'name1',
  description: 'desc1',
  payload: {
    prop1: 1,
    prop2: 'str1'
  }
})
  • viewByCID: View a stored payload by shared data cid, returns the deciphered payload(object or File)
const ownedData = await hcd.sharedData().viewByCID(cid)

Group services

  • createGroup: Creates a new group with the logged in user as the owner
const group = await hcd.group().createGroup('test1')
  • addGroupMember: Adds a member to the specified group, only owners and admins are able to add members
await hcd.group().addGroupMember({
      groupAddress: group.group,
      memberAddress,
      role: GroupRole.MEMBER
    })

Export Vault

const exporter = BrowserDownloadExporter()
await hcd.vault().exportVault(exporter)