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

@bitbounti-oss/tangly

v1.0.0-beta

Published

A library for storing and querying identity related data on the IOTA Tangle

Downloads

4

Readme

Tangly: Identity library for the IOTA Tangle

Tangly (tangle + identity) interfaces with the IOTA Tangle; allowing for storing and retrieving data based on a seed. Instead of a user registering and sending sensitive data to a centralized data store, user data is encrypted based off of the user's seed that only the user knows and stored in the decentralized Tangle. The Tangle has the unique property of having free transactions which allows for data to be stored through Tangly one field at a time. Data is then retrieved and decrypted based off of a user's seed. No sensitive data needs to touch a centralized database, not even a username and password.

It is sometimes necessary to store meta data like user reputation and stats. Tangly allows you to add an "anchor" ID to the Tangle which can be stored in a centralized database. This anchor ID can be retrieved from the tangle to be used to send meta data to a database.

Quick Start

Installation

npm install --save tangly

Demo

npm run demo

Client-side usage

<--! example.html -->
<script src="./node_modules/iota.lib.js/dist/iota.js"></script>
<script src="./node_modules/crypto-js/crypto-js.js"></script>
<script src="./node_modules/tangly/dist/tangly.js"></script>
// example.js
const tangly = new window.tangly({
  seed: 'your_seed',
  node: 'https://testnet140.tangle.works'  // testnet node. Can use testnet or mainnet
})

tangly.find({}).then(data => data)

Server-side usage

// server.js
const Tangly = require('tangly');

const tangly = new Tangly({
  seed: 'your_seed',
  node: 'https://testnet140.tangle.works'  // testnet node. Can use any testnet or mainnet node
});

tangly.insert({ firstName: "Jane" })
  .then(data => data)

API

tangly.generateSeed()

Generate a random seed.

Input

tangly.generateSeed()
Example
const seed = tangly.generateSeed()

Return Value

  • String: Generated seed
Example
'VOOGDWRRNECRXZTAASVMYZPONDFBAURNFPLFHKIBKXYCIKPISAIXIGCWVNERD9OUEIBZUZCVCRSFFJHGY'

tangly.insert()

Insert an object into the Tangle by attaching a zero-value transaction.

Input

tangly.insert(data, options)
  • data (Object) required: Data you will be attaching to the tangle.
  • options (Object) optional: Tangle meta data.
    • tag (String): Tryte-encoded tag. Maximum value is 27 trytes.
Example
tangly.insert(
    {
      firstName: "Jane",
      lastName: "Doe"
    },
    {
      tag: 'SuperDescriptiveTag'
    }
  ).then(data => data)

Return Value

  • Object
    • address (String): Address that was used to insert data into the Tangle.
    • tag (String): Tag that was assigned.
Example
{
  address: 'W9AZFNWZZZNTAQIOOGYZHKYJHSVMALVTWJSSZDDRVEIXXWPNWEALONZLPQPTCDZRZLHNIHSUKZRSZAZ9W',
  tag: 'SUPER9DESCRIPTIVE9TAG'
}

tangly.find()

Find data that was inserted by the specified seed.

Input

tangly.find(field, options)
  • field (String) required: The name of the field you are attempting to find. An empty string will return all fields.
  • options (Object) optional: Optional search parameters.
    • history (Boolean) default false: Flag to return a field's history.
Example
Single field query
tangly.find('firstName', { history: false }).then(data => data)
All fields query
tangly.find('', { history: true }).then(data => data)

Return Value

  • Object
    • fieldName (Object)
      • value (Any)
      • timestamp (String)
Example
Without history
{
  firstName: {
    value: "Jane",
    timestamp: '3534534234'
  }
  lastName: {
    value: "Doe",
    timestamp: '3534534234'
  }
}
With history
{
  firstName: {
    value: 'Jane',
    timestamp: '34567893233',
    history: [
      {
        value: 'jaane'
        timestamp: '3456789876'
      }
    ]
  }
}

TODO: tangly.addAnchorId()


TODO: tangly.getAnchorId()