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 🙏

© 2026 – Pkg Stats / Ryan Hefner

tegula

v1.0.0

Published

Tegula

Downloads

11

Readme

Tegula

Tegula is a low level abstraction layer for securely decentralizing the world's listing data, developed and maintained by imbrex. The core of the package is three main classes:

  1. Decentralizer: the raw connection layer enabling adding and retrieving data directly to IPFS as well as in a structured event log via OrbitDB on IPFS
  2. Encrypter: the encryption layer that securely encrypts/decrypts JSON data with a given key
  3. Identifier: the identification layer for uniquely, and consistently, generating UPIs (Universal Property Identifiers) for listings based on their geo-coordinates

These three classes come together in the ListingController and then abstracted one step further in the Tegula class (which is what gets exposed by default). At the Tegula level the three agnostic classes listed above are wrapped in listing-specific logic that enables the easy addition and retrieval of listings given a user address and an encryption key.


Installation

This package can be install via npm

npm install --save tegula

Basic Usage

Initialize

// import the package
const Tegula = require("tegula");
// setup a new class instance
const tegula = new Tegula();

// initialize everything
tegula.initialize().then(() => {
  // now you're good to go!
});

// OR if you're inside an async method already
await tegula.initialize();

Set Address and Encryption Keys

// ...

tegula.initialize().then(async () => {
  await tegula.setUserAddress("0xAbC...");
  await tegula.setEncryptionKey("some-encryption-key");
});

Add a Listing

// ...

tegula.initialize().then(async () => {
  // ...

  const listingData = { latitude: 123.456789, longitude: 123.456789, ... };
  await tegula.addListing(listingData);
});

Fetch Listings for a given Address

// ...
tegula.initialize().then(async () => {
  // ...

  // Option 1: use previously set encryption key and user address values
  const listings = await tegula.getListings();
  // Option 2: pass in one-time use
  const listings = await tegula.getListings("some-encryption-key", "0xAbC");
});

For a more complete list of available methods, visit API.md


Dependencies

  • Crypto-JS - node crypto library universally available and used here for encryption
  • IPFS - decentralized file storage
  • OrbitDB - database methods atop IPFS
  • Web3 - Ethereum wrapper used here for address validation and sha3 hashing

DevDependencies


Project Structure

This project is split into a few main directories:

  1. dist/ - this is where the actual built and minified files live
  2. examples/ - some quick example files for using the various classes
  3. src/ - the raw source code
  4. test/ - unit tests for everything in src
├── .cicleci/
├──── config.yml
├── dist/
├── examples/
├──── decentralizer.example.js
├──── encrypter.example.js
├──── identifier.example.js
├──── tegula.example.js
├── node_modules/
├── src/
├──── decentralizer.js
├──── encrypter.js
├──── identifier.js
├──── index.js
├──── listing-controller.js
├──── tegula.js
├── test/
├──── _setup.js
├──── decentralizer.test.js
├──── encrypter.test.js
├──── identifier.test.js
├──── listing-controller.test.js
├──── tegula.test.js
├── .eslintignore
├── .eslintrc.json
├── .npmignore
├── .prettierrc
├── API.md
├── guplfile.js
├── LICENSE
├── package-lock.json
├── package.json
├── README.md

Tests

Every logic file in the src/ directory has a corresponding test in the test/ directory. Each method is unit tested which consequently results in cross-class integration tests with the Tegula and ListingController class tests.

npm test

FAQ

What does it mean if I get ipfs-block-service error?
/tegula/node_modules/ipfs-block-service/src/index.js:64
      this._repo.blocks.put(block, callback)
                        ^

TypeError: Cannot read property 'put' of undefined

You're having a setup issue with IPFS, "... in order for me to solve it i deleted a file called repo.lock located in .jsipfs folder at the home directory". Read more here.