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

@lorena-ssi/wallet-lib

v1.1.6

Published

Lorena Wallet

Downloads

21

Readme

Lorena Wallet Library

Build Status Coverage Status

The Lorena Wallet Library provides a method for storage, encryption, and retrieval of sensitive information such as private keys and verifiable credentials. This library is useful in back-end Javascript server applications (such as NodeJS) or in front-end Javascript (such as Vue, React, or React Native).

The library provides interfaces appropriate for interaction with the Lorena SDK, and it is used in the Lorena Terminal.

Overview

Diagram

Storage methods

The library includes implementation of in-memory and filesystem storage methods (useful for console applications, server back-ends, or tests). For use in a web application the storage can be implemented in a derived class to take advantage of browser local storage; for mobile applications the mobile SDK should be used.

Filesystem

The default implementation works with a POSIX filesystem, storing the data in the user's home directory under the subdirectory .lorena/wallets with the filename being the wallet username (e.g. ~/.lorena/wallets/myUserName). The file is encrypted with the password.

Encryption

Encryption uses Zenroom, a cryptographic virtual machine that provides cross-platform, safe and reliable encryption.

Usage

npm install @lorena-ssi/wallet-lib
const Wallet = require('@lorena-ssi/wallet-lib').default

const options = {
  storage: 'fs', // default in the filesystem; 'mem' for in-memory
  silent: true // default silences Zenroom debugging messages
}

// create your instance of the wallet with the username supplied
const myWallet = new Wallet('myUserName', options)

// attempt to unlock an existing wallet (since it is in-memory, this will be `false`)
let result = myWallet.unlock('myPassword')

// this is a new wallet, so `unlock` returned `false`.
assert(result === false)

myWallet.info.myData = 'this is my sensitive data'

// write changes to disk (encrypted: you need to supply the password)
result = myWallet.lock('myPassword')

// successful (password correct, data saved)
assert(result === true)

// data is stored on the filesystem, encrypted with the password

//////////////////////////
//  start a new session

// create your instance of the wallet with the username supplied
const myWallet2 = new Wallet('myUserName', options)

// try to unlock with the wrong password
result = myWallet2.unlock('someOtherPassword')

// will not work
assert(result === false)

// Read encrypted data
result = myWallet2.unlock('myPassword')

// successful (password correct)
assert(result === true)

// Data that you saved in the previous session is now loaded.
assert(myWallet2.info.myData === 'this is my sensitive data')

// add more data
myWallet2.info.moreData = 'additional secrets'

// write changes to disk (encrypted: you need to supply the password)
result = myWallet2.lock('myPassword')

// successful (password correct, data saved)
assert(result === true)

License

MIT