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

cc-metadata-server

v0.1.1

Published

REST API server for fetching and sharing ColoredCoins transactions metadata

Downloads

7

Readme

ColoredCoins Metadata Server

Slack Channel

js-standard-style

REST API server for fetching and sharing ColoredCoins transactions metadata.

Getting Started

Installation

$ npm i -g cc-metadata-server

Run

Currently, the server uses AWS S3 storage service as a caching layer. So, in order to use the server one needs to set the environment variables:

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_S3_BUCKET

Then, you can run the ColoredCoins metadata server with the following options:

$ cc-metadata-server [options]

  Options:

    -h, --help                                         output usage information
    -V, --version                                      output the version number
    -p, --port <port>                                  Port to listen on

Or just run it with the defaults using:

$ cc-metadata-server

API

GET /getMetadata

  • Query Parameters:

    • torrentHash hex string of length 40, representing the SHA1 result of the origin metadata torrent file
    • sha2 hex string of length 64, the SHA256 result of JSON.stringify() of the origin metadata
  • Success Response:

    Code: 200 OK Content: The origin metadata JSON

  • Error Response:

    Code: 400 Bad Request Content: "Can't get metadata" In case no file which correponds to given torrentHash and sha2 is found.

POST /addMetadata

  • Body Parameters:

    • metadata JSON
    • token JWT encoded by secret given in environment variable JWTTOKENSECRET. Decode is of the format {iss: 'admin', exp: 'expiration'}. If JWTTOKENSECRET environment variable (or corresponding properties file field) is not given, this parameter is ignored.
  • Success Response:

    Code: 200 OK Content: Object which consists of the following:

    • torrentHash hex string of length 40, representing the SHA1 result of the origin metadata torrent file
    • sha2 hex string of length 64, the SHA256 result of JSON.stringify() of the origin metadata
  • Error Response:

    Code: 401 Unauthorized In case given token is not as expected.

GET /shareMetadata

  • Query parameters

    • torrentHash hex string of length 40, representing the SHA1 result of the origin metadata torrent file
    • token JWT encoded by secret given in environment variable JWTTOKENSECRET. Decode is of the format {iss: 'admin', exp: 'expiration'}. If JWTTOKENSECRET environment variable (or corresponding properties file field) is not given, this parameter is ignored.
  • Success Response:

    Code: 200 OK Content: The metadata file which has torrent which corresponds to torrentHash, is seeded to BitTorrent network.

  • Error Response:

    Code: 401 Unauthorized In case given token is not as expected.

    Code: 400 Bad Request Content: "Can't share metadata" In case no file which corresponds to torrentHash is found.

Note: this call should be preceded by a call to POST /addMetadata

Configuration

Default configuration per environment (NODE_ENV value) can be found in the config directory. You can use custom properties by adding properties.conf to that folder.

Development

  1. Fork this repo
  2. npm install
  3. use the Standard coding style when hacking the code - https://github.com/feross/standard
  4. Send us a pull request

Hosted Server

ColoredCoins maintains a hosted version of this server at: https://prod-metadata.coloredcoins.org

License

Apache-2.0